Search code examples
javascriptgoogle-chromefirefoxgreasemonkey

Possible to delete nodes on new page?


When clicking "Slow Download" on this page it gives an overlay modal which covers the screen with id's superbox-wrapper and superbox-overlay. I can remove them in Chrome developer tools by just deleting them.

Right now I have the follow code which clicks on the "Slow Download" button.

function SkipId(objId){
    var oId = document.getElementById(objId);
    oId.click();
}

window.onload = function(){
    SkipId('slow-download');
};

I have tried to remove them by

document.getElementById('superbox-wrapper').hide();
document.getElementById('superbox-overlay').hide();

var element = document.getElementById("superbox-wrapper");
element.outerHTML = "";
delete element;

function remove(id) {
    var elem = document.getElementById(id);
    return elem.parentNode.removeChild(elem);
}

remove('superbox-wrapper');

getElementById('superbox-wrapper').remove();

Question

How can I remove superbox-wrapper and superbox-overlay?


Solution

  • Based on @Brock Adams comment this this the solution

    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
    // @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
    
    waitForKeyElements("div.superbox-wrapper", removeSuperbox);
    
    function removeSuperbox() {
      document.getElementById('superbox-wrapper').hide();
    }