User:Arashiryuu0/wikia.js

window.onload = function { /* ####################################################################################        ########                                START                               ######## ####################################################################################   */     /***********************      ********** 0 **********      ***********************/        if(wgPageName.includes('User') || wgPageName.includes('Message_Wall')) { /**             * 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'); }           });        }     /**      * 0.5      */        (function { function iterate { $('.activity-ns-1201 > table, .activity-ns-2001 > table').each(function(index, element) {                   if(!$(element).hasClass('wallfeed')) {                        $(element).addClass('wallfeed');                        console.log('iteration complete: ' + index, element);                    }                }); }           var re = /activity-ns-\d{4}/ig; if(wgPageName.includes('WikiActivity')) { var e = new MutationObserver(function(changes) {                   changes.forEach(function(change) { if(change.addedNodes) { change.addedNodes.forEach(function(node) {                               if(node.classList && node.classList.contains('activityfeed')) {                                    iterate;                                    for(var t = 0, len = node.children.length; t < len; t++) {                                        if(node.children[t].className.match(re)) {                                            iterate;                                        }                                    }                                }                            }); }                   });                });                console.log('iterating...'); iterate; e.observe($('.WikiaArticle')[0], { childList: true, subtree: true }); }       });     /***********************      ********** 1 **********      ***********************/        // Fix forum's "Edit-topic" and "follow" buttons        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 **********      ***********************/        if(wgTitle === 'Arashiryuu0') {            info('TagClassScript', 'Starting', '#ae0');            $('.tag:contains(\'全王\')').addClass('zen-ou');            $('.tag:contains(\'拳王\')').addClass('ken-ou');            info('TagClassScript', 'Finishing', '#ae0');            $('.tag:contains(\'人殺し合\')').addClass('murderer');        } else        if(wgTitle === 'ShadowBeast109') {            info('TagClassScript', 'Starting', '#ae0');            $('.tag:contains(\'Administrator\')').addClass('admin'); info('TagClassScript', 'Finishing', '#ae0'); $('.tag:contains(\'Vampiric Overlord\')').addClass('vamp'); } else if(wgTitle === 'Matsczon') { info('TagClassScript', 'Starting', '#ae0'); $('.tag:contains(\'Bureaucrat\')').addClass('crat'); info('TagClassScript', 'Finishing', '#ae0'); $('.tag:contains(\'Duckman\')').addClass('duck'); } else if(wgTitle === 'LaVey') { info('TagClassScript', 'Starting', '#ae0'); $('.tag:contains(\'Administrator\')').addClass('admin'); info('TagClassScript', 'Finishing', '#ae0'); $('.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'); $('.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'); $('.tag:contains(\'TheseHands™\')').addClass('these-hands'); }    /***********************      ********** 3 **********      ***********************/        // 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'); }     /***********************       ********** 4 **********       ***********************/        // add extra buttons info('RandomPageButton', 'Starting', '#82AAFF'); try { (function {               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); /***********************    ********** 5 **********     ***********************/        /**         * Make the new "..." button in the header work on click, not hover. * Fix its size. - 11px 3px padding. */       (function {            var script = $(' ', { id: 'EllipseFixCSS', type: 'text/css', text: '.wds-community-header__wiki-buttons > .wds-dropdown:hover .wds-dropdown__content { display: none !important; }' });           var headerButton = $('.wds-community-header__wiki-buttons > .wds-dropdown > .wds-button');            info('EllipseButtonFix', 'Starting', '#59F');            $('head').append(script);            headerButton.css('padding', '11px 3px');            headerButton.on('click.EllipseFix', function(e) { var display = $(this).closest('.wds-dropdown__content').css('display'); if(display === 'none') { $(this).find('.wds-dropdown__content').toggle; } else { $(this).find('.wds-dropdown__content').toggle; }           });            info('EllipseButtonFix', 'Finished', '#59F');        }); /* ####################################################################################        ########                                END                                 ######## ####################################################################################   */ }; /*  ####################################################################################    ########                        Utility Function(s)                         ######## ####################################################################################   function info(title, text, color) { if(!text && !color && typeof title === 'string') { text = title; return console.info(text); }

if(!color && typeof text === 'string' && typeof title === 'string') { return console.info('['+title+'] ' + text); }

if(typeof title !== 'string' || typeof text !== 'string' || typeof color !== 'string') { throw new TypeError('Supplied parameter must be a string.'); }

return console.info('%c['+title+']%c ' + text, 'color: ' + color, ''); } /* ####################################################################################    ########                       END Utility Function(s)                      ######## ####################################################################################