From b537f8d9c1c4a43610aab72eb04353cc20b9a044 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 23 Dec 2009 15:15:56 +0100 Subject: [PATCH] Moved from DIMP. --- horde/js/horde.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/horde/js/horde.js b/horde/js/horde.js index 77c868171..a06fac352 100644 --- a/horde/js/horde.js +++ b/horde/js/horde.js @@ -75,6 +75,17 @@ Object.extend(String.prototype, { window[func[1]] = eval(func[1]); } }); + }, + + /* More efficient String.unfilterJSON() function. */ + unfilterJSON: function(filter) { + if (filter) { + return this.replace(filter, '$1'); + } else if (this.startsWith('/*-secure-') && + this.endsWith('*/')) { + return this.slice(10, -2); + } + return this; } }); -- 2.11.0