web-manager 3.2.60 → 3.2.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/utilities.js +23 -2
  2. package/package.json +1 -1
package/lib/utilities.js CHANGED
@@ -110,11 +110,17 @@ Utilities.escapeHTML = function (str) {
110
110
  shadow.innerHTML = '';
111
111
  shadow.appendChild(document.createTextNode(str));
112
112
 
113
- return shadow.innerHTML.replace(/["']/g, function(m) {
113
+ return shadow.innerHTML.replace(/[&<>"']/g, function(m) {
114
114
  switch (m) {
115
+ case '&':
116
+ return '&amp;';
117
+ case '<':
118
+ return '&lt;';
119
+ case '>':
120
+ return '&gt;';
115
121
  case '"':
116
122
  return '&quot;';
117
- default:
123
+ case "'":
118
124
  return '&#039;';
119
125
  }
120
126
  });
@@ -144,4 +150,19 @@ Utilities.getContext = function () {
144
150
  }
145
151
  }
146
152
 
153
+ // Navigate fn that takes a url and an object of query params
154
+ Utilities.navigate = function (url, params) {
155
+ // Should work if the url is a relative path too
156
+ var newUrl = new URL(url, window.location.origin);
157
+
158
+ // Add the params to the url
159
+ Object.keys(params).forEach(function (key) {
160
+ newUrl.searchParams.set(key, params[key]);
161
+ });
162
+
163
+ // Navigate to the new url
164
+ window.location.href = newUrl;
165
+ }
166
+
167
+
147
168
  module.exports = Utilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.2.60",
3
+ "version": "3.2.62",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {