mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 10:09:04 +00:00
feature(util) rm isContainStr
This commit is contained in:
parent
ad87145c42
commit
5d4db87a96
5 changed files with 10 additions and 46 deletions
|
|
@ -1264,7 +1264,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
parallel([loadHash, getStoreHash], function(error, loadHash, storeHash) {
|
||||
var equal,
|
||||
isContain = Util.isContainStr(loadHash, 'error');
|
||||
isContain = /error/.test(loadHash);
|
||||
|
||||
if (isContain)
|
||||
error = loadHash;
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ var Util, DOM;
|
|||
});
|
||||
|
||||
Events.add('readystatechange', xhr, function(event) {
|
||||
var TYPE_JSON, type, data, isContain,
|
||||
var TYPE_JSON, type, data, isContain, notText,
|
||||
xhr = event.target;
|
||||
|
||||
if (xhr.readyState === 4 /* Complete */) {
|
||||
|
|
@ -204,14 +204,13 @@ var Util, DOM;
|
|||
|
||||
if (xhr.status === 200 /* OK */) {
|
||||
data = xhr.response;
|
||||
isContain = Util.isContainStr(type, TYPE_JSON);
|
||||
notText = p.dataType !== 'text',
|
||||
isContain = ~type.indexOf(TYPE_JSON);
|
||||
|
||||
if (p.dataType !== 'text')
|
||||
/* If it's json - parse it as json */
|
||||
if (type && isContain)
|
||||
data = Util.json.parse(xhr.response) || xhr.response;
|
||||
if (type && isContain && notText)
|
||||
data = Util.json.parse(xhr.response) || xhr.response;
|
||||
|
||||
Util.exec(p.success, data, xhr.statusText, xhr);
|
||||
Util.exec(p.success, data, xhr.statusText, xhr);
|
||||
}
|
||||
/* file not found or connection lost */
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ var CloudCmd, Util, join, DOM, CloudFunc, Github, cb;
|
|||
if (!code)
|
||||
code = window.location.search;
|
||||
|
||||
isContain = Util.isContainStr(code, '?code=');
|
||||
isContain = ~code.indexOf('?code=');
|
||||
|
||||
if (!isContain)
|
||||
DOM.openWindow(URL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue