Rename all cookies to be instance-independent (Requires relogin) - fixes #94
Change-Id: Icd8b58e4b6fbd99a93ee6972485ef77786b5764c
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index cb60c2a..5df346b 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -9,16 +9,22 @@
};
};
-var _quoteRE = new RegExp("([\"\\\\])", 'g');
+const _quoteRE = new RegExp("([\"\\\\])", 'g');
String.prototype.quote = function () {
- return this.replace(_quoteRE, '\\$1');
+ return '"' + this.replace(_quoteRE, '\\$1') + '"';
};
-var _escapeRE = new RegExp("([\/\\\\])", 'g');
+const _escapeRE = new RegExp("([\/\\\\])", 'g');
String.prototype.escapeRegex = function () {
return this.replace(_escapeRE, '\\$1');
};
+const _slug1RE = new RegExp("[^-a-zA-Z0-9_\\s]+", 'g');
+const _slug2RE = new RegExp("[-\\s]+", 'g');
+String.prototype.slugify = function () {
+ return this.toLowerCase().replace(_slug1RE, '').replace(_slug2RE, '-');
+};
+
// Add toggleClass method similar to jquery
HTMLElement.prototype.toggleClass = function (c1, c2) {
var cl = this.classList;