summaryrefslogtreecommitdiff
path: root/program/js/common.js
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-10-30 19:51:55 +0100
committerAleksander Machniak <machniak@kolabsys.com>2013-10-30 19:51:55 +0100
commit6a91448aee5d036b35c621bbdaff250dc84e15f3 (patch)
tree4cc4c149e05b163d8a2a209471d07b13344e5801 /program/js/common.js
parent8d9dcca2b6fc1117e170195aa4104980e5bfa238 (diff)
Improve performance and code readability by using String's startsWith() method, other code improvements
Diffstat (limited to 'program/js/common.js')
-rw-r--r--program/js/common.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/program/js/common.js b/program/js/common.js
index afaf91639..02934f734 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -592,6 +592,14 @@ Date.prototype.getStdTimezoneOffset = function()
return tzo;
}
+// define String's startsWith() method for old browsers
+if (!String.prototype.startsWith) {
+ String.prototype.startsWith = function(search, position) {
+ position = position || 0;
+ return this.slice(position, search.length) === search;
+ };
+}
+
// Make getElementById() case-sensitive on IE
if (bw.ie) {
document._getElementById = document.getElementById;