【问题标题】:Is there a way to customize Firebug's keyboard shortcuts?有没有办法自定义 Firebug 的键盘快捷键?
【发布时间】:2008-11-06 07:56:12
【问题描述】:

有没有办法自定义 Firebug 的键盘快捷键?我喜欢能够使用 Firebug 的 Script 面板单步执行 JavaScript 代码,但看起来我仅限于使用默认键盘快捷键来单步执行/进入/退出代码或使用鼠标单击相应的按钮。

我错过了什么吗?

在 Firefox/Firebug 中是否有一些秘密的 about:config hack 可以帮助我?

【问题讨论】:

    标签: debugging firefox keyboard-shortcuts firebug


    【解决方案1】:

    您可以手动更改它们。进入这个目录:

    在最近的版本中,扩展名包含在一个扩展名为 XPI 的文件中。只需将其重命名为 ZIP,创建一个目录并将其内容提取到其中。

    Linux:

    .mozilla/firefox/*****.default/extensions/firebug@software.joehewitt.com/ 
    

    窗户:

    %APPDATA%\Mozilla\Firefox\Profiles\<profile>\extensions\firebug@software.joehewitt.com\
    

    然后修改这个文件(这些是我的重映射设置):

    content/firebug/debugger/script/scriptPanel.js(Firebug 2.0)

        this.keyListeners =
        [
            chrome.keyCodeListen("F5", Events.isShift, Obj.bind(this.rerun, this, context), true),
            chrome.keyCodeListen("F5", null, Obj.bind(this.resume, this, context), true),
            chrome.keyCodeListen("F6", null, Obj.bind(this.stepOver, this, context), true),
            chrome.keyCodeListen("F7", null, Obj.bind(this.stepInto, this, context)),
            chrome.keyCodeListen("F8", null, Obj.bind(this.stepOut, this, context))
        ];
    

    content/firebug/js/scriptPanel.js(Firebug 2.0 之前)

        this.keyListeners =
        [
            chrome.keyCodeListen("F5", null, Obj.bind(this.resume, this, context), true),
            chrome.keyListen("/", Events.isControl, Obj.bind(this.resume, this, context)),
            chrome.keyCodeListen("F6", null, Obj.bind(this.stepOver, this, context), true),
            chrome.keyListen("'", Events.isControl, Obj.bind(this.stepOver, this, context)),
            chrome.keyCodeListen("F7", null, Obj.bind(this.stepInto, this, context)),
            chrome.keyListen(";", Events.isControl, Obj.bind(this.stepInto, this, context)),
            chrome.keyCodeListen("F8", null, Obj.bind(this.stepOut, this, context)),
            chrome.keyListen(",", Events.isControlShift, Obj.bind(this.stepOut, this, context))
        ];
    

    在 2.0 之前的版本中,您还应该更改本地化文件,因此工具提示应该是正确的键:

    locale/en-US/firebug.properties

    firebug.Continue=Continue (F5)
    firebug.StepOver=Step Over (F6)
    firebug.StepInto=Step Into (F7)
    firebug.StepOut=Step Out (F8)
    

    仅此而已。不幸的是,每次更新 Firebug 时都必须这样做。虽然已经有request to allow their customization directly within Firebug。

    【讨论】:

    • 不客气!我认为更新旧答案很重要。
    【解决方案2】:

    如他们的discussion forum 中所述,您可以尝试keyconfig...否则,它是known bug/limitation。

    【讨论】:

      【解决方案3】:

      正如@VonC 所提到的,这方面有一张公开的票。根据我的经验,keyconfig 不适用于此目的。我做了write a patch,它允许在 about:config 中自定义调试器执行控制键。如果您不想等待它被上游接受,和/或您不想自己构建它,我还发布了一个带有此修复的 XPI。

      【讨论】:

        【解决方案4】:

        另一种选择是在文件中手动配置快捷方式

        %APPDATA%\Mozilla\Firefox\Profiles\<profile>\extensions\firebug@software.joehewitt.com\content\firebug\browserOverlay.xul
        

        例如,我通过注释相应部分删除了 F12 上的快捷方式,因为它与 Tab Mix Plus 的 Undo Closed Tab 快捷方式冲突。

        缺点:Firebug 的更新会覆盖修改后的配置。

        【讨论】:

          【解决方案5】:

          虽然change the shortcuts within Firebug's source code 是可能的,但还有一种方法可以为这些操作添加不同的键,而无需接触源。

          为此,您必须安装一个扩展程序,它允许您定义自定义快捷方式,例如Dorando keyconfig。

          为该扩展程序执行的步骤:

          1. 转到插件管理器。
          2. 点击扩展旁边的选项按钮打开自定义对话框。
          3. 单击添加新密钥按钮打开密钥编辑器。
          4. 给快捷方式一个合适的名称
          5. 将code related to the action* 粘贴到代码字段中。
          6. 点击确定
          7. 点击进入快捷方式字段
          8. 通过按键盘上的键添加自定义快捷方式
          9. 点击应用按钮

          截图说明:

          * 那是oncommand 属性的值。因此,如果要添加恢复 JavaScript 执行的快捷方式,则需要从 cmd_firebug_resumeExecution 命令中复制 Firebug.Debugger.resume(Firebug.currentContext)。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-07-03
            • 2012-08-28
            • 2012-05-07
            • 2017-02-19
            • 1970-01-01
            • 2012-07-16
            • 1970-01-01
            • 2012-02-14
            相关资源
            最近更新 更多