Last active
January 27, 2024 04:26
-
-
Save adithya-r-prabhu/e232741015c5bb0273505cbe1c2008ee to your computer and use it in GitHub Desktop.
Remove element bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:if (typeof(zapper) == "undefined") {window.zapper = {state: 1,over: null,selected: null,select: function(e) {zapper.selected = document.elementFromPoint(e.clientX, e.clientY);zapper.over=document.createElement("div");zapper.over.style="pointer-events:none;position:fixed;z-index:2147483647;background-color:#FF0000;opacity:0.5;";document.body.appendChild(zapper.over);var rect = zapper.selected.getBoundingClientRect();var overS=zapper.over.style;overS.left = rect.left+"px";overS.top = rect.top+"px";overS.width = rect.width+"px";overS.height = rect.height+"px";zapper.state = 2;},zap: function(e) {var selected2 = document.elementFromPoint(e.clientX, e.clientY);if (zapper.selected == selected2){console.log("zapping");selected2.parentElement.removeChild(selected2);}document.body.removeChild(zapper.over);zapper.state=3;console.log("done");}};document.body.addEventListener("click", function(e){e.preventDefault();console.log("click");if (zapper.state == 1){zapper.select(e);} else if (zapper.state == 2) {zapper.zap(e);}});} else {zapper.state = 1;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment