Usuário:HyperBroad/script.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.
//<pre><nowiki>

/************* afd Helper ************/
// see User:Jnothman/afd_helper

document.write('<script type="text/javascript"' +
  'src="http://pt.wikipedia.org/w/index.php?title=Usuário:Giro720/automod.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

afdh_signature = '~~'+'~';
afdh_summaryprompt = true;
afdh_useicons = false;

afdh_shortcuts = Array();
afdh_shortcuts['a'] = 'Apagar';
afdh_shortcuts['m'] = 'Manter';
afdh_shortcuts['me'] = 'Mergir';
afdh_shortcuts['mv'] = 'Mover';
afdh_shortcuts['rd'] = 'Redirect';
afdh_shortcuts['c'] = 'Comentar';

afdh_icons = Array();
afdh_icons['a'] = 'Symbol delete vote.svg';
afdh_icons['m'] = 'Symbol keep vote.svg';
afdh_icons['me'] = 'Symbol merge vote.svg';
afdh_icons['c'] = 'Symbol comment vote.svg';

afdh_commscs = Array();
afdh_commscs['pn'] = 'per nom.';

function afd_helper() {
    if (auto_mod())
       return;

    var anchors = new Array();
    {
    var oldanchors = document.getElementById('bodyContent').getElementsByTagName('a');
    for (var i=0; i < oldanchors.length; i++)
        anchors[i] = oldanchors[i];
    }
    var url_re = /\?title=Wikipedia:Páginas_para_eliminar\/([^&]+)&action=edit&/;
    var url, matches;
    for (var i=0; i < anchors.length; i++) {
        if (!(matches = anchors[i].href.match(url_re))
         || (matches[1].substr(0, 1) == '/'))
            continue;
        var na = document.createElement('a');
        na.href = "javascript:afd_vote('"+escape(anchors[i].href)+"')";
        na.title = "Votar na deleção de "+unescape(matches[1]);
        var inlink = document.createElement('sup');
        inlink.appendChild(document.createTextNode('vote'));
        na.appendChild(inlink);
        anchors[i].parentNode.insertBefore(na, anchors[i].nextSibling);
    }

        am_add_li('tb', 'javascript:afd_nominate()', 'Propor eliminação', '', 'Propor este artigo para eliminação');
}

function afd_vote(edit_link) {
    var shortcuts_list = '';
    for (var key in afdh_shortcuts)
        shortcuts_list += key + ': ' + afdh_shortcuts[key] + '; ';
    var vote = window.prompt("Entre com seu voto.   (Atalhos disponíveis são: "+shortcuts_list+")");
    if (!vote) return;
    var icon_link = '';
    if (afdh_useicons && afdh_icons[vote.toLowerCase()])
        icon_link = '[[Image:' + afdh_icons[vote.toLowerCase()] + '|20px]] ';
    if (afdh_shortcuts[vote.toLowerCase()])
        vote = afdh_shortcuts[vote.toLowerCase()];

    shortcuts_list = '';
    for (var key in afdh_commscs)
        shortcuts_list += key + ': ' + afdh_commscs[key] + '; ';
    var comment = window.prompt("Entre com seu comentário.  (Atalhos disponíveis são: "+shortcuts_list+")");
    if (typeof comment != 'string') return;
    if (afdh_commscs[comment.toLowerCase()])
        comment = afdh_commscs[comment.toLowerCase()];

    var summary = vote;
    if (afdh_summaryprompt)
      if (!(summary = window.prompt("Entre com o sumário da edição:", summary)))
         summary = vote;
    var url = edit_link + 
        '&amaddafter='+escape("* '''"+icon_link+vote+"''' "+comment+" "+afdh_signature+" ~~"+"~~"+"~") +
        '&amsummary='+escape(summary);

    if (window.location.href.indexOf("/") == -1)
      window.location.href = url;
    else
      window.open(url, "afd_helper_vote");
}

function afd_nominate() {
    var title = am_get_title();
    var log_date = window.prompt("This should be the date of the latest AFD log. Change it if necessary.", am_guess_date());
    if (!log_date)
        return;
    var reason = window.prompt("POr favor, justifique a nomeação para eliminação de "+title+":");
    if (!reason)
        return;
    window.open(am_make_url(title, '{{'+'subst:apagar2}}', '', 'Nomeação para eliminação'), 'afdhn1');
    window.open(am_make_url('Wikipedia:Páginas_para_eliminar/'+log_date, '', '{{'+'subst:Wikipedia:Páginas_para_eliminar/'+title+'}}', 'Nomeação de [['+title+']] para eliminação'), 'afdhn3');
    window.location.href = am_make_url('Wikipedia:Páginas_para_eliminar/'+title, '', '{{'+'subst:novoapagar|'+title+'|'+reason+'|'+afdh_signature+" ~~"+"~~"+"~"+'}}', 'nomeado para eliminação');
}

$(afd_helper);

//</nowiki></pre>