GreasyFork Total Scripts(modified)

Shows a user's total scripts count on GreasyFork(modified).

目前为 2021-12-23 提交的版本。查看 最新版本

// ==UserScript==
// @name              GreasyFork Total Scripts(modified)
// @namespace    pxgamer
// @version            0.2.5
// @description     Shows a user's total scripts count on GreasyFork(modified).
// @author             NotYou
// @include            *gf.qytechs.cn/*/users/*
// @include            *gf.qytechs.cn/*/scripts*
// @include            *sleazyfork.org/*/users/*
// @include            *sleazyfork.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
// ==/UserScript==

/* What's New?:
 * - All languages support (https://gf.qytechs.cn/en/scripts/20343-greasyfork-total-scripts/discussions/15913)
 * - Displaying total user's scripts near "Scripts"
 * - Colours change parallel to the number count
 * - jQuery bug fix
 * - Total script at search
 * - Total libraries at search
 * - Include Sleazy Fork.
 */

(function() {
    'use strict';

    let l = $('li[data-script-id]').length;
    if (l == 1) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(191, 191, 191);font-variant: normal;">  [' + l + ' Total Script]</span>');
    }
    else if(l >= 100) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l >= 50) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l >= 25) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l >= 10) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l >= 5) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l > 1) {
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;">  [' + l + ' Total Scripts]</span>');
    }
    else if(l = 0){
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;">  [ No Scripts Found! ]</span>');
    }
    else if(l < 0){
        $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;">  [ Unexpected error! ]</span>');
    }
})();

if(window.location.href.includes("/libraries?q=")) {
    (function() {
    'use strict';

    let t = $('li[data-script-id]').length;
    if (t == 1) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(191, 191, 191);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(t >= 50) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(t >= 25) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(t >= 10) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(t >= 5) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(t > 1) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;font-weight: bold;">  [' + t + ' Total Libraries]</span>');
    }
    else if(l = 0){
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;">  [ No Libraries Found! ]</span>');
    }
    else if(t < 0){
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;font-weight: bold;">  [ Unexpected error! ]</span>');
    }
})();
} else if(window.location.search.includes("?q=")) {
(function() {
    'use strict';

    let t = $('li[data-script-id]').length;
    if (t == 1) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(191, 191, 191);font-variant: normal;font-weight: bold;">  [' + t + ' Total Script]</span>');
    }
    else if(t >= 50) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Scripts]</span>');
    }
    else if(t >= 25) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Scripts]</span>');
    }
    else if(t >= 10) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;font-weight: bold;">  [' + t + ' Total Scripts]</span>');
    }
    else if(t >= 5) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;font-weight: bold;">  [' + t + ' Total Scripts]</span>');
    }
    else if(t > 1) {
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;font-weight: bold;">  [' + t + ' Total Scripts]</span>');
    }
    else if(l = 0){
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;">  [ No Scripts Found! ]</span>');
    }
    else if(t < 0){
        $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;font-weight: bold;">  [ Unexpected error! ]</span>');
    }
})();
} else {
    console.error(" GreasyFork Total Scripts(modified).user.js > [ Unexpected Error! ] ")
}












QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址