User:Merlin the Immortal/global.js

/*Time Desplayer Clickable ImportJS page Protection Icons Statistics importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:DisplayTimer/code.js',        'u:dev:MediaWiki:ImportJSPage/code.js',        'u:dev:MediaWiki:ProtectionIcons.js',        'u:dev:MediaWiki:RCStats.js',    ] }); //Previous Wiki mw.loader.using('mw.Api', function {   var currWiki = mw.config.get('wgServer'),        prevWiki = mw.user.options.get('userjs-prevWiki'),        params;    if (currWiki != 'https://community.fandom.com' && prevWiki === null) {       //Cond. 1.a.        params = {            action: 'options',            optionname: 'userjs-prevWiki',            optionvalue: currWiki,            format: 'json'        };    } else if (currWiki != 'https://community.fandom.com') {        //Cond. 1.b.        params = {            action: 'options',            change: 'userjs-prevWiki=' + currWiki,            format: 'json'        };    } else {        //Cond. 1.c        var ccButton = document.querySelector('.global-navigation .wds-dropdown__content a[href*="community.fandom.com"]');        ccButton.textContent = 'Previous Wiki';        ccButton.href = (!prevWiki) ? currWiki : prevWiki;    }    if (currWiki != 'https://community.fandom.com') {        //Cond. 2        var api = new mw.Api;        api.postWithToken('csrf', params).done(function(data) { console.log(data); });   } });

//Unvote, Credit to HumansCanWinElves (function unvotePoll(window, $, mw) {   if (window.onvotePollLoaded) return;    window.unvotePollLoaded = true;

mw.loader.using(['mediawiki.util', 'mediawiki.Uri']).then(function {       var url = mw.util.wikiScript('wikia'),            threadId = mw.util.getParamValue('unvotePoll');

if (typeof threadId !== 'string' || /\D/.test(threadId)) return;

$.getJSON(url, {           controller: 'DiscussionThread',            method: 'getThread',            threadId: threadId        }).error(function(err) {            console.error('(unvotePoll) Error loading thread information', err);        }).then(function(data) {            var pollId = data.poll && data.poll.id;

if (!pollId) { console.error('(unvotePoll) Failed to retrive poll data or thread is not a poll', data.poll); return; }

$.post(url, {               controller: 'DiscussionPoll',                method: 'castVote',                pollId: pollId,                answerIds: ''            }).error(function {                console.error('(unvotePoll) Error unvoting', err);            }); })   }) })(this, jQuery, mediaWiki);