Skip to content

Instantly share code, notes, and snippets.

@happiness801
Last active November 5, 2020 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happiness801/98578ded3917cc6bad70e0b3318be2d7 to your computer and use it in GitHub Desktop.
Save happiness801/98578ded3917cc6bad70e0b3318be2d7 to your computer and use it in GitHub Desktop.
Remove NY Times paywall
// ==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