diff options
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 40 |
1 files changed, 40 insertions, 0 deletions
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 |