js/icinga/utils: Implement fixedEncodeURIComponent method

* FYI: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent

refs #9347
This commit is contained in:
Alexander Fuhr 2015-08-04 16:43:33 +02:00
parent bebff5b83e
commit ebd103f7ee

View File

@ -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);
});
}
};