Greasy Fork is available in English.

GreasyFork Total Scripts(modified)

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

2022-01-09 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name GreasyFork Total Scripts(modified)
  3. // @namespace pxgamer
  4. // @version 0.2.8
  5. // @description Shows a user's total scripts count on GreasyFork(modified).
  6. // @author NotYou
  7. // @include *greatest.deepsurf.us/*/users/*
  8. // @include *greatest.deepsurf.us/*/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://greatest.deepsurf.us/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 Scripts 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 better visibility
  28. * Total Libraries
  29. * Less Usless Code
  30. * Fixed Total Scripts at search
  31. */
  32.  
  33. // Total Scripts
  34. (function() {
  35. 'use strict';
  36.  
  37. let jstotal = $("span:contains('JS')").length;
  38. let csstotal = $("span:contains('CSS')").length;
  39. let libtotal = $("span:contains('(Library)')").length;
  40.  
  41. if (jstotal == 1) {
  42. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;"> [' + jstotal + ' Total Script]</span>');
  43. }
  44. else if(jstotal >= 100) {
  45. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  46. }
  47. else if(jstotal >= 50) {
  48. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  49. }
  50. else if(jstotal >= 25) {
  51. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  52. }
  53. else if(jstotal >= 10) {
  54. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  55. }
  56. else if(jstotal >= 5) {
  57. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  58. }
  59. else if(jstotal > 1) {
  60. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + jstotal + ' Total Scripts]</span>');
  61. }
  62. else if(jstotal < 0){
  63. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  64. }
  65.  
  66. // Total Styles
  67.  
  68. if (csstotal == 1) {
  69. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;"> [' + csstotal + ' Total Style]</span>');
  70. }
  71. else if(csstotal >= 100) {
  72. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  73. }
  74. else if(csstotal >= 50) {
  75. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  76. }
  77. else if(csstotal >= 25) {
  78. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  79. }
  80. else if(csstotal >= 10) {
  81. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  82. }
  83. else if(csstotal >= 5) {
  84. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  85. }
  86. else if(csstotal > 1) {
  87. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + csstotal + ' Total Styles]</span>');
  88. }
  89. else if(csstotal < 0){
  90. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  91. }
  92.  
  93. // Total Libraries
  94.  
  95. if (libtotal == 1) {
  96. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-variant: normal;"> [' + libtotal + ' Total Library]</span>');
  97. }
  98. else if(libtotal >= 100) {
  99. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 16, 16);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  100. }
  101. else if(libtotal >= 50) {
  102. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  103. }
  104. else if(libtotal >= 25) {
  105. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  106. }
  107. else if(libtotal >= 10) {
  108. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  109. }
  110. else if(libtotal >= 5) {
  111. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  112. }
  113. else if(libtotal > 1) {
  114. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-variant: normal;"> [' + libtotal + ' Total Libraries]</span>');
  115. }
  116. else if(libtotal < 0){
  117. $('div.sidebarred-main-content h3:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-variant: normal;"> [ Unexpected error! ]</span>');
  118. }
  119. })();
  120.  
  121. // Total Libraries at search
  122. if(window.location.href.includes("/libraries?q=")||window.location.href.includes("/libraries?locale_override=1&q=")) {
  123. (function() {
  124. 'use strict';
  125.  
  126. let t = $('li[data-script-type="library"]').length;
  127. if (t == 1) {
  128. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-weight: bold;"> [' + t + ' Total Library]</span>');
  129. }
  130. else if(t >= 50) {
  131. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-weight: bold;"> [' + t + ' Total Libraries]</span>');
  132. }
  133. else if(t >= 25) {
  134. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-weight: bold;"> [' + t + ' Total Libraries]</span>');
  135. }
  136. else if(t >= 10) {
  137. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-weight: bold;"> [' + t + ' Total Libraries]</span>');
  138. }
  139. else if(t >= 5) {
  140. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-weight: bold;"> [' + t + ' Total Libraries]</span>');
  141. }
  142. else if(t > 1) {
  143. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-weight: bold;"> [' + t + ' Total Libraries]</span>');
  144. }
  145. else if(t < 0){
  146. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-weight: bold;"> [ Unexpected error! ]</span>');
  147. }
  148. })(); // Total Scripts at search
  149. } else if(window.location.href.includes("/scripts?q=")||(window.location.href.includes("/scripts?locale_override=1&q=")) != -1) {
  150. (function() {
  151. 'use strict';
  152.  
  153. let l = $('li[data-script-type]').length;
  154. if (l == 1) {
  155. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(125, 125, 125);font-weight: bold;"> [' + l + ' Total Script]</span>');
  156. }
  157. else if(l >= 50) {
  158. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 87, 16);font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  159. }
  160. else if(l >= 25) {
  161. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(185, 159, 16);font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  162. }
  163. else if(l >= 10) {
  164. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(21, 185, 16);font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  165. }
  166. else if(l >= 5) {
  167. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 185, 153);font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  168. }
  169. else if(l > 1) {
  170. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(16, 42, 185);font-weight: bold;"> [' + l + ' Total Scripts]</span>');
  171. }
  172. else if(l < 0){
  173. $('div.sidebarred-main-content p:first').append('<span style="font-size: 15px;color: rgb(213, 79, 79);font-weight: bold;"> [ Unexpected error! ]</span>');
  174. }
  175. })();
  176. }
  177.  
  178. // Log Message
  179. let jstotal = $("span:contains('JS')").length;
  180. let csstotal = $("span:contains('CSS')").length;
  181. let libtotal = $("span:contains('(Library)')").length;
  182. let t = $('li[data-script-type="library"]').length;
  183. let l = $('li[data-script-type]').length;
  184.  
  185. console.log('[Total Scripts: ' + jstotal + ']\n[Total Styles: ' + csstotal + ']\n[Total Libraries: ' + libtotal + ']\n[Total Libraries At Search: ' + t + ']\n[Total Scripts At Search: ' + l + ']')
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.