From 6a91448aee5d036b35c621bbdaff250dc84e15f3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <machniak@kolabsys.com>
Date: Wed, 30 Oct 2013 14:51:55 -0400
Subject: [PATCH] Improve performance and code readability by using String's startsWith() method, other code improvements

---
 program/js/common.js |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/program/js/common.js b/program/js/common.js
index afaf916..02934f7 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -592,6 +592,14 @@
   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;

--
Gitblit v1.9.1