f95zone tweaks

f95zone exclude tags and min like filter

当前为 2021-04-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         f95zone tweaks
// @namespace    f95zone tweaks
// @version      0.4.1
// @description  f95zone exclude tags and min like filter
// @author       3xd_tango
// @match        https://f95zone.to/latest/
// @require     https://cdn.jsdelivr.net/combine/npm/@violentmonkey/dom@1,npm/@violentmonkey/[email protected]
// @grant       GM_addStyle
// ==/UserScript==

let dislikes = ['female protagonist','text based','mind control'];
let likes = [['incest','#ff0000'],['harem','#0011ff']];
let like_limit = 200;//<-----------------------likes limit

(function() {
    'use strict';

    function init() {
        const element = document.querySelectorAll('.resource-tile')
        if (element[0]){
            checki: for (var i = 0; i < element.length; i++) {
              var node = document.createElement("DIV");
              const element_likes = element[i].childNodes[0].childNodes[1].childNodes[1].childNodes[1].childNodes[1].innerHTML;
              var element_new_tag = element[i].childNodes[0].childNodes[1].childNodes[1];
              for (var j = 0; j < dislikes.length; j++){
                        if (element[i].dataset.tags.includes(dislikes[j])) {
                            element[i].style.display = 'none'
                            element[i].style.height = '0px'
                            element[i].style.margin = '0px'
                        }
                    }
              var isDisplay = false
                for (var j = likes.length -1; j >= 0; j--){
                        if (element[i].dataset.tags.includes(likes[j][0])) {
                            var node1 = document.createElement("SPAN");
                            node1.style.backgroundColor = likes[j][1]
                            node1.style.borderRadius = "2px"
                            node1.style.boxShadow = '0 0 0 0 rgba(0,0,0,0),0 1px 1px 0 rgba(0,0,0,0.15),0 1px 2px 0 rgba(0,0,0,0.15)'
                            node1.style.display = 'inline-block'
                            node1.style.fontSize = '.8em'
                            node1.style.lineHeight = '1.8em'
                            node1.style.margin = '4px 4px 0 0'
                            node1.style.padding = '0 6px'
                            node1.style.textShadow = '1px 1px 2px rgba(0,0,0,0.75)'
                            element[i].style.boxShadow = `0px 0px 10px 1px ${likes[j][1]}`
                            node1.appendChild(document.createTextNode(likes[j][0]))
                            node.appendChild(node1)
                            isDisplay = true
                        }
                    }
              if (element_likes <= like_limit) {
                
                if (isDisplay == false) {
                    element[i].style.display = 'none'
                    element[i].style.height = '0px'
                    element[i].style.margin = '0px'
                }
                }
              element_new_tag.appendChild(node)
            }
        } else {
            setTimeout(init, 100);
        }
    }
    init();
  
    // var value = VM.getTextValues(document.querySelectorAll('#first_name2'))
    // console.log(value)

    history.onpushstate = function(state) {
        setTimeout(init, 200);
    };

    (function(history){
        var pushState = history.pushState;
        history.pushState = function(state) {
            if (typeof history.onpushstate == "function") {
                history.onpushstate({state: state});
            }
            return pushState.apply(history, arguments);
        };
    })(window.history);
})();