Jump to content

User:Mattflaschen/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=application/javascript&smaxage=21600&maxage=86400');

importScript('User:Mattflaschen/catscan.js');

function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //* name is what will appear as the name of the button.
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //* key is the char you want for the accesskey. Optional.
    //* after is the id of the button you want to follow this one. Optional.
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }

    return li;
}

function doTag(tag, summary, minor, watch)
{
document.editform.wpTextbox1.value = "{{" + tag + "}}" + "\n\n" + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = summary;
document.editform.wpMinoredit.checked = minor;
document.editform.wpWatchthis.checked = watch;
}

function doWPUI() {
  document.editform.wpSummary.value = "Thousands of pictures are untagged. [[WP:UI|You can help!]]";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = false;
  document.editform.submit();
}

importScript('User:Mattflaschen/CommonsHelper Labs.js');

function addUserLogs()
{
  var user = wgTitle;
  addLink("p-tb", "/w/index.php?title=Special:Log&type=block&page=User:" + user, "Block log", "t-blocklog", null, null, "t-blockip");
  //addLink("p-tb", "/w/index.php?title=Special:Log&user=" + user, "User log", "t-userlog", null, null, "t-blocklog");
  addEditCount(user);
}

//added encodeURIComponent (2008-09-29)
function addEditCount(user)
{
  addLink("p-tb", "//tools.wikimedia.de/~river/cgi-bin/count_edits?user=" + encodeURIComponent(user) + "&dbname=enwiki_p", "Edit count", "t-editcount", null, null, "t-log");

}

//added encodeURIComponent (2008-09-29)
function addPageLog()
{
  addLink("p-tb", "/w/index.php?title=Special%3ALog&page=" + encodeURIComponent(mw.config.get('wgPageName')), "Log", "t-pagelog", null, null, "t-whatlinkshere");
}

if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") 
{
  addOnloadHook(addUserLogs);
}

if (wgCanonicalNamespace == "Special" && wgTitle == "Contributions")
{
  addOnloadHook(addContribLinks);
}

function addContribLinks()
{
  var allForms = document.getElementsByTagName("form");
  var contribForm = allForms[0];

  var targetInput;
  var i = 0;
  var allInputs = contribForm.getElementsByTagName("input");
  
  while((targetInput == null || targetInput.getAttribute("name") != "target") && i < allInputs.length)
  {
    targetInput = allInputs[i];
    i++;
  }

  username = targetInput.getAttribute("value");
  addEditCount(username);
}

if(wgCanonicalNamespace != "Special")
{
  addOnloadHook(addPageLog);
}

// [[User:Mattflaschen/Compare link.js]]
importScript("User:Mattflaschen/Compare link.js");

if (wgPageName == "Special:Statistics")
{
  setTimeout(function()
             {
               window.location.reload();
             }, 30000);
}

var toggleScript = document.createElement("script");
toggleScript.src = "//commons.wikimedia.org/w/index.php?title=User:Mattflaschen/noGalleryToggle.js&action=raw&ctype=text/javascript&dontcountme=s";
document.getElementsByTagName("head")[0].appendChild(toggleScript);

proveit = window.proveit || {};
proveit.dateFormatString = 'ISO 8601';
// proveit.shouldAddSummary = false;
// proveit.loadMaximized = true;
// proveit.isSupportedEditPage = function(){ return true; };

// importScript('User:ProveIt GT/ProveIt.js'); // Dev
// [[User:ProveIt GT/ProveIt.js]]

// mw.loader.load('//proveit-js.googlecode.com/hg/ProveIt_Wikipedia.js'); // Production in repo, with comments

// Switch from VE to source mode, preserving work, by clicking "Edit source" while in VE.
importScript( 'User:John Vandenberg/switch editor 2.js' );
// </nowiki>