更加方便的 Opera 代理按钮和菜单
注意:在 Opera 11 下部分命令可能失效,我近期将会改进。
你也可以自己动手在命令之间加上延迟:& Delay,1 。
已经改进,见:Opera 自动代理解决方案和代理菜单。
A.shun 这回对之前写过的 Opera 代理菜单和按钮进行较大的改进。
大大提高了实用性:占用地方小,不需要打开菜单就能显示当前代理端口,抛弃 Set preference 切换方式等。
这也是我写过的最长的按钮。。。代理设置作为条目较多的一项,用来练习按钮和菜单语法正好。
本文仅提供配置文件的修改方法,目的是为了探讨 Opera 按钮和菜单的技巧。仅供学习交流之用,不提供任何相关工具和网址。
这是对此功能的第二次改进了,建议订阅以获取后续更新内容。
预览和示意图
代理按钮和菜单的主要改进
- 硬生生的把之前的3个按钮揉成1个
很暴力的说,之前三个按钮的确是说不过去,好吧,我忏悔。这下在释放了工具栏空间的同时,也解决了以前按钮多让新手困惑的问题。 - 在启用代理时,为多种常见端口添加了特定的图标
以提高工具栏按钮风格的协调性。(默认可以显示10种状态,Pac+禁用+启用(7种端口+其他) - 去掉了在线 Pac 文件的条目。
由于 Opera10.5x 的一个 bug (无法识别base64编码过的 Pac 文件),加上appspot.com本身处于半墙状态,autoproxy2pac还经常出现 Over Quota。在线 pac 并不实际。老版本的 Opera 可以访问前文获取这个菜单条目。还是自己写 Pac 吧,写得好一个就够了。 - 精简了菜单上的条目,条目顺序及其他细节微调。
去掉了如不常用的:使用剪贴板代理、关闭所有代理工具,需要的话从前面的文章复制代码加上去吧。也去掉了在线代理条目,因为这类服务很难存活久,而且自己添加并不困难。
获得 Opera 代理按钮+菜单
添加 Opera 代理状态显示和开关按钮
将下面按钮直接拖到除个人栏外的任何工具栏。如果你要见识下这个按钮的长度就直接点击添加
。
单击启用/禁用代理,点击旁边的小箭头呼出快速代理菜单,显示多种代理状态(含对应端口)。
安装 Opera 快速切换代理菜单
在你的
菜单配置文件最后添加以下代码:
[Quick Proxy Menu]
Item, "开关 » Autoproxy"=New page,,,, "Extended Security" & Go to page, "opera:config" & Delay, 1 & Go to page, "javascript:(function(){var as=opera.getPreference('Proxy','Use Automatic Proxy Configuration');if(as==0){var as=1}else{var as=0}opera.setPreference('Proxy','Use Automatic Proxy Configuration',as);window.close()})();"
Submenu, "切换 » AutoProxy", Pac Menu="Show popup menu,,,, "Restart transfer""
Item, "[召唤 » Fgate ]"=Execute program,"fg的路径或快捷方式",,,"fg"
;Item, "[召唤 » FreeU ]"=Execute program,"fu的路径或快捷方式",,,"fu"
Item, "[召唤 » wujie ]"=Execute program,"wj的路径或快捷方式",,,"u"
Item, "[召唤 » GApp ]"=Execute program,"gapp的路径或快捷方式",,,"gap"
Item, "[召唤 » GTunnel]"=Execute program,"gt的路径或快捷方式",,,"gt"
Item, "[召唤 » Puff ]"=Execute program,"puff的路径或快捷方式",,,"puff"
Item, "[召唤 » Mr.Z ]"=Execute program,"Mr.zhang的路径或快捷方式",,,"Panel Contacts"
Item, "[召唤 » SSH-D ]"=Execute program,"myentunnel的路径或快捷方式" ,,,"p" & Execute program,"Privoxy/Polipo的快捷方式或启动脚本"
Item, "[召唤 » Tor ]"=Execute program,"tor的路径或快捷方式",,,"tor"
BreakItem
Item, "Setting » Proxy"=External action,,,,Menu Tools | show preferences & show proxy servers
Item, "Add To Exceptions"=External action,,,,Add widget | edit site preferences & delay, 10 & copy & Cancel & delay,1 & Disable proxy servers & Show preferences & Show proxy servers & Delay, 10 & Check item & Focus next widget & Focus next widget & Focus next widget & Check item & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Check item & Focus next widget & Go to end & Insert, "," & Paste & Ok & Delay, 10 & Cancel
Item, "---Fuck » GFW---"=Show popup menu
Item, "[ Fg/fu ] » 8580"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & ok & delay,10 & cancel
Item, "[ Wujie ] » 9666"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"9666" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"9666" & ok & delay,10 & cancel
Item, "[ GApp ] » 8000"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8000" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8000" & ok & delay,10 & cancel
Item, "[GTunnel] » 8081"="External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8081" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8081" & ok & delay,10 & cancel"
Item, "[ Puff ] » 1984"="External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"1984" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"1984" & ok & delay,10 & cancel"
Item, "[ Mr.Z ] » 1984"="External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"2010" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"2010" & ok & delay,10 & cancel"
Item, "[Tor/SSH] » 8118"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8118" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8118" & ok & delay,10 & cance
[Pac Menu]
Item, "[9666 » Wujie ]"=disable proxy servers,,,,"u" & Show preferences& Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
Item, "[8580 » Fg/Fu ]"=disable proxy servers ,,,,"fg" & Show preferences& Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
Item, "[8000 » Gapp ]"=disable proxy servers ,,,,"gap" & Show preferences& Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
Item, "[1984 » Puff ]"=disable proxy servers ,,,,"puff" &Show preferences& Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
Item, "[8081 »GTunnel]"=disable proxy servers ,,,,"gt" & Show preferences & Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
Item, "[8118 »SSH/Tor]"=disable proxy servers ,,,,"p" & Show preferences& Show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert,"本地pac1路径,绝对或相对均可" & focus next widget & Ok & Delay, 10 & Cancel
不懂编辑配置文件的,请访问:Opera 中文 wiki。
修改 Opera 皮肤,添加图标
下载这个图标包(13.6kb),把解压后的 proxy 文件夹放到你
当前使用的皮肤里面。
并编辑 skin.ini,在 [Image] 后面添加:
;Quick Proxy by A.shun u=proxy/u.png fg=proxy/fg.png tor=proxy/tor.png puff=proxy/puff.png gt=proxy/gt.png gap=proxy/gap.png fu=proxy/fu.png p=proxy/p.png mrz=proxy/mrz.png u_s=proxy/u_s.png fg_s=proxy/fg_s.png puff_s=proxy/puff_s.png gt_s=proxy/gt_s.png gap_s=proxy/gap_s.png p_s=proxy/p_s.png mrz_s=proxy/mrz_s.png
当然,如果你经常换皮肤,那么建议你修改 opera/skin 里的 standard_skin.zip。
注意事项
- 根据你计算机的实际情况,修改代码中所有的“xxx的路径或快捷方式”。如果需要“运行工具并启用相应的代理设置”的,请点击链接查看,并自行修改。
- 修改菜单时,要注意保存为 UTF-8格式,否则会乱码。在保存 menu 、skin 之前,要先关闭 Opera。
- 如果提示“此扩展名未注册应用程序”,那么请检查外部程序路径。
- 菜单条目比较多,这是为了照顾更多人的习惯,也是为了看起来更加壮观。实际上当然不用这么多。不需要的条目注释掉(在前面加分号)或者删掉该行即可。因此谢绝“太多了、花哨”之类评价。
» 转载请以超链接形式注明来源:A.shun Blog » 《更加方便的 Opera 代理按钮和菜单》
» 本文链接地址:http://www.a-shun.com/archives/21366.html



Hi Boss,
首先,非常感谢你的博文。我本来以为Opera做跨栏运动是个蠢驴 – -
我根据你的代码修改成了一个特别针对S-S*H的按钮。
但是我遇到问题了,请帮助我!
修改后的代码:
(为便于阅读,我保留了多行排版)
Disable proxy servers, , , “Disable AutoProxy”, “No Security”
> Go to page, “opera:config” & Delay, 1 & Go to page, “javascript:(function(){opera.setPreference(‘Proxy’,'Use HTTP’,1);opera.setPreference(‘Proxy’,'Use HTTPS’,1);window.close()})();”
> Set preference, “proxy|Use Automatic Proxy Configuration=1″, , “Automatic Mode”, “Extended Security”
> Go to page, “opera:config” & Delay, 1 & Go to page, “javascript:(function(){opera.setPreference(‘Proxy’,'Use HTTP’,1);opera.setPreference(‘Proxy’,'Use HTTPS’,1);window.close()})();”
> Set preference, “Proxy|HTTP server=127.0.0.1:8123″, , “SSH”, “proxy-ssh”
> Enable proxy servers, , , “Proxy Enabled”, “High Security Simple” + Show popup menu, “AutoProxy Menu”
Item, “Automatic Mode”=New page,,,, “Extended Security” & Go to page, “opera:config” & Delay, 1 & Go to page, “javascript:(function(){var as=opera.getPreference(‘Proxy’,'Use Automatic Proxy Configuration’);if(as==0){var as=1}else{var as=0}opera.setPreference(‘Proxy’,'Use Automatic Proxy Configuration’,as);window.close()})();”
Item, “SSH”=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,”127.0.0.1″ & focus next widget & insert,”8123″ & focus next widget & check item & focus next widget & insert,”127.0.0.1″ & focus next widget & insert,”8123″ & ok & delay,10 & cancel
疑问:
1、当使用SSH的时候,按钮变得很长很长(见图片http://cn.drop.io/q8m1ase),这是怎么回事?怎样解决?
2、代码“High Security Simple”是什么用途?
3、有没有不需要弹出设置框的办法?
再问个其他的问题:用什么办法隐藏p.o.l.i.p.o.的命令行窗口?
谢谢帮助!
@Michael
1.按钮变得很长很长,显示的是名称,也就是没有指定图标。
2.High Security Simple 就是那个图标- -
3.有,用Set命令,比如
Set preference, "Proxy|HTTP server=127.0.0.1:8123",,"SSH","High Security Simple"。4.p.o.l.i.p.o.,那个要用命令提示符的参数了,但隐藏了窗口要关闭只能结束进程吧,不是太了解
代码我还看,在折腾主题。。。你只用一个代理么?那没有必要写得这么复杂的。
@A.shun
现在主要就用那一个。
我今天才安装Opera,让我整出一个完美的确实太折腾了。
你可以写个s-s-h特别版吗?就三项功能:全局代理,自动代理和禁用代理。最好是不用弹出框的那种方法。
感激不尽!
@Michael 刚刚洗澡去了
。
我还是用老方法,因为set方式的话,在标签多的情况下会卡。而且虽然可以显示多状态,但若加上pac状态的话,伤脑筋。
按钮:
Proxy
菜单:
[AutoProxy Menu] Item, "运行 SSH-D"=Execute program,"SSh 客户端的路径" ,,,"Low Security" & Execute program,"polipo 的路径" Item, "开关 » Autoproxy"=New page,,,, "Extended Security" & Go to page, "opera:config" & Delay, 1 & Go to page, "javascript:(function(){var as=opera.getPreference('Proxy','Use Automatic Proxy Configuration');if(as==0){var as=1}else{var as=0}opera.setPreference('Proxy','Use Automatic Proxy Configuration',as);window.close()})();" --------------0 Item, "打开代理设置"="External action,,,,Menu Tools | show preferences & show proxy servers" Item, "端口设置为8123"="External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8123" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8123" & ok & delay,10 & cancel" Item, "添加到例外"=External action,,,,Add widget | edit site preferences & delay, 10 & copy & Cancel & delay,1 & Disable proxy servers & Show preferences & Show proxy servers & Delay, 10 & Check item & Focus next widget & Focus next widget & Focus next widget & Check item & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Focus next widget & Check item & Focus next widget & Go to end & Insert, "," & Paste & Ok & Delay, 10 & Cancel@A.shun
Thank you very much
Hi Boss,
请教一个有关皮肤的问题。
是不是皮肤图标必须打包成zip文档?
我只是想添加四个自定义图标(ico格式),有没有更简便的方法?
———-
补充一个应该出现在上一个回复的问题:
以下代码等号后面的引号(非命令参数)是可选的,还是分情况必须的?
Item, “打开代理设置”=”External action,,,,Menu Tools | show preferences & show proxy servers”
Best regards
@Michael 对,op的皮肤都是以zip格式存在的,o的皮肤相对复杂。。
图标支持png 以及动态的gif和apng(仅在工具栏和对话框会动)。
ico格式估计是不行。
等号后面如果加引号的话,那么最后面也要加一个引号,成对即可。在o里面添加按钮的话会默认加上引号的,如果自己编辑工具栏配置的话不加也可以。
另外,我最近有点忙,有什么问题到 oc 来吧,热情的朋友很多呢。
@A.shun
Thank you!
交流下:
myentunnel已经过时了,Bitvise Tunnelier更佳,我自己测试验证过。
ico文件可以被用于皮肤,我在状态栏的实验是可行的。
@Michael “myentunnel已经过时了,Bitvise Tunnelier更佳”
同意。不过我一般都只用着plink.exe,并不是每个版本都有bug的,而且就我的带宽来看,速度没啥差距。
200多k的小程序和o一起带着,方便
哦,ico可以啊,那挺好。
bug提交:
在由非代理模式向代理模式转换时,会关闭当前网页,且在“恢复已关闭标签页”按钮中无法恢复,请问A.shun兄有碰到过这种情况么?我使用的是win7的32位旗舰版,opera是10.70,OperaPortable便携版。
@蘧庐 首选项>高级>标签,取消勾选“重用当前标签页”。
太意外了,谢谢您这么快的回复!
我按照您的提示,取消勾选“重用当前标签页”,试了一下,还是会关闭,我只好在点击按钮之前,先新建一个标签页,以免把当前浏览页给关闭了又无法恢复。呵呵。这不是很严重的问题,只是有些麻烦,不过还是感谢A.shun兄的热心解答
@蘧庐 哈,刚刚好睡觉之前上来看看
取消勾选这个之后是不会的。因为新开的设置标签是自动在新标签打开的。
这太诡异了。
不过还有第二种解决方法。
就是在按钮命令的所有
Go to page, "opera:config"前面加上new page &相关工具栏配置文件的编辑这里不好解释,请看wiki或者到oc提问。
非常感谢!解决了!
其实您在第一次回复的方法就可以解决了。之所以先前没有成功,是因为我自作聪明,还是按没有修改设置前(取消勾选“重用当前标签页”)防止关闭当前浏览页而新建页面的方式点击,这样新建标签页就会被关闭。而我试着对非新建起始页进行操作,则界面上闪过一个新建标签页并且关闭,而当前页面则仍然存在,呵呵。
再次感谢A.shun兄,我常用代理,并且需要调入外部程序,您的博文对我太有帮助了,呵呵
此扩展名未注册应用程序是怎么回事呢
在线PAC还算稳定吧 http没被墙
@m 路径错了。
上面有说了:“如果提示“此扩展名未注册应用程序”,那么请检查外部程序路径。”
稳定,那是不可能的。gae有流量和资源限制。
你用过上面的代理或者第三方tw页面就知道了。
刚才那个回复不知道发成功了没有,再发一次orz
我看本地pac路径不能用相对的啊,比如 profile\optools\autoproxy.pac 这样填就不成,用不了~
@wuyunxian 恩,的确如此呢。又一个吐槽点。
更新OPERA11后代理切换失效了
@若想 在命令与命令之间加点延迟即可。
你先折腾看看。
我这几天忙,有空再更新下。
已解决了,加两个延迟就行了。谢谢!
用在OPERA11后代理切换失效,看了若想的加两个延迟,偶捣鼓了半天,无奈水平太低,实在是无法搞定。
@bbtg 你可以用采儿折腾的那个,相当好的说。
我打算在现有和他那个基础上再整理一下的,不过最近忙呀
采儿折腾的那个偶的Opera11用起来有些问题,偶见过的代理设置,Firefox里是AutoProxy最好;Opera里就是你这个最好。除了没有添加和删除代理网站的功能,你这个我看比AutoProxy还好一点,就是能直接启动代理软件。
@bbtg 那个有什么问题?欢迎指出以帮助我们改进
。
添加和删除代理网站感觉不是很有必要,有 pac 嘛。
还是达不到 AutoProxy 的水平啊,在自动代理方面- -
其实启动代理我一般不再 Opera 中进行,写上去只是让人知道 Opera 可以做到这个。
采儿那个偶还要重新配置一下才符合偶的习惯,而且在11里用会再打开一个opera11。如果不麻烦的话,请告诉偶在按钮的什么地方加2个延迟。
@bbtg
比如
Item, "[ Fg/fu ] » 8580"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & show proxy servers & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & ok & delay,10 & cancel改成
Item, "[ Fg/fu ] » 8580"=External action,,,,Panel Collapse Right | disable proxy servers & show preferences & Delay,1 & show proxy servers & Delay,1 & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & focus next widget & check item & focus next widget & insert,"127.0.0.1" & focus next widget & insert,"8580" & ok & delay,10 & cancel试试,可以的话其他也按照这个。
采儿的是窗口方式,我这是标签方式,各有优点,其实我还比较喜欢他那种。
过几天我会重新整理好,同时提供窗口和标签方式。
切换全局代理没问题,自动代理还是切换不过去,点击后是关闭代理的状态。非常感谢你的回复。
@bbtg 试试这个
Item, "开关 » Autoproxy"=New page,,,, "Extended Security" & Delay, 1 & Go to page, "opera:config" & Delay, 1 & Go to page, "javascript:(function(){var as=opera.getPreference('Proxy','Use Automatic Proxy Configuration');if(as==0){var as=1}else{var as=0}opera.setPreference('Proxy','Use Automatic Proxy Configuration',as);window.close()})();"hh,难得遇到你在线上,偶试了你的新开关,切换自动代理还是老样子。真是麻烦你了。偶装得的白菜版1190,不知是否有关系。
@bbtg 不是定制版的原因。是我的命令没有在 11 下测试过,只是大概估计的修改。
现在还用着 10.70 呢。
最近有升级到 11.01 的打算了~
a.shun兄好!啥时候把代理设置挪到新版本上去呢?一直没升级11版,就是因为代理方面的原因,呵呵。
@蘧庐 早就挪呐,Opera 自动代理解决方案和代理菜单
添加Privoxy时出现如下错误提示:—————————
Privoxy Error
—————————
Jun 08 15:46:40 Privoxy(00061400) Fatal error: can’t check configuration file ‘config.txt’: (error number 2)
—————————
确定
—————————
怎么办啊。我觉得我快配置好了,可是怎么也弄不对呀。求助!远程。
看看先谢谢楼主
为什么用你上面提供 的pac文件,切换到“启动自动代理”打不开相应的页面,但切换到“全局代理”就可以翻墙了。
我添加相应的网址到pac文件了,但就是在自动代理模式下打不开。
是不是这个pac格式不适合我的opera版本啊?我的是opera 11.50.
麻烦您回答一下
支持10.10.1893吗,可以请博主电邮一下,谢谢~