User:Arashiryuu0/wikia.js

window.onload = function { importArticles({       type: 'script',        articles: ['w:c:bloodborne:MediaWiki:Tooltips.js']    }); window.tagList = { '全王':'King of All', '拳王':'King of the Fist', '人殺し合':'Murderer', 'Administrator':'Wiki Administration', 'Bureaucrat':'Wiki Administration', 'Vampiric Overlord':'Girlycard', 'Chat Moderator':'Wiki Chat Moderator', 'Chat moderator':'Wiki Chat Moderator', 'Discussions Moderator':'Wiki Discussions Moderator', 'Content Moderator':'Wiki Content Moderator', 'Staff':'Fandom Staff' };   /***********************     ********** 0 **********     ***********************/        (function {            var profile = $('.UserProfileMasthead');            if(!profile.length) return;            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™']            };            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'); }       });        (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);                    }                }); }

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;                                }                            }); }                   });                });                console.log('iterating...'); iterate; e.observe($('.WikiaArticle')[0], { childList: true, subtree: true }); }       });    /***********************     ********** 1 **********     ***********************/        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' });           $('.wikia-button.secondary').removeClass('secondary');            $('.wikia-menu-button.secondary').removeClass('secondary');            $('.related-topics .related-topic').css({'background-color':'#201c10'});            info('buttonFixScript', 'Done', '#c94f12');        }    /***********************     ********** 2 **********     ***********************/        (function { var profile = $('.UserProfileMasthead'); if(!profile.length) return; var tags = { '全王':'zen-ou', '拳王':'ken-ou', '人殺し合':'murderer', 'Administrator':'admin', 'Bureaucrat':'crat', 'Duckman':'duck', 'Emoji Dab Lad':'emoji-dab', 'Fallout: Las Vegas':'las-vegas', 'Ginger':'ginger', 'Lad':'lad', 'One of The Boys':'boys', 'TheseHands™':'these-hands', 'Vampiric Overlord':'vamp' };           var people = [ 'Arashiryuu0', 'ShadowBeast109', 'Matsczon', 'Filename', 'IronChaos' ];           var oldtags = $('span.tag'); var user = $('.UserProfileMasthead hgroup h1'); function getWord(text) { if(tags[text]) { return tags[text]; }               return null; }           function loop { var j = 0; for(j; j < oldtags.length; j++) { var text = $(oldtags[j]).text; var word = getWord(text); if(word && !$(oldtags[j]).hasClass(word)) { $(oldtags[j]).addClass(word); }               }            }            if(people.includes(user.text)) { info('TagClassScript', 'Starting', '#ae0'); loop; info('TagClassScript', 'Finishing', '#ae0'); }       });    /***********************     ********** 3 **********     ***********************/        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, '')                }) );           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 **********     ***********************/        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 **********     ***********************/        (function { var script = createElement('style', {               id: 'EllipseFixCSS',                type: 'text/css',                textContent: '.WikiaSiteWrapper .wds-community-header .wds-community-header__wiki-buttons > .wds-dropdown > .wds-dropdown__content, .wds-dropdown.wds-is-active::after, .wds-dropdown.wds-is-active::before, .wds-dropdown:hover::after, .wds-dropdown:hover::before { display: none; } .wds-community-header__wiki-buttons > .wds-dropdown > .wds-button:hover { cursor: pointer; }'            }); var headerButton = $('.wds-community-header__wiki-buttons > .wds-dropdown > .wds-button'); info('EllipseButtonFix', 'Starting', '#59F'); document.head.appendChild(script); headerButton.css('padding', '11px 3px'); headerButton.on('click.EllipseFix', function(e) {               $(this).parent.find('.wds-dropdown__content').toggle('fast');            }); info('EllipseButtonFix', 'Finished', '#59F'); });       (function { var stylesheet = createElement('style', {               id: 'ToggleCSS',                type: 'text/css',                textContent: '.wds-community-header__local-navigation .wds-dropdown:hover .wds-dropdown__content { display: none; } .wds-community-header__local-navigation .wds-dropdown:hover .wds-dropdown__toggle-chevron { transform: none; transition: transform 200ms cubic-bezier(0.6, -0.28, 0.74, 0.05); }'            }); var toggles = $('.wds-community-header__local-navigation .wds-dropdown .wds-dropdown__toggle-chevron'); document.head.appendChild(stylesheet); toggles.on('click.ToggleClick', function(i) {               var rotation = 'rotateX(180deg)';                $(this).parent.siblings.first.toggle('fast');                this.style.transform = this.style.transform !== rotation ? rotation : 'none';            }); });   /***********************     ********** 6 **********     ***********************/        (function { var date = new Date; var currentDay = date.toLocaleDateString(document.documentElement.lang, { weekday: 'long' }); var day = createElement('a', {               id: 'currDay',                title: 'Today',                target: '_blank',                textContent: currentDay            }); document.querySelector('.wds-community-header__local-navigation').appendChild(day); });   /***********************     ********** 7 **********     ***********************/        (function { setTimeout(window.getStarted, 1000); });   /***********************     ********** 8 **********     ***********************/        (function { document.querySelector('.wds-community-header__wiki-buttons .wds-dropdown').setAttribute('title', 'Options'); });   /***********************     ********** 9 **********     ***********************/    (function { var menu = $(' ', {           id: 'contextMenu',            class: 'menu',            append: [ $(' ', { class: 'action open', text: 'Open in New Tab', style: 'padding: 5px 3px', on: { click: function(e) { if(e.target.nodeName === 'A') window.open(e.target.href); menu.detach; } } }) ]        }).css({            'background': '#6b603b',            'min-width': '3vw',            'width': '6vw',            'max-width': '8vw',            'min-height': '5vh',            'height': 'auto',            'max-height': '10vh',            'position': 'absolute',            'left': '0',            'top': '0',            'z-index': '5',            'cursor': 'pointer'        }); function onContext(o) { o.preventDefault; this.onClick(o); }       $(document, window, document.body).on('contextmenu.ctx', function(e) {            $('body').append(menu);            menu.css('left', e.pageX + 'px');            menu.css('top', e.pageY + 'px');            menu.find('.action.open').on('click.ctx', function(i) { onContext(e) });        }); }); };

/*     ####################################################################################    ########                        Utility Function(s)                         ######## ####################################################################################   function info(title, text, color) { if(!text && !color && typeof title === 'string') { return console.info(title); }

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, ''); }   function createElement(type, properties) { if(typeof type !== 'string' || typeof properties !== 'object') throw new Error('First parameter must be a string. Second parameter must be an object with properties.'); var element = document.createElement(type); for(var prop in properties) { element[prop] = properties[prop]; }       return element; } /*   ####################################################################################    ########                       END Utility Function(s)                      ######## ####################################################################################