Difference between revisions 318903 and 318904 on test2wiki

/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
 * |_____________________________________________________________________________|
 *
(contracted; show full)}

// Add a citation bot button
function addCitationBot() {
	if (document.getElementById('wpDiff')){
	 var diff = document.getElementById('wpDiff');
	 var cbButton = document.createElement("input");

	 var newline = document.createTextNode("\n");
	 cbButton.value="Citations";
	 cbButton.type="submit";
	 originalAction=document.getElementById('editform').getAttribute('action');
	 cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', '//tools.wmflabs.org/citations/text.php')");
	 cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', '//tools.wmflabs.org/citations/text.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(cbButton, diff.nextSibling);
	 diff.parentNode.insertBefore(newline, cbButton);
	}

}
$( addCitationBot );

if ( $.inArray( mw.config.get( 'skin' ), ['monobook', 'modern', 'vector'] ) !== -1 ) {
  $( addCBToToolbox );
}