User:Arashiryuu0/wikia.js

/* ####################################################################################    ########                                START                               ######## ####################################################################################

/*********************** ********** 0 ********** ***********************/

/** * Masthead Rights; Custom Tags * @author Rappy 4187 */ $(function { var rights = { Arashiryuu0: [      '全王',      '拳王',       '人殺し合'  ],  ShadowBeast109: [      'Administrator',       'Vampiric Overlord'  ],  Matsczon: [      'Bureaucrat',       'Duckman'  ],  Filename: [      'Emoji Dab Lad',       'Fallout: Las Vegas'  ],  IronChaos: [      'Lad',       'One of The Boys',       'Ginger',       'TheseHands™'  ],  LaVey: [      'Administrator',       'All Seeing Eye'  ] }; if(typeof rights[wgTitle] != 'undefined') {    info('mastheadRightsScript', 'Starting', '#ffcb6b');    // remove old rights    $('.UserProfileMasthead .masthead-info span.tag').remove;      for(var i = 0, len = rights[wgTitle].length; i < len; i++) {        // add new rights        $(' ' + rights[wgTitle][i] + ' ').appendTo('.masthead-info hgroup');     }    info('mastheadRightsScript', 'Done', '#ffcb6b'); } });

/*********************** ********** 1 ********** ***********************/

// Fix forum's "Edit-topic" and "follow" buttons $(function { // check for appropriate pages if(wgPageName.includes('Message_Wall') || wgPageName.includes('Thread')) {   info('buttonFixScript', 'Starting', '#c94f12');    var fb = $('li.edit-topic');    // edit-topic button    fb.addClass('button');    fb.children.first.css({ 'position':'relative', 'bottom':'3px', 'color':'white' });   // fixing follow buttons    $('.wikia-button.secondary').removeClass('secondary');    $('.wikia-menu-button.secondary').removeClass('secondary');    $('.related-topics .related-topic').css({'background-color':'#201c10'});    info('buttonFixScript', 'Done', '#c94f12'); } });

/*********************** ********** 2 ********** ***********************/

/* Adding a faux-bio section to my user profile $(function { if(wgTitle === 'Arashiryuu0') {    return $('.details ul').append($('', {     class: 'bio',     id: 'bio-content'     }).html(' Bio ' + 'お前はもう死んでいる'));  }   return; });

/* Test $( => {   const LRT = alert('This is a test.');    let x = prompt('Is this not JavaScript?'); }); /*********************************************************************************
 * Test Results                                                                **
 * Fandom does not support ES6 features, such as const, let, or arrow functions **
 * @return {null}                                                              **
 * @return {null}                                                              **
 * @return {null}                                                              **

/* #########################################################################################    ######                              CustomTagEdits                                  ##### #########################################################################################

/*********************** ********** 3 ********** ***********************/

$(function { if(wgTitle === 'Arashiryuu0') {    info('TagClassScript', 'Starting', '#ae0');    $('.tag:contains(\'全王\')').addClass('zen-ou');    $('.tag:contains(\'拳王\')').addClass('ken-ou');    info('TagClassScript', 'Finishing', '#ae0');    return $('.tag:contains(\'人殺し合\')').addClass('murderer');  } else  if(wgTitle === 'ShadowBeast109') {    info('TagClassScript', 'Starting', '#ae0');    $('.tag:contains(\'Administrator\')').addClass('admin');    info('TagClassScript', 'Finishing', '#ae0');    return $('.tag:contains(\'Vampiric Overlord\')').addClass('vamp');  } else  if(wgTitle === 'Matsczon') {    info('TagClassScript', 'Starting', '#ae0');    $('.tag:contains(\'Bureaucrat\')').addClass('crat');    info('TagClassScript', 'Finishing', '#ae0');    return $('.tag:contains(\'Duckman\')').addClass('duck');  } else  if(wgTitle === 'LaVey') {    info('TagClassScript', 'Starting', '#ae0'); $('.tag:contains(\'Administrator\')').addClass('admin'); info('TagClassScript', 'Finishing', '#ae0'); return $('.tag:contains(\'All Seeing Eye\')').addClass('eye'); } else if(wgTitle === 'Filename') { info('TagClassScript', 'Starting', '#ae0'); $('.tag:contains(\'Emoji Dab Lad\')').addClass('emoji-dab'); info('TagClassScript', 'Finishing', '#ae0'); return $('.tag:contains(\'Fallout: Las Vegas\')').addClass('las-vegas'); } else if(wgTitle === 'IronChaos') { info('TagClassScript', 'Starting', '#ae0'); $('.tag:contains(\'Lad\')').addClass('lad'); $('.tag:contains(\'One of The Boys\')').addClass('boys'); $('.tag:contains(\'Ginger\')').addClass('ginger'); info('TagClassScript', 'Finishing', '#ae0'); return $('.tag:contains(\'TheseHands™\')').addClass('these-hands'); } });

/* ####################################################################################    ########                        Utility Function(s)                         ######## ####################################################################################

/*********************** ********** 4 ********** ***********************/

function info(title, text, color) { if(!color) { return console.info('['+title+'] ' + text); } return console.info('%c['+title+']%c ' + text, 'color: ' + color, ''); }

function reverse(str) { var newStr = ''; for(var l = str.length-1; l >= 0; l--) { newStr += str[l]; } return newStr; }

/* ####################################################################################    ########                       END Utility Function(s)                      ######## ####################################################################################

/*********************** ********** 5 ********** ***********************/

// test to replace ' ' tag functionality $(function { if(wgTitle === 'Custom Armor Set Comparison' || wgTitle === 'Armor Piece Comparison') {    info('importScriptsCASC_APC', 'Starting', '#aaf');    var scripts = {      'Custom Armor Set Comparison': [        'MediaWiki:CustomArmorSet',         'MediaWiki:CustomArmorSetBox',         'MediaWiki:CustomArmorSetData'      ],      'Armor Piece Comparison': [        'MediaWiki:CustomArmorSet',         'MediaWiki:CustomArmorSetBox',         'MediaWiki:CustomArmorSetData'      ]    };

if(typeof scripts[wgTitle] != 'undefined') { for(var i = 0, len = scripts[wgTitle].length; i < len; i++) { $(' ', {              id: 'importedScripts-'+[i],                href: scripts[wgTitle][i],                type: 'text/html'             }).appendTo('head'); $(' ', {               id: 'importedScripts-'+[i],                src: scripts[wgTitle][i],                type: 'text/html'             }).appendTo('head'); }   }    info('importScriptsCASC_APC', 'Done', '#aaf'); } if(wgTitle === 'Armor Piece Comparison') { importScript('MediaWiki:ArmorSearch.js'); } });

/*********************** ********** 6 ********** ***********************/

// Toggle page button, just for fun  //

$(function { // Add hide-page button  if(wgNamespaceNumber === 0) {    $('.wds-community-header').append($('', {         id: 'togglePage',         text: 'hide',         style: '\        position: relative;\        left: 2px;\        bottom: 1.2vh;\        color: whitesmoke;\        cursor: pointer;'.replace(/\s+/g, '')    }));    // Hide page button function    info('hidePageToggle', 'Starting', '#89DDF3');    $('#togglePage').click(function(hidden) { hidden = $('.WikiaPageContentWrapper').css('display'); var state = { initial:'initial', block:'block', flex:'flex', 'inline-block':'inline-block', 'inline-flex':'inline-flex' };     state[hidden] ? (       $('#togglePage').text('show'),        $('.WikiaPageContentWrapper').hide('slow'),        $('.WikiaPageContentWrapper').addClass('hidden')      ) : (        $('#togglePage').text('hide'),        $('.WikiaPageContentWrapper').show('slow'),        $('.WikiaPageContentWrapper').removeClass('hidden')      ); });   info('hidePageToggle', 'Finished', '#89DDF3');  } });

/*********************** ********** 7 ********** ***********************/

// Add buttons to header $(function { info('RandomPageButton', 'Starting', '#82AAFF');  try {    var headTarget = $('.wds-community-header__wiki-buttons.wds-button-group');    headTarget.append( $('', {        class: 'wds-button wds-is-squished wds-is-secondary',        id: 'jsReturn',        text: '\u2111',        style: 'font-size: 20px; font-weight: 400;',        href: '/wiki/User:Arashiryuu0/wikia.js',         title: 'Return to Personal JS'        }) );   setTimeout(function { headTarget.append(       $('', { class: 'wds-button wds-is-squished wds-is-secondary', id: 'cssReturn', text: '\u212D', style: 'font-size: 20px; font-weight: 400;', href: '/wiki/User:Arashiryuu0/wikia.css', title: 'Return to Personal CSS' })     );    }, 250);    setTimeout(function { headTarget.append(       $('', { class: 'wds-button wds-is-squished wds-is-secondary', id: 'purgePageButton', text: '\u262F', style: 'font-size: 20px; font-weight: 400;', href: '?action=purge', title: 'Purge Page' })     );    }, 300);    setTimeout(function { headTarget.append(       $('', { class: 'wds-button wds-is-squished wds-is-secondary', id: 'returnButton', text: '↩', style: 'font-size: 20px; font-weight: 600;', href: '/wiki/User:Arashiryuu0', title: 'Return to User Page' })     );    }, 350);    setTimeout(function { headTarget.append(       $('', { class: 'wds-button wds-is-squished wds-is-secondary', id: 'randomPageButton', text: '?', style: 'font-size: 20px;', 'data-tracking': 'Special:Random', href: '/wiki/Special:Random', title: 'Random Page' })     );    }, 450);  } catch(e) {      console.error(e.stack);  }  setTimeout(function { info('RandomPageButton', 'Finished', '#82AAFF'); }, 650); });

/*********************** ********** 8 ********** ***********************/

$(function { var whitelist = [ '.js',  '.css',  'MediaWiki' ]; if(whitelist.some(   function(o) {      !wgPageName.includes(o);   } )) {  $(document).on('click.win', function(e) { e.preventDefault; if(e && e.target) { if(e.target.nodeName === 'A') { window.open(e.target.href); }     }  }); } });

/* ####################################################################################    ########                                END                                 ######## ####################################################################################