Usuário:Dpc01/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.
mw.loader.load( 'https://pt.wikipedia.org/w/index.php?title=Usuário:Dpc01/tb.js&action=raw&ctype=text/javascript' );

// [[User:Lupin/popups.js]]

mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript' );

simplePopups=true;
popupPreviewRawTemplates=true;
popupAdminLinks=true;
popupQueriedRevertSummary="Revertido para a revisão $1, feita por $3";
popupQueriedRevertToPreviousSummary="Revertido para a revisão $1, feita por $3";


function addlilink(tabs, url, name, id, ttl) {
    var na = document.createElement('a');
    na.href = url;
    na.id = id;
    na.title = ttl;
    na.style.backgroundColor = '#efefef';
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

function morelinks() {
    if (!document.getElementById) return;

    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    
    var x = document.getElementById('ca-edit');
    if(!x) return;
    if(x.children) x1 = x.children[0];
    else x1 = x.childNodes[0];
    addlilink(tabs, x1.href.replace(/(=edit)/, "$1&section=0"),
        '0', 'ca-edit0', 'Editar seção 0');

    addlilink(tabs, x1.href.replace(/=edit/, "=purge"),
        'P', 'ca-replace', 'Limpar cache');

    if (location.href.match(/action=(edit|submit)/))
        addlilink(tabs, 'javascript:replace("","")', 'S', 'ca-replace', 'Substituir');
}

function replace(rex,sub) {
    var s = prompt("Expressão regular:", rex);
    if (s) {
        var r = prompt("Substituir por:", sub);
        if(!r && r != '') return;
        if (confirm('Substituir "'+ s +'" por "'+ r +'"?')) {
            var txt = document.editform.wpTextbox1;
            txt.value = txt.value.replace(new RegExp(s, "g"), r);
            s.replace('\'','\\\''); r.replace('\'','\\\'');
            document.getElementById('ca-replace').href = "javascript:replace('" + s + "','" + r + "');";
        }
    }
}

$(morelinks);