|
阅读:3662回复:5
有没有什么办法弄一个按钮一键切换“在新标签页中打开”?
老婆问的,老婆是触摸屏,没有中键,另外按Ctrl(对链接)和Alt(对地址栏)都不方便,想问问有没有像Maxthon一样有一个“在新标签页中打开”的切换键?
因为这牵涉到几个键值,好像用CustomButtoms²可以做到吧? |
|
|
|
1楼#
发布于:2008-11-09 21:12
默认点击链接是在当前页中打开吧,可以试试鼠标手势的扩展实现左右键同时按下时候在新标签页打开链接吧!
PS:真老婆还是假老婆(指女朋友)? |
|
|
|
2楼#
发布于:2008-11-09 21:12
Tab Mix Lite CE中可以设定默认在新标签页中打开。
|
|
|
3楼#
发布于:2008-11-09 21:12
fang5566:默认点击链接是在当前页中打开吧,可以试试鼠标手势的扩展实现左右键同时按下时候在新标签页打开链接吧! 真老婆啦 我还真没发现Tab Mix Plus里面有一个选项,可以强制把任何左键点击的链接都在新标签页中打开的(不管是同站点的还是他站点的,除了JS链接)。其实这个切换很有必要,比方说有时在论坛读多个帖子的时候需要点链接在后台新标签页打开,有时又只是看一两个帖子,情愿一进一出也不想关闭很多个页面,这时就需要在当前页打开。 晕,我找到了这个选项:强制在新窗口打开==>All links (lock all tabs),不过它的实现还真的是很cruel:锁定所有标签页,这样就强迫所有的链接在新窗口打开了。 |
|
|
|
4楼#
发布于:2008-11-09 21:12
祝kmc夫妻生活愉快。
|
|
|
5楼#
发布于:2008-11-09 21:12
谢谢楼上的:)
我已经用customebuttons²实现了这个功能,下面是代码(写在Initialization code里面) /*====================================================================*/
/* START OF AREA NEEDING EDITING */
// NAME OF YOUR BUTTON (DO NOT REMOVE QUOTES)
var name = 'Toggle force new tab';
// PREFERENCE TO TOGGLE (DO NOT REMOVE QUOTES)
var preF = 'extensions.tabmix.speLink';
// PLACE VALUES FOR YOUR PREF HERE, (NO QUOTES NECESSARY)
// BOOLEAN VALUES ARE TRUE/FALSE
// INTEGER VALUES CAN BE ANY NUMBERS FOR TOGGLING BETWEEN
var on = 1;
var off = 2;
// do NOT edit the next two lines
this.pref=preF;
this.setState=function(){
// end do NOT edit these two lines
// COMMENT OUT THE KIND OF PREFERENCE THIS IS NOT!
var state=this.PS.getBoolPref(this.pref); // BOOLEAN
//var state=this.PS.getIntPref(this.pref); // INTEGER
/* END OF AREA NEEDING EDITING */
/*====================================================================*/
if (state==off){
this.checked=false;
}else{
this.checked=true;
}
}
// TOGGLE FUNCTION FOR CHECK/UNCHECK
this.leftclick = function(evt){
var prefValue = custombuttons.getPrefs(preF);
if (prefValue == off) { custombuttons.setPrefs(preF,on); this.checked=false; }
else { custombuttons.setPrefs(preF,off); this.checked=true; }
}
this.setAttribute('onclick', 'gQuot( event, this )'); // Calls the Global MouseClick handler gQuot
// OBSERVES STATE OF PREFERENCE
this.PS=
Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
this.ob={};
this.ob.observe=this.setState.bind(this);
this.PS.addObserver(this.pref,this.ob,false);
this.setState();
this.setAttribute('preference',preF);
// BUTTON ATTRIBUTES
this.setAttribute("author",'nicholas'); // Stores Author.
this.setAttribute("version",'20080306.00'); // Stores Version.
this.setAttribute("homepage", // Stores Homepage.
"http://custombuttons2.com/forum/viewtopic.php?f=35&t=" +
"517");
this.setAttribute("dependency",'FF 2.0.*,CB 2.0.*'); // Stores Dependency.
this.setAttribute("status",'Complete'); // Stores Devstatus.
this.setAttribute("public",true); // Stores Public.
// MAKES THIS A CHECKBOX BUTTON
if ((!name) || (!preF)) {
var err = "You must edit the Checkbox Preference Toggler Button with the correct values before you may use it";
this.setAttribute("oncommand",
"alert('" + err + "'); " +
"this.disabled = true; " +
"this.style.opacity = '.25';"
);
return;
} else {
this.setAttribute("label",name);
this.setAttribute("class","checkbox-check")
this.setAttribute("btntype", "check");
this.tooltipText = "Toggle " + name;
this.setAttribute("style", "list-style-image: none !important; margin-bottom: 2px; margin-left: 4px; margin-right: 4px; margin-top: 2px; padding-bottom: 1px; padding-left: 4px; padding-right: 2px; padding-top: 1px; -moz-appearance: checkbox-container; -moz-box-align: center; -moz-binding: url(chrome://global/content/bindings/checkbox.xml#checkbox); -moz-box-orient: horizontal;");
}
完整的代码在附件中,只要复制全部然后粘贴到地址栏打开即可提示是否添加按钮。 |
|
|
