GreasyFork Total Scripts(modified)

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

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

  1. // ==UserScript==
  2. // @name GreasyFork Total Scripts(modified)
  3. // @namespace pxgamer
  4. // @version 0.2.7
  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. * - Shows Total Styles
  27. * - Better colors for low number for betteer visibility
  28. */
  29.  
  30. // Total Scripts
  31. (function() {
  32. 'use strict';
  33.  
  34. let jstotal = $('li[data-script-language="js"]').length;
  35. if (jstotal == 1) {
  36. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;"> [' + jstotal + ' Total Script]</span>');
  37. }
  38. else if(jstotal >= 100) {
  39. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  40. }
  41. else if(jstotal >= 50) {
  42. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  43. }
  44. else if(jstotal >= 25) {
  45. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  46. }
  47. else if(jstotal >= 10) {
  48. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  49. }
  50. else if(jstotal >= 5) {
  51. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  52. }
  53. else if(jstotal > 1) {
  54. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  55. }
  56. else if((jstotal = 0)||(jstotal = undefined)||(jstotal = NaN)){
  57. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Scripts Found! ]</span>');
  58. }
  59. else if(jstotal < 0){
  60. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  61. }
  62. })();
  63.  
  64. // Total Styles
  65. (function() {
  66. 'use strict';
  67.  
  68. let csstotal = $('li[data-script-language="css"]').length;
  69. if (csstotal == 1) {
  70. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;"> [' + csstotal + ' Total Style]</span>');
  71. }
  72. else if(csstotal >= 100) {
  73. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  74. }
  75. else if(csstotal >= 50) {
  76. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  77. }
  78. else if(csstotal >= 25) {
  79. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  80. }
  81. else if(csstotal >= 10) {
  82. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  83. }
  84. else if(csstotal >= 5) {
  85. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  86. }
  87. else if(csstotal > 1) {
  88. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  89. }
  90. else if((csstotal = 0)||(csstotal = undefined)||(csstotal = NaN)){
  91. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Scripts Found! ]</span>');
  92. }
  93. else if(csstotal < 0){
  94. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  95. }
  96. })();
  97.  
  98. // Total Libraries
  99. if(window.location.href.includes("/libraries?q=")||window.location.href.includes("/libraries?locale_override=1&q=")) {
  100. (function() {
  101. 'use strict';
  102.  
  103. let t = $('li[data-script-id]').length;
  104. if (t == 1) {
  105. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;font-weight: bold;"> [' + t + ' Total Library]</span>');
  106. }
  107. else if(t >= 50) {
  108. $('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>');
  109. }
  110. else if(t >= 25) {
  111. $('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>');
  112. }
  113. else if(t >= 10) {
  114. $('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>');
  115. }
  116. else if(t >= 5) {
  117. $('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>');
  118. }
  119. else if(t > 1) {
  120. $('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>');
  121. }
  122. else if((t = 0)||(t = undefined)||(t = NaN)){
  123. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Libraries Found! ]</span>');
  124. }
  125. else if(t < 0){
  126. $('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>');
  127. }
  128. })(); // Total Scripts at search
  129. } else if(window.location.href.includes("/scripts?q=")||window.location.href.includes("/scripts?locale_override=1&q=")) {
  130. (function() {
  131. 'use strict';
  132.  
  133. let l = $('li[data-script-id]').length;
  134. if (l == 1) {
  135. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;font-weight: bold;"> [' + l + ' Total Script]</span>');
  136. }
  137. else if(t >= 50) {
  138. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  139. }
  140. else if(l >= 25) {
  141. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  142. }
  143. else if(l >= 10) {
  144. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  145. }
  146. else if(l >= 5) {
  147. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  148. }
  149. else if(l > 1) {
  150. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  151. }
  152. else if((l = 0)||(l = undefined)||(l = NaN)){
  153. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ No Scripts Found! ]</span>');
  154. }
  155. else if(l < 0){
  156. $('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>');
  157. }
  158. })(); // Error Messsenge
  159. } else {
  160. console.error(" GreasyFork Total Scripts(modified).user.js > [ Unexpected Error! ] \nMay be scripts/library count = 0")
  161. }
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.