Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Perlmonks Navigator

by tilly (Archbishop)
on Mar 18, 2001 at 05:46 UTC ( [id://65224]=sourcecode: print w/replies, xml ) Need Help??
Category: PerlMonks Related Scripts
Author/Contact Info
Description: First, while this is useful and Perlmonks related, it isn't Perl. It is JavaScript.

d/l the code, and save the two pieces marked with ##filename=foo.html## as what the name is supposed to be. Be sure cookies and JavaScript are on. Then point your browser at perlmonks.html, and try it out.

With this, this morning I was able to walk through every post for several days worth of PerlMonks in just a few hours. Most of that time was spent writing up responses. With this I can follow the whole site with less energy than it would take to hit a reasonable portion of it through using Newest Nodes.

Update
Clearly my cookie handling in JavaScript sucks. Oh well, I don't like either cookies or JavaScript, so I guess that was my internal bias showing. :-) Now fixed.

##filename=perlmonks.html##
<html>
  <head>
    <title>Perlmonks Navigator</title>
  </head>
 
  <frameset cols='10%,90%'>
    <frame name='control' src='nav.html' scrolling='yes'>
    <frame name='perlmonks'
      src='http://www.perlmonks.org/index.pl?node_id=26179' scrolling=
+'yes'>
  </frameset>
</html>

##filename=nav.html##
<html>
 <head>
  <title>Perlmonks Navigation Sidebar</title>
 </head>

 <body>
   <form name="nav_control">
     <input type="button" value="prev"  onClick="move(-1)"><br>
     <input type="button" value="next" onClick="move(1)"><p>
     <input type="text" size="8" name="article_no"><br>
     <input type="button" value="jump" onClick="move_to(document.nav_c
+ontrol.article_no.value)"><p>
     <input type="button" value="cookie" onClick="alert(document.cooki
+e)">
   </form>

   <script>
     var cookie_index = "pm_index";

     function get_next_year () {
       var year = new Date();
       year.setFullYear(year.getFullYear() + 1);
       return year;
     }

     // Takes the encoded name of the attrib, returns the decoded valu
+e
     function get_cookie_attrib (name) {
       var stored_as = unescape(name) + "=";
       var pieces = document.cookie.split(/; /);
         for (my_index in document.cookie.split("")) {
           var piece = pieces[my_index];
           if (null == piece)
             continue;
           if (0 == piece.indexOf(stored_as)) {
             var escaped_val = piece.substr(stored_as.length);
             return unescape(escaped_val);
           }
         }
       return null;
     }

     // Gets the current pos or "tilly"'s home node
     function get_cur_pos () {
       // Don't forget that this should be a number.
       var cur_pos = get_cookie_attrib(cookie_index) - 0;
       return (0 == cur_pos ? 26179 : cur_pos);
     }

     // Move forward or back
     function move (count) {
       move_to(get_cur_pos() + count);
     }

     // Takes an index, moves there.
     function move_to (pos) {
       set_cookie_attrib(cookie_index, pos);
       document.nav_control.article_no.value = pos;
       parent.perlmonks.location.href =
         "http://www.perlmonks.org/index.pl?node_id=" + pos;
     }

     // Takes a name/value, encodes and stores them in the cookie
     function set_cookie_attrib (name, value) {
       // This does not disturb other attributes.  Why?
       // Just another stupid JavaScript interface decision. :-(
       var cookie_str = escape(name) + "=" + escape(value);
       cookie_str += ";expires= " + get_next_year().toGMTString();
       document.cookie = cookie_str;
     }

     // Default location
     move_to(get_cur_pos());
   </script>

 </body>
</html>
Replies are listed 'Best First'.
Re: Perlmonks Navigator
by busunsl (Vicar) on Mar 19, 2001 at 13:26 UTC
    Nice work !

    It's working fine with Netscape 4.7x, but it doesn't work with Mozilla 0.8.
    But I think that's a bug in Mozilla :-(

      It's working fine under Mozilla 0.9.3 on my RedHat 6.2 box

      Good Stuff!

Re: Perlmonks Navigator
by poqui (Deacon) on Aug 16, 2001 at 18:52 UTC
    Its working fine in MS IE 5.5 too. Thanks for the tool!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://65224]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2025-06-17 01:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.