// ==UserScript==
// @name GreasyFork Total Scripts(modified)
// @namespace pxgamer
// @version 0.2.4
// @description Shows a user's total scripts count on GreasyFork(modified).
// @author NotYou
// @include *greasyfork.org/*/users/*
// @include *greasyfork.org/*/scripts*
// @require https://code.jquery.com/jquery-1.7.2.min.js
// @license GPLv3
// @license-link https://www.gnu.org/licenses/gpl-3.0.txt
// @grant none
// @downloadURL none
// ==/UserScript==
/* What's New?:
* - All languages support (https://greasyfork.org/en/scripts/20343-greasyfork-total-scripts/discussions/15913)
* - Displaying near "Scripts"
* - Colours change parallel to the number count
* - jQuery bug fix
* - Total script at search
*/
(function() {
'use strict';
let l = $('li[data-script-id]').length;
if (l == 1) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Script]');
}
else if(l >= 100) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l >= 50) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l >= 25) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l >= 10) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l >= 5) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l > 1) {
$('div.sidebarred-main-content h3:first').append(' [' + l + ' Total Scripts]');
}
else if(l < 0){
$('div.sidebarred-main-content h3:first').append(' [ Unexpected error! ]');
}
let t = $('li[data-script-id]').length;
if (t == 1) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Script]');
}
else if(t >= 100) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t >= 50) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t >= 25) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t >= 10) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t >= 5) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t > 1) {
$('div.sidebarred-main-content p:first').append(' [' + t + ' Total Scripts]');
}
else if(t < 0){
$('div.sidebarred-main-content p:first').append(' [ Unexpected error! ]');
}
})();