Jump to content

User:Voice of All/Adminwarnings/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<pre><nowiki>

function welcometn(num)
{
  var varticle = '';
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
  {t.value += '\n';}
  if (num==1)
  {
  t.value += "{{subst:Welcome}} ~~~~";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==2)
  {
  t.value += "{{subst:Anon}} ~~~~";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==3)
  {
  t.value += "{{subst:User:Centrx/Welcome}}";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
  else if (num==4)
  {
  t.value += "{{subst:W-screen}}";
  f.wpSummary.value = "Welcome to our free Encyclopedia!";
  }
}

function testn(number)
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any unconstructive edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "test" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " test" + number;
}

function povn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "Uw-npov1" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " Uw-npov1";
}

function warningn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "Uw-bv" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " bv";
}

function revertsn()
{
  var IPnoteR = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnoteR = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning, but aviod making any [[Wikipedia:revert|reverts]] within 24 hours of this warning in order to avoid any confusion.'' ";}
  var article = prompt("Enter the page name where the 3RR violation occured:")
  articleh = article.replace(/ /g, '_');
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding reversions" + "[http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "Uw-3rr" + "}} " + IPnoteR + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " 3rr";
}

function finalwn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += ":{{subst:" + "uw-vandalism4" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " final warning";
}

function blockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "Uw-vblock" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " temporary block";
}

function spamblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "Uw-sblock" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " temporary block";
}

function schoolblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "schoolblock" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " temporary school IP block";
}

function indefblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "vandalblock" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " indefinite block";
}

function usernameblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "Uw-ublock|subst=subst:|sig=y}}";
  f.wpSummary.value = "User notice:" + " username block";
}

function usernameblockvn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "Uw-uhblock|subst=subst:|sig=y}}";
  f.wpSummary.value = "User notice:" + " username block";
}
function rrblockn()
{
  username_a = document.URL.match(/:.*:(.*)/);
  username=username_a[1];
  var article = prompt("Enter the page name where the 3RR violation occured:");
  articleh = article.replace(/ /g, '_');
  var well = prompt("Warning is already in context (*y* or *n*)?")
  var time = prompt("Enter the duration of the block (in hours)")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    {t.value += '\r';}
  t.value += '<div style="background-color: #f9f9f9; border: 1px solid red; padding: 3px;">' + '\n';
  if (well == 'y' || well == 'yes')
  {
  t.value += ":{{subst:" + "3rr3" + "}} The duration of the [http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. [http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history Here] are the reverts in question. ~" + "~" + "~" + "~" + "</div>";
  }
  else if (well == 'n' || well == 'no') 
  {
  t.value += "==" + "Regarding reversions" + "[http://en.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "3rr3" + "}} The duration of the [http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. ~" + "~" + "~" + "~" + "</div>";
  }
  else 
  {
  prompt("Error, enter *y* or *n*.");
  return;
  }
  f.wpSummary.value = "User notice:" + " temporary 3RR block";
}

function testbl()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "Uw-delete2}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " Uw-delete2";
}

function spam(type)
{
  if (type == 1){var temp = 'Uw-spam1'}
  else if (type == 2){var temp = 'Uw-spam2'}
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + temp + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice: " + temp;
}

function rrwarn()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*The user has now been warned per [[WP:3RR|3RR]] not to let this happen again. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: user warned)');
  f.wpSummary.value = "Response: user warned";
}

function rrblock()
{
  var number = prompt("User blocked for how many hours?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*I have blocked the user for " + number + " hours per [[WP:3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: ' + number + ' hours)');
  f.wpSummary.value = "Response: user blocked";
}

function rrnoblock()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*The user has not yet violated [[WP:3RR]] because there are not yet four reverts within 24 hours nor is there any severely disruptive behavior. However, I have warned the user for nearly breaching [[WP:3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Result: no violation)');
  f.wpSummary.value = "Response: no violation";
}

//more tabs
addOnloadHook(add_testn_tabs)
function add_testn_tabs()
{ 
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  if (document.title.indexOf("Talk:") == -1 && document.title.indexOf("talk:") == -1 && document.title.indexOf("User:") == -1 && document.title.indexOf("MediaWiki:") == -1 && document.title.indexOf("Image:") == -1 && document.title.indexOf("Wikipedia:") == -1 && document.title.indexOf("Template:") == -1 && document.title.indexOf("Portal:") == -1 && document.title.indexOf("Help:") == -1 && document.title.indexOf("Main Page") == -1 && document.title.indexOf("Category:") == -1)
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';}
      if(document.getElementById('ca-talk'))
      {document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';}
      }
  else 
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';}
      if(document.getElementById('ca-talk'))
      {document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';}
      }
if (document.title.indexOf("Editing ") != -1)
{
  if (document.title.indexOf("Editing User talk:") != -1)
    {
        var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
        addlimenu(tabs, '{{message}}', 'warnfunc');
        var warnfunc = document.getElementById('warnfunc').getElementsByTagName('ul')[0];
        addlilink(warnfunc, 'javascript:welcometn(1)', 'welcome', '');
        addlilink(warnfunc, 'javascript:welcometn(3)', 'welcome2', '');
        addlilink(warnfunc, 'javascript:welcometn(4)', 'welcome3', '');
        addlilink(warnfunc, 'javascript:welcometn(2)', 'anon', '');
        addlilink(warnfunc, 'javascript:testn(1)', 'test', '');
        addlilink(warnfunc, 'javascript:povn()', 'NPOV', '');
        addlilink(warnfunc, 'javascript:testn(2)', 'vandal', '');
        addlilink(warnfunc, 'javascript:testn(3)', 'vandal2', '');
        addlilink(warnfunc, 'javascript:warningn()', 'bv', '');
        addlilink(warnfunc, 'javascript:testbl()', 'blanking', '');
        addlilink(warnfunc, 'javascript:spam(1)', 'spam', '');
        addlilink(warnfunc, 'javascript:spam(2)', 'spam2', '');
        addlilink(warnfunc, 'javascript:finalwn()', 'final', '');
        addlilink(warnfunc, 'javascript:blockn()', 'vblock', '');
        addlilink(warnfunc, 'javascript:spamblockn()', 'spamblock', '');
        addlilink(warnfunc, 'javascript:schoolblockn()', 'schoolblock', '');
        addlilink(warnfunc, 'javascript:indefblockn()', 'indefblock', ''); 
        addlilink(warnfunc, 'javascript:usernameblockn()', 'nameblock', '');
        addlilink(warnfunc, 'javascript:usernameblockvn()', 'hardnmblock', '');
        addlilink(warnfunc, 'javascript:revertsn()', '3rr', '');
        addlilink(warnfunc, 'javascript:rrblockn()', 'rr block', '');
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[d]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[m]';
      }  
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
    }
  else if (document.title.indexOf("Editing User:") != -1)
    {  
    var nothing = 'yes';
    }
  else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1)
    {
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[d]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[m]';
      } 
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
      }
    }
  else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1)
    {
    addTab('javascript:rrwarn()',"a|wn","ca-wn","Warned","");
    addTab('javascript:rrblock()',"a|bl","ca-bl","Blocked","");
    addTab('javascript:rrnoblock()',"r|cl","ca-cl","Close to 3RR","");
    }
 else if(document.title.indexOf("Wikipedia:") != -1 || document.title.indexOf("Help:Contents/Editing Wikipedia") != -1 || document.title.indexOf("Editing Talk") != -1 || document.title.indexOf("Editing Wikipedia talk") != -1)
    {
  {nothing=1;}
    }
}
 else if (document.title.indexOf("User:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
      }
 }
 else if (document.title.indexOf("User talk:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
      }
  }
}
//</nowiki></pre>