GreasyFork User Script Data Visualization

Fetch and visualize user script data with Chart.js and display totals below the chart

< Feedback on GreasyFork User Script Data Visualization

Review: Good - script works

§
Posted: 18-09-2024

感谢作者优秀的脚本作品。! 提点小请求,可以将返回的数据按照总安装排序

const getUserData = (userID) => {
    return fetch(`https://${window.location.hostname}/users/${userID}.json`)
        .then((response) => {
            console.log(`${response.status}: ${response.url}`);
            return response.json();
        })
        .then((data) => {
            data.scripts.sort((a, b) => b.total_installs - a.total_installs);
            return data;
        });
};

由于开启了脚本清理链接中无用的参数:导致表达式无法寻找到ID 可以改成/(\d+)/ 这样就可以匹配是清理前和清理后的ID了

Post reply

Sign in to post a reply.