mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 16:35:13 +00:00
Update http.js
This commit is contained in:
parent
503641bdb0
commit
915d72ebbe
26
lib/http.js
26
lib/http.js
|
@ -642,6 +642,32 @@ var HTTPObject = function(engine) {
|
|||
this.saveTo = filename;
|
||||
};
|
||||
|
||||
this.parseScripts = function() {
|
||||
var scripts = [];
|
||||
|
||||
if (typeof this.responseBody !== "string")
|
||||
return scripts;
|
||||
|
||||
var tagName = "script";
|
||||
var a = this.responseBody.indexOf('<' + tagName + ' ');
|
||||
var b = a < 0 ? -1 : this.responseBody.indexOf('</' + tagName + '>', a);
|
||||
|
||||
while (a > -1 && b > -1) {
|
||||
var outerHTML = this.responseBody.substring(a, b + tagName.length + 3);
|
||||
var innerHTML = this.responseBody.substring(this.responseBody.indexOf('>', a), b);
|
||||
|
||||
scripts.push({
|
||||
'outerHTML': outerHTML,
|
||||
'innerHTML': innerHTML
|
||||
});
|
||||
|
||||
a = this.responseBody.indexOf('<' + tagName + ' ', b + tagName.length + 3);
|
||||
b = a < 0 ? -1 : this.responseBody.indexOf('</' + tagName + '>', a);
|
||||
}
|
||||
|
||||
return scripts;
|
||||
};
|
||||
|
||||
this.create();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user