Created
September 23, 2020 13:13
-
-
Save iigmir/c05ce2b0f077e5120a7f9292b2824910 to your computer and use it in GitHub Desktop.
Block Quora Login screen by Greasemonkey
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 Block Quora Login screen | |
// @version 3 | |
// @grant none | |
// @match *://*.quora.com/* | |
// @author iigmir | |
// ==/UserScript== | |
/** | |
* The reason why Quora shows up the login popup after clicking a link is because of the referrer header. | |
* Therefore, if block referrer headers, the site will never show the login popup again. | |
* Luckily, the <a> element has an attribute called "referrer-policy". | |
*/ | |
(function () { | |
"use strict"; | |
console.log( "GMonkey: Quora Script" ); | |
const domInsertionObserver = new MutationObserver(function(mutation){ | |
[ ...document.querySelectorAll("a") ].forEach( dom => dom.referrerPolicy = "no-referrer" ); | |
}); | |
domInsertionObserver.observe( document.body.firstChild, { childList: true, subtree:true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment