jQuery Warning in the Code Tab with jQuery

Match "jquery" in @require lines and show large jQuery warning when you are checking out the Code tab on Greasy Fork. Now written with jQuery.

目前為 2020-02-14 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name jQuery Warning in the Code Tab with jQuery
  3. // @name:zh-CN 在“代码”中显示 jQuery 警告 - jQuery 版
  4. // @description Match "jquery" in @require lines and show large jQuery warning when you are checking out the Code tab on Greasy Fork. Now written with jQuery.
  5. // @description:zh-CN 在查看 Greasy Fork 代码页时,通过判断 @require 行中是否有 jquery,显示特大号红色 jQuery 警告。现更以 jQuery 版本呈现。
  6. // @author RainSlide
  7. // @namespace RainSlide
  8. // @match https://greasyfork.org/*/scripts/*/code
  9. // @version 1.0
  10. // @grant none
  11. // @require https://code.jquery.com/jquery-3.4.1.slim.min.js
  12. // ==/UserScript==
  13.  
  14. $( '#script-content > pre' )
  15. .first()
  16. .filter(
  17. ( index, pre ) =>
  18. /\n[ \t]*\/\/[ \t]*@require[ \t]+.+?jquery/
  19. .test( $( pre ).text() )
  20. ).before(
  21. $( '<p></p>' )
  22. .css( "text-align", "center" )
  23. .append(
  24. $( '<strong></strong>' )
  25. .text( "jQuery!!!" )
  26. .css({
  27. "color" : "red",
  28. "font-size" : "5em"
  29. })
  30. )
  31. )