summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/prototype/string.js
diff options
context:
space:
mode:
authorwei <>2006-01-09 03:40:59 +0000
committerwei <>2006-01-09 03:40:59 +0000
commit9c9a2d731fea9679f65904a3a6b72dd78b4253a4 (patch)
tree1d81a12a7a79e74e98218d01c6278a81f0996f5d /framework/Web/Javascripts/prototype/string.js
parent10420d2bcde1a7437b58175f417170b2d6d93e50 (diff)
Update library
Diffstat (limited to 'framework/Web/Javascripts/prototype/string.js')
-rw-r--r--framework/Web/Javascripts/prototype/string.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/prototype/string.js b/framework/Web/Javascripts/prototype/string.js
index c869e7db..f7b74710 100644
--- a/framework/Web/Javascripts/prototype/string.js
+++ b/framework/Web/Javascripts/prototype/string.js
@@ -3,6 +3,22 @@ Object.extend(String.prototype, {
return this.replace(/<\/?[^>]+>/gi, '');
},
+ stripScripts: function() {
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+ },
+
+ extractScripts: function() {
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+ return (this.match(matchAll) || []).map(function(scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ });
+ },
+
+ evalScripts: function() {
+ return this.extractScripts().map(eval);
+ },
+
escapeHTML: function() {
var div = document.createElement('div');
var text = document.createTextNode(this);