summaryrefslogtreecommitdiffstats
path: root/web/gui/src/dashboard.js/compatibility.js
blob: e1ecfbdb2c1be98662b3f38022a730571d68d5c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// *** src/dashboard.js/compatibility.js

// Compatibility fixes.

// fix IE issue with console
if (!window.console) {
    window.console = {
        log: function () {
        }
    };
}

// if string.endsWith is not defined, define it
if (typeof String.prototype.endsWith !== 'function') {
    String.prototype.endsWith = function (s) {
        if (s.length > this.length) {
            return false;
        }
        return this.slice(-s.length) === s;
    };
}

// if string.startsWith is not defined, define it
if (typeof String.prototype.startsWith !== 'function') {
    String.prototype.startsWith = function (s) {
        if (s.length > this.length) {
            return false;
        }
        return this.slice(s.length) === s;
    };
}