Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Since monks keep getting promoted, here is a script to regenerate the javascript from the current Saints in our Book:

use strict; use warnings; use LWP::UserAgent; use HTML::TreeBuilder; my $ua = LWP::UserAgent->new(); $ua->agent("MyApp/0.1"); my $req = HTTP::Request->new(GET => 'http://perlmonks.org/?node=Saints +%20in%20our%20Book'); my $res = $ua->request($req); unless($res->is_success) { die $res->status_line; } my $tree = HTML::TreeBuilder->new(); $tree->parse($res->content); $tree->eof(); print <<'EOF' ; <style type="text/css"> .Pope { font-weight: bold; color: #FF3010 !important; } .Apostle { font-weight: bold; color: #F84020 !important; } .Saint { font-weight: bold; color: #F44030 !important; } .Sage { font-weight: bold; color: #F04040 !important; } .Cardinal { font-weight: bold; color: #E04050 !important; } .Archbishop { font-weight: bold; color: #D04060 !important; } .Bishop { font-weight: bold; color: #C03070 !important; } .Chancellor { font-weight: bold; color: #B03080 !important; } .Canon { font-weight: bold; color: #A03090 !important; } .Abbot { font-weight: bold; color: #9030A0 !important; } .Monsignor { font-weight: bold; color: #8020B0 !important; } .Prior { font-weight: bold; color: #7020C0 !important; } .Parson { font-weight: bold; color: #6020D0 !important; } .Vicar { font-weight: bold; color: #5020E0 !important; } .Priest { font-weight: bold; color: #4010F0 !important; } .Curate { font-weight: bold; color: #3010FF !important; } .HighPriority { font-weight: bold; background-color: #FFFF00 !importan +t; } </style> <script type="text/javascript"> <!-- // "When a society has no colored pants to differentiate class... // ...it's a society without purpose" -- Wef // http://en.wikipedia.org/wiki/Kin-dza-dza! var SaintsBook = new Object(); EOF dump_saints($tree); print <<'EOF' ; function Colorize() { var links = document.links; for( var i=links.length-1; i>=0 ; --i ) if ( /\?node_id=(\d+)$/.test(links[i].href) && SaintsBook[RegE +xp.$1] ) links[i].className = SaintsBook[RegExp.$1]; } setTimeout('Colorize()', 600); // --> </script> EOF sub dump_saints { my $element = shift; if($element->tag() eq 'table') { my @contents = $element->content_list; if(@contents > 10) { # The saints table has lots of rows my %saints; shift(@contents); # The first row is headers foreach my $row (@contents) { my ($id) = (((($row->content_list())[1]->content_list( +))[0]->content_list())[0]->attr('href') =~ m/=(.*)/); my ($level) = ((($row->content_list())[3]->content_lis +t())[0] =~ m/([^ ]*)/); push(@{$saints{$level}}, $id); } foreach my $level (keys %saints) { print "var $level = [" . join(',',@{$saints{$level}}) +. "];\nfor( var i=$level.length-1; i>=0; i--) SaintsBook[$level\[i]] += '$level';\n\n"; } } } foreach my $e ($element->content_list()) { if(ref($e) and $e->isa('HTML::Element')) { dump_saints($e); } } }

In reply to Re: [Free Nodelet Hack] Highlight monk names accordingly their XP level by ig
in thread [Free Nodelet Hack] Highlight monk names accordingly their XP level by ccn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2014-04-20 16:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls