(bez virsraksta)

« previous entry | next entry »
Dec. 7., 2021 | 01:12 am

// ==UserScript==
// @name LCF
// @namespace https://gist.github.com/mindbound
// @version 0.3.5
// @description Filters out idiots and spammers in the latest posts page
// @author mindbound
// @license WTFPL; http://www.wtfpl.net/
// @match http://klab.lv/stats/latest.bml
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB7ElEQVQ4jWNgGF7AwEBA4M/zwPj/rwKX/3sesPb9Te/GqlSZ8hQ/oeJEb8HMSFe+SAdjXhsGBgY2DM0lUcI5O6ep/bx3yOb/g2MO/x+edP7/6LTL/wenXP4fWW36/8Q6s/8n15r8Pzhf+/+sMskdGAb05Mjlv9pm8P/tdq3/r7eq/3+1Re3/y00qGPj5OpX/m1plNqDrZ55Zpbvx3xnP/5/2Gv//tMfo/6e9Rv/f7dT9/2qz6v+Xm1T+P12j8v/hYtX/Dxaq/d9dp7yDgYGBCa47P0Kh8NdJz//fD1tjtRUd35un9r8xXCIRpp9l73STF//Pev1/s02LKAMeLVP9v6JA4RYDAwMjAysrg+GHA87//5xyJUrzy00q/x8uUf1/ql31PwMDgzEDJyeD9c/jbv9/HLUn2oC7c9T+X+vX+C/KzxzCwMDAwHdkjvH3j3uMidL8fL3K/+sTNf7vq1f+z8DAYAQJxBCBvmcblIky4M4siO25HiK7kaORrT5JZPvzDbg1vtgA0Xy+S/1/qa/YSQYGBlH0tMAR6cK3an2b1O8n6xCuebEREmgHmpX/14WIv9WS4VjMwMAggi0rcLIwMLgwMzAk8HMzddjqc8z3teZZ6W7Is1RXln0KExNDPgsDgzsDA4M+AwMDO0wTAOkmi+x6U2zHAAAAAElFTkSuQmCC
// @require https://raw.githubusercontent.com/sizzlemctwizzle/GM_config/master/gm_config.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @run-at document-end
// ==/UserScript==

"use strict";

const cfg = new GM_configStruct({
id: "LCFConfig",
title: `


LCF


`,
events: {
open: function () {
makeDraggable(LCFConfig, LCFConfig_header);
LCFConfig_header.style.cursor = "move";
},
save: function () {
apply();
}
},
fields: {
filterList: {
section: ["Filter List", "Create a list of user accounts to filter"],
type: "textarea",
default: "",
save: true
}
},
frame: document.body.appendChild(document.createElement("div")),
css: `
#LCFConfig {
background-color: #f3f6f4;
}
#LCFConfig textarea {
margin-left: auto;
margin-right: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
height: 325px;
resize: none;
font-size: 12px;
}
#LCFConfig_header p.lcftitle {
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
`
});

function makeDraggable(element, handle) {
if (!element) {
return;
}

let mdX = 0, mdY = 0, mdeX = 0, mdeY = 0;

(handle ?? element).onmousedown = function (event) {
this.style.userSelect = "none";
mdX = event.clientX;
mdY = event.clientY;
mdeX = element.offsetLeft;
mdeY = element.offsetTop;
onmouseup = () => {
onmousemove = null;
this.style.userSelect = "";
};
onmousemove = (evt) => {
element.style.left = `${mdeX + evt.clientX - mdX}px`;
element.style.top = `${mdeY + evt.clientY - mdY}px`;
};
};
}

function apply() {
const filterList = cfg.get("filterList").split("\n").filter((e) => e.length > 0);

if (filterList.length !== 0) {
for (let tr of document.querySelectorAll("tr[valign='top']")) {
if (filterList.some(
(s) => tr
.querySelectorAll("td")[1]
.querySelector("span.ljuser")
.getElementsByTagName("a")[0]
.getAttribute("href")
.includes(s)
)) {
tr.parentNode.removeChild(tr);
}
}
}
}

function openConfig() {
cfg.open();
LCFConfig.style = `
height: 75%;
max-height: 500px;
top: calc(50% - 200px);
width: 300px;
left: calc(50% - 150px);
border: 1px solid #000000;
border-radius: 5px;
margin: 0px;
opacity: 1.0;
overflow: auto;
padding: 10px;
position: fixed;
z-index: 65536;
display: block;
right: auto;
bottom: auto;
`;
}

(function () {
GM_registerMenuCommand("Settings", openConfig);
apply();
})();

Link | ir doma | Add to Memories


Comments {6}

multipimp

(bez virsraksta)

from: [info]multipimp
date: Dec. 7., 2021 - 01:15 am
Link

Nepareizi dari. Šo kodu vajag iekomentēt ikvienam esošam LCIF lietotājam, tad tas sāks strādāt

Atbildēt | Diskusija


Ever After

(bez virsraksta)

from: [info]bauda
date: Dec. 7., 2021 - 01:25 am
Link

raudu

Atbildēt | Iepriekšējais


(bez virsraksta)

from: anonymous
date: Dec. 7., 2021 - 01:41 am
Link

raudi, ka tavu zarazu ignorē, suni?

Atbildēt | Iepriekšējais | Diskusija


(bez virsraksta)

from: [info]doom
date: Dec. 7., 2021 - 02:03 am
Link

nefolk, nerunā ar savu suni cibā

Atbildēt | Iepriekšējais | Diskusija


(bez virsraksta)

from: anonymous
date: Dec. 7., 2021 - 02:11 am
Link

te runā policija - tu esi dzēsts

Atbildēt | Iepriekšējais | Diskusija


(bez virsraksta)

from: anonymous
date: Dec. 7., 2021 - 02:18 am
Link

te runā dzēstais ararats - tu esi atsaldēts

Atbildēt | Iepriekšējais