pipe.send({
'path': path,
'momentStr': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp)),
+ 'momentStrShort': utils.pretty_date_time(datetime.datetime.fromtimestamp(timestamp), short=True),
'sizeStr': utils.pretty_size(size),
'timestamp': timestamp
})
import settings
-def pretty_date_time(date_time, tzinfo=None):
+def pretty_date_time(date_time, tzinfo=None, short=False):
if date_time is None:
return '('+ _('never') + ')'
if isinstance(date_time, int):
return pretty_date_time(datetime.datetime.fromtimestamp(date_time))
- text = u'{day} {month} {year}, {hm}'.format(
- day=date_time.day,
- month=date_time.strftime('%B'),
- year=date_time.year,
- hm=date_time.strftime('%H:%M')
- )
+ if short:
+ text = u'{day} {month}, {hm}'.format(
+ day=date_time.day,
+ month=date_time.strftime('%b'),
+ hm=date_time.strftime('%H:%M')
+ )
+
+ else:
+ text = u'{day} {month} {year}, {hm}'.format(
+ day=date_time.day,
+ month=date_time.strftime('%B'),
+ year=date_time.year,
+ hm=date_time.strftime('%H:%M')
+ )
if tzinfo:
offset = tzinfo.utcoffset(datetime.datetime.utcnow()).seconds
}
div.media-dialog-groups {
+ float: left;
+ width: 10em;
text-align: center;
overflow: auto;
white-space: nowrap;
}
+div.media-dialog-groups.small-screen {
+ float: none;
+}
+
div.media-dialog-group-button {
- display: inline-block;
height: 1.5em;
line-height: 1.5em;
text-align: center;
- margin: 0em 0.2em 0.3em 0.2em;
+ margin: 0em 0.2em 0.2em 0.2em;
padding: 0px 0.5em;
background-color: #414141;
color: #3498db;
border-radius: 3px;
transition: all 0.1s linear;
cursor: pointer;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+div.media-dialog-groups.small-screen div.media-dialog-group-button {
+ display: inline-block;
}
div.media-dialog-group-button:HOVER {
}
div.media-list-entry-name {
+ font-weight: bold;
font-size: 1.3em;
padding: 0.4em 0em;
text-align: center;
text-overflow: ellipsis;
}
+div.media-list-entry-details span.details-moment-short {
+ display: none;
+}
+
div.media-list-download-button {
float: right;
height: 1.5em;
div.hostname {
display: none;
}
+
+ div.media-list-entry-name {
+ font-size: 1em;
+ padding: 0.2em 0em 0em 0em;
+ }
+
+ div.media-list-entry-details {
+ padding-top: 0.2em;
+ font-size: 1em;
+ text-align: center;
+ white-space: normal;
+ }
+
+ div.media-list-entry-details span.details-moment {
+ display: none;
+ }
+
+ div.media-list-entry-details span.details-moment-short {
+ display: block;
+ }
}
@media all and (max-width: 400px) {
dialogDiv.append(groupsDiv);
dialogDiv.append(mediaListDiv);
- var windowWidth = $(window).width();
- var windowHeight = $(window).height();
- var widthCoef = windowWidth < 1000 ? 0.8 : 0.5;
- var heightCoef = 0.75;
+ function setDialogSize() {
+ var windowWidth = $(window).width();
+ var windowHeight = $(window).height();
+
+ if (windowWidth < 1000) {
+ groupsDiv.width(parseInt(windowWidth * 0.8));
+ groupsDiv.height('');
+ groupsDiv.addClass('small-screen');
+ mediaListDiv.width(parseInt(windowWidth * 0.8));
+ mediaListDiv.height(parseInt(windowHeight * 0.7));
+ }
+ else {
+ mediaListDiv.width(parseInt(windowWidth * 0.7));
+ mediaListDiv.height(parseInt(windowHeight * 0.7));
+ groupsDiv.height(parseInt(windowHeight * 0.7));
+ groupsDiv.width('');
+ groupsDiv.removeClass('small-screen');
+ }
+ }
+
+ function onResize() {
+ setDialogSize();
+ updateModalDialogPosition();
+ }
- mediaListDiv.width(parseInt(windowWidth * widthCoef));
- groupsDiv.width(parseInt(windowWidth * widthCoef));
- mediaListDiv.height(parseInt(windowHeight * heightCoef));
+ $(window).resize(onResize);
+
+ setDialogSize();
showModalDialog('<div class="modal-progress"></div>');
detailsDiv = entry.div.find('div.media-list-entry-details');
}
- detailsDiv.html(entry.momentStr + ' | ' + entry.sizeStr);
+ var momentSpan = $('<span class="details-moment">' + entry.momentStr + ', </span>');
+ var momentShortSpan = $('<span class="details-moment-short">' + entry.momentStrShort + '</span>');
+ var sizeSpan = $('<span class="details-size">' + entry.sizeStr + '</span>');
+ detailsDiv.append(momentSpan);
+ detailsDiv.append(momentShortSpan);
+ detailsDiv.append(sizeSpan);
mediaListDiv.append(entryDiv);
});
var media = mediaListByName[entry.name];
if (media) {
entry.momentStr = media.momentStr;
+ entry.momentStrShort = media.momentStrShort;
entry.sizeStr = media.sizeStr;
entry.timestamp = media.timestamp;
}
if (keys.length) {
showGroup(keys[0]);
}
+ },
+ onClose: function () {
+ $(window).unbind('resize', onResize);
}
});
});
var windowWidth = $(window).width();
var windowHeight = $(window).height();
- var modalWidth = container.width() + 10 /* the margins */;
- var modalHeight = container.height() + 10 /* the margins */;
+ var modalWidth, modalHeight, i;
- container.css('left', Math.floor((windowWidth - modalWidth) / 2));
- container.css('top', Math.floor((windowHeight - modalHeight) / 2));
+ /* repeat the operation multiple times, the size might change */
+ for (i = 0; i < 3; i++) {
+ modalWidth = container.outerWidth() + 10 /* the margins */;
+ modalHeight = container.outerHeight() + 10 /* the margins */;
+
+ container.css('left', Math.floor((windowWidth - modalWidth) / 2));
+ container.css('top', Math.floor((windowHeight - modalHeight) / 2));
+ }
}
function makeModalDialogButtons(buttonsInfo) {