Last active
November 5, 2020 19:16
-
-
Save happiness801/98578ded3917cc6bad70e0b3318be2d7 to your computer and use it in GitHub Desktop.
Remove NY Times 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
// ==UserScript== | |
// @name Remove NY Times paywall | |
// @namespace http://onai.net/ | |
// @version 0.4 | |
// @description Removes paywall from nytimes.com | |
// @author Kevin Gwynn | |
// @match https://*.nytimes.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let removeModals = function() { | |
console.log('KAG: attempt to remove paywall...'); | |
document.getElementById('site-content').style.position = 'relative'; | |
// Version 2 | |
var gatewayContent = document.getElementById('gateway-content'); | |
if (gatewayContent) { | |
var parent = gatewayContent.parentElement; | |
gatewayContent.remove(); | |
var div = parent.firstElementChild; | |
div.style.position = 'relative'; | |
} | |
// Remove block-out gradient | |
var divs = document.getElementsByTagName('div'); | |
for(let x in divs) { | |
if (typeof divs[x] !== 'object') continue; | |
let cssProp = window.getComputedStyle(divs[x], null).getPropertyValue('background-image'); | |
if (cssProp.match(/linear-gradient/)) divs[x].remove(); | |
} | |
}; | |
setTimeout(removeModals, 3000); | |
setTimeout(removeModals, 6000); | |
setTimeout(removeModals, 9000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment