// Вернуть иконки сайтов в строке адреса ............................................................................................. (function() { // Блокировать повторный запуск функций и обработчиков при открытии настройки панелей .... if (document.getElementById('fav-image')) return; var identityBox = document.getElementById('identity-box'); imgBox = document.createElement('image'); imgBox.setAttribute('id', 'fav-image'); imgBox.setAttribute('class', 'favimage'); identityBox.insertBefore(imgBox, identityBox.firstChild); // стиль для иконки сайта в строке адреса .... document.getElementById('identity-box').setAttribute('style','padding: 3px 2px !important;'); document.getElementById('fav-image').setAttribute('style','height: 16px !important; width: 16px !important; margin: 1px 3px !important;'); document.getElementById('page-proxy-favicon').setAttribute("style", "visibility: collapse;"); // .... function changeFavicon(event) { var tabImg = gBrowser.selectedTab.image; var favicon = document.getElementById('fav-image'); if (tabImg) favicon.setAttribute('style','max-height: 16px !important; height: 16px !important; max-width: 16px !important; list-style-image:url(' + tabImg + '); -moz-image-region:auto'); else favicon.setAttribute('style','max-height: 16px !important; height: 16px !important; max-width: 16px !important; list-style-image:url("chrome://mozapps/skin/places/defaultFavicon.png")!important;'); }; // добавляем обработчики для табов ..... gBrowser.tabContainer.addEventListener("TabSelect", function(event){ changeFavicon(event) }, false); gBrowser.addEventListener("pageshow", function(event) { // стоп, если открыть другие владки в фоновом режиме if (event.target.location.href !== getBrowser().currentURI.spec) return; setTimeout(function() { changeFavicon(event) }, 0); }, true); })(); |