Advertise Here

Author Topic: [Code] Code Index  (Read 2343 times)

0 Members and 1 Guest are viewing this topic.

Offline Agent Moose

  • Moderator
  • *****
  • Posts: 836
  • Do not PM me for Code Support or Request
    • View Profile

  • Total Badges: 32
    Badges: (View All)
    Search Level 6 Tenth year Anniversary Nineth year Anniversary Eighth year Anniversary
[Code] Code Index
« on: April 30, 2010, 10:12:45 am »
That's right!  I have finally decided to release the famous Code Index that I created for my forums, Simple Machine Codes and Revolution X!

Please note: This code isn't just for Coding boards, so use your imagination :)  It's is mainly just to index topics, to make it easier to go through :)

the set up is really quite simple, just a couple of steps:

Step 1: jQuery - Add this to the top of your headers if you don't have it already
Code: [Select]
<script type="text/javascript" src="/jquary.js"></script>
Step 2: The Main Code - Add to footers
Code: [Select]
<script type="text/javascript">
function CIv4(title,board,index){
/*
Code Index Created by Agent Moose
Released on: 4/30/2010
*/
if(location.href.match("." + index)){
document.title = title;
var navigation = $("div.nav").html();
var pages = $("tr td.middletext").html();
var online = $("tr.windowbg2 td[colspan='8']").html();
var Search = "<div class='catbg' style='padding: 5px 5px 5px 10px;'>Search " + title + "</div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='titlebg' width='100%'>Search</td></tr><tr><td class='windowbg2' width='100%'><center><form id='searchform' name='searchform' accept-charset='ISO-8859-1' method='post' action='" + smf_scripturl + "?action=search2'><input type='text' size='40' name='search' id='Index'/><input id='brd" + board + "' type='hidden' checked='checked' value='" + board + "' name='brd[" + board + "]'/><input type='submit' value='Search' name='submit'/></form></center></td></tr></table></div>";
$("img[alt='New'],#news_box,#bodyarea").hide();
$("#bodyarea").before("<br /><div class='nav' style='font-size: smaller; margin-bottom: 2ex; margin-top: 2ex;'>" + navigation + " > <b><a class='nav' href='" + smf_scripturl + "/board," + board + ".0." + index + "/sort,subject.html'>Code Index</a></b></div><br/><div class='tborder'>" + Search + "<br/><div class='tborder'><div class='catbg' style='padding: 5px 5px 5px 10px;'>" + title + " - <span class='smalltext'>Sort By: <a href='" + location.pathname + "/board," + board + ".0." + index + "/sort,replies/desc.html'>Replies</a> | <a href='" + smf_scripturl + "/board," + board+ ".0." + index + "/sort,views/desc.html'>Views</a> | <a href='" + smf_scripturl + "/board,"+ board + ".0." + index + "/sort,subject.html'>Subject</a></span></div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='titlebg2' colspan='5'>" + online + "</td></tr><tr><td class='titlebg2' colspan='5'>" + pages + "</td></tr><tr id='Codes' align='right'><td class='windowbg' colspan='2'><span class='smalltext'>© Code Index created by Agent Moose.</span></td></tr><tr><td class='titlebg2' colspan='5'>" + pages + "</td></tr></table>");
var Codes = document.getElementsByTagName("span");
for(x=0;x<Codes.length;x++){
if(Codes[x].id.match(/msg/i) && Codes[x].parentNode.className == "windowbg"){
var topic = Codes[x].innerHTML;
var creator = $(Codes[x]).parent().next().html();
$("#Codes").before("<tr><td class='windowbg2' width='50%'>" + topic + "</td><td class='windowbg2' width='50%'>" + creator + "</td></tr>");
};};
for(r=0;w = document.links;r++){
if(w[r].href.match(/\/sort,/i) && !w[r].href.match("." + index + "/sort,")){
w[r].href = w[r].href.replace("/sort,subject","." + index + "/sort,subject");
w[r].href = w[r].href.replace("/sort,starter","." + index + "/sort,starter");
w[r].href = w[r].href.replace("/sort,replies","." + index+"/sort,replies") ;
w[r].href = w[r].href.replace("/sort,views","." + index + "/sort,views");
};
if(w[r].href.match(/#bot/i)) w[r].style.display = "none";
};};};
CIv4("TITLE","BOARD ID","EXTENSION");
</script>

TITLE = The Title of the Index (EX: SMC Code Index)
BOARD ID = AKA Board Number you want to index.
EXTENSION = Tells which index you are on. (EX: for the SMC Code Index, it could be smcindex.  For a theme index, it could be themeindex.  NO SPACES ALLOWED!)

You may add more of these lines:
Code: [Select]
CIv4("TITLE","BOARD ID","EXTENSION");
Step 3: the Child Board - Creating the Child Board (optional)
Please note that you don't have to create a new child board each time you want to have another Index.  The Child Board is there to link to the index.  If you want to just give out a link instead of making a new child board, use this:
Code: [Select]
http://XXXXXX.smfforfreeX.com/index.php/BOARD_ID.0.EXTENSION/sort,subject.htmlAll you have to do is replace whats in all caps :) (The X's, BOARD_ID and EXTENSION which is exactly the same as you put above)

Childboard Setup
 - Create a child board (add it to the board you want the index to be on)
 - Use the following code as your "Full Name" Option
Code: [Select]
</a><a href="/index.php/board,BOARD_ID.0.EXTENSION/sort,subject.html">TITLE</a>BOARD_ID = The Board ID/number of the board you want to index.
EXTENSION = place the same EXTENSION you used above.
TITLE = The title of the index (just like above)
 - The rest of the information you can fill in as you wish.  You just need to edit the "Full Name" Option.


And that's it!  If you had done everything correctly, you would have something that looks similar to this:
http://smcodes.smfforfree3.com/index.php/board,8.0.smcindex/sort,subject.html


Enjoy :)
« Last Edit: April 30, 2010, 10:20:08 am by Agent Moose »
Check out Revolution X's Brand new Code Index!

Offline Andrew

  • Helpers
  • *
  • Posts: 2060
  • Andrew at your service
    • View Profile
    • Alabama Weather Prediction

  • Total Badges: 32
    Badges: (View All)
    10 Poll Votes Level 6 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary
Re: [Code] Code Index
« Reply #1 on: April 30, 2010, 04:00:26 pm »
Haha yess! Moosey finally revealed his secret Code Index. Wow didn't think it was that simple to be honest lol, I'll need to find some ways I can use this...

Thanks for the release! I'm sure it will be used by lots of people here!

Offline Jntg4

  • SMF For Free Sr. Member
  • *
  • Posts: 250
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Code Index
« Reply #2 on: May 02, 2010, 10:42:23 am »
I'll use this as a Sports Teams index

 

Related Topics

  Subject / Started by Replies Last post
7 Replies
4521 Views
Last post January 13, 2007, 01:27:43 pm
by Legend_Killer
8 Replies
4316 Views
Last post November 15, 2007, 11:58:56 am
by simply sibyl