Jump to content

Wikipedia:WikiProject User scripts/Scripts/CleanupTab.js

From Wikipedia, the free encyclopedia
// <pre>
// CleanupTab.js
//
// This script adds a "cleanup" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doCleanup() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Cleanup|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for cleanup.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

addOnloadHook(function() {
  if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {
     return;
  }
  if (document.editform) {
     addPortletLink("p-cactions", "javascript:doCleanup()", "cleanup", "ca-cleanup", "Mark for cleanup", "");
  }
});

// </pre>