diff options
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 2 | ||||
-rw-r--r-- | apps/files/js/newfilemenu.js | 1 | ||||
-rw-r--r-- | core/js/js.js | 40 |
3 files changed, 43 insertions, 0 deletions
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 82cca0d0fb3..bdec9c08509 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -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 { @@ -193,6 +194,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..10ddf706d74 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -210,6 +210,7 @@ fileType: 'folder' }] })); + OC.Util.scaleFixForIE8(this.$('.svg')); }, /** diff --git a/core/js/js.js b/core/js/js.js index 397fea8e3c5..e40141ac617 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1597,6 +1597,46 @@ OC.Util = { }, /** + * Fix image scaling for IE8, since background-size is not supported. + * + * This scales the image to the element's actual size, the URL is + * taken from the "background-image" CSS attribute. + * + * @param {Object} $el image element + */ + scaleFixForIE8: function($el) { + if (!this.isIE8()) { + return; + } + var self = this; + $($el).each(function() { + var url = $(this).css('background-image'); + var r = url.match(/url\(['"]?([^'")]*)['"]?\)/); + if (!r) { + return; + } + url = r[1]; + url = self.replaceSVGIcon(url); + // TODO: escape + url = url.replace(/'/g, '%27'); + $(this).css({ + 'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + url + '\', sizingMethod=\'scale\')', + 'background-image': '' + }); + }); + return $el; + }, + + /** + * Returns whether this is IE8 + * + * @return {bool} true if this is IE8, false otherwise + */ + isIE8: function() { + return $('html').hasClass('ie8'); + }, + + /** * Remove the time component from a given date * * @param {Date} date date |