更新chrome中的greasemonkey脚本而不重新安装? [英] Update a greasemonkey script in chrome without reinstalling?

查看:673
本文介绍了更新chrome中的greasemonkey脚本而不重新安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只希望能够保存,刷新页面,并使我的更改显示为与Firefox中的相同。



有什么想法?

解决方案

是的,有一种方法可以做到这一点。使用从这个辉煌的答案(^ _ ^),您可以编辑脚本 - 只需点击重新加载链接即可使更改生效。



此方法有额外的奖励Chrome的扩展程序文件夹 1 不会混淆无法辨认的文件夹和文件名,并且您可以轻松找到想要调整的脚本。



以下是设置工作环境的方法,以便轻松更新脚本:
$ b


  1. 创建一个对您来说很方便的目录,而 EM> 1 。例如,创建: C:\ MyChromeScripts \

    这将是所有脚本将来驻留的位置。


  2. 为每个脚本创建自己的子目录。例如, Script_1 Script_2 等。


  3. 每个子目录都应包含其脚本,EG MyScript1.user.js 以及该脚本使用的所有文件。


  4. 现在为了秘密......您还必须在该子目录中创建一个清单文件,并且必须命名为: manifest.json 。 p>

    样本内容至少为:

      {
    manifest_version:2,
    content_scripts:[{
    exclude_globs:[],
    include_globs:[*],
    js:[ MyScript1.user.js],
    matches:[https://stackoverflow.com/*,
    https://stackoverflow.com/*
    ]
    }],
    description:此脚本执行X,Y和Z.,
    name:我的脚本编号1,
    version: 1
    }

    现在,在Chrome的扩展程序管理器(URL = chrome:// extensions / )中,展开

  5. em>开发者模式

    单击 加载未打包的扩展名 按钮。
  6. 对于该文件夹,粘贴到您的脚本的文件夹中,例如:

    C:\MyChromeScripts\Script_1


  7. 您的脚本将被安装并运行。

  8. 现在,当您保存对* .js文件的任何更改时,请点击 重新加载 链接,以便立即生效。
  9. Enjoy!








1 extensions文件夹默认为:

 
Windows XP:
C:\ Documents and Settings \ *** {用户名} *** \ Local Settings \Application Data\Google\Chrome\User Data\Default

Windows Vista:
C:\ Users \ *** {用户名} *** \AppData\Local\Google\Chrome\User Data\Default

Windows 7:
C:\ Users \ *** {用户名} *** \AppData\Local\Google\Chrome\User Data\Default

尽管您可以通过使用 - user-data-dir = 运行Chrome来更改它,选项。


I just want to be able to save, refresh the page, and have my changes show up like I do in Firefox. Having to drag it over and install it every time gets annoying.

Any ideas?

解决方案

Yes, there is a way to do this. Using the method adopted from this brilliant answer (^_^), you can edit scripts -- in place -- and just hit a "Reload" link for the changes to take effect.

This method has the added bonus that Chrome's Extensions folder1 doesn't get cluttered with indecipherable folder and file names, and you can easily find the script you want to tweak.

Here's how to set up your work environment to allow easy script updating:

  1. Create a directory that's convenient to you, and not where Chrome normally looks for extensions1.   For example, Create: C:\MyChromeScripts\.
    This will be where all your scripts will reside in the future.

  2. For each script create its own subdirectory.   For example, Script_1, Script_2, etc.

  3. Each subdirectory should contain its script, EG MyScript1.user.js, and any files used by that script.

  4. Now for the secret sauce... You must also create a manifest file in that subdirectory, and it must be named: manifest.json.

    Sample contents, at a minimum:

    {
        "manifest_version": 2,
        "content_scripts": [ {
            "exclude_globs":    [  ],
            "include_globs":    [ "*" ],
            "js":               [ "MyScript1.user.js" ],
            "matches":          [   "https://stackoverflow.com/*",
                                    "https://stackoverflow.com/*"
                                ]
        } ],
        "description":  "This script does X, Y, and Z.",
        "name":         "My script number 1",
        "version":      "1"
    }
    


  5. Now, in Chrome's Extension manager (URL = chrome://extensions/), Expand Developer mode.

  6. Click the Load unpacked extension... button.

  7. For the folder, paste in the folder for your script, For example:
    C:\MyChromeScripts\Script_1.

  8. Your script will be installed and operational.

  9. Keep the Extensions page open. Now, when you save any changes to your *.js file, Hit the Reload link for them to take effect immediately.

  10. Enjoy!



1 The extensions folder defaults to:

Windows XP:
C:\Documents and Settings\***{username}***\Local Settings\Application Data\Google\Chrome\User Data\Default

Windows Vista:
C:\Users\***{username}***\AppData\Local\Google\Chrome\User Data\Default

Windows 7:
C:\Users\***{username}***\AppData\Local\Google\Chrome\User Data\Default

Although you can change it by running Chrome with the --user-data-dir= option.

这篇关于更新chrome中的greasemonkey脚本而不重新安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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