User:Shining-Armor/cologneblue.js

//Add link to Special:Nuke //By Lil' Miss Rarity if (mw.config.get("wgCanonicalSpecialPageName") === "Contributions") { $(".chat-change-ban").after(" | Nuke");

$(".chat-change-ban").after(" | Nuke + Block (A)");

$("#contribs-nuke-block").click(function {        $.ajax({ url: "/api.php", type: "POST", dataType: "JSON", data: { action: "block", user: (mw.config.get("wgPageName").split("/")[1]), expiry: "indefinite", reason: "Advertisement", nocreate: 0, autoblock: 0, format: "json", token: mw.user.tokens.values.editToken },           success: function (d) { if (!d.error) { window.location.replace("/wiki/Special:Nuke/" + (mw.config.get("wgPageName").split("/")[1])); } else { alert("Request failed: " + d.error.code); }           },            error: function  { alert("Request failed!"); }       });    }); }

/* Multiple Interwiki links - by Monchoman45 */ window.InterwikiEdit = { buffer: true, threads: 10,

running: 0, queue: [] };

InterwikiEdit.onload = function { if (wgCanonicalSpecialPageName == 'InterwikiEdit' && !mw.util.getParamValue('action')) { var gui = document.createElement('div'); gui.innerHTML = 'Multiple List each domain (eg. ), one on each line. This will link each specified wiki to every other specified wiki.    '; document.getElementById('mw-content-text').appendChild(gui); } } $(InterwikiEdit.onload);

InterwikiEdit.linkAll = function (wikis) { for (var i = 0; i < wikis.length - 1; i++) { for (var j = i + 1; j < wikis.length; j++) { if (wikis[i] != wikis[j]) { if (!InterwikiEdit.buffer || InterwikiEdit.running < InterwikiEdit.threads) { InterwikiEdit.link(wikis[i], wikis[j], InterwikiEdit.linkAllCallback); InterwikiEdit.running++; } else { InterwikiEdit.queue.push([wikis[i], wikis[j]]); }           } else { console.log(i + ' == ' + j); }       }    } }

InterwikiEdit.link = function (wiki1, wiki2, callback) { if (!wiki1 || !wiki2) { return false; }   var get = new XMLHttpRequest; var url = '/wiki/Special:InterwikiEdit?action=Link&wikia=' + wiki1 + '.wikia.com&ext_wikia=' + wiki2 + '.wikia.com&useskin=wikia'; get.open('GET', url, true); get.onreadystatechange = function { if (this.readyState == 4 && this.status == 200) { var html = document.createElement('html'); html.innerHTML = this.responseText; var form = html.getElementsByTagName('form'); for (var i = 0; i < form.length; i++) { if (form[i].id == 'chooseaction') { form = form[i]; break; }           }

var post = new XMLHttpRequest; post.open('POST', url, true); post.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); post.onreadystatechange = function { if (this.readyState == 4 && this.status == 200 && typeof callback == 'function') { callback.call(this, wiki1, wiki2); }           }            post.send('action=commit_link&wikia_id=' + form['wikia_id'].value + '&ext_wikia_id=' + form['ext_wikia_id'].value); }   }    get.send; return get; }

InterwikiEdit.linkAllCallback = function (wiki1, wiki2) { var output = document.getElementById('interwiki-multiple-output'); var scroll = false; if (output) { if (output.offsetHeight + output.scrollTop >= output.scrollHeight) { scroll = true; }       output.innerHTML += wiki1 + ' >=< ' + wiki2 + '\n'; }   if (InterwikiEdit.queue.length > 0) { wikis = InterwikiEdit.queue.shift; InterwikiEdit.link(wikis[0], wikis[1], InterwikiEdit.linkAllCallback); } else { InterwikiEdit.running--; if (InterwikiEdit.running == 0 && output) { output.innerHTML += '-\n'; }   }    if (scroll) { output.scrollTop = output.scrollHeight; } }