本站不兼容 8 以前的版本的 Interner Explorer 浏览器(或基于这些版本的 IE 的其他浏览器),并且页面样式不完全兼容 IE 8,我们建议你升级至 IE 9 或改用其他非 IE 浏览器

Mozest™

  • 正在加载用户菜单…

开放、分享、互助

转播到腾讯微博
返回列表 回复 发帖

[推荐] 用鼠标手势切换autoproxy

是我原创的,我在用了这么长时间后,感觉实在很好,推荐给各位

首先安装dragit扩展

然后修改about:config,autoproxy快捷键(ctrl+alt+a冲突,所以没用),我改的是ctrl+alt+7,重启生效

再添加firegestures脚本

var evt = document.createEvent("KeyEvents");
evt.initKeyEvent(
  "keypress",
  true,
  true,
  null,
  true,  // holds Ctrl key
  true,  // holds Alt key
  false,  // holds Shift key
  false,  // holds Meta key
  evt.DOM_VK_G,  // presses a special key, @see http://mxr.mozilla.org/mozilla/source/dom/public/idl/events/nsIDOMKeyEvent.idl
  "G".charCodeAt(0)  // presses a normal key, e.g. "A".charCodeAt(0),
);
document.documentElement.dispatchEvent(evt);

为ctrl+alt+7和ctrl+alt+G分别添加两个

然后到了dragit,这也是个手势插件,你可以用它启动外部程序,这次我们需要它的原因是设一个与ctrl+alt+G一模一样的手势,动作是刷新页面

明白了吗

我使用手势,autoproxy改为全局状态,同时,页面刷新了!

hoho
本帖最后由 nightson 于 2012-1-17 23:18 编辑

太麻烦了,fg直接:
  1. document.getElementById("aup-command-modeglobal").doCommand();
  2. BrowserReload();
复制代码
1

评分次数

  • bugmenot1

本帖最后由 bugmenot1 于 2012-1-18 08:34 编辑

原来是我复制中出错吧,昨晚贴上去提示代码出错,非常棒的代码
2# nightson
这是切换至global模式的代码,如果要切换回自动模式,不知道代码应该怎么写?
本帖最后由 bugmenot1 于 2012-1-18 08:35 编辑

document.getElementById("aup-command-modeauto").doCommand();
BrowserReload();
我是根本不懂代码的,这段代码该如何使用呢
bugmenot1 发表于 2012-1-17 22:35
直接当手势脚本用...
2# nightson
这是切换至global模式的代码,如果要切换回自动模式,不知道代码应该怎么写?
xindeshenhua 发表于 2012-1-18 00:08
aup-command-modeglobal改成aup-key-modeauto就行了
6# nightson
多谢
现在都用的什么ssh软件?

RE: 用鼠标手势切换autoproxy

6# nightson 高手 请教下js代码
由于不会js,就中文表达了

                 if(开启中==检查(状态))
                {
                        关闭;
                }
                else
                {
                    开启;
                }
2# nightson

请教,切换到禁用模式又该如何修改呢?
本帖最后由 nightson 于 2012-2-11 14:18 编辑
  1. (function (){
  2.     var button = document.getElementById("aup-toolbarbutton");
  3.     var status = button.getAttribute("proxyMode");
  4.     switch (status){
  5.         case "auto":
  6.             document.getElementById("aup-command-modeglobal").doCommand();
  7.             BrowserReload();
  8.             break;
  9.         case "global":
  10.             document.getElementById("aup-command-modedisabled").doCommand();
  11.             BrowserReload();
  12.             break;
  13.         case "disabled":
  14.             document.getElementById("aup-command-modeauto").doCommand();
  15.             BrowserReload();
  16.             break;
  17.     }
  18. })();
复制代码
自动-->全局-->禁用-->自动
跟对着按钮点中键的切换顺序一样
11# nightson 真是太棒了,正需要这个,谢谢nightson。测试有效,切换autoproxy并刷新网页。

写个pac不是更简单。
11# nightson
好。非常感谢。
(function (){
    var button = document.getElementById("aup-toolbarbutton");
    var status = button.getAttribute("proxyMode");
    switch (status){
        case "auto":
            document.getEleme ...
nightson 发表于 2012-2-11 14:11
非常牛逼,请教下只想切换   自动/全局  怎么办,
不懂代码 -_-|||  麻烦您了
同求
很不错,谢谢分享