Difference between revisions of "MediaWiki:Common.js"

From NewlyPossible.org
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
 +
 +
$( function ()  {
 +
 +
 +
/**
 +
* Automatically tick the minor edit check box
 +
*
 +
* @source: https://www.mediawiki.org/wiki/Snippets/Mark_minor_edit
 +
* @rev: 2
 +
*/
 +
jQuery( document ).ready( function( $ ) {
 +
if( mw.config.get( 'wgAction' ) === 'edit' ) {
 +
document.getElementById( 'wpMinoredit' ).checked = true;
 +
}
 +
} );
 +
  
 
var x = document.getElementsByTagName("h3");
 
var x = document.getElementsByTagName("h3");
Line 6: Line 22:
 
  x[i].insertAdjacentHTML ("afterend", "<div><p>[[#BackToTop|Go to Top]]</p></div>");
 
  x[i].insertAdjacentHTML ("afterend", "<div><p>[[#BackToTop|Go to Top]]</p></div>");
 
}
 
}
 +
 +
 +
} );

Revision as of 07:08, 27 February 2021

/* Any JavaScript here will be loaded for all users on every page load. */

$( function ()  {


/**
 * Automatically tick the minor edit check box
 *
 * @source: https://www.mediawiki.org/wiki/Snippets/Mark_minor_edit
 * @rev: 2
 */
jQuery( document ).ready( function( $ ) {
	if( mw.config.get( 'wgAction' ) === 'edit' ) {
		document.getElementById( 'wpMinoredit' ).checked = true;
	}
} );


var x = document.getElementsByTagName("h3");
var i;
for (i = 0; i < x.length, i++) {
 x[i].insertAdjacentHTML ("afterend", "<div><p>[[#BackToTop|Go to Top]]</p></div>");
}


} );