-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdetachTab.html
More file actions
35 lines (33 loc) · 8.82 KB
/
Copy pathdetachTab.html
File metadata and controls
35 lines (33 loc) · 8.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE HTML>
<meta charset="utf-8"/>
<title>Detach Tab [0.2.2 - 2017-07-04]</title>
<body>
<a href="custombutton://%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3Ccustombutton%20xmlns%3Acb%3D%22http%3A//xsms.nm.ru/custombuttons/%22%3E%0A%20%20%3Cname%3EDetach%20Tab%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAw1BMVEUAAAAXFxcAAABMTEx/f38AAABycnJhYWFWVlYTExM8PDxLS0sAAABqampQtlB/f39ejV5Vu1VBp0F6enrp6elJr0k2kTZ/f38liyUulC7w8PCI7ogliyVVu1Vdw134+Pjr6+tozmh123Xs7OxQtlBBp0GA5oA4njj09PT8/Pzo6Ojq6ups0mwrkSu50rnv7+/k5OSzzbNHk0cRdxFHrUf29va/2b8dgx3l6eX///9GrEYWfBY2nDZMmUxJr0n7+/tly2VN1y0QAAAAGXRSTlMAdRpuZhZoa2xbcFMGar9ZjL9AWtO/1iK/ts2udwAAAJFJREFUeF51z9UOwjAYQOFCmQpulbnj7vb+T8W/ZUkhhO/y3B30n13qiNCcMRAhYfBiSfIQoRuzIAhiCKNWA7RT5vuRn0Lo9c+AMMchwwuBIOdPwG2b5/KYQ7DcPTju5gfXQgUlo2Bxvd0zpQzqclpYb7YnFYKBsbeqeBgbSKc0nFRCSnWk1b5oyJTqHyTzZ/oNhHwSaOEGr5gAAAAASUVORK5CYII%3D%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B/*Initialization%20Code*/%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B//%20http%3A//infocatcher.ucoz.net/js/cb/detachTab.js%0A//%20https%3A//github.com/Infocatcher/Custom_Buttons/tree/master/Detach_Tab%0A%0A//%20Detach%20Tab%20button%20for%20Custom%20Buttons%0A//%20%28code%20for%20%22code%22%20section%29%0A%0A//%20%28c%29%20Infocatcher%202012%2C%202016-2017%0A//%20version%200.2.2%20-%202017-07-04%0A%0Avar%20forceHideTabBar%20%3D%20false%3B%0A%0Aconst%20ns%20%3D%20%22_cbDetachTab_%22%3B%0Avar%20btn%20%3D%20this%3B%0Aif%28ns%20+%20%22detachedWindow%22%20in%20btn%29%0A%09attachTab%28%29%3B%0Aelse%0A%09detachTab%28%29%3B%0A%0Afunction%20detachTab%28%29%20%7B%0A%09btn.checked%20%3D%20true%3B%0A%09var%20selectedTab%20%3D%20gBrowser.selectedTab%3B%0A%09btn%5Bns%20+%20%22tabPos%22%5D%20%3D%20%22_tPos%22%20in%20selectedTab%0A%09%09%3F%20selectedTab._tPos%0A%09%09%3A%20Array.prototype.indexOf.call%28gBrowser.tabs%20%7C%7C%20gBrowser.tabContainer.childNodes%2C%20selectedTab%29%3B%0A%09if%28%22TreeStyleTabService%22%20in%20window%29%0A%09%09btn%5Bns%20+%20%22parentTab%22%5D%20%3D%20TreeStyleTabService.getParentTab%28selectedTab%29%3B%0A%09//%20See%20replaceTabWithWindow%28%29%20in%20chrome%3A//browser/content/tabbrowser.xml%0A%09var%20opts%20%3D%20%22chrome%2Cdialog%3Dno%2Call%22%3B%0A%09//var%20opts%20%3D%20%22chrome%2Cdialog%3D0%2Cresizable%3D1%2Clocation%3D0%22%3B%0A%09var%20w%20%3D%20btn%5Bns%20+%20%22detachedWindow%22%5D%20%3D%20window.openDialog%28getBrowserURL%28%29%2C%20%22_blank%22%2C%20opts%2C%20selectedTab%29%3B%0A%09if%28forceHideTabBar%29%20%7B%0A%09%09var%20autoHide%20%3D%20cbu.getPrefs%28%22browser.tabs.autoHide%22%29%3B%0A%09%09if%28%21autoHide%29%0A%09%09%09cbu.setPrefs%28%22browser.tabs.autoHide%22%2C%20true%29%3B%0A%09%7D%0A%09var%20initDetachedWindow%20%3D%20function%20init%28e%29%20%7B%0A%09%09w.removeEventListener%28e.type%2C%20init%2C%20false%29%3B%0A%09%09w.addEventListener%28%22unload%22%2C%20destroyDetachedWindow%2C%20false%29%3B%0A%09%09compactWindow%28w%29%3B%0A%09%7D%3B%0A%09var%20destroyDetachedWindow%20%3D%20function%20destroy%28e%2C%20parentDestroy%29%20%7B%0A%09%09w.removeEventListener%28e.type%2C%20destroy%2C%20false%29%3B%0A%09%09window.removeEventListener%28%22unload%22%2C%20destroyParentWindow%2C%20false%29%3B%0A%09%09if%28%21parentDestroy%29%0A%09%09%09_attachTab%28%29%3B%0A%09%09if%28forceHideTabBar%20%26%26%20%21autoHide%29%0A%09%09%09cbu.setPrefs%28%22browser.tabs.autoHide%22%2C%20false%29%3B%0A%09%7D%3B%0A%09var%20destroyParentWindow%20%3D%20function%20destroy%28e%29%20%7B%0A%09%09w.removeEventListener%28%22DOMContentLoaded%22%2C%20initDetachedWindow%2C%20false%29%3B%0A%09%09destroyDetachedWindow%28e%2C%20true%29%3B%0A%09%7D%3B%0A%09w.addEventListener%28%22DOMContentLoaded%22%2C%20initDetachedWindow%2C%20false%29%3B%0A%09window.addEventListener%28%22unload%22%2C%20destroyParentWindow%2C%20false%29%3B%0A%7D%0Afunction%20attachTab%28%29%20%7B%0A%09if%28%21btn%5Bns%20+%20%22detachedWindow%22%5D.closed%29%0A%09%09btn%5Bns%20+%20%22detachedWindow%22%5D.close%28%29%3B%0A%09else%0A%09%09delete%20btn%5Bns%20+%20%22detachedWindow%22%5D%3B%0A%7D%0Afunction%20_attachTab%28%29%20%7B%0A%09var%20tab%20%3D%20btn%5Bns%20+%20%22detachedWindow%22%5D.gBrowser.selectedTab%3B%0A%09var%20newTab%20%3D%20gBrowser.selectedTab%20%3D%20gBrowser.addTab%28%29%3B%0A%09gBrowser.moveTabTo%28newTab%2C%20btn%5Bns%20+%20%22tabPos%22%5D%29%3B%0A%09if%28ns%20+%20%22parentTab%22%20in%20btn%29%20%7B%0A%09%09let%20parentTab%20%3D%20btn%5Bns%20+%20%22parentTab%22%5D%3B%0A%09%09if%28parentTab%20%26%26%20parentTab.parentNode%29%0A%09%09%09gBrowser.treeStyleTab.attachTabTo%28newTab%2C%20parentTab%29%3B%0A%09%7D%0A%0A%09//%20Strange%20bug...%0A%09//%20Temporary%20override%20some%20preferences%0A%09var%20warnOnClose%20%3D%20cbu.getPrefs%28%22browser.tabs.warnOnClose%22%29%3B%0A%09if%28warnOnClose%29%0A%09%09cbu.setPrefs%28%22browser.tabs.warnOnClose%22%2C%20false%29%3B%0A%09var%20warnOnQuit%20%3D%20cbu.getPrefs%28%22browser.warnOnQuit%22%29%3B%0A%09if%28warnOnQuit%29%0A%09%09cbu.setPrefs%28%22browser.warnOnQuit%22%2C%20false%29%3B%0A%0A%09try%20%7B%0A%09%09gBrowser.swapBrowsersAndCloseOther%28newTab%2C%20tab%29%3B%0A%09%7D%0A%09catch%28e%29%20%7B%0A%09%09Components.utils.reportError%28e%29%3B%0A%09%7D%0A%0A%09if%28warnOnClose%29%0A%09%09cbu.setPrefs%28%22browser.tabs.warnOnClose%22%2C%20true%29%3B%0A%09if%28warnOnQuit%29%0A%09%09cbu.setPrefs%28%22browser.warnOnQuit%22%2C%20true%29%3B%0A%0A%09window.focus%28%29%3B%0A%09delete%20btn%5Bns%20+%20%22detachedWindow%22%5D%3B%0A%09delete%20btn%5Bns%20+%20%22tabPos%22%5D%3B%0A%09delete%20btn%5Bns%20+%20%22parentTab%22%5D%3B%0A%09btn.checked%20%3D%20false%3B%0A%7D%0Afunction%20compactWindow%28win%29%20%7B%0A%09var%20document%20%3D%20win.document%3B%0A%09//%20See%20styles%20for%20window%5Bchromehidden%7E%3D%22*%22%5D%20in%20chrome%3A//global/content/xul.css%0A%09//%20But%20don%27t%20use%20%22display%3A%20none%3B%22%0A%09var%20style%20%3D%20%27%5C%0A%09%09%23TabsToolbar%2C%5Cn%5C%0A%09%09%23nav-bar%2C%20/*%20Just%20force%20hide%2C%20now%20used%20too%20complex%20tricks%20to%20handle%20%22chromehidden%22%20*/%5Cn%5C%0A%09%09.tabbrowser-strip%2C%5Cn%5C%0A%09%09.treestyletab-splitter%2C%5Cn%5C%0A%09%09.chromeclass-menubar%2C%5Cn%5C%0A%09%09.chromeclass-directories%2C%5Cn%5C%0A%09%09.chromeclass-status%2C%5Cn%5C%0A%09%09.chromeclass-extrachrome%2C%5Cn%5C%0A%09%09.chromeclass-location%2C%5Cn%5C%0A%09%09.chromeclass-toolbar%2C%5Cn%5C%0A%09%09.chromeclass-toolbar-additional%20%7B%5Cn%5C%0A%09%09%09visibility%3A%20collapse%20%21important%3B%5Cn%5C%0A%09%09%7D%27%3B%0A%09var%20root%20%3D%20document.documentElement%3B%0A%09document.insertBefore%28%0A%09%09document.createProcessingInstruction%28%0A%09%09%09%22xml-stylesheet%22%2C%0A%09%09%09%27href%3D%22%27%20+%20%22data%3Atext/css%2C%22%0A%09%09%09%09+%20encodeURIComponent%28style%29%20+%20%27%22%20type%3D%22text/css%22%27%0A%09%09%29%2C%0A%09%09root%0A%09%29%3B%0A%09//%20See%20%23main-window%5Bdisablechrome%5D%20...%20in%20chrome%3A//browser/content/browser.css%0A%09//%20User%20may%20want%20override%20this%20styles%0A%09var%20origSetAttribute%20%3D%20root.setAttribute%3B%0A%09root.setAttribute%20%3D%20function%28attr%2C%20val%29%20%7B%0A%09%09if%28attr%20%3D%3D%20%22disablechrome%22%29%0A%09%09%09return%20undefined%3B%0A%09%09return%20origSetAttribute.apply%28this%2C%20arguments%29%3B%0A%09%7D%3B%0A%09root.removeAttribute%28%22disablechrome%22%29%3B%0A%09root.offsetHeight%3B%20//%20Force%20reflow%0A%09try%20%7B%20//%20Mark%20as%20popup%20window%20to%20open%20new%20tabs%20in%20window%20with%20visible%20tab%20bar%0A%09%09win.toolbar.visible%20%3D%20false%3B%0A%09%7D%0A%09catch%28e%29%20%7B%0A%09%7D%0A%7D%5D%5D%3E%3C/code%3E%0A%20%20%3Caccelkey%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/accelkey%3E%0A%20%20%3Chelp%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/help%3E%0A%20%20%3Cattributes/%3E%0A%3C/custombutton%3E"
>Install</a>
| <a href="https://github.com/Infocatcher/Custom_Buttons/tree/master/Detach_Tab">Source</a>
| <a href="https://github.com/Infocatcher/Custom_Buttons#usage">Instructions</a>
<script type="text/javascript">
var a = document.getElementsByTagName("a")[0];
a.title = document.title;
if(/%3Cimage%3E%3C%21%5BCDATA%5B(data%3A\S+)%5D%5D%3E%3C\/image%3E/.test(a.href)) {
var icon = decodeURIComponent(RegExp.$1);
var img = document.createElement("img");
img.src = icon;
img.alt = "";
img.style.verticalAlign = "middle";
img.style.marginRight = "4px";
img.style.border = "none";
a.insertBefore(img, a.firstChild);
var link = document.createElement("link");
link.rel = "shortcut icon";
link.href = icon;
document.documentElement.insertBefore(link, document.documentElement.firstChild);
}
</script>
<script type="text/javascript" src="https://infocatcher.github.io/Custom_Buttons/viewCustomButton.js"></script>
<script type="text/javascript">
if("viewCustomButtonCode" in window) setTimeout(function() {
viewCustomButtonCode(a.href);
}, 0);
</script>
</body>