News for hackers. Stuff that matters.
Re:Ad Blocking Irony by jrs235 on Saturday September 19, 2015 @11:58AM (#10244587)
I have a bookmarklet that lets me do that without popping open dev tools. When I get home I'll post it.
Re:Ad Blocking Irony by jrs235 on Saturday September 19, 2015 @02:19PM (#10245082)
Here it is:

    javascript:(function(){document.styleSheets[0].addRule(".highlighted_to_remove","background:red !important");var e=function(e){if(e.keyCode==27){i()}};document.addEventListener("keydown",e);var t=function(e){e.stopPropagation();this.classList.add("highlighted_to_remove");return false};var n=function(e){e.stopPropagation();this.classList.remove("highlighted_to_remove");return false};var r=function(e){this.parentNode.removeChild(this);i();e.preventDefault();e.stopPropagation();return false};var i=function(){var i=0;var s=document;while(s=document.body.getElementsByTagName("*").item(i++)){s.removeEventListener("mouseover",t);s.removeEventListener("mouseout",n);s.removeEventListener("click",r);s.classList.remove("highlighted_to_remove")}document.removeEventListener("keydown",e)};var s=0;var o=document;while(o=document.body.getElementsByTagName("*").item(s++)){o.addEventListener("mouseover",t);o.addEventListener("mouseout",n);o.addEventListener("click",r)}})()
Re:Ad Blocking Irony by holyjaw on Saturday September 19, 2015 @02:12PM (#10245049)
This is what I have in my "Kill Element" bookmarklet. (SECURITY NOTE: You should never blindly copy and paste javascript like this and run it in your browser.)

  javascript:(function(){var e=document.body.style.cursor;document.body.style.cursor="crosshair";var t=document.createElement("div");var n="border:1px solid #3280FF;background-color:rgba(50,128,255,0.5);position:absolute;z-index:999999999999999;display:none;";var%20r="pointer-events:none;";var%20i="transition:width%2060ms,height%2060ms,left%2060ms,top%2060ms;";n+=r+"-webkit-"+r+"-moz-"+r;n+=i+"-webkit-"+i+"-moz-"+i;t.setAttribute("style",n);document.body.appendChild(t);var%20s=null;var%20o=function(e){var%20n=e.target;if(n!==s&&n.parentNode){var%20r=n.getBoundingClientRect();var%20i=document.documentElement;var%20o=document.body;var%20u=i.clientTop||o.clientTop||0;var%20a=i.clientLeft||o.clientLeft||0;var%20f=window.pageYOffset||i.scrollTop||o.scrollTop;var%20l=window.pageXOffset||i.scrollLeft||o.scrollLeft;var%20c=l-a+r.left-1;var%20h=f-u+r.top-1;t.style.display="block";t.style.left=c+"px";t.style.top=h+"px";t.style.width=r.width+"px";t.style.height=r.height+"px";s=n}};var%20u=function(n){document.body.style.cursor=e;if(n.target.parentNode)n.target.parentNode.removeChild(n.target);if(t.parentNode)t.parentNode.removeChild(t);window.removeEventListener("click",u,false);window.removeEventListener("mouseover",o,false);n.stopPropagation();n.preventDefault()};window.addEventListener("mouseover",o,false);window.addEventListener("click",u,false)})();void(0)
Re:Ad Blocking Irony by betenoire on Saturday September 19, 2015 @02:19PM (#10245081)
Your comment makes this page have a long horizontal scroll, and a total pain in the ass to read now. Perhaps you can edit that and put in spaces so it wraps? Thanks.
Re:Ad Blocking Irony by dTal on Saturday September 19, 2015 @07:15PM (#10245881)
In fairness, this is HN's fault - not allowing posts to mess up the whole page is basic fit-for-purposeness for forum software and the whole reason HTML is not allowed in the first place. Your workaround, on the other hand, breaks the content as bookmarklets are always one-liners. Evidently (according to a sibling comment) the solution is to prepend 4 spaces, which isn't exactly standard.

As for the bookmarklet, smashing stuff. I'm always deleting irritating stuff on pages using the inspector.

Re:Ad Blocking Irony by betenoire on Saturday September 19, 2015 @09:18PM (#10246191)
not blaming anyone, just wanna be able to read the comments :)
Re:Ad Blocking Irony by grey-area on Saturday September 19, 2015 @02:18PM (#10245079)
Please prepend four spaces to this - you have broken formatting on the entire page.