可以将一个greasemonkey类型的用户脚本打包为Chrome扩展吗? [英] Can a greasemonkey-type userscript be packaged as a Chrome extension?

查看:149
本文介绍了可以将一个greasemonkey类型的用户脚本打包为Chrome扩展吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,Google 。



Today Google changed the way userscripts are installed in Chrome. No longer can you just click on a link that contains one, confirm a couple dialog boxes and have it installed. Now you have to download the script with Save As..., open the Finder/Explorer window that contains it, open the Extensions window in Chrome, then drag the script to the extensions window. IOW, a big PITA.

Presumably the alternative is to package as a Chrome extension and get it on the Chrome webstore. However, I can't find any information anywhere that suggests you can package a userscript as an extension. Is this possible? If yes, any new limitations, links to docs, or other tips?

解决方案

Two things first:

  1. This new behavior of Chrome seems too restricting and draconian for userscripts. If you agree, please make your displeasure known to Google. (Userscripts are not quite as dangerous, or powerful, as full-fledged extensions.)

  2. Rather than trying to package extensions (which seems like a low benefit-to-hassle activity), Chrome provides two mechanisms to (selectively) disable this new annoyance:

    1. Configure Chrome to start with the --enable-easy-off-store-extension-install parameter.

    2. Add configuration keys to allow installations from specific sites:
      For example, add this entry to the Windows registry:

      Software\Policies\Google\Chrome\ExtensionInstallSources\1 = "http://userscripts.org/*"
      

      To allow easy installation from that useful script clearinghouse.



Packaging a userscript as an extension (Verified on the latest release, version 20.0.1132.57 and subject to change):

  1. Create a script folder and a manifest for your userscript, as in the "Controlling the Script and name" section of this answer.

  2. From the Chrome Extensions page, activate Developer mode:

  3. Click Pack Extension.

  4. Enter the folder path, created in step 1, and click Pack Extension:

  5. Note that the new extension file (HelloWorld.crx) and key file (HelloWorld.pem) are created in the parent directory (C:\MyChromeScripts\).

  6. Now the extension can be installed like any other, or uploaded to the Chrome Web Store.

这篇关于可以将一个greasemonkey类型的用户脚本打包为Chrome扩展吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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