jQuery Warning in the Code Tab

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

Version vom 20.11.2019. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name              jQuery Warning in the Code Tab
// @name:zh-CN        在“代码”中显示 jQuery 警告
// @description       Match "jquery" in @require lines and show large jQuery warning when you are checking out the Code tab on Greasy Fork.
// @description:zh-CN 在查看 Greasy Fork 代码页时,通过判断 @require 行中是否有 jquery,显示特大号红色 jQuery 警告。
// @namespace         RainSlide
// @match             https://greasyfork.org/*/scripts/*/code
// @version           1.0
// @grant             none
// ==/UserScript==

if ( document.querySelector('#script-content > pre') ) {
	const pre = document.querySelector('#script-content > pre');
	if (
		/\n[ \t]*\/\/[ \t]*@require[ \t]+.+?jquery/.test(pre.textContent)
	) pre.parentNode.insertBefore(
		(() => {
			const p = document.createElement("p"),
			strong = document.createElement("strong");
			strong.textContent = "jQuery!!!";
			p.style = "text-align: center;"
			strong.style = "color: red; font-size: 5em;";
			p.appendChild(strong);
			return p;
		})(), pre
	);
}