User:Kirito (Kirigaya Kazuto)/global.js

//Chat Options $.getScript("https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js");

importArticles({   type: 'script',    articles: [        'u:dev:NoImageLightbox/code.js',        'u:dev:OldFilePages/code.js',        'u:vstf:User:Joeyaa/wham.js'    ] }); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/ChatPMs.js', 'c'); importScriptPage('User:Madnessfan34537/multikick.js', 'callofduty'); importScriptPage('BackToTopButton/code.js', 'dev'); importScriptPage('User:Joeyaa/wham.js','vstf'); importScriptPage('MediaWiki:FindReplace.js', 'kangaroopower'); importScriptURI('http://dev.wikia.com/wiki/BotoneraPopups/Code/en.js?action=raw&ctype=text/javascript&templates=expand'); importStylesheetPage('BotoneraPopups/code.css', 'dev'); importScriptPage('AjaxBatchDelete/code.js', 'dev'); importScriptPage('AutoEditDropdown/code.js', 'dev'); importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('AjaxPatrol/code.js', 'dev' ); importScriptPage('AjaxUndo/code.js', 'dev' ); AjaxRCRefreshText = 'AJAX'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('User:PlasmaTime/quickBlock.js', 'c'); importScriptPage('FastDelete/code.js', 'dev'); importScriptPage('MessageBlocker/code.js', 'dev'); var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'spam', 'label': 'spam'}; fdButtons[fdButtons.length] = { 'summary': 'vandalism', 'label': 'vandalism'} fdButtons[fdButtons.length] = { 'summary': 'housekeeping', 'label': 'housekeeping'} $.getScript("https://raw.github.com/sactage/wikia-js-snippets/master/RollbackMods.js"); importArticles({   type: "script",    articles: [        "w:c:dev:RevealAnonIP/usercode.js"    ] });

/* Classic Snow Fall - Java Script // Set the number of snowflakes (more than 30 - 40 not recommended) var snowmax=35 // Set the colors for the snow. Add as many colors as you like var snowcolor=new Array("#cccccc","#8EE5EE","#ffffff","#C1CDCD","#CDC9C9") // Set the fonts, that create the snowflakes. Add as many fonts as you like var snowtype=new Array("Times","Arial","Times","Verdana") // Set the letter that creates your snowflake (recommended: • ) var snowletter="•" // Set the speed of sinking (recommended values range from 0.3 to 2) var sinkspeed=0.6 // Set the maximum-size of your snowflakes var snowmaxsize=30 // Set the minimal-size of your snowflakes var snowminsize=8 // Set the snowing-zone // Set 1 for all-over-snowing, set 2 for left-side-snowing // Set 3 for center-snowing, set 4 for right-side-snowing var snowingzone=1 /////////////////////////////////////////////////////////////////////////// // CONFIGURATION ENDS HERE /////////////////////////////////////////////////////////////////////////// // Do not edit below this line var snow=new Array var marginbottom var marginright var timer var i_snow=0 var x_mv=new Array; var crds=new Array; var lftrght=new Array; var browserinfos=navigator.userAgent var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/) var ns6=document.getElementById&&!document.all var opera=browserinfos.match(/Opera/) var browserok=ie5||ns6||opera function randommaker(range) { rand=Math.floor(range*Math.random) return rand } function initsnow { if (ie5 || opera) { marginbottom = document.body.scrollHeight marginright = document.body.clientWidth-15 }       else if (ns6) { marginbottom = document.body.scrollHeight marginright = window.innerWidth-15 }       var snowsizerange=snowmaxsize-snowminsize for (i=0;i<=snowmax;i++) { crds[i] = 0; lftrght[i] = Math.random*15; x_mv[i] = 0.03 + Math.random/10; snow[i]=document.getElementById("s"+i) snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)] snow[i].size=randommaker(snowsizerange)+snowminsize snow[i].style.fontSize=snow[i].size+'px'; snow[i].style.color=snowcolor[randommaker(snowcolor.length)] snow[i].style.zIndex=1000 snow[i].sink=sinkspeed*snow[i].size/5 if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)} if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4} if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2} snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size) snow[i].style.left=snow[i].posx+'px'; snow[i].style.top=snow[i].posy+'px'; }       movesnow } function movesnow { for (i=0;i<=snowmax;i++) { crds[i] += x_mv[i]; snow[i].posy+=snow[i].sink snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i])+'px'; snow[i].style.top=snow[i].posy+'px'; if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){ if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)} if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4} if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2} snow[i].posy=0 }       }        var timer=setTimeout("movesnow",50) } for (i=0;i<=snowmax;i++) { document.write(""+snowletter+" ") } if (browserok) { window.onload=initsnow } importArticles({   type: "script",    articles: [        "w:c:onceuponatime:MediaWiki:Snowing.js"    ] });

importArticles( {   type: 'script',    articles: [        // ...        'u:dev:CapsFirst/code.js',        // ...    ] } );

/** * Quick Tools - a collection of AJAX based helper scripts * * @author - Benjamin Williams (Shining-Armor) * * @license - GNU GPL v3 */ /** * @variable [object] main QuickTools object. */ var QuickTools = window.QuickTools || {};

/** * @variable [object] object for applet specific functions */ QuickTools.applet = {};

/** * @variable [object] object for applet specific HTML */ QuickTools.applet.html = {};

/** * @block [string] HTML for different applet forms * * current applets: *   - Block *   - Delete *   - Move *   - Protect *   - Batch Delete */ QuickTools.applet.html.home = '\ Welcome to Quick Tools! \ \

\ Quick Tools is a blah blah blah something ponies might turn this area into a sort of to-do list idk. \

\ Debugging info: \ \

\ User name: ' + mw.config.get('wgUserName') + ' \ User rights: ' + (function {   var userText = '';    var userGroups = mw.config.get('wgUserGroups');

for (var i = 0; i < userGroups.length; i++) { userGroups[i] = userGroups[i].charAt(0).toUpperCase + userGroups[i].slice(1); userText += userGroups[i] + ', '; }

return userText.substring(0, userText.length - 2); }) + ' \ Namespace: ' + (function { var namespace = '';

for (k in mw.config.get('wgNamespaceIds')) { if (mw.config.get('wgNamespaceIds')[k] === mw.config.get('wgNamespaceNumber')) { if (k.toString === "") { namespace = "Main"; } else { namespace = k.toString.charAt(0).toUpperCase + k.slice(1); }       }    }

return namespace; }) + ' (' + mw.config.get('wgNamespaceNumber') + ')';

QuickTools.applet.html.block = '\ User name:  \ Duration:  \ Reason:    \ \   Disallow talk pages:  \ Disallow account creation:  \ \ Status: \ \   Block \ ';

QuickTools.applet.html.delete = '\ delete ';

QuickTools.applet.html.move = '\ move ';

QuickTools.applet.html.protect = '\ protect ';

QuickTools.applet.html.batchdelete = '\ batch delete ';

/** * @variable [boolean] modal control switch */ QuickTools.modalShown = false;

/** * @variable [string] modal HTML */ QuickTools.formHTML = '\ \   \        Quick Tools \ X \ \     \ ';

/** * @variable [string] modal CSS */ QuickTools.formCSS = '\ display: none; \ -moz-border-radius: 10px; \ -moz-box-shadow: -3px 2px 9px 0 rgba(50, 50, 50, 0.81); \ -webkit-border-radius: 10px; \ -webkit-box-shadow: -3px 2px 9px 0 rgba(50, 50, 50, 0.81); \ background-color: #0175c7; \ border-radius: 10px; \ box-shadow: -3px 2px 9px 0 rgba(50, 50, 50, 0.81); \ height: auto; \ left: 25%; \ margin: 0; \ padding: 4px; \ position: fixed !important; \ top: 20%; \ width: 650px; \ z-index: 2000000004 !important; \ } \   -moz-border-radius: 4px; \ -webkit-border-radius: 4px; \ border-collapse: collapse; \ border-radius: 4px; \ height: 300px; \ margin-bottom: 3px; \ } \   border: 2px solid #fff !important; \ } \   height: auto; \ width: 100%; \ } \   color: #fff; \ float: left; \ font-family: "Times New Roman"; \ font-size: 170%; \ font-weight: bold; \ margin-top: 0; \ margin: 4px; \ } \   -moz-border-radius: 4px; \ -webkit-border-radius: 4px; \ -webkit-transition: background-color 1s; \ border-radius: 4px; \ border: 2px solid #fff; \ color: #fff; \ float: right; \ font-weight: bold; \ margin-top: 2px; \ margin: 4px; \ padding: 2px; \ padding-left: 4px; \ padding-right: 4px; \ transition: background-color: 1s; \ } \   background-color: #0061a6; \ cursor: pointer; \ } \   width: 100%; \ } \   height: 100%; \ margin: 0; \ padding: 0; \ width: 80%; \ } \   border-right: 1px solid #fff; \ height: 100%; \ margin: 0; \ overflow: auto; \ padding: 0; \ width: 20%; \ } \   height: 100%; \ list-style: none; \ margin: 0; \ padding: 0; \ } \   border-left: 1px solid #fff; \ height: 100%; \ width: 99%; \ padding: 8px 8px 8px 8px; \ color: #fff; \ font-weight: bold; \ } \   width: 96%; \ float: left; \ } \   width: auto; \ } \   border: 2px solid #FFF; \ width: 94%; \ height: 83px; \ padding: 4px; \ overflow: auto; \ } \ .QuickToolsLink { \ -webkit-transition: background-color 1s; \ border: 2px solid #fff; \ color: #fff; \ display: inline-block; \ font-weight: bold; \ margin: 3px; \ padding: 3px; \ transition: background-color: 1s; \ width: 87%; \ } \ .QuickToolsLink:hover { \ background-color: #0061a6; \ text-decoration: none; \ } \ .QuickToolsInput { \ background: transparent; \ border-bottom: 2px solid #fff !important; \ border-left: 2px solid #fff !important; \ border: none; \ color: #fff; \ font-weight: bold; \ margin: 4px; \ padding: 2px; \ } \ .QuickToolsInput:focus { \ outline: 0; \ }\ .QuickToolsSingleButton { \ -webkit-transition: background-color 1s; \ background-color: transparent; \ border: 2px solid #fff; \ color: #fff; \ font-weight: bold; \ margin: 2px; \ padding: 2px; \ text-decoration: none; \ transition: background-color: 1s; \ cursor: pointer; \ } \ .QuickToolsSingleButton:hover { \ background-color: #0061a6; \ text-decoration: none; \ cursor: pointer; \ }';
 * 1) QuickToolsModal { \
 * 1) QuickToolsWrapper { \
 * 1) QuickToolsWrapper, \
 * 2) QuickToolsWrapper>td, \
 * 3) QuickToolsWrapper>th, \
 * 4) QuickToolsWrapper > tr { \
 * 1) QuickToolsHead { \
 * 1) QuickToolsHeading { \
 * 1) QuickToolsClose { \
 * 1) QuickToolsClose:hover { \
 * 1) QuickToolsWrapper { \
 * 1) QuickToolsContext { \
 * 1) QuickToolsRail { \
 * 1) QuickToolsRail > ul { \
 * 1) QuickToolsDraw { \
 * 1) QuickToolsDraw hr { \
 * 1) QuickToolsDraw p { \
 * 1) QuickToolsStatus { \

/** * Adds even listeners to various UI components * * @function [args] none * @returns [] none */ QuickTools.addListeners = function { // Open button (tool bar) document.getElementById('QuickToolsOpen').addEventListener('click', function {       QuickTools.showHideModal;    });

// Close button (in modal) document.getElementById('QuickToolsClose').addEventListener('click', function {       QuickTools.showHideModal;    });

//All sidebar buttons $('#QuickToolsRail ul li').each(function {       $(this).click(function { switch ($(this).children('a').text.toLowerCase) { case 'batch delete': QuickTools.applet.showApplet('batch delete'); break; case 'block': QuickTools.applet.showApplet('block'); break case 'delete': QuickTools.applet.showApplet('delete'); break; case 'move': QuickTools.applet.showApplet('move'); break; case 'protect': QuickTools.applet.showApplet('protect'); break; default: QuickTools.applet.showApplet('home'); }       });    }); };

/** * Adds modal HTML and CSS to the body/head of the page * * @function [args] none * @returns [] none */ QuickTools.buildModal = function { $('body').append(QuickTools.formHTML); document.getElementsByTagName('head')[0].innerHTML += ' ' + QuickTools.formCSS + ' '; }; /** * Toggles the modals state on or off * * @function [args] none * @returns [] none * * @TODO: Replace with CSS animations */ QuickTools.showHideModal = function { if (QuickTools.modalShown == false) { $('#QuickToolsModal').fadeIn('slow'); QuickTools.modalShown = true; } else if (QuickTools.modalShown == true) { $('#QuickToolsModal').fadeOut('slow'); QuickTools.modalShown = false; } };

/** * Draws applet HTML to the applet context * * @function [args] [[string](applet): applet name] * @returns [] none */ QuickTools.applet.showApplet = function(applet) {   var applet = applet.replace(/ /g, '');

$('#QuickToolsDraw').html(QuickTools.applet.html[applet]);

if (applet !== 'home') { $('a[name=QuickToolsSubmit]').click(function {           QuickTools.applet[applet];        }); } };

/** * Creates an XHR request to the API * * @function [args] [[object](payload): API params] * @returns [[object](response data)] */ QuickTools.applet.post = function(payload, callback) {   $.ajax({        url: mw.util.wikiScript('api'),        type: "POST",        dataType: "JSON",        data: payload,        success: function(data) {            callback(data);        },        error: function(err, status) {            callback('FAILED ' + err + ':' + status);        }    }); };

/** * Creates an XHR request to the API * * @function [args] [[string](message): message to write] *                  [[bool](status): fail or success] * @returns [] none */ QuickTools.applet.writeOut = function(message, status) {    var html = $('#QuickToolsStatus').html;    var color = status === true ? 'white' : 'red';    var line = '> ' + message + ' ';

html += line;

$('#QuickToolsStatus').html(html); };

/** * Creates an XHR request to the API * * @function [args] none * @returns [] none */ QuickTools.applet.block = function { var payload = { action: 'block', user: $('input[name=QuickToolsBlock]').val, expiry: $('input[name=QuickToolsDuration]').val, reason: $('input[name=QuickToolsReason]').val, nocreate: '', allowusertalk: '', autoblock: 0, format: 'json', token: mw.user.tokens.values.editToken };

if (!$('input[name=QuickToolsNoCreate]:checked').length > 0) { delete payload.nocreate; }   if ($('input[name=QuickToolsNoTalk]:checked').length > 0) { delete payload.allowusertalk; }

QuickTools.applet.writeOut('attempting to block ' + payload.user + ' for ' + payload.expiry + '...', true);

QuickTools.applet.post(payload, function(data) {       if (typeof data === 'object') {            if (!data.error) {                QuickTools.applet.writeOut(payload.user + ' was blocked!', true);            } else {                QuickTools.applet.writeOut('block failed: ' + data.error.code, false);            }        } else {            QuickTools.applet.writeOut(result, false);        }    }); };

/** * Initializes script * * @function [args] none * @returns [] none */ QuickTools.init = function { if ($('#QuickToolsOpen').length > 0) { return; }

var link ='Quick Tools';

$('.toolbar > ul.tools').append(link); QuickTools.buildModal; QuickTools.addListeners; QuickTools.applet.showApplet('home'); };

$(document).ready(function {   QuickTools.init; });