User:John Vandenberg/tags.js

// // User:JayVDB/tags.js // // // Tags for Wikisource // Copied from tags script by S (formerly known as Seed 2.0) - // uber-alpha hack // heavily based on CleanupTab.js // My thanks and major props go to AzaToth.

//requires: //importScript('User:JayVDB/Add LI menu'); //importStylesheet('User:JayVDB/Add LI menu/css');

if(typeof(autosubmit) == 'undefined') { var autosubmit = 'false'; } if(typeof(minoredit) == 'undefined') { var minoredit = 'true'; }

Date.monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; Date.prototype.getMonthName = function { return Date.monthNames[ this.getMonth ]; } Date.prototype.getUTCMonthName = function { return Date.monthNames[ this.getUTCMonth ]; }

function doCleanup(n) { text = document.editform.wpTextbox1.value; date = new Date;

switch(n) { case 'commons': text = '{' + '{' + 'Move to Wikimedia Commons}}\n\n' + text; summary = 'Marked image to be moved to Wikimedia Commons using tags'; break; case 'delete': text = '{' + '{' + 'delete}}\n\n' + text; summary = 'Marked image as listed on Proposed deletions using tags'; break; }	document.editform.wpSummary.value = summary; document.editform.wpTextbox1.value = text; if (minoredit == true) { document.editform.wpMinoredit.checked = true; }

if (autosubmit == true) { document.editform.submit; } }

$(function {		if ( wgCanonicalNamespace in { "User":, "User_talk": } ) {			return;		}		if ( document.editform ) {			var tabs = document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0];			addlimenu(tabs, "tags", "tags" );			mw.util.addPortletLink("tags", "javascript:doCleanup('commons')", "commons", "commons", "Move to Wikimedia Commons", "");			mw.util.addPortletLink("tags", "javascript:doCleanup('delete')", "delete", "commons", "Mark for deletion", "");		}	});

// //