I wrote the following script to hide some divs that appears in some Facebook pages. I run it with Tampermonkey on Google Chrome:
(function fbPurity() {
let fF = document.querySelector("._1uh-");
fF.style.display = "none";
}());
// everythingGeneral:
document.querySelectorAll("#leftCol, .fbChatSidebar").forEach(function(element) {
element.style.visibility = "hidden";
});
// myWall:
document.querySelectorAll("#stream_pagelet").forEach(function(element) {
element.style.visibility = "hidden";
});
The script works fine on all pages which have query strings in their URL, but doesn’t work on all pages without.
This is extremely problematic as Facebook creates non-query-string-containing (NQSC) copies of almost each page; For example, if I click on my profile link with a left mouse click I get a NQSC version without the script’s effect and if I click it with a middle click (mosule wheel click) I get a query-string-containing version with the script’s effect.
I am very new to Javascript and can’t explain this behavior.