Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

[Free Nodelet Hack] Highlight monk names accordingly their XP level

by ccn (Vicar)
on Mar 21, 2009 at 15:06 UTC ( #752253=monkdiscuss: print w/ replies, xml ) Need Help??

I've returned back to PM after several weeks of absence and have faced with huge Newest Nodes list. I have no time to read each new topic, so I need to filter the list. There are two criteria I have here. Thery are familiar names and XP level.

Update: Originally I had written a greasemonkey script Here it is. kindzadza.user.js Thanks to jettero and ambrus for directing me to make a Free Nodelet version of the script

Put the following code to your Free Nodelet Settings
<style type="text/css"> .Pope { font-weight: bold; color: #01C2F3 !important; } /* blu +e pants */ .Saint { font-weight: bold; color: #F400B1 !important; } /* cri +mson pants */ .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: #FFFF00 !important; } /* yel +low pants */ .Canon { font-weight: bold; color: #FFFF00 !important; } .Abbot { font-weight: bold; color: #FFFF00 !important; } .Monsignor { font-weight: bold; color: #7A4DB3 !important; } /* lil +ac pants */ .Prior { font-weight: bold; color: #7A4DB3 !important; } .Parson { font-weight: bold; color: #7A4DB3 !important; } .Vicar { font-weight: bold; color: #51AE5A !important; } /* gre +en pants */ .Priest { font-weight: bold; color: #51AE5A !important; } .Curate { font-weight: bold; color: #51AE5A !important; } .HighPriority { font-weight: bold; background-color: #FF8000 !importan +t; } /* orange pants */ </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(); var Pope = [979]; for( var i=Pope.length-1; i>=0; i--) SaintsBook[Pope[i]] = 'Pope'; var Saint = [171588]; for( var i=Saint.length-1; i>=0; i--) SaintsBook[Saint[i]] = 'Saint'; var Cardinal = [9073, 381608]; for( var i=Cardinal.length-1; i>=0; i--) SaintsBook[Cardinal[i]] = 'Ca +rdinal'; var Archbishop = [17000, 5348, 85580, 22609, 82147, 26179]; for( var i=Archbishop.length-1; i>=0; i--) SaintsBook[Archbishop[i]] = + 'Archbishop'; var Bishop = [1382, 461912, 29008, 169744]; for( var i=Bishop.length-1; i>=0; i--) SaintsBook[Bishop[i]] = 'Bishop +'; var Chancellor = [22308, 18800, 131741, 114691, 104919, 58196, 2680, 8 +0749, 180961, 186362, 366986, 108447]; for( var i=Chancellor.length-1; i>=0; i--) SaintsBook[Chancellor[i]] = + 'Chancellor'; var Canon = [281137, 1936, 157432, 616540, 123953, 194920, 21156, 4098 +50, 44715, 224409, 299049, 190859, 211692, 57126]; for( var i=Canon.length-1; i>=0; i--) SaintsBook[Canon[i]] = 'Canon'; var Abbot = [421114, 107642, 9346, 57097, 132236, 290905, 510280, 1271 +16, 87452, 131279, 198160, 585085, 118343, 25626, 170442, 159343, 182 +681, 195718, 368189, 65703, 324763, 146981]; for( var i=Abbot.length-1; i>=0; i--) SaintsBook[Abbot[i]] = 'Abbot'; var Monsignor = [442602, 352046, 16260, 33117, 155876, 268515, 176576, + 144850, 465654, 326529, 31503, 300037, 237051, 83485, 72267, 45414, +8930, 166227, 277846, 145001, 483556, 104238, 53423, 2698, 295576, 95 +47, 160333, 80322, 133383, 167085, 272239, 187037]; for( var i=Monsignor.length-1; i>=0; i--) SaintsBook[Monsignor[i]] = ' +Monsignor'; var Prior = [241598, 611550, 149104, 137386, 245082, 25047, 580097, 95 +145, 439528, 315586, 139958, 105128, 70929, 9270, 375665, 119620, 249 +603, 4677, 126161, 266955, 10277, 77866, 401112, 524150, 248054, 1460 +55, 14909, 163683, 16186, 154315, 67275, 113686, 49599, 87399, 190016 +, 33341, 139399]; for( var i=Prior.length-1; i>=0; i--) SaintsBook[Prior[i]] = 'Prior'; var Parson = [31548, 45366, 43546, 62512, 273627, 534893, 287641, 6110 +4, 75719, 3537, 109358, 159887, 72516, 221638, 373533, 360010, 6041, +76537, 27402, 603247, 168548, 16034, 2675, 153214, 474411, 123291, 25 +235, 127307, 24736, 151991, 8656, 169829, 326280, 230012, 133118, 417 +993, 446266, 57426, 329777, 5993, 170000, 622051, 263384, 494652, 368 +438, 533863, 72806, 213642, 155191, 209409, 231445, 186342, 95917, 10 +261, 375088, 292373, 10395, 59514]; for( var i=Parson.length-1; i>=0; i--) SaintsBook[Parson[i]] = 'Parson +'; var Vicar = [142528, 104914, 3737, 23317, 373431, 84630, 43019, 394193 +, 33345, 72812, 63250, 388230, 56739, 17251, 80839, 396583, 132645, 3 +25183, 16098, 194370, 5403, 647878, 70099, 295259, 350468, 345630, 18 +0139, 81749, 89333, 3607, 420266, 32155, 128274, 471998, 272750, 1559 +73, 169799, 382261, 228394, 25825, 468064, 73441, 195379, 439923, 562 +70, 85567, 9135, 250038, 386673, 222593, 120013, 53200, 116292, 30479 +6, 95704, 341121, 6415, 61798, 460657, 64906, 34691, 258724, 228902, +448370, 178258, 31579, 5549, 173932, 16711, 321512, 535734, 281009, 1 +41380, 269874, 103111]; for( var i=Vicar.length-1; i>=0; i--) SaintsBook[Vicar[i]] = 'Vicar'; var Priest = [218773, 369157, 16202, 45391, 127547, 28188, 77235, 5286 +46, 110976, 25823, 194928, 131494, 233329, 71127, 296575, 144696, 502 +468, 203787, 89299, 57755, 261960, 44950, 217641, 245320, 9685, 35051 +2, 330779, 294463, 209598, 204547, 141348, 421540, 22772, 47040, 1069 +49, 8948, 107600, 159943, 186172, 8119, 131165, 351094, 298378, 19091 +8, 227499, 8157, 184322, 373324, 310484, 480254, 131262, 111406, 1753 +25, 313535, 253915, 62377, 162891, 49266, 391408, 186684, 69487, 2233 +11, 184363, 20087, 489086, 153701, 89780, 299295, 36133, 258928, 1169 +37, 178658, 218135, 540414, 139427, 416961, 201687, 336451, 472157, 1 +10201, 47597, 247561, 373188, 310822, 65521, 49324, 343950, 17361, 57 +6594, 277600, 253850, 41288, 29600, 36507, 45946, 80543, 177604, 1033 +44, 74129, 205152, 2610, 438717, 468061, 699288, 332319, 290288, 2127 +89, 541305, 460541, 91903, 363393, 83012, 240337, 12207, 137449, 7348 +7, 133139, 489671, 235663, 464937]; for( var i=Priest.length-1; i>=0; i--) SaintsBook[Priest[i]] = 'Priest +'; var Curate = [197321, 7824, 272682, 393886, 2329, 90987, 37222, 163790 +, 189756, 394960, 56130, 211693, 231169, 38800, 5539, 28290, 67820, 8 +5161, 10795, 3568, 127435, 27919, 141786, 16834, 150658, 176753, 5024 +58, 565709, 6035, 555959, 9463, 43894, 129189, 11400, 129551, 209263, + 512600, 406189, 8911, 123017, 102902, 523944, 323154, 21569, 189168, + 12209, 233158, 8836, 509638, 347753, 18122, 174110, 83713, 125487, 7 +1198, 7056, 239281, 45674, 52296, 125863, 59285, 272364, 35324, 13629 +1, 460726, 236234, 123137, 415035, 31011, 244306, 97646, 31063, 19840 +, 10158, 152175, 277103, 243154, 114324, 23324, 493758, 1553, 33990, +222702, 59207, 260843, 69394, 185225, 150245, 59896, 20513, 41758, 91 +846, 85506, 58682, 387687, 154438, 126041, 79379, 169603, 81423, 2756 +05, 221484, 43868, 647953, 31280, 115801, 89172, 366581, 55272, 25282 +7, 16314, 110814, 125121, 5094, 52492, 289824, 512341, 5999, 132180, +5406, 270952, 74757, 326696, 11052, 46495, 446719, 485015, 219414, 66 +950, 600445, 19314, 128665, 395537, 116575, 5565, 227005, 68278, 1311 +28, 628526, 122163, 115693, 85412, 341073, 7102, 131381, 59531, 14627 +6, 51515, 52855, 424604, 409485, 60407, 196557, 200365, 150584, 23227 +, 48685, 136567, 114167, 108432, 46399, 162080, 53018, 522408, 101553 +, 7873, 1598, 63769, 40469, 287302, 363655, 53043, 11332, 21732, 9616 +9, 618967, 29772, 400549]; for( var i=Curate.length-1; i>=0; i--) SaintsBook[Curate[i]] = 'Curate +'; var HighPriority = [116292, 222593]; for( var i=HighPriority.length-1; i>=0; i--) SaintsBook[HighPriority[i +]] = 'HighPriority'; 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>

P.S. Please no holy-wars about "XP vs. Perl knowledge"

Comment on [Free Nodelet Hack] Highlight monk names accordingly their XP level
Download Code
Re: [gm_script] Highlight monk names accordingy their XP level
by jettero (Monsignor) on Mar 21, 2009 at 15:28 UTC
    greasemonkey seems like overkill when you have a free nodelet.

    -Paul

      I have them both. :)
      As I remember there is some size limit for Free Nodelet content. And this script is big.

        You can link to an external script file from your free nodelet.

Re: [Free Nodelet Hack] Highlight monk names accordingly their XP level
by zentara (Archbishop) on Mar 22, 2009 at 12:19 UTC
    I think we need a committee meeting to decide which color is assigned to which monk level. Some monks are very color-sensitive. I think we should hold this meeting at a very neutral location, like Blacks's Beach in La Hoya. ( I would have suggested Maui, but with this AIG thing...well...you know. ) :-)

    I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness
Re: [Free Nodelet Hack] Highlight monk names accordingly their XP level
by linuxer (Deacon) on Apr 04, 2009 at 20:17 UTC

    Hi,

    I did a minor change to your script.

    I think the used regex matches too many links. Any link, which includes the proper node_id=\d+ is highlighted (saw this on the home node of a highlighted user).

    Don't know if this is intentional, or not.

    As I wanted only to highlight links which direct to home nodes, I tried a fix and changed the regex from /node_id=(\d+)/ to /\?node_id=(\d+)$/:

    if ( /\?node_id=(\d+)$/.test(links[i].href) && SaintsBook[RegExp.$1] )

    Maybe it's a fix, maybe not.

    May it be helpful to others ;)

      Thank you, I did not vizit home nodes in that time and did not know about that side effect. Also I found that original color scheme is ugly. Here is more pretty one.
      <style type="text/css"> .Pope { font-weight: bold; color: #01C2F3 !important; } .Saint { 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>

        Thank you for the new style. It's indeed prettier and more readable than the previous one. I haven't found the time and/or motivation to hack on that. So thanks again, I like it.

Re: [Free Nodelet Hack] Highlight monk names accordingly their XP level
by ig (Vicar) on Apr 18, 2009 at 06:38 UTC

    Thanks for this. With tye's help I got it going today, and learned a bit about the Free Nodelet. Then I had fun with colours (and learned how the Other Users list is sorted).

    On the slim chance that someone else may share my odd aesthetic tastes, here is the colour scheme I came up with:

Re: [Free Nodelet Hack] Highlight monk names accordingly their XP level
by ig (Vicar) on May 23, 2009 at 04:17 UTC
      Thank you ig. Here is my stuff: I'd like to make a cgi version of that script but I have no suitable public site to publish it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-09-19 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (138 votes), past polls