User:Arashiryuu0/wikia.js

window.onload = function { importScriptPage('MediaWiki:Tooltips.js', 'bloodborne'); window.tagList = { 'Founder':'Wiki Creator', 'Bureaucrat':'Wiki Administration', 'Administrator':'Wiki Administration', 'Chat Moderator':'Wiki Chat Moderator', 'Chat moderator':'Wiki Chat Moderator', 'Content Moderator':'Wiki Content Moderator', 'Discussions Moderator':'Wiki Discussions Moderator', 'Staff':'Fandom Staff', 'Klaxosaur Blood':'００２｜아이고' };   /***********************     ********** 0 **********     ***********************/    (function {        var tagContainer, oldTags,            profile = $('.UserProfileMasthead'),            rights, len, i;        if (!profile.length) return;        rights = {            'Arashiryuu0': ['Klaxosaur Blood'],            'Mai Is Me': ['Founder', 'Bureaucrat']        };        if (rights.hasOwnProperty(wgTitle)) {            $('.masthead-info span.tag').remove;            i = 0;            len = rights[wgTitle].length;            tagContainer = createElement('h2', { id: 'tagContainer', className: 'tags' });            $('.masthead-info hgroup').append(tagContainer);            for (i; i < len; i++) {                $(' ' + rights[wgTitle][i] + ' ').appendTo('.masthead-info hgroup h2.tags');           }        } else {            $('.masthead-info span.tag').remove;

i = 0; oldTags = $$('.tag'); len = oldTags.length; tagContainer = createElement('h2', { id: 'tagContainer', className: 'tags' }); $('.masthead-info hgroup').append(container); for (i; i < len; i++) { $(' ' + $(oldTags[i]).text +                ' ').appendTo('.masthead-info hgroup h2.tags'); }       }    });    (function { var article = $_('.WikiaArticle'), e,           options = { childList: true, subtree: true }; function iterate { var i = 0, selection = $$('.activity-ns-1201 > table, .activity-ns-2001 > table'), len = selection.length; for (i; i < len; i++) { if ($(selection[i]).hasClass('wallfeed')) continue; $(selection[i]).addClass('wallfeed'); log('iteration complete: ' + i, selection[i]); }       }        function handleMutation(changes) { var change, node, len, i;           for (change in changes) { change = changes[change]; if (change.addedNodes.length) { i = 0; len = change.addedNodes.length; for (i; i < len; i++) { node = change.addedNodes[i]; if (node.classList && node.classList.contains('activityfeed')) iterate; }               }            }        }        if (wgPageName.includes('WikiActivity')) { e = new MutationObserver(handleMutation); log('iterating...'); iterate; e.observe(article, options); }   });    /***********************     ********** 1 **********     ***********************/    if (wgPageName.includes('Message_Wall') || wgPageName.includes('Thread')) {        (function { var btn = $('li.edit-topic'); btn.addClass('button'); btn.children.first.css({               position: 'relative',                bottom: '3px',                color: '#FFF'            }); $('.wikia-button.secondary, .wikia-menu-button.secondary').removeClass('secondary'); });   }

/***********************    ********** 2 **********     ***********************/    (function {        var profile = $('.UserProfileMasthead'),            people, oTags, user, tags;        if (!profile.length) return;        tags = {            'Klaxosaur Blood':'klb',            'Administrator':'admin',            'Bureaucrat':'crat',            'Founder':'founder'        };        people = [            'Arashiryuu0',            'Mai Is Me'        ];        oTags = $$('.masthead-info .tags span');        user = $('.UserProfileMasthead hgroup h1');        function getTag(text) {            if (tags.hasOwnProperty(text)) return tags[text];            return null;        }        function run {            var tagList = window.tagList ? window.tagList : {},                tiptext, text, len = oTags.length,                txt, tag, i = 0;            for (i; i < len; i++) {                text = $(oTags[i]).text; tag = getTag(text); txt; if (tag && !$(oTags[i]).hasClass(tag)) { $(oTags[i]).addClass(tag); }               if (text) tiptext = tagList[text] ? tagList[text] : ''; if (tiptext) tooltip($(oTags[i]), tiptext, 'top'); }           setTimeout(function {                var tipcss = $('#tooltipCSS');                if (tipcss.length) {                    tipcss.text(tipcss[0].textContent += ' .superTag:hover { cursor: help; }');                }            }, 100); }       function cycle { var state = document.readyState; if (state !== 'complete') { return setTimeout(function {                   cycle;                }, 500); }           setTimeout(function {                run;            }, 1000); }       cycle; });   /***********************     ********** 3 **********     ***********************/    (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);    });    /***********************     ********** 4 **********     ***********************/    (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 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'); var headerButton = $('.wds-community-header__wiki-buttons > .wds-dropdown > .wds-button'); document.head.appendChild(script); document.head.appendChild(stylesheet); headerButton.css('padding', '11px 3px'); headerButton.on('click.EllipseFix', function {           $(this).parent.find('.wds-dropdown__content').toggle('fast');        }); toggles.on('click.ToggleClick', function {           var rotation = 'rotateX(180deg)';

$(this).parent.siblings.first.toggle('fast');

this.style.transform = this.style.transform !== rotation ? rotation : 'none'; });   });    /***********************     ********** 5 **********     ***********************/    (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 });

$_('.wds-community-header__local-navigation').appendChild(day); });   /***********************     ********** 6 **********     ***********************/    $_('.wds-community-header__wiki-buttons .wds-dropdown').setAttribute('title', 'Options');    /***********************     ********** 7 **********     ***********************/ };

/*********************** ********* 000 ********* ***********************/ function createElement(type, properties) { if (typeof type !== 'string' || typeof properties !== 'object') throw new TypeError('`type` parameter must be string, `properties` parameter must be object.'); var element = document.createElement(type), prop; for (prop in properties) { element[prop] = properties[prop]; }   return element; }

function log { var args = Array.prototype.slice.call(arguments); args.unshift('%c[Log]', 'color: #C3E88D;'); return console.log.apply(this, args); }

function $$(selector) { return document.querySelectorAll.call(document, selector); } function $_(selector) { return document.querySelector.call(document, selector); }

/*@end@*/