userChrome.js Scripte für den Fuchs (Diskussion)
-
Endor -
12. Mai 2015 um 14:19 -
Erledigt
-
-
Quicklinkbutton für's Forum:
Nur mal für mich aus Interesse.
Wo siehst du den Vorteil gegenüber einem normalen Lesezeichen?
-
Danke, Zeile 31 ist gelöscht.
Wenn ich ganz scharf nachdenke, könnte ich vielleicht einen Vorteil erkennen.
😁️ Ich weiß einen: bei ausgeblendeter Lesezeichenleiste...
-
bei ausgeblendeter Lesezeichenleiste.
Danke.
-
Danke, Zeile 31 ist gelöscht.
Wenn ich ganz scharf nachdenke, könnte ich vielleicht einen Vorteil erkennen.
😁️ Ich weiß einen: bei ausgeblendeter Lesezeichenleiste...
Macht Sinn .
Was vielleicht auch Sinn machen würde - bei ausgeblendeter Lesezeichenleiste einen Button zum Öffnen von nur einem Lesezeichenordner zu haben ; z.B. Weitere Lesezeichen , oder noch besser einem anderen festgelegten Ordner .
Also quasi ein einzelner Lesezeichenordner für die Toolbar , der aufklappt wie ein normaler Lesezeichenordner .
Nicht dass ich danach verzweifelt suchen würde oder so ... .
-
Was vielleicht auch Sinn machen würde - bei ausgeblendeter Lesezeichenleiste einen Button zum Öffnen von nur einem Lesezeichenordner zu haben ; z.B. Weitere Lesezeichen , oder noch besser einem anderen festgelegten Ordner .
Also quasi ein einzelner Lesezeichenordner für die Toolbar , der aufklappt wie ein normaler Lesezeichenordner .
Vielleicht so:
SaveForReadLater – Get this Extension for 🦊 Firefox (en-US)Download SaveForReadLater for Firefox. Bookmark pages for read them lateraddons.mozilla.org -
Danke für den Tip !
-
Hallo zusammen.
Nur als Info für Leute die das Script expandsidebar.uc.js verwenden.
Der Autor hat neue Versionen dafür veröffentlicht:
Für Firefox 106
JavaScript
Alles anzeigen// ==UserScript== // @name expandsidebar_fx58.uc.js // @description Seitenleiste automatisches Öffnen und Schließen // @namespace http://forums.mozillazine.org/viewtopic.php?p=2592073#2592073 // @include main // @compatibility Firefox 106 // @author Alice0775 // @Note Seitenleistenposition bei _SIDEBARPOSITION wählbar (links oder rechts) // @Note Keyconfig und Mousegesten usw. SidebarUI.toggle (entsprechender Code); // @Note // @version 2022/09/14 11:00 box width:auto // @version 2022/08/26 Bug 1695435 - Remove @@hasInstance for IDL interfaces in chrome context // @version 2021/11/14 21:00 css // @version 2021/11/14 13:00 no longer close when print preview // @version 2021/09/30 22:00 change splitter color // @version 2020/12/14 00:00 vtb // @version 2020/07/14 00:00 style // @version 2019/12/09 18:00 fix 72 Bug 1582530 // @version 2019/12/05 18:00 fix 72 Bug 1492582 - browser.xhtml: Migrate root xul:window element to an html:html element // @version 2019/12/05 17:00 fix 71 Bug 1582530 - Turn on `layout.css.xul-box-display-values.survive-blockification.enabled` by default // @version 2019/12/05 10:00 fix 70 Bug 1558914 - Disable Array generics in Nightly // @version 2019/09/04 Fx69 // @version 2018/07/03 Fx61 fix regression from remove loadoverlay // @version 2018/07/03 Fx61 remove loadoverlay // @version 2018/06/25 Fx61 wip // @version 2018/01/25 Fx58 wip // @version 2017/11/18 Fx57 // @version 2017/11/18 nsIPrefBranch2 to nsIPrefBranch // @version 2017/02/01 00:00 enable floating(overlay) sidebar // @version 2017/01/19 00:00 change event phase,target // @version 2015/08/29 00:00 fix lastused command // @version 2015/05/13 19:00 fix lastused command // @version 2015/02/20 22:00 fix due to Bug 1123517 // @version 2014/10/31 22:00 fix due to Bug 714675 // @version 2014/05/22 12:00 fix var // @version 2013/03/03 00:00 fix It close too soon when it opened from a button or menu // @version 2013/02/26 00:00 fix close delay // @version 2012/12/08 22:30 Bug 788290 Bug 788293 Remove E4X // ==/UserScript== // @version 2012/08/04 09:00 private browsingを考慮 // @version 2012/08/04 09:00 hiddenではなくcollapsedを使うように // @version 2012/02/08 14:00 splitter width in full screen // @version 2011/05/26 12:00 5.0a2でマウスが要素上通過する時, 移動速度が速すぎるとmouseoverイベントが発火しない? 感度が落ちた? // @version 2011/03/24 12:00 ドラッグオーバー遅延を別設定とした // @version 2010/10/30 18:00 http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=84baf90b040c&tochange=16eac4b8b8e0 // @version 2010/10/09 18:00 Windows7 Aero // @version 2009/06/06 20:00 ドラッグオーバーで閉じてしまうので // @version 2009/05/24 18:00 chromeのチェック変更 // @version 2009/04/30 18:00 サイドバーを開閉したときは必ずタイマーをクリアするようにした。 // @version 2009/04/28 00:00 負荷軽減 // @version 2009/04/23 00:00 _KEEP_SIZESが動かなくなっていたので // @version 2009/04/22 12:00 ドラッグオーバーで開かなくなっていたので // @version 2009/04/15 21:00 マウスが通過したときは開かないが動かなくなっていたので // @version 2009/04/15 19:00 細々bug修正 // @version 2009/04/15 02:00 _CLOSEWHENGOOUTが動かなくなっていたので // @version 2009/04/14 22:00 fx2削除 var ucjs_expand_sidebar = { // --- config --- //Anfang Konfiguration _OPEN_DELAY: 300, //Zeitverzögerung zum Öffnen bei Mouseover _OPEN_DELAY_DRAGOVER: 400, //Zeitverzögerung zum Öffnen per Dragover _CLOSE_DELAY: 800, //Zeitverzögerung beim Schließen _SCROLLBAR_DELAY: 1000, //Zeitverzögerung der Bildlaufleiste beim Öffnen / Schließen _DEFAULTCOMMAND: "viewBookmarksSidebar", // Standardseitenleiste _TOLERANCE: 0, //Bereich, der als linke Kante des Fensters erkannt wird (0 kann bei Verwendung von TreeStyleTab usw. verwendet werden) _DONOTCLOSE_XULELEMENT: true, //Wenn sich die Maus auf einem XUL-Element befindet, nicht schließen //(Wird nicht geschlossen, selbst wenn XUL im Inhalt angezeigt wird) _CLOSEWHENGOOUT: false, //Wenn sich die Maus aus dem Fenster bewegt: true: schließen, [false]: nicht schließen _FLOATING_SIDEBAR: true, //Schwebende Seitenleiste (Überlagerung des Seiteninhalts) aktivieren, //(bekanntes Problem: Seitenleiste kann nicht skaliert werden = mit Maus breiter oder schmaler ziehen) _SIDEBARPOSITION: "L", //Seitenleistenposition Linke Seite: L Rechte Seite: R //VerticalToolbar.uc.js von Gomita - vertikale Symbolleiste 0.1 //(http://www.xuldev.org/blog/?p=113) muss zuerst ausgeführt werden! _KEEP_SIZES:true, //Breite für jeden Seitenleisten-Typ speichern _defaultWidth: 234, //Standardbreite der Seitenleiste _inFullscreen: true, //Bei Vollbild, Verhalten von Firefox 31 verwenden //Ende Konfiguration // --- config --- _MOUSEMOVEINTERVAL: 10, //Intervall zum Überprüfen der Mausposition _CHECKBOX_AT_STARUP:false, //Kontrollkästchen beim Start anzeigen _CLOSE_AT_STARTUP:true, //Seitenleiste beim Start geschlossen _lastcommand: null, _backup_lastcommand:null, _open_Timeout: null, _close_Timeout: null, _sidebar_box:null, _sidebar:null, _sidebar_splitter:null, _checkbox:null, _content:null, _opend:false, _mousedown:false, _mouse_Timeout: null, _resizeTimer: null, _mtimer: false, _startup:true, sizes:[], prefKeepItSizes: "userChrome.expandSidebar.keepItSizes", jsonToDOM: function(jsonTemplate, doc, nodes) { jsonToDOM.namespaces = { html: "http://www.w3.org/1999/xhtml", xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" }; jsonToDOM.defaultNamespace = jsonToDOM.namespaces.xul; function jsonToDOM(jsonTemplate, doc, nodes) { function namespace(name) { var reElemNameParts = /^(?:(.*):)?(.*)$/.exec(name); return { namespace: jsonToDOM.namespaces[reElemNameParts[1]], shortName: reElemNameParts[2] }; } // Note that 'elemNameOrArray' is: either the full element name (eg. [html:]div) or an array of elements in JSON notation function tag(elemNameOrArray, elemAttr) { // Array of elements? Parse each one... if (Array.isArray(elemNameOrArray)) { var frag = doc.createDocumentFragment(); Array.prototype.forEach.call(arguments, function(thisElem) { frag.appendChild(tag.apply(null, thisElem)); }); return frag; } // Single element? Parse element namespace prefix (if none exists, default to defaultNamespace), and create element var elemNs = namespace(elemNameOrArray); var elem = doc.createElementNS(elemNs.namespace || jsonToDOM.defaultNamespace, elemNs.shortName); // Set element's attributes and/or callback functions (eg. onclick) for (var key in elemAttr) { var val = elemAttr[key]; if (nodes && key == "keyvalue") { nodes[val] = elem; continue; } var attrNs = namespace(key); if (typeof val == "function") { // Special case for function attributes; don't just add them as 'on...' attributes, but as events, using addEventListener elem.addEventListener(key.replace(/^on/, ""), val, false); } else { // Note that the default namespace for XML attributes is, and should be, blank (ie. they're not in any namespace) elem.setAttributeNS(attrNs.namespace || "", attrNs.shortName, val); } } // Create and append this element's children var childElems = Array.prototype.slice.call(arguments, 2); childElems.forEach(function(childElem) { if (childElem != null) { elem.appendChild( doc.defaultView.Node.isInstance(childElem) /*childElem instanceof doc.defaultView.Node*/ ? childElem : Array.isArray(childElem) ? tag.apply(null, childElem) : doc.createTextNode(childElem)); } }); return elem; } return tag.apply(null, jsonTemplate); } return jsonToDOM(jsonTemplate, doc, nodes); }, init: function(){ if ("EzSidebarService" in window) return; this._sidebar_box = document.getElementById('sidebar-box'); var style = ` @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); #sidebar-checkbox { border: 1px solid currentColor !important; width: 16px !important; height: 16px !important; overflow-x: hidden !important; } #sidebar-splitter { -moz-box-align: center; -moz-box-pack: center; cursor: ew-resize; border-width: 0 2px; border-style: solid; width: 2px; max-width: 2px; min-width: 0px; background-color: var(--toolbar-bgcolor); border-inline-start-color: var(--toolbar-bgcolor); border-inline-end-color: var(--toolbar-bgcolor); margin-left: 0px; margin-inline-start: 0px; } #navigator-toolbox[inFullscreen="true"] #sidebar-box[hidden="true"] + #sidebar-splitter, :root[inFullscreen="true"] #sidebar-box[hidden="true"] + #sidebar-splitter { width: 0px; max-width: 1px; min-width: 0px; border-left-width: 0px; border-right-width: 1px; background-color: ThreeDFace; } `; var sspi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css,' + encodeURIComponent(style) + '"' ); document.insertBefore(sspi, document.documentElement); sspi.getAttribute = function(name) { return document.documentElement.getAttribute(name); }; if (this._FLOATING_SIDEBAR) { // floating css var floatingStyle = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); #sidebar-box { position: fixed ; display: block; z-index: 55555; left: 4px; } :root:not([lwtheme-image]) #sidebar-box { background-color: var(--toolbar-bgcolor); } :root[lwtheme-image] #sidebar-box { background-color: var(--tabpanel-background-color); } #sidebar-box #sidebar-header { width :100%; } #sidebar-box #sidebar { height: calc(100vh - 230px); border-left:3px solid var(--toolbar-bgcolor); border-right:3px solid var(--toolbar-bgcolor); border-bottom:3px solid var(--toolbar-bgcolor); } #sidebar-box #sidebar:-moz-lwtheme { border-left:3px solid var(--sidebar-background-color); border-right:3px solid var(--sidebar-background-color); border-bottom:3px solid var(--sidebar-background-color); } #sidebar-box { border-right: 1px solid var(--sidebar-border-color); border-bottom: 1px solid var(--sidebar-border-color); } #sidebar-box:-moz-locale-dir(rtl) { border-left: 1px solid var(--sidebar-border-color); } #sidebar-box:-moz-lwtheme { background-color: var(--sidebar-background-color); } #sidebar-box sidebarheader:-moz-lwtheme { color: -moz-dialogtext; text-shadow: none; background-color: var(--sidebar-background-color); -moz-appearance: toolbox; border-bottom: 1px solid var(--sidebar-border-color); border-top: 1px solid var(--sidebar-border-color); } #sidebar-box #sidebarpopuppanel-bottom { background-color: var(--toolbar-bgcolor); width:100%; } #sidebar-box #sidebarpopuppanel-bottom:-moz-lwtheme { background-color: var(--sidebar-background-color); }`; if (this._SIDEBARPOSITION="L") { floatingStyle += ' #sidebar-box .PopupResizerGripper { \ list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABG0lEQVQ4jZXT2ytEURTH8U8UIjNESh5kQq4zGIpci+LBg8vkMhgkl+RhMo0Uf7yHWWo8jDlzXvbZv32+a63fr31o7WnHEDaxj6VW4TTW8YgHbLUC92E2wDKKWEgCtyEVcAEfsc6gJwmcxgpKqGIPExhAd7OxUwFf4QknmMYadrD8H/zruRTwEbLI4za0g0Zj13uuRud5ZGKaL7xiNYnnXUyqJV7EN05D+5NBI8+ToZ2jEnAeI+ht5nk+Op/jDfexX8NGvDf1XIzOd1jEXIRYxgX0J/D8W3Aaz/iM72cFfBljH2MMufBaCTgbWgHvOIschmE7Dg6jcypGLeAa4xiMIjdROBd6Xl1QGXSho+5wCp2hj6ndvlG1XzqPlx+JJSwSgQwohgAAAABJRU5ErkJggg=="); \ cursor: se-resize; \ }'; } else { floatingStyle += ' #sidebar-box:-moz-locale-dir(rtl) .PopupResizerGripper { \ list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABIUlEQVQ4jZXRwUsUYRzG8Q8Jthi6SiKEB1lZJdvWXUtBKW3BIA8dajfSUjdlMSU6RFII9cd7mGdBPM3MYYaZ9/0983y/L7TxBluYwwMVry4+4UtCZjBRJWAZ7/EdQ7QwWyWkhlV8xJ+0aaVJKZzJbG5gPyFDBU69TEgTG+ikST84x0o6eZnaA4XQNj6o4OQpTnCNrwqp7TQp5eRhMPr4n5BucEo5qWEe6wm5xmEGSjlpZLiT6mf4mZBSTno4Deua4kTO7zkZt7vrpD4OWVKcwG9c4nn+PIiTY8VJreEt/mKEV1iQWwefcYNv2MnQAP/ufFtJg1+4wK5sbOY5zOJrLEbij/D38BjPgjbCO7jK8JOwHQVhGlPYxgE28/4o63t4cQuE/SwSa1JPlgAAAABJRU5ErkJggg=="); \ cursor: sw-resize; \ }'; } sspi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css,' + encodeURIComponent(floatingStyle) + '"' ); document.insertBefore(sspi, document.documentElement); sspi.getAttribute = function(name) { return document.documentElement.getAttribute(name); }; let template = ["hbox", {id: "sidebarpopuppanel-bottom"}, ["spacer", {flex: "1"}], ["image", {class: "PopupResizerGripper", onmousedown: "if (event.target == this) sidebarpopuppanelResize.start(event);"}] ]; document.getElementById('sidebar-box') .appendChild(this.jsonToDOM(template, document, {})); } if (this._sidebar_box.hasAttribute('hidden') || this._CLOSE_AT_STARTUP) { this._sidebar_box.collapsed = true; } this._sidebar_box.hidden = false; this._sidebar = document.getElementById('sidebar'); this._sidebar_splitter = document.getElementById('sidebar-splitter'); if (this._sidebar_splitter.hasAttribute('hidden')) { this._sidebar_splitter.removeAttribute('hidden'); } this._sidebar_splitter.removeAttribute('state'); this._sidebar_splitter.removeAttribute('collapsed'); var checkbox = document.createXULElement('checkbox'); var item = document.getElementById('sidebar-throbber'); this._checkbox = item.parentNode.insertBefore(checkbox, item); checkbox.setAttribute("id", "sidebar-checkbox"); checkbox.setAttribute("type", "checkbox"); checkbox.setAttribute("label", ""); checkbox.setAttribute('persist','checked'); checkbox.checked = this._CHECKBOX_AT_STARUP; if(this._SIDEBARPOSITION == "R"){ (function(self){ //this code from http://pc11.2ch.net/test/read.cgi/software/1185343069/128 self._sidebar_splitter = self._sidebar_box.parentNode.appendChild(self._sidebar_splitter); self._sidebar_box = self._sidebar_box.parentNode.appendChild(self._sidebar_box); })(this); } window.PrintUtils.printPreview_org = PrintUtils.printPreview; PrintUtils.printPreview = function(arg) { if(document.getElementById("sidebar-box") && !!document.getElementById("sidebar-box").getAttribute("sidebarcommand")) { if (window.ucjs_expand_sidebar._FLOATING_SIDEBAR) SidebarUI.hide(); } window.PrintUtils.printPreview_org(arg); }; /** * helper functions */ function accessorDescriptor(field, fun) { var desc = { enumerable: true, configurable: true }; desc[field] = fun; return desc; } function defineGetter(obj, prop, get) { if (Object.defineProperty) return Object.defineProperty(obj, prop, accessorDescriptor("get", get)); if (Object.prototype.__defineGetter__) return obj.__defineGetter__(prop, get); throw new Error("browser does not support getters"); } function defineSetter(obj, prop, set) { if (Object.defineProperty) return Object.defineProperty(obj, prop, accessorDescriptor("set", set)); if (Object.prototype.__defineSetter__) return obj.__defineSetter__(prop, set); throw new Error("browser does not support setters"); } /** * hack */ defineGetter(SidebarUI, "isOpen", function isOpen(){return this._box && !this._box.collapsed;}) SidebarUI.show_org = SidebarUI.show; SidebarUI.show = function show(commandID, triggerNode) { //this._box.hidden = false; this._box.collapsed = false; this._splitter.hidden = false; ucjs_expand_sidebar._loadKeepItSizes(commandID); ucjs_expand_sidebar._lastcommand = commandID; ucjs_expand_sidebar._opend = true; if (ucjs_expand_sidebar._FLOATING_SIDEBAR) { let x = document.getElementById("appcontent").getBoundingClientRect().x; ucjs_expand_sidebar._sidebar_box.style.setProperty("left", x + "px", ""); } SidebarUI.show_org(commandID, triggerNode); } SidebarUI.hide_org = SidebarUI.hide; SidebarUI.hide = function hide(triggerNode) { if (!this.isOpen) { return; } ucjs_expand_sidebar._saveKeepItSizes(ucjs_expand_sidebar._lastcommand); this._box.collapsed = true; if ("treeStyleTab" in gBrowser) gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_WINDOW_RESIZE); gBrowser.selectedBrowser.focus(); //SidebarUI.hide(triggerNode); } //Fokussierte Aktion der Seitenleisten ausführen // if (typeof fireSidebarFocusedEvent == "function") { window.fireSidebarFocusedEvent_org = fireSidebarFocusedEvent; fireSidebarFocusedEvent = function () { fireSidebarFocusedEvent_org(); ucjs_expand_sidebar._focused(); } } if (typeof SidebarUI._fireFocusedEvent == "function") { SidebarUI._fireFocusedEvent_org = SidebarUI._fireFocusedEvent; SidebarUI._fireFocusedEvent = function () { SidebarUI._fireFocusedEvent_org(); ucjs_expand_sidebar._focused(); } } //Beim Start Seitenleiste geschlossen halten? setTimeout(function(self) { var command = self._sidebar_box.getAttribute("sidebarcommand"); if (command) self._lastcommand = command; var broadcasters = document.getElementsByAttribute("group", "sidebar"); if (self._CLOSE_AT_STARTUP) { SidebarUI.hide(); //self._sidebar_box.setAttribute('collapsed',true); for (var i = 0; i < broadcasters.length; ++i) { if (broadcasters[i].localName != "broadcaster") { continue; } broadcasters[i].removeAttribute("checked"); } } else { for (var i = 0; i < broadcasters.length; ++i) { if (broadcasters[i].localName != "broadcaster") { continue; } if (broadcasters[i].hasAttribute("checked")) { self._loadKeepItSizes(); break;; } } } }, 500, this); this._sidebar.style.removeProperty('max-width'); this._sidebar.style.removeProperty('min-width'); this._content = document.getElementById("content"); if (this._CLOSEWHENGOOUT) window.addEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); else this._sidebar_splitter.addEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); if (this._KEEP_SIZES) window.addEventListener("resize", this, false); if (this._SIDEBARPOSITION == "R"){ gBrowser.tabpanels.addEventListener("mouseup", this, true); gBrowser.tabpanels.addEventListener("mousedown", this, true); } //this._content.addEventListener("mouseover", ucjs_expand_sidebar._mousemove, true); document.getElementById("browser").addEventListener("mousemove", ucjs_expand_sidebar._mousemove, true); this._sidebar_box.addEventListener("mouseover", ucjs_expand_sidebar._mouseover, true); window.addEventListener("dblclick", this, true); //window.addEventListener("click", this, true); this._sidebar_splitter.addEventListener("dragover", this, true); Services.obs.addObserver(this, "private-browsing", false); }, uninit: function(){ if (this._CLOSEWHENGOOUT) window.removeEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); else this._sidebar_splitter.removeEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); if (this._KEEP_SIZES) window.removeEventListener("resize", this, false); if (this._SIDEBARPOSITION == "R"){ gBrowser.tabpanels.removeEventListener("mouseup", this, true); gBrowser.tabpanels.removeEventListener("mousedown", this, true); } //this._content.removeEventListener("mouseover", ucjs_expand_sidebar._mousemove, true); document.getElementById("browser").removeEventListener("mousemove", ucjs_expand_sidebar._mousemove, true); this._sidebar_box.removeEventListener("mouseover", ucjs_expand_sidebar._mouseover, true); window.removeEventListener("dblclick", this, true); //window.removeEventListener("click", this, true); this._sidebar_splitter.removeEventListener("dragover", this, true); Services.obs.removeObserver(this, "private-browsing"); }, _back_url: null, _back_cachedurl: null, observe: function(aSubject, aTopic, aData) { var self = ucjs_expand_sidebar; if (aData == "enter") { self._back_url = self._sidebar_box.getAttribute("src"); if (self._back_url == "chrome://browser/content/web-panels.xul") { var b = self._sidebar.contentDocument.getElementById("web-panels-browser"); self._back_cachedurl = b.getAttribute("cachedurl"); } self._sidebar_box.setAttribute("src", "about:blank"); self._sidebar.setAttribute("src", "about:blank"); self._backup_lastcommand = self._lastcommand; } else if (aData == "exit") { self._lastcommand = self._backup_lastcommand; self._backup_lastcommand = null; self._sidebar.setAttribute("src", "about:blank"); if (self._back_url == "chrome://browser/content/web-panels.xul") { if (!!self._back_cachedurl) { b = self._sidebar.contentDocument.getElementById("web-panels-browser"); b.setAttribute("cachedurl", self._back_cachedurl); document.persist("web-panels-browser", "cachedurl"); self._back_cachedurl = null; } } self._sidebar_box.setAttribute("src", self._back_url); self._back_url = null; } }, handleEvent: function(event){ event = new XPCNativeWrapper(event); switch (event.type){ case "mouseup": if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = setTimeout(function(self) { self._mousedown = false; self._checkWindowSideOrNot(event); },this._SCROLLBAR_DELAY,this); break; case "mousedown": if (event.screenX < this._sidebar_splitter.screenX - this._TOLERANCE) break; this._mousedown = true; if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; this._clearOpenCloseTimer(); break; case "click": if (event.button != 2) { //return; } event.preventDefault(); case "dblclick": if(event.originalTarget != this._sidebar_splitter) return; event.preventDefault(); event.stopPropagation(); if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; SidebarUI.toggle(this._getDefaultCommandID()); this._openSidebar(this._getDefaultCommandID()); this._mousedown = false; break; case "dragover": if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; this._mousedown = false; if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if(!this._open_Timeout){ this._open_Timeout = setTimeout(function(self){ var hidden = (self._sidebar_box.hasAttribute('hidden')?true:false) || self._sidebar_box.getAttribute('collapsed') == "true"; if (hidden) { SidebarUI.toggle(self._getDefaultCommandID(), true); self._openSidebar(self._getDefaultCommandID(), true); } }, this._OPEN_DELAY_DRAGOVER, this); } break; case "resize": if (this._FLOATING_SIDEBAR) { /* this._loadKeepItSizes(); if (this._resizeTimer) clearTimeout(this._resizeTimer); this._resizeTimer = setTimeout(() => {this._loadKeepItSizes();},250) */ return; } if (this._resizeTimer) clearTimeout(this._resizeTimer); if (this._startup) { this._startup = false; return; } this._resizeTimer = setTimeout(function(self) { //Wenn die Seitenleiste geöffnet ist, Größe speichern var hidden = self._sidebar_box.hasAttribute('hidden') ? true : false; if (!hidden && self._sidebar_box.getAttribute('collapsed') != "true" ) { var size = self._sidebar_box.getBoundingClientRect().width; //Aktuellen Befehl ermitteln.(get) var _command = self.getCommandId(); if (!!_command){ self._saveKeepItSizes(_command, size); } } }, 500, this); break; } }, //Getrennt, um die Last zu reduzieren _mouseover: function(event){ ucjs_expand_sidebar._checkWindowSideOrNot(event); }, _mousemove: function(event){ var self = ucjs_expand_sidebar; //self.debug(event); if (self._mtimer) return; self._mtimer = true; setTimeout(function(self){ self._mtimer = false; }, self._MOUSEMOVEINTERVAL, self); //self..debug("_mousemove " +event.originalTarget); if (event.originalTarget == self._sidebar_splitter) { self._checkWindowSideOrNot(event); return; } //self.debug("_mousemove self._mousedown=" +self._mousedown); if (self._mousedown) { return; } self._checkWindowSideOrNot(event); }, _mouseout: function(event){ var self = ucjs_expand_sidebar; if (self._mouse_Timeout) clearTimeout(self._mouse_Timeout); self._mouse_Timeout = null; //keine Aktion direkt nach dem öffnen if (self._opend) return; //Beim Überfahren des Fensterrandes Seitenleiste nicht öffnen if(!self._CLOSEWHENGOOUT){ if (self._sidebar_splitter == event.originalTarget){ if (self._open_Timeout) clearTimeout(self._open_Timeout); self._open_Timeout = null; } return; } //Wenn diese Option aktiviert ist, Seitenleiste nicht schließen if (self._checkbox.checked) return; if (/^menu|browser|tooltip/.test(event.originalTarget.localName)) return; if (self._sidebar.contentWindow.location.href == "chrome://browser/content/web-panels.xul") return; if (!self._close_Timeout) { //self.debug(event.type + " " + event.originalTarget.localName + " " + event.target.localName ); if (self._open_Timeout) clearTimeout(self._open_Timeout); self._open_Timeout = null; self._close_Timeout = setTimeout(function(self){ self._mousedown = false; self.toggleSidebar(); }, self._CLOSE_DELAY, self); } }, //Aktuellen Befehl ermitteln.(get) getCommandId: function(){ return SidebarUI._box.getAttribute("sidebarcommand"); }, toggleSidebar: function expandsidebartoggleSidebar(commandID, forceOpen = false) { if (this._FLOATING_SIDEBAR) { let x = document.getElementById("appcontent").getBoundingClientRect().x; this._sidebar_box.style.setProperty("left", x + "px", ""); this._sidebar.style.setProperty("left", x - 1 + "px", ""); } if (forceOpen) { SidebarUI.show(commandID); } else { SidebarUI.toggle(commandID); } }, _loadKeepItSizes: function(_command){ if (this._KEEP_SIZES) { if (!_command) _command = this.getCommandId(); if(!!_command) { this.sizes = this.getPref(this.prefKeepItSizes, 'str', 'viewBookmarksSidebar|178|viewHistorySidebar|286|viewGrepSidebar|157|viewUpdateScanSidebar|230|viewWebPanelsSidebar|371|viewWebPageSidebar|371|viewScrapBookSidebar|182|viewAdd-onsSidebar|371|viewStylishSidebar|379|viewMozgestSidebar|234|viewConsole2Sidebar|234|viewGoogleTransitSidebar|371|viewGoogleDocSidebar|371|viewIGoogleSidebar|371|viewPasswordManagerSidebar|371').split('|'); var index = this.sizes.indexOf(_command); if (index < 0 ){ this.sizes.push(_command); index = this.sizes.length - 1; this.sizes.push(this._defaultWidth); } if (this.sizes[index + 1] <= 0) this.sizes[index + 1] = this._defaultWidth if (this._FLOATING_SIDEBAR) { this._sidebar_box.style.setProperty('width', this.sizes[index + 1] + "px", ""); this._sidebar.style.setProperty('width', this.sizes[index + 1] - 1 + "px", ""); } else this._sidebar_box.style.setProperty('width', this.sizes[index + 1] + "px", ""); return; } } if (this._sidebar_box.getBoundingClientRect().width == 0) { if (this._FLOATING_SIDEBAR) { this._sidebar_box.style.setProperty('width', this._defaultWidth + "px", ""); this._sidebar.style.setProperty('width', this._defaultWidth - 1 + "px", ""); } else { this._sidebar_box.style.setProperty('width', this._defaultWidth + "px", ""); } } }, _saveKeepItSizes: function(_command, size){ if (!this._KEEP_SIZES) return; if (!!_command && size) { //this.debug(_command + " "+ size); var index = this.sizes.indexOf(_command); if (index < 0 ){ this.sizes.push(_command); this.sizes.push(size); } else { this.sizes[index + 1] = size; } var str = this.sizes.join('|'); this.setPref(this.prefKeepItSizes, 'str', str); } }, _openSidebar: function(_command, _forceOpen){ this._clearOpenCloseTimer(); //this.toggleSidebar(_command, _forceOpen); //Flag, ob mouseout sofort nach dem Öffnen als true verarbeitet werden soll oder nicht this._opend = true; if(this._mouseoutTimer) clearTimeout(this._mouseoutTimer); //Auf „false“ setzen, damit mouseout nach 200 ms nach dem Öffnen verarbeitet werden kann this._mouseoutTimer = setTimeout(function(that){that._opend = false;},300,this); }, _focused: function(){ //Suchfeld fokussieren wenn vorhanden var doc = this._sidebar.contentWindow.document; if (doc) { var elem = doc.getElementById("search-box"); if (elem) { try { setTimeout(function(doc, elem){ doc.defaultView.focus(); elem.focus(); }, 0, doc, elem) } catch(e) {} } } }, _getDefaultCommandID: function(_command){ if(!_command) _command = this._lastcommand; if(!_command) _command = this._DEFAULTCOMMAND; return _command; }, _clearOpenCloseTimer: function() { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; }, _checkMouseIsWindowEdge: function(x) { var sw = this._sidebar_splitter.getBoundingClientRect().width; if (this._SIDEBARPOSITION == "L") { //Linker Rand des Fensters x Koordinaten if ( 0 <= x && x <= sw + this._TOLERANCE) return true; }else if(this._SIDEBARPOSITION == "R") { //Rechter Rand des Fensters x Koordinaten if (-this._TOLERANCE <= x && x <= sw) return true; } return false; }, _checkMouseIsSidebarEdge: function(x){ var sw = this._sidebar_splitter.getBoundingClientRect().width; //this.debug("_checkMouseIsSidebarEdge " +(sw + this._TOLERANCE+"px ") + (x+"px ")); if (this._SIDEBARPOSITION == "L") { //Linker Rand des Fensters x Koordinaten if(sw + this._TOLERANCE < x) return true; } else if(this._SIDEBARPOSITION == "R") { //Rechter Rand des Fensters x Koordinaten if (x < -this._TOLERANCE) return true; } return false; }, _checkWindowSideOrNot: function(event){ var sidebar_box = this._sidebar_box; if (sidebar_box.getBoundingClientRect().width == 0) { sidebar_box.style.setProperty('width', this._defaultWidth + "px", "");//Seitenleiste Standardbreite this._sidebar.style.setProperty('width', this._defaultWidth - 1 + "px", "");//Seitenleiste Standardbreite } //this.debug(event.target.localName); /* if(/tabbrowser/.test(event.target.localName)){ return } */ //Ob es außerhalb des oberen und unteren Bereichs des Inhaltsbereichs liegt var y = event.screenY - gBrowser.tabpanels.screenY; if(y < 0 || y > gBrowser.tabpanels.getBoundingClientRect().height){ this._clearOpenCloseTimer(); return } //this.debug(event.type+"\n"+event.screenX+"\n"+this._sidebar_splitter.boxObject.screenX+"\n"+(event.target instanceof HTMLElement || /browser/.test(event.target.localName) )) var hidden = (sidebar_box.hasAttribute('hidden')?true:false) || sidebar_box.getAttribute('collapsed') == "true"; var x = event.screenX - this._sidebar_splitter.screenX; //Fensterrand ermitteln if (hidden) { if (event.originalTarget == this._sidebar_splitter || this._checkMouseIsWindowEdge(x)) { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if (!this._open_Timeout) { this._open_Timeout = setTimeout(function(self){ SidebarUI.toggle(self._getDefaultCommandID()); self._openSidebar(self._getDefaultCommandID()); }, this._OPEN_DELAY, this); } } else { if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; } return; } //X-Koordinate der Inhaltsseite der Seitenleiste if (!this._checkbox.checked && !hidden) { //this.debug("this.isChrome(event) "+ this.isChrome(event)); if (event.originalTarget != this._sidebar_splitter && this._checkMouseIsSidebarEdge(x) && !(this._DONOTCLOSE_XULELEMENT && this.isChrome(event)) /*|| (event.type == "mouseover" && (event.target instanceof HTMLElement || /browser/.test(event.target.localName)) )*/ ) { if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; if (this._close_Timeout || this._opend) return; this._close_Timeout = setTimeout(function(self){ self.toggleSidebar(); }, this._CLOSE_DELAY, this); } else { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; this._opend = false; } } }, isChrome: function(aEvent) { var x = aEvent.screenX; var y = aEvent.screenY; var sidebarBox = this._sidebar_box.getBoundingClientRect(); //userChrome_js.debug( this._sidebar_box.screenX <= x) //userChrome_js.debug( x <= this._sidebar_box.screenX + sidebarBox.width ) if (this._sidebar_box.screenX <= x && x <= this._sidebar_box.screenX + sidebarBox.width && this._sidebar_box.screenY <= y && y <= this._sidebar_box.screenY + sidebarBox.height) return true; //if (aEvent.target instanceof HTMLElement) // return false; if (/^(splitter|grippy|menu|panel|notification)/.test(aEvent.target.localName)) return true; var box = gBrowser.tabpanels.getBoundingClientRect(); var bx = gBrowser.tabpanels.screenX; var by = gBrowser.tabpanels.screenY; if (bx <= x && x <= bx + box.width && by <= y && y <= by + box.height) return false; else return true; }, //Einstellungen lesen getPref: function(aPrefString, aPrefType, aDefault){ var xpPref = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefBranch); try{ switch (aPrefType){ case 'complex': return xpPref.getComplexValue(aPrefString, Components.interfaces.nsILocalFile); break; case 'str': return xpPref.getCharPref(aPrefString).toString(); break; case 'int': return xpPref.getIntPref(aPrefString); break; case 'bool': default: return xpPref.getBoolPref(aPrefString); break; } }catch(e){ } return aDefault; }, //Einstellungen speichern setPref: function(aPrefString, aPrefType, aValue){ var xpPref = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefBranch); try{ switch (aPrefType){ case 'complex': return xpPref.setComplexValue(aPrefString, Components.interfaces.nsIFile, aValue); break; case 'str': return xpPref.setCharPref(aPrefString, aValue); break; case 'int': aValue = parseInt(aValue); return xpPref.setIntPref(aPrefString, aValue); break; case 'bool': default: return xpPref.setBoolPref(aPrefString, aValue); break; } }catch(e){ } return null; }, debug: function(aMsg){ // return; const Cc = Components.classes; const Ci = Components.interfaces; Cc["@mozilla.org/consoleservice;1"] .getService(Ci.nsIConsoleService) .logStringMessage(aMsg); } }; // Einstiegspunkt ucjs_expand_sidebar.init(); window.addEventListener("unload", function(){ ucjs_expand_sidebar.uninit(); }, false); var sidebarpopuppanelResize = { drag : false, size : null, offset : null, PREF_SIZE : "extensions.sidebarpopuppanelResize.size.", get isRTL() { return document.defaultView .getComputedStyle(document.getElementById("nav-bar"), "") .direction == "rtl"; }, get sidebar() { return document.getElementById("sidebar");; }, get sidebarbox() { return document.getElementById("sidebar-box");; }, get sidebarcommand() { return this.sidebarbox.getAttribute('sidebarcommand'); }, init: function(){ window.addEventListener("unload", this, false); this.SM_Observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { switch (mutation.attributeName) { case "style": let style = this.sidebarbox.getAttribute("style"); if (style.includes("width: 0px")) { ucjs_expand_sidebar._loadKeepItSizes(); } break; } }.bind(this)); }.bind(this)); // pass in the target node, as well as the observer options this.SM_Observer.observe(document.getElementById("sidebar-box"), {attribute: true, attributeFilter: ["style"]}); }, uninit: function(){ window.removeEventListener("unload", this, false); window.removeEventListener("mouseup", this, true); window.removeEventListener("mousemove", this, true); }, handleEvent: function (event) { switch (event.type) { case "load": this.init(); break; case "unload": this.uninit(); break; case "mouseup": this.mouseup(event); break; case "mousemove": if (this.timer) { clearTimeout(this.timer); } this.timer = setTimeout(function (event, self) { self.mousemove(event); }, 10, event, this); break; default:; } }, start: function(event){ this.drag = true; this.size = {height:parseInt(this.sidebarbox.getBoundingClientRect().height), width:parseInt(this.sidebarbox.getBoundingClientRect().width)}; this.offset = {x: event.screenX, y: event.screenY}; window.addEventListener("mouseup", this, true); window.addEventListener("mousemove", this, true); }, mouseup: function(event) { this.drag = false; window.removeEventListener("mousemove", this, true); window.removeEventListener("mouseup", this, true); ucjs_expand_sidebar._saveKeepItSizes(this.sidebarcommand, this.sidebarbox.getBoundingClientRect().width); }, mousemove: function(event) { if (this.drag) { var newValue; var h = this.sidebarbox.getBoundingClientRect().height; newValue = this.size.height + event.screenY - this.offset.y; if (newValue <= screen.height - 50 && newValue >= 10) { h = newValue; } var w = this.sidebarbox.getBoundingClientRect().width; if (this.isRTL) newValue = this.size.width - (event.screenX - this.offset.x); else newValue = this.size.width + event.screenX - this.offset.x; if (newValue <= screen.width && newValue >= 100) { w = newValue; } this.setSize(h, w); } }, setSize: function(h, w){ if (h && h + this.sidebarbox.screenY <= screen.height - 50 && h >= 10) { // this.sidebar.style.setProperty('height', h + "px", ""); } if (w && 0<=w ) { this.sidebar.style.setProperty('width', w - 1 + "px", ""); this.sidebarbox.style.setProperty('width', w + "px", ""); } } }; sidebarpopuppanelResize.init();
Für Firefox 107+
JavaScript
Alles anzeigen// ==UserScript== // @name expandsidebar_fx58.uc.js // @description Seitenleiste automatisches Öffnen und Schließen // @namespace http://forums.mozillazine.org/viewtopic.php?p=2592073#2592073 // @include main // @compatibility Firefox 107 // @author Alice0775 // @Note Seitenleistenposition bei _SIDEBARPOSITION wählbar (links oder rechts) // @Note Keyconfig und Mousegesten usw. SidebarUI.toggle (entsprechender Code); // @Note // @version 2022/10/14 20:00 sidebar width:100% // @version 2022/09/30 20:00 Bug 1792748 // @version 2022/09/14 11:00 box width:auto // @version 2022/08/26 Bug 1695435 - Remove @@hasInstance for IDL interfaces in chrome context // @version 2021/11/14 21:00 css // @version 2021/11/14 13:00 no longer close when print preview // @version 2021/09/30 22:00 change splitter color // @version 2020/12/14 00:00 vtb // @version 2020/07/14 00:00 style // @version 2019/12/09 18:00 fix 72 Bug 1582530 // @version 2019/12/05 18:00 fix 72 Bug 1492582 - browser.xhtml: Migrate root xul:window element to an html:html element // @version 2019/12/05 17:00 fix 71 Bug 1582530 - Turn on `layout.css.xul-box-display-values.survive-blockification.enabled` by default // @version 2019/12/05 10:00 fix 70 Bug 1558914 - Disable Array generics in Nightly // @version 2019/09/04 Fx69 // @version 2018/07/03 Fx61 fix regression from remove loadoverlay // @version 2018/07/03 Fx61 remove loadoverlay // @version 2018/06/25 Fx61 wip // @version 2018/01/25 Fx58 wip // @version 2017/11/18 Fx57 // @version 2017/11/18 nsIPrefBranch2 to nsIPrefBranch // @version 2017/02/01 00:00 enable floating(overlay) sidebar // @version 2017/01/19 00:00 change event phase,target // @version 2015/08/29 00:00 fix lastused command // @version 2015/05/13 19:00 fix lastused command // @version 2015/02/20 22:00 fix due to Bug 1123517 // @version 2014/10/31 22:00 fix due to Bug 714675 // @version 2014/05/22 12:00 fix var // @version 2013/03/03 00:00 fix It close too soon when it opened from a button or menu // @version 2013/02/26 00:00 fix close delay // @version 2012/12/08 22:30 Bug 788290 Bug 788293 Remove E4X // ==/UserScript== // @version 2012/08/04 09:00 private browsingを考慮 // @version 2012/08/04 09:00 hiddenではなくcollapsedを使うように // @version 2012/02/08 14:00 splitter width in full screen // @version 2011/05/26 12:00 5.0a2でマウスが要素上通過する時, 移動速度が速すぎるとmouseoverイベントが発火しない? 感度が落ちた? // @version 2011/03/24 12:00 ドラッグオーバー遅延を別設定とした // @version 2010/10/30 18:00 http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=84baf90b040c&tochange=16eac4b8b8e0 // @version 2010/10/09 18:00 Windows7 Aero // @version 2009/06/06 20:00 ドラッグオーバーで閉じてしまうので // @version 2009/05/24 18:00 chromeのチェック変更 // @version 2009/04/30 18:00 サイドバーを開閉したときは必ずタイマーをクリアするようにした。 // @version 2009/04/28 00:00 負荷軽減 // @version 2009/04/23 00:00 _KEEP_SIZESが動かなくなっていたので // @version 2009/04/22 12:00 ドラッグオーバーで開かなくなっていたので // @version 2009/04/15 21:00 マウスが通過したときは開かないが動かなくなっていたので // @version 2009/04/15 19:00 細々bug修正 // @version 2009/04/15 02:00 _CLOSEWHENGOOUTが動かなくなっていたので // @version 2009/04/14 22:00 fx2削除 var ucjs_expand_sidebar = { // --- config --- //Anfang Konfiguration _OPEN_DELAY: 300, //Zeitverzögerung zum Öffnen bei Mouseover _OPEN_DELAY_DRAGOVER: 400, //Zeitverzögerung zum Öffnen per Dragover _CLOSE_DELAY: 800, //Zeitverzögerung beim Schließen _SCROLLBAR_DELAY: 1000, //Zeitverzögerung der Bildlaufleiste beim Öffnen / Schließen _DEFAULTCOMMAND: "viewBookmarksSidebar", // Standardseitenleiste _TOLERANCE: 0, // Bereich, der als linke Kante des Fensters erkannt wird (0 kann bei Verwendung von TreeStyleTab usw. verwendet werden) _DONOTCLOSE_XULELEMENT: true, //Wenn sich die Maus auf einem XUL-Element befindet, nicht schließen //(Wird nicht geschlossen, selbst wenn XUL im Inhalt angezeigt wird) _CLOSEWHENGOOUT: false, //Wenn sich die Maus aus dem Fenster bewegt: true: schließen, [false]: nicht schließen _FLOATING_SIDEBAR: true, //Schwebende Seitenleiste (Überlagerung des Seiteninhalts) aktivieren, //(bekanntes Problem: Seitenleiste kann nicht skaliert werden = mit Maus breiter oder schmaler ziehen) _SIDEBARPOSITION: "L", //Seitenleistenposition Linke Seite: L Rechte Seite: R //VerticalToolbar.uc.js von Gomita - vertikale Symbolleiste 0.1 //(http://www.xuldev.org/blog/?p=113) muss zuerst ausgeführt werden! _KEEP_SIZES:true, //Breite für jeden Seitenleisten-Typ speichern _defaultWidth: 234, //Standardbreite der Seitenleiste _inFullscreen: true, //Bei Vollbild, Verhalten von Firefox 31 verwenden //Ende Konfiguration // --- config --- _MOUSEMOVEINTERVAL: 10, //Intervall zum Überprüfen der Mausposition _CHECKBOX_AT_STARUP:false, //Kontrollkästchen beim Start anzeigen _CLOSE_AT_STARTUP:true, //Seitenleiste beim Start geschlossen _lastcommand: null, _backup_lastcommand:null, _open_Timeout: null, _close_Timeout: null, _sidebar_box:null, _sidebar:null, _sidebar_splitter:null, _checkbox:null, _content:null, _opend:false, _mousedown:false, _mouse_Timeout: null, _resizeTimer: null, _mtimer: false, _startup:true, sizes:[], prefKeepItSizes: "userChrome.expandSidebar.keepItSizes", jsonToDOM: function(jsonTemplate, doc, nodes) { jsonToDOM.namespaces = { html: "http://www.w3.org/1999/xhtml", xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" }; jsonToDOM.defaultNamespace = jsonToDOM.namespaces.xul; function jsonToDOM(jsonTemplate, doc, nodes) { function namespace(name) { var reElemNameParts = /^(?:(.*):)?(.*)$/.exec(name); return { namespace: jsonToDOM.namespaces[reElemNameParts[1]], shortName: reElemNameParts[2] }; } // Note that 'elemNameOrArray' is: either the full element name (eg. [html:]div) or an array of elements in JSON notation function tag(elemNameOrArray, elemAttr) { // Array of elements? Parse each one... if (Array.isArray(elemNameOrArray)) { var frag = doc.createDocumentFragment(); Array.prototype.forEach.call(arguments, function(thisElem) { frag.appendChild(tag.apply(null, thisElem)); }); return frag; } // Single element? Parse element namespace prefix (if none exists, default to defaultNamespace), and create element var elemNs = namespace(elemNameOrArray); var elem = doc.createElementNS(elemNs.namespace || jsonToDOM.defaultNamespace, elemNs.shortName); // Set element's attributes and/or callback functions (eg. onclick) for (var key in elemAttr) { var val = elemAttr[key]; if (nodes && key == "keyvalue") { nodes[val] = elem; continue; } var attrNs = namespace(key); if (typeof val == "function") { // Special case for function attributes; don't just add them as 'on...' attributes, but as events, using addEventListener elem.addEventListener(key.replace(/^on/, ""), val, false); } else { // Note that the default namespace for XML attributes is, and should be, blank (ie. they're not in any namespace) elem.setAttributeNS(attrNs.namespace || "", attrNs.shortName, val); } } // Create and append this element's children var childElems = Array.prototype.slice.call(arguments, 2); childElems.forEach(function(childElem) { if (childElem != null) { elem.appendChild( doc.defaultView.Node.isInstance(childElem) /*childElem instanceof doc.defaultView.Node*/ ? childElem : Array.isArray(childElem) ? tag.apply(null, childElem) : doc.createTextNode(childElem)); } }); return elem; } return tag.apply(null, jsonTemplate); } return jsonToDOM(jsonTemplate, doc, nodes); }, init: function(){ if ("EzSidebarService" in window) return; this._sidebar_box = document.getElementById('sidebar-box'); var style = ` @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); #sidebar-checkbox { border: 1px solid currentColor !important; width: 16px !important; height: 16px !important; overflow-x: hidden !important; } #sidebar-splitter { -moz-box-align: center; -moz-box-pack: center; cursor: ew-resize; border-width: 0; border-style: solid; width: 2px; max-width: 2px; min-width: 0px; background-color: transparent; border-inline-start-color: var(--toolbar-bgcolor); border-inline-end-color: var(--toolbar-bgcolor); margin-left: 0px; margin-inline-start: 0px; } #navigator-toolbox[inFullscreen="true"] #sidebar-box[hidden="true"] + #sidebar-splitter, :root[inFullscreen="true"] #sidebar-box[hidden="true"] + #sidebar-splitter { width: 0px; max-width: 1px; min-width: 0px; border-left-width: 0px; border-right-width: 1px; background-color: ThreeDFace; } `; var sspi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css,' + encodeURIComponent(style) + '"' ); document.insertBefore(sspi, document.documentElement); sspi.getAttribute = function(name) { return document.documentElement.getAttribute(name); }; if (this._FLOATING_SIDEBAR) { // floating css var floatingStyle = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); #sidebar-box { position: fixed ; display: block; z-index: 55555; left: 4px; min-width: unset; max-width: unset; } :root:not([lwtheme-image]) #sidebar-box { background-color: var(--toolbar-bgcolor); } :root[lwtheme-image] #sidebar-box { background-color: var(--tabpanel-background-color); } #sidebar-box #sidebar-header { width :100%; } #sidebar-box #sidebar { height: calc(100vh - 230px); border-left:3px solid var(--toolbar-bgcolor); border-right:3px solid var(--toolbar-bgcolor); border-bottom:3px solid var(--toolbar-bgcolor); } #sidebar-box #sidebar:-moz-lwtheme { border-left:3px solid var(--sidebar-background-color); border-right:3px solid var(--sidebar-background-color); border-bottom:3px solid var(--sidebar-background-color); } #sidebar-box { border-right: 1px solid var(--sidebar-border-color); border-bottom: 1px solid var(--sidebar-border-color); } #sidebar-box:-moz-locale-dir(rtl) { border-left: 1px solid var(--sidebar-border-color); } #sidebar-box:-moz-lwtheme { background-color: var(--sidebar-background-color); } #sidebar-box sidebarheader:-moz-lwtheme { color: -moz-dialogtext; text-shadow: none; background-color: var(--sidebar-background-color); -moz-appearance: toolbox; border-bottom: 1px solid var(--sidebar-border-color); border-top: 1px solid var(--sidebar-border-color); } #sidebar-box #sidebarpopuppanel-bottom { background-color: var(--toolbar-bgcolor); width:100%; } #sidebar-box #sidebarpopuppanel-bottom:-moz-lwtheme { background-color: var(--sidebar-background-color); }`; if (this._SIDEBARPOSITION="L") { floatingStyle += ' #sidebar-box .PopupResizerGripper { \ list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABG0lEQVQ4jZXT2ytEURTH8U8UIjNESh5kQq4zGIpci+LBg8vkMhgkl+RhMo0Uf7yHWWo8jDlzXvbZv32+a63fr31o7WnHEDaxj6VW4TTW8YgHbLUC92E2wDKKWEgCtyEVcAEfsc6gJwmcxgpKqGIPExhAd7OxUwFf4QknmMYadrD8H/zruRTwEbLI4za0g0Zj13uuRud5ZGKaL7xiNYnnXUyqJV7EN05D+5NBI8+ToZ2jEnAeI+ht5nk+Op/jDfexX8NGvDf1XIzOd1jEXIRYxgX0J/D8W3Aaz/iM72cFfBljH2MMufBaCTgbWgHvOIschmE7Dg6jcypGLeAa4xiMIjdROBd6Xl1QGXSho+5wCp2hj6ndvlG1XzqPlx+JJSwSgQwohgAAAABJRU5ErkJggg=="); \ cursor: se-resize; \ }'; } else { floatingStyle += ' #sidebar-box:-moz-locale-dir(rtl) .PopupResizerGripper { \ list-style-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABIUlEQVQ4jZXRwUsUYRzG8Q8Jthi6SiKEB1lZJdvWXUtBKW3BIA8dajfSUjdlMSU6RFII9cd7mGdBPM3MYYaZ9/0983y/L7TxBluYwwMVry4+4UtCZjBRJWAZ7/EdQ7QwWyWkhlV8xJ+0aaVJKZzJbG5gPyFDBU69TEgTG+ikST84x0o6eZnaA4XQNj6o4OQpTnCNrwqp7TQp5eRhMPr4n5BucEo5qWEe6wm5xmEGSjlpZLiT6mf4mZBSTno4Deua4kTO7zkZt7vrpD4OWVKcwG9c4nn+PIiTY8VJreEt/mKEV1iQWwefcYNv2MnQAP/ufFtJg1+4wK5sbOY5zOJrLEbij/D38BjPgjbCO7jK8JOwHQVhGlPYxgE28/4o63t4cQuE/SwSa1JPlgAAAABJRU5ErkJggg=="); \ cursor: sw-resize; \ }'; } sspi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css,' + encodeURIComponent(floatingStyle) + '"' ); document.insertBefore(sspi, document.documentElement); sspi.getAttribute = function(name) { return document.documentElement.getAttribute(name); }; let template = ["hbox", {id: "sidebarpopuppanel-bottom"}, ["spacer", {flex: "1"}], ["image", {class: "PopupResizerGripper", onmousedown: "if (event.target == this) sidebarpopuppanelResize.start(event);"}] ]; document.getElementById('sidebar-box') .appendChild(this.jsonToDOM(template, document, {})); } if (this._sidebar_box.hasAttribute('hidden') || this._CLOSE_AT_STARTUP) { this._sidebar_box.collapsed = true; } this._sidebar_box.hidden = false; this._sidebar = document.getElementById('sidebar'); this._sidebar_splitter = document.getElementById('sidebar-splitter'); if (this._sidebar_splitter.hasAttribute('hidden')) { this._sidebar_splitter.removeAttribute('hidden'); } this._sidebar_splitter.removeAttribute('state'); this._sidebar_splitter.removeAttribute('collapsed'); var checkbox = document.createXULElement('checkbox'); var item = document.getElementById('sidebar-throbber'); this._checkbox = item.parentNode.insertBefore(checkbox, item); checkbox.setAttribute("id", "sidebar-checkbox"); checkbox.setAttribute("type", "checkbox"); checkbox.setAttribute("label", ""); checkbox.setAttribute('persist','checked'); checkbox.checked = this._CHECKBOX_AT_STARUP; if(this._SIDEBARPOSITION == "R"){ (function(self){ //this code from http://pc11.2ch.net/test/read.cgi/software/1185343069/128 self._sidebar_splitter = self._sidebar_box.parentNode.appendChild(self._sidebar_splitter); self._sidebar_box = self._sidebar_box.parentNode.appendChild(self._sidebar_box); })(this); } window.PrintUtils.printPreview_org = PrintUtils.printPreview; PrintUtils.printPreview = function(arg) { if(document.getElementById("sidebar-box") && !!document.getElementById("sidebar-box").getAttribute("sidebarcommand")) { if (window.ucjs_expand_sidebar._FLOATING_SIDEBAR) SidebarUI.hide(); } window.PrintUtils.printPreview_org(arg); }; /** * helper functions */ function accessorDescriptor(field, fun) { var desc = { enumerable: true, configurable: true }; desc[field] = fun; return desc; } function defineGetter(obj, prop, get) { if (Object.defineProperty) return Object.defineProperty(obj, prop, accessorDescriptor("get", get)); if (Object.prototype.__defineGetter__) return obj.__defineGetter__(prop, get); throw new Error("browser does not support getters"); } function defineSetter(obj, prop, set) { if (Object.defineProperty) return Object.defineProperty(obj, prop, accessorDescriptor("set", set)); if (Object.prototype.__defineSetter__) return obj.__defineSetter__(prop, set); throw new Error("browser does not support setters"); } /** * hack */ defineGetter(SidebarUI, "isOpen", function isOpen(){return this._box && !this._box.collapsed;}) SidebarUI.show_org = SidebarUI.show; SidebarUI.show = function show(commandID, triggerNode) { //this._box.hidden = false; this._box.collapsed = false; this._splitter.hidden = false; ucjs_expand_sidebar._loadKeepItSizes(commandID); ucjs_expand_sidebar._lastcommand = commandID; ucjs_expand_sidebar._opend = true; if (ucjs_expand_sidebar._FLOATING_SIDEBAR) { let x = document.getElementById("appcontent").getBoundingClientRect().x; ucjs_expand_sidebar._sidebar_box.style.setProperty("left", x + "px", ""); } SidebarUI.show_org(commandID, triggerNode); } SidebarUI.hide_org = SidebarUI.hide; SidebarUI.hide = function hide(triggerNode) { if (!this.isOpen) { return; } ucjs_expand_sidebar._saveKeepItSizes(ucjs_expand_sidebar._lastcommand); this._box.collapsed = true; if ("treeStyleTab" in gBrowser) gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_WINDOW_RESIZE); gBrowser.selectedBrowser.focus(); //SidebarUI.hide(triggerNode); } //Fokussierte Aktion der Seitenleisten ausführen // if (typeof fireSidebarFocusedEvent == "function") { window.fireSidebarFocusedEvent_org = fireSidebarFocusedEvent; fireSidebarFocusedEvent = function () { fireSidebarFocusedEvent_org(); ucjs_expand_sidebar._focused(); } } if (typeof SidebarUI._fireFocusedEvent == "function") { SidebarUI._fireFocusedEvent_org = SidebarUI._fireFocusedEvent; SidebarUI._fireFocusedEvent = function () { SidebarUI._fireFocusedEvent_org(); ucjs_expand_sidebar._focused(); } } //Beim Start Seitenleiste geschlossen halten? setTimeout(function(self) { var command = self._sidebar_box.getAttribute("sidebarcommand"); if (command) self._lastcommand = command; var broadcasters = document.getElementsByAttribute("group", "sidebar"); if (self._CLOSE_AT_STARTUP) { SidebarUI.hide(); //self._sidebar_box.setAttribute('collapsed',true); for (var i = 0; i < broadcasters.length; ++i) { if (broadcasters[i].localName != "broadcaster") { continue; } broadcasters[i].removeAttribute("checked"); } } else { for (var i = 0; i < broadcasters.length; ++i) { if (broadcasters[i].localName != "broadcaster") { continue; } if (broadcasters[i].hasAttribute("checked")) { self._loadKeepItSizes(); break;; } } } }, 500, this); this._sidebar.style.removeProperty('max-width'); this._sidebar.style.removeProperty('min-width'); this._sidebar.style.setProperty('width', '100%', ''); this._content = document.getElementById("content"); if (this._CLOSEWHENGOOUT) window.addEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); else this._sidebar_splitter.addEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); if (this._KEEP_SIZES) window.addEventListener("resize", this, false); if (this._SIDEBARPOSITION == "R"){ gBrowser.tabpanels.addEventListener("mouseup", this, true); gBrowser.tabpanels.addEventListener("mousedown", this, true); } //this._content.addEventListener("mouseover", ucjs_expand_sidebar._mousemove, true); document.getElementById("browser").addEventListener("mousemove", ucjs_expand_sidebar._mousemove, true); this._sidebar_box.addEventListener("mouseover", ucjs_expand_sidebar._mouseover, true); window.addEventListener("dblclick", this, true); //window.addEventListener("click", this, true); this._sidebar_splitter.addEventListener("dragover", this, true); Services.obs.addObserver(this, "private-browsing", false); }, uninit: function(){ if (this._CLOSEWHENGOOUT) window.removeEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); else this._sidebar_splitter.removeEventListener("mouseout", ucjs_expand_sidebar._mouseout, true); if (this._KEEP_SIZES) window.removeEventListener("resize", this, false); if (this._SIDEBARPOSITION == "R"){ gBrowser.tabpanels.removeEventListener("mouseup", this, true); gBrowser.tabpanels.removeEventListener("mousedown", this, true); } //this._content.removeEventListener("mouseover", ucjs_expand_sidebar._mousemove, true); document.getElementById("browser").removeEventListener("mousemove", ucjs_expand_sidebar._mousemove, true); this._sidebar_box.removeEventListener("mouseover", ucjs_expand_sidebar._mouseover, true); window.removeEventListener("dblclick", this, true); //window.removeEventListener("click", this, true); this._sidebar_splitter.removeEventListener("dragover", this, true); Services.obs.removeObserver(this, "private-browsing"); }, _back_url: null, _back_cachedurl: null, observe: function(aSubject, aTopic, aData) { var self = ucjs_expand_sidebar; if (aData == "enter") { self._back_url = self._sidebar_box.getAttribute("src"); if (self._back_url == "chrome://browser/content/web-panels.xul") { var b = self._sidebar.contentDocument.getElementById("web-panels-browser"); self._back_cachedurl = b.getAttribute("cachedurl"); } self._sidebar_box.setAttribute("src", "about:blank"); self._sidebar.setAttribute("src", "about:blank"); self._backup_lastcommand = self._lastcommand; } else if (aData == "exit") { self._lastcommand = self._backup_lastcommand; self._backup_lastcommand = null; self._sidebar.setAttribute("src", "about:blank"); if (self._back_url == "chrome://browser/content/web-panels.xul") { if (!!self._back_cachedurl) { b = self._sidebar.contentDocument.getElementById("web-panels-browser"); b.setAttribute("cachedurl", self._back_cachedurl); document.persist("web-panels-browser", "cachedurl"); self._back_cachedurl = null; } } self._sidebar_box.setAttribute("src", self._back_url); self._back_url = null; } }, handleEvent: function(event){ event = new XPCNativeWrapper(event); switch (event.type){ case "mouseup": if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = setTimeout(function(self) { self._mousedown = false; self._checkWindowSideOrNot(event); },this._SCROLLBAR_DELAY,this); break; case "mousedown": if (event.screenX < this._sidebar_splitter.screenX - this._TOLERANCE) break; this._mousedown = true; if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; this._clearOpenCloseTimer(); break; case "click": if (event.button != 2) { //return; } event.preventDefault(); case "dblclick": if(event.originalTarget != this._sidebar_splitter) return; event.preventDefault(); event.stopPropagation(); if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; SidebarUI.toggle(this._getDefaultCommandID()); this._openSidebar(this._getDefaultCommandID()); this._mousedown = false; break; case "dragover": if (this._mouse_Timeout) clearTimeout(this._mouse_Timeout); this._mouse_Timeout = null; this._mousedown = false; if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if(!this._open_Timeout){ this._open_Timeout = setTimeout(function(self){ var hidden = (self._sidebar_box.hasAttribute('hidden')?true:false) || self._sidebar_box.getAttribute('collapsed') == "true"; if (hidden) { SidebarUI.toggle(self._getDefaultCommandID(), true); self._openSidebar(self._getDefaultCommandID(), true); } }, this._OPEN_DELAY_DRAGOVER, this); } break; case "resize": if (this._FLOATING_SIDEBAR) { /* this._loadKeepItSizes(); if (this._resizeTimer) clearTimeout(this._resizeTimer); this._resizeTimer = setTimeout(() => {this._loadKeepItSizes();},250) */ return; } if (this._resizeTimer) clearTimeout(this._resizeTimer); if (this._startup) { this._startup = false; return; } this._resizeTimer = setTimeout(function(self) { //Wenn die Seitenleiste geöffnet ist, Größe speichern var hidden = self._sidebar_box.hasAttribute('hidden') ? true : false; if (!hidden && self._sidebar_box.getAttribute('collapsed') != "true" ) { var size = self._sidebar_box.getBoundingClientRect().width; //Aktuellen Befehl ermitteln.(get) var _command = self.getCommandId(); if (!!_command){ self._saveKeepItSizes(_command, size); } } }, 500, this); break; } }, //Getrennt, um die Last zu reduzieren _mouseover: function(event){ ucjs_expand_sidebar._checkWindowSideOrNot(event); }, _mousemove: function(event){ var self = ucjs_expand_sidebar; //self.debug(event); if (self._mtimer) return; self._mtimer = true; setTimeout(function(self){ self._mtimer = false; }, self._MOUSEMOVEINTERVAL, self); //self..debug("_mousemove " +event.originalTarget); if (event.originalTarget == self._sidebar_splitter) { self._checkWindowSideOrNot(event); return; } //self.debug("_mousemove self._mousedown=" +self._mousedown); if (self._mousedown) { return; } self._checkWindowSideOrNot(event); }, _mouseout: function(event){ var self = ucjs_expand_sidebar; if (self._mouse_Timeout) clearTimeout(self._mouse_Timeout); self._mouse_Timeout = null; //keine Aktion direkt nach dem öffnen if (self._opend) return; //Beim Überfahren des Fensterrandes Seitenleiste nicht öffnen if(!self._CLOSEWHENGOOUT){ if (self._sidebar_splitter == event.originalTarget){ if (self._open_Timeout) clearTimeout(self._open_Timeout); self._open_Timeout = null; } return; } //Wenn diese Option aktiviert ist, Seitenleiste nicht schließen if (self._checkbox.checked) return; if (/^menu|browser|tooltip/.test(event.originalTarget.localName)) return; if (self._sidebar.contentWindow.location.href == "chrome://browser/content/web-panels.xul") return; if (!self._close_Timeout) { //self.debug(event.type + " " + event.originalTarget.localName + " " + event.target.localName ); if (self._open_Timeout) clearTimeout(self._open_Timeout); self._open_Timeout = null; self._close_Timeout = setTimeout(function(self){ self._mousedown = false; self.toggleSidebar(); }, self._CLOSE_DELAY, self); } }, //Aktuellen Befehl ermitteln.(get) getCommandId: function(){ return SidebarUI._box.getAttribute("sidebarcommand"); }, toggleSidebar: function expandsidebartoggleSidebar(commandID, forceOpen = false) { if (this._FLOATING_SIDEBAR) { let x = document.getElementById("appcontent").getBoundingClientRect().x; this._sidebar_box.style.setProperty("left", x + "px", ""); this._sidebar.style.setProperty("left", x - 1 + "px", ""); } if (forceOpen) { SidebarUI.show(commandID); } else { SidebarUI.toggle(commandID); } }, _loadKeepItSizes: function(_command){ if (this._KEEP_SIZES) { if (!_command) _command = this.getCommandId(); if(!!_command) { this.sizes = this.getPref(this.prefKeepItSizes, 'str', 'viewBookmarksSidebar|178|viewHistorySidebar|286|viewGrepSidebar|157|viewUpdateScanSidebar|230|viewWebPanelsSidebar|371|viewWebPageSidebar|371|viewScrapBookSidebar|182|viewAdd-onsSidebar|371|viewStylishSidebar|379|viewMozgestSidebar|234|viewConsole2Sidebar|234|viewGoogleTransitSidebar|371|viewGoogleDocSidebar|371|viewIGoogleSidebar|371|viewPasswordManagerSidebar|371').split('|'); var index = this.sizes.indexOf(_command); if (index < 0 ){ this.sizes.push(_command); index = this.sizes.length - 1; this.sizes.push(this._defaultWidth); } if (this.sizes[index + 1] <= 0) this.sizes[index + 1] = this._defaultWidth if (this._FLOATING_SIDEBAR) { this._sidebar_box.style.setProperty('width', this.sizes[index + 1] + "px", ""); //this._sidebar.style.setProperty('width', this.sizes[index + 1] - 1 + "px", ""); } else this._sidebar_box.style.setProperty('width', this.sizes[index + 1] + "px", ""); return; } } if (this._sidebar_box.getBoundingClientRect().width == 0) { if (this._FLOATING_SIDEBAR) { this._sidebar_box.style.setProperty('width', this._defaultWidth + "px", ""); //this._sidebar.style.setProperty('width', this._defaultWidth - 1 + "px", ""); } else { this._sidebar_box.style.setProperty('width', this._defaultWidth + "px", ""); } } }, _saveKeepItSizes: function(_command, size){ if (!this._KEEP_SIZES) return; if (!!_command && size) { //this.debug(_command + " "+ size); var index = this.sizes.indexOf(_command); if (index < 0 ){ this.sizes.push(_command); this.sizes.push(size); } else { this.sizes[index + 1] = size; } var str = this.sizes.join('|'); this.setPref(this.prefKeepItSizes, 'str', str); } }, _openSidebar: function(_command, _forceOpen){ this._clearOpenCloseTimer(); //this.toggleSidebar(_command, _forceOpen); //Flag, ob mouseout sofort nach dem Öffnen als true verarbeitet werden soll oder nicht this._opend = true; if(this._mouseoutTimer) clearTimeout(this._mouseoutTimer); //Auf „false“ setzen, damit mouseout nach 200 ms nach dem Öffnen verarbeitet werden kann this._mouseoutTimer = setTimeout(function(that){that._opend = false;},300,this); }, _focused: function(){ //Suchfeld fokussieren wenn vorhanden var doc = this._sidebar.contentWindow.document; if (doc) { var elem = doc.getElementById("search-box"); if (elem) { try { setTimeout(function(doc, elem){ doc.defaultView.focus(); elem.focus(); }, 0, doc, elem) } catch(e) {} } } }, _getDefaultCommandID: function(_command){ if(!_command) _command = this._lastcommand; if(!_command) _command = this._DEFAULTCOMMAND; return _command; }, _clearOpenCloseTimer: function() { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; }, _checkMouseIsWindowEdge: function(x) { var sw = this._sidebar_splitter.getBoundingClientRect().width; if (this._SIDEBARPOSITION == "L") { //Linker Rand des Fensters x Koordinaten if ( 0 <= x && x <= sw + this._TOLERANCE) return true; }else if(this._SIDEBARPOSITION == "R") { //Rechter Rand des Fensters x Koordinaten if (-this._TOLERANCE <= x && x <= sw) return true; } return false; }, _checkMouseIsSidebarEdge: function(x){ var sw = this._sidebar_splitter.getBoundingClientRect().width; //this.debug("_checkMouseIsSidebarEdge " +(sw + this._TOLERANCE+"px ") + (x+"px ")); if (this._SIDEBARPOSITION == "L") { //Linker Rand des Fensters x Koordinaten if(sw + this._TOLERANCE < x) return true; } else if(this._SIDEBARPOSITION == "R") { //Rechter Rand des Fensters x Koordinaten if (x < -this._TOLERANCE) return true; } return false; }, _checkWindowSideOrNot: function(event){ var sidebar_box = this._sidebar_box; if (sidebar_box.getBoundingClientRect().width == 0) { sidebar_box.style.setProperty('width', this._defaultWidth + "px", "");//Seitenleiste Standardbreite //this._sidebar.style.setProperty('width', this._defaultWidth - 1 + "px", "");//Seitenleiste Standardbreite } //this.debug(event.target.localName); /* if(/tabbrowser/.test(event.target.localName)){ return } */ //Ob es außerhalb des oberen und unteren Bereichs des Inhaltsbereichs liegt var y = event.screenY - gBrowser.tabpanels.screenY; if(y < 0 || y > gBrowser.tabpanels.getBoundingClientRect().height){ this._clearOpenCloseTimer(); return } //this.debug(event.type+"\n"+event.screenX+"\n"+this._sidebar_splitter.boxObject.screenX+"\n"+(event.target instanceof HTMLElement || /browser/.test(event.target.localName) )) var hidden = (sidebar_box.hasAttribute('hidden')?true:false) || sidebar_box.getAttribute('collapsed') == "true"; var x = event.screenX - this._sidebar_splitter.screenX; //Fensterrand ermitteln if (hidden) { if (event.originalTarget == this._sidebar_splitter || this._checkMouseIsWindowEdge(x)) { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; if (!this._open_Timeout) { this._open_Timeout = setTimeout(function(self){ SidebarUI.toggle(self._getDefaultCommandID()); self._openSidebar(self._getDefaultCommandID()); }, this._OPEN_DELAY, this); } } else { if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; } return; } //X-Koordinaten der Inhaltsseite der Seitenleiste if (!this._checkbox.checked && !hidden) { //this.debug("this.isChrome(event) "+ this.isChrome(event)); if (event.originalTarget != this._sidebar_splitter && this._checkMouseIsSidebarEdge(x) && !(this._DONOTCLOSE_XULELEMENT && this.isChrome(event)) /*|| (event.type == "mouseover" && (event.target instanceof HTMLElement || /browser/.test(event.target.localName)) )*/ ) { if (this._open_Timeout) clearTimeout(this._open_Timeout); this._open_Timeout = null; if (this._close_Timeout || this._opend) return; this._close_Timeout = setTimeout(function(self){ self.toggleSidebar(); }, this._CLOSE_DELAY, this); } else { if (this._close_Timeout) clearTimeout(this._close_Timeout); this._close_Timeout = null; this._opend = false; } } }, isChrome: function(aEvent) { var x = aEvent.screenX; var y = aEvent.screenY; var sidebarBox = this._sidebar_box.getBoundingClientRect(); //userChrome_js.debug( this._sidebar_box.screenX <= x) //userChrome_js.debug( x <= this._sidebar_box.screenX + sidebarBox.width ) if (this._sidebar_box.screenX <= x && x <= this._sidebar_box.screenX + sidebarBox.width && this._sidebar_box.screenY <= y && y <= this._sidebar_box.screenY + sidebarBox.height) return true; //if (aEvent.target instanceof HTMLElement) // return false; if (/^(splitter|grippy|menu|panel|notification)/.test(aEvent.target.localName)) return true; var box = gBrowser.tabpanels.getBoundingClientRect(); var bx = gBrowser.tabpanels.screenX; var by = gBrowser.tabpanels.screenY; if (bx <= x && x <= bx + box.width && by <= y && y <= by + box.height) return false; else return true; }, //Einstellungen lesen getPref: function(aPrefString, aPrefType, aDefault){ var xpPref = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefBranch); try{ switch (aPrefType){ case 'complex': return xpPref.getComplexValue(aPrefString, Components.interfaces.nsILocalFile); break; case 'str': return xpPref.getCharPref(aPrefString).toString(); break; case 'int': return xpPref.getIntPref(aPrefString); break; case 'bool': default: return xpPref.getBoolPref(aPrefString); break; } }catch(e){ } return aDefault; }, //Einstellungen speichern setPref: function(aPrefString, aPrefType, aValue){ var xpPref = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefBranch); try{ switch (aPrefType){ case 'complex': return xpPref.setComplexValue(aPrefString, Components.interfaces.nsIFile, aValue); break; case 'str': return xpPref.setCharPref(aPrefString, aValue); break; case 'int': aValue = parseInt(aValue); return xpPref.setIntPref(aPrefString, aValue); break; case 'bool': default: return xpPref.setBoolPref(aPrefString, aValue); break; } }catch(e){ } return null; }, debug: function(aMsg){ // return; const Cc = Components.classes; const Ci = Components.interfaces; Cc["@mozilla.org/consoleservice;1"] .getService(Ci.nsIConsoleService) .logStringMessage(aMsg); } }; // Einstiegspunkt ucjs_expand_sidebar.init(); window.addEventListener("unload", function(){ ucjs_expand_sidebar.uninit(); }, false); var sidebarpopuppanelResize = { drag : false, size : null, offset : null, PREF_SIZE : "extensions.sidebarpopuppanelResize.size.", get isRTL() { return document.defaultView .getComputedStyle(document.getElementById("nav-bar"), "") .direction == "rtl"; }, get sidebar() { return document.getElementById("sidebar");; }, get sidebarbox() { return document.getElementById("sidebar-box");; }, get sidebarcommand() { return this.sidebarbox.getAttribute('sidebarcommand'); }, init: function(){ window.addEventListener("unload", this, false); this.SM_Observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { switch (mutation.attributeName) { case "style": let style = this.sidebarbox.getAttribute("style"); if (style.includes("width: 0px")) { ucjs_expand_sidebar._loadKeepItSizes(); } break; } }.bind(this)); }.bind(this)); // pass in the target node, as well as the observer options this.SM_Observer.observe(document.getElementById("sidebar-box"), {attribute: true, attributeFilter: ["style"]}); }, uninit: function(){ window.removeEventListener("unload", this, false); window.removeEventListener("mouseup", this, true); window.removeEventListener("mousemove", this, true); }, handleEvent: function (event) { switch (event.type) { case "load": this.init(); break; case "unload": this.uninit(); break; case "mouseup": this.mouseup(event); break; case "mousemove": if (this.timer) { clearTimeout(this.timer); } this.timer = setTimeout(function (event, self) { self.mousemove(event); }, 10, event, this); break; default:; } }, start: function(event){ this.checked = ucjs_expand_sidebar._checkbox.checked; ucjs_expand_sidebar._checkbox.checked = true; this.drag = true; this.size = {height:parseInt(this.sidebarbox.getBoundingClientRect().height), width:parseInt(this.sidebarbox.getBoundingClientRect().width)}; this.offset = {x: event.screenX, y: event.screenY}; window.addEventListener("mouseup", this, true); window.addEventListener("mousemove", this, true); }, mouseup: function(event) { ucjs_expand_sidebar._checkbox.checked = this.checked; this.drag = false; window.removeEventListener("mousemove", this, true); window.removeEventListener("mouseup", this, true); ucjs_expand_sidebar._saveKeepItSizes(this.sidebarcommand, this.sidebarbox.getBoundingClientRect().width); }, mousemove: function(event) { if (this.drag) { var newValue; var h = this.size.height; newValue = h + event.screenY - this.offset.y; if (newValue <= h - 50) { h = newValue; } var w = this.size.width; if (this.isRTL) newValue = w - (event.screenX - this.offset.x); else newValue = w + event.screenX - this.offset.x; if (newValue <= screen.width) { w = newValue; } this.setSize(h, w); } }, setSize: function(h, w){ if (h && h + this.sidebarbox.screenY <= screen.height - 50 && h >= 10) { // this.sidebar.style.setProperty('height', h + "px", ""); } if (w && 0<=w ) { this.sidebar.style.setProperty('width', w - 1 + "px", ""); this.sidebarbox.style.setProperty('width', w + "px", ""); } } }; sidebarpopuppanelResize.init();
Mfg.
Endor -
Vielen Dank!
-
Hi, seit Firefox 107.0 64-Bit/Win11 habe ich leider ein Problem mit dem Multitabrow-Skript 03-MultiRowTabLiteforFx.uc.js (Version 106)
Mit jedem neu geöffneten Tab wird eine leere, nicht sichtbare Tabzeile bzw. einfach Leerzeile unterhalb der obersten Tabzeile erzeugt.
Da ich 20...30 Tabs offen habe, stehen mir dann nur etwa <20% des Bildschirms für den Seiteninhalt zur Verfügung. Der Rest darüber bleibt leer/weiß.
Hat jemand eine Lösung für das Problem? Mit Firefox 106.x.x war noch alles komplett fehlerfrei.
Bei Bedarf kann ich Screenshots posten, falls das Problem so nicht erkennbar ist.
-
Hat jemand eine Lösung für das Problem?
Dazu gibt es inzwischen schon einige Anfragen hier
Teste bitte:
JavaScript
Alles anzeigen// ==UserScript== // @name zzzz-MultiRowTab_LiteforFx48.uc.js // @namespace http://space.geocities.yahoo.co.jp/gl/alice0775 // @description Experimentelle CSS Version für Mehrzeilige Tableiste // @include main // @compatibility Firefox 106 // @author Alice0775 // @version 2016/08/05 00:00 Firefox 48 // @version 2016/05/01 00:01 hide favicon if busy // @version 2016/03/09 00:01 Bug 1222490 - Actually remove panorama for Fx45+ // @version 2016/02/09 00:01 workaround css for lwt // @version 2016/02/09 00:00 // ==/UserScript== "use strict"; MultiRowTabLiteforFx(); function MultiRowTabLiteforFx() { var css =` @-moz-document url-prefix("chrome://browser/content/browser.xhtml") { /* Symbolleiste Sortieren */ #toolbar-menubar { -moz-box-ordinal-group: 1; } /* Menüleiste */ #nav-bar { -moz-box-ordinal-group: 2; } /* Navigationsleiste */ #PersonalToolbar { -moz-box-ordinal-group: 3; } /* Lesezeichenleiste */ #titlebar { -moz-box-ordinal-group: 4; } /* Tableiste */ /*Anpassung der Symbolleiste */ #titlebar,#tabbrowser-tabs { -moz-appearance: none !important; } /* Anpassung für Titelleistenschaltflächen */ #nav-bar > .titlebar-buttonbox-container .titlebar-button { width: 46px !important; } #toolbar-menubar:not([inactive]) ~ #nav-bar:not([inFullscreen]) > .titlebar-buttonbox-container { display: none !important; } /* Mehrzeilige Tableiste */ box.scrollbox-clip[orient="horizontal"] { display: block !important;contain: none !important; } box.scrollbox-clip[orient="horizontal"] > scrollbox { display: flex !important; flex-wrap: wrap !important; } .tabbrowser-tab[fadein]:not([pinned]) { flex-grow: 1 !important; } .tabbrowser-tab { height: calc(8px + var(--tab-min-height)); } .tabbrowser-tab > .tab-stack { width: 100% !important; } #TabsToolbar .toolbarbutton-1 { margin: 0 !important; } /* Ausblenden - Verstecken */ .tabbrowser-tab:not([fadein]),#alltabs-button { display: none !important; } /* --- Ziehbereich der Tab-Leiste --- */ /* Anpassung */ hbox.titlebar-spacer[type="pre-tabs"] { width: 0px !important; } /* Linker Ziehbereich: Standard 40px */ hbox.titlebar-spacer[type="post-tabs"] { width: 0px !important; } /* Rechter Ziehbereich: Standard 40px */ /* ↓ Wenn Sie die Auskommentierung links und rechts von unten stehenden CSS-Code entfernen und den CSS-Code aktivieren, können Sie den Ziehbereich links einblenden, der beim Maximieren des Fensters ausgeblendet wird. */ /* :root:not([sizemode="normal"]) hbox.titlebar-spacer[type="pre-tabs"] { display: block !important; } */ /* ↓ Wenn Sie die Auskommentierung links und rechts von unten stehenden CSS-Code entfernen und den CSS-Code aktivieren, können Sie den linken und rechten Ziehbereich einblenden, der im Vollbildmodus ausgeblendet wird. */ /* :root[inFullscreen] .titlebar-spacer { display: block !important; } */ } `; var sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService); var uri = makeURI('data:text/css;charset=UTF=8,' + encodeURIComponent(css)); sss.loadAndRegisterSheet(uri, sss.USER_SHEET); if(location.href !== 'chrome://browser/content/browser.xhtml') return; // Verschieben Sie die Menüleiste an den oberen Rand der Symbolleiste document.getElementById("titlebar").parentNode.insertBefore(document.getElementById("toolbar-menubar"),document.getElementById("titlebar")); // Titelleisten Schaltflächen in die Tableiste an den Rechten Rand verschieben document.getElementById("nav-bar").appendChild(document.querySelector("#TabsToolbar .titlebar-buttonbox-container")); // Scroll-Buttons und Spacer in der Tab-Leiste ausblenden shadowRoot gBrowser.tabContainer.arrowScrollbox.shadowRoot.getElementById('scrollbutton-up').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.getElementById('scrollbutton-down').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.querySelector('[part="overflow-start-indicator"]').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.querySelector('[part="overflow-end-indicator"]').style.display = "none"; // drag & drop & DropIndicator gBrowser.tabContainer.clearDropIndicator = function() { let tabs = this.allTabs; for (let i = 0, len = tabs.length; i < len; i++) { tabs[i].removeAttribute("style"); } } gBrowser.tabContainer.addEventListener("dragleave", function(event) { this.clearDropIndicator(event); }, true); gBrowser.tabContainer.on_dragover = function(event) { this.clearDropIndicator(); var effects = this.getDropEffectForTabDrag(event); event.preventDefault(); event.stopPropagation(); if (effects == "link") { let tab = this._getDragTargetTab(event, true); if (tab) { if (!this._dragTime) { this._dragTime = Date.now(); } if (Date.now() >= this._dragTime + this._dragOverDelay) { this.selectedItem = tab; } return; } } let newIndex = this._getDropIndex(event, effects == "link"); let children = this.allTabs; if (newIndex == children.length) { children[newIndex - 1].style.setProperty("box-shadow","-1px 0 0 red inset,1px 0 0 red","important"); } else { children[newIndex].style.setProperty("box-shadow","1px 0 0 red inset,-1px 0 0 red","important"); } } gBrowser.tabContainer.on_drop = function(event) { this.clearDropIndicator(); var dt = event.dataTransfer; var dropEffect = dt.dropEffect; var draggedTab; let movingTabs; if (dt.mozTypesAt(0)[0] == TAB_DROP_TYPE) { // tab copy or move draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); // not our drop then if (!draggedTab) { return; } movingTabs = draggedTab._dragData.movingTabs; draggedTab.container._finishGroupSelectedTabs(draggedTab); } this._tabDropIndicator.hidden = true; event.stopPropagation(); if (draggedTab && dropEffect == "copy") { // copy the dropped tab (wherever it's from) let newIndex = this._getDropIndex(event, false); let draggedTabCopy; for (let tab of movingTabs) { let newTab = gBrowser.duplicateTab(tab); gBrowser.moveTabTo(newTab, newIndex++); if (tab == draggedTab) { draggedTabCopy = newTab; } } if (draggedTab.container != this || event.shiftKey) { this.selectedItem = draggedTabCopy; } } else if (draggedTab && draggedTab.container == this) { let oldTranslateX = Math.round(draggedTab._dragData.translateX); let tabWidth = Math.round(draggedTab._dragData.tabWidth); let translateOffset = oldTranslateX % tabWidth; let newTranslateX = oldTranslateX - translateOffset; if (oldTranslateX > 0 && translateOffset > tabWidth / 2) { newTranslateX += tabWidth; } else if (oldTranslateX < 0 && -translateOffset > tabWidth / 2) { newTranslateX -= tabWidth; } let dropIndex; if (draggedTab._dragData.fromTabList) { dropIndex = this._getDropIndex(event, false); } else { dropIndex = this._getDropIndex(event, false); // "animDropIndex" in draggedTab._dragData && // draggedTab._dragData.animDropIndex; } let incrementDropIndex = true; if (dropIndex && dropIndex > movingTabs[0]._tPos) { dropIndex--; incrementDropIndex = false; } if (oldTranslateX && oldTranslateX != newTranslateX && !gReduceMotion) { for (let tab of movingTabs) { tab.setAttribute("tabdrop-samewindow", "true"); tab.style.transform = "translateX(" + newTranslateX + "px)"; let postTransitionCleanup = () => { tab.removeAttribute("tabdrop-samewindow"); this._finishAnimateTabMove(); if (dropIndex !== false) { gBrowser.moveTabTo(tab, dropIndex); if (incrementDropIndex) { dropIndex++; } } gBrowser.syncThrobberAnimations(tab); }; if (gReduceMotion) { postTransitionCleanup(); } else { let onTransitionEnd = transitionendEvent => { if ( transitionendEvent.propertyName != "transform" || transitionendEvent.originalTarget != tab ) { return; } tab.removeEventListener("transitionend", onTransitionEnd); postTransitionCleanup(); }; tab.addEventListener("transitionend", onTransitionEnd); } } } else { this._finishAnimateTabMove(); if (dropIndex !== false) { for (let tab of movingTabs) { gBrowser.moveTabTo(tab, dropIndex); if (incrementDropIndex) { dropIndex++; } } } } } else if (draggedTab) { // Move the tabs. To avoid multiple tab-switches in the original window, // the selected tab should be adopted last. const dropIndex = this._getDropIndex(event, false); let newIndex = dropIndex; let selectedTab; let indexForSelectedTab; for (let i = 0; i < movingTabs.length; ++i) { const tab = movingTabs[i]; if (tab.selected) { selectedTab = tab; indexForSelectedTab = newIndex; } else { const newTab = gBrowser.adoptTab(tab, newIndex, tab == draggedTab); if (newTab) { ++newIndex; } } } if (selectedTab) { const newTab = gBrowser.adoptTab( selectedTab, indexForSelectedTab, selectedTab == draggedTab ); if (newTab) { ++newIndex; } } // Restore tab selection gBrowser.addRangeToMultiSelectedTabs( gBrowser.tabs[dropIndex], gBrowser.tabs[newIndex - 1] ); } else { // Pass true to disallow dropping javascript: or data: urls let links; try { links = browserDragAndDrop.dropLinks(event, true); } catch (ex) {} if (!links || links.length === 0) { return; } let inBackground = Services.prefs.getBoolPref( "browser.tabs.loadInBackground" ); if (event.shiftKey) { inBackground = !inBackground; } let targetTab = this._getDragTargetTab(event, true); let userContextId = this.selectedItem.getAttribute("usercontextid"); let replace = !!targetTab; let newIndex = this._getDropIndex(event, true); let urls = links.map(link => link.url); let csp = browserDragAndDrop.getCSP(event); let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal( event ); (async () => { if ( urls.length >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn") ) { // Sync dialog cannot be used inside drop event handler. let answer = await OpenInTabsUtils.promiseConfirmOpenInTabs( urls.length, window ); if (!answer) { return; } } gBrowser.loadTabs(urls, { inBackground, replace, allowThirdPartyFixup: true, targetTab, newIndex, userContextId, triggeringPrincipal, csp, }); })(); } if (draggedTab) { delete draggedTab._dragData; } } gBrowser.tabContainer._getDropIndex = function(event, isLink) { var tabs = this.allTabs; var tab = this._getDragTargetTab(event, isLink); if (!RTL_UI) { for (let i = tab ? tab._tPos : 0; i < tabs.length; i++) { if ( event.screenY < tabs[i].screenY + tabs[i].getBoundingClientRect().height ) { if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i; } if ( event.screenX > tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 && event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width ) { return i + 1; } } } } else { for (let i = tab ? tab._tPos : 0; i < tabs.length; i++) { if ( event.screenY < tabs[i].screenY + tabs[i].getBoundingClientRect().height ) { if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width && event.screenX > tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i; } if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i + 1; } } } } return tabs.length; } }
-
Dazu gibt es inzwischen schon einige Anfragen hier
Heftig, was durch so ein Update für Supportanfragen generiert werden. Hätte ich nicht gedacht.
-
Heftig,
Das ist noch harmlos, weil ja nicht alle diese mehrzeiligen Leisten nutzen
-
Heftig, was durch so ein Update für Supportanfragen generiert werden. Hätte ich nicht gedacht.
Das ist vermutlich den Wenigsten so bewusst, aber was das tatsächlich offen legt, sind Verhaltensunterschiede, die zwischen der XUL- und der CSS-Flexbox existieren. Mozilla befindet sich nämlich im Prozess, seine alte und proprietäre XUL-Flexbox zu Gunsten der standardisierten CSS-Flexbox zu beerdigen. In Firefox 107 erfolgten hierfür einige Anpassungen, in Firefox 108 und Firefox 109 gehen diese Arbeiten weiter. Und es ist gut, dass diese Änderungen passieren. Denn anders als XUL entspricht die CSS-Flexbox einem gültigen Webstandard. Also etwas, was gut dokumentiert ist, von sehr vielen Menschen verstanden wird und wozu man im Web auch Hilfe erhält, wenn man Fragen hat. XUL stammt aus der Zeit der Dinosaurier. Tatsächlich, Mozilla hatte damals noch einen Dinosaurier als Logo. Individuelle Firefox-Anpassungen werden nachvollziehbarer, wenn sie mit gängigen Webstandards umgesetzt sind und keine Verhaltensweisen eines veralteten Nicht-Standards berücksichtigt werden müssen. Wenn Anpassungen nicht mehr richtig funktionieren, nervt das sicherlich erst einmal. Aber auf lange Sicht profitieren die Bastler aus meiner Sicht von solchen Anpassungen der Firefox-Interna.
-
Dazu gibt es inzwischen schon einige Anfragen hier
Hmpf, hier in diesem Thread? Ich schaue mir immer die neuesten Beiträge an (waren ja seit meinem Beitrag nicht so viele) und konnte nichts dazu finden?!
Teste bitte:
Funktioniert 1A, vielen Dank! Wann kommt das offiziell ins Repo?
-
Mozilla befindet sich nämlich im Prozess, seine alte und proprietäre XUL-Flexbox zu Gunsten der standardisierten CSS-Flexbox zu beerdigen. In Firefox 107 erfolgten hierfür einige Anpassungen, in Firefox 108 und Firefox 109 gehen diese Arbeiten weiter. Und es ist gut, dass diese Änderungen passieren.
Oh, das wusste ich so nicht. Aber ja, das ist dann natürlich sehr gut. Dann komme ich mit meinen CSS-Kenntnissen auch besser voran.
-
Vielen Dank!
Das Original skript hat bei mir zu leeren Pages geführt - Keine eizige seite wurde angezeigt.
Mit deinem Code gehts - was wurde da gegenüber dem Original geändert.
Hat jemand eine Lösung für das Problem?
Dazu gibt es inzwischen schon einige Anfragen hier
Teste bitte:
JavaScript
Alles anzeigen// ==UserScript== // @name zzzz-MultiRowTab_LiteforFx48.uc.js // @namespace http://space.geocities.yahoo.co.jp/gl/alice0775 // @description Experimentelle CSS Version für Mehrzeilige Tableiste // @include main // @compatibility Firefox 106 // @author Alice0775 // @version 2016/08/05 00:00 Firefox 48 // @version 2016/05/01 00:01 hide favicon if busy // @version 2016/03/09 00:01 Bug 1222490 - Actually remove panorama for Fx45+ // @version 2016/02/09 00:01 workaround css for lwt // @version 2016/02/09 00:00 // ==/UserScript== "use strict"; MultiRowTabLiteforFx(); function MultiRowTabLiteforFx() { var css =` @-moz-document url-prefix("chrome://browser/content/browser.xhtml") { /* Symbolleiste Sortieren */ #toolbar-menubar { -moz-box-ordinal-group: 1; } /* Menüleiste */ #nav-bar { -moz-box-ordinal-group: 2; } /* Navigationsleiste */ #PersonalToolbar { -moz-box-ordinal-group: 3; } /* Lesezeichenleiste */ #titlebar { -moz-box-ordinal-group: 4; } /* Tableiste */ /*Anpassung der Symbolleiste */ #titlebar,#tabbrowser-tabs { -moz-appearance: none !important; } /* Anpassung für Titelleistenschaltflächen */ #nav-bar > .titlebar-buttonbox-container .titlebar-button { width: 46px !important; } #toolbar-menubar:not([inactive]) ~ #nav-bar:not([inFullscreen]) > .titlebar-buttonbox-container { display: none !important; } /* Mehrzeilige Tableiste */ box.scrollbox-clip[orient="horizontal"] { display: block !important;contain: none !important; } box.scrollbox-clip[orient="horizontal"] > scrollbox { display: flex !important; flex-wrap: wrap !important; } .tabbrowser-tab[fadein]:not([pinned]) { flex-grow: 1 !important; } .tabbrowser-tab { height: calc(8px + var(--tab-min-height)); } .tabbrowser-tab > .tab-stack { width: 100% !important; } #TabsToolbar .toolbarbutton-1 { margin: 0 !important; } /* Ausblenden - Verstecken */ .tabbrowser-tab:not([fadein]),#alltabs-button { display: none !important; } /* --- Ziehbereich der Tab-Leiste --- */ /* Anpassung */ hbox.titlebar-spacer[type="pre-tabs"] { width: 0px !important; } /* Linker Ziehbereich: Standard 40px */ hbox.titlebar-spacer[type="post-tabs"] { width: 0px !important; } /* Rechter Ziehbereich: Standard 40px */ /* ↓ Wenn Sie die Auskommentierung links und rechts von unten stehenden CSS-Code entfernen und den CSS-Code aktivieren, können Sie den Ziehbereich links einblenden, der beim Maximieren des Fensters ausgeblendet wird. */ /* :root:not([sizemode="normal"]) hbox.titlebar-spacer[type="pre-tabs"] { display: block !important; } */ /* ↓ Wenn Sie die Auskommentierung links und rechts von unten stehenden CSS-Code entfernen und den CSS-Code aktivieren, können Sie den linken und rechten Ziehbereich einblenden, der im Vollbildmodus ausgeblendet wird. */ /* :root[inFullscreen] .titlebar-spacer { display: block !important; } */ } `; var sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService); var uri = makeURI('data:text/css;charset=UTF=8,' + encodeURIComponent(css)); sss.loadAndRegisterSheet(uri, sss.USER_SHEET); if(location.href !== 'chrome://browser/content/browser.xhtml') return; // Verschieben Sie die Menüleiste an den oberen Rand der Symbolleiste document.getElementById("titlebar").parentNode.insertBefore(document.getElementById("toolbar-menubar"),document.getElementById("titlebar")); // Titelleisten Schaltflächen in die Tableiste an den Rechten Rand verschieben document.getElementById("nav-bar").appendChild(document.querySelector("#TabsToolbar .titlebar-buttonbox-container")); // Scroll-Buttons und Spacer in der Tab-Leiste ausblenden shadowRoot gBrowser.tabContainer.arrowScrollbox.shadowRoot.getElementById('scrollbutton-up').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.getElementById('scrollbutton-down').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.querySelector('[part="overflow-start-indicator"]').style.display = "none"; gBrowser.tabContainer.arrowScrollbox.shadowRoot.querySelector('[part="overflow-end-indicator"]').style.display = "none"; // drag & drop & DropIndicator gBrowser.tabContainer.clearDropIndicator = function() { let tabs = this.allTabs; for (let i = 0, len = tabs.length; i < len; i++) { tabs[i].removeAttribute("style"); } } gBrowser.tabContainer.addEventListener("dragleave", function(event) { this.clearDropIndicator(event); }, true); gBrowser.tabContainer.on_dragover = function(event) { this.clearDropIndicator(); var effects = this.getDropEffectForTabDrag(event); event.preventDefault(); event.stopPropagation(); if (effects == "link") { let tab = this._getDragTargetTab(event, true); if (tab) { if (!this._dragTime) { this._dragTime = Date.now(); } if (Date.now() >= this._dragTime + this._dragOverDelay) { this.selectedItem = tab; } return; } } let newIndex = this._getDropIndex(event, effects == "link"); let children = this.allTabs; if (newIndex == children.length) { children[newIndex - 1].style.setProperty("box-shadow","-1px 0 0 red inset,1px 0 0 red","important"); } else { children[newIndex].style.setProperty("box-shadow","1px 0 0 red inset,-1px 0 0 red","important"); } } gBrowser.tabContainer.on_drop = function(event) { this.clearDropIndicator(); var dt = event.dataTransfer; var dropEffect = dt.dropEffect; var draggedTab; let movingTabs; if (dt.mozTypesAt(0)[0] == TAB_DROP_TYPE) { // tab copy or move draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); // not our drop then if (!draggedTab) { return; } movingTabs = draggedTab._dragData.movingTabs; draggedTab.container._finishGroupSelectedTabs(draggedTab); } this._tabDropIndicator.hidden = true; event.stopPropagation(); if (draggedTab && dropEffect == "copy") { // copy the dropped tab (wherever it's from) let newIndex = this._getDropIndex(event, false); let draggedTabCopy; for (let tab of movingTabs) { let newTab = gBrowser.duplicateTab(tab); gBrowser.moveTabTo(newTab, newIndex++); if (tab == draggedTab) { draggedTabCopy = newTab; } } if (draggedTab.container != this || event.shiftKey) { this.selectedItem = draggedTabCopy; } } else if (draggedTab && draggedTab.container == this) { let oldTranslateX = Math.round(draggedTab._dragData.translateX); let tabWidth = Math.round(draggedTab._dragData.tabWidth); let translateOffset = oldTranslateX % tabWidth; let newTranslateX = oldTranslateX - translateOffset; if (oldTranslateX > 0 && translateOffset > tabWidth / 2) { newTranslateX += tabWidth; } else if (oldTranslateX < 0 && -translateOffset > tabWidth / 2) { newTranslateX -= tabWidth; } let dropIndex; if (draggedTab._dragData.fromTabList) { dropIndex = this._getDropIndex(event, false); } else { dropIndex = this._getDropIndex(event, false); // "animDropIndex" in draggedTab._dragData && // draggedTab._dragData.animDropIndex; } let incrementDropIndex = true; if (dropIndex && dropIndex > movingTabs[0]._tPos) { dropIndex--; incrementDropIndex = false; } if (oldTranslateX && oldTranslateX != newTranslateX && !gReduceMotion) { for (let tab of movingTabs) { tab.setAttribute("tabdrop-samewindow", "true"); tab.style.transform = "translateX(" + newTranslateX + "px)"; let postTransitionCleanup = () => { tab.removeAttribute("tabdrop-samewindow"); this._finishAnimateTabMove(); if (dropIndex !== false) { gBrowser.moveTabTo(tab, dropIndex); if (incrementDropIndex) { dropIndex++; } } gBrowser.syncThrobberAnimations(tab); }; if (gReduceMotion) { postTransitionCleanup(); } else { let onTransitionEnd = transitionendEvent => { if ( transitionendEvent.propertyName != "transform" || transitionendEvent.originalTarget != tab ) { return; } tab.removeEventListener("transitionend", onTransitionEnd); postTransitionCleanup(); }; tab.addEventListener("transitionend", onTransitionEnd); } } } else { this._finishAnimateTabMove(); if (dropIndex !== false) { for (let tab of movingTabs) { gBrowser.moveTabTo(tab, dropIndex); if (incrementDropIndex) { dropIndex++; } } } } } else if (draggedTab) { // Move the tabs. To avoid multiple tab-switches in the original window, // the selected tab should be adopted last. const dropIndex = this._getDropIndex(event, false); let newIndex = dropIndex; let selectedTab; let indexForSelectedTab; for (let i = 0; i < movingTabs.length; ++i) { const tab = movingTabs[i]; if (tab.selected) { selectedTab = tab; indexForSelectedTab = newIndex; } else { const newTab = gBrowser.adoptTab(tab, newIndex, tab == draggedTab); if (newTab) { ++newIndex; } } } if (selectedTab) { const newTab = gBrowser.adoptTab( selectedTab, indexForSelectedTab, selectedTab == draggedTab ); if (newTab) { ++newIndex; } } // Restore tab selection gBrowser.addRangeToMultiSelectedTabs( gBrowser.tabs[dropIndex], gBrowser.tabs[newIndex - 1] ); } else { // Pass true to disallow dropping javascript: or data: urls let links; try { links = browserDragAndDrop.dropLinks(event, true); } catch (ex) {} if (!links || links.length === 0) { return; } let inBackground = Services.prefs.getBoolPref( "browser.tabs.loadInBackground" ); if (event.shiftKey) { inBackground = !inBackground; } let targetTab = this._getDragTargetTab(event, true); let userContextId = this.selectedItem.getAttribute("usercontextid"); let replace = !!targetTab; let newIndex = this._getDropIndex(event, true); let urls = links.map(link => link.url); let csp = browserDragAndDrop.getCSP(event); let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal( event ); (async () => { if ( urls.length >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn") ) { // Sync dialog cannot be used inside drop event handler. let answer = await OpenInTabsUtils.promiseConfirmOpenInTabs( urls.length, window ); if (!answer) { return; } } gBrowser.loadTabs(urls, { inBackground, replace, allowThirdPartyFixup: true, targetTab, newIndex, userContextId, triggeringPrincipal, csp, }); })(); } if (draggedTab) { delete draggedTab._dragData; } } gBrowser.tabContainer._getDropIndex = function(event, isLink) { var tabs = this.allTabs; var tab = this._getDragTargetTab(event, isLink); if (!RTL_UI) { for (let i = tab ? tab._tPos : 0; i < tabs.length; i++) { if ( event.screenY < tabs[i].screenY + tabs[i].getBoundingClientRect().height ) { if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i; } if ( event.screenX > tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 && event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width ) { return i + 1; } } } } else { for (let i = tab ? tab._tPos : 0; i < tabs.length; i++) { if ( event.screenY < tabs[i].screenY + tabs[i].getBoundingClientRect().height ) { if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width && event.screenX > tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i; } if ( event.screenX < tabs[i].screenX + tabs[i].getBoundingClientRect().width / 2 ) { return i + 1; } } } } return tabs.length; } }
-
was wurde da gegenüber dem Original geändert.
Zeile 34 erweitert um:
contain: none !important; }
-
Moin @all,
ich habe hier mal ein bisschen Javascript aufgeschnappt,
leider reicht das wohl nicht für mein Vorhaben.
Mein Problem:
Das hier funktioniert:
Code
Alles anzeigen(function() { if (location.href !== 'chrome://browser/content/browser.xhtml') return; const orig = document.getElementById('context_closeOtherTabs'); const clone = orig.cloneNode(); const ref = document.getElementById('context_closeTab'); setTimeout(() => { orig.setAttribute('label', 'Andere Tabs schließen (Orig)'); clone.setAttribute('label', 'Andere Tabs schließen (Clone)'); }, 7000); tabContextMenu.insertBefore(clone, ref.nextSibling); })();
Das hier nicht:
Code(function() { if (location.href !== 'chrome://browser/content/browser.xhtml') return; const orig = document.getElementById('saveforreadlater_gmail_com-menuitem-_saveIt'); const clone = orig.cloneNode(); const ref = document.getElementById('context-take-screenshot'); contentAreaContextMenu.insertBefore(clone, ref.nextSibling); })();
Meine Frage ist:
Sind Add-Ons von Veränderungen durch Javascript ausgeschlossen?
Oder ist im Script ein Fehler?
Vielen Dank aus dem regnerischen Schleswig-Holstein!
-
Sind Add-Ons von Veränderungen durch Javascript ausgeschlossen?
Add-ons sind nicht vor Veränderungen in JavaScript gefeit. Mozilla entwickelt Firefox und also auch die JavaScript-Basis. Daran müssen sich Add-on-Entwickler und Skripte-Entwickler halten, denn beide wollen ja Einfluss auf Firefox nehmen. Ändert Mozilla etwas in Firefox und ein Benutzerskript oder ein Add-on funktioniert dann nicht mehr, obliegt es dem jeweiligen Skript- bzw. Add-on-Entwickler sein Skript bzw. Add-on anzupassen.
-