User:Arashiryuu0/wikia.js

window.onload = function { /***********************    ********** 0 **********     ***********************/            (function {                var profile = $('.UserProfileMasthead');                if(!profile.length) return;                var rights = {                    'Arashiryuu0': ['Klaxosaur Blood'],                    'Mai Is Me': ['Founder', 'Bureaucrat']                };                if(typeof rights[wgTitle] !== 'undefined') {                    $('.masthead-info span.tag').remove;                    var tagContainer = createElement('h2', { id: 'tagContainer', className: 'tags' });                    $('.masthead-info hgroup').append(tagContainer);                    for(var i = 0, len = rights[wgTitle].length; i < len; i++) {                        $(' ' + rights[wgTitle][i] + ' ').appendTo('.masthead-info hgroup h2.tags');                   }                }                return;            }); (function {           function iterate {                $('.activity-ns-1201 > table, .activity-ns-2001 > table').each(function(_, e) { if(!$(e).hasClass('wallfeed')) { $(e).addClass('wallfeed'); console.log('[Wallfeed] Iteration ' + _ + ' complete.', e); }               });            }            if(wgPageName.includes('WikiActivity')) {                var e = new MutationObserver(function(changes) { changes.forEach(function(change) {                       if(change.addedNodes.length) {                            change.addedNodes.forEach(function(node) { if(node.classList && node.classList.contains('activityfeed')) { iterate; }                           });                        }                    });                });                iterate;                e.observe(document.querySelector('.WikiaArticle'), { childList: true, subtree: true });            }        }); /***********************    ********** 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');            if(!profile.length) return;            (function { var tags = { 'Klaxosaur Blood':'klb', 'Administrator':'admin', 'Bureaucrat':'crat', 'Founder':'founder' };               var people = [ 'Arashiryuu0', 'Mai Is Me' ];               var oTags = $('.masthead-info .tags span'); var user = $('.UserProfileMasthead hgroup h1'); function getTag(text) { if(typeof tags[text] !== 'undefined') { return tags[text]; }                   return null; }               function run { for(var i = 0; i < oTags.length; i++) { var text = $(oTags[i]).text; var tag = getTag(text); var txt; if(tag && !$(oTags[i]).hasClass(tag)) { $(oTags[i]).addClass(tag); }                       switch(text) { case 'Founder': txt = 'Wiki Creator'; break; case 'Administrator': case 'Bureaucrat': txt = 'Wiki Administration'; break; case 'Klaxosaur Blood': txt = '００２｜아이고'; break; }                       tooltip($(oTags[i]), txt, 'top'); }                   if(document.contains(document.getElementById('tooltipCSS'))) { $('#tooltipCSS').text($('#tooltipCSS')[0].textContent += ' .superTag:hover { cursor: help; }'); }               }                if(people.includes(user.text)) run; });       });    /***********************     ********** 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(e) { $(this).parent.find('.wds-dropdown__content').toggle('fast'); });           toggles.on('click.ToggleClick', function(e) { 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 });           document.querySelector('.wds-community-header__local-navigation').appendChild(day);        }); /***********************    ********** 6 **********     ***********************/        (function {            $('.wds-community-header__wiki-buttons .wds-dropdown').attr('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); for(var prop in properties) { element[prop] = properties[prop]; }   return element; }

function tooltip(node, text, type) { var tooltipcss = $(' ', { id: 'tooltipCSS', text: '@keyframes fadeFromTop { 0% { opacity: 0; transform: translate3d(0, -50%, 0); } 100% { opacity: 0.9; transform: none; } } @keyframes fadeFromBottom { 0% { opacity: 0; transform: translate3d(0, 50%, 0); } 100% { opacity: 0.9; transform: none; } } @keyframes fadeFromLeft { 0% { opacity: 0; transform: translate3d(-50%, 0, 0); } } @keyframes fadeFromRight { 0% { opacity: 0; transform: translate3d(50%, 0, 0); } } .tooltip { background: #373737; filter: drop-shadow(0 0 1px black) drop-shadow(0 1px 2px black); letter-spacing: 0.025rem; font-size: 1em; } .tooltip::after { content: " "; border: 5px solid transparent; pointer-events: none; height: 0; width: 0; } .tooltip.tooltip-bottom { animation: fadeFromBottom 200ms; } .tooltip.tooltip-bottom::after { bottom: 100%; left: 50%; margin-left: -5px; position: absolute; border-bottom-color: #373737; } .tooltip.tooltip-top { animation: fadeFromTop 200ms; } .tooltip.tooltip-top::after { left: 50%; margin-left: -5px; position: absolute; top: 100%; border-top-color: #373737; } .tooltip.tooltip-left { animation: fadeFromLeft 200ms; } .tooltip.tooltip-left::after { border-left-color: #373737; top: 50%; left: 100%; margin-top: -5px; position: absolute; } .tooltip.tooltip-right { animation: fadeFromRight 200ms; } .tooltip.tooltip-right::after { border-right-color: #373737; margin-top: -5px; top: 50%; right: 100%; position: absolute; }' }); var tip = $(' ', { id: 'tooltip', class: 'tooltip tooltip-' + type, text: text }); if(!document.contains(document.getElementById('tooltipCSS'))) { $('head').append(tooltipcss); }   node.on('mouseenter.tooltip', function {        var tipstyle = tip.attr('class');        setTimeout(function { var nodecenter = node.offset.left + (node.outerWidth / 2); var center = nodecenter - (tip.outerWidth / 2); var top; switch(tipstyle.split(' ')[1]) { case 'tooltip-top': top = node.offset.top - tip.outerHeight; break; case 'tooltip-bottom': top = node.offset.top + node.outerHeight; break; case 'tooltip-left': center = node.offset.left - tip.outerWidth; top = node.offset.top + (node.outerHeight - tip.outerHeight) / 2; break; case 'tooltip-right': center = node.offset.left + node.outerWidth; top = node.offset.top + (node.outerHeight - tip.outerHeight) / 2; break; }           tip.attr('style', 'left: ' + center + 'px; top: ' + top + 'px;'); }, 10);       tip.attr('style', 'left: -1000vw; height: -1000vh;');        $('body').append(tip);    }); node.on('mouseleave.tooltip', function {       $('#tooltip').remove;    }); return true; }

function removeTooltip(node) { var tips = $('#tooltip'); if(tips.length) { tips.remove; node.off('mouseenter.tooltip'); node.off('mouseleave.tooltip'); return true; }   return false; }

function removeTooltipCss { var css = document.getElementById('tooltipCSS'); if(document.contains(css)) { $(css).remove; return true; }   return false; }

/*@end@*/