Brainly v2.0

try to take over the world!

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Brainly v2.0
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://brainly.com/*
// @grant        none
// ==/UserScript==
function removePost(e) {
    e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);
}

function checkRating(rating) {
  let value = parseInt(rating.innerText);
  return value >= 4;
}

function filterRatings() {
    if (document.querySelectorAll("div[class='sg-rate-box__rate']").length === 0) {
        console.log('No answers to check.');
    }
    else {
        var Listings = [...document.querySelectorAll("div[class='sg-rate-box__rate']")].map(listing => {
        if (parseInt(listing.innerText) < 4 && parseInt(listing.innerText) != 0) {
            removePost(listing);
            console.log(`${listing} being removed`);
        }
        else {
          return parseInt(listing.innerText);
        }
    });
    console.log(Listings);
    }
}


(function() {
    'use strict';
    filterRatings();
})();