Board Thread:General Discussion/@comment-5254530-20140406203815/@comment-26479628-20140407154750

function addMastheadTags( ) { var rights = { } ; // BEGIN List of Accounts Given Extra User Rights Icons - Must list all tags rights[ "Love Robin" ] = [ "Faculty" <span class="sy0" style="color:rgb(51,153,51);">, <span class="st0" style="color:rgb(51,102,204);">"13th Muse" <span class="br0" style="color:rgb(0,153,0);">] <span class="sy0" style="color:rgb(51,153,51);">; <span class="co1" style="font-style:italic;color:rgb(0,102,0);">// END List of Accounts Given Extra User Rights Icons <span class="co1" style="font-style:italic;color:rgb(0,102,0);">// BEGIN Script to Remove Old Rights Icons & Insert New <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">if <span class="br0" style="color:rgb(0,153,0);">( wgCanonicalSpecialPageName <span class="sy0" style="color:rgb(51,153,51);">== <span class="st0" style="color:rgb(51,102,204);">"Contributions" <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">{ <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">var user <span class="sy0" style="color:rgb(51,153,51);">= wgPageName.<span class="me1" style="color:rgb(102,0,102);">substring <span class="br0" style="color:rgb(0,153,0);">( wgPageName.<span class="me1" style="color:rgb(102,0,102);">lastIndexOf <span class="br0" style="color:rgb(0,153,0);">( <span class="st0" style="color:rgb(51,102,204);">"/" <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">+ <span class="nu0" style="color:rgb(204,0,0);">1 <span class="br0" style="color:rgb(0,153,0);">) .<span class="me1" style="color:rgb(102,0,102);">replace <span class="br0" style="color:rgb(0,153,0);">( <span class="co2" style="font-style:italic;color:rgb(0,153,102);">/_/g <span class="sy0" style="color:rgb(51,153,51);">, <span class="st0" style="color:rgb(51,102,204);">" " <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">; <span class="br0" style="color:rgb(0,153,0);">} <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">else <span class="br0" style="color:rgb(0,153,0);">{ <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">var user <span class="sy0" style="color:rgb(51,153,51);">= wgTitle<span class="sy0" style="color:rgb(51,153,51);">; <span class="br0" style="color:rgb(0,153,0);">} <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">if <span class="br0" style="color:rgb(0,153,0);">( <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">typeof rights<span class="br0" style="color:rgb(0,153,0);">[ user<span class="br0" style="color:rgb(0,153,0);">] <span class="sy0" style="color:rgb(51,153,51);">!= <span class="st0" style="color:rgb(51,102,204);">"undefined" <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">{ <span class="co1" style="font-style:italic;color:rgb(0,102,0);">// remove old rights $<span class="br0" style="color:rgb(0,153,0);">( <span class="st0" style="color:rgb(51,102,204);">'.UserProfileMasthead .masthead-info span.tag' <span class="br0" style="color:rgb(0,153,0);">) .<span class="me1" style="color:rgb(102,0,102);">remove <span class="br0" style="color:rgb(0,153,0);">( <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">; <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">for <span class="br0" style="color:rgb(0,153,0);">( <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">var i<span class="sy0" style="color:rgb(51,153,51);">= <span class="nu0" style="color:rgb(204,0,0);">0 <span class="sy0" style="color:rgb(51,153,51);">, len<span class="sy0" style="color:rgb(51,153,51);">= rights<span class="br0" style="color:rgb(0,153,0);">[ user<span class="br0" style="color:rgb(0,153,0);">] .<span class="me1" style="color:rgb(102,0,102);">length <span class="sy0" style="color:rgb(51,153,51);">; i <span class="sy0" style="color:rgb(51,153,51);">< len<span class="sy0" style="color:rgb(51,153,51);">; i<span class="sy0" style="color:rgb(51,153,51);">++ <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">{ <span class="co1" style="font-style:italic;color:rgb(0,102,0);">// add new rights $<span class="br0" style="color:rgb(0,153,0);">( <span class="st0" style="color:rgb(51,102,204);">'<span class="tag" span style="margin-left: 10px !important">' <span class="sy0" style="color:rgb(51,153,51);">+ rights<span class="br0" style="color:rgb(0,153,0);">[ user<span class="br0" style="color:rgb(0,153,0);">] <span class="br0" style="color:rgb(0,153,0);">[ i<span class="br0" style="color:rgb(0,153,0);">] <span class="sy0" style="color:rgb(51,153,51);">+           <span class="st0" style="color:rgb(51,102,204);">' ' <span class="br0" style="color:rgb(0,153,0);">) .<span class="me1" style="color:rgb(102,0,102);">appendTo <span class="br0" style="color:rgb(0,153,0);">( <span class="st0" style="color:rgb(51,102,204);">'.masthead-info hgroup' <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">; <span class="br0" style="color:rgb(0,153,0);">} <span class="br0" style="color:rgb(0,153,0);">} <span class="co1" style="font-style:italic;color:rgb(0,102,0);">// END Script to Remove Old Rights Icons & Insert New <span class="br0" style="color:rgb(0,153,0);">} <span class="sy0" style="color:rgb(51,153,51);">; $<span class="br0" style="color:rgb(0,153,0);">( <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">function <span class="br0" style="color:rgb(0,153,0);">( <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">{   <span class="kw1" style="font-weight:bold;color:rgb(0,0,102);">if <span class="br0" style="color:rgb(0,153,0);">( $<span class="br0" style="color:rgb(0,153,0);">( <span class="st0" style="color:rgb(51,102,204);">'#UserProfileMasthead' <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">) <span class="br0" style="color:rgb(0,153,0);">{      addMastheadTags<span class="br0" style="color:rgb(0,153,0);">( <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">;    <span class="br0" style="color:rgb(0,153,0);">}  <span class="br0" style="color:rgb(0,153,0);">} <span class="br0" style="color:rgb(0,153,0);">) <span class="sy0" style="color:rgb(51,153,51);">; <span class="sy0" style="color:rgb(51,153,51);">This should work.