User:Quinxorin/vector.js

From wikishia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
importScript('User:TheDJ/qui.js');
//////////STATUS CHANGER
// Creator: Misza13
// Credits: Voyagerfan5761 for some minor improvements
// Modified by Xenocidic to simply use /Status as a one word indicator,
// Modified by Kraftlos to include Sleep status
// compatible with {{Statustop}} for display
 
addOnloadHook(function (){
  //Check if the config is defined
  if (typeof(statusChangerConfig) == 'undefined') {
    statusChangerConfig = {}
  }
 
  if (typeof(statusChangerConfig.statusList) == 'undefined') {
      statusChangerConfig.statusList = [ 'online', 'busy', 'around', 'offline', 'sleep' ];
  }
 
  if (typeof(statusChangerConfig.statusPage) == 'undefined') {
      statusChangerConfig.statusPage = 'User:' + wgUserName + '/Status';
  }
 
  //Add the links
  for (var i=0; i<statusChangerConfig.statusList.length; i++) {
    var stat = statusChangerConfig.statusList[i];
    var message = (stat === "sleep") ?  link = "asleep" : link = stat;
    addPortletLink(
      "p-personal", //target tab - personal links
      wgServer + wgScript + "?title=" + statusChangerConfig.statusPage + "&action=edit&newstatus=" + stat, //link URL
      stat, //link text
      "pt-status-" + stat, //id of new button
      "I'm " + message + "!", //hover text
      "", //???
      document.getElementById("pt-logout")); //add before logout button
  }
 
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  var status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = status;
  document.getElementById('wpSummary').value = wgUserName + " is now " + status +".";
  document.getElementById('wpMinoredit').checked = true;
  //Submit it!
  document.getElementById('editform').submit();
});
 
//[[Category:Wikipedia scripts|statusChanger]]
importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]//Mass rollback function
//Written by John254
//Adapted from User:Mr.Z-man/rollbackSummary.js
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)
 
function rollbackEverythingButton() {
  var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link");
  if (hasRollback[0] && (document.title.indexOf("User contributions") != -1) ) {
    addPortletLink('p-cactions', 'javascript:rollbackEverything()', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
  }
}
addOnloadHook(rollbackEverythingButton);
function rollbackEverything() {
    for (var i in document.links) {
      if (document.links[i].href.indexOf('action=rollback') != -1) {
        window.open(document.links[i].href);
      }
    }
}

// For description, see [[User:Mr.Z-man/rollbackSummary]]
 
function rollbackSummary() {
  var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link");
  if (hasRollback[0]) {
    addPortletLink('p-cactions', 'javascript:setRollbackSummary()', "rollback summary", "ca-rollbacksummary", "Set rollback link edit summary");
  }
}
addOnloadHook(rollbackSummary);
function setRollbackSummary() {
  summary = prompt("Change the default rollback summary for rollback links on this page to:", "");
  if (!summary) {
    for (var i in document.links) {
      if (document.links[i].href.indexOf('summary=') != -1) {
        document.links[i].href = document.links[i].href.substring(0, document.links[i].href.indexOf('summary=')-1);
      }
    }
  }
  else {
  summary = "&summary=" + encodeURIComponent(summary);
    for (var i in document.links) {
      if (document.links[i].href.indexOf('action=rollback') != -1) {
        document.links[i].href += summary;
      }
    }
  }
}