[IMP] website,*: removes compatibility layer for (really) old browsers
*:web_editor,portal This commit aims at removing the need to rely on `$.browser`, which was mainly the case to support deprecated and unsupported browsers like MS Internet Explorer or old version of Firefox. Doing so, this commit removes the `data-browser` attribute initialy introduced by odoo/odoo@a7e0b73930 as not needed anymore nowadays and to generally promote "feature detection" instead of "user-agent sniffing" to handle browsers' feature support and edge cases. task-3439226 Part-of: odoo/odoo#133916
This commit is contained in:
@@ -50,12 +50,6 @@ var PortalSidebar = publicWidget.Widget.extend({
|
||||
* @param {string} href
|
||||
*/
|
||||
_printIframeContent: function (href) {
|
||||
// due to this issue : https://bugzilla.mozilla.org/show_bug.cgi?id=911444
|
||||
// open a new window with pdf for print in Firefox (in other system: http://printjs.crabbly.com)
|
||||
if ($.browser.mozilla) {
|
||||
window.open(href, '_blank');
|
||||
return;
|
||||
}
|
||||
if (!this.printContent) {
|
||||
this.printContent = $('<iframe id="print_iframe_content" src="' + href + '" style="display:none"></iframe>');
|
||||
this.$el.append(this.printContent);
|
||||
|
||||
@@ -280,10 +280,6 @@ div.media_iframe_video {
|
||||
}
|
||||
}
|
||||
|
||||
html[data-browser^="msie"] div.media_iframe_video iframe {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
// Fields
|
||||
address {
|
||||
.fa.fa-mobile-phone {
|
||||
|
||||
@@ -5,19 +5,6 @@
|
||||
* content too.
|
||||
*/
|
||||
|
||||
// Check the browser and its version and add the info as an attribute of the
|
||||
// HTML element so that css selectors can match it
|
||||
var browser = Object.entries($.browser).map(([key, val]) => val === true && key)[0]
|
||||
if ($.browser.mozilla && +$.browser.version.replace(/^([0-9]+\.[0-9]+).*/, '\$1') < 20) {
|
||||
browser = 'msie';
|
||||
}
|
||||
browser += (',' + $.browser.version);
|
||||
var mobileRegex = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i;
|
||||
if (mobileRegex.test(window.navigator.userAgent.toLowerCase())) {
|
||||
browser += ',mobile';
|
||||
}
|
||||
document.documentElement.setAttribute('data-browser', browser);
|
||||
|
||||
// Check if flex is supported and add the info as an attribute of the HTML
|
||||
// element so that css selectors can match it (only if not supported)
|
||||
var htmlStyle = document.documentElement.style;
|
||||
@@ -29,6 +16,5 @@ if (!isFlexSupported) {
|
||||
}
|
||||
|
||||
export default {
|
||||
browser: browser,
|
||||
isFlexSupported: isFlexSupported,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user