如何在Greasemonkey中使用jQuery? [英] How can I use jQuery in Greasemonkey?

查看:76
本文介绍了如何在Greasemonkey中使用jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试放置此行,但不起作用:

I tried putting this line but it doesn't work:

// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js

jQuery根本无法在Greasemonkey中工作.还有其他在Greasemonkey中使用jQuery的方法吗?

jQuery doesn't work in Greasemonkey at all. Is there other way to use jQuery in Greasemonkey?

-

对于所有有相同问题的人,您必须将文件上传到油脂专区,然后从那里安装.

For all the people who have the same problem, you must upload the file to greasespot then install it from there.

创建新脚本"选项不起作用!

The Create New Script option wouldn't work!

推荐答案

也许您的Greasemonkey版本不足.是版本0.8添加了@require.

Perhaps you don't have a recent enough version of Greasemonkey. It was version 0.8 that added @require.

// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js 

如果您没有0.8,请使用琼·皮德拉(Joan Piedra)为script元素到页面.

If you don't have 0.8, then use the technique Joan Piedra describes for manually adding a script element to the page.

在版本0.8和0.9之间,仅在首次安装脚本时进行处理..如果更改了所需脚本的列表,则需要卸载脚本并重新安装; Greasemonkey在安装一次后下载所需的脚本,然后使用缓存的副本.

Between version 0.8 and 0.9, @require is only processed when the script is first installed. If you change the list of required scripts, you need to uninstall your script and reinstall it; Greasemonkey downloads the required script once at installation and uses a cached copy thereafter.

从0.9开始,Greasemonkey的行为已更改(以解决与切向相关的问题与之相关的问题),现在,它会在每次编辑后加载所需的脚本;不再需要重新安装脚本.

As of 0.9, Greasemonkey behavior has changed (to address a tangentially related issue) so that it now loads the required scripts after every edit; reinstalling the script is no longer necessary.

这篇关于如何在Greasemonkey中使用jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆