http://qs321.pair.com?node_id=65224
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>