Kaynağa Gözat

[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.
tags/v8.2RC1
Vincent Petry 8 yıl önce
ebeveyn
işleme
dbb6692468

+ 2
- 0
apps/files/js/mainfileinfodetailview.js Dosyayı Görüntüle

@@ -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)
});
}

+ 1
- 0
apps/files/js/newfilemenu.js Dosyayı Görüntüle

@@ -210,6 +210,7 @@
fileType: 'folder'
}]
}));
OC.Util.scaleFixForIE8(this.$('.svg'));
},

/**

+ 40
- 0
core/js/js.js Dosyayı Görüntüle

@@ -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…
İptal
Kaydet