简单摸了一个油猴脚本,请看
因为没办法获取到百天内的统计数据,所以用30天的代替
因为没办法获取到百天内的统计数据,所以用30天的代替
因为没办法获取到百天内的统计数据,所以用30天的代替
不要再吐槽数据不准确了
数据来自 about
脚本奉上,希望大佬们赶紧C个管理号出来
// ==UserScript==
// @name Level 3 我来了
// @namespace http://tampermonkey.net/
// @version 2024-03-06
// @description try to take over the world!
// @author wen
// @match https://linux.do/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linux.do
// @grant window.onurlchange
// @require https://scriptcat.org/lib/513/2.0.0/ElementGetter.js
// ==/UserScript==
(function() {
'use strict';
async function get_about(){
let response = await fetch(`https://linux.do/about.json`, {
"headers": {
"Accept": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
},
"method": "Get",
});
let data =await response.json();
return data;
};
function add_lv3_conditions(){
elmGetter.get('li.stats-days-visited > div > span > span').then(div => {
if(div.getAttribute("title")!=null){
div.innerHTML = div.getAttribute("title") + " / " + need_days_visited;
}
else{
div.setAttribute("title",div.innerHTML);
div.innerHTML = div.innerHTML + " / " + need_days_visited;
}
});
elmGetter.get('li.stats-posts-read > div > span > span').then(div => {
console.log(div.getAttribute("title").replace(",",""));
div.innerHTML = div.getAttribute("title").replace(",","") + " / " + Math.min(parseInt(parseInt(posts_30_days)/4),20000);
});
elmGetter.get('li.stats-topics-entered > div > span > span').then(div => {
console.log(div.getAttribute("title").replace(",",""));
div.innerHTML = div.getAttribute("title").replace(",","") + " / " + need_topics_read;
});
elmGetter.get('li.stats-likes-given>a > div > span > span').then(div => {
if(div.getAttribute("title")!=null){
div.innerHTML = div.getAttribute("title") + " / " + need_likes_given;
}
else{
div.setAttribute("title",div.innerHTML);
div.innerHTML = div.innerHTML + " / " + need_likes_given;
}
});
elmGetter.get('li.stats-likes-received > div > span > span').then(div => {
console.log(div.innerHTML);
if(div.getAttribute("title")!=null){
div.innerHTML = div.getAttribute("title") + " / " + need_likes_received;
}
else{
div.setAttribute("title",div.innerHTML);
div.innerHTML = div.innerHTML + " / " + need_likes_received;
}
});
elmGetter.get('li.stats-post-count > a > div > span > span').then(div => {
console.log(div.innerHTML);
if(div.getAttribute("title")!=null){
div.innerHTML = div.getAttribute("title") + " / " + need_posts_read;
}
else{
div.setAttribute("title",div.innerHTML);
div.innerHTML = div.innerHTML + " / " + need_posts_read;
}
});
}
let need_days_visited = 50;
let need_topics_reply = 10;
let need_topics_read = 500;
let need_topics_read_alltime = 200;
let need_posts_read = 10;
let need_posts_read_alltime = 500;
let need_likes_given = 30;
let need_likes_received = 20;
let topics_count,topics_last_day,topics_7_days;
let posts_30_days;
get_about().then((res)=>{
console.log(res);
posts_30_days = res.about.stats.posts_30_days;
console.log(posts_30_days);
});
if (window.onurlchange === null) {
// feature is supported
window.addEventListener('urlchange', (info) => {
var regex = /^https:\/\/linux\.do\/u\/[^\/]+\/summary$/;
if(regex.test(info.url)){
add_lv3_conditions();
}
});
};
add_lv3_conditions();
})();
修改
1、修复需要刷新才能显示
2、增加上限为20000
有大哥优化了一下样式。