It is done - we hope you like our new style.
Please remember to make use of the Manual of Style and Code of Conduct during your stay on the wiki.

 Actions

MediaWiki

Difference between revisions of "Monobook.js"

From Dragon Mania Legends Wiki

(To test JS button in non-active theme)
 
m (Test MW way of scrolling sections in monobook)
Line 2: Line 2:
  
 
mw.loader.load( '/index.php?title=MediaWiki:ScrollTop.js&action=raw&ctype=text/javascript' );
 
mw.loader.load( '/index.php?title=MediaWiki:ScrollTop.js&action=raw&ctype=text/javascript' );
 +
 +
<!-- Test MW way of doing this -->
 +
$( function () {
 +
var elems = document.getElementsByClassName('editsection'); // *** NOTE: ClassName may need to be 'mw-editsection' instead
 +
for (i = 0; i < elems.length; i++) {
 +
var span = document.createElement('span');
 +
var link = document.createElement('a');
 +
link.href = '#top';
 +
link.appendChild(document.createTextNode('back to top'));
 +
span.appendChild(document.createTextNode('['));
 +
span.appendChild(link);
 +
span.appendChild(document.createTextNode('] '));
 +
elems[i].insertBefore(span, elems[i].firstChild);
 +
}
 +
});

Revision as of 00:14, 14 July 2019

/* Any JavaScript here will be loaded for users using the MonoBook skin */

mw.loader.load( '/index.php?title=MediaWiki:ScrollTop.js&action=raw&ctype=text/javascript' );

<!-- Test MW way of doing this -->
$( function () {
	var elems = document.getElementsByClassName('editsection'); // *** NOTE: ClassName may need to be 'mw-editsection' instead
	for (i = 0; i < elems.length; i++) {
		var span = document.createElement('span');
		var link = document.createElement('a');
		link.href = '#top';
		link.appendChild(document.createTextNode('back to top'));
		span.appendChild(document.createTextNode('['));
		span.appendChild(link);
		span.appendChild(document.createTextNode('] '));
		elems[i].insertBefore(span, elems[i].firstChild);
	}
});