Advertisement
Guest User

Untitled

a guest
Apr 28th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Adds custom usertags to the Oasis profile masthead
  3.  *
  4.  * @author Rappy 4187 <http://c.wikia.com/wiki/User:Rappy_4187>
  5.  * @author Cqm        <http://c.wikia.com/wiki/User:Cqm>
  6.  */
  7.  
  8. $( function () {
  9.  
  10.     var title = mw.config.get( 'wgTitle' ),
  11.         rights = {
  12.             // BUREAUCRATS
  13.             'John Trololo':       ['Bureaucrat'],
  14.             'Think D. Solucer':   ['Bureaucrate'],
  15.  
  16.             // ADMINISTRATORS
  17.             'Emperor Jarjarkine': ['Administrateur', 'MDM-Décembre 2013'],
  18.  
  19.             // Conseil
  20.             'Portgas D. Dohv':    ['Conseiller'],
  21.             'ImpactZone':         ['Conseiller'],
  22.             'WolfIce':            ['Conseiller'],
  23.             'TehBlaaz':           ['Conseiller'],
  24.  
  25.             // Patrouilleurs
  26.             'insertnamehere':     ['Patrouilleurs'],
  27.  
  28.             // Membres de confiance
  29.             'Hulothe':            ['Membre de Confiance'],
  30.             'Matauf':             ['Membre de Confiance'],
  31.             'TombRaiser':         ['Membre de Confiance']
  32.         },
  33.         toAdd,
  34.         i,
  35.         len;
  36.  
  37.     if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Contributions' ) {
  38.         title = title.split( '/' )[1];
  39.     }
  40.  
  41.     if ( rights[title] ) {
  42.         // remove old rights
  43.         $('.UserProfileMasthead .masthead-info span.tag').remove();
  44.  
  45.         toAdd = rights[title];
  46.         len = toAdd.length;
  47.  
  48.         for ( i = 0; i < len; i++ ) {
  49.             // add new rights
  50.             $( '<span>' )
  51.                 .text( toAdd[i] )
  52.                 .addClass( 'tag' )
  53.                 .appendTo( '.masthead-info hgroup' );
  54.         }
  55.     }
  56.  
  57. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement