Roblox Game Blacklist

Lets you blacklist certain games based on their names

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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)
})();