Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sun Paywall Defeater
// Alternately, a bookmarklet using the Sun's jQuery dependency against it:
// If you don't know what to do with this, create a new bookmark in your browser
// and paste this line as teh "address."
javascript:$("#reg-overlay").remove();$("html,body").css("overflow","visible");
/* Userscript for Tampermonkey or Greasemonkey to skip the paywall on the
* Baltimore Sun website
*/
// ==UserScript==
// @name Sun Paywall Defeater
// @namespace http://decomplecting.org
// @version 0.2
// @description Get rid of the paywall on The Baltimore Sun's website
// @author Jason Lewis
// @match *://*.baltimoresun.com/*
// @grant none
// ==/UserScript==
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes) {
Array.prototype.forEach.call(mutation.addedNodes, function(node) {
if (node.id == "reg-overlay") {
node.parentNode.removeChild(node); // Fix for when body is not the parent node
document.body.style.overflow = "visible";
document.body.parentNode.style.overflow = "visible";
}
});
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
characterData: false
});
@canweriotnow

This comment has been minimized.

Copy link
Owner Author

canweriotnow commented May 14, 2015

Issues at the moment: scrolling through additional stories is a little buggy, as something in the UX code relies on detecting the offsetHeight (I'm pretty sure for article count to throw up another paywall... it would explain both errrors here:

(anonymous function) @ VM7931:24(anonymous function) @ VM7931:22(anonymous function) @ VM7931:20
baltngux.min.js:2 
Uncaught TypeError: Cannot read property 'offsetHeight' of undefinedn @ baltngux.min.js:2
VM7931:24 
Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
@canweriotnow

This comment has been minimized.

Copy link
Owner Author

canweriotnow commented May 14, 2015

Also DISCLAIMER NOTICE: something something this is an academic exercise and should never be used by anyone I would certainly never use it because DMCA something something something about the dark side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.