Hacker News new | ask | show | jobs
by dankohn1 3420 days ago
This is awesome. Just for folks who aren't clear how to create a bookmarklet:

Create a bookmark of any page, by going to a URL such as https://www.wsj.com/articles/SB122878081364889613 (note that only the top part of the page loads) and enter Cmd (or Ctrl) D. Now Save the bookmark to your bookmark bar. Find the bookmark, right click, and replace the WSJ URL with the javascript URL in the parent post. Save and now test by clicking the bookmark in the bookmark bar. After a redirect through Facebook, the full WSJ article should display.

2 comments

I may be misunderstanding your instructions, but I think the intended use (in Chrome, at least) is to highlight the javascript and drag it to your bookmarks bar. This creates a bookmark that executes the javascript, which you can click to unblock the WSJ article you're currently viewing by redirecting the current page through Facebook.

Another useful bookmarklet for deleting annoying DOM elements:

  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)}})()
Same thing for firefox. And you can right-click the bookmarklet to edit its properties and make a nice name.
How does this work, step by step?