vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: Code Index v2 - View Topic
Topic Rating: *****
Printable View
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 31
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Code Index v2 (9th Mar 08 at 6:24pm UTC)
Adds an improved code index to your board.
This is version two of my other Code Index. It adds a code index to your forum, allowing you to organize and display codes.

Preview

New Features:
- Show index in either board or thread
- Ability to open links in same/new window
- Show coders
- View codes by coder
- Total coders in database stats


This code comes in two parts.

Part 1: Board Header
Code:
 
  1. <div id="code_database"></div>
 


Part 2: Board Footer
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*
  4. Code Index v2 by Cr0w
  5. Copyright 2008
  6. Do not repost
  7. */
  8.  
  9. //Last Update
  10. var lastup = "Sunday March 9th, 2008 12:51PM"; // Most recent update
  11.  
  12. //Database Options
  13. var dbshow = 0; // 0 = Show index in board, 1 = Show index in thread
  14. var dbthread = 9; // The thread where your index will be [if dbshow = 1]
  15. var dbforum = "codeindex2"; // The board id where your index is in
  16. var dbwin = 0; // 0 = Open codes on same page, 1 = Open in new window
  17.  
  18. //Sections
  19. var sections = [];
  20. sections[0]=["Category Name","Category ID"];
  21. sections[1]=["Category Name","Category ID"];
  22. sections[2]=["Category Name","Category ID"];
  23.  
  24. //Creators
  25. var creators = [];
  26. creators[0] = ["Display Name 1","Username"]; // ID = 0
  27. creators[1] = ["Display Name 2","Username"]; // ID = 1
  28. creators[2] = ["Display Name 3","Username"]; // ID = 2
  29.  
  30. //Codes
  31. var codes = []; var _cd = 0;
  32. codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
  33. codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
  34. codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
  35. codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
  36. codes[_cd++] = ["Code Name","Thread Number","Creator ID","Category ID"];
  37.  
  38. //Do not edit below
  39.  
  40. function showdb(){
  41. var td=document.getElementsByTagName("td");
  42. if(dbshow==1){
  43. for(t=6;t<td.length;t++){
  44. td[t].style.display="none";
  45. }
  46. }
  47.  
  48. 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 />';
  49. var nav=document.getElementById("navhere");
  50. var main=document.getElementById("dbmain");
  51. var search=document.getElementById("searchit");
  52. /* Categories */
  53. nav.innerHTML="";
  54. nav.innerHTML+="<b>Categories</b><br />";
  55. for(l=0;l<sections.length;l++){
  56. var catnum=l+1;
  57. nav.innerHTML+=catnum+". <a href='javascript:void(0)' onclick=\"catchange('"+sections[l][1]+"')\">"+sections[l][0]+"</a><br />";
  58. }
  59. nav.innerHTML+="<br />";
  60. nav.innerHTML+="<b>Other</b><br />";
  61. nav.innerHTML+="1. <a href='javascript:void(0)' onclick='location.reload()'>Recent Codes</a><br />";
  62. nav.innerHTML+="2. <a href='javascript:void(0)' onclick='showfulldb()'>All Codes</a><br />";
  63. nav.innerHTML+="3. <a href='javascript:void(0)' onclick='showcreators()'>All Coders</a><br />";
  64. nav.innerHTML+="4. <a href='javascript:void(0)' onclick='aboutdb()'>About</a><br /><br />";
  65.  
  66. /* Main DB Page */
  67. main.innerHTML="";
  68. main.innerHTML+="<u><b>Database Info</b></u>";
  69. main.innerHTML+="<br />";
  70. main.innerHTML+="<b>Total Codes:</b> <a href='javascript:void(0)' onclick='showfulldb()'>"+codes.length+"</a><br />";
  71. main.innerHTML+="<b>Total Coders:</b> <a href='javascript:void(0)' onclick='showcreators()'>"+creators.length+"</a><br />";
  72. main.innerHTML+="<b>Last Updated:</b> "+lastup+"<br /><br />";
  73. main.innerHTML+="<b><u>Last 5 Codes</u></b><br /><br />";
  74. var FiveNew="";
  75. var num=1;
  76. for(t=codes.length-1;t>codes.length-6;t--){
  77. 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 />";
  78. num=num+1;
  79. }
  80. main.innerHTML+=FiveNew;
  81.  
  82. /* Search DB */
  83. search.innerHTML="";
  84. search.innerHTML+="<b>Search:</b><br />";
  85. search.innerHTML+="<input type='text' id='lookfor' style='width: 60%' /> ";
  86. search.innerHTML+="<input type='submit' onclick='searchdb()' value='Go' />";
  87. }
  88.  
  89. function searchdb(){
  90. codes.sort();
  91. sections.sort();
  92. var main=document.getElementById("dbmain");
  93. var searchthis=document.getElementById('lookfor');
  94. main.innerHTML="<b><u>Search Results</u></b><br /><br />";
  95. for(i=0;i<codes.length;i++){
  96. if(codes[i][0].match(new RegExp(searchthis.value, 'gi'))){
  97. 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 />";
  98. }
  99. }
  100. }
  101. function catchange(tothis){
  102. codes.sort();
  103. sections.sort();
  104. var main=document.getElementById("dbmain");
  105. main.innerHTML="";
  106. var num=1;
  107. for(q=0;q<codes.length;q++){
  108. if(codes[q][3]==tothis){
  109. 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 />";
  110. num=num+1;
  111. }
  112. }
  113. }
  114. function aboutdb(){
  115. codes.sort();
  116. sections.sort();
  117. var main=document.getElementById("dbmain");
  118. main.innerHTML="";
  119. main.innerHTML+="<b><u><font size='+1'>";
  120. 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.";
  121. main.innerHTML+="</font></u></b>";
  122. }
  123. function showfulldb(){
  124. codes.sort();
  125. sections.sort();
  126. var main=document.getElementById("dbmain");
  127. main.innerHTML="";
  128. for(t=0;t<codes.length;t++){
  129. var t2=t+1;
  130. 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 />";
  131. }
  132. }
  133. function showcreators(){
  134. creators.sort();
  135. var main=document.getElementById("dbmain");
  136. main.innerHTML="";
  137. for(t=0;t<creators.length;t++){
  138. main.innerHTML+="<a href = 'javascript: void();' onclick='showcodes("+t+")'>"+creators[t][0]+"</a><br />";
  139. }
  140. }
  141. function showcodes(cdr){
  142. codes.sort();
  143. var main=document.getElementById("dbmain");
  144. 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 />";
  145. for(t=0;t<codes.length;t++){
  146. if(codes[t][2]==cdr){
  147. main.innerHTML+="<a href='/board/"+dbforum+"/action/view_topic/topic/"+codes[t][1]+"/'"+((dbwin==1) ? " target='_blank'" : '')+">"+codes[t][0]+"</a><br />";
  148. }
  149. }
  150. }
  151. if(dbshow==1 && location.href.match("topic/"+dbthread) || dbshow==0 && !location.href.match("topic/")){
  152. showdb();
  153. }
  154. //-->
  155. </script>
 


Editing options are explained within the code itself. Both parts are needed for the code to work.

rroll.to— Shorten a link, rickroll your friends.
Alex Bailey
Senior Member
****

Posts: 503
Status: Offline
Gender: Male
Location: Uk
Age: 32
Joined:  
Reputation: 8%  


pmmsnaim
Re: Code Index v2 (9th Mar 08 at 6:36pm UTC)
Looks alot more complicated to edit

ting-tong2k6@hotmail.com
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 31
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Code Index v2 (9th Mar 08 at 6:40pm UTC)
 
Looks alot more complicated to edit


I tried to make it as easy as possible. {Wink}

rroll.to— Shorten a link, rickroll your friends.
Cryhavoc_
Full Member
***

Just do it.

Posts: 238
Status: Offline
Gender: Male
Location: The wrong way.
Age: 31
Joined:  
Reputation: 0%  


pm
Re: Code Index v2 (9th Mar 08 at 9:28pm UTC)
You could make it an admin editable. XD

Image

Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 31
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Code Index v2 (9th Mar 08 at 11:44pm UTC)
 
You could make it an admin editable. XD


Not to give anything away, but I'm trying to make it need less and less admin action; the next version won't even need header/footer access, so admins won't need to give mods Header/Footer access. {Wink}

rroll.to— Shorten a link, rickroll your friends.
ajay
Guest
Re: Code Index v2 (13th Mar 08 at 7:35pm UTC)
Great Code Thanks!
blanka
Full Member
***

[Avatar]

Posts: 319
Status: Offline
Gender: Male
Joined:  
Reputation: 10%  


pm
Re: Code Index v2 (19th Aug 08 at 12:28am UTC)
Would it be possible to change the "code database" into an "image database"? Thanks, Marc.
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 31
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Code Index v2 (19th Aug 08 at 1:25am UTC)
 
Would it be possible to change the "code database" into an "image database"? Thanks, Marc.


I'll code up a v2.5 shortly. {Wink}

rroll.to— Shorten a link, rickroll your friends.
blanka
Full Member
***

[Avatar]

Posts: 319
Status: Offline
Gender: Male
Joined:  
Reputation: 10%  


pm
Re: Code Index v2 (19th Aug 08 at 1:43am UTC)
 
 
Would it be possible to change the "code database" into an "image database"? Thanks, Marc.


I'll code up a v2.5 shortly. {Wink}

Okie Dokie. {Grin}
Alex Bailey
Senior Member
****

Posts: 503
Status: Offline
Gender: Male
Location: Uk
Age: 32
Joined:  
Reputation: 8%  


pmmsnaim
Re: Code Index v2 (19th Aug 08 at 1:50am UTC)
 
 
Would it be possible to change the "code database" into an "image database"? Thanks, Marc.


I'll code up a v2.5 shortly. {Wink}


*adds to marc's todo list*

OMG next year it will be released?

ting-tong2k6@hotmail.com
RuhRoe
Full Member
***

Posts: 218
Status: Offline
Gender: Male
Age: 29
Joined:  
Reputation: 5%  


pmxfire
Re: Code Index v2 (23rd Nov 08 at 7:14pm UTC)
Don't mean to rush you but when are you gonna get this done? {Tongue Out}
ajay
Guest
Re: Code Index v2 (25th Nov 08 at 12:48am UTC)
MARC GET IT DONE NOW!


Wow, some people are so impatient here.
Dave
New Member
*

Posts: 6
Status: Offline
Location: Bolton, Lancashire, UK
Age: 37
Joined:  
Reputation: 0%  


pmwwwmsn
Re: Code Index v2 (15th Apr 09 at 9:07pm UTC)
Im waiting for this too {Tongue Out}

Not as an image or code index

But as as index of something {Cheesy}

* secrets * {Tongue Out}
 Printable View

All times are GMT+0 :: The current time is 6:00am
Page generated in 4.0044 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums