阅读:2860回复:6
求FF6能用的 open url in new tab uc.js
如题。谢谢
|
|
1楼#
发布于:2011-08-30 11:43
(function() { /*open bookmark/history in new tab */ try { eval("whereToOpenLink = " + whereToOpenLink.toString().replace( /var shift/,"var Class=e.target.getAttribute('class'); try " +"{ if (Class=='') Class=e.target.parentNode.getAttribute('" +"class');} catch(e) {} Browser=getTopWin().document.getEle" +"mentById('content'); if ((!IsBlankPage(Browser.currentURI" +".spec)|| Browser.webProgress.isLoadingDocument) && Class " +"&& (Class=='sidebar-placesTreechildren'||Class=='placesTr" +"ee'||Class.indexOf('bookmark-item')>=0)) return 'tab'; $&" )); }catch(e){} /*open url in new tab */ try { var new_str = '_LoadURL(aTriggeringEvent, '; var old_str = /if \(aTriggeringEvent instanceof MouseEvent\) {/; try { // firefox 3.0.* eval("BrowserLoadURL = "+ BrowserLoadURL.toString().replace( old_str, new_str+' aPostData); return; $&')); } catch(e) { // firefox 3.1+ var urlbar = document.getElementById("urlbar"); eval("urlbar.handleCommand="+ urlbar.handleCommand.toString( ).replace(old_str, new_str+' postData); return; $&')); } }catch(e){} })(); function _LoadURL(aTriggeringEvent, aPostData) { var where = (gBrowser.currentURI.spec!='about:blank' || gBrowser.webProgress.isLoadingDocument) ? 'tab' : 'current'; if (gURLBar.value!='') openUILinkIn(gURLBar.value, where); return true; } function IsBlankPage(url) { return url=="" || url=="about:blank" || url=="about:home"; } |
|
2楼#
发布于:2011-08-30 11:43
貌似这个脚本在6.0下,地址栏输入URL不能在新标签页打开
|
|
3楼#
发布于:2011-08-30 11:43
uc脚本的代码
// ==UserScript== // @name open_in_new_tab // @description Open in new tab // @compatibility Firefox 3.0+ // @author GOLF-AT // @version 1.5.20101229 (function() { /*open bookmark/history in new tab */ try { eval("whereToOpenLink = " + whereToOpenLink.toString().replace( /var shift/,"var Class=e.target.getAttribute('class'); try " +"{ if (Class=='') Class=e.target.parentNode.getAttribute('" +"class');} catch(e) {} Browser=getTopWin().document.getEle" +"mentById('content'); if ((Browser.currentURI.spec!='about" +":blank'||Browser.webProgress.isLoadingDocument) && Class " +"&& (Class=='sidebar-placesTreechildren'||Class=='placesTr" +"ee'||Class.indexOf('bookmark-item')>=0)) return 'tab'; $&" )); }catch(e){} /*open url in new tab */ try { var new_str = '_LoadURL(aTriggeringEvent, '; var old_str = /if \(aTriggeringEvent instanceof MouseEvent\) {/; try { // firefox 3.0.* eval("BrowserLoadURL = "+ BrowserLoadURL.toString().replace( old_str, new_str+' aPostData); return; $&')); } catch(e) { // firefox 3.1+ var urlbar = document.getElementById("urlbar"); eval("urlbar.handleCommand="+ urlbar.handleCommand.toString( ).replace(old_str, new_str+' postData); return; $&')); } }catch(e){} /*open home in new tab */ try { eval("BrowserGoHome = " + BrowserGoHome.toString().replace( /switch \(where\) {/, "where = (gBrowser.currentURI.spec!=" +"'about:blank' || gBrowser.webProgress.isLoadingDocument"+ ") ? 'tab' : 'current'; $&")); }catch(e){} /*open search in new tab */ try { var searchbar = document.getElementById("searchbar"); eval("searchbar.handleSearchCommand="+searchbar.handleSearchCommand. toString().replace(/this.doSearch\(textValue, where\);/, "if (!gBrowser.webProgress.isLoadingDocument && gBrowser.curren" +"tURI.spec=='about:blank') where='current'; else where='tab'; " +"$&")); }catch(e){} })(); //总在当前标签页打开Bookmarklet eval("openLinkIn = " + openLinkIn.toString() .replace(/(?=if \(where == "save"\))/, 'if (url.substr(0, 11) == "javascript:") where = "current";') .replace(/(?=var loadInBackground)/, 'if (w.gBrowser.currentURI.spec == "about:blank" && !w.gBrowser.mCurrentTab.hasAttribute("busy")) where = "current";') ); function _LoadURL(aTriggeringEvent, aPostData) { var where = (gBrowser.currentURI.spec!='about:blank' || gBrowser.webProgress.isLoadingDocument) ? 'tab' : 'current'; if (gURLBar.value!='') openUILinkIn(gURLBar.value, where); return true; }[/code] |
|
4楼#
发布于:2011-08-30 11:43
|
|
5楼#
发布于:2011-08-30 11:43
我用Tab Utilities 勾选“强制在新标签页打开所有链接”。这样可以。
不过有个缺点,安装扩展、下载软件会弹新建空白页,有点烦人,一直没能解决。 |
|
6楼#
发布于:2011-08-30 11:43
火狐太强大了
|
|