Skip to content

Instantly share code, notes, and snippets.

@mnixry
Last active February 6, 2023 19:20
Show Gist options
  • Save mnixry/8f77e4fa658170561d6f7197ce7d6340 to your computer and use it in GitHub Desktop.
Save mnixry/8f77e4fa658170561d6f7197ce7d6340 to your computer and use it in GitHub Desktop.
Userscript to highlight inactive group members with rainbow color
// ==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/member.html
// @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';
const MAX_DAY = 90
setInterval(
()=>{
const members = [...document.querySelectorAll('.mb')]
members
.forEach(m=>{
const itime = m.querySelector('td:nth-child(8)').innerText;
const ltime = m.querySelector('td:nth-child(10)').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('dd 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