f95zone tweaks

f95zone exclude tags and min like filter

2021-04-02 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

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