【问题标题】:Lose focus on Embededd/Flash element/tab in Firefox不再关注 Firefox 中的嵌入式/Flash 元素/选项卡
【发布时间】:2011-03-20 16:23:27
【问题描述】:

没有AutoHotkey and Firefox -unfocus,因为它涉及操作另一个程序并且它在Linux上不起作用,没有Restore Window Focus After Flash插件,因为它不能让你控制Flash标签。

有没有人成功实现这个gBrowser.selectedTab.unfocus(); 方法并将其绑定到Firefox v3.6 中的按键?

我也试过(基于上面的插件)

if (document.getElementsByTagName("EMBED").length == 0) {
  return;
}

if (document.activeElement.tagName == "EMBED") {
      document.activeElement.blur();
}
return;

但它不起作用。

还试过这个JS代码绑定到一个按键:

var file = Components.classes["@mozilla.org/file/local;1"].
  createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes["@mozilla.org/process/util;1"].
  createInstance(Components.interfaces.nsIProcess);
var args = ["-unfocus"];
file.initWithPath("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
process.init(file);
process.run(false, args, args.length);

还是不行。

【问题讨论】:

    标签: javascript flash firefox focus keystroke


    【解决方案1】:

    您好,我是 unfocus 扩展的作者。

    一般我现在不能简单地将 Firefox 中的击键绑定到 unfocus 插件,因为 Firefox 没有焦点。插件具有全键盘焦点,因此您必须使用外部应用程序解除插件焦点。 这就是创建此类扩展的原因。这是实现最简单的唯一方法。

    我运行 linux 并且我所知道的几乎每个窗口管理器都支持与命令的键绑定。 AutoHotkey 只是在 Windows 上实现此目的的方法之一。正因为如此,我一直认为这个扩展对于 Linux/BSD 人群来说要简单得多。

    将击键绑定到firefox -unfocus 命令。

    如果你使用 metacity(gnome 的默认 WM):

    gconf-editor -> / -> apps -> metacity -> global_keybindings and keybinding_commands
    

    如果你使用kwin(kde):

    http://maketecheasier.com/configure-custom-shortcuts-in-kde/2009/09/28

    novell.com/coolsolutions/qna/11619.html

    如果你使用 xfwm (xfce):

    Keyboard Settings -> Shortcuts

    如果你使用 openbox (lxde):

    http://urukrama.wordpress.com/openbox-guide/#Key_mouse

    注意,我没有使用前面提到的WM-s和DE-s,我只是搜索了一下。 如果您使用平铺 wm,您应该已经知道如何绑定按键。

    【讨论】:

      猜你喜欢
      • 2013-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多