Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: chrome/browser/resources/downloads.html

Issue 55002: Add date information to the downloads page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/downloads_ui.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/downloads.html
===================================================================
--- chrome/browser/resources/downloads.html (revision 12636)
+++ chrome/browser/resources/downloads.html (working copy)
@@ -43,16 +43,28 @@
}
.download {
position:relative;
+ margin-top:5px;
+ margin-left:96px;
padding-left:56px;
margin-bottom:16px;
}
html[dir='rtl'] .download {
padding-left:0px;
- padding-right:56px;
}
+.date-container {
+ position:absolute;
+ left:-92px;
+ width:92px;
+}
+.date-container .since {
+ color:black;
+}
+.date-container .date {
+ color:#666;
+}
.download .icon {
position:absolute;
- top:7px;
+ top:0px;
left:9px;
width:32px;
height:32px;
@@ -63,7 +75,7 @@
}
.progress {
position:absolute;
- top:2px;
+ top:-5px;
left:0px;
width:48px;
height:48px;
@@ -250,6 +262,7 @@
} else {
this.node_.appendChild(this.downloads_[id].node);
}
+ this.updateDateDisplay_();
}
}
@@ -284,12 +297,31 @@
}
/**
+ * Update the date visibility in our nodes so that no date is
+ * repeated.
+ */
+Downloads.prototype.updateDateDisplay_ = function() {
+ var dateContainers = document.getElementsByClassName('date-container');
+ var displayed = {};
+ for (var i = 0, container; container = dateContainers[i]; i++) {
+ var dateString = container.getElementsByClassName('date')[0].innerHTML;
+ if (!!displayed[dateString]) {
+ container.style.display = 'none';
+ } else {
+ displayed[dateString] = true;
+ container.style.display = 'block';
+ }
+ }
+}
+
+/**
* Remove a download.
* @param {Number} id The id of the download to remove.
*/
Downloads.prototype.remove = function(id) {
this.node_.removeChild(this.downloads_[id].node);
delete this.downloads_[id];
+ this.updateDateDisplay_();
}
/**
@@ -311,9 +343,18 @@
function Download(download) {
// Create DOM
this.node = createElementWithClassName('div', 'download');
+
+ // Dates
+ this.dateContainer_ = createElementWithClassName('div', 'date-container');
+ this.node.appendChild(this.dateContainer_);
+
+ this.nodeSince_ = createElementWithClassName('div', 'since');
+ this.nodeDate_ = createElementWithClassName('div', 'date');
+ this.dateContainer_.appendChild(this.nodeSince_);
+ this.dateContainer_.appendChild(this.nodeDate_);
// Container for all 'safe download' UI.
- this.safe_ = document.createElement("div");
+ this.safe_ = createElementWithClassName('div', 'safe');
this.safe_.ondragstart = bind(this.drag_, this);
this.node.appendChild(this.safe_);
@@ -431,6 +472,9 @@
this.fileName_ = download.file_name;
this.url_ = download.url;
this.state_ = download.state;
+
+ this.since_ = download.since_string;
+ this.date_ = download.date_string;
// See DownloadItem::PercentComplete
this.percent_ = Math.max(download.percent, 0);
@@ -491,6 +535,8 @@
showInline(this.controlCancel_, this.state_ == Download.States.IN_PROGRESS ||
this.state_ == Download.States.PAUSED);
+ this.nodeSince_.innerHTML = this.since_;
+ this.nodeDate_.innerHTML = this.date_;
this.nodeURL_.innerHTML = this.url_;
this.nodeStatus_.innerHTML = this.getStatusText_();
« no previous file with comments | « chrome/browser/dom_ui/downloads_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698