Jump to content

User:Gabriele Nunzio Tornetta/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.
// My scripts.
/*
addOnloadHook(
    function () { 
        mw.util.addPortletLink('p-coll-print_export', "javascript:doTeXify()", "TeXify", "coll-texify", "Produces a LaTeX document out of the current article");
    }
);

function doTeXify() {
    var client = new XMLHttpRequest();
    client.open('GET', 'https://en.wikipedia.org/w/index.php?title=' + document.getElementById("firstHeading").innerHTML + '&action=edit', false);
    client.setRequestHeader("User-Agent", navigator.userAgent);
    client.send();

    var edt = client.responseText
    patt = new RegExp('(?:^|\s)<textarea .*? id="wpTextbox1" .*?>(.*)</textarea>(?:\s|$)', "g")
    var match = patt.exec(edt)
    alert(match[1]);
    win = document.open();
    win.write(match[1]);
    win.close();
}
*/