Usuário:Roni1986/goahead.js

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)
  • Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
/* Indo diretamente para a página a partir da qual se logou. Autor: [[Usuário:Brandizzi]] */ 
/* Should go back?  */
function aheadShouldGo() {
    return wgCanonicalNamespace == "Special" && 
        wgCanonicalSpecialPageName == "Userlogin" &&
        wgAction == "submitlogin";
}
 
/* If so, let us go! */
function aheadGo() {
    if (aheadShouldGo()) {
        var destination = aheadGetNextPage();
        if (destination) {
            window.location = destination;
        }
    }
}
 
/* To where? Here! */
 
function aheadGetNextPage() {
    var elements = document.getElementsByTagName('link');
    for (var i = 0; i < elements.length; i++) {
        var element = elements[i];
        var relAttribute = element.getAttribute('rel');
        if (relAttribute == 'next') {
            return element.getAttribute('href');
        }
    }
    return null;
}
 
$(aheadGo);

//<noinclude>[[Categoria:!Subpáginas de Roni1986/Configurações(JS-CSS)|Goahead.js]]</noinclude>