Skip to content

Instantly share code, notes, and snippets.

@joepie91
Last active March 27, 2018 00:20
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save joepie91/dfca98eb735e81959cfe to your computer and use it in GitHub Desktop.
Save joepie91/dfca98eb735e81959cfe to your computer and use it in GitHub Desktop.
Remove Wired / V3 "ad-blocker veil"

Supported sites:

  • Wired
  • V3.co.uk

Requests for other sites are welcome (admin@cryto.net).

Changelog

  • July 25, 2016: Added support for V3.co.uk.
  • February 19, 2016: Initial release for Wired.

Broken?

GitHub Gist doesn't send notifications when people leave a comment, so shoot me an e-mail at admin@cryto.net. I'll gladly fix it. Fuck advertising.

// Mind that sometimes, the javascript: prefix gets lost when copying this somewhere. Ensure that it's still there.
javascript:(function(){window.fetch(window.location).then(function(e){return e.text()}).then(function(e){var t=(new DOMParser).parseFromString(e,"text/html");if((""+window.location).match(/^https?:\/\/(?:[^\.]+\.)?v3\.co\.uk[\/$]/)){var r=t.querySelector(".article-page-body-content"),o=document.querySelector("#rdm-below-summary");o.parentNode.insertBefore(r,o.nextSibling);var n=Array.from(document.querySelectorAll(".r3z-wait")).concat(Array.from(document.querySelectorAll(".r3z-hide")));n.forEach(function(e){e.parentNode.removeChild(e)})}else if((""+window.location).match(/^https?:\/\/(?:[^\.]+\.)?wired\.(?:co\.uk|com)[\/$]/)){var r=t.querySelector("[data-js='post']"),o=document.querySelector("[data-js='postHeader']");o.parentNode.insertBefore(r,o.nextSibling);var c=document.querySelector("#veil");c.parentNode.removeChild(c),document.body.classList.remove("no-scroll")}});})();
(function(){
window.fetch(window.location).then(function(response) {
return response.text();
}).then(function(responseText) {
var fakeDocument = (new DOMParser()).parseFromString(responseText, "text/html");
if (window.location.toString().match(/^https?:\/\/(?:[^\.]+\.)?v3\.co\.uk[\/$]/)) {
// v3.co.uk
var articleContents = fakeDocument.querySelector(".article-page-body-content");
var prevElement = document.querySelector("#rdm-below-summary");
prevElement.parentNode.insertBefore(articleContents, prevElement.nextSibling);
var veilElements = Array.from(document.querySelectorAll(".r3z-wait")).concat(Array.from(document.querySelectorAll(".r3z-hide")));
veilElements.forEach(function(element) {
element.parentNode.removeChild(element);
});
} else if (window.location.toString().match(/^https?:\/\/(?:[^\.]+\.)?wired\.(?:co\.uk|com)[\/$]/)) {
// Wired
var articleContents = fakeDocument.querySelector("[data-js='post']");
var prevElement = document.querySelector("[data-js='postHeader']");
prevElement.parentNode.insertBefore(articleContents, prevElement.nextSibling);
var veilElement = document.querySelector("#veil");
veilElement.parentNode.removeChild(veilElement);
document.body.classList.remove("no-scroll");
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment