From ebd103f7ee39fd234ad191516acee3132d89bdcd Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 4 Aug 2015 16:43:33 +0200 Subject: [PATCH] js/icinga/utils: Implement fixedEncodeURIComponent method * FYI: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent refs #9347 --- public/js/icinga/utils.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public/js/icinga/utils.js b/public/js/icinga/utils.js index b447454e3..659be9ea9 100644 --- a/public/js/icinga/utils.js +++ b/public/js/icinga/utils.js @@ -307,6 +307,19 @@ destroy: function () { this.urlHelper = null; this.icinga = null; + }, + + /** + * Encode the parenthesis too + * + * @param str {String} A component of a URI + * + * @returns {String} Encoded component + */ + fixedEncodeURIComponent: function (str) { + return encodeURIComponent(str).replace(/[()]/g, function(c) { + return '%' + c.charCodeAt(0).toString(16); + }); } };