Bug 456216 - Add attributes "first-visible" and "last-visible" to the first and last visible radio buttons of the Add-ons Manager toolbar, r=Mossop

This commit is contained in:
Markus Stange 2008-09-30 12:59:42 +02:00
Родитель cc1434d1c3
Коммит 302600fb40
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -2154,6 +2154,7 @@ function updateOptionalViews() {
document.getElementById("locales-view").hidden = !showLocales; document.getElementById("locales-view").hidden = !showLocales;
document.getElementById("updates-view").hidden = !showUpdates; document.getElementById("updates-view").hidden = !showUpdates;
document.getElementById("installs-view").hidden = !showInstalls; document.getElementById("installs-view").hidden = !showInstalls;
updateVisibilityFlags();
// fall back to the previously selected view or "search" since "installs" became hidden // fall back to the previously selected view or "search" since "installs" became hidden
if (!showInstalls && gView == "installs") { if (!showInstalls && gView == "installs") {
@ -2167,6 +2168,23 @@ function updateOptionalViews() {
} }
} }
function updateVisibilityFlags() {
let children = document.getElementById("installs-view").parentNode._getRadioChildren();
let firstVisible = null, lastVisible = null;
children.forEach(function(child) {
child.removeAttribute("first-visible");
child.removeAttribute("last-visible");
if (!child.hidden) {
firstVisible = firstVisible || child;
lastVisible = child;
}
});
if (firstVisible) {
firstVisible.setAttribute("first-visible", "true");
lastVisible.setAttribute("last-visible", "true");
}
}
function updateGlobalCommands() { function updateGlobalCommands() {
var disableInstallFile = false; var disableInstallFile = false;
var disableUpdateCheck = true; var disableUpdateCheck = true;