User:ZooFari/WarnMover.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// <source lang="javascript">
$ = jQuery; $(document).ready(function(){

// LRP
window.LicenseReview_P = function () {
		var diff = prompt("Diff:", "")
	document.editform.wpTextbox1.value = document.editform.wpTextbox1.value+'==Note on file moving==\nHi {{subst:PAGENAME}}. This is to remind you that you should follow the [[Commons:File renaming|renaming guidelines]] when moving files. The following move does not appear to be in accordance with the guidelines: [' + diff + '] Reason: [[Commons:File renaming#What files should not be renamed?]]. If you disagree with the this note, disregard it and let me know your reason. Thanks, ~~~~';
	document.editform.wpMinoredit.checked = false;
 
	document.editform.submit();

}


window.addFunction = function(functionNameString, buttonDisplayName, checkNameSpaceFlag, whereAdd) {
	if ( wgNamespaceNumber !== checkNameSpaceFlag && wgPageName !== "Commons:Sandbox" ) {
		return;
	}

	if ( getParamValue('functionName') == functionNameString) {
			eval(functionNameString+"(true)");
	}

	var href;
	if ( wgAction == 'edit' ){ 
		href = "javascript:" + functionNameString + "(true)";
	} else {
		href = wgScript + "?title=" + encodeURIComponent(mw.config.get('wgPageName')) + "&action=edit&functionName=" + functionNameString;
	}
	
	if (whereAdd == 'top') {
		mw.util.addPortletLink('p-cactions', href, buttonDisplayName);
	} else if (whereAdd == 'toolbox') {
		mw.util.addPortletLink('p-tb', href, buttonDisplayName);
	}
	// [link]
	var targets = getElementsByClassName(document, 'div', 'cleanup');
	if(targets.length === 0) return true;
	
	targets[0].style.textAlign = 'center';

		var passlink = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName=LicenseReviewChange";
	
		targets[0].innerHTML = '[<a href="'+passlink+'">Add Description</a>]';
		return true;
	//
}


// jQuery UI is not loaded on all pages yet:
if (jQuery.ui == undefined) {
	$.getScript(wgServer + '/w/extensions/UsabilityInitiative/css/vector/jquery-ui-1.7.2.css');
	$.getScript(wgServer + '/w/extensions/UsabilityInitiative/js/js2stopgap/jui.combined.min.js', function(){

		addFunction("LicenseReview_P", "WarnMover", 3, "top");
	});
} else {
	addFunction("LicenseReview_P", "WarnMover", 3, "top");
}

});
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Animum/massdelete.js&action=raw&ctype=text/javascript&smaxage=10000&maxage=50000");
// </source>