Last active
November 21, 2015 22:35
-
-
Save atleastimtrying/655ad1208e8afca60b02 to your computer and use it in GitHub Desktop.
An explanation of how paragraph shotgun 2 works!
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
function(){ //a nice closure to keep our variables nice and tidied away. | |
for(//a weird looking forloop that does some extra assignment. | |
var e=document.querySelectorAll("p,li,td,th,h1,span,img,h2,h3,h4,h5"),//grab all of the required elements from the page | |
i=0,//a count to keep track | |
l=e.length;//store the length so we don't have to measure again | |
i<l;// test if we're at the end | |
++i// increment our counter; | |
){ | |
e[i].style.cursor="crosshair",//set the style of the current element to crosshair | |
e[i].addEventListener("click",function(){// listen out for a click on the current element | |
this.parentNode.removeChild(this)// when clicked find the element's parent and remove the element from it | |
})// close our click | |
}// close our loop | |
}();// close our closure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment