Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yanyongyu/ee16e250bcc136a322f9eff830475b04 to your computer and use it in GitHub Desktop.
Save yanyongyu/ee16e250bcc136a322f9eff830475b04 to your computer and use it in GitHub Desktop.
High dead people at qun.qq.com
// ==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