User:Jonpatterns/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin can be added at User:Jonpatterns/common.css. |
//Qwikify
//Add Wikify option to wikipedia - the option adds the {{wikify}} template to the top of the page
//Issue - requires user to be editing article, does not put anything in edit summary, {{wikify}} template is depreciated.
$(document).ready( function () {
// Make sure the utilities module is loaded (will only load if not already)
mw.loader.using( 'mediawiki.util', function () {
// Wait for the page to be parsed
$(document).ready( function () {
//see below "Portlets" subsection
var link = mw.util.addPortletLink( 'p-cactions', '#', 'Wikify', 'ca-wikify', 'Mark for wikification');
$( link ).click( function ( event ) {
event.preventDefault();
doQwikify();
} );
} );
} );
} );
function doQwikify() {
document.editform.wpTextbox1.value = "{" + "{wikify}}\n\n" + document.editform.wpTextbox1.value;
document.editform.submit();
}
$(function() {
var elems = document.getElementsByClassName('editsection');
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);
}
});