Bug 401215 - "Background banding for the download manager" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=sdwilsh aM9=beltzner]

This commit is contained in:
reed@reedloden.com 2007-10-29 11:31:27 -07:00
parent 4894cad90d
commit 69595574d6
3 changed files with 32 additions and 2 deletions

View File

@ -161,9 +161,10 @@ function downloadCompleted(aDownload)
// If we are displaying search results, we do not want to add it to the list
// of completed downloads
if (!gSearching)
if (!gSearching) {
gDownloadsView.insertBefore(dl, gDownloadsDoneArea.nextSibling);
else
evenOddCellAttribution();
} else
removeFromView(dl);
// getTypeFromFile fails if it can't find a type for this file.
@ -848,6 +849,7 @@ function removeFromView(aDownload)
let index = gDownloadsView.selectedIndex;
gDownloadsView.removeChild(aDownload);
gDownloadsView.selectedIndex = Math.min(index, gDownloadsView.itemCount - 1);
evenOddCellAttribution();
}
function getReferrerOrSource(aDownload)
@ -878,6 +880,25 @@ function buildDefaultView()
gDownloadsView.selectedItem = children[0];
}
/**
* Gives every second cell an odd attribute so they can receive alternating
* backgrounds from the stylesheets.
*/
function evenOddCellAttribution()
{
let alternateCell = false;
let allDownloadsInView = gDownloadsView.getElementsByTagName("richlistitem");
for (let i = 0; i < allDownloadsInView.length; i++) {
if (alternateCell)
allDownloadsInView[i].setAttribute("alternate", "true");
else
allDownloadsInView[i].removeAttribute("alternate");
alternateCell = !alternateCell;
}
}
/**
* Builds the downloads list with a given statement and reference node.
*
@ -923,6 +944,7 @@ function buildDownloadList(aStmt, aRef)
if (dl)
gDownloadsView.insertBefore(dl, aRef.nextSibling);
}
evenOddCellAttribution();
}
var gActiveDownloadsQuery = null;

View File

@ -10,6 +10,10 @@ richlistitem[type="download"] {
min-height: 46px !important;
}
richlistitem[type="download"][alternate="true"]:not([selected="true"]) {
background-color: #ecf2fe;
}
richlistitem[type="download"] .name {
font-size: larger;
}

View File

@ -16,6 +16,10 @@ richlistitem[type="download"] {
min-height: 46px;
}
richlistitem[type="download"][alternate="true"]:not([selected="true"]) {
background-color: ThreeDLightShadow;
}
richlistitem[type="download"] .name {
font-size: larger;
}