GreasyFork Trực quan hóa dữ liệu tập lệnh do người dùng xuất bản

sử dụngChart.jsLấy và hiển thị dữ liệu tập lệnh người dùng,Và tạo biểu đồ trên trang chủ cá nhân của người dùng để hiển thị trạng thái cài đặt chi tiết bên dưới.

< Feedback on GreasyFork Trực quan hóa dữ liệu tập lệnh do người dùng xuất bản

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

Đăng nhập để bình luận