Полезная информация

Пользователи не любят читать документацию. Станьте оригинальным, будьте не как все. Ознакомьтесь с нашей базой знаний.

№1157617-10-2021 08:49:03

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

Dumby пишет

Да, с этим возился, но всё равно сейчас ещё поправлять пришлось.

Спасибо.

_zt пишет

Правда у меня немного модифицированная, но думаю разберетесь.

Ага, спасибо, мне такая даже лучше, ибо не модифицированная есть в Add Toolbar Buttons.

Отсутствует

 

№1157717-10-2021 10:21:48

Dobrov
Участник
 
Группа: Members
Зарегистрирован: 04-10-2011
Сообщений: 395
UA: Firefox 87.0

Re: Настройка внешнего вида Firefox в userChrome.css

перестал работать CSS, переключающий стиль на любой странице на более подходящий для чтения - на зелёный фон и чёрный текст.
На форуме есть только старый CSS-код, но в новых Firefox в результате остаётся только зелёный фон, а должен меняться и фон и текст.

Выделить код

Код:

/*AGENT_SHEET*/

@-moz-document url-prefix("http"), url-prefix("https"), url-prefix("ftp"), url-prefix("file") {
html *, html {
background: #ccd1d1 !important; text-shadow: none !important;
color: #000000 !important;
-moz-border-top-colors: #8FBC8F !important; -moz-border-bottom-colors: #8FBC8F!important; -moz-border-left-colors: #8FBC8F !important; -moz-border-right-colors: #8FBC8F !important;
}
code, pre, input, samp, kbd, var, dfn,.postright {
-moz-appearance: none !important;
background-color: #BADBAD !important;
}
input, select, textarea, button {
-moz-appearance: none !important;
border: 1px solid #BADBAD !important;
background-color: #BADBAD !important;
}
.codebox, BLOCKQUOTE, TEXTAREA, .spoiler { -moz-border-top-colors: #444  !important; -moz-border-bottom-colors: #444 !important;
-moz-border-left-colors: #444 !important; -moz-border-right-colors: #444 !important; }
}

UCF - Кнопка переключения стиля страниц

Выделить код

Код:

try {	CustomizableUI.createWidget({ tooltiptext: `ЛКМ:	Reader`,
		type: "custom", id: "ucf_Reader", label: "Reader", localized: false,
		onBuild(doc) {
			var trbn = doc.createXULElement("toolbarbutton");
			trbn.id = this.id; trbn.tooltipText = this.tooltiptext; trbn.label = this.label;
			trbn.className = "toolbarbutton-1 chromeclass-toolbar-additional";
			trbn.setAttribute("context", false);
			trbn.style.setProperty("list-style-image", 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAACS0lEQVR4Xt1VIZCkMBBcGYlERiKRSCQSuTISiUQiVyJXIle8QCKRSOTJkyterDtU8t1cpipVl937f3mpmkuupnt6MjNhTz9v1XWdYi1Jkjit9YilXuGBGYDfySH3WwEAR2xODCLdi+BtiCX32+yVUg8cd5BvJPH/WGZVVRF790lM5ITYqGVZZkhAeVbnnOIOkivLMosIZPARu2ERu5DrY8QXQFNYFgTWsOoZviiKSsSlXBCan5VH84qwXUj/YuSAK2XSsYZJeZb/nUByfQWamHOmM8/z3hiTNU2T/q1A27YpOeTGysSGHeWRqZGrYuwm+J6Wiz5OkHDCGIwZn2eaUnJmNnfUN4/UPIfvPcahMeaX2qVa2/Y62mHdbD/NNitKK2OLF52gBAWNZ6yVPmKIJYdcxgh66buPRwKCI2janZ0eznEf3x9W57n1r3TjHp7pIybkUAjixH1Oo0xPZZoD+Ov37sRIaIbrIRAz+oi53T/x3MlBLEnKnND9leCW4IcIfBzGrIZlFYEd5TE0nmH0kQNsIIAYrU8Kk7id8Gf9zGZANqHAAXaXeQlrGvaMvi8C4a0ZmyU6E1zWZ1/LAyhgZy6D1H0QAX+m78AInlwKlOfzIcDYbLJ8Ilx/m+wcNOy6vXEqnH+ApQj4s6OPGGkyuYzBWPJl9RnpngSF7tdtZzuAzOUSjtwU+d2YvAixB4dcxvDZ9+FTVyDcggmxwUNbi6JIBRvcIqUvxoH42HWdiv0eNFB+4xWx32E9xJMX36CEGGI5++BvjHH6UesPIe4VKP0pWeUAAAAASUVORK5CYII=")', "important");
			trbn.addEventListener("click", function(e) {
				var win = e.view;
				if (e.button == 0) {

					var green = `
@-moz-document url-prefix("http"), url-prefix("https"), url-prefix("ftp"), url-prefix("file") {
html *, html {
background: #ccd1d1 !important; text-shadow: none !important;
color: #000000 !important;
-moz-border-top-colors: #8FBC8F !important; -moz-border-bottom-colors: #8FBC8F!important; -moz-border-left-colors: #8FBC8F !important; -moz-border-right-colors: #8FBC8F !important;
}
code, pre, input, samp, kbd, var, dfn,.postright {
-moz-appearance: none !important;
background-color: #BADBAD !important;
}
input, select, textarea, button {
-moz-appearance: none !important;
border: 1px solid #BADBAD !important;
background-color: #BADBAD !important;
}
.codebox, BLOCKQUOTE, TEXTAREA, .spoiler { -moz-border-top-colors: #444  !important; -moz-border-bottom-colors: #444 !important;
-moz-border-left-colors: #444 !important; -moz-border-right-colors: #444 !important; }
a:link { color: #300090 !important;
}
a:visited { color: #489412 !important; }
a:active { color: #d81e1e !important; }
a:hover { color: #d81e1e !important; }
}`;
					var sss = this.sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
					var uri = this.uri = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService).newURI("data:text/css,"+ encodeURIComponent(green),null,null);

					function setStyleForPages( reason ) {
						var style = sss.sheetRegistered(uri, sss.AGENT_SHEET);
					style
						? sss.unregisterSheet(uri, sss.AGENT_SHEET)
						: sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
					};
					setStyleForPages();
					return;
				}
			}, false);
			return trbn;
		},
	});
} catch(e) {}

Отсутствует

 

№1157817-10-2021 13:00:32

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

Dobrov
А так, вместо первой секции?

скрытый текст

Выделить код

Код:

html *, html {
background: #ccd1d1 !important; text-shadow: none !important;
-moz-border-top-colors: #8FBC8F !important; -moz-border-bottom-colors: #8FBC8F!important; -moz-border-left-colors: #8FBC8F !important; -moz-border-right-colors: #8FBC8F !important;
}
html, body, input, textarea, select, button {
color: #000000 !important;
}


И вроде вместо -moz-appearance теперь просто appearance надо.

Отредактировано _zt (17-10-2021 13:10:37)

Отсутствует

 

№1157917-10-2021 13:30:26

ALEX_45_ORP
Участник
 
Группа: Members
Зарегистрирован: 18-01-2018
Сообщений: 162
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

как через userChrome.css уменьшить расстояние между иконками на панели навигации в 93 [firefox]?


Win 10х64

Отсутствует

 

№1158017-10-2021 16:35:11

Гавроша
Участник
 
Группа: Members
Зарегистрирован: 13-09-2021
Сообщений: 16
UA: Firefox 92.0

Re: Настройка внешнего вида Firefox в userChrome.css

Гавроша пишет
sandro79 пишет
beloff пишет

как на вкладках сделать боковые и нижние границы? И можно ли цвет линий вкладок и закладок сделать более темным?

Не пойму, почему у вас всё сплошным чистым белым цветом. Или так и должно быть.
Обновлённый стиль для вкладок под строкой адреса здесь, включил его в стиль ниже в процессе подгонки. Попробуйте так, вроде всё нормально

скрытый текст

Выделить код

Код:

/* вкладки не вверху */
@-moz-document url("chrome://browser/content/browser.xhtml") {
:root {
    --v-toolbar-menubar-height: 28px; /* высота панели меню, только чётные числа не меньше 20px,
    если изменяете эту переменную то и в --v-toolbar-menubar-height-content - атрибут height= нужно установить ровно в два раза больше*/
    --v-toolbar-menubar-height-content: url("data:image/svg+xml,<svg width='28' height='56' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='0' width='100%' height='100%' style='fill:transparent;'/></svg>");  /* height='2 * --v-toolbar-menubar-height' */
    --tab-border-radius: 4px !important;

    /* **************************************** */
    --proton-tab-block-margin: 0px !important;
    --tab-block-margin: 0px !important;
}
#navigator-toolbox {
    border-block: none !important;
    box-shadow: none !important;
    padding-top: 0 !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
:root:not([inFullscreen])[tabsintitlebar] #navigator-toolbox {
    position: relative !important;
}
#navigator-toolbox > toolbar {
    -moz-box-ordinal-group: 10 !important;
}
#navigator-toolbox > #nav-bar {
    margin-block: 0 !important;
    box-shadow: none !important;
    -moz-box-ordinal-group: 0 !important;
    padding-inline: 0 !important;
}
:root:not([inFullscreen]) #navigator-toolbox > #nav-bar {
    margin-top: var(--v-toolbar-menubar-height) !important;
}
#navigator-toolbox > #PersonalToolbar {
    -moz-box-ordinal-group: 1 !important;
}
:root:not([inFullscreen])[tabsintitlebar] > *|body::before {
    content: var(--v-toolbar-menubar-height-content) !important;
    display: -moz-box !important;
    -moz-box-flex: 0 !important;
    -moz-box-orient: vertical !important;
    -moz-box-pack: start !important;
    -moz-box-align: stretch !important;
    -moz-box-ordinal-group: 0 !important;
    margin-bottom: calc(-2 * var(--v-toolbar-menubar-height)) !important;
    box-sizing: content-box !important;
}
:root:not([inFullscreen])[tabsintitlebar][sizemode="normal"] > *|body::before {
    -moz-appearance: -moz-window-titlebar !important;
    appearance: -moz-window-titlebar !important;
}
:root:not([inFullscreen])[tabsintitlebar][sizemode="maximized"] > *|body::before {
    -moz-appearance: -moz-window-titlebar-maximized !important;
    appearance: -moz-window-titlebar-maximized !important;
}
:root:not([inFullscreen])[tabsintitlebar]:-moz-lwtheme > *|body::before {
    visibility: hidden !important;
}
@media not all and (-moz-os-version: windows-win7) {
    @media not all and (-moz-os-version: windows-win8) {
:root:-moz-lwtheme {
    background-color: var(--lwt-accent-color, -moz-Dialog) !important;
}
:root:-moz-window-inactive:-moz-lwtheme {
    background-color: var(--lwt-accent-color-inactive, var(--lwt-accent-color, -moz-Dialog)) !important;
}
    }
}
#navigator-toolbox > #titlebar {
    -moz-appearance: none !important;
    appearance: none !important;
    -moz-box-ordinal-group: 100 !important;
    position: static !important;
}
#toolbar-menubar {
    padding-block: 0 !important;
    margin-block: 0 !important;
    border: none !important;
    background: none !important;
    --toolbarbutton-outer-padding: 0px !important;
    --toolbarbutton-inner-padding: calc((var(--v-toolbar-menubar-height) - 16px) / 2) !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
:root:not(:is([inFullscreen],[chromehidden~="menubar"])) #toolbar-menubar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
    height: var(--v-toolbar-menubar-height) !important;
    overflow: hidden !important;
}
#toolbar-menubar .toolbarbutton-badge {
    margin-inline-end: calc(-1 * (var(--toolbarbutton-outer-padding) + var(--toolbarbutton-inner-padding))) !important;
}
:root:not([inFullscreen]) #toolbar-menubar > :is(toolbaritem,toolbarbutton) {
    align-self: center !important;
}
:root:not([inFullscreen]) #toolbar-menubar > :is(#menubar-items,#wrapper-menubar-items,.titlebar-buttonbox-container) {
    align-self: flex-start !important;
}
:root:not([inFullscreen]) #toolbar-menubar > * {
    padding-block: 0 !important;
    margin-block: 0 !important;
}
:root:not([inFullscreen]) #toolbar-menubar[autohide="true"][inactive="true"]:not([customizing="true"]) > *:not(.titlebar-buttonbox-container) {
    opacity: 0 !important;
    pointer-events: none !important;
}
:root[inFullscreen] #toolbar-menubar {
    visibility: collapse !important;
}
:root:not([inFullscreen]) #toolbar-menubar > :is(*[style*="-moz-box-ordinal-group: 1000;"],.titlebar-buttonbox-container) {
    order: 1000 !important;
}
:root:not([inFullscreen]) #toolbar-menubar > :is(toolbarspring,spacer,[id^="wrapper-customizableui-special-spring"]) {
    flex-grow: 1 !important;
}
:root:not([inFullscreen]) #toolbar-menubar > :is(#search-container,#wrapper-search-container) {
    flex-grow: 100 !important;
}
#toolbar-menubar #search-container {
    padding-block: 0 !important;
}
#toolbar-menubar #searchbar {
    min-height: calc(var(--v-toolbar-menubar-height) - 2px) !important;
}
#TabsToolbar {
    -moz-appearance: none !important;
    appearance: none !important;
    padding-block: 0 !important;
    margin-block: 0 !important;
    box-shadow: 0 -1px 0 var(--tabs-border-color, rgba(0,0,0,.3)) inset !important;
    position: static !important;
    background-color: var(--toolbar-bgcolor, -moz-dialog) !important;
    background-image: var(--toolbar-bgimage, none) !important;
    color: var(--toolbar-color, -moz-dialogtext) !important;
    --lwt-toolbarbutton-icon-fill: inherit !important;
}
#TabsToolbar #tabbrowser-tabs {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}
#TabsToolbar .tabbrowser-tab {
    background-color: transparent !important;
    border-top: none !important;
}
#TabsToolbar .tab-background {
    border-end-end-radius: 0 !important;
    border-end-start-radius: 0 !important;
}
#TabsToolbar > .toolbar-items {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
#TabsToolbar .tab-background {
    border-top-style: solid !important;
}
#TabsToolbar .titlebar-buttonbox-container,
#navigator-toolbox::after,
#TabsToolbar::after,
#TabsToolbar .titlebar-spacer:is([type="pre-tabs"],[type="post-tabs"]) {
    display: none !important;
}
#scrollbutton-up, #scrollbutton-down {
    border-block: none !important;
    border-end-end-radius: 0 !important;
    border-end-start-radius: 0 !important;
}
:root[inFullscreen] #window-controls {
    position: absolute !important;
    display: flex !important;
    align-items: start !important;
    top: 0 !important;
    inset-inline-start: auto !important;
    inset-inline-end: 0 !important;
    margin: 0 !important;
}
:root[inFullscreen] #navigator-toolbox > #nav-bar {
    margin-inline-end: var(--v-titlebar-buttonbox-container-width, 108px) !important;
}
:root:not([inFullscreen])[v_menubar_autohide="true"] #navigator-toolbox > #nav-bar {
    margin-top: 0 !important;
    margin-inline-end: var(--v-titlebar-buttonbox-container-width, 108px) !important;
}
:root:not([inFullscreen])[v_menubar_autohide="true"] #toolbar-menubar {
    pointer-events: none !important;
}
:root:not([inFullscreen])[v_menubar_autohide="true"] #toolbar-menubar .titlebar-buttonbox-container {
    pointer-events: auto !important;
}
@media (-moz-os-version: windows-win7), (-moz-os-version: windows-win8) {
:root[sizemode="normal"] #TabsToolbar {
    border-inline: 1px solid hsla(240,5%,5%,0.3) !important;
    background-clip: padding-box !important;
}
    @media (-moz-windows-classic: 0) {
:root:not([inFullscreen])[v_menubar_autohide="true"][tabsintitlebar][sizemode="normal"] #navigator-toolbox > #nav-bar {
    margin-top: 1px !important;
}
:root:not([inFullscreen])[sizemode="normal"] #toolbar-menubar:not([autohide="true"]) > #menubar-items {
    margin-top: 1px !important;
}
    }
}
@media (-moz-windows-classic) {
:root:not([inFullscreen])[tabsintitlebar][sizemode="normal"] #navigator-toolbox::before {
    content: "" !important;
    display: -moz-box !important;
    height: 4px !important;
    -moz-box-ordinal-group: 0 !important;
    visibility: visible !important;
}
:root:not([inFullscreen])[tabsintitlebar][sizemode="normal"]:-moz-lwtheme #navigator-toolbox::before {
    background-image: linear-gradient(to bottom, ThreeDLightShadow 0, ThreeDLightShadow 1px, ThreeDHighlight 1px, ThreeDHighlight 2px, ActiveBorder 2px, ActiveBorder 4px, transparent 4px) !important;
}
:root:not([inFullscreen])[tabsintitlebar][sizemode="normal"] #toolbar-menubar {
    margin-top: 4px !important;
}
}
:root[data-l10n-id="browser-main-window-mac"] {
    --v-toolbar-menubar-height: 0px !important;
    --v-toolbar-menubar-height-content: none !important;
}
:root:not([inFullscreen])[tabsintitlebar][data-l10n-id="browser-main-window-mac"] #nav-bar {
    margin-inline-start: calc(var(--toolbarbutton-outer-padding, 2px) + var(--v-titlebar-button-horizont-padding, 6px) * 6 + var(--v-titlebar-button-image-width, 12px) * 3) !important;
}
:root:not([inFullscreen])[tabsintitlebar][data-l10n-id="browser-main-window-mac"] #TabsToolbar .titlebar-buttonbox-container {
    visibility: visible !important;
    display: -moz-box !important;
    position: absolute !important;
    display: flex !important;
    top: 0 !important;
}
}

/* обводка вкладки *//* var(--chrome-content-separator-color) можно заменить на свой цвет */
.tab-background {
    border: 1px solid var(--chrome-content-separator-color) !important; 
    box-shadow: none !important;  /* убрать тень по краям */
}

/* цвет панели вкладок и бордюр снизу */
#TabsToolbar-customization-target {
    /* background: #fb8af92b !important; */   /* раскомментировать на замену "сплошной цвет на панелях" */
    border-bottom: 1px solid var(--chrome-content-separator-color);
}

/* отступы по бокам вкладок */
.tabbrowser-tab {
    padding-inline: 0px !important;
}

/* цвет панели закладок *//*
#PersonalToolbar {
    background: #fb8af92b !important;
}*/ /* раскомментировать на замену "сплошной цвет на панелях" */

/* сплошной цвет на панелях для системной темы Firefox */
toolbar:not(:-moz-lwtheme) {
    --toolbar-bgcolor: #F0F0F0 !important;
}

/* цвет обводки строк адреса и поиска */
#urlbar:not([focused="true"]) > #urlbar-background, #searchbar:not(:focus-within) {
    border-color: ThreeDShadow !important;
}
#urlbar[focused=true] > #urlbar-background {
    border: 1px solid grey !important;
    box-shadow: none !important;
}
#searchbar:focus-within {
    box-shadow: none !important;
    border: 1px solid grey !important;
}

На экспериментальной 92 и win 10 у меня выглядит так.


Гавроша пишет

Спасибо, оба варианта попробовал, но папки все равно прозрачные, может я что не так сделал?

Может вы забыли переключить toolkit.legacyUserProfileCustomizations.stylesheets в true

Просто не знаю, что это такое?

Это точно я писал такое сообщение, или кто-то за меня?

Отсутствует

 

№1158117-10-2021 23:09:09

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

От нечего делать.

скрытый текст
2021.10.17_225630.th.png  2021.10.17_230135.th.png
скрытый текст

Выделить код

Код:

@namespace url("http://www.w3.org/1999/xhtml");
@-moz-document regexp("(?:https?|ftp|file):\/\/.*") {
html *, html {
	background: #222 !important;
	text-shadow: none !important;
	border-top-color: #222 !important;
	border-bottom-color: #222!important;
	border-left-color: #222 !important;
	border-right-color: #222 !important;
	color: silver !important;
	}
html, body, input, textarea, select, button {
	color: silver !important;
	}
a:link {
	color: #5794D0 !important;
	}
code, pre, input, samp, kbd, var, dfn {
	appearance: none !important;
	background-color: #191919 !important;
	color: silver !important;
	}
input, select, button {
	appearance: none !important;
	border: 1px solid #555 !important;
	background-color: #191919 !important;
	color: silver !important;
	}
.codebox, .scrollbox, blockquote, blockquote div p, textarea, .spoiler {
	background: #191919 !important;
	background-color: #191919 !important;
	border-top-color: #333 !important;
	border-bottom-color: #333 !important;
	border-left-color: #333 !important;
	border-right-color: #333 !important;
	}
.spoiler-plus, .spoiler-minus {
	background-color: #191919 !important;
	}
/* forum.mozilla-russia.org */
#brdmenu.inbox ul,
table tbody tr td, table thead tr th,
.blockpost {
	appearance: none !important;
	border: 1px solid #555 !important;
	}
.blockpost h2 {
	border-bottom: 1px solid #555 !important
	}
.postright {
	background-color: #191919 !important;
	padding: 0 0 0 2px !important;
	}
.postfootleft, .postfootright {
	border-top: 1px solid #555 !important;
	height: 20px !important;
	}
.postfootleft p, .postfootright ul {
	margin-top: -8px !important;
	}
[id^="message"], .postsignature p {
	padding: 5px 5px 5px 10px !important;
	}
.postedit {
	padding: 0 20px 0 0 !important;
	}
/* kinozal */
.mn2 {
	appearance: none !important;
	border: 1px solid #555 !important;
	}




}

Отсутствует

 

№1158218-10-2021 01:37:37

Vitaliy V.
Участник
 
Группа: Members
Зарегистрирован: 19-09-2014
Сообщений: 2074
UA: Firefox 94.0

Re: Настройка внешнего вида Firefox в userChrome.css

_zt пишет

назначить на один из Ctrl открытие старого во вкладке

Так?

скрытый текст

Выделить код

Код:

(async (
id = "ucf-open-about-config",
label = "about:config",
tooltiptext = "ЛКМ: Открыть about:config\nShift+ЛКМ: Искать содержимое буфера обмена в about:config\nCtrl+ЛКМ: Искать содержимое буфера обмена в about:cfg\nСКМ: Открыть about:cfg\nПКМ: Открыть окно about:cfg\nShift+ПКМ: Искать выделенное в about:config\nCtrl+ПКМ: Искать выделенное в about:cfg\nAlt+ПКМ: Искать выделенное в окне about:cfg",
img = "chrome://user_chrome_files/content/vertical_top_bottom_bar/svg/about-config-16.svg",
aboutoldurl = "about:cfg",
about_config = {
    get clipboardHelp() {
        delete this.clipboardHelp;
        return this.clipboardHelp = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
    },
    readFromClipboard(win) {
        var url = "";
        try {
            var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
            trans.init(win.docShell.QueryInterface(Ci.nsILoadContext));
            trans.addDataFlavor("text/unicode");
            var clipboard = Services.clipboard;
            clipboard.getData(trans, clipboard.kGlobalClipboard);
            var data = {};
            trans.getTransferData("text/unicode", data, {});
            if (data.value) {
                data = data.value.QueryInterface(Ci.nsISupportsString);
                url = data.data;
            }
        } catch (ex) {}
        return url;
    },
    openClipboardConfigTab(win, clip = "", copy, url = "about:config") {
        var filter = this.readFromClipboard(win), nowarn = false, pref = url === "about:config" ? "browser.aboutConfig.showWarning" : "general.warnOnAboutConfig";
        if (copy && clip != filter)
            this.clipboardHelp.copyString(clip);
        if (Services.prefs.getBoolPref(pref, true)) {
            Services.prefs.setBoolPref(pref, false);
            nowarn = true;
        }
        var browser = win.gBrowser.getBrowserForTab(win.gBrowser.selectedTab = this.addTab(win, url));
        browser.addEventListener("pageshow", e => {
            var doc = e.target;
            var input = doc && doc.querySelector("input#about-config-search, search-textbox#textbox");
            if (input && filter) {
                input.value = filter;
                input.focus();
                input.dispatchEvent(new doc.defaultView.Event("input", { bubbles: true }));
            }
            if (nowarn)
                win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }, { once: true });
    },
    openSelectedConfig(win, url, oldwin) {
        var clip = this.readFromClipboard(win);
        win.goDoCommand("cmd_copy");
        win.setTimeout(() => {
            if (!oldwin)
                this.openClipboardConfigTab(win, clip, true, url);
            else
                this.openOldConfigWin(win, clip, true);
        }, 100);
    },
    addTab(win, url, params = {}) {
        params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
        params.index = win.gBrowser.selectedTab._tPos + 1;
        return win.gBrowser.addTab(url, params);
    },
    get configoldurl() {
        delete this.configoldurl;
        var mod = Cc[`@mozilla.org/network/protocol/about;1?what=${aboutoldurl.split(":")[1]}`].getService(Ci.nsIAboutModule);
        var url;
        try {
            url = mod.getChromeURI(Services.io.newURI(aboutoldurl)).spec;
        } catch (e) {
            url = mod.wrappedJSObject.uri?.spec;
        }
        return this.configoldurl = url || aboutoldurl;
    },
    async openOldConfigWin(win, clip = "", copy) {
        var filter, input;
        if (copy) {
            filter = this.readFromClipboard(win);
            if (clip != filter)
                this.clipboardHelp.copyString(clip);
        }
        var type = "Preferences:ConfigManager", id = "config";
        var _win = Services.wm.getMostRecentWindow(type);
        if (!_win) {
            let nowarn = false, pref = "general.warnOnAboutConfig";
            if (copy && Services.prefs.getBoolPref(pref, true)) {
                Services.prefs.setBoolPref(pref, false);
                nowarn = true;
            }
            let url = this.configoldurl;
            let xs = Services.xulStore;
            let sx = xs.getValue(url, id, "screenX");
            let sy = xs.getValue(url, id, "screenY");
            let wh = xs.getValue(url, id, "width");
            let ht = xs.getValue(url, id, "height");
            let sm = xs.getValue(url, id, "sizemode");
            let features = `chrome,dialog=no,resizable,${sx && sy ? `screenX=${sx !== "0" ? sx : "1"},screenY=${sy !== "0" ? sy : "1"}` : "centerscreen"}${wh && ht ? `,width=${wh},height=${ht}` : ""}`;
            _win = win.openDialog(url, type, features);
            await new Promise(resolve => {
                _win.windowRoot.addEventListener("DOMContentLoaded", () => {
                    _win.windowRoot.addEventListener("MozUpdateWindowPos", () => {
                        if (sm === "maximized")
                            _win.maximize();
                    }, { once: true, capture: true });
                    resolve();
                }, { once: true });
            });
            if (copy && nowarn)
                _win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }
        var doc = _win.document;
        var docEl = doc.documentElement;
        docEl.setAttribute("windowtype", type);
        docEl.id = id;
        docEl.setAttribute("persist", "screenX screenY width height sizemode");
        _win.focus();
        if (!copy || !(input = doc.querySelector("search-textbox#textbox"))) return;
        input.value = filter;
        input.focus();
        input.dispatchEvent(new _win.Event("input", { bubbles: true }));
    },
}) => {
    CustomizableUI.createWidget({
        id: id,
        type: "custom",
        label: label,
        tooltiptext: tooltiptext,
        localized: false,
        defaultArea: CustomizableUI.AREA_NAVBAR,
        onBuild(doc) {
            var win = doc.defaultView;
            var trbn = doc.createXULElement("toolbarbutton");
            trbn.id = id;
            trbn.className = "toolbarbutton-1 chromeclass-toolbar-additional";
            trbn.setAttribute("label", label);
            trbn.setAttribute("context", "");
            trbn.setAttribute("tooltiptext", tooltiptext);
            trbn.style.setProperty("list-style-image", `url("${img}")`, "important");
            trbn.addEventListener("click", e => {
                if (e.button == 0) {
                    if (e.shiftKey)
                        about_config.openClipboardConfigTab(win);
                    else if (e.getModifierState("Accel"))
                        about_config.openClipboardConfigTab(win, "", false, aboutoldurl);
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:config");
                } else if (e.button == 1)
                    win.gBrowser.selectedTab = about_config.addTab(win, aboutoldurl);
                else if (e.button == 2) {
                    e.preventDefault();
                    e.stopPropagation();
                    if (e.shiftKey)
                        about_config.openSelectedConfig(win);
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win, aboutoldurl);
                    else if (e.altKey)
                        about_config.openSelectedConfig(win, undefined, true);
                    else
                        about_config.openOldConfigWin(win);
                }
            });
            return trbn;
        }
    });
})();


зависит от №11574

Отредактировано Vitaliy V. (18-10-2021 14:08:48)

Отсутствует

 

№1158318-10-2021 02:13:27

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

Vitaliy V. пишет

Так?

А можете сделать вариант, чтоб остались только пункты для about:cfg? А то кнопка получилась сильно перегруженной, труднее выбирать, а все необходимое для about:config есть уже в кнопке в Add Toolbar Buttons

Отсутствует

 

№1158418-10-2021 06:20:06

ALEX_45_ORP
Участник
 
Группа: Members
Зарегистрирован: 18-01-2018
Сообщений: 162
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

ALEX_45_ORP пишет

как через userChrome.css уменьшить расстояние между иконками на панели навигации в 93 [firefox]?

так, понятно, Vitaliy V. может я неправильно сформулировал, тогда подскажите код, который регулирует их горизонтальное размещение в оной панели? (сам покопаюсь) ...
UPD. вот этот

Выделить код

Код:

#nav-bar-customization-target > .toolbarbutton-1 > .toolbarbutton-icon{margin-right: -1px !important; margin-left: -1px !important;}

работал в 85 [firefox], а в 93 не работает ...

Отредактировано ALEX_45_ORP (18-10-2021 06:28:56)


Win 10х64

Отсутствует

 

№1158518-10-2021 09:25:09

f480185
Участник
 
Группа: Members
Зарегистрирован: 05-04-2012
Сообщений: 155
UA: Firefox 92.0

Re: Настройка внешнего вида Firefox в userChrome.css

Возможно модифицировать плеер который используется в функции "Картинка в картинке" через userChrome.css
Добавив функционалу кнопки  громкости и перемотки.

Отредактировано f480185 (18-10-2021 09:30:29)

Отсутствует

 

№1158618-10-2021 10:11:02

sandro79
Участник
 
Группа: Members
Зарегистрирован: 15-11-2017
Сообщений: 1750
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

ALEX_45_ORP пишет

может я неправильно сформулировал

А чего тут формулировать, понятно всё, просто не забывайте пользоваться поиском https://forum.mozilla-russia.org/viewto … 00#p793900
Это есть практически в каждом коде для компактности Протона https://forum.mozilla-russia.org/viewto … 22#p790422

Так ещё можно

Выделить код

Код:

toolbar .toolbarbutton-1 {
    padding: 0 1px !important;
}

Отсутствует

 

№1158718-10-2021 10:27:27

ALEX_45_ORP
Участник
 
Группа: Members
Зарегистрирован: 18-01-2018
Сообщений: 162
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

sandro79 привет, ничего не помогло ... цифры менял разные, никаких результатов, как будто и нет этих кодов в userChrome.css.
ЗЫ. почитал материал по ссылкам - меня интересует код только для компактного режима значков.

Отредактировано ALEX_45_ORP (18-10-2021 10:44:20)


Win 10х64

Отсутствует

 

№1158818-10-2021 10:55:14

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

ALEX_45_ORP

Выделить код

Код:

:root {
    --toolbarbutton-outer-padding: 1px !important; /* внешний отступ между кнопками */
    --toolbarbutton-inner-padding: 4px !important; /* внутренний отступ иконки от границ кнопки */
}

Отсутствует

 

№1158918-10-2021 11:02:47

ALEX_45_ORP
Участник
 
Группа: Members
Зарегистрирован: 18-01-2018
Сообщений: 162
UA: Firefox 85.0

Re: Настройка внешнего вида Firefox в userChrome.css

_zt
этот код действует только на вертикальное регулирование, а мне надо горизонтальное панели навигации в компактном режиме значков ...


Win 10х64

Отсутствует

 

№1159018-10-2021 11:19:38

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

ALEX_45_ORP
У меня он действует только на горизонтальное. Но я не уверен, что он подойдет для компактного режима, не проверял.

Отсутствует

 

№1159118-10-2021 11:52:54

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

Vitaliy V. пишет

Так?

Ну почти.

скрытый текст

Выделить код

Код:

// Этот скрипт можно использовать для создания кнопок с помощью CustomizableUI.createWidget

// Отдельная кнопка about:config с альт.управлением и открытием "about:cfg" от Vitaliy V.
// https://forum.mozilla-russia.org/viewtopic.php?pid=795555#p795555
(async (
id = "ucf-open-about-config",
label = "about:config",
tooltiptext = "	   ЛКМ	: Открыть about:config\n  Ctrl+ЛКМ	: Искать выделенное / буфер в about:config\nShift+ЛКМ	: Открыть окно about:cfg\n	   ПКМ 	: Открыть вкладку about:cfg\n  Ctrl+ПКМ	: Искать выделенное / буфер во вкладке about:cfg\nShift+ПКМ	: Искать выделенное / буфер в окне about:cfg",
aboutoldurl = "about:cfg",
about_config = {
    get clipboardHelp() {
        delete this.clipboardHelp;
        return this.clipboardHelp = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
    },
    readFromClipboard(win) {
        var url = "";
        try {
            var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
            trans.init(win.docShell.QueryInterface(Ci.nsILoadContext));
            trans.addDataFlavor("text/unicode");
            var clipboard = Services.clipboard;
            clipboard.getData(trans, clipboard.kGlobalClipboard);
            var data = {};
            trans.getTransferData("text/unicode", data, {});
            if (data.value) {
                data = data.value.QueryInterface(Ci.nsISupportsString);
                url = data.data;
            }
        } catch (ex) {}
        return url;
    },
    openClipboardConfigTab(win, clip = "", copy, url = "about:config") {
        var filter = this.readFromClipboard(win), nowarn = false, pref = url === "about:config" ? "browser.aboutConfig.showWarning" : "general.warnOnAboutConfig";
        if (copy && clip != filter)
            this.clipboardHelp.copyString(clip);
        if (Services.prefs.getBoolPref(pref, true)) {
            Services.prefs.setBoolPref(pref, false);
            nowarn = true;
        }
        var browser = win.gBrowser.getBrowserForTab(win.gBrowser.selectedTab = this.addTab(win, url));
        browser.addEventListener("pageshow", e => {
            var doc = e.target;
            var input = doc && doc.querySelector("input#about-config-search, search-textbox#textbox");
            if (input && filter) {
                input.value = filter;
                input.focus();
                input.dispatchEvent(new doc.defaultView.Event("input", { bubbles: true }));
            }
            if (nowarn)
                win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }, { once: true });
    },
    openSelectedConfig(win, url, oldwin) {
        var clip = this.readFromClipboard(win);
        win.goDoCommand("cmd_copy");
        win.setTimeout(() => {
            if (!oldwin)
                this.openClipboardConfigTab(win, clip, true, url);
            else
                this.openSelectedOldConfigWin(win, clip);
        }, 100);
    },
    addTab(win, url, params = {}) {
        params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
        params.index = win.gBrowser.selectedTab._tPos + 1;
        return win.gBrowser.addTab(url, params);
    },
    get configoldurl() {
        delete this.configoldurl;
        let mod = Cc[`@mozilla.org/network/protocol/about;1?what=${aboutoldurl.split(":")[1]}`].getService(Ci.nsIAboutModule);
        let url;
        try {
            url = mod.getChromeURI(Services.io.newURI(aboutoldurl)).spec;
        } catch (e) {
            url = mod.wrappedJSObject.uri?.spec;
        }
        return this.configoldurl = url || aboutoldurl;
    },
    async openSelectedOldConfigWin(win, clip) {
        var filter = this.readFromClipboard(win);
        if (clip != filter)
            this.clipboardHelp.copyString(clip);
        var type = "Preferences:ConfigManager", id = "config";
        var _win = Services.wm.getMostRecentWindow(type);
        if (!_win) {
            let nowarn = false, pref = "general.warnOnAboutConfig";
            if (Services.prefs.getBoolPref(pref, true)) {
                Services.prefs.setBoolPref(pref, false);
                nowarn = true;
            }
            let url = this.configoldurl;
            let xs = Services.xulStore;
            let sx = xs.getValue(url, id, "screenX");
            let sy = xs.getValue(url, id, "screenY");
            let wh = xs.getValue(url, id, "width");
            let ht = xs.getValue(url, id, "height");
            let sm = xs.getValue(url, id, "sizemode");
            let features = `chrome,dialog=no,resizable,${sx && sy ? `screenX=${sx !== "0" ? sx : "1"},screenY=${sy !== "0" ? sy : "1"}` : "centerscreen"}${wh && ht ? `,width=${wh},height=${ht}` : ""}`;
            _win = win.openDialog(url, type, features);
            await new Promise(resolve => {
                _win.windowRoot.addEventListener("DOMContentLoaded", () => {
                    _win.windowRoot.addEventListener("MozUpdateWindowPos", () => {
                        if (sm === "maximized")
                            _win.maximize();
                    }, { once: true, capture: true });
                    resolve();
                }, { once: true });
            });
            if (nowarn)
                _win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }
        var doc = _win.document;
        var docEl = doc.documentElement;
        docEl.setAttribute("windowtype", type);
        docEl.id = id;
        docEl.setAttribute("persist", "screenX screenY width height sizemode");
        _win.focus();
        var input = doc.querySelector("search-textbox#textbox");
        if (!input) return;
        input.value = filter;
        input.focus();
        input.dispatchEvent(new _win.Event("input", { bubbles: true }));
    },
}) => {
    CustomizableUI.createWidget({
        id: id,
        type: "custom",
        label: label,
        tooltiptext: tooltiptext,
        localized: false,
        defaultArea: CustomizableUI.AREA_NAVBAR,
        onBuild(doc) {
            var win = doc.defaultView;
            var trbn = doc.createXULElement("toolbarbutton");
            trbn.id = id;
            trbn.className = "toolbarbutton-1 chromeclass-toolbar-additional";
            trbn.setAttribute("label", label);
            trbn.setAttribute("context", "");
            trbn.setAttribute("tooltiptext", tooltiptext);
            trbn.setAttribute("image", "chrome://user_chrome_files/content/vertical_top_bottom_bar/svg/about-config-16.svg");
            trbn.addEventListener("click", function(e) {
                if (e.button == 0) {
                    if (e.shiftKey)
                        about_config.openSelectedConfig(win);
                    if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win);
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:config");
                } else if (e.button == 1)
                        about_config.openSelectedConfig(win);
                else if (e.button == 2) {
                    e.preventDefault();
                    e.stopPropagation();
                    if (e.shiftKey)
                        about_config.openSelectedConfig(win, undefined, true);
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win, "about:cfg");
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:cfg");
                }
            });
            return trbn;
        }
    });
})();


Только дайте строку простого открытия окна "about:cfg", у меня этот пункт пока не рабочий.

Отредактировано _zt (18-10-2021 12:41:49)

Отсутствует

 

№1159218-10-2021 12:24:46

EgorSokolov
Участник
 
Группа: Members
Зарегистрирован: 30-12-2006
Сообщений: 122
UA: Firefox 48.0

Re: Настройка внешнего вида Firefox в userChrome.css

to Dumby (насчет этого)


Да, вот теперь работает и в FF-36/45 — спасибо! :). В них не работало, как я понимаю, из-за того, что "insertAdjacentElement" появился в FireFox с v48 (кто бы мог подумать! Ведь в IE он с v5, хе-хе). Но у меня возник один вопрос, это не особо важно, но если можете, то пожалуйста ответьте.

Только я поясню, что я помещаю код не прямо в userChrome.css, а в отдельный XML-файл (чтобы не загромождать userChrome) — я назвал его binding.xml. Получается примерно так:


userChrome.css
menuitem#bookmarksShowAll > hbox {
-moz-binding: url('binding.xml#move_BMB_viewBookmarksSidebar') !important;}


binding.xml
<binding id="move_BMB_viewBookmarksSidebar">
  <implementation>
   <constructor>
    <![CDATA[
      (id => {
          var menuitem = this.parentNode.parentNode.insertBefore(document.getElementById(id), this.parentNode.nextSibling);
          menuitem.id = "menu_" + id; // (?)
          menuitem.removeAttribute("class");
       })("BMB_viewBookmarksSidebar");
    ]]>
   </constructor>
  </implementation>
</binding>


Так вот, я попробовал переписать ваш код без богомерзкого оператора "=>" (он некошерный, ибо в IE его нет, да и синтаксис его трудно-понимаем), получилось так:


binding.xml
<binding id="move_BMB_viewBookmarksSidebar">
  <implementation>
   <constructor>
    <![CDATA[
     (function(id) {
      var menuitem = this.parentNode.parentNode.insertBefore(document.getElementById(id), this.parentNode.nextSibling);
      menuitem.id = "menu_" + id; // (?)
      menuitem.removeAttribute("class");
     })("BMB_viewBookmarksSidebar");
    ]]>
   </constructor>
  </implementation>
</binding>


Но это у меня почему-то не работает. Подскажите, что я сделал не так? Можете сделать вариант без "=>"? Это, конечно, моя блажь, но просто в целях, так сказать, общего развития :)

Отсутствует

 

№1159318-10-2021 14:20:48

Vitaliy V.
Участник
 
Группа: Members
Зарегистрирован: 19-09-2014
Сообщений: 2074
UA: Firefox 94.0

Re: Настройка внешнего вида Firefox в userChrome.css

_zt пишет

Только дайте строку простого открытия окна "about:cfg"

Изменил, добавил так
СКМ: Открыть about:cfg
ПКМ: Открыть окно about:cfg
Alt+ПКМ: Искать выделенное в окне about:cfg

voqabuhe пишет

чтоб остались только пункты для about:cfg?

Ну например так, если заменить trbn.addEventListener("click", e => { ... });

скрытый текст

Выделить код

Код:

trbn.addEventListener("click", e => {
    if (e.button == 0) {
        if (e.getModifierState("Accel"))
            about_config.openClipboardConfigTab(win, "", false, aboutoldurl);
        else
            win.gBrowser.selectedTab = about_config.addTab(win, aboutoldurl);
    } else if (e.button == 1)
        win.gBrowser.selectedTab = about_config.addTab(win, aboutoldurl);
    else if (e.button == 2) {
        e.preventDefault();
        e.stopPropagation();
        if (e.getModifierState("Accel"))
            about_config.openSelectedConfig(win, aboutoldurl);
        else if (e.altKey)
            about_config.openSelectedConfig(win, undefined, true);
        else
            about_config.openOldConfigWin(win);
    }
});


строку tooltiptext = ... тоже замените на свою

Отсутствует

 

№1159418-10-2021 16:02:32

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

Vitaliy V. пишет

Ну например так, если заменить trbn.addEventListener("click", e => { ... });

Дык так пункты для окна about:cfg пропали.

Отредактировано voqabuhe (18-10-2021 16:04:57)

Отсутствует

 

№1159518-10-2021 16:10:26

Vitaliy V.
Участник
 
Группа: Members
Зарегистрирован: 19-09-2014
Сообщений: 2074
UA: Firefox 94.0

Re: Настройка внешнего вида Firefox в userChrome.css

voqabuhe
надо сначала обновить было, для окна эти
ПКМ: Открыть окно about:cfg
Alt+ПКМ: Искать выделенное в окне about:cfg

Отредактировано Vitaliy V. (18-10-2021 16:11:04)

Отсутствует

 

№1159618-10-2021 16:27:04

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

Vitaliy V. пишет

надо сначала обновить было, для окна эти
ПКМ: Открыть окно about:cfg
Alt+ПКМ: Искать выделенное в окне about:cfg

Не понял, как их обновить?

Отсутствует

 

№1159718-10-2021 16:40:27

_zt
Участник
 
Группа: Members
Зарегистрирован: 10-11-2014
Сообщений: 1419
UA: Firefox 91.0

Re: Настройка внешнего вида Firefox в userChrome.css

В общем для себя так сделал:

скрытый текст

Выделить код

Код:

// Этот скрипт можно использовать для создания кнопок с помощью CustomizableUI.createWidget

// Отдельная кнопка about:config с альт.управлением и открытием "about:cfg" от Vitaliy V.
// https://forum.mozilla-russia.org/viewtopic.php?pid=795555#p795555
(async (
id = "ucf-open-about-config",
label = "about:config",
tooltiptext = "	   ЛКМ	: Открыть about:config\n  Ctrl+ЛКМ	: Искать выделенное / буфер в about:config\n	   ПКМ 	: Открыть вкладку about:cfg\n  Ctrl+ПКМ	: Искать выделенное / буфер во вкладке about:cfg\nShift+ЛКМ	: Открыть окно about:cfg\nShift+ПКМ	: Искать выделенное / буфер в окне about:cfg",
img = "chrome://user_chrome_files/content/vertical_top_bottom_bar/svg/about-config-16.svg",
aboutoldurl = "about:cfg",
about_config = {
    get clipboardHelp() {
        delete this.clipboardHelp;
        return this.clipboardHelp = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
    },
    readFromClipboard(win) {
        var url = "";
        try {
            var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
            trans.init(win.docShell.QueryInterface(Ci.nsILoadContext));
            trans.addDataFlavor("text/unicode");
            var clipboard = Services.clipboard;
            clipboard.getData(trans, clipboard.kGlobalClipboard);
            var data = {};
            trans.getTransferData("text/unicode", data, {});
            if (data.value) {
                data = data.value.QueryInterface(Ci.nsISupportsString);
                url = data.data;
            }
        } catch (ex) {}
        return url;
    },
    openClipboardConfigTab(win, clip = "", copy, url = "about:config") {
        var filter = this.readFromClipboard(win), nowarn = false, pref = url === "about:config" ? "browser.aboutConfig.showWarning" : "general.warnOnAboutConfig";
        if (copy && clip != filter)
            this.clipboardHelp.copyString(clip);
        if (Services.prefs.getBoolPref(pref, true)) {
            Services.prefs.setBoolPref(pref, false);
            nowarn = true;
        }
        var browser = win.gBrowser.getBrowserForTab(win.gBrowser.selectedTab = this.addTab(win, url));
        browser.addEventListener("pageshow", e => {
            var doc = e.target;
            var input = doc && doc.querySelector("input#about-config-search, search-textbox#textbox");
            if (input && filter) {
                input.value = filter;
                input.focus();
                input.dispatchEvent(new doc.defaultView.Event("input", { bubbles: true }));
            }
            if (nowarn)
                win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }, { once: true });
    },
    openSelectedConfig(win, url, oldwin) {
        var clip = this.readFromClipboard(win);
        win.goDoCommand("cmd_copy");
        win.setTimeout(() => {
            if (!oldwin)
                this.openClipboardConfigTab(win, clip, true, url);
            else
                this.openOldConfigWin(win, clip, true);
        }, 100);
    },
    addTab(win, url, params = {}) {
        params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
        params.index = win.gBrowser.selectedTab._tPos + 1;
        return win.gBrowser.addTab(url, params);
    },
    get configoldurl() {
        delete this.configoldurl;
        var mod = Cc[`@mozilla.org/network/protocol/about;1?what=${aboutoldurl.split(":")[1]}`].getService(Ci.nsIAboutModule);
        var url;
        try {
            url = mod.getChromeURI(Services.io.newURI(aboutoldurl)).spec;
        } catch (e) {
            url = mod.wrappedJSObject.uri?.spec;
        }
        return this.configoldurl = url || aboutoldurl;
    },
    async openOldConfigWin(win, clip = "", copy) {
        var filter, input;
        if (copy) {
            filter = this.readFromClipboard(win);
            if (clip != filter)
                this.clipboardHelp.copyString(clip);
        }
        var type = "Preferences:ConfigManager", id = "config";
        var _win = Services.wm.getMostRecentWindow(type);
        if (!_win) {
            let nowarn = false, pref = "general.warnOnAboutConfig";
            if (copy && Services.prefs.getBoolPref(pref, true)) {
                Services.prefs.setBoolPref(pref, false);
                nowarn = true;
            }
            let url = this.configoldurl;
            let xs = Services.xulStore;
            let sx = xs.getValue(url, id, "screenX");
            let sy = xs.getValue(url, id, "screenY");
            let wh = xs.getValue(url, id, "width");
            let ht = xs.getValue(url, id, "height");
            let sm = xs.getValue(url, id, "sizemode");
            let features = `chrome,dialog=no,resizable,${sx && sy ? `screenX=${sx !== "0" ? sx : "1"},screenY=${sy !== "0" ? sy : "1"}` : "centerscreen"}${wh && ht ? `,width=${wh},height=${ht}` : ""}`;
            _win = win.openDialog(url, type, features);
            await new Promise(resolve => {
                _win.windowRoot.addEventListener("DOMContentLoaded", () => {
                    _win.windowRoot.addEventListener("MozUpdateWindowPos", () => {
                        if (sm === "maximized")
                            _win.maximize();
                    }, { once: true, capture: true });
                    resolve();
                }, { once: true });
            });
            if (copy && nowarn)
                _win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }
        var doc = _win.document;
        var docEl = doc.documentElement;
        docEl.setAttribute("windowtype", type);
        docEl.id = id;
        docEl.setAttribute("persist", "screenX screenY width height sizemode");
        _win.focus();
        if (!copy || !(input = doc.querySelector("search-textbox#textbox"))) return;
        input.value = filter;
        input.focus();
        input.dispatchEvent(new _win.Event("input", { bubbles: true }));
    },
}) => {
    CustomizableUI.createWidget({
        id: id,
        type: "custom",
        label: label,
        tooltiptext: tooltiptext,
        localized: false,
        defaultArea: CustomizableUI.AREA_NAVBAR,
        onBuild(doc) {
            var win = doc.defaultView;
            var trbn = doc.createXULElement("toolbarbutton");
            trbn.id = id;
            trbn.className = "toolbarbutton-1 chromeclass-toolbar-additional";
            trbn.setAttribute("label", label);
            trbn.setAttribute("context", "");
            trbn.setAttribute("tooltiptext", tooltiptext);
            trbn.style.setProperty("list-style-image", `url("${img}")`, "important");
            trbn.addEventListener("click", e => {
                if (e.button == 0) {
                    if (e.shiftKey)
                        about_config.openOldConfigWin(win);
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win);
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:config");
                } else if (e.button == 1)
                        about_config.openSelectedConfig(win);
                else if (e.button == 2) {
                    e.preventDefault();
                    e.stopPropagation();
                    if (e.shiftKey)
                        about_config.openSelectedConfig(win, undefined, true);
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win, "about:cfg");
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:cfg");
                }
            });
            return trbn;
        }
    });
})();

Vitaliy V.
Ошибок нет?
Я вообще не понимаю необходимость отдельных openClipboard, разве openSelected где-то иначе работает, чем у меня. У меня он ищет выделенное, если есть, а если нет, то открывает буфер.
   
voqabuhe
Для вас так будет:
скрытый текст

Выделить код

Код:

// Этот скрипт можно использовать для создания кнопок с помощью CustomizableUI.createWidget

// Отдельная кнопка about:config с альт.управлением и открытием "about:cfg" от Vitaliy V.
// https://forum.mozilla-russia.org/viewtopic.php?pid=795555#p795555
(async (
id = "ucf-open-about-config",
label = "about:config",
tooltiptext = "	   ЛКМ	: Открыть окно about:cfg\n  Ctrl+ЛКМ	: Искать выделенное / буфер в окне about:cfg\n	   ПКМ 	: Открыть вкладку about:cfg\n  Ctrl+ПКМ	: Искать выделенное / буфер во вкладке about:cfg",
img = "chrome://user_chrome_files/content/vertical_top_bottom_bar/svg/about-config-16.svg",
aboutoldurl = "about:cfg",
about_config = {
    get clipboardHelp() {
        delete this.clipboardHelp;
        return this.clipboardHelp = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
    },
    readFromClipboard(win) {
        var url = "";
        try {
            var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
            trans.init(win.docShell.QueryInterface(Ci.nsILoadContext));
            trans.addDataFlavor("text/unicode");
            var clipboard = Services.clipboard;
            clipboard.getData(trans, clipboard.kGlobalClipboard);
            var data = {};
            trans.getTransferData("text/unicode", data, {});
            if (data.value) {
                data = data.value.QueryInterface(Ci.nsISupportsString);
                url = data.data;
            }
        } catch (ex) {}
        return url;
    },
    openClipboardConfigTab(win, clip = "", copy, url = "about:config") {
        var filter = this.readFromClipboard(win), nowarn = false, pref = url === "about:config" ? "browser.aboutConfig.showWarning" : "general.warnOnAboutConfig";
        if (copy && clip != filter)
            this.clipboardHelp.copyString(clip);
        if (Services.prefs.getBoolPref(pref, true)) {
            Services.prefs.setBoolPref(pref, false);
            nowarn = true;
        }
        var browser = win.gBrowser.getBrowserForTab(win.gBrowser.selectedTab = this.addTab(win, url));
        browser.addEventListener("pageshow", e => {
            var doc = e.target;
            var input = doc && doc.querySelector("input#about-config-search, search-textbox#textbox");
            if (input && filter) {
                input.value = filter;
                input.focus();
                input.dispatchEvent(new doc.defaultView.Event("input", { bubbles: true }));
            }
            if (nowarn)
                win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }, { once: true });
    },
    openSelectedConfig(win, url, oldwin) {
        var clip = this.readFromClipboard(win);
        win.goDoCommand("cmd_copy");
        win.setTimeout(() => {
            if (!oldwin)
                this.openClipboardConfigTab(win, clip, true, url);
            else
                this.openOldConfigWin(win, clip, true);
        }, 100);
    },
    addTab(win, url, params = {}) {
        params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
        params.index = win.gBrowser.selectedTab._tPos + 1;
        return win.gBrowser.addTab(url, params);
    },
    get configoldurl() {
        delete this.configoldurl;
        var mod = Cc[`@mozilla.org/network/protocol/about;1?what=${aboutoldurl.split(":")[1]}`].getService(Ci.nsIAboutModule);
        var url;
        try {
            url = mod.getChromeURI(Services.io.newURI(aboutoldurl)).spec;
        } catch (e) {
            url = mod.wrappedJSObject.uri?.spec;
        }
        return this.configoldurl = url || aboutoldurl;
    },
    async openOldConfigWin(win, clip = "", copy) {
        var filter, input;
        if (copy) {
            filter = this.readFromClipboard(win);
            if (clip != filter)
                this.clipboardHelp.copyString(clip);
        }
        var type = "Preferences:ConfigManager", id = "config";
        var _win = Services.wm.getMostRecentWindow(type);
        if (!_win) {
            let nowarn = false, pref = "general.warnOnAboutConfig";
            if (copy && Services.prefs.getBoolPref(pref, true)) {
                Services.prefs.setBoolPref(pref, false);
                nowarn = true;
            }
            let url = this.configoldurl;
            let xs = Services.xulStore;
            let sx = xs.getValue(url, id, "screenX");
            let sy = xs.getValue(url, id, "screenY");
            let wh = xs.getValue(url, id, "width");
            let ht = xs.getValue(url, id, "height");
            let sm = xs.getValue(url, id, "sizemode");
            let features = `chrome,dialog=no,resizable,${sx && sy ? `screenX=${sx !== "0" ? sx : "1"},screenY=${sy !== "0" ? sy : "1"}` : "centerscreen"}${wh && ht ? `,width=${wh},height=${ht}` : ""}`;
            _win = win.openDialog(url, type, features);
            await new Promise(resolve => {
                _win.windowRoot.addEventListener("DOMContentLoaded", () => {
                    _win.windowRoot.addEventListener("MozUpdateWindowPos", () => {
                        if (sm === "maximized")
                            _win.maximize();
                    }, { once: true, capture: true });
                    resolve();
                }, { once: true });
            });
            if (copy && nowarn)
                _win.setTimeout(() => {
                    Services.prefs.setBoolPref(pref, true);
                }, 200);
        }
        var doc = _win.document;
        var docEl = doc.documentElement;
        docEl.setAttribute("windowtype", type);
        docEl.id = id;
        docEl.setAttribute("persist", "screenX screenY width height sizemode");
        _win.focus();
        if (!copy || !(input = doc.querySelector("search-textbox#textbox"))) return;
        input.value = filter;
        input.focus();
        input.dispatchEvent(new _win.Event("input", { bubbles: true }));
    },
}) => {
    CustomizableUI.createWidget({
        id: id,
        type: "custom",
        label: label,
        tooltiptext: tooltiptext,
        localized: false,
        defaultArea: CustomizableUI.AREA_NAVBAR,
        onBuild(doc) {
            var win = doc.defaultView;
            var trbn = doc.createXULElement("toolbarbutton");
            trbn.id = id;
            trbn.className = "toolbarbutton-1 chromeclass-toolbar-additional";
            trbn.setAttribute("label", label);
            trbn.setAttribute("context", "");
            trbn.setAttribute("tooltiptext", tooltiptext);
            trbn.style.setProperty("list-style-image", `url("${img}")`, "important");
            trbn.addEventListener("click", e => {
                if (e.button == 0) {
                    if (e.shiftKey)
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:config");
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win, undefined, true);
                    else
                        about_config.openOldConfigWin(win);
                } else if (e.button == 1)
                        about_config.openSelectedConfig(win);
                else if (e.button == 2) {
                    e.preventDefault();
                    e.stopPropagation();
                    if (e.shiftKey)
                        about_config.openSelectedConfig(win);
                    else if (e.getModifierState("Accel"))
                        about_config.openSelectedConfig(win, "about:cfg");
                    else
                        win.gBrowser.selectedTab = about_config.addTab(win, "about:cfg");
                }
            });
            return trbn;
        }
    });
})();

Шифты там тоже работают и открывают обычный about:config. лкм+shift - просто, пкм+shift - выделенное / буфер. Просто не записал их в подсказку.

Отсутствует

 

№1159818-10-2021 16:51:20

yuriymos
Участник
 
Группа: Members
Зарегистрирован: 31-07-2017
Сообщений: 43
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

Привет. Перестали работать скрипты *.js
Подскажите, пожалуйста, как исправить. Спасибо

UPD. Сделал по методу 2. https://github.com/Aris-t2/CustomJSforFx

Отредактировано yuriymos (18-10-2021 17:29:33)

Отсутствует

 

№1159918-10-2021 17:00:13

voqabuhe
Участник
 
Группа: Members
Зарегистрирован: 06-12-2011
Сообщений: 3231
UA: Firefox 93.0

Re: Настройка внешнего вида Firefox в userChrome.css

_zt пишет

Для вас так будет:

Спасибо, почти то что нужно. Теперь у меня три кнопки получилось и со всеми жалко расставаться. :)

Отсутствует

 

№1160018-10-2021 17:16:40

Vitaliy V.
Участник
 
Группа: Members
Зарегистрирован: 19-09-2014
Сообщений: 2074
UA: Firefox 94.0

Re: Настройка внешнего вида Firefox в userChrome.css

_zt пишет

Ошибок нет?

Как то не последовательно подсказка записана 2 ЛКМ 2 ПКМ потом опять ЛКМ, СКМ вообще пропущена
а так нет ошибок

_zt пишет

Я вообще не понимаю необходимость отдельных openClipboard, разве openSelected где-то иначе работает, чем у меня. У меня он ищет выделенное, если есть, а если нет, то открывает буфер.

Так это надо следить чтобы ничего не было выделено или как найти из буфера не убирая выделения?! и т.д.

Отредактировано Vitaliy V. (18-10-2021 17:19:01)

Отсутствует

 

Board footer

Powered by PunBB
Modified by Mozilla Russia
Copyright © 2004–2020 Mozilla Russia GitHub mark
Язык отображения форума: [Русский] [English]