Forked from mnixry/highlight-inactive-member.user.js
Last active
January 11, 2024 02:53
-
-
Save yanyongyu/ee16e250bcc136a322f9eff830475b04 to your computer and use it in GitHub Desktop.
High dead people at qun.qq.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Highlight inactive group member | |
// @namespace https://gist.github.com/mnixry/ | |
// @version 0.1 | |
// @description Highlight inactive group members with rainbow color | |
// @author Mix | |
// @author yanyongyu | |
// @match https://qun.qq.com/ | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com | |
// @updateURL https://gist.github.com/mnixry/8f77e4fa658170561d6f7197ce7d6340/raw/highlight-inactive-member.user.js | |
// @downloadURL https://gist.github.com/mnixry/8f77e4fa658170561d6f7197ce7d6340/raw/highlight-inactive-member.user.js | |
// @supportURL https://gist.github.com/mnixry/8f77e4fa658170561d6f7197ce7d6340/#new_comment_field | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (!/#\/member-manage\/base-manage/.test(location.hash)) return; | |
const MAX_DAY = 90 | |
setInterval( | |
()=>{ | |
const members = [...document.querySelectorAll('tbody.t-table__body > tr')] | |
members | |
.forEach(m=>{ | |
const itime = m.querySelector('td:nth-child(7)').innerText; | |
const ltime = m.querySelector('td:nth-child(8)').innerText; | |
let idate, ldate; | |
try { | |
idate = Date.parse(itime); | |
ldate = Date.parse(ltime); | |
} catch (error) { | |
return | |
} | |
const diffDay = MAX_DAY - ( (ldate - idate) / (24 * 60 * 60 * 1000) ) | |
if (diffDay < 0) return | |
const hslValue = 160 * (MAX_DAY - diffDay) / MAX_DAY | |
const columns = [...m.querySelectorAll('td')] | |
columns.forEach(c=>(c.style.backgroundColor = `hsl(${hslValue},80%,90%)`)) | |
}) | |
}, | |
1000 | |
) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment