Jump to content

User:Smith609/reftool.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.
function addRefTool() {
	if (document.getElementById('wpDiff')){
	 diff = document.getElementById('wpDiff');
	 refButton = document.createElement("input");
	 refButton.value="Convert refs";
	 refButton.type="submit";
	 originalAction=document.getElementById('editform').getAttribute('action');
	 refButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Scholar/Refs.php')");
	 refButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Scholar/Refs.php')");
	 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(refButton, diff.nextSibling);
	}

}
$(addRefTool);