User:Arashiryuu0/wikia.js

window.onload = function { importScriptPage('MediaWiki:Tooltips.js', 'bloodborne'); window.tagList = { 'Founder': 'Wiki Creator', 'Bureaucrat': 'Wiki Administration', 'Administrator': 'Wiki Administration', 'Admin': 'Wiki Administration', 'Content Moderator': 'Wiki Content Moderator', 'Chat Moderator': 'Wiki Chat Moderator', 'Discussions Moderator': 'Wiki Discussions Moderator', 'Tet': 'The One True God', 'Elkian': '16th Ranked Exceed', '『　』': 'Blank', 'Staff': 'Fandom Staff' };   /***********************     ********** 0 **********     ***********************/    (function {        var profile = $('.UserProfileMasthead'),            rights, len, i;        if(!profile.length) return;        rights = {            Arashiryuu0: ['『　』', 'Elkian']        };        if(typeof rights[wgTitle] !== 'undefined') {            i = 0;            len = rights[wgTitle].length;            $('.masthead-info span.tag').remove;            for(i; i < len; i++) {                $(' ' + rights[wgTitle][i] + ' ').appendTo('.masthead-info hgroup');           }        }    });

/***********************    ********** 1 **********     ***********************/    (function {        function iterate {            $('.activity-ns-1201 > table, .activity-ns-2001 > table').each(function(_, i) { if(!$(i).hasClass('wallfeed')) { $(i).addClass('wallfeed'); log('iteration complete: ' + _, i); }           });        }

if(wgPageName.includes('WikiActivity')) { var e = new MutationObserver(function(changes) {               var change, node, i, len;                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;                        }                    }                }            }); log('iterating...'); iterate; e.observe($('.WikiaArticle')[0], { childList: true, subtree: true }); }   });    /***********************     ********** 2 **********     ***********************/    (function { 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);            if(wgNamespaceNumber === 0) { $('.wds-community-header').append(                   $('', { id: 'togglePage', text: 'hide', style: '\ position: relative;\ left: 2px;\ bottom: 1.22vh;\ color: whitesmoke;\ cursor: pointer;'.replace(/\s+/g, '') })               );                $('#togglePage').on('click.togglePage', function(e) {                    var 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') );               });            }        } catch(e) { console.error(e.stack); }   });    /***********************     ********** 3 **********     ***********************/    (function { var date = new Date, currentDay = date.toLocaleDateString(document.documentElement.lang, { weekday: 'long' }); var day = createElement('a', {           id: 'currDay',            title: 'Today',            target: '_blank',            textContent: currentDay        }), style = 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; }'        }), 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'), headerButton = $('.wds-community-header__wiki-buttons > .wds-dropdown > .wds-button');

document.head.appendChild(style); document.head.appendChild(stylesheet); document.querySelector('.wds-community-header__local-navigation').appendChild(day); headerButton.css('padding', '11px 3px'); headerButton.on('click.EllipseFix', function(e) {           $(this).parent.find('.wds-dropdown__content').toggle('fast');        }); 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'; });   });    /***********************     ********** 4 **********     ***********************/    document.querySelector('.wds-community-header__wiki-buttons .wds-dropdown').setAttribute('title', 'Options'); setTimeout(window.getStarted, 1000); };

/** * Utility */

function createElement(type, properties) { if(typeof type !== 'string' || typeof properties !== 'object') throw new TypeError('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; }

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

/*@end@*/