NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Brainly Bypass Paywall
// @namespace https://gitlab.com/Dwyriel
// @version 1.5.4
// @description Clears brainly's local storage to reset daily count to bypass the daily limit/paywall. Also remove ads and popups.
// @author Dwyriel
// @license MIT
// @match *://*brainly.pl/*
// @match *://*znanija.com/*
// @match *://*brainly.lat/*
// @match *://*brainly.com.br/*
// @match *://*nosdevoirs.fr/*
// @match *://*eodev.com/*
// @match *://*brainly.ro/*
// @match *://*brainly.co.id/*
// @match *://*brainly.in/*
// @match *://*brainly.ph/*
// @match *://*brainly.com/*
// @grant none
// @run-at document-start
// @homepageURL https://gitlab.com/Dwyriel/Greasyfork-Scripts
// @downloadURL https://gitlab.com/Dwyriel/Greasyfork-Scripts/-/raw/main/BrainlyBypassPaywall/script.js
// @updateURL https://gitlab.com/Dwyriel/Greasyfork-Scripts/-/raw/main/BrainlyBypassPaywall/script.js
// ==/UserScript==
(function () {
'use strict';
const elementsToRemove = [
"[data-testid^='ad_below_']" //Annoying video ads
];
const config = { attributes: true, childList: true, subtree: true };
let timeoutID = 0;
let mutationObserver;
const mutationCallback = () => {
mutationObserver.disconnect();
for (let query of elementsToRemove) {
let nodes = document.querySelectorAll(query);
for (let node of nodes)
node.remove();
}
//simulating button click to keep native brainly functionality without needing additional code.
let loginModal = document.querySelector(`[data-testid='registration_toplayer_close_button']`); //Login popup/modal close button
if (loginModal && timeoutID === 0)
timeoutID = setTimeout(() => { timeoutID = 0; loginModal.click(); }, 500);
let offerModal = document.querySelector(`[data-testid="offer_modal_wrapper"]`); //Promotion popup/modal close button
if (offerModal && timeoutID === 0)
timeoutID = setTimeout(() => { timeoutID = 0; offerModal.parentElement.children[0].click(); }, 500);
mutationObserver.observe(document.body, config);
}
try {
localStorage.clear();
} catch (err) {
console.error("Couldn't clear local storage, the browser is most likely blocking access to it. (are all cookies being blocked?)");
console.error(err);
}
document.addEventListener("DOMContentLoaded", () => {
mutationObserver = new MutationObserver(mutationCallback);
mutationCallback();
});
})();