f95zone tweaks

f95zone exclude tags and min like filter

// ==UserScript==
// @name         f95zone tweaks
// @namespace    f95zone tweaks
// @version      0.3
// @description  f95zone exclude tags and min like filter
// @author       3xd_tango
// @match        https://f95zone.to/latest/
// @grant        none
// ==/UserScript==

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

(function() {
    'use strict';
    let css = `
  div[data-tags*='harem'] {/*<--------------------------- Favorites Tags*/
          -webkit-box-shadow:0px 0px 10px 1px #0011ff ;
          -moz-box-shadow:0px 0px 10px 1px #0011ff ;
          box-shadow:0px 0px 10px 1px #0011ff !important;
            }

  div[data-tags*='incest'] {
              -webkit-box-shadow:0px 0px 10px 1px #ff0000 ;
              -moz-box-shadow:0px 0px 10px 1px #ff0000 ;
              box-shadow:0px 0px 10px 1px #ff0000 !important;
            }

div[data-tags*='female protagonist'],div[data-tags*='text based'],div[data-tags*='mind control'] {/*<--------------------------- Exclude Tags*/
    display: none !important;
    height: 0px;
    margin: 0px !important;
}
`;

    function init() {
        const element = document.querySelectorAll('.resource-tile_info-meta_likes')
        if (element[0]){
            checki: for (var i = 0; i < element.length; i++) {
                const number = parseInt(element[i].innerText)
                if (number <= like_limit) {
                    for (var j = 0; j < likes_limit_tag.length; j++){
                        if (element[i].parentNode.parentNode.parentNode.parentNode.parentNode.dataset.tags.includes(likes_limit_tag[j])) {
                            continue checki;
                        }
                    }
                    console.log(element[i].parentNode.parentNode.parentNode.parentNode.parentNode.dataset.tags)
                    console.log(element[i].parentNode.parentNode.parentNode.parentNode.parentNode.dataset.tags.includes('incest'))
                    element[i].parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none'
                    element[i].parentNode.parentNode.parentNode.parentNode.parentNode.style.height = '0px'
                    element[i].parentNode.parentNode.parentNode.parentNode.parentNode.style.margin = '0px'
                }
            }
        } else {
            setTimeout(init, 100);
        }
    }
    init();

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

    if (typeof GM_addStyle !== "undefined") {
        GM_addStyle(css);
    } else {
        let styleNode = document.createElement("style");
        styleNode.appendChild(document.createTextNode(css));
        (document.querySelector("head") || document.documentElement).appendChild(styleNode);
    }

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