[IE8] Fix filetype icon sizes
Added hack that uses a "filter" CSS with explicit URL to fix the "New" menu by scaling down icons and also fix the folder/filetype icon in the sidebar by scaling it up.
This commit is contained in:
parent
00623b1c73
commit
dbb6692468
|
@ -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)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -210,6 +210,7 @@
|
|||
fileType: 'folder'
|
||||
}]
|
||||
}));
|
||||
OC.Util.scaleFixForIE8(this.$('.svg'));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1596,6 +1596,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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue