GreasyFork Total Scripts(modified)

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

目前為 2021-12-24 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name GreasyFork Total Scripts(modified)
  3. // @namespace pxgamer
  4. // @version 0.2.6
  5. // @description Shows a user's total scripts count on GreasyFork(modified).
  6. // @author NotYou
  7. // @include *greasyfork.org/*/users/*
  8. // @include *greasyfork.org/*/scripts*
  9. // @include *sleazyfork.org/*/users/*
  10. // @include *sleazyfork.org/*/scripts*
  11. // @require https://code.jquery.com/jquery-1.7.2.min.js
  12. // @license GPLv3
  13. // @license-link https://www.gnu.org/licenses/gpl-3.0.txt
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. /* What's New?:
  18. * - All languages support (https://greasyfork.org/en/scripts/20343-greasyfork-total-scripts/discussions/15913)
  19. * - Displaying total user's scripts near "Scripts"
  20. * - Colours change parallel to the number count
  21. * - jQuery bug fix
  22. * - Total script at search
  23. * - Total libraries at search
  24. * - Include Sleazy Fork.
  25. * - Works with local override.
  26. */
  27.  
  28. (function() {
  29. 'use strict';
  30.  
  31. let l = $('li[data-script-id]').length;
  32. if (l == 1) {
  33. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(191, 191, 191);font-variant: normal;"> [' + l + ' Total Script]</span>');
  34. }
  35. else if(l >= 100) {
  36. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  37. }
  38. else if(l >= 50) {
  39. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  40. }
  41. else if(l >= 25) {
  42. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  43. }
  44. else if(l >= 10) {
  45. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  46. }
  47. else if(l >= 5) {
  48. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  49. }
  50. else if(l > 1) {
  51. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + l + ' Total Scripts]</span>');
  52. }
  53. else if(l = 0){
  54. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Scripts Found! ]</span>');
  55. }
  56. else if(l < 0){
  57. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  58. }
  59. })();
  60.  
  61. if(window.location.href.includes("/libraries?q=")||window.location.href.includes("/libraries?locale_override=1&q=")) {
  62. (function() {
  63. 'use strict';
  64.  
  65. let t = $('li[data-script-id]').length;
  66. if (t == 1) {
  67. $('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 Library]</span>');
  68. }
  69. else if(t >= 50) {
  70. $('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>');
  71. }
  72. else if(t >= 25) {
  73. $('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>');
  74. }
  75. else if(t >= 10) {
  76. $('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>');
  77. }
  78. else if(t >= 5) {
  79. $('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>');
  80. }
  81. else if(t > 1) {
  82. $('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>');
  83. }
  84. else if(l = 0){
  85. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Libraries Found! ]</span>');
  86. }
  87. else if(t < 0){
  88. $('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>');
  89. }
  90. })();
  91. } else if(window.location.href.includes("/scripts?q=")||window.location.href.includes("/scripts?locale_override=1&q=")) {
  92. (function() {
  93. 'use strict';
  94.  
  95. let t = $('li[data-script-id]').length;
  96. if (t == 1) {
  97. $('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>');
  98. }
  99. else if(t >= 50) {
  100. $('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>');
  101. }
  102. else if(t >= 25) {
  103. $('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>');
  104. }
  105. else if(t >= 10) {
  106. $('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>');
  107. }
  108. else if(t >= 5) {
  109. $('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>');
  110. }
  111. else if(t > 1) {
  112. $('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>');
  113. }
  114. else if(l = 0){
  115. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Scripts Found! ]</span>');
  116. }
  117. else if(t < 0){
  118. $('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>');
  119. }
  120. })();
  121. } else {
  122. console.error(" GreasyFork Total Scripts(modified).user.js > [ Unexpected Error! ] ")
  123. }
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.