// ==UserScript==
// @name Greasy Fork Total Downloads
// @namespace -
// @version 0.3
// @description Shows a user's total downloads.
// @author NotYou
// @include *greasyfork.org/*/users/*
// @license GPLv3
// @license-link https://www.gnu.org/licenses/gpl-3.0.txt
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @grant none
// @downloadURL none
// ==/UserScript==
/*
﹀ Change Log ﹀
0.3 Version:
- Fixed bug #002
- Shorter code for log message
- Shorter append
- Removed Subtract
0.2 Version:
- Added Daily Installs
- Fixed bug #001
*/
/*
BUG #002:
Subtract daily installs 2 times, aslo doesn't subtract daily installs from deleted script.
BUG #001:
Count deleted script installs.
*/
$('body').ready(function(){
// LETs
let totalDownloads = 0;
let totalDailyDownloads = 0;
// COUNTING
$('ol#user-script-list li article dd.script-list-total-installs span').each(function() {
totalDownloads += Number($(this).text())
});
$('ol#user-script-list li article dd.script-list-daily-installs span').each(function() {
totalDailyDownloads += Number($(this).text())
});
// LOG
console.log('[ Total Downloads: ' +totalDownloads+ ' ]\n[ Total Daily Downloads: ' +totalDailyDownloads+ ' ]')
// HTML
$('div.sidebarred-main-content h3:first').append(' [' +totalDownloads+ ' Total Installs] [' +totalDailyDownloads+ ' Total Daily Installs]');
});