Advertise Here

Author Topic: [Code] Change Pages: To Drop Down Menu  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

Offline webworldx

  • Code Master's
  • *
  • Posts: 31
    • View Profile
    • InvisionFusion

  • Total Badges: 15
    Badges: (View All)
    Windows User Topic Starter Combination Level 3 Level 2
[Code] Change Pages: To Drop Down Menu
« on: June 26, 2006, 09:48:46 pm »
Code: [Select]
<script type='text/javascript'>
/*
Change Pages: To Drop Down Menu
Created by iFusion
*/
function send_to_page(val){
 location.href = location.href.replace(/.(\d+).html/i, "." + val + ".html");
}

if(location.href.match(/\/(topic|board)\//i) != null){
 var number_per_page = 15;

 var iTD = document.getElementsByTagName('TD');
 for(i=0;i<iTD.length;i++){
  if(iTD[i].firstChild && ((iTD[i].firstChild.tagName=="B" && iTD[i].firstChild.innerHTML == "Pages:") || (iTD[i].firstChild.tagName == "A" && iTD[i].firstChild.nextSibling && iTD[i].firstChild.nextSibling.innerHTML == "Pages:")) ){
   var iLinks = iTD[i].getElementsByTagName('A');
   var num_pages = 1;
   if(iLinks.length != 0 && iLinks[iLinks.length-1].className == "navPages") num_pages = Math.floor(iLinks[iLinks.length-1].innerHTML);
   if(iTD[i].lastChild.data.match(/\]/i) != null) num_pages += 1;
   var select_options = "<select onchange='send_to_page(this.value)'>";
   for(u=0;u<num_pages;u++){
     var myReg = new RegExp("." + (u * number_per_page) + ".html$");
     if(myReg.exec(location.href) != null){
      select_options += "<option value='"+ (u * number_per_page) + "' selected>" + (u+1) + "</option>";
     } else {
      select_options += "<option value='"+ (u * number_per_page) + "'>" + (u+1) + "</option>";
   }}
   iTD[i].innerHTML = select_options + "</select>";
}}}
</script>

Footer. You'll need to change:

var number_per_page = 15;

to how many topics/posts per page you've set to show, but that's about it.  Saves the page you're on, and links to the rest of them.
« Last Edit: August 27, 2007, 08:54:07 pm by simply sibyl »

 

Related Topics

  Subject / Started by Replies Last post
9 Replies
5150 Views
Last post August 05, 2008, 07:47:26 pm
by simply sibyl
2 Replies
4882 Views
Last post June 23, 2009, 05:18:57 pm
by Colette Brunel
0 Replies
18834 Views
Last post June 23, 2009, 06:27:54 pm
by simply sibyl
2 Replies
2319 Views
Last post September 16, 2009, 08:56:01 pm
by Simply1Nick
0 Replies
1294 Views
Last post September 15, 2009, 07:54:18 pm
by simply sibyl