Greasy Fork Total Downloads

Shows a user's total downloads.

当前为 2022-03-27 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name Greasy Fork Total Downloads
// @namespace -
// @version 0.4
// @description Shows a user's total downloads.
// @author NotYou
// @include *greasyfork.org/*/users/*
// @license GPL-3.0
// @run-at document-body
// @grant none
// ==/UserScript==

/*

﹀ Change Log ﹀

0.4 Version:
- Fixed counting bugs
- Converted jQuery to Pure JS
- ES6 Syntax using

*/

window.addEventListener('load', function() {
    let ti = 0;
    let tdi = 0;
    document.querySelectorAll('#user-script-list > li dd.script-list-total-installs span').forEach(function(e) {
        ti += (parseInt(e.innerText.replace(/,/g, '')));
    });
    document.querySelectorAll('#user-script-list > li dd.script-list-daily-installs span').forEach(function(e) {
        tdi += (parseInt(e.innerText.replace(/,/g, '')));
    });
    let tif = ti.toLocaleString();
    let tdif = tdi.toLocaleString();
    document.querySelector('div.sidebarred-main-content h3:first-child').insertAdjacentHTML('beforeend', `<div style="display: inline-flex;padding: 3px 4px 0px 4px;">
    <span style="font-size: 15px;font-variant: normal;color: rgb(123, 23, 23) !important;margin-right: 8px;"> [${tif} Installs]</span>
    <span style="font-size: 15px;font-variant: normal;color: rgb(185, 32, 32) !important;"> [${tdif} Daily Installs]</span>
    </div>`)
});