Jump to content

User:Bop34/Userscripts/sandbox.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.
function wait(ms) {
    var d = new Date();
    var d2 = null;
    do { d2 = new Date(); }
    while(d2-d < ms);
}

function autodesc() {
    if(document.getElementById("sdh").innerHTML.includes('<a title="Import description from Wikidata" role="button" tabindex="0">Import</a>')){
        alert("Wikidata description avalible");
    } else {
        alert("Nothing importable");
        if (document.URL!='https://en.wikipedia.org/w/index.php?title=User:Bop34/Userscripts/sandbox.js') {
    		window.location = 'https://en.wikipedia.org/wiki/Special:Random';
        }
    }
}

window.addEventListener('load', function () {
  console.log("Loaded");
  wait("1000");
  autodesc();
});