Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: [Free Nodelet Hack] Highlight monk names accordingly their XP level

by ccn (Vicar)
on May 25, 2009 at 21:27 UTC ( #766095=note: print w/ replies, xml ) Need Help??


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

Thank you ig. Here is my stuff:

#!/usr/bin/perl -- use strict; use warnings; use LWP::Simple; my $saints = get('http://perlmonks.org/?node=Saints%20in%20our%20Book' +) or die "Can't get saints list\n"; # a hash of something like ( 'Cardinal (24)' => [9073, 381608], ... ) my %levels = ( 'HighPriority (00)' => [ # users to be highlighted 116292, # mpeppler 679041, # oshalla 222593, # ccn ], ); push @{$levels{$2}}, $1 while $saints =~ m{user-(\d+).+?<td>(\w+ \(\d+)\)</td>}g; print <<'End_of_FreeNodelet_part_1'; [id://492700|Free Nodelet] <!-- Highlight monk names accordingly their XP level see http://perlmonks.org/?node_id=752253 for comments --> <style type="text/css"> .Pope { font-weight: bold; color: #01C2F3 !important; } .Saint { font-weight: bold; color: #F400B1 !important; } .Sage { font-weight: bold; color: #F400B1 !important; } .Cardinal { font-weight: bold; color: #F400B1 !important; } .Archbishop { font-weight: bold; color: #F400B1 !important; } .Bishop { font-weight: bold; color: #F400B1 !important; } .Chancellor { font-weight: bold; color: #FF8000 !important; } .Canon { font-weight: bold; color: #FF8000 !important; } .Abbot { font-weight: bold; color: #FF8000 !important; } .Monsignor { font-weight: bold; color: #BA4D73 !important; } .Prior { font-weight: bold; color: #BA4D73 !important; } .Parson { font-weight: bold; color: #BA4D73 !important; } .Vicar { font-weight: bold; color: #51AE5A !important; } .Priest { font-weight: bold; color: #51AE5A !important; } .Curate { font-weight: bold; color: #51AE5A !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(); End_of_FreeNodelet_part_1 for my $ra (sort {$b->[2] cmp $a->[2]} map {[$_, split / /, $_]} keys +%levels) { # $ra looks like ['Cardinal (24)', 'Cardinal', '(24)'] print "var $ra->[1] = [", join(', ', @{$levels{$ra->[0]}}), "];\n" +; print "for( var i=$ra->[1].length-1; i>=0; i--) SaintsBook[$ra->[1 +]\[i]] = '$ra->[1]';\n\n"; } print <<'End_of_FreeNodelet_part_2'; function Colorize() { var links = document.links; for( var i=links.length-1; i>=0 ; --i ) if ( /node_id=(\d+)/.test(links[i].href) && SaintsBook[RegExp. +$1] ) links[i].className = SaintsBook[RegExp.$1]; } setTimeout('Colorize()', 600); // --> </script> <!-- End of Highlight monk names accordingly their XP level --> End_of_FreeNodelet_part_2 __END__
I'd like to make a cgi version of that script but I have no suitable public site to publish it.


Comment on Re^2: [Free Nodelet Hack] Highlight monk names accordingly their XP level
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (19)
As of 2015-07-02 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (34 votes), past polls