User:RandyWang/autocvgdeletion

From Wikipedia, the free encyclopedia

Add this script (not including the <pre></pre> tags) to /[YOURUSERNAME]/monobook.js before flushing your cache (shift-clicking your Reload button, normally) to make it work. Full credit goes to User:Raylu for this code, I just modified it.

It requires Add LI link and Add tab, so make sure you install those in your monobook.js before using this script.

// From code by [[User:Raylu|raylu]]
//
//
// This script adds a "CVG Deletion" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doCvgdeletion() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'CVG' + ' ' + 'deletion' + '}' + '}';
  document.editform.wpSummary.value = 'Now a CVG deletion.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addCvgdeletion() {
  addTab("javascript:doCvgdeletion()", "cvgdeletion", "ca-cvgdeletion", "CVG Deletion", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1 || document.title.indexOf("Articles for deletion") == -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addCvgdeletion);
  }
});