intrepidOlivia / WashPo Bypass

// ==UserScript==
// @name         WashPo Bypass
// @namespace    pixelstomp.com
// @version      2.0
// @description  Removes the adblock restriction ("We noticed you're blocking ads") from Washington Post articles.
// @author       intrepidOlivia
// @match        https://www.washingtonpost.com/*
// @license      GPL-3.0-or-later
// @copyright 2019-2020, intrepidOlivia (https://openuserjs.org/users/intrepidOlivia)
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
function makeHTTPRequest(url) {
    return new Promise((resolve, reject) => {
        const request = new XMLHttpRequest();
        request.open('GET', url);
        request.onload = (event) => resolve(event.target.responseText);
        request.onerror = reject;
        request.send();
    })
}

let paywallCheck = setInterval(function() {
    if (document.documentElement.style.overflow) {
        clearInterval(paywallCheck);
        console.log('making http request for article');
        makeHTTPRequest(window.location.href).then(result => {
            let body = '';
            let headline = document.getElementsByTagName('header');
            if (headline && headline[0]) {
                body += headline[0].outerHTML;
            }
            let article = result.match(/(<article.*?>)([\s\S]*?)(<\/article>)/);
            if (!article) {
                console.error('No article found on page. Please file a bug with the developer of this userscript.');
                return;
            }
            if (article[0]) {
                body += article;
            } else {
                body += result;
            }
            document.body.innerHTML = body;
            document.body.style.margin = "15px 50px";
            document.documentElement.style.overflow = 'auto';
        });
    }
}, 100);

})();