User:Nightclubbing/common.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.
importScript('User:Ohconfucius/script/Sources.js'); // [[User:Ohconfucius/script/Sources.js]]
importScript('User:Ohconfucius/script/formatgeneral.js'); // [[User:Ohconfucius/script/formatgeneral.js]]
importScript('User:Cameltrader/Advisor.js');
// Wikipedia:Tools/Navigation popups
importScript('MediaWiki:Gadget-popups.js');
importStylesheet('MediaWiki:Gadget-navpop.css');
mw.loader.load( '//de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript' );
importScript('User:Ohconfucius/script/MOSNUM dates.js'); // [[User:Ohconfucius/script/MOSNUM dates.js]]
importScript('User:Salix alba/Citoid.js'); // Linkback: [[User:Salix alba/Citoid.js]]
// Add [[WP:Reflinks]] launcher in the toolbox on left
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://dispenser.homenet.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName')
   + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'),
  "Reflinks"  // link label
)});
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]
// @Version 1.00 - Adds a "Citation bot" link to the toolbox, and a button beneath edit fields.
// @Version 1.01 - Sets accept-charset to avoid mangling special characters

function addCBetaToToolbox() {
  if (mw.config.get('wgCanonicalNamespace') != "Special") {
   var pTb = document.getElementById("p-tb");
   if( !pTb ) return;
   var escPageName = encodeURIComponent(mw.config.get('wgPageName'));
importScript('User:Ohconfucius/script/EngvarB.js'); // [[User:Ohconfucius/script/EngvarB.js]]
   mw.util.addPortletLink("p-tb", "http://tools.wmflabs.org/citations-dev/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(mw.config.get('wgUserName'))+"&page="+escPageName, 'Expand citations [Beta]', '', "Expand citations and fix common formatting errors");
    }
}

// Add a citation bot button
function addCitationBeta() {
	if (document.getElementById('wpDiff')){
	 var diff = document.getElementById('wpDiff');
	 var cbetaButton = document.createElement("input");
	 cbetaButton.value="Citations [Beta]";
	 cbetaButton.type="submit";
	 originalAction=document.getElementById('editform').getAttribute('action');
	 cbetaButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://tools.wmflabs.org/citations-dev/text.php')");
	 cbetaButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://tools.wmflabs.org/citations-dev/text.php')");
        // document.getElementById('editform').setAttribute('accept-charset', 'UTF-8');
	 diff.setAttribute("onmousedown", originalAction);
	 diff.setAttribute("onkeydown", originalAction);
	 document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);
	 document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);
	 document.getElementById('wpSave').setAttribute("onmousedown", originalAction);
	 document.getElementById('wpSave').setAttribute("onkeydown", originalAction);
	 diff.parentNode.insertBefore(cbetaButton, diff.nextSibling);
	}

}
$(addCitationBeta);
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {
  addOnloadHook(addCBetaToToolbox);
}
importScript('User:Ohconfucius/script/EngvarB.js'); // [[User:Ohconfucius/script/EngvarB.js]]