mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
fix
This commit is contained in:
parent
cfc883aab6
commit
d9dbdd8d74
|
@ -48,7 +48,9 @@ var FILE = require('lib/file');
|
||||||
var pos = url.indexOf('://');
|
var pos = url.indexOf('://');
|
||||||
var scheme = (pos < 0) ? "" : url.substring(0, pos);
|
var scheme = (pos < 0) ? "" : url.substring(0, pos);
|
||||||
|
|
||||||
if (scheme == 'http' || scheme == 'https') {
|
switch (scheme) {
|
||||||
|
case "http":
|
||||||
|
case "https":
|
||||||
var req = xmlHttp();
|
var req = xmlHttp();
|
||||||
if (!req) {
|
if (!req) {
|
||||||
return;
|
return;
|
||||||
|
@ -64,7 +66,9 @@ var FILE = require('lib/file');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req.send(null);
|
req.send(null);
|
||||||
} else {
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
responseText = FILE.readFile(url, "utf-8");
|
responseText = FILE.readFile(url, "utf-8");
|
||||||
callback(responseText);
|
callback(responseText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,11 +392,14 @@ var FILE = require('lib/file');
|
||||||
var pos = url.indexOf('://');
|
var pos = url.indexOf('://');
|
||||||
var scheme = (pos < 0) ? "" : url.substring(0, pos);
|
var scheme = (pos < 0) ? "" : url.substring(0, pos);
|
||||||
|
|
||||||
if (scheme == 'http' || scheme == 'https') {
|
switch (scheme) {
|
||||||
|
case "http":
|
||||||
|
case "https":
|
||||||
xhr.open("GET", url, false);
|
xhr.open("GET", url, false);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
return (xhr.status == 200) ? xhr.responseText : EMPTY_STRING;
|
return (xhr.status == 200) ? xhr.responseText : EMPTY_STRING;
|
||||||
} else {
|
|
||||||
|
default:
|
||||||
var responseText = FILE.readFile(url, "utf-8");
|
var responseText = FILE.readFile(url, "utf-8");
|
||||||
return responseText;
|
return responseText;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user