User:Retired username/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
function addDeleteLink() {
    var targetSpan = document.getElementById('specialDeleteTarget');
    var linkSpan = document.getElementById('specialDeleteLink');
    if (targetSpan == null || linkSpan == null) return;
 
    var targetLink = targetSpan.getElementsByTagName("A")[0];
    if (targetLink == null) return;
 
    var targetTitle = targetLink.childNodes[0].data;
 
    var deleteHref = "http://en.wikipedia.org/w/index.php?action=delete&title=" + escape(targetTitle);
 
    var deleteSpan = null;
    with (easyDom) {
        deleteSpan = span({ "class": "plainlinks" }, " (", a({ "href": deleteHref, "class": "external text" }, "delete"), ")");
    }
 
    linkSpan.appendChild(deleteSpan);
}
addOnloadHook(addDeleteLink);
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Mike_Dillon/easydom.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// CSD AutoReason
importScript('User:^demon/csd.js');
 
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
 
// <pre>
// [[User:S/tags.js]]
// <nowiki>
//
// 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('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
//importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
 
if(typeof(autosubmit) == 'undefined') { var autosubmit = 'false'; }
if(typeof(minoredit) == 'undefined') { var minoredit = 'true'; }
if(typeof(show_cwli) == 'undefined') { var showcwli = 'false'; }
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 'abbr':
		text = '{' + '{' + 'Abbreviations|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as containing inappropriate abbreviations using [[User:S/tags|tags]]';
		break;
	case 'confusing':
		text = '{' + '{' + 'confusing|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as confusing using [[User:S/tags|tags]]';
		break;
	case 'copyedit':
		text = '{' + '{' + 'copyedit|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as requiring some copyediting using [[User:S/tags|tags]]';
		break;
	case 'context':
		text = '{' + '{' + 'context|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as providing insufficient context using [[User:S/tags|tags]]';
		break;
	case 'cleanup':
		text = '{' + '{' + 'Cleanup|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as requiring cleanup using [[User:S/tags|tags]]';
		break;
	case 'globalize':
		text = '{' + '{' + 'Globalize|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as being in need of globalization using [[User:S/tags|tags]]';
		break;
	case 'resume':
		text = '{' + '{' + 'Like-resume|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as possibly being in violation of [[WP:COI|conflict of interest policy]] using [[User:S/tags|tags]]';
		break;
	case 'orphan':
		text = '{' + '{' + 'orphan|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as being orphaned using [[User:S/tags|tags]]';
		break;
	case 'subsections':
		text = '{' + '{' + 'Subsections' + '}' + '}\n\n' + text;
		summary = 'Marked article as needing subsections using [[User:S/tags|tags]]';
		break;
	case 'uncategorized':
		text = '{' + '{' + 'uncategorized|date=' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as needed categorization using [[User:S/tags|tags]]';
		break;
	case 'unreferenced':
		text = '{' + '{' + 'Unreferenced|date=' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as not properly citing its sources using [[User:S/tags|tags]]';
		break;
	case 'wikify':
		text = '{' + '{' + 'wikify|' + date.getUTCMonthName() + ' ' + date.getUTCFullYear() + '}}\n\n' + text;
		summary = 'Marked article as needing wikification using [[User:S/tags|tags]]';
		break;
	case 'can we link it':
		window.location = "http://can-we-link-it.nickj.org/suggest-links/suggester.php?page=" + encodeURIComponent( wgPageName );
		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();
	}
}
 
addOnloadHook(function() {
		if ( wgCanonicalNamespace  in { "User":'', "User_talk":'' } ) {
			return;
		}
		if ( document.editform ) {
			var tabs = document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0];
			addlimenu(tabs, "tags", "tags" );
			addPortletLink("tags", "javascript:doCleanup('abbr')", "abbr", "abbr", "Add abbreviations template", "");
			addPortletLink("tags", "javascript:doCleanup('confusing')", "confusing", "confusing", "Add confusing template", "");
			addPortletLink("tags", "javascript:doCleanup('copyedit')", "copyedit", "copyedit", "Add Copyedit template", "");
			addPortletLink("tags", "javascript:doCleanup('context')", "context", "context", "Add Context template", "");
			addPortletLink("tags", "javascript:doCleanup('cleanup')", "cleanup", "cleanup", "Add cleanup template", "");
			addPortletLink("tags", "javascript:doCleanup('globalize')", "globalize", "globalize", "Add Globalize template", "");
			addPortletLink("tags", "javascript:doCleanup('resume')", "resume", "resume", "Add Like-resume template", "");
			addPortletLink("tags", "javascript:doCleanup('orphan')", "orphan", "orphan", "Add orphan template", "");
			addPortletLink("tags", "javascript:doCleanup('subsections')", "subsections", "subsections", "Add Subsections template", "");
			addPortletLink("tags", "javascript:doCleanup('uncategorized')", "uncategorized", "uncategorized", "Add uncategorized template", "");
			addPortletLink("tags", "javascript:doCleanup('unreferenced')", "unreferenced", "unreferenced", "Add unreferenced template", "");
			addPortletLink("tags", "javascript:doCleanup('wikify')", "wikify", "wikify", "Add wikify template", "");
			if ( show_cwli == true ) {
				addPortletLink("tags", "javascript:doCleanup('can we link it')", "can we link it", "can we link it", "Can we link it", ""); 
			}
 
 
		}
	});
 
// </nowiki>
// </pre>
 
show_cwli=true;
 
//this helps automate AfD closing by adding a 'close' tab to AfD debates
//written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]
 
function autoafd_result()
{
  var close = prompt("Result of debate?")
  var f = document.editform, t = f.wpTextbox1;
  t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0');
  t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "ab" + "}}";
  f.wpSummary.value = "Closing debate; result was " + close;
}
 
function autoafd_relist()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
  f.wpSummary.value = "Relisting debate";
}
 
function autoafd_keep()
{
  var date = prompt("Nomination was made when?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article survived AfD";
}
 
function autoafd_no_consensus()
{
  var date = prompt("Nomination was made when?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article survived AfD with no consensus";
}
 
function autoafd_redirect()
{
  var date = prompt("Nomination was made when?")
  var redirect = prompt("Redirect to?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";
}
 
function autoafd_merge()
{
  var date = prompt("Nomination was made when?")
  var redirect = prompt("Merge and redirect to?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD";
}
 
function autoafd_other()
{
  var date = prompt("Nomination was made when?")
  var result = prompt("Result was?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "AfDed; result was " + result;
}
 
function autoafd_add_afd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
    {
      addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
      addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
  if (document.title.indexOf("Editing Talk:") != -1)
    {
      addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep");
      addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
      addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
      addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge");
      addPortletLink('p-cactions', 'javascript:autoafd_other()', "other");
    }
}
 
addOnloadHook(autoafd_add_afd_tabs);
 
//end AfD closing script