From a681d91b463dc4c4f82c55020ab4cf59fa4352dd Mon Sep 17 00:00:00 2001 From: Awais Jibran Date: Wed, 28 Mar 2018 14:41:27 +0500 Subject: [PATCH 1/2] fix js issue with video uploads --- cms/static/js/views/baseview.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cms/static/js/views/baseview.js b/cms/static/js/views/baseview.js index 45b5e67492..ec2aecde33 100644 --- a/cms/static/js/views/baseview.js +++ b/cms/static/js/views/baseview.js @@ -32,6 +32,15 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/utils/handle_iframe_b if (this.options) { options = _.extend({}, _.result(this, 'options'), options); } + + // trunc is not available in IE, and it provides polyfill for it. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc + if (!Math.trunc) { + Math.trunc = function(v) { + v = +v; + return (v - v % 1) || (!isFinite(v) || v === 0 ? v : v < 0 ? -0 : 0); + }; + } this.options = options; var _this = this; From 05a1d61f5cc8a9652c2ebd0609654776802c214f Mon Sep 17 00:00:00 2001 From: Awais Jibran Date: Wed, 28 Mar 2018 16:41:34 +0500 Subject: [PATCH 2/2] quality --- cms/static/js/views/baseview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/static/js/views/baseview.js b/cms/static/js/views/baseview.js index ec2aecde33..a09f4a7e68 100644 --- a/cms/static/js/views/baseview.js +++ b/cms/static/js/views/baseview.js @@ -37,8 +37,8 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/utils/handle_iframe_b // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc if (!Math.trunc) { Math.trunc = function(v) { - v = +v; - return (v - v % 1) || (!isFinite(v) || v === 0 ? v : v < 0 ? -0 : 0); + v = +v; // eslint-disable-line no-param-reassign + return (v - v % 1) || (!isFinite(v) || v === 0 ? v : v < 0 ? -0 : 0); }; } this.options = options;