Code:
- <script type="text/javascript">
- <!--
- /*
- Code Index v2 by Cr0w
- Copyright 2008
- Do not repost
- */
-
- //Last Update
- var lastup = "Sunday March 9th, 2008 12:51PM"; // Most recent update
-
- //Database Options
- var dbshow = 0; // 0 = Show index in board, 1 = Show index in thread
- var dbthread = 9; // The thread where your index will be [if dbshow = 1]
- var dbforum = "codeindex2"; // The board id where your index is in
- var dbwin = 0; // 0 = Open codes on same page, 1 = Open in new window
-
- //Sections
- var sections = [];
- sections[0]=["Category Name","Category ID"];
- sections[1]=["Category Name","Category ID"];
- sections[2]=["Category Name","Category ID"];
-
- //Creators
- var creators = [];
- creators[0] = ["Display Name 1","Username"]; // ID = 0
- creators[1] = ["Display Name 2","Username"]; // ID = 1
- creators[2] = ["Display Name 3","Username"]; // ID = 2
-
- //Codes
- var codes = []; var _cd = 0;
- codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
- codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
- codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
- codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
- codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
-
- //Do not edit below
-
- function showdb(){
- var td=document.getElementsByTagName("td");
- if(dbshow==1){
- for(t=6;t<td.length;t++){
- td[t].style.display="none";
- }
- }
-
- document.getElementById('code_database').innerHTML='<table cellspacing="1" cellpadding="4" class="border" width="'+vf_width+'" align="center" id="codedb"><tr><td class="title1" colspan="2" align="center">Code Database</td></tr><tr><td class="title2" width="20%" align="center">Navigation</td><td class="title2" width="80%" align="center">Main</td></tr><tr><td class="window1" width="20%" valign="top"><div id="navhere"></div><div id="searchit"></div></td><td class="window1" width="80%" valign="top"><div id="dbmain"></div></td></tr></table><br />';
- var nav=document.getElementById("navhere");
- var main=document.getElementById("dbmain");
- var search=document.getElementById("searchit");
- /* Categories */
- nav.innerHTML="";
- nav.innerHTML+="<b>Categories</b><br />";
- for(l=0;l<sections.length;l++){
- var catnum=l+1;
- nav.innerHTML+=catnum+". <a href='javascript:void(0)' onclick=\"catchange('"+sections[l][1]+"')\">"+sections[l][0]+"</a><br />";
- }
- nav.innerHTML+="<br />";
- nav.innerHTML+="<b>Other</b><br />";
- nav.innerHTML+="1. <a href='javascript:void(0)' onclick='location.reload()'>Recent Codes</a><br />";
- nav.innerHTML+="2. <a href='javascript:void(0)' onclick='showfulldb()'>All Codes</a><br />";
- nav.innerHTML+="3. <a href='javascript:void(0)' onclick='showcreators()'>All Coders</a><br />";
- nav.innerHTML+="4. <a href='javascript:void(0)' onclick='aboutdb()'>About</a><br /><br />";
-
- /* Main DB Page */
- main.innerHTML="";
- main.innerHTML+="<u><b>Database Info</b></u>";
- main.innerHTML+="<br />";
- main.innerHTML+="<b>Total Codes:</b> <a href='javascript:void(0)' onclick='showfulldb()'>"+codes.length+"</a><br />";
- main.innerHTML+="<b>Total Coders:</b> <a href='javascript:void(0)' onclick='showcreators()'>"+creators.length+"</a><br />";
- main.innerHTML+="<b>Last Updated:</b> "+lastup+"<br /><br />";
- main.innerHTML+="<b><u>Last 5 Codes</u></b><br /><br />";
- var FiveNew="";
- var num=1;
- for(t=codes.length-1;t>codes.length-6;t--){
- FiveNew+=num+". <a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[t][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[t][0]+"</a> by <a href = '/action/view_profile/user/"+creators[codes[t][2]][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+creators[codes[t][2]][0]+"</a><br />";
- num=num+1;
- }
- main.innerHTML+=FiveNew;
-
- /* Search DB */
- search.innerHTML="";
- search.innerHTML+="<b>Search:</b><br />";
- search.innerHTML+="<input type='text' id='lookfor' style='width: 60%' /> ";
- search.innerHTML+="<input type='submit' onclick='searchdb()' value='Go' />";
- }
-
- function searchdb(){
- codes.sort();
- sections.sort();
- var main=document.getElementById("dbmain");
- var searchthis=document.getElementById('lookfor');
- main.innerHTML="<b><u>Search Results</u></b><br /><br />";
- for(i=0;i<codes.length;i++){
- if(codes[i][0].match(new RegExp(searchthis.value, 'gi'))){
- main.innerHTML+="<b>-</b> <a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[i][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[i][0]+"</a> by <a href = '/action/view_profile/user/"+creators[codes[i][2]][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+creators[codes[i][2]][0]+"</a><br />";
- }
- }
- }
- function catchange(tothis){
- codes.sort();
- sections.sort();
- var main=document.getElementById("dbmain");
- main.innerHTML="";
- var num=1;
- for(q=0;q<codes.length;q++){
- if(codes[q][3]==tothis){
- main.innerHTML+=num+". <a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[q][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[q][0]+"</a> by <a href = '/action/view_profile/user/"+creators[codes[q][2]][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+creators[codes[q][2]][0]+"</a><br />";
- num=num+1;
- }
- }
- }
- function aboutdb(){
- codes.sort();
- sections.sort();
- var main=document.getElementById("dbmain");
- main.innerHTML="";
- main.innerHTML+="<b><u><font size='+1'>";
- main.innerHTML+="This code database is coded by <a href='http://support.virtualforums.co.uk/action/view_profile/user/cr0w'>Marc</a>. It is available for use by any forum, as long as it is not reposted without written permission from its creator.<br /><br />If you encounter any errors with this code, or find anyone who has reposted/ripped this code, please contact Marc using the link above. Thank you.";
- main.innerHTML+="</font></u></b>";
- }
- function showfulldb(){
- codes.sort();
- sections.sort();
- var main=document.getElementById("dbmain");
- main.innerHTML="";
- for(t=0;t<codes.length;t++){
- var t2=t+1;
- main.innerHTML+=t2+". <a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[t][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[t][0]+"</a> by <a href = '/action/view_profile/user/"+creators[codes[t][2]][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+creators[codes[t][2]][0]+"</a><br />";
- }
- }
- function showcreators(){
- creators.sort();
- var main=document.getElementById("dbmain");
- main.innerHTML="";
- for(t=0;t<creators.length;t++){
- main.innerHTML+="<a href = 'javascript: void();' onclick='showcodes("+t+")'>"+creators[t][0]+"</a><br />";
- }
- }
- function showcodes(cdr){
- codes.sort();
- var main=document.getElementById("dbmain");
- main.innerHTML="<b>Coder Profile: </b><a href = '/action/view_profile/user/"+creators[cdr][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+creators[cdr][0]+"</a><br /><br />";
- for(t=0;t<codes.length;t++){
- if(codes[t][2]==cdr){
- main.innerHTML+="<a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[t][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[t][0]+"</a><br />";
- }
- }
- }
- if(dbshow==1 && location.href.match("topic/"+dbthread) || dbshow==0 && !location.href.match("topic/")){
- showdb();
- }
- //-->
- </script>