f95zone exclude tags and min like filter
// ==UserScript==
// @name f95zone tweaks
// @namespace f95zone tweaks
// @version 0.4
// @description f95zone exclude tags and min like filter
// @author 3xd_tango
// @match https://f95zone.to/latest/
// @grant none
// ==/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'
}
}
if (element_likes <= like_limit) {
var isDisplay = false
for (var j = 0; j < likes.length; 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 (isDisplay == false) {
element[i].style.display = 'none'
element[i].style.height = '0px'
element[i].style.margin = '0px'
}
}
console.log(node)
element_new_tag.appendChild(node)
}
} else {
setTimeout(init, 100);
}
}
init();
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);
})();