Brainly v2.0

try to take over the world!

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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();
})();