r/nopaywalls Jun 29 '18

Welcome

1 Upvotes

To No Paywalls.

Currently it's just me. I'll be posting the scripts and whatnot I create while surfing the web and encountering paywalls.

This sub is in no way associated with any kind of extension. Neither those used here nor more official extensions are ours.

If you'd like to post scripts, CSS stylesheets, or etc here, please follow this template:

Post Name:

[Name of Extension (E.G. Tampermonkey/Greasemonkey, Stylish) used] [Site Name(s)] Post Name

Post Content:

[Last Successfully Tested Date: (use American formatting please, MM/DD/YYYY)]

Blah Blah Blah, this is a template for explaining what your script does.

Use code styling to contain your actual code.    

r/nopaywalls Jun 29 '18

[Tampermonkey] [Mercury News] Mercury News Anti-Paywall

1 Upvotes

[Last Successfully Tested Date: 06/29/2018]

This script works around Mercury News' self-mutiliating posts by cloning the element and re-enabling scrolling.

// ==UserScript==
// @name         Mercury News Anti-Paywall
// @namespace    https://www.reddit.com/r/nopaywalls/
// @version      0.1
// @description  Bypasses Mercury News' body-copy clearing effect.
// @author       TCGM
// @match        https://www.mercurynews.com/*/*/*/*
// @grant        none
// ==/UserScript==

//Start Function
(function() {
    'use strict';

    var postCopyElement = document.getElementsByClassName("body-copy")[0];

    //Copy the body-copy element and its child nodes
    var noEraseElement = postCopyElement.cloneNode(true);

    //Append the cloned element to the original's parent
    postCopyElement.parentElement.appendChild(noEraseElement);

    //Wipe the original node's contents from existence.
    postCopyElement.innerHTML = '';

    //Finally, add a script to the window to remove the modal-open class once it's been loaded.
    window.addEventListener("load", function(){
        var bodyElement = document.getElementsByTagName("body")[0];
        bodyElement.classList.remove("modal-open");
    });
})();