Moved from DIMP.
authorJan Schneider <jan@horde.org>
Wed, 23 Dec 2009 14:15:56 +0000 (15:15 +0100)
committerJan Schneider <jan@horde.org>
Wed, 23 Dec 2009 14:15:56 +0000 (15:15 +0100)
horde/js/horde.js

index 77c8681..a06fac3 100644 (file)
@@ -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;
     }
 });