User:Sunny910910/WarningScript.js

From Wikipedia, the free encyclopedia

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.

//THIS SCRIPT IS DISIGNED TO PROVIDE BUTTONS FOR
//ADDING USER WARNINGS
//THE "DH" ADDS <nowiki>== {{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}} ==</nowiki>
//IT SHOULD BE USED FOR ADDING THE HEADER 
//ABOVE WARNINGS
//
//
//
//DATEHEADER
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:datehead()','DH','ca-datehead','Add date as header'); });
function datehead() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '== {{' + 'subst:CURRENTMONTHNAME}} {{' + 'subst:CURRENTYEAR}} ==';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
//UW-VAND 1-4
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Vand1()','V1','ca-Vand1','subst:vandalism1'); });
function Vand1() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-vandalism1}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Vandalism1';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Vand2()','2','ca-Vand2','subst:vandalism2'); });
function Vand2() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-vandalism2}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Vandalism2';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Vand3()','3','ca-Vand3','subst:vandalism3'); });
function Vand3() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-vandalism3}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Vandalism3';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Vand4()','4','ca-Vand4','subst:vandalism4'); });
function Vand4() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-vandalism4}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Vandalism4';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Vand4im()','4im','ca-Vand4im','subst:vandalism4im'); });
function Vand4im() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-vandalism4im}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Vandalism4im';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
//UW-DELETE 1-4
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Delete1()','D1','ca-Delete1','subst:Delete1'); });
function Delete1() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-delete1}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Delete1';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Delete2()','D2','ca-Delete2','subst:Delete2'); });
function Delete2() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-delete2}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Delete2';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Delete3()','D3','ca-Delete3','subst:Delete3'); });
function Delete3() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-delete3}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Delete3';
  document.forms["editform"].wpWatchthis.checked = false 
}
 
if(wgNamespaceNumber == 3 && wgAction == 'edit') addOnloadHook(function() { addPortletLink('p-cactions','javascript:Delete4()','D4','ca-Delete4','subst:Delete4'); });
function Delete4() {
  if(document.getElementById('wpTextbox1').value != '') document.getElementById('wpTextbox1').value += '\n'
  document.getElementById('wpTextbox1').value += '{{' + 'subst:uw-delete4}} ~~' + '~~';
  document.getElementById('wpSummary').value += 'Warning: Delete4';
  document.forms["editform"].wpWatchthis.checked = false 
}