aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js7
-rw-r--r--apps/files/js/mainfileinfodetailview.js33
-rw-r--r--apps/files/js/newfilemenu.js3
3 files changed, 36 insertions, 7 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b4cc71e2d3b..9c4e43b3b8b 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -628,6 +628,9 @@
* Event handler when clicking on a table header
*/
_onClickHeader: function(e) {
+ if (this.$table.hasClass('multiselect')) {
+ return;
+ }
var $target = $(e.target);
var sort;
if (!$target.is('a')) {
@@ -1408,10 +1411,10 @@
generatePreviewUrl: function(urlSpec) {
urlSpec = urlSpec || {};
if (!urlSpec.x) {
- urlSpec.x = this.$table.data('preview-x') || 36;
+ urlSpec.x = this.$table.data('preview-x') || 32;
}
if (!urlSpec.y) {
- urlSpec.y = this.$table.data('preview-y') || 36;
+ urlSpec.y = this.$table.data('preview-y') || 32;
}
urlSpec.x *= window.devicePixelRatio;
urlSpec.y *= window.devicePixelRatio;
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js
index 82cca0d0fb3..b50e92dea8c 100644
--- a/apps/files/js/mainfileinfodetailview.js
+++ b/apps/files/js/mainfileinfodetailview.js
@@ -10,7 +10,7 @@
(function() {
var TEMPLATE =
- '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"></a></div>' +
+ '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"><div class="stretcher"/></a></div>' +
'<div class="file-details-container">' +
'<div class="fileName"><h3 title="{{name}}" class="ellipsis">{{name}}</h3></div>' +
' <div class="file-details ellipsis">' +
@@ -131,6 +131,7 @@
} else {
// TODO: special icons / shared / external
$iconDiv.css('background-image', 'url("' + OC.MimeType.getIconUrl('dir') + '")');
+ OC.Util.scaleFixForIE8($iconDiv);
}
this.$el.find('[title]').tooltip({placement: 'bottom'});
} else {
@@ -140,13 +141,18 @@
},
loadPreview: function(path, mime, etag, $iconDiv, $container, isImage) {
- var maxImageHeight = ($container.parent().width() + 50) / (16/9); // 30px for negative margin
+ var maxImageWidth = $container.parent().width() + 50; // 50px for negative margins
+ var maxImageHeight = maxImageWidth / (16/9);
var smallPreviewSize = 75;
var isLandscape = function(img) {
return img.width > (img.height * 1.2);
};
+ var isSmall = function(img) {
+ return (img.width * 1.1) < (maxImageWidth * window.devicePixelRatio);
+ };
+
var getTargetHeight = function(img) {
if(isImage) {
var targetHeight = img.height / window.devicePixelRatio;
@@ -159,13 +165,23 @@
}
};
+ var getTargetRatio = function(img){
+ var ratio = img.width / img.height;
+ if (ratio > 16/9) {
+ return ratio;
+ } else {
+ return 16/9;
+ }
+ };
+
this._fileList.lazyLoadPreview({
path: path,
mime: mime,
etag: etag,
y: isImage ? maxImageHeight : smallPreviewSize,
- x: isImage ? 99999 /* only limit on y */ : smallPreviewSize,
+ x: isImage ? maxImageWidth : smallPreviewSize,
a: isImage ? 1 : null,
+ mode: isImage ? 'cover' : null,
callback: function (previewUrl, img) {
$iconDiv.previewImg = previewUrl;
@@ -176,7 +192,7 @@
$iconDiv.removeClass('icon-loading icon-32');
var targetHeight = getTargetHeight(img);
if (this.model.isImage() && targetHeight > smallPreviewSize) {
- $container.addClass(isLandscape(img)? 'landscape': 'portrait');
+ $container.addClass((isLandscape(img) && !isSmall(img))? 'landscape': 'portrait');
$container.addClass('image');
}
@@ -184,7 +200,13 @@
// when we dont have a preview we show the mime icon in the error handler
$iconDiv.css({
'background-image': 'url("' + previewUrl + '")',
- height: (isLandscape(img) && targetHeight > smallPreviewSize)? 'auto': targetHeight
+ height: (targetHeight > smallPreviewSize)? 'auto': targetHeight,
+ 'max-height': isSmall(img)? targetHeight: null
+ });
+
+ var targetRatio = getTargetRatio(img);
+ $iconDiv.find('.stretcher').css({
+ 'padding-bottom': (100 / targetRatio) + '%'
});
}.bind(this),
error: function () {
@@ -193,6 +215,7 @@
$iconDiv.css({
'background-image': 'url("' + $iconDiv.previewImg + '")'
});
+ OC.Util.scaleFixForIE8($iconDiv);
}.bind(this)
});
}
diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js
index 4c021e6b873..0a67aba202b 100644
--- a/apps/files/js/newfilemenu.js
+++ b/apps/files/js/newfilemenu.js
@@ -84,6 +84,8 @@
OC.hideMenus();
} else {
event.preventDefault();
+ this.$el.find('.menuitem.active').removeClass('active');
+ $target.addClass('active');
this._promptFileName($target);
}
},
@@ -210,6 +212,7 @@
fileType: 'folder'
}]
}));
+ OC.Util.scaleFixForIE8(this.$('.svg'));
},
/**