Greasy Fork User Statistics+

shows user statistics as total installs, total scripts and etc.

当前为 2022-02-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Greasy Fork User Statistics+
// @namespace -
// @version 0.1
// @description shows user statistics as total installs, total scripts and etc.
// @author NotYou
// @include *greasyfork.org/*/users/*
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @license GPL-3.0
// @license-link https://www.gnu.org/licenses/gpl-3.0.txt
// @grant GM_addStyle
// ==/UserScript==

(function() {
let css = `

.numStat {
  margin-left: 0px;
  font-weight: 700 !important;
  font-size: 14px;
}

.columnStat {
  background-color: rgba(0, 0, 0, 0.17);
  user-select: none !important;
  transition: 380ms;
  padding-left: 5px;
  padding-top: 5px;
  margin-top: 3px;
  display: block;
  height: 40px;
  border-radius: 0px 4px 4px 0px;
}

.showMore {
  background: rgba(0, 0, 0, 0.17);
  color: currentColor !important;
  position: absolute;
  transition: 100ms;
  border-radius: 0px 5px 5px 0px;
  left: 92.4%;
  margin-top: -37px;
  cursor: default;
  padding: 8px;
  border-left: 2px solid currentColor;
}

#user-statistics > span {
  font-weight: 700;
}

#user-statistics > h3:nth-of-type(1):lang(ar)::before {
    content: "إحصائيات المستخدم";
}

#user-statistics > h3:nth-of-type(2):lang(ar)::before {
    content: "يعمل المستخدم";
}

#user-statistics > h3:nth-of-type(1):lang(bg)::before {
    content: "Потребителска статистика";
}

#user-statistics > h3:nth-of-type(2):lang(bg)::before {
    content: "Потребителят работи";
}

#user-statistics > h3:nth-of-type(1):lang(cs)::before {
    content: "Statistiky uživatelů";
}

#user-statistics > h3:nth-of-type(2):lang(cs)::before {
    content: "Uživatel pracuje";
}

#user-statistics > h3:nth-of-type(1):lang(da)::before {
    content: "Brugerstatistik";
}

#user-statistics > h3:nth-of-type(2):lang(da)::before {
    content: "Brugeren fungerer";
}

#user-statistics > h3:nth-of-type(1):lang(de)::before {
    content: "Benutzerstatistiken";
}

#user-statistics > h3:nth-of-type(2):lang(de)::before {
    content: "Benutzer funktioniert";
}

#user-statistics > h3:nth-of-type(1):lang(el)::before {
    content: "Στατιστικά στοιχεία χρηστών";
}

#user-statistics > h3:nth-of-type(2):lang(el)::before {
    content: "Ο χρήστης λειτουργεί";
}

#user-statistics > h3:nth-of-type(1):lang(en)::before {
    content: "User statistics";
}

#user-statistics > h3:nth-of-type(2):lang(en)::before {
    content: "User works";
}

#user-statistics > h3:nth-of-type(1):lang(eo)::before {
    content: "Statistiko de uzantoj";
}

#user-statistics > h3:nth-of-type(2):lang(eo)::before {
    content: "Uzanto funkcias";
}

#user-statistics > h3:nth-of-type(1):lang(es)::before {
    content: "Estadísticas de usuario";
}

#user-statistics > h3:nth-of-type(2):lang(es)::before {
    content: "El usuario trabaja";
}

#user-statistics > h3:nth-of-type(1):lang(fi)::before {
    content: "Käyttäjätilastot";
}

#user-statistics > h3:nth-of-type(2):lang(fi)::before {
    content: "Käyttäjä toimii";
}

#user-statistics > h3:nth-of-type(1):lang(fr)::before {
    content: "Statistiques d'utilisateurs";
}

#user-statistics > h3:nth-of-type(2):lang(fr)::before {
    content: "L'utilisateur travaille";
}

#user-statistics > h3:nth-of-type(1):lang(he)::before {
    content: "סטטיסטיקות משתמשים";
}

#user-statistics > h3:nth-of-type(2):lang(he)::before {
    content: "משתמש עובד";
}

#user-statistics > h3:nth-of-type(1):lang(hu)::before {
    content: "Felhasználói statisztikák";
}

#user-statistics > h3:nth-of-type(2):lang(hu)::before {
    content: "Felhasználó működik";
}

#user-statistics > h3:nth-of-type(1):lang(id)::before {
    content: "Statistik pengguna";
}

#user-statistics > h3:nth-of-type(2):lang(id)::before {
    content: "Pengguna bekerja";
}

#user-statistics > h3:nth-of-type(1):lang(it)::before {
    content: "Statistiche utente";
}

#user-statistics > h3:nth-of-type(2):lang(it)::before {
    content: "L'utente lavora";
}

#user-statistics > h3:nth-of-type(1):lang(ja)::before {
    content: "ユーザー統計";
}

#user-statistics > h3:nth-of-type(2):lang(ja)::before {
    content: "ユーザーは動作します";
}

#user-statistics > h3:nth-of-type(1):lang(ko)::before {
    content: "사용자 통계";
}

#user-statistics > h3:nth-of-type(2):lang(ko)::before {
    content: "사용자 작품";
}

#user-statistics > h3:nth-of-type(1):lang(ne)::before {
    content: "Gebruikersstatistieken";
}

#user-statistics > h3:nth-of-type(2):lang(ne)::before {
    content: "Gebruiker werkt";
}

#user-statistics > h3:nth-of-type(1):lang(pl)::before {
    content: "Statystyki użytkowników";
}

#user-statistics > h3:nth-of-type(2):lang(pl)::before {
    content: "Użytkownik pracuje";
}

#user-statistics > h3:nth-of-type(1):lang(ro)::before {
    content: "Statistici utilizatori";
}

#user-statistics > h3:nth-of-type(2):lang(ro)::before {
    content: "Utilizatorul lucrează";
}

#user-statistics > h3:nth-of-type(1):lang(ru)::before {
    content: "Статистика пользователей";
}

#user-statistics > h3:nth-of-type(2):lang(ru)::before {
    content: "Пользовательские работы";
}

#user-statistics > h3:nth-of-type(1):lang(tr)::before {
    content: "Kullanıcı istatistikleri";
}

#user-statistics > h3:nth-of-type(2):lang(tr)::before {
    content: "Kullanıcı işleri";
}

#user-statistics > h3:nth-of-type(1):lang(uk)::before {
    content: "Статистика користувачів";
}

#user-statistics > h3:nth-of-type(2):lang(uk)::before {
    content: "Користувач працює";
}

#user-statistics > h3:nth-of-type(1):lang(vi)::before {
    content: "Thống kê người dùng";
}

#user-statistics > h3:nth-of-type(2):lang(vi)::before {
    content: "Người dùng hoạt động";
}

#user-statistics > h3:nth-of-type(1):lang(zh-CN)::before {
    content: "用户统计";
}

#user-statistics > h3:nth-of-type(2):lang(zh-CN)::before {
    content: "用户作品";
}

#user-statistics > h3:nth-of-type(1):lang(zh-TW)::before {
    content: "用戶統計";
}

#user-statistics > h3:nth-of-type(2):lang(zh-TW)::before {
    content: "用戶作品";
}

#user-statistics > h3:nth-of-type(1)::before {
    content: "User statistics";
}

#user-statistics > h3:nth-of-type(2)::before {
    content: "User works";
}

`;
if (typeof GM_addStyle !== "undefined") {
  GM_addStyle(css);
} else {
  let styleNode = document.createElement("style");
  styleNode.appendChild(document.createTextNode(css));
  (document.querySelector("head") || document.documentElement).appendChild(styleNode);
}
})();

/* START OF MIT LICENSE | Source: https://greasyfork.org/scripts/438584/code */
const wrapper = document.querySelector("#browse-script-list, #user-script-list");
const els = [...wrapper.querySelectorAll("dd.script-list-total-installs")];
const els2 = [...wrapper.querySelectorAll("dd.script-list-daily-installs")];
const nonDigits = /[^\d]/g;
const getNum = txt => parseFloat(txt.replace(nonDigits, ""));
const totalDownloads = els.reduce((acc, el) => acc + getNum(el.textContent), 0);
const totalDailyDownloads = els2.reduce((acc, el) => acc + getNum(el.textContent), 0);
const totalDownloadsStat = els.reduce((acc, el) => acc + getNum(el.textContent), 0);
const totalDailyDownloadsStat = els2.reduce((acc, el) => acc + getNum(el.textContent), 0);
/* END OF MIT LICENSE */

if(totalDownloads > 800) {
    var totalDownloadsTotal = '';
} else if(totalDownloads == 0) {
    var totalDownloadsTotal = '0'
} else if(totalDownloads < 800) {
    var totalDownloadsTotal = totalDownloads;
}

if(totalDailyDownloads > 800) {
    var totalDailyDownloadsTotal = '';
} else if(totalDailyDownloads == 0) {
    var totalDailyDownloadsTotal = '0'
} else if(totalDailyDownloads < 800) {
    var totalDailyDownloadsTotal = totalDailyDownloads;
}

let cssStat = document.querySelectorAll('[data-css-available-as-js="true"]').length; var cssTotal = cssStat * 4;
let libStat = document.querySelectorAll('#user-library-script-list > li').length; var libTotal = libStat * 4;
let jsStat = document.querySelectorAll('#user-script-list > [data-css-available-as-js="false"]').length; var jsTotal = jsStat * 4;

$('#about-user').append(`<section id="user-statistics">
<h3></h3>
<span id="column0" class="columnStat">Total Installs</span><span id="column0More" class="showMore">`+totalDownloadsStat+`</span>
<span id="column1" class="columnStat">Daily Installs</span><span id="column1More" class="showMore">`+totalDailyDownloadsStat+`</span>
<h3></h3>
<span id="column2" class="columnStat">Total Scripts</span><span id="column2More" class="showMore">`+jsStat+`</span>
<span id="column3" class="columnStat">Total Styles</span><span id="column3More" class="showMore">`+cssStat+`</span>
<span id="column4" class="columnStat">Total Libraries</span><span id="column4More" class="showMore">`+libStat+`</span>
</section>`);

(function() {
    let css = `
    #column0 {
    width: 0px;
    }

    #column1 {
    width: 0px;
    }

    #column2 {
    width: 0px;
    }

    #column3 {
    width: 0px;
    }

    #column4 {
    width: 0px;
    }
    `;
    if (typeof GM_addStyle !== "undefined") {
        GM_addStyle(css);
    } else {
        let styleNode = document.createElement("style");
        styleNode.appendChild(document.createTextNode(css));
        (document.querySelector("head") || document.documentElement).appendChild(styleNode);
    }
})();

if(totalDownloadsTotal == "") {
    totalDownloadsTotal = '92%'
} else {
    totalDownloadsTotal = totalDownloadsTotal+'px'
}

if(totalDailyDownloadsTotal == "") {
    totalDailyDownloadsTotal = '92%'
} else {
    totalDailyDownloadsTotal = totalDailyDownloadsTotal+'px'
}

function columnsStart() {
    (function() {
        let css = `

        #column0 {
        width: `+totalDownloadsTotal+` !important;
        }

        #column1 {
        width: `+totalDailyDownloadsTotal+` !important;
        }

        #column2 {
        width: `+jsTotal+`px;
        }

        #column3 {
        width: `+cssTotal+`px;
        }

        #column4 {
        width: `+libTotal+`px;
        }

        `;
            if (typeof GM_addStyle !== "undefined") {
            GM_addStyle(css);
        } else {
            let styleNode = document.createElement("style");
            styleNode.appendChild(document.createTextNode(css));
            (document.querySelector("head") || document.documentElement).appendChild(styleNode);
        }})();
    }
setTimeout(columnsStart, 300)