GreasyFork - 在“代码”中显示 jQuery 警告 - jQuery 版

在查看 Greasy Fork 代码页时,通过判断 @require 行中是否有 jquery,显示特大号红色 jQuery 警告。现更以 jQuery 版本呈现。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name              GreasyFork - jQuery Warning in the Code Tab with jQuery
// @name:zh-CN        GreasyFork - 在“代码”中显示 jQuery 警告 - jQuery 版
// @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.
// @description:zh-CN 在查看 Greasy Fork 代码页时,通过判断 @require 行中是否有 jquery,显示特大号红色 jQuery 警告。现更以 jQuery 版本呈现。
// @namespace         RainSlide
// @author            RainSlide
// @icon              https://greasyfork.org/packs/media/images/blacklogo96-b2384000fca45aa17e45eb417cbcbb59.png
// @version           1.2.3
// @license           blessing
// @require           https://code.jquery.com/jquery-3.7.1.slim.min.js
// @match             https://greasyfork.org/*/scripts/*/code
// @grant             none
// ==/UserScript==

"use strict";

$( '.code-container > pre' )
	.first()
	.filter(
		( index, pre ) =>
			/\n[ \t]*\/\/[ \t]*@require[ \t]+.+?jquery/
				.test( $( pre ).text() )
	)
	.parent()
	.before(
		$( '<p></p>' )
			.css( "text-align", "center" )
			.append(
				$( '<strong></strong>' )
					.text( "jQuery!!!" )
					.css({
						"color"     : "red",
						"font-size" : "5em"
					})
			)
	);