User:FrancoGG/misfunciones.js

From Simple English Wikipedia, the free encyclopedia

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror:: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.

//<pre><nowiki>

function save()
{
   document.editform.submit();
}

function preview()
{
   document.editform.wpPreview.click();
}

function QD()
{
Qr="";
if (!Qr)
  {
   void(Qr = prompt("Reason:",""));
  }

if (Qr != null)
  {
   document.getElementById("wpTextbox1").value = "{{QD|" + Qr + "}}" + "\n\n" + document.getElementById("wpTextbox1").value;

   document.editform.wpSummary.value = "QD: " + Qr;
   document.editform.submit();
  }
}

function welcome()
{
var string = location.href;
var registered;
var discussion;

if (wgCanonicalNamespace == "User_talk") 
  {
   var ip_re = /^\d+\.\d+\.\d+\.\d+$/;
   discussion = true;
   if (ip_re.test(wgTitle)) 
     {
      registered = false;
     }
   else 
     {
      registered = true;
     }
  }
else
  {
   discussion = false;
  }

if (discussion)
  {
   if (registered)
     {
      document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:Welcomeg}}" + "\n";
     }
   else
     {
      document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:Anon}} ~~~~" + "\n";
     }

   if (string.indexOf('&section=new') != -1)
     {
      document.editform.wpSummary.value = "Welcome";
     }
   else
     {
      if (document.editform.wpSummary.value == "")
        {
         document.editform.wpSummary.value = "Welcome";
        }
      else
        {
         document.editform.wpSummary.value = document.editform.wpSummary.value + ", Welcome";
        }
     }
  }
else
  {
   alert("This is not a user talk page.");
  }
}

function test()
{
var string = location.href;
var discussion;

if (wgCanonicalNamespace == "User_talk") 
  {
   discussion = true;
  }
else
  {
   discussion = false;
  }

if (discussion)
  {
   document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:Test}} ~~~~" + "\n";

   if (string.indexOf('&section=new') != -1)
     {
      document.editform.wpSummary.value = "Test";
     }
   else
     {
      if (document.editform.wpSummary.value == "")
        {
         document.editform.wpSummary.value = "user notice: Test";
        }
      else
        {
         document.editform.wpSummary.value = document.editform.wpSummary.value + ", user notice: Test";
        }
     }
  }
else
  {
   alert("This is not a user talk page.");
  }
}

function test2()
{
var string = location.href;
var discussion;

if (wgCanonicalNamespace == "User_talk") 
  {
   discussion = true;
  }
else
  {
   discussion = false;
  }

if (discussion)
  {
   if (document.getElementById("wpTextbox1").value == "")
     {
      document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:Test2}} ~~~~" + "\n";
     }
   else
     {
      document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + ":{{subst:Test2}} ~~~~" + "\n";
     }

   if (string.indexOf('&section=new') != -1)
     {
      document.editform.wpSummary.value = "Test";
     }
   else
     {
      if (document.editform.wpSummary.value == "")
        {
         document.editform.wpSummary.value = "user notice: Test2";
        }
      else
        {
         document.editform.wpSummary.value = document.editform.wpSummary.value + ", user notice: Test2";
        }
     }
  }
else
  {
   alert("This is not a user talk page.");
  }
}

function bv()
{
var string = location.href;
var discussion;

if (wgCanonicalNamespace == "User_talk") 
  {
   discussion = true;
  }
else
  {
   discussion = false;
  }

if (discussion)
  {
   document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:Vandalism}} ~~~~" + "\n";

   if (string.indexOf('&section=new') != -1)
     {
      document.editform.wpSummary.value = "Vandalism";
     }
   else
     {
      if (document.editform.wpSummary.value == "")
        {
         document.editform.wpSummary.value = "user notice: Vandalism";
        }
      else
        {
         document.editform.wpSummary.value = document.editform.wpSummary.value + ", user notice: Vandalism";
        }
     }
  }
else
  {
   alert("This is not a user talk page.");
  }
}

function lastwarning()
{
var string = location.href;
var discussion;

if (wgCanonicalNamespace == "User_talk") 
  {
   discussion = true;
  }
else
  {
   discussion = false;
  }

if (discussion)
  {
   document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value + "{{subst:RepeatVandal}} ~~~~" + "\n";

   if (string.indexOf('&section=new') != -1)
     {
      document.editform.wpSummary.value = "Last warning";
     }
   else
     {
      if (document.editform.wpSummary.value == "")
        {
         document.editform.wpSummary.value = "user notice: RepeatVandal";
        }
      else
        {
         document.editform.wpSummary.value = document.editform.wpSummary.value + ", user notice: RepeatVandal";
        }
     }
  }
else
  {
   alert("This is not a user talk page.");
  }
}

//</nowiki></pre>