Roblox Game Blacklist

Lets you blacklist certain games based on their names

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Roblox Game Blacklist
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Lets you blacklist certain games based on their names
// @author       crapbass
// @match        https://www.roblox.com/discover*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=roblox.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    function remGames(){
        setTimeout(remGames, 500);
        Array.from(thing).forEach(function (element) {
            var title = element.getAttribute("title")
            if (title != null) {
                for (var i = 0; i < blacklistfilter.length; i++) {
                    var find = blacklistfilter[i]
                    if (find.startsWith("regex:")) {
                        let regex = new RegExp(find.replace("regex:",""))
                        if (regex.test(title)) {
                            element.style.display = 'none'
                        }
                    } else if (find == "*emoji") {
                        const EmojiRegexExp = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi;
                        let regex = new RegExp(EmojiRegexExp)
                        if (regex.test(title)) {
                            element.style.display = 'none'
                        }
                    } else if (find.startsWith("insensitive:")) {
                        if (title.toLowercase().includes(find.toLowercase().replace("insensitive:",""))) {
                            element.style.display = 'none'
                        }
                    } else if (title.includes(find)) {
                        element.style.display = 'none'
                    }
                }
            }
        });
    }
    window.editBlacklist = function() {
        try {
            var value = JSON.parse(localStorage["BlacklistStrings"]);
        } catch {
            console.log("oopsies!!! no blacklist strings saved yet")
        }
        var input = prompt("Text seperated with commas (example: simulator,OHIO)",value)
        if (input == null) {
            return;
        }
        localStorage["BlacklistStrings"]=JSON.stringify(input);
    }
    function doThing() {
        try {
            var blacklistfilterstring = JSON.parse(localStorage["BlacklistStrings"]);
        } catch {
            console.log("oopsies!!! no blacklist strings saved yet")
            blacklistfilterstring = ""
        }
        function escapeRegExp(string) {
            return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
        }
        window.blacklistfilter = blacklistfilterstring.split(",");
        console.log(blacklistfilter)
        window.thing = document.getElementsByClassName("list-item game-card game-tile")
        var navbar = document.querySelector("#navigation > div > div.simplebar-wrapper > div.simplebar-mask > div > div > div > ul")
        var blacklisteditor = document.createElement("li")
        blacklisteditor.setAttribute("class", "rbx-upgrade-now")
        blacklisteditor.innerHTML = "<a onclick='window.editBlacklist()' href='javascript:void(0);' class='btn-growth-md btn-secondary-md' id='blacklist-button'>Blacklist Editor</a>"
        navbar.appendChild(blacklisteditor);
        remGames();
    }
    setTimeout(doThing, 2000)
})();