Created
April 4, 2011 23:02
-
-
Save danielwanja/902658 to your computer and use it in GitHub Desktop.
Bookmarklet to bypass NYT paywall
This file contains 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
// From: http://toys.euri.ca/nyt.js | |
//Here's the old stuff: | |
$('overlay').hide(); | |
$('gatewayCreative').hide(); | |
$(document.body).setStyle( { overflow:'scroll' } ); | |
try { | |
//Get the first graph: | |
var url = window.location.href; | |
new Ajax.Request(url, { | |
method: 'get', | |
onSuccess: function(transport) { | |
var notice = $('notice'); | |
//alert(transport); | |
fulltext = transport.responseText; | |
//And here's my dirty secret, I don't know how to manipulate the DOM with prototype.js | |
var pattern=/\/NYT_CORRECTION_TOP>\n <p>\n(.*)<\/p>/gi; | |
text = pattern.exec(fulltext) | |
firstgraph = text[1]; | |
} | |
}); | |
} catch (e) { | |
firstgraph= "[NYTClean note, I'm looking into getting this paragraph back.]"; | |
} | |
text2 = $('article').getElementsByClassName('articleBody')[0]; | |
if(text2.innerHTML.indexOf("20 free articles")>0) { | |
text2.innerHTML = firstgraph; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this still work or did it get patched out?