Ohne diesen Code funktionieren beide Scripte (aus #3066 und auch aus #3077)
Nur zur Info, Dein CSS, das bei Dir dazwischen funkte, hatte hier keinen negativen Effekt.
Ohne diesen Code funktionieren beide Scripte (aus #3066 und auch aus #3077)
Nur zur Info, Dein CSS, das bei Dir dazwischen funkte, hatte hier keinen negativen Effekt.
Versuche ich die Adresse zu markieren
Dafür hat das Script vorgesehen, das Du mit der Maus von oben in die Adressleiste fährst und zwar eher etwas langsamer.
Warum fällt es euch eigentlich immer so schwer, die eigentliche Quelle zu verlinken?
sdavidg/firefoxChromeScripts bzw. konkret firefoxChromeScripts/dav_LinkifiesLocationBar.uc.js.
Dafür hat das Script vorgesehen, das Du mit der Maus von oben in die Adressleiste fährst und zwar eher etwas langsamer.
Das funktioniert hier aber nur, wenn vorher auf der Seite schon einmal eine Markierung vorgenommen wurde.
Beim Aufruf einer Seite, deren Link über die ganze verfügbare Breite (und länger) der Urlbar verläuft, so habe ich nur zwei Möglichkeiten eine Markierung zu machen.
1. Ein Linksklick auf http/https
2. Ein Rechtsklick in die Urlbar (egal wohin), öffnet gleichzeitig das Popup zur Auswahl.
Ist es denn bei Dir anders?
Ist es denn bei Dir anders?
Ja, ich öffne eine irgendeine neue Seite und gehe von oben in die Adressleiste und die URL wird kopierfähig verändert, es war vorher nie etwas markiert, so geht es jedes mal.
Beim Aufruf einer Seite, deren Link über die ganze verfügbare Breite (und länger) der Urlbar verläuft, so habe ich nur zwei Möglichkeiten eine Markierung zu machen.
1. Ein Linksklick auf http/https
2. Ein Rechtsklick in die Urlbar (egal wohin), öffnet gleichzeitig das Popup zur Auswahl.
Hier auch, so ist es ja auch gedacht. Das Skript trägt nicht zufällig seinen Namen: Es macht die einzelnen Abschnitte anklickbar. Andreas hat den entsprechenden Eventlistener aber deaktiviert (das ist in der neueren Skriptversion komplizierter, weil man noch mehr auf Klammern und Kommata achten muss).
Hier auch, so ist es ja auch gedacht.
Danke für die Bestätigung, dann arbeitet das Script hier auch fehlerfrei.
Danke für die Bestätigung, dann arbeitet das Script hier auch fehlerfrei.
Nein, bei Dir besteht ein Problem mit dem von oben in die URL zu fahren, um die URL kopieren zu können, das funktioniert hier so wie es vom Script gedacht ist, genauso wie wenn man von unten in die URL fährt, einzelne Bereiche anklickbar werden.
Nein, bei Dir besteht ein Problem mit dem von oben in die URL zu fahren, um die URL kopieren zu können
Das Problem besteht allerdings. An diesem Verhalten RE: userChrome.js Scripte für den Fuchs (Diskussion) hat sich auch nichts geändert. Denn das passiert dann immer --- dann verschiebt sich die Adresse ganz nach links, und lässt sich nicht mehr markieren. ---
Erst wenn wieder ein Klick auf eine freie Stelle der Seite erfolgt, dann erscheint wieder die volle Adresse linksbündig mit http/https . Dann beginnt das Spiel erneut, wenn von oben mit der Maus in die Url-Bar gefahren wird.
Nun sage mir bitte, woran das liegt.
Teste in einem jungfäulichen Profil, indem nur dieses Script werkelt. Wenns dann klappt, nimmt ein anderes Script oder ein CSS Einfluß.
Es ist schon eine Ewigkeit so, dass bei Einsatz des Scriptes für die Scrollbar bei Erhöhung des Zoom, diese sich dann verbreitert.
Auch in diesem Fall RE: in der Druckabteilung vom Fux ein wenig ändern ? kommt es zu dieser Verbreiterung.
Kann das im folgenden Script geändert werden, dass Zoom für die Scrollbar ausgeschlossen wird?
"use strict";
/* Firefox 57+ userChrome.js tweaks - SCROLLBARS ********************************************** */
/* by Aris (aris-addons@gmx.net)*************************************************************** */
/* Github: https://github.com/aris-t2/customscrollbarsforfx *********************************** */
/* ******************************************************************************************** */
/* ******************************************************************************************** */
/* Custom Scrollbars for Firefox ************************************************************** */
/* version 1.0.4 ****************************************************************************** */
/* ******************************************************************************************** */
/* ***********************************************************************************************
README
[!] either 'method 1' or 'method 2' are required to prepare Firefox for custom JavaScript files
[!] 'custom_scrollbars.uc.js' file belongs into Firefox profiles 'chrome' folder!
-> finding profile folder: address bar > about:profiles > Root Directory > Open Folder
-> add file to \chrome\ folder (create one, if needed)
[!] STARTUP CACHE HAS TO BE DELETED AFTER EVERY CHANGE!
-> finding 'startupCache' folder: address bar > about:profiles > Local Directory > Open Folder > startupCache
-> close Firefox
-> delete 'startupCache' folders content
ENABLING options > set var to true
DISABLING options > set var to false
Modifying appearance > change values
- color - name: red, blue, transparent / hex code: #33CCFF, #FFF
- color - rgb(a): rgba(0,0,255,0.8) / hsl(a): hsla(240,100%,50%,0.8)
- numbers: 1, 2, 3 ... 10, 11, 12 ...
- opacity: 0.0 to 1.0 e.g. 1.4, 1,75
- gradients: linear-gradient(direction, color, color, color)
- gradients example: linear-gradient(to right, blue, #33CCFF, rgba(0,0,255,0.8))
- unsettings predefined gradients: transparent,rgba(255,255,255,0.5),transparent -> transparent,rgba(255,255,255,0.0),transparent
- button size with arrow (descriptions for vertical scrollbars - analogous for horizontal scrollbars)
-- 1: space above arrow = arrow height
-- 1.5: space above arrow = 0.5 * arrow height
-- 2: no space above arrow
NOTE
- This is a tiny collection of scrollbar tweaks, not a port of 'NewScrollbars' add-on!
- Small scrollbar width values will corrupt some parts of the ui!
*********************************************************************************************** */
// GENERAL SCROLLBAR SETTINGS
var hide_scrollbars = false; // default: hide_scrollbars = false
var hide_scrollbar_buttons = false; // default: hide_scrollbar_buttons = false
var custom_scrollbar_size = true; // default: custom_scrollbar_size = false
var custom_scrollbar_size_value = 16; // in px // default: custom_scrollbar_size_value = 17
var custom_scrollbar_opacity = false; // default: custom_scrollbar_opacity = false
var custom_opacity_value = "1.0"; // default: custom_opacity_value = "1.0"
// floating scrollbars
var enable_scrollbars_on_top_of_webcontent = false; // default: enable_scrollbars_on_top_of_webcontent = false // uses 'custom_scrollbar_size_value' inside its code
// custom scrollbars
var enable_custom_scrollbars = true; // default: enable_custom_scrollbars = true
// CUSTOM SCROLLBAR SETTINGS ("custom_scrollbar_" --> "cs_")
var cs_thumb_border = 1; // in px // default: cs_thumb_border = 0
var cs_thumb_roundness = 10; // in px // default: cs_thumb_roundness = 0
var cs_buttons_roundness = 80; // in px // default: cs_buttons_roundness = 0
var cs_buttons_as_arrows = false; // default: cs_buttons_as_arrows = false // uses 'custom_scrollbar_size_value' inside its code
var cs_arrows_on_buttons = true; // default: cs_arrows_on_buttons = true // uses 'custom_scrollbar_size_value' inside its code
// button size with arrow - 1: space above arrow = arrow height // 1.5: space above arrow = 0.5 * arrow height // 2: no space above arrow
var cs_arrows_on_buttons_buttons_size = 1.25; // default: cs_arrows_on_buttons_buttons_size = 1.5
// 'flat' scrollbars
var cs_ignore_color_gradients = false; // default: cs_ignore_color_gradients = false
// CUSTOM SCROLLBAR COLORS/GRADIENTS
// - background
var cs_background_color = "#b0e2ff"; // Hintergrund
var cs_background_image_vertical = "linear-gradient(to right,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_background_image_vertical = "unset"
var cs_background_image_horizontal = "linear-gradient(to bottom,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_background_image_horizontal = "unset"
// - corner
var cs_corner_background_color = "grey"; // default: cs_corner_background_color = "#DDDDDD"
var cs_corner_background_image = "linear-gradient(45deg,transparent 30%,rgba(255,255,255,0.5) 50%,transparent 70%),linear-gradient(-45deg,transparent 30%,rgba(255,255,255,0.5) 50%,transparent 70%)"; // default: cs_corner_background_image = "unset"
// - thumb/slider
var cs_thumb_color = "#1c86ee"; // Hintergrund Scrollbalken
var cs_thumb_image_vertical = "linear-gradient(to right,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_thumb_image_vertical = "unset"
var cs_thumb_image_horizontal = "linear-gradient(to bottom,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_thumb_image_horizontal = "unset"
var cs_thumb_hover_color = "lime"; // Farbe Scrollbalken bei Hover
var cs_thumb_hover_image_vertical = "linear-gradient(to right,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_thumb_hover_image_vertical = "unset"
var cs_thumb_hover_image_horizontal = "linear-gradient(to bottom,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_thumb_hover_image_horizontal = "unset"
var cs_thumb_border_color = "#228B22"; // default: cs_thumb_border_color = "#33CCFF"
// - buttons
var cs_buttons_color = "#1c86ee"; // Hintergrund der Button
var cs_buttons_image_vertical = "linear-gradient(to right,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_buttons_image_vertical = "unset"
var cs_buttons_image_horizontal = "linear-gradient(to bottom,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_buttons_image_horizontal = "unset"
var cs_buttons_hover_color = "lime"; // Hintergrund bei Hover
var cs_buttons_hover_image_vertical = "linear-gradient(to right,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_buttons_hover_image_vertical = "unset"
var cs_buttons_hover_image_horizontal = "linear-gradient(to bottom,transparent,rgba(255,255,255,0.5),transparent)"; // default: cs_buttons_hover_image_horizontal = "unset"
// - button - Pfeile
var cs_arrows_on_buttons_color = "#b0e2ff"; // Farbe
var cs_arrows_on_buttons_hover_color = "#FF0000"; // Farbe bei Hover
// unset background image color gradients -> flat scrollbars
if(cs_ignore_color_gradients==true)
cs_background_image_vertical
=cs_background_image_horizontal
=cs_corner_background_image=cs_thumb_image_vertical
=cs_thumb_image_horizontal
=cs_thumb_hover_image_vertical
=cs_thumb_hover_image_horizontal
=cs_buttons_image_vertical
=cs_buttons_image_horizontal
=cs_buttons_hover_image_vertical
=cs_buttons_hover_image_horizontal
="unset";
/* ******************************************************************************************** */
/* ******************************************************************************************** */
/* ******************************************************************************************** */
// Scrollbar code
Components.utils.import("resource://gre/modules/Services.jsm");
var ss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
var custom_scrollbars = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar, scrollcorner, scrollbar thumb, scrollbar scrollbarbutton {\
-moz-appearance: none !important;\
}\
scrollbar {\
background-color: '+cs_background_color+' !important;\
}\
scrollbar[orient="vertical"] {\
background-image: '+cs_background_image_vertical+' !important;\
}\
scrollbar[orient="horizontal"] {\
background-image: '+cs_background_image_horizontal+' !important;\
}\
scrollcorner {\
background-color: '+cs_corner_background_color+' !important;\
background-image: '+cs_corner_background_image+' !important;\
}\
scrollbar thumb {\
background-color: '+cs_thumb_color+' !important;\
border-radius: '+cs_thumb_roundness+'px !important;\
border: '+cs_thumb_border+'px solid '+cs_thumb_border_color+' !important;\
}\
scrollbar thumb[orient="vertical"] {\
background-image: '+cs_thumb_image_vertical+' !important;\
}\
scrollbar thumb[orient="horizontal"] {\
background-image: '+cs_thumb_image_horizontal+' !important;\
}\
scrollbar thumb:hover, scrollbar thumb:active {\
background-color: '+cs_thumb_hover_color+' !important;\
}\
scrollbar thumb[orient="vertical"]:hover, scrollbar thumb[orient="vertical"]:active {\
background-image: '+cs_thumb_hover_image_vertical+' !important;\
}\
scrollbar thumb[orient="horizontal"]:hover, scrollbar thumb[orient="horizontal"]:active {\
background-image: '+cs_thumb_hover_image_horizontal+' !important;\
}\
scrollbar scrollbarbutton {\
background-color: '+cs_buttons_color+' !important;\
border-radius: '+cs_buttons_roundness+'px !important;\
}\
scrollbar[orient="vertical"] scrollbarbutton {\
background-image: '+cs_buttons_image_vertical+' !important;\
}\
scrollbar[orient="horizontal"] scrollbarbutton {\
background-image: '+cs_buttons_image_horizontal+' !important;\
}\
scrollbar scrollbarbutton:hover {\
background-color: '+cs_buttons_hover_color+' !important;\
}\
scrollbar[orient="vertical"] scrollbarbutton:hover {\
background-image: '+cs_buttons_hover_image_vertical+' !important;\
}\
scrollbar[orient="horizontal"] scrollbarbutton:hover {\
background-image: '+cs_buttons_hover_image_horizontal+' !important;\
}\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var cs_scrollbars_scrollbar_button_arrows = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar scrollbarbutton, \
scrollbar[orient="vertical"] scrollbarbutton,\
scrollbar[orient="horizontal"] scrollbarbutton, \
scrollbar[orient="vertical"] scrollbarbutton:hover,\
scrollbar[orient="horizontal"] scrollbarbutton:hover {\
background-color: unset !important;\
background-image: unset !important;\
border-radius: 0px !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton {\
min-height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
max-height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
min-width: '+custom_scrollbar_size_value+'px !important;\
width: '+custom_scrollbar_size_value+'px !important;\
max-width: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton {\
min-width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
max-width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
min-height: '+custom_scrollbar_size_value+'px !important;\
height: '+custom_scrollbar_size_value+'px !important;\
max-height: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"]:hover {\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_hover_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"] {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-top: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"]:hover {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_hover_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="decrement"] {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="decrement"]:hover {\
border-right: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_hover_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="increment"] {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-left: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="increment"]:hover {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid '+cs_buttons_hover_color+' !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var cs_scrollbars_arrows_on_buttons = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar scrollbarbutton, \
scrollbar[orient="vertical"] scrollbarbutton,\
scrollbar[orient="horizontal"] scrollbarbutton, \
scrollbar[orient="vertical"] scrollbarbutton:hover,\
scrollbar[orient="horizontal"] scrollbarbutton:hover {\
border-radius: 0px !important;\
}\
\
scrollbar[orient="vertical"] > scrollbarbutton {\
min-height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
max-height: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
min-width: '+custom_scrollbar_size_value+'px !important;\
width: '+custom_scrollbar_size_value+'px !important;\
max-width: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton {\
min-width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
max-width: '+(custom_scrollbar_size_value/cs_arrows_on_buttons_buttons_size)+'px !important;\
min-height: '+custom_scrollbar_size_value+'px !important;\
height: '+custom_scrollbar_size_value+'px !important;\
max-height: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"]:hover {\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_hover_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"] {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-top: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_color+' !important;\
}\
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"]:hover {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_hover_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="decrement"] {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-right: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="decrement"]:hover {\
border-right: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_hover_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="increment"] {\
border-top: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-bottom: '+(custom_scrollbar_size_value/2)+'px solid transparent !important;\
border-left: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_color+' !important;\
}\
scrollbar[orient="horizontal"] > scrollbarbutton[type="increment"]:hover {\
border-left: '+(custom_scrollbar_size_value/2)+'px solid '+cs_arrows_on_buttons_hover_color+' !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var scrollbar_buttons = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar scrollbarbutton {\
opacity: 0 !important;\
}\
scrollbar[orient="vertical"] scrollbarbutton {\
min-height: 1px !important;\
height: 1px !important;\
max-height: 1px !important;\
}\
scrollbar[orient="horizontal"] scrollbarbutton {\
min-width: 1px !important;\
width: 1px !important;\
max-width: 1px !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var scrollbar_size = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar[orient="vertical"] scrollbarbutton {\
min-width: 0 !important;\
width: '+custom_scrollbar_size_value+'px !important;\
max-width: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="horizontal"] scrollbarbutton {\
min-height: 0 !important;\
height: '+custom_scrollbar_size_value+'px !important;\
max-height: '+custom_scrollbar_size_value+'px !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var floating_scrollbars = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar {\
position: relative !important;\
z-index: 1000000000 !important;\
}\
scrollbar[orient="vertical"],\
scrollbar[orient="horizontal"],\
scrollbar, scrollcorner {\
background-color: transparent !important; \
background-image: unset !important; \
}\
scrollbar[orient="vertical"] {\
-moz-margin-start: -'+custom_scrollbar_size_value+'px !important;\
width: '+custom_scrollbar_size_value+'px !important;\
}\
scrollbar[orient="horizontal"] {\
margin-top: -'+custom_scrollbar_size_value+'px !important;\
height: '+custom_scrollbar_size_value+'px !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var scrollbar_opacity = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar {\
opacity: '+custom_opacity_value+' !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
var remove_scrollbars = {
init: function() {
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
@namespace html url("http://www.w3.org/1999/xhtml");\
\
scrollbar, scrollcorner {\
display: none !important;\
visibility: collapse !important;\
}\
\
'), null, null);
ss.loadAndRegisterSheet(uri, ss.AGENT_SHEET);
}
};
// enable settings as configured above
if(enable_custom_scrollbars==true) custom_scrollbars.init();
if(cs_buttons_as_arrows==true && hide_scrollbars==false) cs_scrollbars_scrollbar_button_arrows.init();
if(cs_arrows_on_buttons==true && cs_buttons_as_arrows==false && hide_scrollbars==false) cs_scrollbars_arrows_on_buttons.init();
if(hide_scrollbar_buttons==true) scrollbar_buttons.init();
if(custom_scrollbar_size==true) scrollbar_size.init();
if(enable_scrollbars_on_top_of_webcontent==true) floating_scrollbars.init();
if(custom_scrollbar_opacity==true) scrollbar_opacity.init();
if(hide_scrollbars==true) remove_scrollbars.init();
Alles anzeigen
Ich habe das von Speravir überarbeitete Skript UserCSSLoader.uc.js aus dem Github von Endor übernommen. Danke für die Übersichtlichen Konfigurationseinstellungen am Anfang des Skripts und die Rechtschreibkorrekturen!
Die Mittelklick-Funktion funktioniert bei mir aber nicht. In meiner Version des Skripts funktioniert sie und in Speravirs Version fehlt in Zeile 300 der Eintrag onmouseup : "if (event.button == 1) event.preventDefault();",
Vielleicht liegt es daran.
Ich habe das ergänzt und weitere Ergänzungen aus meiner Version eingefügt.
Will/soll Endor diese Version ins Github übernehmen?
// ==UserScript==
// @name UserCSSLoader
// @description CSS Codes - Styles laden und verwalten
// @namespace http://d.hatena.ne.jp/Griever/
// @author Griever
// @include main
// @license MIT License
// @compatibility Firefox 4 - 102*
// @charset UTF-8
// @version 0.0.4K+
// @note Aktualisierung von Speravir - www.camp-firefox.de
// @note Fx92: getURLSpecFromFile() -> getURLSpecFromActualFile()
// @note AUTHOR_SHEET Verwendung hinzugefügt, wichtig: am Ende des Dateinamens .author.css
// @note Version 0.0.4.g ermoeglicht "Styles importieren" per Mittelklick und Verwendung
// @note eines anderen Dateimanager (siehe in Konfiguration)
// @note + ergänzt um einen Parameter für den Dateimanager (vFMParameter in der Konfiguration) von aborix
// @note Frei verschiebbare Schaltfläche eingebaut von aborix
// @note 0.0.4 Remove E4X
// @note CSSEntry-Klasse erstellt
// @note Style-Test-Funktion überarbeitet
// @note Wenn die Datei gelöscht wurde, CSS beim Neu-Erstellen und Löschen des Menüs abbrechen
// @note uc einlesen .uc.css temporäre Korrespondenz zum erneuten Lesen
// ==/UserScript==
/****** Bedienungsanleitung ******
CSS-Ordner im Chrome-Ordner erstellen, CSS-Dateien dort ablegen - speichern.
Diejenigen, deren Dateiname mit "xul-" beginnen, diejenigen, die mit ".as.css" enden, sind AGENT_SHEET,
alle anderen außer USER_SHEET werden gelesen. Da der Inhalt der Datei nicht überprüft wird,
darauf achten, @ Namespace Angabe nicht zu vergessen!
CSS-Menü wird zur Menüleiste hinzugefügt
Linksklick auf Stil, zum aktivieren/deaktivieren
Mittelklick auf Stil zum aktivieren/deaktivieren, ohne Menü zu schließen
Rechtsklick auf Stil zum Öffnen im Editor
Strg+Linksklick zum Anzegen im Dateimanager
Verwenden des in "view_source.editor.path" angegebenen Editors
Dateiordner kann in Konfiguration geändert werden
**** Anleitung Ende ****/
(function(){
/* Konfiguration */
// Position: als Menü anzeigen = 1, als frei verschiebbare-Schaltfläche = 0
let position = 0;
// alternativer Dateimanager, Bsp.:
// let filemanager = "C:\\Programme\\totalcmd\\TOTALCMD.EXE";
let filemanager = "";
// eventuelle Parameter für den alternativen Dateimanager, sonst filemanagerParam = "";
let filemanagerParam = "";
// Unterordner für die CSS-Dateien:
let cssFolder = "CSS";
// zusätzlich Chrome-Ordner im Untermenü anzeigen: 1 = ja, 0 = nein
let showChrome = 0;
/* Ende Konfiguration */
let { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
if (!window.Services)
Cu.import("resource://gre/modules/Services.jsm");
// Wenn beim Start ein anderes Fenster angezeigt wird (das zweite Fenster), wird es beendet
let list = Services.wm.getEnumerator("navigator:browser");
while(list.hasMoreElements()){ if(list.getNext() != window) return; }
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
if (window.UCL) {
window.UCL.destroy();
delete window.UCL;
}
window.UCL = {
vFileManager: filemanager,
vFMParameter: filemanagerParam,
USE_UC: "UC" in window,
AGENT_SHEET: Ci.nsIStyleSheetService.AGENT_SHEET,
USER_SHEET : Ci.nsIStyleSheetService.USER_SHEET,
AUTHOR_SHEET: Ci.nsIStyleSheetService.AUTHOR_SHEET,
readCSS : {},
get disabled_list() {
let obj = [];
try {
obj = this.prefs.getCharPref("disabled_list").split("|");
} catch(e) {}
delete this.disabled_list;
return this.disabled_list = obj;
},
get prefs() {
delete this.prefs;
return this.prefs = Services.prefs.getBranch("UserCSSLoader.")
},
get styleSheetServices(){
delete this.styleSheetServices;
return this.styleSheetServices = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
},
get FOLDER() {
let aFolder;
try {
// UserCSSLoader.FOLDER verwenden
let folderPath = this.prefs.getCharPref("FOLDER");
aFolder = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile)
aFolder.initWithPath(folderPath);
} catch (e) {
aFolder = Services.dirsvc.get("UChrm", Ci.nsIFile);
aFolder.appendRelativePath(cssFolder);
}
if (!aFolder.exists() || !aFolder.isDirectory()) {
aFolder.create(Ci.nsIFile.DIRECTORY_TYPE, 0664);
}
delete this.FOLDER;
return this.FOLDER = aFolder;
},
get CHRMFOLDER() {
let bFolder;
try {
// UserCSSLoader.CHRMFOLDER verwenden
let CHRMfolderPath = this.prefs.getCharPref("CHRMFOLDER");
bFolder = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile)
bFolder.initWithPath(CHRMfolderPath);
} catch (e) {
bFolder = Services.dirsvc.get("UChrm", Ci.nsIFile);
}
if (!bFolder.exists() || !bFolder.isDirectory()) {
bFolder.create(Ci.nsIFile.DIRECTORY_TYPE, 0664);
}
delete this.CHRMFOLDER;
return this.CHRMFOLDER = bFolder;
},
getFocusedWindow: function() {
let win = document.commandDispatcher.focusedWindow;
if (!win || win == window) win = content;
return win;
},
init: function() {
let cssmenu = $C("menu", {
id: "usercssloader-menu",
label: "CSS",
tooltiptext: "UserCSSLoader\n\nLinksklick: Stylesheets anzeigen\nMittelklick: Styles importieren",
accesskey: "C",
onclick: "if (event.button == 1) UCL.rebuild()"
});
let menupopup = $C("menupopup", {
id: "usercssloader-menupopup"
});
cssmenu.appendChild(menupopup);
let menu = $C("menu", {
label: "Style-Loader-Menü",
id: "style-loader-menu",
accesskey: "M"
});
menupopup.appendChild(menu);
menupopup.appendChild($C("menuseparator"));
let mp = $C("menupopup", { id: "usercssloader-submenupopup" });
menu.appendChild(mp);
mp.appendChild($C("menuitem", {
label: "Styles importieren",
accesskey: "R",
acceltext: "Alt + R",
oncommand: "UCL.rebuild();"
}));
mp.appendChild($C("menuseparator"));
mp.appendChild($C("menuitem", {
label: "CSS-Datei erstellen",
accesskey: "D",
oncommand: "UCL.create();"
}));
mp.appendChild($C("menuitem", {
label: "CSS-Ordner öffnen",
accesskey: "O",
oncommand: "UCL.openFolder();"
}));
if (showChrome == 1) {
mp.appendChild($C("menuitem", {
label: "Chrome Ordner öffnen",
accesskey: "O",
oncommand: "UCL.openCHRMFolder();"
}));
}
mp.appendChild($C("menuitem", {
label: "userChrome.css bearbeiten",
hidden: false,
oncommand: "UCL.editUserCSS(\'userChrome.css\');"
}));
mp.appendChild($C("menuitem", {
label: "userContent.css bearbeiten",
hidden: false,
oncommand: "UCL.editUserCSS(\'userContent.css\');"
}));
mp.appendChild($C("menuseparator"));
mp.appendChild($C("menuitem", {
label: "Style-Test (Chrome)",
id: "usercssloader-test-chrome",
hidden: true,
accesskey: "C",
oncommand: "UCL.styleTest(window);"
}));
mp.appendChild($C("menuitem", {
label: "Style-Test (Web)",
id: "usercssloader-test-content",
hidden: true,
accesskey: "W",
oncommand: "UCL.styleTest();"
}));
mp.appendChild($C("menuitem", {
label: "Styles dieser Seite auf userstyles.org finden",
hidden: false,
accesskey: "S",
oncommand: "UCL.searchStyle();"
}));
menu = $C("menu", {
label: ".uc.css",
accesskey: "U",
hidden: !UCL.USE_UC
});
menupopup.appendChild(menu);
mp = $C("menupopup", { id: "usercssloader-ucmenupopup" });
menu.appendChild(mp);
mp.appendChild($C("menuitem", {
label: "Importieren(.uc.js)",
oncommand: "UCL.UCrebuild();"
}));
mp.appendChild($C("menuseparator", { id: "usercssloader-ucseparator" }));
CustomizableUI.createWidget({
id: 'usercssloader-menu-item',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let toolbaritem = aDocument.createElementNS(XULNS, 'toolbaritem');
toolbaritem.id = 'usercssloader-menu-item';
toolbaritem.className = 'chromeclass-toolbar-additional';
return toolbaritem;
}
});
$('usercssloader-menu-item').appendChild(cssmenu);
if (position == 1) {
let refNode = $('helpMenu');
refNode.parentNode.insertBefore(cssmenu, refNode.nextSibling);
}
$("mainKeyset").appendChild($C("key", {
id: "usercssloader-rebuild-key",
oncommand: "UCL.rebuild();",
key: "R",
modifiers: "alt",
}));
this.rebuild();
this.initialized = true;
if (UCL.USE_UC) {
setTimeout(function() {
UCL.UCcreateMenuitem();
}, 1000);
}
window.addEventListener("unload", this, false);
},
uninit: function() {
const dis = [];
for (let x of Object.keys(this.readCSS)) {
if (!this.readCSS[x].enabled)
dis.push(x);
}
this.prefs.setCharPref("disabled_list", dis.join("|"));
window.removeEventListener("unload", this, false);
},
destroy: function() {
var i = document.getElementById("usercssloader-menu");
if (i) i.parentNode.removeChild(i);
var i = document.getElementById("usercssloader-rebuild-key");
if (i) i.parentNode.removeChild(i);
this.uninit();
},
handleEvent: function(event) {
switch(event.type){
case "unload": this.uninit(); break;
}
},
rebuild: function() {
let ext = /\.css$/i;
let not = /\.uc\.css/i;
let files = this.FOLDER.directoryEntries.QueryInterface(Ci.nsISimpleEnumerator);
while (files.hasMoreElements()) {
let file = files.getNext().QueryInterface(Ci.nsIFile);
if (!ext.test(file.leafName) || not.test(file.leafName)) continue;
let CSS = this.loadCSS(file);
CSS.flag = true;
}
for (let leafName of Object.keys(this.readCSS)) {
const CSS = this.readCSS[leafName];
if (!CSS.flag) {
CSS.enabled = false;
delete this.readCSS[leafName];
}
delete CSS.flag;
this.rebuildMenu(leafName);
}
if (this.initialized) {
if (typeof(StatusPanel) !== "undefined")
StatusPanel._label = "Style importiert";
else
XULBrowserWindow.statusTextField.label = "Styles importieren";
}
},
loadCSS: function(aFile) {
var CSS = this.readCSS[aFile.leafName];
if (!CSS) {
CSS = this.readCSS[aFile.leafName] = new CSSEntry(aFile);
if (this.disabled_list.indexOf(CSS.leafName) === -1) {
CSS.enabled = true;
}
} else if (CSS.enabled) {
CSS.enabled = true;
}
return CSS;
},
rebuildMenu: function(aLeafName) {
var CSS = this.readCSS[aLeafName];
var menuitem = document.getElementById("usercssloader-" + aLeafName);
if (!CSS) {
if (menuitem)
menuitem.parentNode.removeChild(menuitem);
return;
}
if (!menuitem) {
menuitem = $C("menuitem", {
label : aLeafName,
id : "usercssloader-" + aLeafName,
class : "usercssloader-item " + (CSS.SHEET == this.AGENT_SHEET? "AGENT_SHEET" : CSS.SHEET == this.AUTHOR_SHEET? "AUTHOR_SHEET": "USER_SHEET"),
type : "checkbox",
autocheck : "false",
oncommand : "UCL.toggle('"+ aLeafName +"');",
onclick : "UCL.itemClick(event);",
onmouseup : "if (event.button == 1) event.preventDefault();",
tooltiptext : "Linksklick: an/aus, Menü schließt\nMittelklick: an/aus, Menü bleibt offen\nRechtsklick: bearbeiten\nStrg+Linksklick: im Dateimanager anzeigen"
});
document.getElementById("usercssloader-menupopup").appendChild(menuitem);
}
menuitem.setAttribute("checked", CSS.enabled);
},
toggle: function(aLeafName) {
var CSS = this.readCSS[aLeafName];
if (!CSS || event.ctrlKey) return;
CSS.enabled = !CSS.enabled;
this.rebuildMenu(aLeafName);
},
itemClick: function(event) {
let label = event.currentTarget.getAttribute("label");
if (event.button == 0) {
if (event.ctrlKey) {
event.preventDefault();
event.stopPropagation();
UCL.openFolder (label);
} else {return;
}
}
event.preventDefault();
event.stopPropagation();
if (event.button == 1) {
this.toggle(label);
}
else if (event.button == 2) {
// closeMenus(event.target);
this.edit(this.getFileFromLeafName(label));
}
},
getFileFromLeafName: function(aLeafName) {
let f = this.FOLDER.clone();
f.QueryInterface(Ci.nsIFile); // use appendRelativePath
f.appendRelativePath(aLeafName);
return f;
},
styleTest: function(aWindow) {
aWindow || (aWindow = this.getFocusedWindow());
new CSSTester(aWindow, function(tester){
if (tester.saved)
UCL.rebuild();
});
},
searchStyle: function() {
let word;
try {
word = gBrowser.currentURI.host;
} catch {
word = gBrowser.currentURI.spec;
}
openWebLinkIn("https://userstyles.org/styles/search/" + word, "tab", {});
},
openFolder:function(label){
if (label) {
var target= this.FOLDER.path + "\\" + label
} else {
var target= this.FOLDER.path
}
if (this.vFileManager.length != 0) {
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
var args=[this.vFMParameter,target];
file.initWithPath(this.vFileManager);
process.init(file);
// Verzeichnis mit anderem Dateimanager öffnen
process.run(false, args, args.length);
} else {
// Verzeichnis mit Dateimanager des Systems öffnen
this.FOLDER.launch();
}
},
openCHRMFolder:function(){
if (this.vFileManager.length != 0) {
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
var args=[this.vFMParameter,this.CHRMFOLDER.path];
file.initWithPath(this.vFileManager);
process.init(file);
// Verzeichnis mit anderem Dateimanager öffnen
process.run(false, args, args.length);
} else {
// Verzeichnis mit Dateimanager des Systems öffnen
this.CHRMFOLDER.launch();
}
},
editUserCSS: function(aLeafName) {
let file = Services.dirsvc.get("UChrm", Ci.nsIFile);
file.appendRelativePath(aLeafName);
this.edit(file);
},
edit: function(aFile) {
var editor = Services.prefs.getCharPref("view_source.editor.path");
if (!editor) return alert("Unter about:config den vorhandenen Schalter:\n view_source.editor.path mit dem Editorpfad ergänzen");
try {
var UI = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
UI.charset = window.navigator.platform.toLowerCase().indexOf("win") >= 0? "Shift_JIS": "UTF-8";
var path = UI.ConvertFromUnicode(aFile.path);
var app = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
app.initWithPath(editor);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(app);
process.run(false, [path], 1);
} catch (e) {}
},
create: function(aLeafName) {
if (!aLeafName) aLeafName = prompt("Name des Styles", dateFormat(new Date(), "%Y_%m%d_%H%M%S"));
if (aLeafName) aLeafName = aLeafName.replace(/\s+/g, " ").replace(/[\\/:*?\"<>|]/g, "");
if (!aLeafName || !/\S/.test(aLeafName)) return;
if (!/\.css$/.test(aLeafName)) aLeafName += ".css";
let file = this.getFileFromLeafName(aLeafName);
this.edit(file);
},
UCrebuild: function() {
let re = /^file:.*\.uc\.css(?:\?\d+)?$/i;
let query = "?" + new Date().getTime();
Array.slice(document.styleSheets).forEach(function(css){
if (!re.test(css.href)) return;
if (css.ownerNode) {
css.ownerNode.parentNode.removeChild(css.ownerNode);
}
let pi = document.createProcessingInstruction('xml-stylesheet','type="text/css" href="'+ css.href.replace(/\?.*/, '') + query +'"');
document.insertBefore(pi, document.documentElement);
});
UCL.UCcreateMenuitem();
},
UCcreateMenuitem: function() {
let sep = $("usercssloader-ucseparator");
let popup = sep.parentNode;
if (sep.nextSibling) {
let range = document.createRange();
range.setStartAfter(sep);
range.setEndAfter(popup.lastChild);
range.deleteContents();
range.detach();
}
let re = /^file:.*\.uc\.css(?:\?\d+)?$/i;
Array.slice(document.styleSheets).forEach(function(css) {
if (!re.test(css.href)) return;
let fileURL = decodeURIComponent(css.href).split("?")[0];
let aLeafName = fileURL.split("/").pop();
let m = $C("menuitem", {
label : aLeafName,
tooltiptext : fileURL,
id : "usercssloader-" + aLeafName,
type : "checkbox",
autocheck : "false",
checked : "true",
oncommand : "if (!event.ctrlKey) {this.setAttribute('checked', !(this.css.disabled = !this.css.disabled));}",
onclick : "UCL.UCItemClick(event);"
});
m.css = css;
popup.appendChild(m);
});
},
UCItemClick: function(event) {
if (event.button == 0) return;
event.preventDefault();
event.stopPropagation();
if (event.button == 1) {
event.target.doCommand();
}
else if (event.button == 2) {
// closeMenus(event.target);
let fileURL = event.currentTarget.getAttribute("tooltiptext");
let file = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromActualFile(fileURL);
this.edit(file);
}
},
};
function CSSEntry(aFile) {
this.path = aFile.path;
this.leafName = aFile.leafName;
this.lastModifiedTime = 1;
this.SHEET = /^xul-|\.as\.css$/i.test(this.leafName) ?
Ci.nsIStyleSheetService.AGENT_SHEET:
/\.author\.css$/i.test(this.leafName)?
Ci.nsIStyleSheetService.AUTHOR_SHEET:
Ci.nsIStyleSheetService.USER_SHEET;
}
CSSEntry.prototype = {
sss: Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService),
_enabled: false,
get enabled() {
return this._enabled;
},
set enabled(isEnable) {
var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile)
aFile.initWithPath(this.path);
var isExists = aFile.exists(); // true, wenn die Datei existiert
var lastModifiedTime = isExists ? aFile.lastModifiedTime : 0;
var isForced = this.lastModifiedTime != lastModifiedTime; // true, wenn es eine Änderung in der Datei gibt
var fileURL = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromActualFile(aFile);
var uri = Services.io.newURI(fileURL, null, null);
if (this.sss.sheetRegistered(uri, this.SHEET)) {
// Wenn diese Datei bereits gelesen wurde
if (!isEnable || !isExists) {
this.sss.unregisterSheet(uri, this.SHEET);
}
else if (isForced) {
// Nach Stornierung erneut einlesen
this.sss.unregisterSheet(uri, this.SHEET);
this.sss.loadAndRegisterSheet(uri, this.SHEET);
}
} else {
// Datei wurde nicht gelesen
if (isEnable && isExists) {
this.sss.loadAndRegisterSheet(uri, this.SHEET);
}
}
if (this.lastModifiedTime !== 1 && isEnable && isForced) {
log(this.leafName + " wurde aktualisiert");
}
this.lastModifiedTime = lastModifiedTime;
return this._enabled = isEnable;
},
};
function CSSTester(aWindow, aCallback) {
this.win = aWindow || window;
this.doc = this.win.document;
this.callback = aCallback;
this.init();
}
CSSTester.prototype = {
sss: Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService),
preview_code: "",
saved: false,
init: function() {
this.dialog = openDialog(
"data:text/html;charset=utf8,"+encodeURIComponent('<!DOCTYPE HTML><html lang="de"><head><title>CSSTester</title></head><body></body></html>'),
"",
"width=550,height=400,dialog=no");
this.dialog.addEventListener("load", this, false);
},
destroy: function() {
this.preview_end();
this.dialog.removeEventListener("unload", this, false);
this.previewButton.removeEventListener("click", this, false);
this.saveButton.removeEventListener("click", this, false);
this.closeButton.removeEventListener("click", this, false);
},
handleEvent: function(event) {
switch(event.type) {
case "click":
if (event.button != 0) return;
if (this.previewButton == event.currentTarget) {
this.preview();
}
else if (this.saveButton == event.currentTarget) {
this.save();
}
else if (this.closeButton == event.currentTarget) {
this.dialog.close();
}
break;
case "load":
var doc = this.dialog.document;
doc.body.innerHTML = '\
<style type="text/css">\
:not(input):not(select) { padding: 0px; margin: 0px; }\
table { border-spacing: 0px; }\
body, html, #main, #textarea { width: 100%; height: 100%; }\
#textarea { font-family: monospace; }\
</style>\
<table id="main">\
<tr height="100%">\
<td colspan="4"><textarea id="textarea"></textarea></td>\
</tr>\
<tr height="40">\
<td><input type="button" value="Vorschau" id="Vorschau"/></td>\
<td><input type="button" value="Speichern" id="Speichern"/></td>\
<td width="80%"><span class="log"></span></td>\
<td><input type="button" value="Schließen" id="Schliessen"/></td>\
</tr>\
</table>\
';
this.textbox = doc.querySelector("textarea");
this.previewButton = doc.querySelector('input[value="Vorschau"]');
this.saveButton = doc.querySelector('input[value="Speichern"]');
this.closeButton = doc.querySelector('input[value="Schließen"]');
this.logField = doc.querySelector('.log');
var code = "@namespace url(" + this.doc.documentElement.namespaceURI + ");\n";
code += this.win.location.protocol.indexOf("http"||"https") === 0 ?
"@-moz-document domain(" + this.win.location.host + ") {\n\n\n\n}":
"@-moz-document url(" + this.win.location.href + ") {\n\n\n\n}";
this.textbox.value = code;
this.dialog.addEventListener("unload", this, false);
this.previewButton.addEventListener("click", this, false);
this.saveButton.addEventListener("click", this, false);
this.closeButton.addEventListener("click", this, false);
this.textbox.focus();
let p = this.textbox.value.length - 3;
this.textbox.setSelectionRange(p, p);
break;
case "unload":
this.destroy();
this.callback(this);
break;
}
},
preview: function() {
var code = this.textbox.value;
if (!code || !/\:/.test(code))
return;
code = "data:text/css;charset=utf-8," + encodeURIComponent(this.textbox.value);
if (code == this.preview_code)
return;
this.preview_end();
var uri = Services.io.newURI(code, null, null);
this.sss.loadAndRegisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET);
this.preview_code = code;
this.log("Preview");
},
preview_end: function() {
if (this.preview_code) {
let uri = Services.io.newURI(this.preview_code, null, null);
this.sss.unregisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET);
this.preview_code = "";
}
},
save: function() {
var data = this.textbox.value;
if (!data) return;
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
fp.init(window, "", Ci.nsIFilePicker.modeSave);
fp.appendFilter("CSS Files","*.css");
fp.defaultExtension = "css";
if (window.UCL)
fp.displayDirectory = UCL.FOLDER;
var res = fp.show();
if (res != fp.returnOK && res != fp.returnReplace) return;
var suConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
suConverter.charset = "UTF-8";
data = suConverter.ConvertFromUnicode(data);
var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
foStream.init(fp.file, 0x02 | 0x08 | 0x20, 0664, 0);
foStream.write(data, data.length);
foStream.close();
this.saved = true;
},
log: function() {
this.logField.textContent = dateFormat(new Date(), "%H:%M:%S") + ": " + $A(arguments);
}
};
UCL.init();
function $(id) { return document.getElementById(id); }
function $A(arr) { return Array.slice(arr); }
function $C(name, attr) {
var el = document.createXULElement(name);
if (attr) Object.keys(attr).forEach(function(n) { el.setAttribute(n, attr[n]) });
return el;
}
function dateFormat(date, format) {
format = format.replace("%Y", ("000" + date.getFullYear()).substr(-4));
format = format.replace("%m", ("0" + (date.getMonth()+1)).substr(-2));
format = format.replace("%d", ("0" + date.getDay()).substr(-2));
format = format.replace("%H", ("0" + date.getHours()).substr(-2));
format = format.replace("%M", ("0" + date.getMinutes()).substr(-2));
format = format.replace("%S", ("0" + date.getSeconds()).substr(-2));
return format;
}
function log() { Application.console.log(Array.slice(arguments)); }
})();
Alles anzeigen
Die Mittelklick-Funktion funktioniert bei mir aber nicht. In meiner Version des Skripts funktioniert sie und in Speravirs Version fehlt in Zeile 300 der Eintrag onmouseup : "if (event.button == 1) event.preventDefault();",
Vielleicht liegt es daran.
Wenn es jetzt bei dir wieder funktioniert, dann vermutlich ja. Dass es bei mir fehlte, liegt daran, dass es schon in der Vorlage fehlte.
Es ist ja ein gewisses Problem hier, dass von diversen Skripten unzählige verschiedene Versionen im Umlauf sind, die man nicht immer alle bemerkt. Schon deshalb würde ich es begrüßen, wenn Endor das in seine Sammlung übernimmt.
Wer das Skript in #3092 vor dem Lesen dieses Beitrags kopiert hat, bitte nochmal updaten. Ich habe noch ein paar Korrekturen hinzugefügt.
Hallo bege,
warum im Menupopup noch ein Menupopup Namens Style-Loader-Menü erzeugen und da dann die Menuitems einfügen, kann man die Menuitems nicht direkt im Menupopup des Buttons einfügen?
Hallo bege,
warum im Menupopup noch ein Menupopup Namens Style-Loader-Menü erzeugen und da dann die Menuitems einfügen, kann man die Menuitems nicht direkt im Menupopup des Buttons einfügen?
Kann man bestimmt, aber das ist wohl vom ursprünglichen Entwickler des Skripts so angelegt. Ich finde das auch übersichtlicher, weil ich eine Menge CSS-Dateien habe und seltener die anderen Menüpunkte nutze. Und für einen schnellen Zugriff auf eine Datei habe ich die Strg+Linksklick-Funktion hinzugefügt.
Ich finde das auch übersichtlicher, weil ich eine Menge CSS-Dateien habe und seltener die anderen Menüpunkte nutze.
Dann wäre für das Bearbeiten der CSS-Dateien ein Submenü sinnvoll, aber nicht für die anderen Punkte, die wäre im ersten Menü sinnvoller aufgehoben. Ich würde denken, Style-Loader-Menü sollte CSS bearbeiten… heißen und dort sollten die Menuitem zum Aufrufen der einzelnen CSS-Dateien aufgelistet sein.
Dharkness Wie schon geschrieben passt es für mich besser wie es ist. Vielleicht findet sich noch jemand, der es so sieht wie du und es umschreiben will.
Mit Nightly 108 ergeben sich hier einige Probleme, die der Abhilfe bedürfen
Im 1. Bild sieht man, das das Loader-Icon nur zur Hälfte zu sehen ist, der Button funktioniert. Allerdings kann man, wie im 2. Bild zu sehen, das Kontext-Menü nicht bis ganz nach oben Scrollen, um dann die Schaltfläche User-Styles laden zu erreichen und auszulösen. Hier der Script-Code:
// ==UserScript==
// @name UserCSSLoader
// @description CSS Codes - Styles laden und verwalten
// @namespace https://d.hatena.ne.jp/Griever/
// @author Griever
// @include main
// @license MIT License
// @compatibility Firefox 4 - 102*
// @charset UTF-8
// @version 0.0.4k
// @note Fx92: getURLSpecFromFile() -> getURLSpecFromActualFile()
// @note AUTHOR_SHEET Verwendung hinzugefügt, wichtig: am Ende des Dateinamens .author.css
// @note Version 0.0.4.g ermoeglicht "Styles importieren" per Mittelklick und Verwendung
// @note eines anderen Dateimanager (s. vFileManager in Zeile 53)
// @note Frei verschiebbare Schaltfläche eingebaut von aborix
// @note 0.0.4 Remove E4X
// @note CSSEntry-Klasse erstellt
// @note Style-Test-Funktion überarbeitet
// @note Wenn die Datei gelöscht wurde, CSS beim Neu erstellen und Löschen des Menüs abbrechen
// @note uc einlesen .uc.css temporäre Korrespondenz zum erneuten Lesen
// ==/UserScript==
/****** Bedienungsanleitung ******
Da der CSS-Ordner im Chrome-Ordner erstellt wurde, CSS-Dateien dort ablegen - speichern.
Diejenigen, deren Dateiname mit "xul-" beginnen, diejenigen, die mit ".as.css" enden, sind AGENT_SHEET,
andere außer USER_SHEET werden gelesen. Da der Inhalt der Datei nicht überprüft wird,
darauf achten, @ Namespace Angabe nicht zu vergessen!
CSS-Menü wird zur Menüleiste hinzugefügt
Linksklick auf Stil, zum aktivieren/deaktivieren
Mittelklick auf Stil zum aktivieren/deaktivieren, ohne Menü zu schließen
Rechtsklick auf Stil zum Öffnen im Editor
Verwenden des in "view_source.editor.path" angegebenen Editors
Ordner kann geändert werden, indem ein Pfad in "UserCSSLoader.FOLDER" eingefügt wird
**** Anleitung Ende ****/
(function(){
let { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
if (!window.Services)
Cu.import("resource://gre/modules/Services.jsm");
// Wenn beim Start ein anderes Fenster angezeigt wird (das zweite Fenster), wird es beendet
let list = Services.wm.getEnumerator("navigator:browser");
while(list.hasMoreElements()){ if(list.getNext() != window) return; }
if (window.UCL) {
window.UCL.destroy();
delete window.UCL;
}
window.UCL = {
vFileManager: 'H:\\Total Commander\\TOTALCMD64.EXE',
vFMParameter: '/T',
USE_UC: "UC" in window,
AGENT_SHEET: Ci.nsIStyleSheetService.AGENT_SHEET,
USER_SHEET : Ci.nsIStyleSheetService.USER_SHEET,
AUTHOR_SHEET: Ci.nsIStyleSheetService.AUTHOR_SHEET,
readCSS : {},
get disabled_list() {
let obj = [];
try {
obj = this.prefs.getCharPref("disabled_list").split("|");
} catch(e) {}
delete this.disabled_list;
return this.disabled_list = obj;
},
get prefs() {
delete this.prefs;
return this.prefs = Services.prefs.getBranch("UserCSSLoader.")
},
get styleSheetServices(){
delete this.styleSheetServices;
return this.styleSheetServices = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
},
get FOLDER() {
let aFolder;
try {
// UserCSSLoader.FOLDER verwenden
let folderPath = this.prefs.getCharPref("FOLDER");
aFolder = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile)
aFolder.initWithPath(folderPath);
} catch (e) {
aFolder = Services.dirsvc.get("UChrm", Ci.nsIFile);
aFolder.appendRelativePath("CSS");
}
if (!aFolder.exists() || !aFolder.isDirectory()) {
aFolder.create(Ci.nsIFile.DIRECTORY_TYPE, 0664);
}
delete this.FOLDER;
return this.FOLDER = aFolder;
},
getFocusedWindow: function() {
let win = document.commandDispatcher.focusedWindow;
if (!win || win == window) win = content;
return win;
},
init: function() {
const cssmenu = $C("menu", {
id: "usercssloader-menu",
label: "CSS",
accesskey: "C",
onclick: "if (event.button == 1) UCL.rebuild()"
});
const menupopup = $C("menupopup", {
id: "usercssloader-menupopup"
});
cssmenu.appendChild(menupopup);
let menu = $C("menu", {
label: "Style Loader Menü",
accesskey: "M"
});
menupopup.appendChild(menu);
let mp = $C("menupopup", { id: "usercssloader-submenupopup" });
menu.appendChild(mp);
mp.appendChild($C("menuitem", {
label: "Styles importieren",
accesskey: "R",
acceltext: "Alt + R",
oncommand: "UCL.rebuild();"
}));
mp.appendChild($C("menuseparator"));
mp.appendChild($C("menuitem", {
label: "CSS Datei erstellen",
accesskey: "D",
oncommand: "UCL.create();"
}));
mp.appendChild($C("menuitem", {
label: "CSS Ordner öffnen",
accesskey: "O",
oncommand: "UCL.openFolder();"
}));
mp.appendChild($C("menuitem", {
label: "userChrome.css bearbeiten",
hidden: false,
oncommand: "UCL.editUserCSS(\'userChrome.css\');"
}));
mp.appendChild($C("menuitem", {
label: "userContent.css bearbeiten",
hidden: false,
oncommand: "UCL.editUserCSS(\'userContent.css\');"
}));
mp.appendChild($C("menuseparator"));
mp.appendChild($C("menuitem", {
label: "Style Test (Chrome)",
id: "usercssloader-test-chrome",
hidden: true,
accesskey: "C",
oncommand: "UCL.styleTest(window);"
}));
mp.appendChild($C("menuitem", {
label: "Style Test (Web)",
id: "usercssloader-test-content",
hidden: true,
accesskey: "W",
oncommand: "UCL.styleTest();"
}));
mp.appendChild($C("menuitem", {
label: "Styles dieser Seite auf userstyles.org finden",
accesskey: "S",
oncommand: "UCL.searchStyle();"
}));
menu = $C("menu", {
label: ".uc.css",
accesskey: "U",
hidden: !UCL.USE_UC
});
menupopup.appendChild(menu);
mp = $C("menupopup", { id: "usercssloader-ucmenupopup" });
menu.appendChild(mp);
mp.appendChild($C("menuitem", {
label: "Importieren(.uc.js)",
oncommand: "UCL.UCrebuild();"
}));
mp.appendChild($C("menuseparator", { id: "usercssloader-ucseparator" }));
CustomizableUI.createWidget({
id: 'usercssloader-menu-item',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbaritem');
toolbaritem.id = 'usercssloader-menu-item';
toolbaritem.className = 'chromeclass-toolbar-additional';
return toolbaritem;
}
});
$('usercssloader-menu-item').appendChild(cssmenu);
//let refNode = $('helpMenu');
//refNode.parentNode.insertBefore(cssmenu, refNode.nextSibling);
$("mainKeyset").appendChild($C("key", {
id: "usercssloader-rebuild-key",
oncommand: "UCL.rebuild();",
key: "R",
modifiers: "alt",
}));
this.rebuild();
this.initialized = true;
if (UCL.USE_UC) {
setTimeout(function() {
UCL.UCcreateMenuitem();
}, 1000);
}
window.addEventListener("unload", this, false);
},
uninit: function() {
const dis = [];
for (let x of Object.keys(this.readCSS)) {
if (!this.readCSS[x].enabled)
dis.push(x);
}
this.prefs.setCharPref("disabled_list", dis.join("|"));
window.removeEventListener("unload", this, false);
},
destroy: function() {
var i = document.getElementById("usercssloader-menu");
if (i) i.parentNode.removeChild(i);
var i = document.getElementById("usercssloader-rebuild-key");
if (i) i.parentNode.removeChild(i);
this.uninit();
},
handleEvent: function(event) {
switch(event.type){
case "unload": this.uninit(); break;
}
},
rebuild: function() {
let ext = /\.css$/i;
let not = /\.uc\.css/i;
let files = this.FOLDER.directoryEntries.QueryInterface(Ci.nsISimpleEnumerator);
while (files.hasMoreElements()) {
let file = files.getNext().QueryInterface(Ci.nsIFile);
if (!ext.test(file.leafName) || not.test(file.leafName)) continue;
let CSS = this.loadCSS(file);
CSS.flag = true;
}
for (let leafName of Object.keys(this.readCSS)) {
const CSS = this.readCSS[leafName];
if (!CSS.flag) {
CSS.enabled = false;
delete this.readCSS[leafName];
}
delete CSS.flag;
this.rebuildMenu(leafName);
}
if (this.initialized) {
if (typeof(StatusPanel) !== "undefined")
StatusPanel._label = "Style importiert";
else
XULBrowserWindow.statusTextField.label = "Styles importieren";
}
},
loadCSS: function(aFile) {
var CSS = this.readCSS[aFile.leafName];
if (!CSS) {
CSS = this.readCSS[aFile.leafName] = new CSSEntry(aFile);
if (this.disabled_list.indexOf(CSS.leafName) === -1) {
CSS.enabled = true;
}
} else if (CSS.enabled) {
CSS.enabled = true;
}
return CSS;
},
rebuildMenu: function(aLeafName) {
var CSS = this.readCSS[aLeafName];
var menuitem = document.getElementById("usercssloader-" + aLeafName);
if (!CSS) {
if (menuitem)
menuitem.parentNode.removeChild(menuitem);
return;
}
if (!menuitem) {
menuitem = $C("menuitem", {
label : aLeafName,
id : "usercssloader-" + aLeafName,
class : "usercssloader-item " + (CSS.SHEET == this.AGENT_SHEET? "AGENT_SHEET" : CSS.SHEET == this.AUTHOR_SHEET? "AUTHOR_SHEET": "USER_SHEET"),
type : "checkbox",
autocheck : "false",
oncommand : "UCL.toggle('"+ aLeafName +"');",
onclick : "UCL.itemClick(event);"
});
document.getElementById("usercssloader-menupopup").appendChild(menuitem);
}
menuitem.setAttribute("checked", CSS.enabled);
},
toggle: function(aLeafName) {
var CSS = this.readCSS[aLeafName];
if (!CSS) return;
CSS.enabled = !CSS.enabled;
this.rebuildMenu(aLeafName);
},
itemClick: function(event) {
if (event.button == 0) return;
event.preventDefault();
event.stopPropagation();
let label = event.currentTarget.getAttribute("label");
if (event.button == 1) {
this.toggle(label);
}
else if (event.button == 2) {
closeMenus(event.target);
this.edit(this.getFileFromLeafName(label));
}
},
getFileFromLeafName: function(aLeafName) {
let f = this.FOLDER.clone();
f.QueryInterface(Ci.nsIFile); // use appendRelativePath
f.appendRelativePath(aLeafName);
return f;
},
styleTest: function(aWindow) {
aWindow || (aWindow = this.getFocusedWindow());
new CSSTester(aWindow, function(tester){
if (tester.saved)
UCL.rebuild();
});
},
searchStyle: function() {
let word;
try {
word = gBrowser.currentURI.host;
} catch {
word = gBrowser.currentURI.spec;
}
openWebLinkIn("https://userstyles.org/styles/search/" + word, "tab", {});
},
openFolder:function(){
if (this.vFileManager.length != 0) {
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
var args=[this.FOLDER.path];
file.initWithPath(this.vFileManager);
process.init(file);
// Verzeichnis mit anderem Dateimanager öffnen
process.run(false, args, args.length);
} else {
// Verzeichnis mit Dateimanager des Systems öffnen
this.FOLDER.launch();
}
},
editUserCSS: function(aLeafName) {
let file = Services.dirsvc.get("UChrm", Ci.nsIFile);
file.appendRelativePath(aLeafName);
this.edit(file);
},
edit: function(aFile) {
var editor = Services.prefs.getCharPref("view_source.editor.path");
if (!editor) return alert("Unter about:config den vorhandenen Schalter:\n view_source.editor.path mit dem Editorpfad ergänzen");
try {
var UI = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
UI.charset = window.navigator.platform.toLowerCase().indexOf("win") >= 0? "Shift_JIS": "UTF-8";
var path = UI.ConvertFromUnicode(aFile.path);
var app = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
app.initWithPath(editor);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(app);
process.run(false, [path], 1);
} catch (e) {}
},
create: function(aLeafName) {
if (!aLeafName) aLeafName = prompt("Name des Styles", dateFormat(new Date(), "%Y_%m%d_%H%M%S"));
if (aLeafName) aLeafName = aLeafName.replace(/\s+/g, " ").replace(/[\\/:*?\"<>|]/g, "");
if (!aLeafName || !/\S/.test(aLeafName)) return;
if (!/\.css$/.test(aLeafName)) aLeafName += ".css";
let file = this.getFileFromLeafName(aLeafName);
this.edit(file);
},
UCrebuild: function() {
let re = /^file:.*\.uc\.css(?:\?\d+)?$/i;
let query = "?" + new Date().getTime();
Array.slice(document.styleSheets).forEach(function(css){
if (!re.test(css.href)) return;
if (css.ownerNode) {
css.ownerNode.parentNode.removeChild(css.ownerNode);
}
let pi = document.createProcessingInstruction('xml-stylesheet','type="text/css" href="'+ css.href.replace(/\?.*/, '') + query +'"');
document.insertBefore(pi, document.documentElement);
});
UCL.UCcreateMenuitem();
},
UCcreateMenuitem: function() {
let sep = $("usercssloader-ucseparator");
let popup = sep.parentNode;
if (sep.nextSibling) {
let range = document.createRange();
range.setStartAfter(sep);
range.setEndAfter(popup.lastChild);
range.deleteContents();
range.detach();
}
let re = /^file:.*\.uc\.css(?:\?\d+)?$/i;
Array.slice(document.styleSheets).forEach(function(css) {
if (!re.test(css.href)) return;
let fileURL = decodeURIComponent(css.href).split("?")[0];
let aLeafName = fileURL.split("/").pop();
let m = $C("menuitem", {
label : aLeafName,
tooltiptext : fileURL,
id : "usercssloader-" + aLeafName,
type : "checkbox",
autocheck : "false",
checked : "true",
oncommand : "this.setAttribute('checked', !(this.css.disabled = !this.css.disabled));",
onclick : "UCL.UCItemClick(event);"
});
m.css = css;
popup.appendChild(m);
});
},
UCItemClick: function(event) {
if (event.button == 0) return;
event.preventDefault();
event.stopPropagation();
if (event.button == 1) {
event.target.doCommand();
}
else if (event.button == 2) {
closeMenus(event.target);
let fileURL = event.currentTarget.getAttribute("tooltiptext");
let file = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler).getFileFromURLSpec(fileURL);
this.edit(file);
}
},
};
function CSSEntry(aFile) {
this.path = aFile.path;
this.leafName = aFile.leafName;
this.lastModifiedTime = 1;
this.SHEET = /^xul-|\.as\.css$/i.test(this.leafName) ?
Ci.nsIStyleSheetService.AGENT_SHEET:
Ci.nsIStyleSheetService.USER_SHEET;
}
CSSEntry.prototype = {
sss: Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService),
_enabled: false,
get enabled() {
return this._enabled;
},
set enabled(isEnable) {
var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile)
aFile.initWithPath(this.path);
var isExists = aFile.exists(); // Wenn die Datei existiert true
var lastModifiedTime = isExists ? aFile.lastModifiedTime : 0;
var isForced = this.lastModifiedTime != lastModifiedTime; // Wenn es eine Änderung in der Datei gibt true
var fileURL = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromActualFile(aFile);
var uri = Services.io.newURI(fileURL, null, null);
if (this.sss.sheetRegistered(uri, this.SHEET)) {
// Wenn diese Datei bereits gelesen wurde
if (!isEnable || !isExists) {
this.sss.unregisterSheet(uri, this.SHEET);
}
else if (isForced) {
// Nach Stornierung erneut einlesen
this.sss.unregisterSheet(uri, this.SHEET);
this.sss.loadAndRegisterSheet(uri, this.SHEET);
}
} else {
// Datei wurde nicht gelesen
if (isEnable && isExists) {
this.sss.loadAndRegisterSheet(uri, this.SHEET);
}
}
if (this.lastModifiedTime !== 1 && isEnable && isForced) {
log(this.leafName + " wurde aktualisiert");
}
this.lastModifiedTime = lastModifiedTime;
return this._enabled = isEnable;
},
};
function CSSTester(aWindow, aCallback) {
this.win = aWindow || window;
this.doc = this.win.document;
this.callback = aCallback;
this.init();
}
CSSTester.prototype = {
sss: Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService),
preview_code: "",
saved: false,
init: function() {
this.dialog = openDialog(
"data:text/html;charset=utf8,"+encodeURIComponent('<!DOCTYPE HTML><html lang="de"><head><title>CSSTester</title></head><body></body></html>'),
"",
"width=550,height=400,dialog=no");
this.dialog.addEventListener("load", this, false);
},
destroy: function() {
this.preview_end();
this.dialog.removeEventListener("unload", this, false);
this.previewButton.removeEventListener("click", this, false);
this.saveButton.removeEventListener("click", this, false);
this.closeButton.removeEventListener("click", this, false);
},
handleEvent: function(event) {
switch(event.type) {
case "click":
if (event.button != 0) return;
if (this.previewButton == event.currentTarget) {
this.preview();
}
else if (this.saveButton == event.currentTarget) {
this.save();
}
else if (this.closeButton == event.currentTarget) {
this.dialog.close();
}
break;
case "load":
var doc = this.dialog.document;
doc.body.innerHTML = '\
<style type="text/css">\
:not(input):not(select) { padding: 0px; margin: 0px; }\
table { border-spacing: 0px; }\
body, html, #main, #textarea { width: 100%; height: 100%; }\
#textarea { font-family: monospace; }\
</style>\
<table id="main">\
<tr height="100%">\
<td colspan="4"><textarea id="textarea"></textarea></td>\
</tr>\
<tr height="40">\
<td><input type="button" value="Vorschau" id="Vorschau"/></td>\
<td><input type="button" value="Speichern" id="Speichern"/></td>\
<td width="80%"><span class="log"></span></td>\
<td><input type="button" value="Schließen" id="Schliessen"/></td>\
</tr>\
</table>\
';
this.textbox = doc.querySelector("textarea");
this.previewButton = doc.querySelector('input[value="Vorschau"]');
this.saveButton = doc.querySelector('input[value="Speichern"]');
this.closeButton = doc.querySelector('input[value="Schließen"]');
this.logField = doc.querySelector('.log');
var code = "@namespace url(" + this.doc.documentElement.namespaceURI + ");\n";
code += this.win.location.protocol.indexOf("http") === 0?
"@-moz-document domain(" + this.win.location.host + ") {\n\n\n\n}":
"@-moz-document url(" + this.win.location.href + ") {\n\n\n\n}";
this.textbox.value = code;
this.dialog.addEventListener("unload", this, false);
this.previewButton.addEventListener("click", this, false);
this.saveButton.addEventListener("click", this, false);
this.closeButton.addEventListener("click", this, false);
this.textbox.focus();
let p = this.textbox.value.length - 3;
this.textbox.setSelectionRange(p, p);
break;
case "unload":
this.destroy();
this.callback(this);
break;
}
},
preview: function() {
var code = this.textbox.value;
if (!code || !/\:/.test(code))
return;
code = "data:text/css;charset=utf-8," + encodeURIComponent(this.textbox.value);
if (code == this.preview_code)
return;
this.preview_end();
var uri = Services.io.newURI(code, null, null);
this.sss.loadAndRegisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET);
this.preview_code = code;
this.log("Preview");
},
preview_end: function() {
if (this.preview_code) {
let uri = Services.io.newURI(this.preview_code, null, null);
this.sss.unregisterSheet(uri, Ci.nsIStyleSheetService.AGENT_SHEET);
this.preview_code = "";
}
},
save: function() {
var data = this.textbox.value;
if (!data) return;
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
fp.init(window, "", Ci.nsIFilePicker.modeSave);
fp.appendFilter("CSS Files","*.css");
fp.defaultExtension = "css";
if (window.UCL)
fp.displayDirectory = UCL.FOLDER;
var res = fp.show();
if (res != fp.returnOK && res != fp.returnReplace) return;
var suConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
suConverter.charset = "UTF-8";
data = suConverter.ConvertFromUnicode(data);
var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
foStream.init(fp.file, 0x02 | 0x08 | 0x20, 0664, 0);
foStream.write(data, data.length);
foStream.close();
this.saved = true;
},
log: function() {
this.logField.textContent = dateFormat(new Date(), "%H:%M:%S") + ": " + $A(arguments);
}
};
UCL.init();
function $(id) { return document.getElementById(id); }
function $A(arr) { return Array.slice(arr); }
function $C(name, attr) {
var el = document.createXULElement(name);
if (attr) Object.keys(attr).forEach(function(n) { el.setAttribute(n, attr[n]) });
return el;
}
function dateFormat(date, format) {
format = format.replace("%Y", ("000" + date.getFullYear()).substr(-4));
format = format.replace("%m", ("0" + (date.getMonth()+1)).substr(-2));
format = format.replace("%d", ("0" + date.getDay()).substr(-2));
format = format.replace("%H", ("0" + date.getHours()).substr(-2));
format = format.replace("%M", ("0" + date.getMinutes()).substr(-2));
format = format.replace("%S", ("0" + date.getSeconds()).substr(-2));
return format;
}
function log() { Application.console.log(Array.slice(arguments)); }
})();
Alles anzeigen
und hier noch ein CSS dazu:
/* UserStyles Loader Button */
#usercssloader-menu {
margin-right: 0 !important;
margin-left: 0 !important;
content: '' !important;
display: block !important;
width: 14px !important;
height: 20px !important;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAABRUlEQVQ4jaXSLW/CUBTG8YdMTmxijiY1M62A8w2omZ1jlhA0mC6ZJTiSKewsDgesohgICWLjQ0DCkvJOPeGZGG3Xji50O8kvueeKv7kX+JorAFkAuRh3AATADYALnJjsfD5nHMuySJKFQuHxGElFA7nFYsE4XoAkdV1/AHAdjeRWqxXjtNttfp9MJnMP4DIUWK/XjDMYDBgdALehwHa7ZZzpdMrhcMhut0vbtmnbNgEYocBut2MSx9cJAq7rMokgYI6ZMt/+BOaYgDnmy7vr8+ac3Q80RhuWOw5JstxxfL/tjdEmCNT7SxZbM5JksTULid55e72/DALVnsN8c0KSzDcnP0TvSbLac4LA0+uHz5vo+dTuB/7F+wf7/Z5J+P9ARAxFUSqHw4FJKIpSEREDImJomlZSVbWWTqefz6Gqak3TtJKIGJ86u+Qm3Nb2fAAAAABJRU5ErkJggg==") !important;
background-repeat: no-repeat !important;
background-position: 5px 6px !important;
background-size: 15px 15px !important;
}
#usercssloader-menu > .menu-text,
#usercssloader-menu > .menu-right {
display: none !important;
}
#usercssloader-menu:hover {
margin-right: 0 !important;
margin-left: 0 !important;
content: '' !important;
display: block !important;
width: 14px !important;
height: 20px !important;
background: lightgrey !important;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAABRUlEQVQ4jaXSLW/CUBTG8YdMTmxijiY1M62A8w2omZ1jlhA0mC6ZJTiSKewsDgesohgICWLjQ0DCkvJOPeGZGG3Xji50O8kvueeKv7kX+JorAFkAuRh3AATADYALnJjsfD5nHMuySJKFQuHxGElFA7nFYsE4XoAkdV1/AHAdjeRWqxXjtNttfp9MJnMP4DIUWK/XjDMYDBgdALehwHa7ZZzpdMrhcMhut0vbtmnbNgEYocBut2MSx9cJAq7rMokgYI6ZMt/+BOaYgDnmy7vr8+ac3Q80RhuWOw5JstxxfL/tjdEmCNT7SxZbM5JksTULid55e72/DALVnsN8c0KSzDcnP0TvSbLac4LA0+uHz5vo+dTuB/7F+wf7/Z5J+P9ARAxFUSqHw4FJKIpSEREDImJomlZSVbWWTqefz6Gqak3TtJKIGJ86u+Qm3Nb2fAAAAABJRU5ErkJggg==") !important;
background-repeat: no-repeat !important;
background-position: 5px 6px !important;
background-size: 15px 15px !important;
}
#usercssloader-menu > .menu-text,
#usercssloader-menu > .menu-right {
display: none !important;
}
Alles anzeigen
Hallo Boersenfeger.
Das liegt an einem anderen CSS Code, der das Symbol vom CSS Loaderscript anzeigt.
Der sieht hier so aus:
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url(chrome://browser/content/browser.xhtml){
#usercssloader-menu {
-moz-appearance:none!important;
margin-right: -6px !important;
margin-left: -1px !important;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAADJklEQVR4Xi3Pb0yVdRjG8e%2Fze57ncDrAOWwRhDQ7xYAMlAgIBW2txaio5TvMzZa68oWtzRdKbXbIpWyOzcWLWqXkFjUtsIksW72wuTVx%2BEJHCxhkSCNoKLYDwuH8e66eNV98dr24t%2Fu%2BLwsAoKsucqg4tFS4kiTtge4PFAkRksADGdsyua4JXJ7ITH0yQw%2BABTB3sHGipGNjJX8MgzGw6oEBQi5kPYinQBYEbDDAX5PEulJXPhqn2bQE2Fayfa2S8THOfu%2FwzTkDzmOQV8nAkOHMoIFgmS9K3w%2Fi5DmP1fwqdrbRFIR6euqJ6btc2Y4jsGWM0emOWrU2FAtQRTSiid7n9EJtkQCVlebrUle9lnuLVA3v09%2FG8diLCFxp%2BDVprF2a2KHqsrACtqVbQy9L8T2qq4goaKOpz5uka22Kn1yn2gBHOPMSx9o3obJokbS8R%2Fp3txTfK918Q%2B2tjwrQYPcWaW6Xdj5fKkB9B2uks%2Bv1VICYSWXQjia4eWuB8z2%2F0%2F%2FpGMMD04yP3qFzfzXBoE3sszGmR27Tubuc3KDDsf4ZsME2iO4GjuqXQh1orxDwv1OxBsX2VQlQcWGObnzdog%2F3bhCg0uIHNPLFVqnf%2F8DlA2ctDSTgxNFnOHFgE7jAg7kQcjnS8TRgQcCiprGQzncrIZ0i%2Fu0so7lLODlgsh6QSMNCAix8BhJJNH6b5NwyFNhwLwWuB%2FNxEoemudi9wMT8Cq4LBrDwgLUULK%2FBPR9%2BjC4ytPUC17%2F8DR6CpYEplt%2BeJTX7OH9HbEL5NvKwjGvj4AHprC8DSZ%2B%2FzHJgI%2BuI%2BxdvbL9E%2BJRLJr%2BSr5LXKd8foqY8QjqN7fxzlzhaAy8LGYHnQTxJ3hNhFlptCi4XsP7PEoaD4mr4KlveeZjNG4qYvDbKyipJolCXOI70U630Y6uvRfrZzyuvSKOvavK9Kp2OFqv3zagWLzb7s21aubBZ519HFjzrg8NP8utbu2hWMIyyHpYBYwyOa2Hn2cwuJAiHAthp%2Be087s4n6e5LjwzeodECAKiAffk5PJLOkJKFACzLZ8B27jfMYgUM7mKSuzPwMcB%2F6Jh%2FV5xUni0AAAAASUVORK5CYII%3D") no-repeat !important;
background-position:1px 6px!important;
}
#usercssloader-menu:hover {
-moz-appearance:none !important;
margin-left: -5px !important;
margin-right: -3px !important;
padding-right: 1px !important;
background: #E3E3E3 url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAADJklEQVR4Xi3Pb0yVdRjG8e%2Fze57ncDrAOWwRhDQ7xYAMlAgIBW2txaio5TvMzZa68oWtzRdKbXbIpWyOzcWLWqXkFjUtsIksW72wuTVx%2BEJHCxhkSCNoKLYDwuH8e66eNV98dr24t%2Fu%2BLwsAoKsucqg4tFS4kiTtge4PFAkRksADGdsyua4JXJ7ITH0yQw%2BABTB3sHGipGNjJX8MgzGw6oEBQi5kPYinQBYEbDDAX5PEulJXPhqn2bQE2Fayfa2S8THOfu%2FwzTkDzmOQV8nAkOHMoIFgmS9K3w%2Fi5DmP1fwqdrbRFIR6euqJ6btc2Y4jsGWM0emOWrU2FAtQRTSiid7n9EJtkQCVlebrUle9lnuLVA3v09%2FG8diLCFxp%2BDVprF2a2KHqsrACtqVbQy9L8T2qq4goaKOpz5uka22Kn1yn2gBHOPMSx9o3obJokbS8R%2Fp3txTfK918Q%2B2tjwrQYPcWaW6Xdj5fKkB9B2uks%2Bv1VICYSWXQjia4eWuB8z2%2F0%2F%2FpGMMD04yP3qFzfzXBoE3sszGmR27Tubuc3KDDsf4ZsME2iO4GjuqXQh1orxDwv1OxBsX2VQlQcWGObnzdog%2F3bhCg0uIHNPLFVqnf%2F8DlA2ctDSTgxNFnOHFgE7jAg7kQcjnS8TRgQcCiprGQzncrIZ0i%2Fu0so7lLODlgsh6QSMNCAix8BhJJNH6b5NwyFNhwLwWuB%2FNxEoemudi9wMT8Cq4LBrDwgLUULK%2FBPR9%2BjC4ytPUC17%2F8DR6CpYEplt%2BeJTX7OH9HbEL5NvKwjGvj4AHprC8DSZ%2B%2FzHJgI%2BuI%2BxdvbL9E%2BJRLJr%2BSr5LXKd8foqY8QjqN7fxzlzhaAy8LGYHnQTxJ3hNhFlptCi4XsP7PEoaD4mr4KlveeZjNG4qYvDbKyipJolCXOI70U630Y6uvRfrZzyuvSKOvavK9Kp2OFqv3zagWLzb7s21aubBZ519HFjzrg8NP8utbu2hWMIyyHpYBYwyOa2Hn2cwuJAiHAthp%2Be087s4n6e5LjwzeodECAKiAffk5PJLOkJKFACzLZ8B27jfMYgUM7mKSuzPwMcB%2F6Jh%2FV5xUni0AAAAASUVORK5CYII%3D") no-repeat !important;
background-position:5px 6px!important;
}
#usercssloader-menu > .menu-text,
#usercssloader-menu > .menu-right {
display: none !important;
}
}
Alles anzeigen
Such Deinen mal raus und vergleiche.
Mfg.
Endor