-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtitleBar.html
More file actions
35 lines (33 loc) · 11.5 KB
/
Copy pathtitleBar.html
File metadata and controls
35 lines (33 loc) · 11.5 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>Title Bar [0.2.3.1 - 2014-05-20]</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%3ETitle%20Bar%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAnFBMVEX///8AAACQkJAAAABdd5Ndd5P///+NjY2Li4vK2+lVb41Yco/h7vbL3OlLaIhmepGNjIxVcI/t9Pn4+Pn29PN9fX3t7e5GZIWSkI37/Pzu9fz5//+MjIz9/v37//9GY4R+fn7h7fWxsbHu7u/L2+nk5eb29PKMi4v7+/3s8/n+/v/e3+Dr6+zs7O3+/v729vf8/P3+/v39/f/z8/SDYsl2AAAABnRSTlMAM/IwxbD9z278AAAAhUlEQVR4XmXPxQ7DMBBF0TZpxxRmLjLD//9bZyzLipSrtzq7N5u2VNKmFghq8DYmb1AIsvHFXif8RiLEbXIxJW2MEAblylQGIUIF2dGUQYUQ9TdbHyF09cFWdwTn+2NXFHpvAv79QZ7qva6cAD75Fta0JxAwGMUQHMaxkx5zENz5KHd6/g8IEREtDCwcngAAAABJRU5ErkJggg%3D%3D%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B//%20https%3A//github.com/Infocatcher/Custom_Buttons/tree/master/Title_Bar%0A%0A//%20Title%20Bar%20button%20for%20Custom%20Buttons%0A//%20%28code%20for%20%22initialization%22%20section%29%0A%0A//%20%28c%29%20Infocatcher%202010%2C%202012%2C%202014%0A//%20version%200.2.3.1%20-%202014-05-20%0A%0Avar%20flexibleWidth%20%3D%20true%3B%0A%0Aif%28%0A%09flexibleWidth%0A%09%26%26%20Array.some%28%0A%09%09this.parentNode.childNodes%2C%0A%09%09function%28node%29%20%7B%0A%09%09%09if%28node%20%3D%3D%20this%29%0A%09%09%09%09return%20false%3B%0A%09%09%09var%20flex%20%3D%20node.getAttribute%28%22flex%22%29%0A%09%09%09%09%7C%7C%20node.ownerDocument.defaultView.getComputedStyle%28node%2C%20null%29.MozBoxFlex%3B%0A%09%09%09return%20flex%20%3E%200%3B%0A%09%09%7D%2C%0A%09%09this%0A%09%29%0A%29%20%7B%0A%09LOG%28%22Detected%20flexible%20nodes%20in%20the%20button%20level%2C%20will%20use%20fixed%20width%22%29%3B%0A%09flexibleWidth%20%3D%20false%3B%0A%7D%0A%0Avar%20titleWidth%2C%20titleWidthMin%2C%20titleWidthMax%2C%20titleWidthCustomize%3B%0Aif%28flexibleWidth%29%20%7B%0A%09titleWidth%20%3D%20%22auto%22%3B%0A%09titleWidthMin%20%3D%20%22100px%22%3B%0A%09titleWidthMax%20%3D%20%22none%22%3B%0A%09titleWidthCustomize%20%3D%20titleWidthMin%3B%0A%7D%0Aelse%20%7B%0A%09titleWidth%20%3D%20titleWidthMin%20%3D%20titleWidthMax%20%3D%20titleWidthCustomize%20%3D%20%22350px%22%3B%0A%7D%0A%0Avar%20root%20%3D%20document.documentElement%3B%0Athis.__savedTitle%20%3D%20null%3B%0Athis.__defineSetter__%28%22title%22%2C%20function%28val%29%20%7B%0A%09if%28val%20%21%3D%20this.__savedTitle%29%0A%09%09this.label%20%3D%20this.tooltipText%20%3D%20this.__savedTitle%20%3D%20val%3B%0A%7D%29%3B%0A%0Avar%20titleUpdater%20%3D%20%7B%0A%09button%3A%20this%2C%0A%09_mo%3A%20null%2C%0A%09init%3A%20function%28%29%20%7B%0A%09%09if%28%22MutationObserver%22%20in%20window%29%20%7B%0A%09%09%09var%20_this%20%3D%20this%3B%0A%09%09%09var%20mo%20%3D%20this._mo%20%3D%20new%20MutationObserver%28function%28%29%20%7B%0A%09%09%09%09_this.handleMutations.apply%28_this%2C%20arguments%29%3B%0A%09%09%09%7D%29%3B%0A%09%09%09//%20http%3A//dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html%23mutation-observers%0A%09%09%09mo.observe%28root%2C%20%7B%0A%09%09%09%09attributes%3A%20true%2C%0A%09%09%09%09attributeFilter%3A%20%5B%22title%22%5D%0A%09%09%09%7D%29%3B%0A%09%09%7D%0A%09%09else%20%7B%0A%09%09%09root.addEventListener%28%22DOMAttrModified%22%2C%20this%2C%20true%29%3B%0A%09%09%7D%0A%09%7D%2C%0A%09destroy%3A%20function%28%29%20%7B%0A%09%09var%20mo%20%3D%20this._mo%3B%0A%09%09if%28mo%29%20%7B%0A%09%09%09this._mo%20%3D%20null%3B%0A%09%09%09mo.disconnect%28%29%3B%0A%09%09%7D%0A%09%09else%20%7B%0A%09%09%09root.removeEventListener%28%22DOMAttrModified%22%2C%20this%2C%20true%29%3B%0A%09%09%7D%0A%09%7D%2C%0A%09handleMutations%3A%20function%28mutations%29%20%7B%0A%09%09this.button.title%20%3D%20document.title%3B%0A%09%7D%2C%0A%09handleEvent%3A%20function%28e%29%20%7B%0A%09%09if%28e.attrName%20%3D%3D%20%22title%22%20%26%26%20e.originalTarget%20%3D%3D%20root%29%0A%09%09%09this.button.title%20%3D%20e.newValue%3B%0A%09%7D%0A%7D%3B%0A%0Avar%20dragHandler%20%3D%20%7B%0A%09get%20sm%28%29%20%7B%0A%09%09delete%20this.sm%3B%0A%09%09return%20this.sm%20%3D%20Components.classes%5B%22@mozilla.org/gfx/screenmanager%3B1%22%5D%0A%09%09%09.getService%28Components.interfaces.nsIScreenManager%29%3B%0A%09%7D%2C%0A%09handleEvent%3A%20function%28e%29%20%7B%0A%09%09switch%28e.type%29%20%7B%0A%09%09%09case%20%22mousedown%22%3A%0A%09%09%09%09if%28e.button%20%21%3D%200%29%0A%09%09%09%09%09break%3B%0A%09%09%09%09window.addEventListener%28%22mouseup%22%2C%20this%2C%20true%29%3B%0A%09%09%09%09window.addEventListener%28%22keypress%22%2C%20this%2C%20true%29%3B%0A%09%09%09%09window.addEventListener%28%22mousemove%22%2C%20this%2C%20true%29%3B%0A%09%09%09%09this.pos%20%3D%20%7B%0A%09%09%09%09%09x%3A%20e.screenX%2C%0A%09%09%09%09%09y%3A%20e.screenY%0A%09%09%09%09%7D%3B%0A%09%09%09%09this.winPos%20%3D%20%7B%0A%09%09%09%09%09x%3A%20window.screenX%2C%0A%09%09%09%09%09y%3A%20window.screenY%0A%09%09%09%09%7D%3B%0A%09%09%09break%3B%0A%09%09%09case%20%22mouseup%22%3A%0A%09%09%09%09this.stopEvent%28e%29%3B%0A%09%09%09%09this.cancel%28%29%3B%0A%09%09%09break%3B%0A%09%09%09case%20%22keypress%22%3A%0A%09%09%09%09if%28e.keyCode%20%21%3D%20e.DOM_VK_ESCAPE%29%0A%09%09%09%09%09break%3B%0A%09%09%09%09this.stopEvent%28e%29%3B%0A%09%09%09%09window.moveTo%28this.winPos.x%2C%20this.winPos.y%29%3B%0A%09%09%09%09this.cancel%28%29%3B%0A%09%09%09break%3B%0A%09%09%09case%20%22mousemove%22%3A%0A%09%09%09%09let%20x%20%3D%20e.screenX%3B%0A%09%09%09%09let%20y%20%3D%20e.screenY%3B%0A%09%09%09%09if%28this.sm.numberOfScreens%20%3D%3D%201%29%20%7B%0A%09%09%09%09%09let%20edge%20%3D%2010%3B%0A%09%09%09%09%09x%20%3D%20Math.max%28screen.availLeft%20+%20edge%2C%20Math.min%28screen.availLeft%20+%20screen.availWidth%20%20-%20edge%2C%20x%29%29%3B%0A%09%09%09%09%09y%20%3D%20Math.max%28screen.availTop%20%20+%20edge%2C%20Math.min%28screen.availTop%20%20+%20screen.availHeight%20-%20edge%2C%20y%29%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09window.moveTo%28%0A%09%09%09%09%09this.winPos.x%20+%20x%20-%20this.pos.x%2C%0A%09%09%09%09%09this.winPos.y%20+%20y%20-%20this.pos.y%0A%09%09%09%09%29%3B%0A%09%09%7D%0A%09%7D%2C%0A%09cancel%3A%20function%28%29%20%7B%0A%09%09window.removeEventListener%28%22mouseup%22%2C%20this%2C%20true%29%3B%0A%09%09window.removeEventListener%28%22keypress%22%2C%20this%2C%20true%29%3B%0A%09%09window.removeEventListener%28%22mousemove%22%2C%20this%2C%20true%29%3B%0A%09%09this.pos%20%3D%20this.winPos%20%3D%20null%3B%0A%09%7D%2C%0A%09stopEvent%3A%20function%28e%29%20%7B%0A%09%09e.preventDefault%28%29%3B%0A%09%09e.stopPropagation%28%29%3B%0A%09%7D%0A%7D%3B%0AaddEventListener%28%22mousedown%22%2C%20dragHandler%2C%20true%2C%20this%29%3B%0Athis.ondblclick%20%3D%20function%28e%29%20%7B%0A%09if%28e.button%20%21%3D%200%29%0A%09%09return%3B%0A%09if%28%22fullScreen%22%20in%20window%20%26%26%20window.fullScreen%29%20%7B%0A%09%09window.fullScreen%20%3D%20false%3B%0A%09%09return%3B%0A%09%7D%0A%09if%28window.windowState%20%21%3D%20window.STATE_NORMAL%29%0A%09%09window.restore%28%29%3B%0A%09else%0A%09%09window.maximize%28%29%3B%0A%7D%3B%0A%0Avar%20s%20%3D%20document.documentElement.style%3B%0Avar%20boxShadowPrefix%20%3D%20%22boxShadow%22%20in%20s%20%3F%20%22%22%20%3A%20%22-moz-%22%3B%0Avar%20cssStr%20%3D%20%28%27%5C%0A%09@namespace%20url%28%22http%3A//www.mozilla.org/keymaster/gatekeeper/there.is.only.xul%22%29%3B%5Cn%5C%0A%09@-moz-document%20url%28%22%27%20+%20window.location.href%20+%20%27%22%29%20%7B%5Cn%5C%0A%09%09%25button%25%20%7B%5Cn%5C%0A%09%09%09width%3A%20%27%20+%20titleWidth%20+%20%27%20%21important%3B%5Cn%5C%0A%09%09%09min-width%3A%20%27%20+%20titleWidthMin%20+%20%27%20%21important%3B%5Cn%5C%0A%09%09%09max-width%3A%20%27%20+%20titleWidthMax%20+%20%27%20%21important%3B%5Cn%5C%0A%09%09%09-moz-box-flex%3A%201%20%21important%3B%5Cn%5C%0A%09%09%09padding%3A%201px%203px%20%21important%3B%5Cn%5C%0A%09%09%09-moz-box-pack%3A%20center%20%21important%3B%5Cn%5C%0A%09%09%09-moz-box-orient%3A%20horizontal%20%21important%3B%5Cn%5C%0A%09%09%09-moz-appearance%3A%20none%20%21important%3B%5Cn%5C%0A%09%09%7D%5Cn%5C%0A%09%09%25button%25%2C%5Cn%5C%0A%09%09%25button%25%20%3E%20.toolbarbutton-text%20%7B%5Cn%5C%0A%09%09%09color%3A%20windowText%20%21important%3B%5Cn%5C%0A%09%09%09text-shadow%3A%20window%202px%20-2px%204px%2C%20window%20-2px%202px%204px%2C%20window%20-2px%20-4px%204px%2C%20window%202px%204px%204px%20%21important%3B%5Cn%5C%0A%09%09%09background%3A%20transparent%20%21important%3B%5Cn%5C%0A%09%09%09border%3A%20none%20%21important%3B%5Cn%5C%0A%09%09%09%27%20+%20boxShadowPrefix%20+%20%27box-shadow%3A%20none%20%21important%3B%5Cn%5C%0A%09%09%7D%5Cn%5C%0A%09%09%25button%25%20%3E%20.toolbarbutton-icon%20%7B%5Cn%5C%0A%09%09%09display%3A%20none%20%21important%3B%5Cn%5C%0A%09%09%7D%5Cn%5C%0A%09%09%25button%25%20%3E%20.toolbarbutton-text%20%7B%5Cn%5C%0A%09%09%09display%3A%20-moz-box%20%21important%3B%5Cn%5C%0A%09%09%09text-align%3A%20left%20%21important%3B%5Cn%5C%0A%09%09%7D%5Cn%5C%0A%09%09toolbarpaletteitem%20%3E%20%25button%25%20%7B%5Cn%5C%0A%09%09%09min-width%3A%20%27%20+%20titleWidthCustomize%20+%20%27%20%21important%3B%5Cn%5C%0A%09%09%09max-width%3A%20%27%20+%20titleWidthCustomize%20+%20%27%20%21important%3B%5Cn%5C%0A%09%09%7D%5Cn%5C%0A%09%7D%27%29%0A%09.replace%28/%25button%25/g%2C%20%22%23%22%20+%20this.id%29%3B%0A%0Avar%20cssURI%20%3D%20makeURI%28%22data%3Atext/css%2C%22%20+%20encodeURIComponent%28cssStr%29%29%3B%0Avar%20sss%20%3D%20Components.classes%5B%22@mozilla.org/content/style-sheet-service%3B1%22%5D%0A%09.getService%28Components.interfaces.nsIStyleSheetService%29%3B%0Aif%28%21sss.sheetRegistered%28cssURI%2C%20sss.USER_SHEET%29%29%0A%09sss.loadAndRegisterSheet%28cssURI%2C%20sss.USER_SHEET%29%3B%0Afunction%20removeStyles%28%29%20%7B%0A%09if%28sss.sheetRegistered%28cssURI%2C%20sss.USER_SHEET%29%29%0A%09%09sss.unregisterSheet%28cssURI%2C%20sss.USER_SHEET%29%3B%0A%7D%0A%0Athis.title%20%3D%20document.title%3B%0AtitleUpdater.init%28%29%3B%0A%0Athis.onDestroy%20%3D%20function%28reason%29%20%7B%0A%09titleUpdater.destroy%28%29%3B%0A%09if%28reason%20%3D%3D%20%22update%22%20%7C%7C%20reason%20%3D%3D%20%22delete%22%29%0A%09%09removeStyles%28%29%0A%09else%20if%28reason%20%3D%3D%20%22constructor%22%20%26%26%20this.parentNode.nodeName%20%3D%3D%20%22toolbar%22%29%0A%09%09setTimeout%28removeStyles%2C%200%29%3B%20//%20Only%20for%20%22flexibleWidth%20%3D%20false%22%20hack%0A%7D%3B%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B/*CODE*/%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/Title_Bar">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>