greasemonkey_Firefox中Greasemonkey用户脚本的初学者指南

greasemonkey

greasemonkey

Everybody knows that Firefox has add-ons for virtually everything, but if you don’t want to bloat your installation you’ve always got the option of Greasemonkey scripts instead. Here’s a quick primer on how to use them.

每个人都知道Firefox几乎可以包含所有内容的附件,但是如果您不想膨胀安装,则始终可以选择Greasemonkey脚本。 这是如何使用它们的快速入门。

Getting Started with User Scripts

用户脚本入门

Once you have Greasemonkey installed, managing the extension is really easy. Left click on the status bar icon to turn the extension on/off and right click to access the context menu shown here.

一旦安装了Greasemonkey,就很容易管理扩展。 左键单击状态栏图标以打开/关闭扩展名,右键单击以访问此处显示的上下文菜单。

greasemonkey-01

Whether you use the Options button in the Add-ons Manager Window or the context menu shown above, both will bring up the Manage User Scripts dialog. At the moment you have a nice clean slate to work with… time to get some scripts added in.

无论您使用“附件管理器”窗口中的“选项”按钮还是上面显示的上下文菜单,两者都将弹出“管理用户脚本”对话框。 目前,您的工作情况不错,可以添加一些脚本。

greasemonkey-02

The majority of user scripts can be found at two different sites, the first being appropriately named userscripts.org, and you can either browse by tag or search for a script.

大多数用户脚本可以在两个不同的站点上找到,第一个站点的名称适当地为userscripts.org,您可以按标记浏览或搜索脚本。

greasemonkey-03

As you can see here your search for a particular type of script can be quickly narrowed down based on category. There is definitely a lot to choose from.

如您所见,可以根据类别快速缩小对特定类型脚本的搜索范围。 绝对有很多选择。

greasemonkey-04

For our example we focused on the “textarea” tag. There were 62 scripts available but we quickly found what we were looking for on the first page.

对于我们的示例,我们重点关注“ textarea”标签。 有62个可用的脚本,但我们很快在第一页上找到了所需的内容。

greasemonkey-05

Installing, Managing, & Using Your Scripts

安装,管理和使用脚本

When you find a script that you want to install visit the script’s homepage and click on the “Install” button.

当您找到要安装的脚本时,请访问该脚本的主页,然后单击“安装”按钮。

Note: Link for this script provided below.

注意:下面提供了此脚本的链接。

greasemonkey-06

Once you have clicked on the Install button, Greasemonkey will open up the following installation window. You will be able to view:

单击“安装”按钮后,Greasemonkey将打开以下安装窗口。 您将能够查看:

  • A summary of what the script does

    脚本功能摘要
  • A list of websites that the script is supposed to function on (our example is set for all)

    该脚本应在其上运行的网站列表(我们的示例已针对所有网站设置)
  • View the script source if desired

    如果需要,查看脚本源
  • Make a final decision on whether to install the script or cancel the process

    关于是否要安装脚本或取消该过程做出最终决定
greasemonkey-07

Right-clicking on our status bar icon shows our new script listed and active.

右键单击状态栏图标可显示列出的新脚本并处于活动状态。

greasemonkey-08

Reopening the Manage User Scripts window shows:

重新打开“管理用户脚本”窗口,显示:

  • Our new script listed in the column on the left

    我们的新脚本在左侧列中列出
  • The websites/pages included

    包含的网站/页面
  • An option to disable the script (can also be done in the context menu)

    禁用脚本的选项(也可以在上下文菜单中完成)
  • The ability to edit the script

    编辑脚本的能力
  • The ability to uninstall the script

    卸载脚本的能力
greasemonkey-09

If you choose to edit the script you will be asked to browse for and select a default text editor of your choice (first time only). Once you have selected a text editor you can make any changes desired to the script.

如果您选择编辑脚本,将要求您浏览并选择一个默认的文本编辑器(仅限第一次)。 选择文本编辑器后,您可以对脚本进行所需的任何更改。

greasemonkey-10

We decided to test our new user script on the site. Going to the comment box at the bottom we could easily resize the window as desired.

我们决定在站点上测试我们的新用户脚本。 转到底部的评论框,我们可以轻松地根据需要调整窗口的大小。

greasemonkey-11

The Comment box definitely got a lot bigger.

评论框肯定更大了。

greasemonkey-12

Conclusion

结论

If you prefer to keep the number of extensions to a minimum in your Firefox installation then Greasemonkey and the Userscripts website can easily provide that extra functionality without the bloat. For added auto website script detection goodness see our article on Greasefire.

如果您希望在Firefox安装中将扩展名的数量保持在最低水平,那么Greasemonkey和Userscripts网站可以轻松提供该额外功能,而不会引起麻烦。 有关自动网站脚本检测的更多信息,请参阅有关Greasefire的文章。

Note: See our article here for specialized How-To Geek User Style Scripts that can be added to Greasemonkey.

注意: 有关可添加到Greasemonkey的专门的How-To Geek用户样式脚本, 请参见 此处 的文章

Links

链接

Download the Greasemonkey Extension (Mozilla Add-ons)

下载Greasemonkey扩展(Mozilla附加组件)

Install the Textarea & Input Resize User Script

安装Textarea和输入调整大小的用户脚本

Visit the Userscripts.org Website

访问Userscripts.org网站

Visit the Userstyles.org Website

访问Userstyles.org网站

翻译自: https://www.howtogeek.com/howto/16470/replace-extensions-with-user-scripts-in-firefox/

greasemonkey

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值