-
-
Save y4code/47ca6a6df1af96242de2bd253b16f77b to your computer and use it in GitHub Desktop.
// let ori = []; | |
// ori.sort( | |
// compare, | |
// ) | |
// function compare(a: any, b: any): number { | |
// var a_compare = Number(a.getElementsByClassName('small fade')[0].innerText.substring(1)) ?? 0; | |
// var b_compare = Number(b.getElementsByClassName('small fade')[0].innerText.substring(1)) ?? 0; | |
// if (a_compare > b_compare) { // 按某种排序标准进行比较, a 小于 b | |
// return -1; | |
// } | |
// if (a_compare < b_compare) { | |
// return 1; | |
// } | |
// return 0; | |
// } | |
// #r_7013167 > table > tbody > tr > td: nth - child(3) > span.small.fade > img | |
// #r_7014240 > table > tbody > tr > td:nth-child(3) > span.small.fade > img | |
var origin = $('div[class=cell][id^=r_]') | |
function compare(a, b) { | |
var a_compare = Number(a.getElementsByClassName('small fade')[0]?.innerText.substring(1) ?? 0); | |
var b_compare = Number(b.getElementsByClassName('small fade')[0]?.innerText.substring(1) ?? 0); | |
if (a_compare > b_compare) { // 按某种排序标准进行比较, a 小于 b | |
console.log('-1') | |
return -1; | |
} | |
if (a_compare < b_compare) { | |
console.log('1') | |
return 1; | |
} | |
console.log('0') | |
return 0; | |
} | |
var sorted = origin.sort(compare); | |
$(".box")[5].remove(); | |
sorted.appendTo($(".box")[5]); | |
// origin.forEach(e => { | |
// console.log(e.getElementsByClassName('small fade')[0]?.innerText.substring(1) ?? 0); | |
// }); |
// ==UserScript==
// @name 假装在用Terminal,实际在上V2EX
// @namespace http://tampermonkey.net/
// @Version 0.1
// @description try to take over the world!
// @author You
// @match https://v2ex.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Your code here...
[].forEach.call(document.getElementsByTagName("*"), (element => {
element.style.filter = 'grayscale(1)';
element.style.background = 'black';
element.style.color = 'white';
// console.log(element)
}))
})();
// ==UserScript==
// @name 移除虎牙交友直播间
// @namespace http://tampermonkey.net/
// @Version 0.1
// @description try to take over the world!
// @author You
// @match https://www.huya.com/l
// @grant none
// ==/UserScript==
(function () {
'use strict';
[].filter.call($(".game-live-item"), (e) => {
return e.innerText.includes('交友')
|| e.innerText.includes('王者荣耀')
|| e.innerText.includes('地下城与勇士')
|| e.innerText.includes('和平精英')
}).forEach(e => e.remove())
})();
移除虎牙主页交友直播间
[].filter.call($(".game-live-item"), (e)=> e.innerText.includes('交友')).forEach(e => e.remove())