Endor Welches CSS nutzt Du um a. Symbole vor die Einträge einzufügen?
Bitte poste doch mal das ganze CSS.
Beiträge von Mira_Belle
-
-
1. Ist meine Erklärung, die ja auch für andere sein soll, richtig.
2. Habe ich Dich auch richtig verstanden und stand mal seit langer Zeit nicht wieder neben mir!
Schön, dass Dir das Skript Freude bereitet. -
Du hast "reingeklickt"?
Also normal wird nur www.tagesschau.de, wobei www. "blasser" (halb transparent) dargestellt wird.
Klickt man in die Adresszeile, ist die URL markiert und drunter öffnet sich das Popup.Erst nach einem nochmaligen klicken wird "alles" sichtbar! => https://www.tagesschau.de/
Aber genau dieses Verhalten ist mit Skript nicht möglich.
Mit einem Fehler muss man dann halt leben.
Dafür ist die URL aber bunt und man kann noch weitere Dinge beeinflussen,
wie z.B. dass camp-firefox.de fett oder kursiv dargestellt werden soll. -
Das ist zu viel des Lobes!
Es ist ein Bug im Skript, den bekomme ich einfach nicht weg!
Normalerweise sollte die URL der Tagesschau so aussehen => https://www.tagesschau.de
Aber leider wird da am Ende mit dem Skript aber ein Slash angezeigt.
Und so ist es bei recht vielen Seiten!
Aber ich habe das ja so gemacht, weil ich "Deinen" Anforderungen gerecht werden wollte.
Wer sich nicht daran stört, dass bei anderen URLs, wo eigentlich am Ende ein Slash sein sollte,
es aber besser findet, dass die URL der Tagesschau ohne Slash am Ende dargestellt wird,
soll eben eine etwas älteren Version benutzen. z.B. jene :JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar.us.js // @version ? // @description dav_LinkifiesLocationBar // @based on https://github.com/sdavidg/firefoxChromeScripts/blob/main/scripts/dav_LinkifiesLocationBar.uc.js // @modified by Mira_Belle [https://www.camp-firefox.de/forum/] // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; function getWindow(){ return window; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var styleBase = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; height: 24px; width: 100%; line-height: 24px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } .claseLocationBar .label_pathname { margin-inline: unset !important; } locationBarTag{ display: inline; } /* Von mir hinzugefügt! */ .claseLocationBar span.protocol{ display: none; } /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; color: #777777; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; color: #C68007; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; } .claseLocationBar span.port{ color: #00aeff; } .claseLocationBar span.pathname{ color: #ffff00; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; } .claseLocationBar .extension{ color: #ffffff; } `; var style_pathnameArrow = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } .claseLocationBar .pathname:before{ content:'/'; font-weight: bold; margin-left: -10px; margin-right: 2px; color:rgb(0, 255, 128); } .claseLocationBar .pathname:after{ content:'/'; font-weight: bold; margin-left: 3px; margin-right: -9px; color:rgb(0, 255, 128); } .claseLocationBar .label_pathname{ display: none; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { if (!text) return; if(clase == "pathname") { let sp = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML:"/" } }); divLocationBar.appendChild(sp); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML:text }, }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if(urlGBrowser.startsWith("about")){ divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) != -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { console.error("Fehler beim Parsen der URL:", e); divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var partido = hostname.split("."); var subdomain; if(partido.length > 2 && !partido.every( v => v == v-0 ))//Es wird geprüf, ob es sich nicht um eine IP handelt (nur Zahlen) { subdomain = partido.splice(0, partido.length-2).join("."); hostname= partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain+".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } var arrayPathname = pathname.split("/"); arrayPathname.forEach((elto) => { if (elto) { let sp = appendPart(elto, "pathname"); let arrayDot = elto.split("."); if(arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href:sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href:sp.getAttribute("href"), innerHTML: "."+extension } })); } } }); appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function() { hideDivLocatonBar() } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; setInterval(function(){ let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(styleBase); CSS_Loader.load(style_pathnameArrow); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 50); -
Und hier nochmal mit "https://".
JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar.us.js // @version ? // @description dav_LinkifiesLocationBar // @based on https://github.com/sdavidg/firefoxChromeScripts/blob/main/scripts/dav_LinkifiesLocationBar.uc.js // @modified by Mira_Belle [https://www.camp-firefox.de/forum/] // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; function getWindow(){ return window; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var styleBase = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; height: 24px; width: 100%; line-height: 24px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } .claseLocationBar .label_pathname { margin-inline: unset !important; } locationBarTag{ display: inline; } /* Von mir hinzugefügt! */ /* .claseLocationBar span.protocol{ display: none; } */ /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; /* color: #777777; */ color: #fdbcd2; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; color: #C68007; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; } .claseLocationBar span.port{ color: #00aeff; } .claseLocationBar span.pathname{ color: #ffff00; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; } .claseLocationBar .extension{ color: #ffffff; } `; var style_pathnameArrow = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } .claseLocationBar .pathname:before{ content:'/'; font-weight: bold; margin-left: -10px; margin-right: 2px; color:rgb(0, 255, 128); } .claseLocationBar .label_pathname{ display: none; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { // Nur leere Strings abbrechen – außer bei pathname if (!text && clase !== "pathname") return; if (clase == "pathname") { let spSlash = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML: "/" } }); divLocationBar.appendChild(spSlash); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML: text || "" // Auch "" explizit anzeigen }, }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if (urlGBrowser.startsWith("about")) { divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) !== -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { console.error("Fehler beim Parsen der URL:", e); divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var partido = hostname.split("."); var subdomain; if (partido.length > 2 && !partido.every(v => v == v - 0)) { //Es wird geprüf, ob es sich nicht um eine IP handelt (nur Zahlen) subdomain = partido.splice(0, partido.length - 2).join("."); hostname = partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain + ".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } if (pathname === "/") { // Spezialfall: Nur ein einfacher Slash appendPart("", "pathname"); } else { let arrayPathname = pathname.split("/"); arrayPathname.forEach((elto, index) => { if (index === 0 && elto === "") return; // erstes leeres Element (vor dem ersten Slash) let sp = appendPart(elto, "pathname"); let arrayDot = elto.split("."); if (arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href: sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href: sp.getAttribute("href"), innerHTML: "." + extension } })); } }); } appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function() { hideDivLocatonBar() } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; setInterval(function(){ let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(styleBase); CSS_Loader.load(style_pathnameArrow); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 50); -
2002Andreas Bitte testen, ob Du noch fehlerhafte Darstellungen findest.
JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar.us.js // @version ? // @description dav_LinkifiesLocationBar // @based on https://github.com/sdavidg/firefoxChromeScripts/blob/main/scripts/dav_LinkifiesLocationBar.uc.js // @modified by Mira_Belle [https://www.camp-firefox.de/forum/] // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; function getWindow(){ return window; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var styleBase = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; height: 24px; width: 100%; line-height: 24px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } .claseLocationBar .label_pathname { margin-inline: unset !important; } locationBarTag{ display: inline; } /* Von mir hinzugefügt! */ .claseLocationBar span.protocol{ display: none; } /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; color: #777777; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; color: #C68007; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; } .claseLocationBar span.port{ color: #00aeff; } .claseLocationBar span.pathname{ color: #ffff00; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; } .claseLocationBar .extension{ color: #ffffff; } `; var style_pathnameArrow = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } .claseLocationBar .pathname:before{ content:'/'; font-weight: bold; margin-left: -10px; margin-right: 2px; color:rgb(0, 255, 128); } .claseLocationBar .label_pathname{ display: none; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { // Nur leere Strings abbrechen – außer bei pathname if (!text && clase !== "pathname") return; if (clase == "pathname") { let spSlash = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML: "/" } }); divLocationBar.appendChild(spSlash); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML: text || "" // Auch "" explizit anzeigen }, }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if (urlGBrowser.startsWith("about")) { divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) !== -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { console.error("Fehler beim Parsen der URL:", e); divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var partido = hostname.split("."); var subdomain; if (partido.length > 2 && !partido.every(v => v == v - 0)) { //Es wird geprüf, ob es sich nicht um eine IP handelt (nur Zahlen) subdomain = partido.splice(0, partido.length - 2).join("."); hostname = partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain + ".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } if (pathname === "/") { // Spezialfall: Nur ein einfacher Slash appendPart("", "pathname"); } else { let arrayPathname = pathname.split("/"); arrayPathname.forEach((elto, index) => { if (index === 0 && elto === "") return; // erstes leeres Element (vor dem ersten Slash) let sp = appendPart(elto, "pathname"); let arrayDot = elto.split("."); if (arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href: sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href: sp.getAttribute("href"), innerHTML: "." + extension } })); } }); } appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function() { hideDivLocatonBar() } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; setInterval(function(){ let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(styleBase); CSS_Loader.load(style_pathnameArrow); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 50); -
Verdammt!
Ok, dann werde ich wohl doch einen anderen Weg einschlagen müssen!
Hier mein geputzter, aktueller Erguss,
noch mit diesem verflixten Fehler.JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar.us.js // @version ? // @description dav_LinkifiesLocationBar // @based on https://github.com/sdavidg/firefoxChromeScripts/blob/main/scripts/dav_LinkifiesLocationBar.uc.js // @modified by Mira_Belle [https://www.camp-firefox.de/forum/] // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; function getWindow(){ return window; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var styleBase = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; height: 24px; width: 100%; line-height: 24px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } .claseLocationBar .label_pathname { margin-inline: unset !important; } locationBarTag{ display: inline; } /* Von mir hinzugefügt! */ .claseLocationBar span.protocol{ display: none; } /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; color: #777777; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; color: #C68007; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; } .claseLocationBar span.port{ color: #00aeff; } .claseLocationBar span.pathname{ color: #ffff00; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; } .claseLocationBar .extension{ color: #ffffff; } `; var style_pathnameArrow = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } .claseLocationBar .pathname:before{ content:'/'; font-weight: bold; margin-left: -10px; margin-right: 2px; color:rgb(0, 255, 128); } .claseLocationBar .pathname:after{ content:'/'; font-weight: bold; margin-left: 3px; margin-right: -9px; color:rgb(0, 255, 128); } .claseLocationBar .label_pathname{ display: none; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { if (!text) return; if(clase == "pathname") { let sp = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML:"/" } }); divLocationBar.appendChild(sp); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML:text }, }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if(urlGBrowser.startsWith("about")){ divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) != -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { console.error("Fehler beim Parsen der URL:", e); divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var partido = hostname.split("."); var subdomain; if(partido.length > 2 && !partido.every( v => v == v-0 ))//Es wird geprüf, ob es sich nicht um eine IP handelt (nur Zahlen) { subdomain = partido.splice(0, partido.length-2).join("."); hostname= partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain+".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } var arrayPathname = pathname.split("/"); arrayPathname.forEach((elto) => { if (elto) { let sp = appendPart(elto, "pathname"); let arrayDot = elto.split("."); if(arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href:sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href:sp.getAttribute("href"), innerHTML: "."+extension } })); } } }); appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function() { hideDivLocatonBar() } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; setInterval(function(){ let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(styleBase); CSS_Loader.load(style_pathnameArrow); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 50); -
Übrigens sind Teile des Skripts (Bezeichnungen) und Kommentare in Spanisch.
Sí, lo sé, ¡pero no importa!
2002Andreas So habe geputzt und reine gemacht. -
2002Andreas Schau mal, musste etwas in die Trickkiste greifen, um den abschließenden Slash hinzubekommen.
Habe das "https" mal ausgeblendet, so wie ohne Skript.Das Skript funktioniert so weit, ist aber noch nicht "geputzt", ist noch nicht benötigter Code vorhanden
JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar // @version 1.1 // @description dav_LinkifiesLocationBar // @shutdown dav_LinkifiesLocationBar.globalShutdown(); // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; //You must set be set to false the preference browser.tabs.hoverPreview.enabled const colorizeExtensionFile = true; // false const selectUrlbarText = true; // true const pathnameArrow = true; // true const fontMonospace = false; // true // const usePunycode = true; // true //https://stackoverflow.com/questions/183485/converting-punycode-with-dash-character-to-unicode/301287#301287 var punycode=new function(){this.utf16={decode:function(r){for(var o,e,t=[],n=0,f=r.length;n<f;){if(55296==(63488&(o=r.charCodeAt(n++)))){if(e=r.charCodeAt(n++),55296!=(64512&o)||56320!=(64512&e))throw new RangeError("UTF-16(decode): Illegal UTF-16 sequence");o=((1023&o)<<10)+(1023&e)+65536}t.push(o)}return t},encode:function(r){for(var o,e=[],t=0,n=r.length;t<n;){if(55296==(63488&(o=r[t++])))throw new RangeError("UTF-16(encode): Illegal UTF-16 value");o>65535&&(o-=65536,e.push(String.fromCharCode(o>>>10&1023|55296)),o=56320|1023&o),e.push(String.fromCharCode(o))}return e.join("")}};var r=36,o=700,e=1,t=26,n=38,f=2147483647;function h(r,o){return r+22+75*(r<26)-((0!=o)<<5)}function a(f,h,a){var i;for(f=a?Math.floor(f/o):f>>1,f+=Math.floor(f/h),i=0;f>(r-e)*t>>1;i+=r)f=Math.floor(f/(r-e));return Math.floor(i+(r-e+1)*f/(f+n))}this.decode=function(o,n){var h,i,u,c,d,l,p,g,s,C,v,w,y,A,E=[],M=[],R=o.length;for(h=128,u=0,c=72,(d=o.lastIndexOf("-"))<0&&(d=0),l=0;l<d;++l){if(n&&(M[E.length]=o.charCodeAt(l)-65<26),o.charCodeAt(l)>=128)throw new RangeError("Illegal input >= 0x80");E.push(o.charCodeAt(l))}for(p=d>0?d+1:0;p<R;){for(g=u,s=1,C=r;;C+=r){if(p>=R)throw RangeError("punycode_bad_input(1)");if((v=(A=o.charCodeAt(p++))-48<10?A-22:A-65<26?A-65:A-97<26?A-97:r)>=r)throw RangeError("punycode_bad_input(2)");if(v>Math.floor((f-u)/s))throw RangeError("punycode_overflow(1)");if(u+=v*s,v<(w=C<=c?e:C>=c+t?t:C-c))break;if(s>Math.floor(f/(r-w)))throw RangeError("punycode_overflow(2)");s*=r-w}if(c=a(u-g,i=E.length+1,0===g),Math.floor(u/i)>f-h)throw RangeError("punycode_overflow(3)");h+=Math.floor(u/i),u%=i,n&&M.splice(u,0,o.charCodeAt(p-1)-65<26),E.splice(u,0,h),u++}if(n)for(u=0,y=E.length;u<y;u++)M[u]&&(E[u]=String.fromCharCode(E[u]).toUpperCase().charCodeAt(0));return this.utf16.encode(E)},this.encode=function(o,n){var i,u,c,d,l,p,g,s,C,v,w,y;n&&(y=this.utf16.decode(o));var A=(o=this.utf16.decode(o.toLowerCase())).length;if(n)for(p=0;p<A;p++)y[p]=o[p]!=y[p];var E,M,R=[];for(i=128,u=0,l=72,p=0;p<A;++p)o[p]<128&&R.push(String.fromCharCode(y?(E=o[p],M=y[p],(E-=(E-97<26)<<5)+((!M&&E-65<26)<<5)):o[p]));for(c=d=R.length,d>0&&R.push("-");c<A;){for(g=f,p=0;p<A;++p)(w=o[p])>=i&&w<g&&(g=w);if(g-i>Math.floor((f-u)/(c+1)))throw RangeError("punycode_overflow (1)");for(u+=(g-i)*(c+1),i=g,p=0;p<A;++p){if((w=o[p])<i&&++u>f)return Error("punycode_overflow(2)");if(w==i){for(s=u,C=r;!(s<(v=C<=l?e:C>=l+t?t:C-l));C+=r)R.push(String.fromCharCode(h(v+(s-v)%(r-v),0))),s=Math.floor((s-v)/(r-v));R.push(String.fromCharCode(h(s,n&&y[p]?1:0))),l=a(u,c+1,c==d),u=0,++c}}++u,++i}return R.join("")},this.ToASCII=function(r){for(var o=r.split("."),e=[],t=0;t<o.length;++t){var n=o[t];e.push(n.match(/[^A-Za-z0-9-]/)?"xn--"+punycode.encode(n):n)}return e.join(".")},this.toUnicode=function(r){for(var o=r.split("."),e=[],t=0;t<o.length;++t){var n=o[t];e.push(n.match(/^xn--/)?punycode.decode(n.slice(4)):n)}return e.join(".")}}; function getWindow(){ return window; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var styleBase = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; height: 24px; width: 100%; line-height: 24px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } /* .claseLocationBar span:hover{ text-decoration: underline; cursor: pointer; } */ .claseLocationBar .label_pathname { margin-inline: unset !important; } locationBarTag{ display: inline; } /* Von mir hinzugefügt! */ .claseLocationBar span.protocol{ display: none; } /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; color: #777777; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; color: #C68007; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; } .claseLocationBar span.port{ color: #00aeff; } .claseLocationBar span.pathname{ color: #ffff00; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; } .claseLocationBar .extension{ color: #ffffff; } `; var style_fontMonospace = !fontMonospace?"":` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .urlbar-input-box[dav_LinkifiesLocationBar]{ font-family: monospace ; margin-top: 4px; } .claseLocationBar{ margin-top: -4px; line-height: 28px; } .claseLocationBar .pathname:after{ top: 10px; } .claseLocationBar span.port{ margin-left: -1px; } .claseLocationBar .subdomain { margin-right: -1px; } .claseLocationBar span.hostname{ margin-right: 1px; } `; var style_pathnameArrow = !pathnameArrow?"":` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } .claseLocationBar .pathname:before{ content:'/'; font-weight: bold; margin-left: -10px; margin-right: 2px; color:rgb(0, 255, 128); } .claseLocationBar .pathname:after{ content:'/'; font-weight: bold; margin-left: 3px; margin-right: -9px; color:rgb(0, 255, 128); } /* .claseLocationBar .pathname:before{ content:' '; display: block; position: absolute; border-style: solid; border-width: 4px 4px 4px 7px; border-color: transparent transparent transparent #6fa880; border-color: transparent transparent transparent #5ba8bf; top: 10px; left: 0px; } */ .claseLocationBar .label_pathname{ display: none; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } const CLIKS = { left: 0, middle: 1, right: 2 } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text) .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { if (!text) return; if(clase == "pathname") { let sp = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML:"/" } }); divLocationBar.appendChild(sp); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML:text }, evtListener: [{ type: "click", funcion: clickPart }] }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } function clickPart(evt) { if (evt.button == CLIKS.right) return; /* let target = evt.target; if (target.className != "protocol") { let href = target.getAttribute("href"); var where = evt.button == CLIKS.middle || evt.ctrlKey ? "tab" : "current"; evt.view.openLinkIn(href, where, { allowThirdPartyFixup: true, targetBrowser: gBrowser.selectedBrowser, indicateErrorPageLoad: true, allowPinnedTabHostChange: true, disallowInheritPrincipal: true, allowPopups: false, triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal() }); evt.stopPropagation(); } */ } function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if(urlGBrowser.startsWith("about")){ divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) != -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } // if(usePunycode){ // hostname = punycode.toUnicode(hostname); // } var partido = hostname.split("."); var subdomain; if(partido.length > 2 && !partido.every( v => v == v-0 ))//wir prüfen, ob es sich nicht um Zahlen handelt, denn dann handelt es sich um eine IP { subdomain = partido.splice(0, partido.length-2).join("."); hostname= partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain+".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } var arrayPathname = pathname.split("/"); var arrayPathnameLength = arrayPathname.length; arrayPathname.forEach((elto, index) => { if (elto) { let sp = appendPart(elto, "pathname"); if(colorizeExtensionFile && index == arrayPathnameLength-1) { let arrayDot = elto.split("."); if(arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href:sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href:sp.getAttribute("href"), innerHTML: "."+extension } })); } } } }); appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function() { hideDivLocatonBar() if(selectUrlbarText){ urlbarInput.select(); } } },{ type: "mouseenter", funcion: function(evt) { //esto es el ratón entrando por encima if(evt.screenY == divLocationBar.screenY) { timeMouseMove = setTimeout(hideDivLocatonBar, 500); } } },{ type: "mouseleave", funcion: function() { clearTimeout(timeMouseMove); } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; var intevalID = setInterval(function(){ //console.log("setInterval", intevalID, localWindow == window, localWindow == getMostRecentWindow()); let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(styleBase); CSS_Loader.load(style_pathnameArrow); CSS_Loader.load(style_fontMonospace); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.shutdown = function(){ borraPrevio(); clearTimeout(intevalID); urlbarInput.parentNode.removeAttribute("dav_LinkifiesLocationBar"); CSS_Loader.unload(styleBase); CSS_Loader.unload(style_pathnameArrow); CSS_Loader.unload(style_fontMonospace); CSS_Loader.unload(stylexul); urlbarInput.removeEventListener("blur", pintaLocation); } dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 50); -
Mh, 'ne ganz schön harte Nuss.
Selbst mit KI komme ich z.Z. nicht weiter.Bisher wohl die falschen Fragen gestellt.
Bleibe aber weiter am Ball, das Ding interessiert mich!Muss herausfinden, wie genau die URL zerpflückt und zerlegt wird.
-
@Horstmann Das ist alles

Mit dieser kleinen Korrektur funktioniert Dein Skript tadellos!!
Bitte vielmals um Entschuldigung -
@Horstmann , es fehlt - damit es in neueren Firefoxversionen funzt - ein Slash nach der Angabe des Profilpfades. Den könnte man z.B. hier einfügen:
style: 'list-style-image: url("' + ProfilePath +'/'+ buttonicon + '");'
In der Tat!
Mit dieser Korrektur funktioniert Horstmann's Skript!
Da bin ich wohl eines gewaltigen Irrtums aufgesessen.
Wobei, irgendetwas haben sie ja wirklich geändert, nur weiß ich nicht mehr was und warum ich alle Skripte überarbeiten musste,
und vor allem wie
-
Nachfrage!
2002Andreas Geht es Dir bei dem Skript um die "bunte" Anzeige der URL,
oder auch um die Funktionen? -
Horstmann's Skript nicht.
Sein Skript funktioniert in Fx 115, aber danach in keiner Fx Version mehr.
Ja, hatte diese Variabel auch in Verwendung, aber Mozilla hatte damals irgendwas geändert und
ich musste alle meine Skripte umschreiben.Aber wie ich schon schrieb, nutzt man CSS dann geht es, wenn das Symbol dann per CSS eingebunden wird.
-
Hi, die Variante mit :"let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir'));"
funktioniert nur, wenn der Pfad in CSS gebraucht wird.
Andi's Skript verwendet aber: "let ProfilePath = Services.dirsvc.get("ProfD", Ci.nsIFile).path.replace(/\\/g, "/");"
So kann die Variabel direkt in JS verwendet werden.Ergo, Andi's Skript erzeugt einen Button mit Symbol, Horstmann's Skript nicht.
Kleiner Nachtrag!
Wenn ein "SVG" verwendet wird, kann dieses aber per CSS angepasst werden,
und wenn man das will, muss man die "erste" Variante nutzen.
-
Grrr,
. Bekomme es mit dem abschließenden Slash einfach nicht hin!
Weder hier noch bei der Seite der Tagesschau.
Aber ich habe auch in dem neuen Skript die Pfeile durch einen Slash ersetzen können. -
Ah, verstehe. Werde mich der Sache, wenn ich Zeit habe, mal annehmen.
-
2002Andreas Witziges Skript.
Habe es mal so geändert, dass wieder „/“ angezeigt wird, anstatt des Pfeils.
Und ich habe in den Farbtopf gegriffen.
JavaScript
Alles anzeigen// ==UserScript== // @name dav_LinkifiesLocationBar // @name colored_addressbar.us.js // @version 2025.07.16 // @description dav_LinkifiesLocationBar // @shutdown dav_LinkifiesLocationBar.globalShutdown(); // ==/UserScript== /* Idea based on https://addons.mozilla.org/en-US/firefox/addon/locationbar%C2%B2/ https://github.com/simonlindholm/locationbar2 */ setTimeout(function() { if (location.href != 'chrome://browser/content/browser.xhtml') return; const colorizeExtensionFile = false, selectUrlbarText = true; function getWindow(){ return window; } function getMostRecentWindow(){ var win = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator) .getMostRecentWindow("navigator:browser"); return win; } var localWindow = getWindow(); localWindow.dav_LinkifiesLocationBar = {}; var style = ` @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); .claseLocationBar{ display: block; position: absolute; padding-top: 1.5px !important; height: 24px; width: 100%; line-height: 20px; white-space:nowrap; overflow:hidden; } .claseLocationBar span{ position: relative; margin: 0 1px; display: inline-block; } .claseLocationBar span:hover{ text-decoration: none; cursor: pointer; } /* .claseLocationBar span.pathname{ padding-left:9px; margin: 0 2px; } */ /* .claseLocationBar .pathname:after{ content:' '; display: block; position: absolute; border-style: solid; border-width: 4px 4px 4px 7px; border-color: transparent transparent transparent #ffaa00; top: 8px; left: 1px; } */ .claseLocationBar .label_pathname{ /* display: none; */ display: inline; font-weight: bold; color: #00aeff; } /************************************* *************** COLORS *************** *************************************/ .claseLocationBar span.protocol{ font-weight: normal; color: #00ff00; margin-right: -1px; } .claseLocationBar .subdomain { font-weight: bold; /* color: #cc00ff; */ color: #ff9900; } .claseLocationBar span.hostname{ font-weight: bold; color: #ff0000; margin-right: -5px; } .claseLocationBar span.port{ color: #ffff00; } .claseLocationBar span.pathname{ /* color: #00aeff; */ color: #ffff00; margin-left: -5px; margin-right: -5px; } .claseLocationBar span.hash{ color: #00ffff; margin-left: -1px; } .claseLocationBar span.search{ color: #00ff00; margin-left: -1px; } .claseLocationBar .extension{ color: cyan; } { black: #333333; blue: #336699; brown: #cc6633; green: #009900; orange: #ff9900; pink: #ff00cc; purple: #cc00ff; red: #cc0000; yellow: #ffff00; aliceblue: #f0f8ff !important; antiquewhite: #faebd7 !important; aquamarine: #7fffd4 !important; azure: #f0ffff !important; beige: #f5f5dc !important; bisque: #ffe4c4 !important; blanchedalmond: #ffebcd !important; blueviolet: #8a2be2 !important; brown: #a52a2a !important; burlywood: #deb887 !important; cadetblue: #5f9ea0 !important; chartreuse: #7fff00 !important; chocolate: #d2691e !important; coral: #ff7f50 !important; cornflowerblue: #6495ed !important; cornsilk: #fff8dc !important; crimson: #dc143c !important; cyan: #00ffff !important; darkblue: #00008b !important; darkcyan: #008b8b !important; darkgoldenrod: #b8860b !important; darkgray: #a9a9a9 !important; darkgreen: #006400 !important; darkgrey: #a9a9a9 !important; darkkhaki: #bdb76b !important; darkmagenta: #8b008b !important; darkolivegreen: #556b2f !important; darkorange: #ff8c00 !important; darkorchid: #9932cc !important; darkred: #8b0000 !important; darksalmon: #e9967a !important; darkseagreen: #8fbc8f !important; darkslateblue: #483d8b !important; darkslategray: #2f4f4f !important; darkslategrey: #2f4f4f !important; darkturquoise: #00ced1 !important; darkviolet: #9400d3 !important; deeppink: #ff1493 !important; deepskyblue: #00bfff !important; dimgray: #696969 !important; dimgrey: #696969 !important; dodgerblue: #1e90ff !important; firebrick: #b22222 !important; floralwhite: #fffaf0 !important; forestgreen: #228b22 !important; gainsboro: #dcdcdc !important; ghostwhite: #f8f8ff !important; gold: #ffd700 !important; goldenrod: #daa520 !important; greenyellow: #adff2f !important; grey: #808080 !important; honeydew: #f0fff0 !important; hotpink: #ff69b4 !important; indianred: #cd5c5c !important; indigo: #4b0082 !important; ivory: #fffff0 !important; khaki: #f0e68c !important; lavender: #e6e6fa !important; lavenderblush: #fff0f5 !important; lawngreen: #7cfc00 !important; lemonchiffon: #fffacd !important; lightblue: #add8e6 !important; lightcoral: #f08080 !important; lightcyan: #e0ffff !important; lightgoldenrodyellow: #fafad2 !important; lightgray: #d3d3d3 !important; lightgreen: #90ee90 !important; lightgrey: #d3d3d3 !important; lightpink: #ffb6c1 !important; lightsalmon: #ffa07a !important; lightseagreen: #20b2aa !important; lightskyblue: #87cefa !important; lightslategray: #778899 !important; lightslategrey: #778899 !important; lightsteelblue: #b0c4de !important; lightyellow: #ffffe0 !important; limegreen: #32cd32 !important; linen: #faf0e6 !important; magenta: #ff00ff !important; mediumaquamarine: #66cdaa !important; mediumblue: #0000cd !important; mediumorchid: #ba55d3 !important; mediumpurple: #9370db !important; mediumseagreen: #3cb371 !important; mediumslateblue: #7b68ee !important; mediumspringgreen: #00fa9a !important; mediumturquoise: #48d1cc !important; mediumvioletred: #c71585 !important; midnightblue: #191970 !important; mintcream: #f5fffa !important; mistyrose: #ffe4e1 !important; moccasin: #ffe4b5 !important; navajowhite: #ffdead !important; oldlace: #fdf5e6 !important; olivedrab: #6b8e23 !important; orange: #ffa500 !important; orangered: #ff4500 !important; orchid: #da70d6 !important; palegoldenrod: #eee8aa !important; palegreen: #98fb98 !important; paleturquoise: #afeeee !important; palevioletred: #db7093 !important; papayawhip: #ffefd5 !important; peachpuff: #ffdab9 !important; peru: #cd853f !important; pink: #ffc0cb !important; plum: #dda0dd !important; powderblue: #b0e0e6 !important; rebeccapurple: #663399 !important; rosybrown: #bc8f8f !important; royalblue: #4169e1 !important; saddlebrown: #8b4513 !important; salmon: #fa8072 !important; sandybrown: #f4a460 !important; seagreen: #2e8b57 !important; seashell: #fff5ee !important; sienna: #a0522d !important; skyblue: #87ceeb !important; slateblue: #6a5acd !important; slategray: #708090 !important; slategrey: #708090 !important; snow: #fffafa !important; springgreen: #00ff7f !important; steelblue: #4682b4 !important; tan: #d2b48c !important; thistle: #d8bfd8 !important; tomato: #ff6347 !important; turquoise: #40e0d0 !important; violet: #ee82ee !important; wheat: #f5deb3 !important; whitesmoke: #f5f5f5 !important; yellowgreen: #9acd32 !important; test-01: #565656 !important; test-02: #454545 !important; test-03: #3b3b3b !important; test-04: #292929 !important; test-05: #eb8e3e !important; test-06: #f5cba3 !important; test-07: #fc70a1 !important; test-08: #fdbcd2 !important; test-09: #619dbf !important; test-10: #a3c6da !important; test-11: #32a6a6 !important; test-12: #63d1d2 !important; test-13: #452370 !important; test-14: #6d36ae !important; test-15: #0b3e1f !important; test-16: #0f6130 !important; test-17: #082b47 !important; test-18: #0e4c7d !important; test-19: #6e0d14 !important; test-20: #aa1324 !important; } `; var stylexul = ` .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus ~ .claseLocationBar{ display: none !important; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input:focus{ opacity: 1; } .urlbar-input-box[dav_LinkifiesLocationBar] #urlbar-input{ opacity: 0; } `; /* AGENT_SHEET: 0 USER_SHEET: 1 AUTHOR_SHEET: 2 */ var CSS_Loader = { sss: Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService), load: function(cssCode) { this.unload(cssCode); var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); this.sss.loadAndRegisterSheet(uri, this.sss.AGENT_SHEET); }, unload: function(cssCode) { var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(cssCode), null, null); if (this.sss.sheetRegistered(uri,this.sss.AGENT_SHEET)) { this.sss.unregisterSheet(uri,this.sss.AGENT_SHEET); } } } const CLIKS = { left: 0, middle: 1, right: 2 } function extend() { var copy, target = {}; for (var i = 0, l = arguments.length; i < l; i++) { var options = arguments[i]; for (var name in options) { copy = options[name]; if (copy !== undefined) { target[name] = copy; } } } return target; } var styleString = (style) => { return Object.keys(style).reduce((prev, curr) => { return `${prev += curr.split(/(?=[A-Z])/).join('-').toLowerCase()}:${style[curr]};` }, ''); }; function createElement(elto) { elto = extend({ attrArray: {}, evtListener: [], estilos: {} }, elto); var node = getWindow().document.createXULElement(elto.type); Object.keys(elto.attrArray).forEach(key => { if(key == "innerHTML"){ node.innerHTML = encodeHTML(elto.attrArray[key]); } else { node.setAttribute(key, elto.attrArray[key]); } }); elto.evtListener.forEach(evt => { node.addEventListener(evt.type, evt.funcion, false); }); let estilo = styleString(elto.estilos); if (estilo) { node.setAttribute("style", estilo); } return node; } function encodeHTML(text) { return decodeURI(text).replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function appendPart(text, clase) { if (!text) return; if(clase == "pathname") { let sp = createElement({ type: "label", attrArray: { class: "label_pathname", innerHTML:"/" } }); divLocationBar.appendChild(sp); } let sp = createElement({ type: "span", attrArray: { class: clase, innerHTML:text }/* , evtListener: [{ type: "click", funcion: clickPart }] */ }); divLocationBar.appendChild(sp); sp.setAttribute("href", divLocationBar.textContent); return sp; } /* function clickPart(evt) { if (evt.button == CLIKS.right) return; let target = evt.target; if (target.className != "protocol") { let href = target.getAttribute("href"); var where = evt.button == CLIKS.middle || evt.ctrlKey ? "tab" : "current"; evt.view.openLinkIn(href, where, { allowThirdPartyFixup: true, targetBrowser: gBrowser.selectedBrowser, indicateErrorPageLoad: true, allowPinnedTabHostChange: true, disallowInheritPrincipal: true, allowPopups: false, triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal() }); evt.stopPropagation(); } } */ function borraPrevio() { var divPrevio = localWindow.document.querySelector(".claseLocationBar"); if (divPrevio) { divPrevio.parentNode.removeChild(divPrevio) } } var debounce = (fn, ms = 0) => { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), ms); }; }; var pintaLocation = debounce(pintaLocation_, 50); function pintaLocation_() { divLocationBar.innerHTML = ''; var urlBarInput = getWindow().document.querySelector("#urlbar-input").value; var urlGBrowser = gBrowser.currentURI.displaySpec; if(urlGBrowser.startsWith("about")){ divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var url = urlGBrowser.indexOf(urlBarInput) != -1 ? urlGBrowser : urlBarInput; try { var { protocol, hostname, port, pathname, hash, search } = new URL(url); } catch (e) { divLocationBar.innerHTML = encodeHTML(urlBarInput); return; } var partido = hostname.split("."); var subdomain; if(partido.length > 2 && !partido.every( v => v == v-0 )) //wir prüfen, ob es sich nicht um Zahlen handelt, denn dann handelt es sich um eine IP { subdomain = partido.splice(0, partido.length-2).join("."); hostname= partido.join("."); } appendPart(protocol + "//", "protocol"); if (subdomain) { appendPart(subdomain+".", "subdomain"); } appendPart(hostname, "hostname"); if (port) { appendPart(":" + port, "port"); } var arrayPathname = pathname.split("/"); var arrayPathnameLength = arrayPathname.length; arrayPathname.forEach((elto, index) => { if (elto) { let sp = appendPart(elto, "pathname"); if(colorizeExtensionFile && index == arrayPathnameLength-1) { let arrayDot = elto.split("."); if(arrayDot.length > 1) { let extension = arrayDot.pop(); sp.innerHTML = ""; sp.appendChild(createElement({ type: "locationBarTag", attrArray: { href:sp.getAttribute("href"), innerHTML: arrayDot.join(".") } })); sp.appendChild(createElement({ type: "locationBarTag", attrArray: { class: "extension", href:sp.getAttribute("href"), innerHTML: "."+extension } })); } } } }); appendPart(search, "search"); appendPart(hash, "hash"); } /******************* INIT ***************************/ var urlbarInput = getWindow().document.querySelector("#urlbar-input"); var timeMouseMove = -1; function hideDivLocatonBar(){ urlbarInput.focus(); } var divLocationBar = createElement({ type: "div", attrArray: { class: "claseLocationBar" }, evtListener: [{ type: "click", funcion: function(evt) { hideDivLocatonBar() if(selectUrlbarText){ urlbarInput.select(); } } },{ type: "mouseenter", funcion: function(evt) { //esto es el ratón entrando por encima if(evt.screenY == divLocationBar.screenY) { timeMouseMove = setTimeout(hideDivLocatonBar, 500); } } },{ type: "mouseleave", funcion: function(evt) { clearTimeout(timeMouseMove); } }] }); borraPrevio(); urlbarInput.parentNode.appendChild(divLocationBar); urlbarInput.parentNode.setAttribute("dav_LinkifiesLocationBar", true); urlbarInput.addEventListener("blur", pintaLocation); pintaLocation(); var last_displaySpec = ""; var intevalID = setInterval(function(){ //console.log("setInterval", intevalID, localWindow == window, localWindow == getMostRecentWindow()); let actual_displaySpec = gBrowser.currentURI.displaySpec; if(last_displaySpec != actual_displaySpec){ last_displaySpec = actual_displaySpec; pintaLocation(); } }, 50); CSS_Loader.load(style); CSS_Loader.load(stylexul); /******************* END INIT ***************************/ dav_LinkifiesLocationBar.shutdown = function(win){ borraPrevio(); clearTimeout(intevalID); urlbarInput.parentNode.removeAttribute("dav_LinkifiesLocationBar"); CSS_Loader.unload(style); CSS_Loader.unload(stylexul); urlbarInput.removeEventListener("blur", pintaLocation); } dav_LinkifiesLocationBar.globalShutdown = function(){ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var ws = wm.getEnumerator(null); while(ws.hasMoreElements()) { var w = ws.getNext(); w.dav_LinkifiesLocationBar.shutdown(w); } } }, 10); -
Super
Und Danke für die Rückmeldung.
-
Das funktioniert auch nicht mit den Werkzeugen als Vorschau, nur in der userChrome.css.
Ah!
Gesagt, getan.
lenny2 Funktioniert! Scrollleiste wird durch das Skript angepasst und verändert
Muss wohl woanders bei Dir der Wurm drinn sein.