// ==UserScript== // @name Greasy Fork Total Downloads // @namespace - // @version 1.0.0 // @description Shows a user's total downloads. // @author NotYou // @include *://greasyfork.org/*/users/* // @include *://sleazyfork.org/*/users/* // @match *://greasyfork.org/*/users/* // @match *://sleazyfork.org/*/users/* // @license GPL-3.0 // @run-at document-body // @grant none // @downloadURL none // ==/UserScript== window.addEventListener('DOMContentLoaded', () => { let totalInstalls = 0 let totalDailyInstalls = 0 let userLocale = document.querySelector('#language-selector-locale').value || 'en-US' document.querySelectorAll('#user-script-list > li dd.script-list-total-installs span').forEach(e => { totalInstalls += +e.textContent.replace(/\D/g, '') }) document.querySelectorAll('#user-script-list > li dd.script-list-daily-installs span').forEach(e => { totalDailyInstalls += +e.textContent.replace(/\D/g, '') }) let totalInstallsConverted = totalInstalls.toLocaleString(userLocale) let totalDailyInstallsConverted = totalDailyInstalls.toLocaleString(userLocale) document.querySelector('div.sidebarred-main-content h3:first-child').insertAdjacentHTML('beforeend', createInstallsStat(totalInstallsConverted, 'rgb(123, 23, 23)') + createInstallsStat(totalDailyInstallsConverted, 'rgb(185, 32, 32)') ) function createInstallsStat(value, color) { return ` ${value} Installs ` } })