UserChromeFiles загрузчик скриптов/стилей расширяет возможности Firefox 115+ через функцию autoconfig. © Vitaliy V. (старая версия)
Установка: скопировать папку chrome в ваш профиль, всё из папки Firefox в путь его установки. В окне UCF включить нужные опции, после изменений нажать в about:support «Очистить кэш запуска».
Скрипты для докум. окна браузера [ChromeOnly]
hookClicks — перехват кликов позволяет «разгрузить» кнопки, исключив код кликов
UCF drag and go жесты мыши
Перезапустить приложение в основном и классическом меню
Автоскрытие панели вкладок
Добавление прокси из контекстного меню
Скрытие панели поиска после клика на странице
Фавикон в адресной строке
Информация о странице, вкладка разрешения
Добавить кнопку "Очистить загрузки" на DownloadsPanel
Кнопка "Меню ссылок" © Dumby
Cохранить картинку кликом колёсика © Dumby
Контекстное меню "Открыть ссылку в…"
Sidebar Tabs в боковой панели Сайт, Загрузки, Журнал… Lite-mod, поддержка Закладок
Скрипты В фоне [System Principal]:
Меню с дополнениями из ATB (авт. Vitaliy V.)
Автоматически добавлять выделенный текст в SearchBar (авт. Dumby)
Тултипы с URL (авт. Dumby)
Кнопка Прокси
Замена фавиконок для сайтов
Кнопка «Сохранить» комбинированная, конвертировать в base64
Меню пользователя (обновляемый текст строк)
Другие менеджеры скриптов: fx-autoconfig MrOtherGuy, Tampermonkey, userChrome.js Endor8
Отредактировано Dobrov (05-10-2026 01:50:04)
Отсутствует
90.0del
Отредактировано Vitaliy V. (14-04-2022 01:31:02)
Отсутствует
Vitaliy V.
Удаляйте все загрузчики скриптов из custom_script_all_win.js
добавляйте этот
У меня там только
load() {
if (this.initialized)
return;
this.initialized = true;
/* ************************************************ */
// Здесь может быть ваш код который сработает по событию "load" не раньше
/* ************************************************ */
},Отредактировано harryk (05-07-2021 23:37:20)
Отсутствует
90.0harryk
Загрузчики можно добавить где комментарий // Здесь может быть ваш код который сработает по событию "load" не раньше
но добавлять необязательно это для тех кто хочет чтобы были отдельные файлы.
Что касается custom_script_all_win.js у вас же там ничего нет значит и добавлять ничего не надо
Т.е. тот загрузчик нужно вставить вместо или рядом с комментарием?
Да
to all
Добавляйте здесь ссылки на скрипты или сами скрипты кто чем пользуется...
Отредактировано Vitaliy V. (06-07-2021 01:22:41)
Отсутствует
Vitaliy V.
Огромное Спасибо за обновлённые загрузчики, скрипты и кнопки.
Еще добавлю здесь ссылку на дропмакер в адресной строке urlbarhistorydropmarker.
В 91+ тоже работает исправно, только иконка там поменялась на arrow-down.svg, сменил у себя в
.
Ещё добавлю переработанные по Вашим советам скрипты классического окна загрузок для custom_script_all_win.js и русифицированные к тому же
if (location.href == "chrome://browser/content/browser.xhtml") {
Cu.import("resource://gre/modules/Services.jsm");
window.ucjs_downloadManager = {
_summary: null,
_list: null,
createElement: function(localName, arryAttribute) {
let elm = document.createXULElement(localName);
for(let i = 0; i < arryAttribute.length; i++) {
elm.setAttribute(arryAttribute[i].attr, arryAttribute[i].value);
}
return elm;
},
init: function() {
window.addEventListener("unload", this, false);
let ref = document.getElementById("menu_openDownloads");
let menu = ref.parentNode.insertBefore(
this.createElement("menuitem",
[{attr: "label", value:"Менеджер загрузок"},
{attr : "oncommand", value: "ucjs_downloadManager.openDownloadManager(true);"}
]), ref);
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
// Ensure that the DownloadSummary object will be created asynchronously.
if (!this._summary) {
this.Downloads.getSummary(this.Downloads.ALL).then(summary => {
this._summary = summary;
return this._summary.addView(this);
}).then(null, Cu.reportError);
}
if (!this._list) {
this.Downloads.getList(this.Downloads.ALL).then(list => {
this._list = list;
return this._list.addView(this);
}).then(null, Cu.reportError);
}
},
uninit: function() {
window.removeEventListener("unload", this, false);
if (this._summary) {
this._summary.removeView(this);
}
if (this._list) {
this._list.removeView(this);
}
},
handleEvent: function(event) {
switch (event.type) {
case "unload":
this.uninit();
break;
}
},
openDownloadManager: function ucjs_openDownloadManager(aForceFocus) {
var enumerator = Services.wm.getEnumerator(null);
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.location == "chrome://browser/content/downloads/contentAreaDownloadsView.xhtml"
&& PrivateBrowsingUtils.isWindowPrivate(window) ==
PrivateBrowsingUtils.isWindowPrivate(win)) {
if (aForceFocus)
win.focus();
return;
}
}
try {
var height = Math.max(100,Services.prefs.getIntPref("browser.download.manager.size.height"));
var width = Math.max(300,Services.prefs.getIntPref("browser.download.manager.size.width"));
var screenX = Math.min(Math.max(0,Services.prefs.getIntPref("browser.download.manager.size.screenX")), screen.availWidth - width);
var screenY = Math.min(Math.max(0,Services.prefs.getIntPref("browser.download.manager.size.screenY")), screen.availHeight - height);
} catch(r){
height = 300;
width = 480;
screenX = 5;
screenY = 5;
}
var win = window.open("chrome://browser/content/downloads/contentAreaDownloadsView.xhtml",
"Download" +
(PrivateBrowsingUtils.isWindowPrivate(window) ? " - Private Window"
: ""),
"outerWidth=" + width + ",outerHeight=" + height +
",left=" + screenX + ",top=" + screenY +
",chrome,toolbar=yes,dialog=no,resizable");
},
closeDownloadManager: function ucjs_closeDownloadManager() {
var enumerator = Services.wm.getEnumerator(null);
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.location == "chrome://browser/content/downloads/contentAreaDownloadsView.xhtml") {
win.close();
return;
}
}
},
onDownloadAdded: function (aDownload) {
var showWhenStarting = true;
try {
showWhenStarting = Services.prefs.getBoolPref("browser.download.manager.showWhenStarting");
} catch(e) {}
var numDls = 0;
if (showWhenStarting) {
if (this._list) {
this._list.getAll().then(downloads => {
for (let download of downloads) {
if (!download.stopped)
numDls++;
}
if (numDls > 0)
this.openDownloadManager(false);
}).then(null, Cu.reportError);
}
}
},
onDownloadChanged: function (aDownload) {
if (!this._list)
return;
this._list.getAll().then(downloads => {
var num = 0;
for (let download of downloads) {
if (!download.succeeded)
num++;
}
if (num == 0) {
var closeWhenDone = true;
try {
closeWhenDone = Services.prefs.getBoolPref("browser.download.manager.closeWhenDone");
} catch(e) {}
if (closeWhenDone) {
this.closeDownloadManager();
}
}
}).then(null, Cu.reportError);
}
};
ucjs_downloadManager.init();
}Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DownloadIntegration.jsm");
window.ucjs_downloadManagerMain = {
originalTitle:"",
_summary: null,
_list: null,
_wait:false,
createElement: function(localName, arryAttribute) {
let elm = document.createXULElement(localName);
for(let i = 0; i < arryAttribute.length; i++) {
elm.setAttribute(arryAttribute[i].attr, arryAttribute[i].value);
}
return elm;
},
createElementNS: function(NS, localName, arryAttribute) {
let elm = document.createElementNS(NS, localName);
for(let i = 0; i < arryAttribute.length; i++) {
elm.setAttribute(arryAttribute[i].attr, arryAttribute[i].value);
}
return elm;
},
init: function() {
window.addEventListener("unload", this, false);
// xxx remove in-content css
var elements = document.childNodes;
for (var i = 0; i <= elements.length; i++) {
var element = elements[i];
if (element.nodeValue.indexOf("chrome://browser/skin/downloads/contentAreaDownloadsView.css") > -1) {
document.removeChild(element);
break;
}
}
document.getElementById("downloadsListEmptyDescription").setAttribute("flex", "1");
let ref = document.documentElement;
ref = ref.appendChild(this.createElement("hbox", []));
ref.appendChild(this.createElement("button",
[{attr: "id", value: "ucjs_clearListButton"},
{attr: "label", value: "Очистить загрузки"},
]));
ref.appendChild(this.createElement("spacer",
[{attr: "flex", value: "1"}]));
ref.appendChild(this.createElementNS("http://www.w3.org/1999/xhtml", "input",
[{attr: "id", value: "ucjs_downloadManagerMain_input"},
{attr: "clickSelectsAll", value: "true"},
{attr: "type", value: "search"},
{attr: "placeholder", value: "Поиск в загрузках"},
{attr: "aria-autocomplete", value: "list"}
]));
document.getElementById("ucjs_clearListButton").addEventListener("command", function(event) {
ucjs_downloadManagerMain.clearDownloads();
});
document.getElementById("ucjs_downloadManagerMain_input")
.addEventListener("input", function(event) {
ucjs_downloadManagerMain.doSearch(event.target.value);
});
this.originalTitle = document.title +
(PrivateBrowsingUtils.isWindowPrivate(window) ? " - Private Window"
: "");
/*
// xxx Bug 1279329 "Copy Download Link" of context menu in Library is grayed out
var listBox = document.getElementById("downloadsRichListBox");
var placesView = listBox._placesView;
var place = placesView.place;
placesView.place= null;
placesView.place = place;
*/
setTimeout(function(){this._wait = true}.bind(this), 0);
// Ensure that the DownloadSummary object will be created asynchronously.
if (!this._summary) {
Downloads.getSummary(Downloads.ALL).then(summary => {
this._summary = summary;
return this._summary.addView(this);
}).then(null, Cu.reportError);
}
if (!this._list) {
Downloads.getList(Downloads.ALL).then(list => {
this._list = list;
return this._list.addView(this);
}).then(null, Cu.reportError);
}
try {
var showProgressInTaskButton = Services.prefs.getBoolPref("browser.download.manager.showProgressInTaskButton")
} catch(ex) {
showProgressInTaskButton = true; //default
}
if (showProgressInTaskButton)
setTimeout(function() {
try {
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow).docShell;
let gWinTaskbar = Components.classes["@mozilla.org/windows-taskbar;1"]
.getService(Components.interfaces.nsIWinTaskbar);
this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell);
} catch(ex) {
this._taskbarProgress = null;
}
}.bind(this), 10);
},
uninit: function() {
window.removeEventListener("unload", this, false);
this._taskbarProgress = null;
if (this._wait)
this.saveSizePosition();
if (this._summary) {
this._summary.removeView(this);
}
if (this._list) {
this._list.removeView(this);
}
},
handleEvent: function(event) {
switch (event.type) {
case "unload":
this.uninit();
break;
}
},
saveSizePosition: function() {
if (window.windowState == 3) {
Services.prefs.setIntPref("browser.download.manager.size.height", window.outerHeight);
Services.prefs.setIntPref("browser.download.manager.size.width", window.outerWidth);
Services.prefs.setIntPref("browser.download.manager.size.screenX", window.screenX);
Services.prefs.setIntPref("browser.download.manager.size.screenY", window.screenY);
}
},
onSummaryChanged: function () {
if (!this._summary)
return;
if (this._summary.allHaveStopped || this._summary.progressTotalBytes == 0) {
document.title = this.originalTitle;
if (this._taskbarProgress) {
this._taskbarProgress.setProgressState(
Ci.nsITaskbarProgress.STATE_NO_PROGRESS, 0, 0);
}
Cu.import("resource://gre/modules/Services.jsm");
var enumerator = Services.wm.getEnumerator("navigator:browser");
while(enumerator.hasMoreElements()) {
return;
}
var closeWhenDone = true;
try {
closeWhenDone = Services.prefs.getBoolPref("browser.download.manager.closeWhenDone");
} catch(e) {}
if (closeWhenDone) {
DownloadIntegration._store.save();
window.close();
}
} else {
// If the last browser window has been closed, we have no indicator any more.
if (this._taskbarProgress) {
if (this._summary.allHaveStopped || this._summary.progressTotalBytes == 0) {
this._taskbarProgress.setProgressState(
Ci.nsITaskbarProgress.STATE_NO_PROGRESS, 0, 0);
} else {
// For a brief moment before completion, some download components may
// report more transferred bytes than the total number of bytes. Thus,
// ensure that we never break the expectations of the progress indicator.
let progressCurrentBytes = Math.min(this._summary.progressTotalBytes,
this._summary.progressCurrentBytes);
this._taskbarProgress.setProgressState(
Ci.nsITaskbarProgress.STATE_NORMAL,
progressCurrentBytes,
this._summary.progressTotalBytes);
}
}
// Update window title
var numDls = 0;
if (!this._list)
return;
this._list.getAll().then(downloads => {
for (let download of downloads) {
if (download.hasProgress && !download.succeeded)
numDls++;
}
let progressCurrentBytes = Math.min(this._summary.progressTotalBytes,
this._summary.progressCurrentBytes);
let percent = Math.floor(progressCurrentBytes / this._summary.progressTotalBytes * 100);
let text = percent + "% из " + numDls + (numDls < 2 ? " файла - " : " файлов - ") ;
document.title = text + this.originalTitle;
}).then(null, Cu.reportError);
}
},
clearDownloads: function ucjs_clearDownloads() {
var DO_NOT_DELETE_HISTORY = true; /* custmizable true or false */
var richListBox = document.getElementById("downloadsRichListBox");
var places = [];
function addPlace(aURI, aTitle, aVisitDate) {
places.push({
uri: aURI,
title: aTitle,
visits: [{
visitDate: (aVisitDate || Date.now()) * 1000,
transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
}
function moveDownloads2History(d) {
if (DO_NOT_DELETE_HISTORY &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
for (let element of richListBox.childNodes) {
let download = element._shell.download;
let aURI = makeURI(download.source.url);
// let aTitle = document.getAnonymousElementByAttribute(element, "class", "downloadTarget").value
let aTitle = download.target.path;
aTitle = aTitle.match( /[^\\]+$/i )[0];
aTitle = aTitle.match( /[^/]+$/i )[0];
let aVisitDate = download.endTime || download.startTime;
addPlace(aURI, aTitle, aVisitDate)
}
}
// Clear List
richListBox._placesView.doCommand('downloadsCmd_clearDownloads');
if (DO_NOT_DELETE_HISTORY &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
if (places.length > 0) {
var asyncHistory = Components.classes["@mozilla.org/browser/history;1"]
.getService(Components.interfaces.mozIAsyncHistory);
asyncHistory.updatePlaces(places);
}
}
}
var btn = document.getElementById("ucjs_clearListButton");
moveDownloads2History(0);
},
doSearch: function ucjs_doSearch(filterString) {
var richListBox = document.getElementById("downloadsRichListBox");
richListBox._placesView.searchTerm = filterString;
}
};
ucjs_downloadManagerMain.init();@-moz-document url(chrome://browser/content/downloads/contentAreaDownloadsView.xhtml) {
#downloadsListEmptyDescription {
margin: 0 !important;
padding: 1px 0 0 6px !important;
background-color: white !important;
}
#contentAreaDownloadsView > hbox {
background-color: -moz-Dialog !important;
padding-top: 2px !important;
border: 1px solid gainsboro !important;
}
#ucjs_clearListButton {
margin: 1px 2px 2px !important;
}
}Отредактировано sandro79 (12-01-2022 13:52:29)
Отсутствует
Скрипты авторства Dumby, которые использую:
Переключение вкладок наведением указателя на вкладку, и там же, как бы костыль, добавления закладки звёздочкой в адресной строке в меню закладок, а через меню на странице - в "Другие закладки" https://forum.mozilla-russia.org/viewto … 27#p786627
Действие двойного клика на панели вкладок - открыть новую вкладку вместо развернуть окно https://forum.mozilla-russia.org/viewto … 49#p782149
Кнопка "Закрыть другие вкладки" https://forum.mozilla-russia.org/viewto … 81#p788681
Скрипт возврата в адресную строку значка "Копировать ссылку" https://forum.mozilla-russia.org/viewto … 96#p790496
Скрипт возврата пункта "Информация о странице" https://forum.mozilla-russia.org/viewto … 92#p792092
Другой вариант возврата пункта "Информация о странице" с открытием вкладки "Разрешения", код в самом низу поста https://forum.mozilla-russia.org/viewto … 04#p792104
Ещё кнопка авторства Vitaliy V. вкл/откл звука на вкладке/вкладках https://forum.mozilla-russia.org/viewto … 10#p787710, тоже сильно выручает.
Через файл user_chrome.manifest комплекта user_chrome_files можно легко поменять значки интерфейса и так же на служебных страницах, что я и сделал в 89+, использовав значки из
78 и свои кое-где
content user_chrome_files ./ # Не уверены, не редактируйте этот файл! override chrome://global/skin/icons/defaultFavicon.svg chrome://user_chrome_files/content/custom_styles/svg/defaultFavicon.svg override chrome://branding/content/identity-icons-brand.svg chrome://user_chrome_files/content/custom_styles/svg/defaultFavicon.svg override chrome://mozapps/skin/extensions/extension.svg chrome://user_chrome_files/content/custom_styles/svg/extension.svg override chrome://global/skin/icons/settings.svg chrome://user_chrome_files/content/custom_styles/svg/settings.svg override chrome://mozapps/skin/extensions/extensionGeneric.svg chrome://user_chrome_files/content/custom_styles/svg/extension.svg override chrome://global/skin/icons/help.svg chrome://user_chrome_files/content/custom_styles/svg/help.svg override chrome://global/skin/icons/plugin.svg chrome://user_chrome_files/content/custom_styles/svg/pluginGeneric.svg override chrome://mozapps/skin/extensions/category-discover.svg chrome://user_chrome_files/content/custom_styles/svg/category-discover.svg override chrome://mozapps/skin/extensions/category-extensions.svg chrome://user_chrome_files/content/custom_styles/svg/category-extensions.svg override chrome://mozapps/skin/extensions/category-themes.svg chrome://user_chrome_files/content/custom_styles/svg/category-themes.svg override chrome://mozapps/skin/extensions/category-plugins.svg chrome://user_chrome_files/content/custom_styles/svg/category-plugins.svg override chrome://browser/skin/preferences/category-general.svg chrome://user_chrome_files/content/custom_styles/svg/settings.svg override chrome://browser/skin/home.svg chrome://user_chrome_files/content/custom_styles/svg/home.svg override chrome://browser/skin/preferences/category-search.svg chrome://user_chrome_files/content/custom_styles/svg/category-search.svg override chrome://browser/skin/preferences/category-privacy-security.svg chrome://user_chrome_files/content/custom_styles/svg/category-privacy-security.svg override chrome://browser/skin/preferences/category-experiments.svg chrome://user_chrome_files/content/custom_styles/svg/category-experiments.svg override chrome://global/skin/icons/more.svg chrome://user_chrome_files/content/custom_styles/svg/more.svg override chrome://global/skin/icons/folder.svg chrome://user_chrome_files/content/custom_styles/svg/folder.svg override chrome://browser/skin/places/folder.svg chrome://user_chrome_files/content/custom_styles/svg/folder.svg override chrome://global/skin/icons/arrow-dropdown-16.svg chrome://user_chrome_files/content/custom_styles/svg/arrow-dropdown-16.svg override chrome://browser/skin/history.svg chrome://user_chrome_files/content/custom_styles/svg/history.svg override chrome://global/skin/icons/chevron.svg chrome://user_chrome_files/content/custom_styles/svg/chevron.svg override chrome://browser/skin/menu.svg chrome://user_chrome_files/content/custom_styles/svg/menu.svg override chrome://global/skin/icons/page-portrait.svg chrome://global/skin/icons/info.svg override chrome://branding/content/icon16.png chrome://branding/content/identity-icons-brand.svg override chrome://browser/skin/controlcenter/tracking-protection.svg chrome://user_chrome_files/content/custom_styles/svg/tracking-protection.svg
/* иконка щита "трекеры не обнаружены" */
#urlbar-input-container[pageproxystate="valid"] > #tracking-protection-icon-container > #tracking-protection-icon-box > #tracking-protection-icon {
list-style-image: url(./svg/tracking-protection.svg) !important;
fill-opacity: 0.6 !important;
}
/* иконка щита "блокируются трекеры" */
#urlbar-input-container[pageproxystate="valid"] > #tracking-protection-icon-container > #tracking-protection-icon-box:not([hasException])[active] > #tracking-protection-icon {
display: block !important;
background-image: url(./svg/tracking-protection-active.svg) !important;
transform: translateX(-256px) !important;
width: 272px !important;
background-size: auto !important;
height: 16px !important;
min-height: 16px !important;
-moz-context-properties: fill, fill-opacity !important;
}
/* зелёный замок */
#identity-box[pageproxystate="valid"].verifiedDomain #identity-icon, #identity-box[pageproxystate="valid"].mixedActiveBlocked #identity-icon {
list-style-image: url(./svg/security.svg) !important;
fill: #12BC00 !important;
}
/* зелёный замок в "информация о сайте" */
#identity-popup[connection^="secure"] .identity-popup-security-connection {
background-image: url(./svg/security.svg) !important;
fill: #12BC00 !important;
}
/* чёрный замок смешанного содержимого */
#identity-box[pageproxystate="valid"].weakCipher #identity-icon, #identity-box[pageproxystate="valid"].mixedDisplayContent #identity-icon, #identity-box[pageproxystate="valid"].mixedDisplayContentLoadedActiveBlocked #identity-icon, #identity-box[pageproxystate="valid"].certUserOverridden #identity-icon, #identity-box[pageproxystate="valid"].certErrorPage #identity-icon {
list-style-image: url(./svg/security-warning.svg) !important;
fill-opacity: 0.6 !important;
}
/* чёрный замок смешанного содержимого в "информация о сайте" */
#identity-popup[ciphers="weak"] .identity-popup-security-connection, #identity-popup[mixedcontent~="passive-loaded"][isbroken] .identity-popup-security-connection {
background-image: url(./svg/security-warning.svg) !important;
}
/* зачёркнутый замок незащещённого содержимого */
#identity-box[pageproxystate="valid"].notSecure #identity-icon, #identity-box[pageproxystate="valid"].mixedActiveContent #identity-icon, #identity-box[pageproxystate="valid"].httpsOnlyErrorPage #identity-icon {
list-style-image: url(./svg/security-broken.svg) !important;
fill-opacity: 0.6 !important;
}
/* зачёркнутый замок незащещённого содержимого в "информация о сайте" */
.identity-popup-security-connection {
background-image: url(./svg/security-broken.svg) !important;
}
/* значок дополнительных разрешений */
#permissions-granted-icon {
list-style-image: url(./svg/permissions.svg) !important;
fill-opacity: 0.6 !important;
}
/* значок запрета автовоспроизведения */
.autoplay-media-icon.blocked-permission-icon {
list-style-image: url(./svg/autoplay-media-blocked.svg) !important;
fill-opacity: 0.6 !important;
}
/* значок разрешённого автовоспроизведения */
.autoplay-media-icon {
list-style-image: url(./svg/autoplay-media.svg) !important;
fill-opacity: 0.6 !important;
}
/* кнопка "назад" */
#back-button {
list-style-image: url("./svg/back.svg") !important;
}
/* кнопка "вперёд" */
#forward-button {
list-style-image: url("./svg/forward.svg") !important;
}
/* значок "v" "показать историю" */
#urlbar .urlbar-history-dropmarker {
/* list-style-image: url(./svg/arrow-dropdown-16.svg) !important; */
fill-opacity: 0.6 !important;
}
/* звёздочка в адресной строке */
#pageAction-panel-bookmark, #star-button {
list-style-image: url("./svg/bookmark-hollow.svg") !important;
fill-opacity: 0.6 !important;
}
#pageAction-panel-bookmark[starred], #star-button[starred] {
list-style-image: url("./svg/bookmark.svg") !important;
fill-opacity: 1 !important;
}
/* прозрачность значка "копироать ссылку" */
#pageAction-urlbar-ucf-copyURL .urlbar-icon {
fill-opacity: .6 !important;
}Отредактировано sandro79 (06-07-2021 16:10:38)
Отсутствует
Скрипты для custom_script.js:
URL tooltip: https://forum.mozilla-russia.org/viewto … 55#p783755
(async () => {
var id = "ucf-toggle-tooltip-url",
label = "Тултипы с URL",
tooltiptext = "Переключить тултипы",
img = "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' style='fill:context-fill rgb(142, 142, 152);'><path d='M9.618 6.721a2.483 2.483 0 0 0-.39-.317l-.735.734A1.486 1.486 0 0 1 8.91 9.55l-2.12 2.122a1.486 1.486 0 0 1-2.122 0 1.486 1.486 0 0 1 0-2.121l.605-.605a3.53 3.53 0 0 1-.206-1.209L3.961 8.843a2.506 2.506 0 0 0 0 3.535 2.506 2.506 0 0 0 3.535 0l2.122-2.121a2.506 2.506 0 0 0 0-3.536z'/><path d='M6.79 9.55c.12.121.25.226.389.317l.734-.734a1.486 1.486 0 0 1-.417-2.411L9.618 4.6a1.486 1.486 0 0 1 2.121 0 1.486 1.486 0 0 1 0 2.121l-.605.605c.137.391.211.798.206 1.209l1.106-1.107a2.506 2.506 0 0 0 0-3.535 2.506 2.506 0 0 0-3.535 0L6.789 6.014a2.506 2.506 0 0 0 0 3.536z'/><circle style='fill:none;stroke:context-fill rgb(142, 142, 152);stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round' cx='8' cy='8' r='7.4'/></svg>",
imgcolordisable = "color-mix(in srgb, currentColor 20%, #e31b5d)";
var branch = "extensions.ucf.", pref = "tooltip_url_enable";
var tpurl = {
initialised: false,
tooltip_url_enable: true,
get ext_branch() {
delete this.ext_branch;
return this.ext_branch = Services.prefs.getBranch(branch);
},
init() {
if (this.initialised) return;
Services.prefs.getDefaultBranch(branch).setBoolPref(pref, true);
Services.prefs.addObserver(`${branch}${pref}`, this);
if (this.tooltip_url_enable = this.ext_branch.getBoolPref(pref))
this.registerActor();
this.initialised = true;
},
observe(subject, topic, data) {
var fill = "";
if ((this.tooltip_url_enable = this.ext_branch.getBoolPref(pref)) === true)
this.registerActor();
else {
fill = imgcolordisable;
this.unregisterActor();
}
this.callWithEachWindow(id, {fill: fill});
},
callWithEachWindow(buttonID, atr) {
var getW = CustomizableUI.getWidget(buttonID);
if (getW.instances.length)
for (let {node} of getW.instances) {
if (!node) continue;
for (let a in atr)
node.style.setProperty(a, atr[a]);
}
else
for (let win of CustomizableUI.windows) {
let node = getW.forWindow(win).node;
if (!node) continue;
for (let a in atr)
node.style.setProperty(a, atr[a]);
}
},
registerActor() {
ChromeUtils.registerWindowActor("UcfTooltipUrl", {
child: {
moduleURI: "chrome://user_chrome_files/content/custom_scripts/Ucf_TooltipUrlChild.jsm",
events: {
mouseover: { capture: true },
},
},
allFrames: true,
matches: ["<all_urls>"],
messageManagerGroups: ["browsers"],
});
},
unregisterActor() {
ChromeUtils.unregisterWindowActor("UcfTooltipUrl");
},
};
CustomizableUI.createWidget({
id: id,
label: label,
tooltiptext: tooltiptext,
localized: false,
defaultArea: CustomizableUI.AREA_NAVBAR,
onCreated(btn) {
tpurl.init();
btn.style.setProperty("list-style-image", `url("${img}")`, "important");
if (!tpurl.tooltip_url_enable)
btn.style.setProperty("fill", imgcolordisable);
},
onCommand(e) {
tpurl.ext_branch.setBoolPref(pref, !tpurl.ext_branch.getBoolPref(pref));
},
});
})();var EXPORTED_SYMBOLS = ["UcfTooltipUrlChild"];
ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
class UcfTooltipUrlChild extends JSWindowActorChild {
handleEvent(e) {
timer.cancel();
timer.initWithCallback(() => {
var elm = e.isTrusted && e.composedTarget, el, titl;
if (!elm) return;
do {
if (!elm.matches) continue;
if (elm.matches(":any-link")) {
if (elm.matches("[href='#'], [href^='javascript']"))
return;
el = elm;
if (elm.matches("[title]"))
titl = elm;
else
while (elm = elm.flattenedTreeParentNode) {
if (!elm.matches) continue;
if (elm.matches("[title]")) {
titl = elm;
break;
}
}
break;
}
if (elm.matches("[title]")) {
titl = elm;
while (elm = elm.flattenedTreeParentNode) {
if (!elm.matches) continue;
if (elm.matches(":any-link")) {
if (elm.matches("[href='#'], [href^='javascript']"))
return;
el = elm;
break;
}
}
break;
}
} while (elm = elm.flattenedTreeParentNode);
if (!el) return;
var href = el.href;
if (titl) el = titl;
titl = (el.title || "");
var title = titl.trim(), pre = "", path = "";
try {
href = Services.io.newURI(href);
pre = href.displayPrePath;
path = `\n${href.pathQueryRef}`;
if (path === "\n/") path = "";
href = `${pre}${path}`;
} catch (e) {}
try {
href = decodeURIComponent(href);
} catch (e) {}
el.title = title = `${href}${title === "" ? "" : `\nTitle: ${title}`}`;
this.contentWindow.addEventListener("mouseout", () => {
try {
if (!el || title !== el.title) return;
if (titl !== "")
el.title = titl;
else
el.removeAttribute("title");
} catch (e) {}
}, { once: true });
}, 400, Ci.nsITimer.TYPE_ONE_SHOT);
}
didDestroy() {
timer.cancel();
}
}Скрипты для custom_script_win.js:
Скрыть ненужные папки в боковой панели: https://forum.mozilla-russia.org/viewto … 25#p777225;
AutoPopup: https://forum.mozilla-russia.org/viewto … 64#p789264
Скрипты: search_image_contextmenu ... https://forum.mozilla-russia.org/viewto … 29#p788229
Отредактировано kokoss (14-04-2023 18:33:43)
Win7
Отсутствует
UndoBookmarksContextMenu - пункты контекстного меню закладок "вернуть\повторить удаление" (закладки)
Для custom_script_win.js или custom_script_all_win.js, в зависимости где должно работать -
панель закладок, сайдбар, библиотека в окне или библиотека во вкладке.
Строка загрузки - loadscript("subfolder/script_file_name.uc.js", win); или loadscript("script_file_name.uc.js", win);
handleEvent: function(event) {
switch (event.type) {
case 'unload':
this.uninit();
break;
case 'popupshown':
this.popupshown(event);
break;
}
},
init: function() {
window.addEventListener('unload', this, false);
this.popup = document.getElementById("placesContext");
if (!this.popup)
return;
this.popup.addEventListener('popupshown', this, false);
let template = (location.href == "chrome://browser/content/browser.xul") ?
[
["menuitem", {id: "undobookmarksmenuUndo",
disabled: "true",
label: "Вернуть удаленное",
key: "key_undo",
oncommand: "PlacesTransactions.undo().catch(Cu.reportError);",
selection: "any"
}],
["menuitem", {id:"undobookmarksmenuRedo",
disabled: "true",
label: "Повторить удаление",
key: "key_redo",
oncommand: "PlacesTransactions.redo().catch(Cu.reportError);",
selection: "any"
}]
] : [
["menuitem", {id: "undobookmarksmenuUndo",
disabled: "true",
label: "Вернуть удаленное",
key: "key_undo",
oncommand: "PlacesTransactions.undo().catch(Cu.reportError);",
acceltext: "Ctrl+Z",
selection: "any"
}],
["menuitem", {id:"undobookmarksmenuRedo",
disabled: "true",
label: "Повторить удаление",
key: "key_redo",
oncommand: "PlacesTransactions.redo().catch(Cu.reportError);",
acceltext: "Ctrl+Y",
selection: "any"
}]
];
let ref = document.getElementById("placesContext_deleteSeparator");
ref.parentNode.insertBefore(this.jsonToDOM(template, document, {}), ref);
},
uninit: function() {
window.removeEventListener('unload', this, false);
if (!this.popup)
return;
this.popup.removeEventListener('popupshown', this, false);
},
popupshown: function(event){
var menuitem = document.getElementById("undobookmarksmenuUndo");
if (menuitem)
menuitem.setAttribute('disabled', PlacesTransactions.topUndoEntry == null);
menuitem = document.getElementById("undobookmarksmenuRedo");
if (menuitem)
menuitem.setAttribute('disabled', PlacesTransactions.topRedoEntry == null);
},
jsonToDOM: function(jsonTemplate, doc, nodes) {
jsonToDOM.namespaces = {
html: "http://www.w3.org/1999/xhtml",
xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
};
jsonToDOM.defaultNamespace = jsonToDOM.namespaces.xul;
function jsonToDOM(jsonTemplate, doc, nodes) {
function namespace(name) {
var reElemNameParts = /^(?
.*)
?(.*)$/.exec(name);
return { namespace: jsonToDOM.namespaces[reElemNameParts[1]], shortName: reElemNameParts[2] };
}
// Note that 'elemNameOrArray' is: either the full element name (eg. [html:]div) or an array of elements in JSON notation
function tag(elemNameOrArray, elemAttr) {
// Array of elements? Parse each one...
if (Array.isArray(elemNameOrArray)) {
var frag = doc.createDocumentFragment();
Array.prototype.forEach.call(arguments, function(thisElem) {
frag.appendChild(tag.apply(null, thisElem));
});
return frag;
}
// Single element? Parse element namespace prefix (if none exists, default to defaultNamespace), and create element
var elemNs = namespace(elemNameOrArray);
var elem = doc.createElementNS(elemNs.namespace || jsonToDOM.defaultNamespace, elemNs.shortName);
// Set element's attributes and/or callback functions (eg. onclick)
for (var key in elemAttr) {
var val = elemAttr[key];
if (nodes && key == "key") {
nodes[val] = elem;
continue;
}
var attrNs = namespace(key);
if (typeof val == "function") {
// Special case for function attributes; don't just add them as 'on...' attributes, but as events, using addEventListener
elem.addEventListener(key.replace(/^on/, ""), val, false);
} else {
// Note that the default namespace for XML attributes is, and should be, blank (ie. they're not in any namespace)
elem.setAttributeNS(attrNs.namespace || "", attrNs.shortName, val);
}
}
// Create and append this element's children
var childElems = Array.prototype.slice.call(arguments, 2);
childElems.forEach(function(childElem) {
if (childElem != null) {
elem.appendChild(
childElem instanceof doc.defaultView.Node ? childElem :
Array.isArray(childElem) ? tag.apply(null, childElem) :
doc.createTextNode(childElem));
}
});
return elem;
}
return tag.apply(null, jsonTemplate);
}
return jsonToDOM(jsonTemplate, doc, nodes);
}
}
window.undobookmarksmenu.init();
}
Отредактировано _zt (16-07-2021 16:52:52)
Отсутствует
Кнопка для Attributes_Inspector от Dumby
https://forum.mozilla-russia.org/viewto … 07#p789007
Путь к attrsInspector.js прописать свой.
Сам attrsInspector.js - https://github.com/Infocatcher/Custom_B … _Inspector
Например, chrome://user_chrome_files/content/custom_scripts/custom_js/attrsInspector.js =
пути ФС - .\chrome\user_chrome_files\custom_scripts\custom_js\attrsInspector.js
Для custom_script.js в user_chrome_files
Открытие окна "Инструменты браузера" по ПКМ на иконке Attributes Inspector
Создано по шаблонам от Vitaliy V.
// Открытие окна "Инструменты браузера"
// по ПКМ на иконке Attributes Inspector
// Создано по шаблонам, где то здесь -
// https://forum.mozilla-russia.org/viewtopic.php?pid=791976#p791976
(this.opendevtoolsrclick3 = {
async init(that) {
await window.delayedStartupPromise;
var btn = CustomizableUI.getWidget("AttributesInspector")?.forWindow(window).node;
if (!btn) return;
btn.setAttribute("context", "");
btn.tooltipText = `ЛКМ: Attributes Inspector\nПКМ: Инструменты браузера`;
var listener = e => {
if (e.button != 2) return;
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
var pref = Services.prefs, chr = "devtools.chrome.enabled", rem = "devtools.debugger.remote-enabled";
if (!pref.getBoolPref(chr) || !pref.getBoolPref(rem)) {
pref.setBoolPref(chr, true);
pref.setBoolPref(rem, true);
}
var { BrowserToolboxLauncher } = ChromeUtils.import("resource://devtools/client/framework/browser-toolbox/Launcher.jsm");
BrowserToolboxLauncher.init();
};
btn.addEventListener("click", listener);
that.unloadlisteners.push("opendevtoolsrclick3");
this.destructor = () => {
btn.removeEventListener("click", listener);
};
}
}).init(this);Отсутствует
Vitaliy V.
Спрошу в этой теме, возможно это можно сделать тоже только скриптом. Вы мне делали скрипт смены иконки поисковика.
Стилем, по этому шаблону, я сменил ещё иконку на старую на закладке.
Старую иконку взял по этому адресу https://yandex.ru/favicon.ico, странно что сейчас везде отображается не она а буква Я в красном круге, но не суть важно.
.bookmark-item:not([container])[image^='page-icon:https://yandex.ru/'] image {
object-position: 16px 0px !important;
list-style-image: none !important;
background: url("./svg/yandex.ico") transparent center no-repeat !important;
}
давненько уже. .bookmark-item:not([container]):is([image^='page-icon:https://nnm-club.me/'], [image^='page-icon:https://nnmclub.ro/'], [image^='page-icon:https://nnmclub.to/']) image {
object-position: 16px 0px !important;
list-style-image: none !important;
background: url("./svg/nnmclub.ico") transparent center no-repeat !important;
}Отредактировано sandro79 (19-07-2021 10:34:20)
Отсутствует
91.0возможно это можно сделать тоже только скриптом
Это скрипты для сайтов, для этого есть Greasemonkey и т.д.
там где он изначально формируется
Естественно со страницы сайта по ссылке например
<link rel="icon" href="favicon.ico">
либо из кеша
Ладно попробую но только потому что в Greasemonkey не сработают некоторые события.
Размеры например sizes="32x32" не учитываются, для всех одна иконка
custom_script.js
ChromeUtils.registerWindowActor("LinkWinActor", {
child: {
moduleURI: "chrome://user_chrome_files/content/custom_scripts/LinkWinActorChild.jsm",
events: {
DOMLinkAdded: { capture: true },
DOMLinkChanged: {},
DOMHeadElementParsed: {},
pageshow: {},
},
},
messageManagerGroups: ["browsers"],
matches: [ // адреса где работает скрипт
"https://yandex.ru/",
"https://yandex.ru/?*",
"https://yandex.ru/search/*",
"https://passport.yandex.ru/*",
"https://nnmclub.to/*",
"about:config",
"about:user-chrome-files",
],
});var EXPORTED_SYMBOLS = ["LinkWinActorChild"];
ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
const LINK_SELECTOR = "link[href]:is([rel~='icon'],[rel~='apple-touch-icon'],[rel~='apple-touch-icon-precomposed'],[rel~='fluid-icon'],[rel~='mask-icon'])";
const ICONS = { // "домен, или адрес для about|chrome|resource": "иконка",
"yandex.ru": "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='16' width='16'><g><rect rx='2' ry='2' width='16' height='16' style='fill:rgb(231, 43, 90);'/><path d='M 8.56,2 C 6.31,2 4.49,3.5 4.49,5.99 4.49,7.49 5.31,8.48 6.97,9.57 L 4,13.5 V 14 H 5.76 L 8.53,9.57 H 9.47 V 14 H 11 V 2 Z M 9.47,8.48 H 8.67 C 7.36,8.48 6.05,7.98 6.05,5.99 6.05,4 7.26,3 8.47,3 H 9.47 Z' style='fill:white;'/></g></svg>",
"nnmclub.to": "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='16' width='16'><g><path d='M 0.887,0 C 0.54,0.14 0.289,0.279 0.135,0.711 0.051,0.851 0.015,0.991 0,1.27 -0.009,1.71 0.061,2.16 0.325,3.05 0.564,3.88 0.612,4.12 0.612,4.37 0.612,4.48 0.612,4.56 0.588,4.67 0.457,5.43 0.457,6.07 0.588,6.56 0.672,6.87 0.779,7.09 0.947,7.28 1.21,7.57 1.49,7.73 2.05,7.87 L 2.27,7.91 2.11,7.96 C 1.87,8.01 1.71,8.08 1.55,8.19 1.33,8.31 1.22,8.41 1.09,8.59 0.947,8.65 0.887,8.83 0.839,8.99 0.803,9.17 0.792,9.41 0.827,9.65 0.851,9.93 0.851,9.93 0.827,10 0.827,10.1 0.767,10.3 0.708,10.5 0.588,10.9 0.564,11.1 0.564,11.2 0.564,11.5 0.612,11.6 0.875,11.8 1.15,12.2 1.18,12.3 1.15,12.6 1.1,13.2 1.18,13.6 1.39,13.7 1.49,13.7 1.6,13.9 1.75,14 1.93,14 2.05,14.1 2.28,14.4 2.48,14.5 2.55,14.5 2.64,14.5 2.73,14.7 2.73,14.7 2.87,14.7 3.04,14.7 3.04,14.7 3.47,14.5 4.03,14 4.19,13.9 4.44,13.9 4.55,13.7 4.6,13.7 4.68,13.7 4.88,13.6 5.11,13 5.35,11.9 5.39,11.8 5.43,11.6 5.47,11.5 5.65,10.9 5.89,10.4 6.12,10 6.24,9.83 6.48,9.59 6.49,9.59 6.49,9.59 6.49,9.75 6.48,10.1 6.44,10.3 6.43,10.5 6.28,11.1 6.12,11.5 6.08,11.7 6.05,12 6.03,12.4 6.11,12.6 6.21,12.9 6.32,13 6.43,13 6.57,13 6.71,12.9 6.81,12.6 6.91,12.4 7.07,12 7.11,11.7 7.11,11 7.11,10.7 7.13,10.4 7.27,10 7.35,9.75 7.32,9.75 7.37,9.83 7.52,10.1 7.64,10.7 7.69,11.3 7.72,11.6 7.72,12.2 7.69,12.4 7.64,13 7.61,13.6 7.68,14 7.72,14.4 7.76,14.5 8.01,14.5 8.15,14.7 8.31,14.8 8.67,15.5 8.92,15.9 9.03,15.9 9.11,16 9.17,16 9.17,16 9.33,16 9.52,16 9.52,16 9.77,15.9 10.1,15.7 10.1,15.7 10.4,15.7 10.7,15.7 10.7,15.7 10.7,15.7 11,15.6 11.1,15.5 11.4,14.9 11.4,14.9 11.4,14.8 11.5,14.7 11.5,14.5 11.6,14.4 11.7,14.1 12.2,13.9 12.2,13.9 12.2,13.7 12.4,13.6 12.4,13.6 12.4,13 12.4,12.6 12.5,12.4 12.5,12.3 12.5,12.3 12.5,12.2 12.7,12 12.8,11.7 12.8,11.6 12.8,11.5 12.8,11.2 12.8,11.1 12.8,11.1 12.7,10.7 12.4,10.3 12,9.93 11.9,9.83 11.9,9.83 11.9,9.83 12.2,9.93 12.7,9.93 12.9,9.93 13.7,9.75 14,9.08 14.1,7.84 14.1,7.76 14.3,7.59 14.3,7.49 14.3,7.27 14.3,7.19 14.5,7.01 14.5,6.83 14.8,6.6 15.1,6.19 15.7,5.24 15.9,4.85 16,4.41 16,4.31 16,4.25 16,4.03 16,3.84 16,3.76 16,3.69 15.7,3.03 15.2,2.68 14.3,2.75 13.7,2.76 13,2.97 12.2,3.32 12,3.4 11.6,3.63 11.4,3.81 10.2,4.49 9.11,5.55 8.08,6.85 7.95,7 7.85,7.11 7.85,7.11 7.85,7.11 7.84,7.05 7.84,7.04 7.76,6.93 7.72,6.87 7.61,6.81 L 7.53,6.73 7.64,6.47 C 7.92,5.92 8.13,5.51 8.31,5.23 8.35,5.12 8.51,4.91 8.76,4.63 9.43,3.73 9.68,3.47 9.77,3.35 10,3.21 10,3.2 10,3.15 10.1,3.05 10,2.92 10,2.87 9.95,2.87 9.95,2.91 9.84,2.97 9.84,3.11 9.52,3.44 9.11,4.03 8.92,4.19 8.76,4.37 8.76,4.45 8.35,4.95 7.95,5.69 7.61,6.47 7.53,6.6 7.49,6.73 7.47,6.73 7.47,6.73 7.43,6.71 7.37,6.71 L 7.28,6.68 V 6.59 C 7.2,5.69 7.08,5.08 6.91,4.49 6.83,4.16 6.8,4 6.59,3.44 6.33,2.75 6.2,2.32 6.2,2.21 6.17,2.09 6.05,2.08 6,2.2 5.97,2.31 5.99,2.39 6.11,2.55 6.21,2.75 6.32,2.97 6.73,4.15 7,4.96 7.07,5.13 7.2,6.29 7.23,6.68 7.23,6.68 7.2,6.68 7.13,6.68 6.97,6.75 6.89,6.83 6.83,6.87 6.81,6.89 6.81,6.89 6.81,6.89 6.75,6.73 6.68,6.56 6.53,6.07 6.4,5.77 6.2,5.27 5.36,3.43 4.39,2.01 3.36,1.13 2.64,0.571 2.01,0.14 1.49,0 1.32,0 1.02,0 0.887,0 Z' style='fill:rgb(0, 140, 255);stroke:black;stroke-width:0.6;stroke-linejoin:round;stroke-linecap:round;'/></g></svg>",
"about:config": "chrome://global/skin/icons/settings.svg",
"about:user-chrome-files": "chrome://global/skin/icons/settings.svg",
};
class LinkWinActorChild extends JSWindowActorChild {
actorCreated() {
var docURI = this.document.documentURIObject, host;
if (!/^(?:about|chrome|resource)$/.test(docURI.scheme))
try {
let baseDomain = Services.eTLD.getBaseDomain(docURI);
host = Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService)
.convertToDisplayIDN(baseDomain, {});
} catch (e) {
try {
host = docURI.displayHost;
} catch (e) {
host = docURI.specIgnoringRef;
}
}
else
host = docURI.specIgnoringRef;
var icon = ICONS[host];
if (!icon) {
this.handleEvent = e => {};
return;
}
this._icon = icon;
this.onHeadParsed(this.document.head);
}
onHeadParsed(target) {
for (let link of target.querySelectorAll(LINK_SELECTOR))
link.remove();
var link = this.document.createElement("link");
link.setAttribute("rel", "icon");
link.setAttribute("sizes", "any");
link.setAttribute("href", this._icon);
target.append(link);
}
onLinkEvent(link) {
if (!link.matches(LINK_SELECTOR) || link.href == this._icon) return;
link.href = this._icon;
link.setAttribute("rel", "icon");
link.setAttribute("sizes", "any");
if (link.hasAttribute("type"))
link.removeAttribute("type");
}
handleEvent(e) {
switch (e.type) {
case "DOMLinkAdded":
case "DOMLinkChanged":
this.onLinkEvent(e.target);
break;
case "pageshow":
this.onHeadParsed(e.target.head);
break;
}
}
}Или вариант поддомен + домен, для тех кому надо устанавливать разные иконки для поддоменов
var EXPORTED_SYMBOLS = ["LinkWinActorChild"];
ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
const LINK_SELECTOR = "link[href]:is([rel~='icon'],[rel~='apple-touch-icon'],[rel~='apple-touch-icon-precomposed'],[rel~='fluid-icon'],[rel~='mask-icon'])";
const ICONS = { // "поддомен + домен, или адрес для about|chrome|resource": "иконка",
"yandex.ru": "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='16' width='16'><g><rect rx='2' ry='2' width='16' height='16' style='fill:rgb(231, 43, 90);'/><path d='M 8.56,2 C 6.31,2 4.49,3.5 4.49,5.99 4.49,7.49 5.31,8.48 6.97,9.57 L 4,13.5 V 14 H 5.76 L 8.53,9.57 H 9.47 V 14 H 11 V 2 Z M 9.47,8.48 H 8.67 C 7.36,8.48 6.05,7.98 6.05,5.99 6.05,4 7.26,3 8.47,3 H 9.47 Z' style='fill:white;'/></g></svg>",
get "passport.yandex.ru"() { return this["yandex.ru"]; },
"nnmclub.to": "data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='16' width='16'><g><path d='M 0.887,0 C 0.54,0.14 0.289,0.279 0.135,0.711 0.051,0.851 0.015,0.991 0,1.27 -0.009,1.71 0.061,2.16 0.325,3.05 0.564,3.88 0.612,4.12 0.612,4.37 0.612,4.48 0.612,4.56 0.588,4.67 0.457,5.43 0.457,6.07 0.588,6.56 0.672,6.87 0.779,7.09 0.947,7.28 1.21,7.57 1.49,7.73 2.05,7.87 L 2.27,7.91 2.11,7.96 C 1.87,8.01 1.71,8.08 1.55,8.19 1.33,8.31 1.22,8.41 1.09,8.59 0.947,8.65 0.887,8.83 0.839,8.99 0.803,9.17 0.792,9.41 0.827,9.65 0.851,9.93 0.851,9.93 0.827,10 0.827,10.1 0.767,10.3 0.708,10.5 0.588,10.9 0.564,11.1 0.564,11.2 0.564,11.5 0.612,11.6 0.875,11.8 1.15,12.2 1.18,12.3 1.15,12.6 1.1,13.2 1.18,13.6 1.39,13.7 1.49,13.7 1.6,13.9 1.75,14 1.93,14 2.05,14.1 2.28,14.4 2.48,14.5 2.55,14.5 2.64,14.5 2.73,14.7 2.73,14.7 2.87,14.7 3.04,14.7 3.04,14.7 3.47,14.5 4.03,14 4.19,13.9 4.44,13.9 4.55,13.7 4.6,13.7 4.68,13.7 4.88,13.6 5.11,13 5.35,11.9 5.39,11.8 5.43,11.6 5.47,11.5 5.65,10.9 5.89,10.4 6.12,10 6.24,9.83 6.48,9.59 6.49,9.59 6.49,9.59 6.49,9.75 6.48,10.1 6.44,10.3 6.43,10.5 6.28,11.1 6.12,11.5 6.08,11.7 6.05,12 6.03,12.4 6.11,12.6 6.21,12.9 6.32,13 6.43,13 6.57,13 6.71,12.9 6.81,12.6 6.91,12.4 7.07,12 7.11,11.7 7.11,11 7.11,10.7 7.13,10.4 7.27,10 7.35,9.75 7.32,9.75 7.37,9.83 7.52,10.1 7.64,10.7 7.69,11.3 7.72,11.6 7.72,12.2 7.69,12.4 7.64,13 7.61,13.6 7.68,14 7.72,14.4 7.76,14.5 8.01,14.5 8.15,14.7 8.31,14.8 8.67,15.5 8.92,15.9 9.03,15.9 9.11,16 9.17,16 9.17,16 9.33,16 9.52,16 9.52,16 9.77,15.9 10.1,15.7 10.1,15.7 10.4,15.7 10.7,15.7 10.7,15.7 10.7,15.7 11,15.6 11.1,15.5 11.4,14.9 11.4,14.9 11.4,14.8 11.5,14.7 11.5,14.5 11.6,14.4 11.7,14.1 12.2,13.9 12.2,13.9 12.2,13.7 12.4,13.6 12.4,13.6 12.4,13 12.4,12.6 12.5,12.4 12.5,12.3 12.5,12.3 12.5,12.2 12.7,12 12.8,11.7 12.8,11.6 12.8,11.5 12.8,11.2 12.8,11.1 12.8,11.1 12.7,10.7 12.4,10.3 12,9.93 11.9,9.83 11.9,9.83 11.9,9.83 12.2,9.93 12.7,9.93 12.9,9.93 13.7,9.75 14,9.08 14.1,7.84 14.1,7.76 14.3,7.59 14.3,7.49 14.3,7.27 14.3,7.19 14.5,7.01 14.5,6.83 14.8,6.6 15.1,6.19 15.7,5.24 15.9,4.85 16,4.41 16,4.31 16,4.25 16,4.03 16,3.84 16,3.76 16,3.69 15.7,3.03 15.2,2.68 14.3,2.75 13.7,2.76 13,2.97 12.2,3.32 12,3.4 11.6,3.63 11.4,3.81 10.2,4.49 9.11,5.55 8.08,6.85 7.95,7 7.85,7.11 7.85,7.11 7.85,7.11 7.84,7.05 7.84,7.04 7.76,6.93 7.72,6.87 7.61,6.81 L 7.53,6.73 7.64,6.47 C 7.92,5.92 8.13,5.51 8.31,5.23 8.35,5.12 8.51,4.91 8.76,4.63 9.43,3.73 9.68,3.47 9.77,3.35 10,3.21 10,3.2 10,3.15 10.1,3.05 10,2.92 10,2.87 9.95,2.87 9.95,2.91 9.84,2.97 9.84,3.11 9.52,3.44 9.11,4.03 8.92,4.19 8.76,4.37 8.76,4.45 8.35,4.95 7.95,5.69 7.61,6.47 7.53,6.6 7.49,6.73 7.47,6.73 7.47,6.73 7.43,6.71 7.37,6.71 L 7.28,6.68 V 6.59 C 7.2,5.69 7.08,5.08 6.91,4.49 6.83,4.16 6.8,4 6.59,3.44 6.33,2.75 6.2,2.32 6.2,2.21 6.17,2.09 6.05,2.08 6,2.2 5.97,2.31 5.99,2.39 6.11,2.55 6.21,2.75 6.32,2.97 6.73,4.15 7,4.96 7.07,5.13 7.2,6.29 7.23,6.68 7.23,6.68 7.2,6.68 7.13,6.68 6.97,6.75 6.89,6.83 6.83,6.87 6.81,6.89 6.81,6.89 6.81,6.89 6.75,6.73 6.68,6.56 6.53,6.07 6.4,5.77 6.2,5.27 5.36,3.43 4.39,2.01 3.36,1.13 2.64,0.571 2.01,0.14 1.49,0 1.32,0 1.02,0 0.887,0 Z' style='fill:rgb(0, 140, 255);stroke:black;stroke-width:0.6;stroke-linejoin:round;stroke-linecap:round;'/></g></svg>",
"about:config": "chrome://global/skin/icons/settings.svg",
"about:user-chrome-files": "chrome://global/skin/icons/settings.svg",
};
class LinkWinActorChild extends JSWindowActorChild {
actorCreated() {
var docURI = this.document.documentURIObject, host;
if (!/^(?:about|chrome|resource)$/.test(docURI.scheme))
try {
host = docURI.displayHost;
} catch (e) {
host = docURI.specIgnoringRef;
}
else
host = docURI.specIgnoringRef;
var icon = ICONS[host];
if (!icon) {
this.handleEvent = e => {};
return;
}
this._icon = icon;
this.onHeadParsed(this.document.head);
}
onHeadParsed(target) {
for (let link of target.querySelectorAll(LINK_SELECTOR))
link.remove();
var link = this.document.createElement("link");
link.setAttribute("rel", "icon");
link.setAttribute("sizes", "any");
link.setAttribute("href", this._icon);
target.append(link);
}
onLinkEvent(link) {
if (!link.matches(LINK_SELECTOR) || link.href == this._icon) return;
link.href = this._icon;
link.setAttribute("rel", "icon");
link.setAttribute("sizes", "any");
if (link.hasAttribute("type"))
link.removeAttribute("type");
}
handleEvent(e) {
switch (e.type) {
case "DOMLinkAdded":
case "DOMLinkChanged":
this.onLinkEvent(e.target);
break;
case "pageshow":
this.onHeadParsed(e.target.head);
break;
}
}
}Я использую этот скрипт для отображения фавикона в строке адреса
Этот скрипт ужасен, что вы в нем нашли?
Отредактировано Vitaliy V. (30-07-2021 14:32:29)
Отсутствует
Ладно попробую но только потому что в Greasemonkey не сработают некоторые события.
Размеры например sizes="32x32" не учитываются, для всех одна иконка
Виталий, ну Вы Мастер!!! Я думал там попроще будет, как с иконкой поисковика примерно.
Огромное Вам Спасибо! Все с ходу заработало! Прописал остальные адреса, всё отлично!
Правда была проблема когда адреса добавлял, запятые забыл проставить и никак иконки не появлялись, но взял себя в руки и решил эту задачу.
Этот скрипт ужасен, что вы в нем нашли?
Да, я вижу его недостатки, скорее всего поверхностно, но плюс в том, что он мне подходит тем, что на месте скрытой стилем лупы в строке адреса, он ставит значок
на странице about:newtab, также расположение фавикона мне привычней (ну этим можно и пожертвовать), с тех пор как пользуюсь этим скриптом, с 60 какой-то версии. И плюс ещё, что фавикон в строке адреса при навигации в пределах страницы, обновлении страницы - всегда отображается и не исчезает. Если бы в Вашем скрипте фавикон не менялся на identity-icon пока находишься на странице - обновляешь, по ссылкам ходишь, я бы его использовал конечно, но постоянное обновление фавикона, ну мне не подходит. Я вижу недостатки в используемом мной скрипте, насколько фавикон жёстко привязан к высоте адресной строки, чуть размер строки другой, растягивается или сжимается, подбирать вручную нужно правкой скрипта. Но я настроил под свой режим и пойдёт пока.
Отредактировано sandro79 (19-07-2021 21:46:53)
Отсутствует
Vitaliy V.
Разреши попросить прояснить насчёт
событий "DOMHeadElementParsed" и "pageshow".
Если я правильно понимаю, то лисий LinkHandlerChild
слушает их на предмет того, что если соответствующий <link>
не нарисовался, то запросить дефолтный http://сайт/favicon.ico,
и для предотвращения сохранения фавиконок,
изменённых js-манипуляциями скриптами сайта.
А LinkWinActorChild зачем их слушает?
Отредактировано Dumby (20-07-2021 00:45:57)
Отсутствует
91.0Dumby
DOMLinkAdded срабатывает не всегда при использовании matches: [ // адреса где работает скрипт ...
Это видно с яндексом если перейти со страницы поиска на главную нажав логотип Яндекс в слева от поиска
А DOMHeadElementParsed да возможно лишний, вариант скрипта не окончательный, есть ещё проблемка с ним
Отредактировано Vitaliy V. (20-07-2021 12:49:24)
Отсутствует
91.0Если бы в Вашем скрипте фавикон не менялся на identity-icon пока находишься на странице - обновляешь, по ссылкам ходишь, я бы его использовал конечно, но постоянное обновление фавикона, ну мне не подходит
Это не постоянное обновление, если говорить об этом то ваш скрипт обновляет её намного чаще, когда это и не нужно.
Это скрытие иконки сделано чтобы при переходе например на другой сайт она не отображалась некоторое время с адресом от другого сайта ,
и вообще то это можно изменить удалив например css селектор , #identity-faviconinurlbar[favbusy="true"]
что на месте скрытой стилем лупы в строке адреса, он ставит значок
на странице about:newtab
что требуется удалить для этого
#identity-faviconinurlbar[faviconchrome="true"],
,.localResource
, #urlbar:not(.searchButton) #identity-box[pageproxystate="invalid"] #identity-faviconinurlbar
или добавить в конце css кода
#urlbar:not(.searchButton) #identity-box[pageproxystate="invalid"].localResource #identity-faviconinurlbar[faviconchrome="true"] {
display: -moz-inline-box !important;
}Отредактировано Vitaliy V. (20-07-2021 14:20:47)
Отсутствует
DOMLinkAdded срабатывает не всегда при использовании matches
О как! Принято, тогда действительно стоит прогонять ещё раз, на всякий случай.
Я-то вообще был бы склонен к переопределению LinkHandlerParent.prototype.setIconFromLink
Отсутствует
но плюс в том, что он мне подходит тем, что на месте скрытой стилем лупы в строке адреса, он ставит значок
на странице about:newtab,
Можно не скрывая подставить другую иконку, например так:
#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] #identity-icon {
list-style-image: url("chrome://branding/content/about-logo.svg") !important;
}Win7
Отсутствует
и вообще то это можно изменить удалив например css селектор , #identity-faviconinurlbar[favbusy="true"]
Да, это сработало.
что требуется удалить для этого
#identity-faviconinurlbar[faviconchrome="true"],
А это не сработало. Добавление в конце css кода тоже нет. Да я может не совсем правильно поставил задачу, не знаю даже. Скрины выложу. Вот на about:newtab у него как и на служебных страницах тоже добавляются значки, может можно так сделать, а так теперь фавикон не мелькает
(this.faviconinurlbar = {
init(that) {
var identity = document.querySelector("#identity-icon");
if (!identity)
return;
var iconDefault = "chrome://branding/content/identity-icons-brand.svg"; // или свою иконку
var style = "data:text/css;charset=utf-8," + encodeURIComponent(`
#identity-faviconinurlbar {
--v-faviconinurlbar-default: url("${iconDefault}");
list-style-image: var(--v-faviconinurlbar, none) !important;
pointer-events: none !important;
height: 16px !important;
width: auto !important;
margin-inline-start: 4px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
fill-opacity: var(--urlbar-icon-fill-opacity, 1);
}
#identity-faviconinurlbar:not([faviconinurlbar="true"]) {
--v-faviconinurlbar: var(--v-faviconinurlbar-default) !important;
}
#urlbar[actiontype="extension"] #identity-faviconinurlbar,
#identity-box:is(.extensionPage,.chromeUI,.localResource) #identity-faviconinurlbar {
display: none !important;
}
`);
windowUtils.loadSheetUsingURIString(style, windowUtils.USER_SHEET);
var faviconinurlbar = document.createXULElement("image");
faviconinurlbar.id = "identity-faviconinurlbar";
identity.after(faviconinurlbar);
gBrowser.tabContainer.addEventListener("TabAttrModified", this);
gBrowser.addProgressListener(this);
that.unloadlisteners.push("faviconinurlbar");
var {STATE_START, STATE_STOP, STATE_IS_NETWORK} = Ci.nsIWebProgressListener;
var updatefavicon = image => {
if (image) {
faviconinurlbar.style.setProperty("--v-faviconinurlbar", `url("${image}")`);
faviconinurlbar.setAttribute("faviconinurlbar", "true");
faviconinurlbar.setAttribute("faviconchrome", `${image.startsWith("chrome:")}`);
} else {
faviconinurlbar.setAttribute("faviconinurlbar", "false");
faviconinurlbar.style.setProperty("--v-faviconinurlbar", "");
}
};
this.handleEvent = e => {
var tab = e.target, changed;
if (!tab.selected || !((changed = e.detail.changed).includes("image") || changed.includes("selected"))) return;
updatefavicon(tab.image);
};
this.onStateChange = (aWebProgress, aRequest, aStateFlags, aStatus) => {
if (aStateFlags & STATE_IS_NETWORK && aWebProgress?.isTopLevel) {
if (aStateFlags & STATE_START)
faviconinurlbar.setAttribute("favbusy", "true");
else if (aStateFlags & STATE_STOP) {
faviconinurlbar.setAttribute("favbusy", "false");
updatefavicon(gBrowser.selectedTab.image);
}
}
};
},
destructor() {
gBrowser.tabContainer.removeEventListener("TabAttrModified", this);
gBrowser.removeProgressListener(this);
}
}).init(this);Можно не скрывая подставить другую иконку, например так:
Да, спасибо. Я знаю как подобные иконки менять
Но как вариант да, сойдет.
Отсутствует
91.0может где ошибся
я ещё писал про ,.localResource
но как я понял вообще скрывать нигде не нужно тогда удалите целиком правило относящееся к display: none !important;
Отсутствует
я ещё писал про ,.localResource
Вот же ж, всё-таки недоглядел я, запутался.
но как я понял вообще скрывать нигде не нужно тогда удалите целиком правило относящееся к display: none !important;
Да, я неправильно сформулировал задачу, не упомянув о служебных страницах, извиняюсь.
Да, и это теперь сработало на служебных страницах. Но чтоб сработало на about:newtab, нужно удалить из кода правило, скрывающее лупу
#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] > #identity-icon-box {
display: none !important;
}
тоже пропадает. Если использовать этот код появляется два лого
.но может кому нибудь ещё пригодится
Конечно, любой рабочий код будет полезен.
Отсутствует
91.0А если скрыть лупу, то лого
тоже пропадает ... Ну я понял, тут дело в том как, к чему привязан что ли вафикон в разных скриптах
Нет дело не в этом, просто нужно скрывать #identity-icon а не контейнер
#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] #identity-icon {
display: none !important;
}Отредактировано Vitaliy V. (20-07-2021 16:30:30)
Отсутствует
Нет дело не в этом, просто нужно скрывать #identity-icon а не контейнер
Огромное Вам спасибо! Теперь всё отлично!
, на ней привыкать буду некоторое время к расположению фавикона сайта. У Ариса он перед замком, у Вас после него. (this.faviconinurlbar = {
init(that) {
var identity = document.querySelector("#identity-icon");
if (!identity)
return;
var iconDefault = "chrome://global/skin/icons/info.svg"; // или свою иконку
var style = "data:text/css;charset=utf-8," + encodeURIComponent(`
#identity-faviconinurlbar {
--v-faviconinurlbar-default: url("${iconDefault}");
list-style-image: var(--v-faviconinurlbar, none) !important;
pointer-events: none !important;
height: 16px !important;
width: auto !important;
margin-inline-start: 4px !important;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
fill-opacity: var(--urlbar-icon-fill-opacity, 1);
}
#identity-faviconinurlbar:not([faviconinurlbar="true"]) {
--v-faviconinurlbar: var(--v-faviconinurlbar-default) !important;
}
`);
windowUtils.loadSheetUsingURIString(style, windowUtils.USER_SHEET);
var faviconinurlbar = document.createXULElement("image");
faviconinurlbar.id = "identity-faviconinurlbar";
identity.after(faviconinurlbar);
gBrowser.tabContainer.addEventListener("TabAttrModified", this);
gBrowser.addProgressListener(this);
that.unloadlisteners.push("faviconinurlbar");
var {STATE_START, STATE_STOP, STATE_IS_NETWORK} = Ci.nsIWebProgressListener;
var updatefavicon = image => {
if (image) {
faviconinurlbar.style.setProperty("--v-faviconinurlbar", `url("${image}")`);
faviconinurlbar.setAttribute("faviconinurlbar", "true");
faviconinurlbar.setAttribute("faviconchrome", `${image.startsWith("chrome:")}`);
} else {
faviconinurlbar.setAttribute("faviconinurlbar", "false");
faviconinurlbar.style.setProperty("--v-faviconinurlbar", "");
}
};
this.handleEvent = e => {
var tab = e.target, changed;
if (!tab.selected || !((changed = e.detail.changed).includes("image") || changed.includes("selected"))) return;
updatefavicon(tab.image);
};
this.onStateChange = (aWebProgress, aRequest, aStateFlags, aStatus) => {
if (aStateFlags & STATE_IS_NETWORK && aWebProgress?.isTopLevel) {
if (aStateFlags & STATE_START)
faviconinurlbar.setAttribute("favbusy", "true");
else if (aStateFlags & STATE_STOP) {
faviconinurlbar.setAttribute("favbusy", "false");
updatefavicon(gBrowser.selectedTab.image);
}
}
};
},
destructor() {
gBrowser.tabContainer.removeEventListener("TabAttrModified", this);
gBrowser.removeProgressListener(this);
}
}).init(this);#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] #identity-icon {
display: none !important;
}Отредактировано sandro79 (20-07-2021 21:56:01)
Отсутствует
91.0У Ариса он перед замком, у Вас после него
Не думаете же вы что это сложно изменить, вот даже стилем можно
заменить
margin-inline-start: 4px !important;
на
-moz-box-ordinal-group: 0 !important;
margin-inline: 0 4px !important;
ну или вместо -moz-box-ordinal-group: 0 !important;
//identity.after(faviconinurlbar);
identity.before(faviconinurlbar);
Отредактировано Vitaliy V. (20-07-2021 17:19:06)
Отсутствует