Usuário(a):Gdamasceno/monobook.js

Origem: Wikipédia, a enciclopédia livre.

Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer / Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
 /** Anti-vandal tool ************************************************************************
  *    Origem: [[Wikipedia:Software/antivandaltool.js]]
  *     Ajuda: [[Wikipedia:Software/Anti-vandal tool]]
  * Descrição: Monitorização de mudanças recentes
  *     Autor: [[:en:User:Lupin]]
  ********************************************************************************************/
 mw.loader.load( 'https://pt.wikipedia.org/w/index.php?title=Usu%C3%A1rio:Mosca/antivandaltool.js&action=raw&ctype=text/javascript' );


 /** Atalhos *********************************************************************************
  *     Ajuda: [[Wikipedia:Software/Scripts/Atalhos]]
  * Descrição: Acrescenta ligações personalizadas num menu lateral
  *     Autor: [[:en:User:Jsimlo]]
  ********************************************************************************************/
 mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Jsimlo/shortcuts.js&action=raw&ctype=text/javascript' );
 function shortcutsInit ()
 { 
  shortcutsStartSection ('utilidades');
  shortcutsAddLink ( 'Esplanada',        'Wikipedia:Esplanada' );
  shortcutsAddLink ( 'Pedidos admins',   'Wikipedia:Pedidos a administradores' );
  shortcutsAddLink ( 'Doc-levantamento', 'Wikipedia:Projetos/Documentação interna/levantamento' );
  shortcutsAddLink ( 'Doc-organização',  'Wikipedia:Projetos/Documentação interna/organização' );
  shortcutsAddLink ( 'Software',         'Wikipedia:Software' );
  shortcutsAddLink ( 'Predefinições',    'Wikipedia:Namespace predefinição' );
  shortcutsAddLink ( 'Página de testes', 'Wikipedia:Página de testes' );
  shortcutsAddLink ( 'Sp:Linksearch',    'Especial:Linksearch' );
  shortcutsAddLink ( 'Sp:Prefixindex',   'Especial:Prefixindex' );
  shortcutsAddLink ( 'Sp:Log',           'Especial:Log' );
  shortcutsAddLink ( 'Sp:Allmessages',   'Especial:Allmessages' );
  shortcutsAddLink ( 'Sp:Listusers',     'Especial:Listusers' );
 }


 /** Reversão e avisos ***********************************************************************
  *    Origem: [[Wikipedia:Software/Scripts/Reversão e avisos.js]]
  *     Ajuda: [[Wikipedia:Software/Scripts/Reversão e avisos]]
  * Descrição: Em páginas de comparação de 2 edições, inclui atalhos de reverter e avisar o usuário.
  *     Autor: [[:en:User:Lorian]] <noinclude>[[Categoria:!Código-fonte de scripts|Reversão e avisos]] [[en:Wikipedia:WikiProject User scripts/Scripts/Revert tools]]</noinclude>
  ********************************************************************************************/
 function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
 }
 var _GET = new Array();
 var _uri = location.href;
 var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
 var _temp_get_arr_1 = new Array();
 for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
 }
 delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
 function getMessage (where, user1, user2) {
  var message = prompt ('Comentário a acrescentar ao sumário da reversão:', '');
  window.location = 'https://pt.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
 }
 addOnloadHook(function (){
  if (location.href.match(/diff=/)) {
    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
    document.getElementById('contentSub').innerHTML = '(<a href="https://pt.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">Reverter</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">+comentário</a>) (Usuário: <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=1">aviso</a> . <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=7">bv</a> . <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=6">ip</a> / <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">propaganda</a> / <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">mudou grafia</a> / <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=4">assinou</a> / <a href="https://pt.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=5">copiou</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'Revertida de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] para [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'Revertida de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] para [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'Aviso';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Aviso}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'Aviso propaganda';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Propaganda}}~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'Aviso ortografia';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Ortografia}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = 'Aviso-assinatura';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Aviso-assinatura}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=5/)) {
    document.getElementById('wpSummary').value = 'Aviso não copie';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Não copie}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=6/)) {
    document.getElementById('wpSummary').value = 'Bem-vindo IP +aviso';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Bem-vindo IP}} {{sub'+'st:Aviso}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=7/)) {
    document.getElementById('wpSummary').value = 'Bem-vindo +aviso';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Bem vindo}} {{sub'+'st:Aviso}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
 });























 function tnaddlilink(url, name)
 {
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
 }
  
 function testn(number)
 {
  var page = prompt("Vandalism to which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Vandalismo em [[" + page + "]] - aviso " + number;
  f.submit();
 }
 
 function wA() {
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "welcome-anon-from|Where" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Welcome to Wikipedia!";
  f.submit();
 }
 
 function wap() {
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "User:Where/pwelcome" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Use preview; also, welcome!";
  f.submit();
 }
 
 
 function es() {
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==Edit summaries==\n{{subst:" + "Edit summary" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Please use edit summaries";
  f.submit();
 }
 
 function add_testn_tabs()
 {
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editando Usuário Discussão:") != -1)
    {
      tabs.appendChild(tnaddlilink('javascript:es()', "ES"));
      tabs.appendChild(tnaddlilink('javascript:testn("Av-test")',"t1"));
      tabs.appendChild(tnaddlilink('javascript:testn("test1a")',"t1a"));
      tabs.appendChild(tnaddlilink('javascript:testn("test2")',"t2"));
      tabs.appendChild(tnaddlilink('javascript:testn("Cópia")',"c"));
      tabs.appendChild(tnaddlilink('javascript:testn("Não elimine")',"ne"));
      tabs.appendChild(tnaddlilink('javascript:testn("Av-as")',"ass"));
      tabs.appendChild(tnaddlilink('javascript:testn("bv")',"bv"));
      tabs.appendChild(tnaddlilink('javascript:testn("Remoção")',"rem"));
      tabs.appendChild(tnaddlilink('javascript:testn("Aviso-categoria")',"cat"));
      tabs.appendChild(tnaddlilink('javascript:testn("welcomenpov")',"w-N"));
      tabs.appendChild(tnaddlilink('javascript:wA()',"w-A"));
      tabs.appendChild(tnaddlilink('javascript:wap()',"w-A-p"));
 }}
$(add_testn_tabs);

















//<pre>
//Auto AFD script
//Please include the two following lines
//Modified version of AutoVFD script to work with AFD
//Script Modified by User:Jtkiefer
//Further modified to work with [[:en:WP:AFDC]] by [[:en:User:ais523]]
//Modificado para a versão lusófona por [[Usuário:Giro720]]

// This needs to change depending on skin used.
function add_link(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
  na.appendChild(document.createTextNode(name));

  var li = document.createElement('li');
  li.appendChild(na);

  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  tabs.appendChild(li);
}

function strip_namespace(target)
{
  var colon = target.indexOf(':');
  if (colon != -1)
    {
      var spaces = new Array('Usuário', 'Wikipedia', 'Imagem', 'MediaWiki', 'Predefinição', 'Ajuda', 'Categoria');
      var ns = target.substring(0, colon);
      if (ns == '' || ns == 'Discussão')
        return target.substring(colon + 1);
      else
        for (var i = 0; i < spaces.length; ++i)
          {
            if (ns == spaces[i]
                || ns == spaces[i] + '_talk')
              return target.substring(colon + 1);
          }
    }

  return target;
}

function afd()
{
  document.editform.wpTextbox1.value = '{{' + 'subst:apagar2}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'apagar';

  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6,
                            target.lastIndexOf('&action=submit'));

  var date = new Date();
  var months = new Array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro');
 date.setUTCDate(date.getUTCDate() + 7);

  date = date.getUTCDate() + '_' + 'de' + '_' + months[date.getUTCMonth()];

  var pagename = strip_namespace(target);

  window.open('/w/index.php?title=Wikipedia:Páginas_para_eliminar/' + pagename + '&action=edit&fakeaction=afdsub&faketarget=' + target,
              'Afd ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
  window.open('/w/index.php?title=Wikipedia:Páginas_para_eliminar/' + date + '&action=edit&fakeaction=afdlist&faketarget=' + pagename,
              'AfdLog ' + unescape(target),
              'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}

function autoafd()
{
    if (document.title.indexOf('Editando ') == 0)
    {
      var action = '';
      var target = '';
      if (location.search)
        {
          var l = location.search.substring(1).split('&');
          for (var i = 0; i < l.length; ++i)
            {
              var eq = l[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = decodeURI((l[i].substring(eq + 1)).replace(/_/g, ' '));
            }
        }

      if (action == 'afdlist')
        {
          document.editform.wpTextbox1.value += '{{' + 'Wikipedia:Páginas_para_eliminar/' + target + '}}\n';
          document.editform.wpSummary.value = '[[Wikipedia:Páginas_para_eliminar/' + target + ']]';
        }
      else if (action == 'afdsub')
        {
          if (document.editform.wpTextbox1.value.length > 0)
            {
              target = document.editform.action;
              target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');
              window.alert("Já existe uma página com esse nome para eliminação.\n\n" +
                           'Please either move it out of the way (and update existing links to it), or file the Afd by hand in another location (such as [[' + target + ' (2)]]).');
            }
          else
            document.editform.wpTextbox1.value += '{{' + 'subst:novoapagar|' + target + '|Motivo|~~' + '~~' + '}}';
        }
      else
        add_link('javascript:afd()', 'Propor eliminação');
    }
}

$(autoafd);

//</pre>
//</pre>