Skip to content

Commit 55bddaf

Browse files
committed
[frontend] IE fixes
1 parent 9b32af0 commit 55bddaf

File tree

6 files changed

+133
-3
lines changed

6 files changed

+133
-3
lines changed

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = function(grunt) {
3333
},
3434
utils: {
3535
src: [
36+
'frontend/express/public/javascripts/utils/polyfills.js',
3637
'frontend/express/public/javascripts/utils/underscore-min.js',
3738
'frontend/express/public/javascripts/utils/prefixfree.min.js',
3839
'frontend/express/public/javascripts/utils/moment/moment-with-locales.min.js',

frontend/express/public/javascripts/countly/countly.template.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ var AppRouter = Backbone.Router.extend({
829829
$("#sidebar-menu #" + app_type + "-type #" + parent_code + "-menu").removeAttr("href");
830830
}
831831

832-
$("#sidebar-menu #" + app_type + "-type #" + parent_code + "-menu").show();
832+
$("#sidebar-menu #" + app_type + "-type #" + parent_code + "-menu").css('display', 'block');
833833

834834
if (typeof node.callback === "function") {
835835
node.callback(app_type, parent_code, node, menu);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
if (!String.prototype.endsWith) {
2+
String.prototype.endsWith = function(search, this_len) {
3+
if (this_len === undefined || this_len > this.length) {
4+
this_len = this.length;
5+
}
6+
return this.substring(this_len - search.length, this_len) === search;
7+
};
8+
}
9+
if (!String.prototype.startsWith) {
10+
Object.defineProperty(String.prototype, 'startsWith', {
11+
value: function(search, pos) {
12+
pos = !pos || pos < 0 ? 0 : +pos;
13+
return this.substring(pos, pos + search.length) === search;
14+
}
15+
});
16+
}
17+
if (!String.prototype.includes) {
18+
String.prototype.includes = function(search, start) {
19+
'use strict';
20+
if (typeof start !== 'number') {
21+
start = 0;
22+
}
23+
24+
if (start + search.length > this.length) {
25+
return false;
26+
} else {
27+
return this.indexOf(search, start) !== -1;
28+
}
29+
};
30+
}
31+
// https://tc39.github.io/ecma262/#sec-array.prototype.find
32+
if (!Array.prototype.find) {
33+
Object.defineProperty(Array.prototype, 'find', {
34+
value: function(predicate) {
35+
// 1. Let O be ? ToObject(this value).
36+
if (this == null) {
37+
throw new TypeError('"this" is null or not defined');
38+
}
39+
40+
var o = Object(this);
41+
42+
// 2. Let len be ? ToLength(? Get(O, "length")).
43+
var len = o.length >>> 0;
44+
45+
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
46+
if (typeof predicate !== 'function') {
47+
throw new TypeError('predicate must be a function');
48+
}
49+
50+
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
51+
var thisArg = arguments[1];
52+
53+
// 5. Let k be 0.
54+
var k = 0;
55+
56+
// 6. Repeat, while k < len
57+
while (k < len) {
58+
// a. Let Pk be ! ToString(k).
59+
// b. Let kValue be ? Get(O, Pk).
60+
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
61+
// d. If testResult is true, return kValue.
62+
var kValue = o[k];
63+
if (predicate.call(thisArg, kValue, k, o)) {
64+
return kValue;
65+
}
66+
// e. Increase k by 1.
67+
k++;
68+
}
69+
70+
// 7. Return undefined.
71+
return undefined;
72+
},
73+
configurable: true,
74+
writable: true
75+
});
76+
}
77+
78+
// From https://github.com/kevlatus/polyfill-array-includes/blob/master/array-includes.js
79+
if (!Array.prototype.includes) {
80+
Object.defineProperty(Array.prototype, 'includes', {
81+
value: function (searchElement, fromIndex) {
82+
83+
// 1. Let O be ? ToObject(this value).
84+
if (this == null) {
85+
throw new TypeError('"this" is null or not defined');
86+
}
87+
88+
var o = Object(this);
89+
90+
// 2. Let len be ? ToLength(? Get(O, "length")).
91+
var len = o.length >>> 0;
92+
93+
// 3. If len is 0, return false.
94+
if (len === 0) {
95+
return false;
96+
}
97+
98+
// 4. Let n be ? ToInteger(fromIndex).
99+
// (If fromIndex is undefined, this step produces the value 0.)
100+
var n = fromIndex | 0;
101+
102+
// 5. If n ≥ 0, then
103+
// a. Let k be n.
104+
// 6. Else n < 0,
105+
// a. Let k be len + n.
106+
// b. If k < 0, let k be 0.
107+
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
108+
109+
function sameValueZero(x, y) {
110+
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
111+
}
112+
113+
// 7. Repeat, while k < len
114+
while (k < len) {
115+
// a. Let elementK be the result of ? Get(O, ! ToString(k)).
116+
// b. If SameValueZero(searchElement, elementK) is true, return true.
117+
// c. Increase k by 1.
118+
if (sameValueZero(o[k], searchElement)) {
119+
return true;
120+
}
121+
k++;
122+
}
123+
124+
// 8. Return false
125+
return false;
126+
}
127+
});
128+
}

frontend/express/public/stylesheets/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ input.custom-styled-green-check:checked {border-color: #C2C2C2;}
17481748
#sidebar,
17491749
#main-views-container #analytics-main-view.active #sidebar.hidden { transform:translate(-230px); opacity:0.8; transition: opacity 0.1s 0.2s, transform 0.55s; }
17501750
#main-views-container #analytics-main-view.active #sidebar { transform:translate(0); opacity:1; transition: opacity 0.1s 0.2s, transform 0.55s; }
1751-
#hide-sidebar-button { position: absolute; left: 16px; top: 22px; cursor: pointer; width: 21px; height: 18px; background-image: url("../images/dashboard/collapse-sprite.svg"); background-repeat: no-repeat;}
1751+
#hide-sidebar-button { position: absolute; left: 16px; top: 21px; cursor: pointer; width: 21px; height: 18px; background-image: url("../images/dashboard/collapse-sprite.svg"); background-repeat: no-repeat;}
17521752
#hide-sidebar-button:hover { background-position: -21px 0px; }
17531753
#hide-sidebar-button.active { background-position: -42px 0px; }
17541754
#hide-sidebar-button.active:hover { background-position: -63px 0px; }

frontend/express/views/dashboard.html

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/dom/jqueryui/jquery-ui-i18n.js"></script>
6060
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/dom/slimScroll.min.js"></script>
6161
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/dom/jquery.easing.1.3.js"></script>
62+
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/utils/polyfills.js"></script>
6263
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/utils/underscore-min.js"></script>
6364
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/utils/prefixfree.min.js"></script>
6465
<script language="javascript" type="text/javascript" src="<%- cdn %>javascripts/utils/moment/moment-with-locales.min.js"></script>

plugins/star-rating/frontend/public/javascripts/countly.views.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ window.starView = countlyView.extend({
388388
if (self.currentTab === 'time-series') {
389389
self.renderTimeSeriesTable(isRefresh);
390390
self.renderTimeSeriesChart();
391-
countlyCommon.applyColors();
391+
CountlyHelpers.applyColors();
392392
$('#tableOne_wrapper').css("display", "none");
393393
$('#tableTwo_wrapper').css("display", "block");
394394
$('#big-numbers-container').css("display", "block");

0 commit comments

Comments
 (0)