F95Zone Auto Add Notags

Automatically adds your personal blocked tags (notags) into the F95Zone SAM hash URL so you never have to set them manually.

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         F95Zone Auto Add Notags
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically adds your personal blocked tags (notags) into the F95Zone SAM hash URL so you never have to set them manually.
// @author       Nakimor
// @license      MIT
// @match        https://f95zone.to/sam/latest_alpha/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=f95zone.to
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // === CONFIGURATION ===
    // Add here all tag IDs you want to exclude (comma-separated).
    // How to find a tag ID:
    // 1. Go to F95Zone "latest" or "SAM" page.
    // 2. Manually add a tag to the "Excluded tags" filter.
    // 3. Look at the URL — you will see something like: .../notags=522,1707,2265
    // 4. Copy those numbers and paste them here.
    const bannedTags = "522,1707,2265"; // <-- EDIT THIS LINE TO ADD/REMOVE YOUR TAGS

    // Get the current hash (part after "#")
    let hash = window.location.hash;

    // Only modify the URL if it doesn't already contain "notags="
    if (!hash.includes("notags=")) {
        // Split hash into segments (removing the leading "#")
        let segments = hash.slice(1).split("/");
        let newSegments = [];

        // We just rebuild the hash keeping known parts untouched
        segments.forEach(seg => {
            // Pass-through all known segments
            if (
                seg.startsWith("tags=") ||
                seg.startsWith("prefixes=") ||
                seg.startsWith("noprefixes=") ||
                seg.startsWith("cat=") ||
                seg.startsWith("page=") ||
                seg.startsWith("sort=") ||
                seg.startsWith("search=") ||
                seg.startsWith("date=")
            ) {
                newSegments.push(seg);
            } else {
                // Keep any unknown segment as well (safe for future updates)
                newSegments.push(seg);
            }
        });

        // Insert notags after "cat=" or "page=" if found, otherwise just append at the end
        let index = newSegments.findIndex(s => s.startsWith("cat=") || s.startsWith("page="));
        if (index >= 0) index++;
        else index = newSegments.length;

        newSegments.splice(index, 0, "notags=" + bannedTags);

        // Replace the current hash with our new one
        window.location.replace("#/" + newSegments.join("/"));
    }
})();