vForums Support Banner Image



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: View Topic - Code Index v2
Printable View
cout << "Marc is busy";
vChat Developer
*****
I <­3 Ross

[Avatar]

Posts: 2,953
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 16
Joined: 9th Dec 2007

Additional Groups:
Coding Team

Reputation: 18%  



Code Index v2 (9th Mar 08 at 7:24pm)
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 Cr0w. 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 email Cr0w at <a href='mailto:admin@cr0wonline.com'>admin@cr0wonline.com</a>. 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.
Back to Top - Link to Post - Last edit: 9th Mar 08 at 7:27pm by cout << "Marc is busy";

Image


Image
.System
Full Member
***

[Avatar]

Posts: 489
Status: Offline
Gender: Male
Location: Uk
Age: 16
Joined: 30th Dec 2007
Reputation: 6%  



Re: Code Index v2 (9th Mar 08 at 7:36pm)
Looks alot more complicated to edit
Back to Top - Link to Post
cout << "Marc is busy";
vChat Developer
*****
I <­3 Ross

[Avatar]

Posts: 2,953
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 16
Joined: 9th Dec 2007

Additional Groups:
Coding Team

Reputation: 18%  



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



I tried to make it as easy as possible. Smiley
Back to Top - Link to Post

Image


Image
Cryhavoc_
Full Member
***

Just do it.

Posts: 238
Status: Offline
Gender: Male
Location: The wrong way.
Age: 15
Joined: 3rd Jan 2008
Reputation: 0%  



Re: Code Index v2 (9th Mar 08 at 10:28pm)
You could make it an admin editable. XD
Back to Top - Link to Post

Image

cout << "Marc is busy";
vChat Developer
*****
I <­3 Ross

[Avatar]

Posts: 2,953
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 16
Joined: 9th Dec 2007

Additional Groups:
Coding Team

Reputation: 18%  



Re: Code Index v2 (10th Mar 08 at 12:44am)
 
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. Smiley
Back to Top - Link to Post

Image


Image
Ajay
Senior Member
****

[Avatar]

Posts: 508
Status: Offline
Gender: Male
Location: Virtualforums Support
Age: 15
Joined: 19th Feb 2008
Reputation: 0%  



Re: Code Index v2 (13th Mar 08 at 8:35pm)
Great Code Thanks!
Back to Top - Link to Post

Image
blanka
Full Member
***

[Avatar]

Posts: 251
Status: Offline
Gender: Male
Joined: 30th Dec 2007
Reputation: 6%  



Re: Code Index v2 (19th Aug 08 at 1:28am)
Would it be possible to change the "code database" into an "image database"? Thanks, Marc.
Back to Top - Link to Post

Image Image
cout << "Marc is busy";
vChat Developer
*****
I <­3 Ross

[Avatar]

Posts: 2,953
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 16
Joined: 9th Dec 2007

Additional Groups:
Coding Team

Reputation: 18%  



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



I'll code up a v2.5 shortly. Smiley
Back to Top - Link to Post

Image


Image
blanka
Full Member
***

[Avatar]

Posts: 251
Status: Offline
Gender: Male
Joined: 30th Dec 2007
Reputation: 6%  



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



I'll code up a v2.5 shortly. Smiley


Okie Dokie. Smiley
Back to Top - Link to Post

Image Image
.System
Full Member
***

[Avatar]

Posts: 489
Status: Offline
Gender: Male
Location: Uk
Age: 16
Joined: 30th Dec 2007
Reputation: 6%  



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



I'll code up a v2.5 shortly. Smiley



*adds to marc's todo list*

OMG next year it will be released?
Back to Top - Link to Post
Printable View

All times are GMT+1 :: The current time is 11:17am
Page generated in 0.7145 seconds
with 22 Database Queries and 13 cache files
This Forum is Powered By vForums
Create a Forum for Free