mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
chore(client) route
This commit is contained in:
parent
612ebed2ac
commit
86028587de
1 changed files with 15 additions and 14 deletions
|
|
@ -156,22 +156,23 @@ var Util, DOM, CloudFunc;
|
|||
Util.ifExec(document.body.scrollIntoViewIfNeeded, lCallBack, lFunc);
|
||||
};
|
||||
|
||||
this.route = function(pPath) {
|
||||
var lQuery, lModule, lFile, lCurrent, lMsg;
|
||||
this.route = function(path) {
|
||||
var query, module, file, current, msg;
|
||||
|
||||
if (pPath.length > 0) {
|
||||
lQuery = pPath.split('/');
|
||||
if (path.length > 0) {
|
||||
query = path.split('/');
|
||||
|
||||
if (lQuery.length > 0) {
|
||||
lModule = Util.getStrBigFirst(lQuery[1]);
|
||||
lFile = lQuery[2];
|
||||
lCurrent = DOM.getCurrentFileByName(lFile);
|
||||
if (lFile && !lCurrent) {
|
||||
lMsg = CloudFunc.formatMsg('set current file', lFile, 'error');
|
||||
Util.log(lMsg);
|
||||
if (query.length > 0) {
|
||||
module = Util.getStrBigFirst(query[1]);
|
||||
file = query[2];
|
||||
current = DOM.getCurrentFileByName(file);
|
||||
|
||||
if (file && !current) {
|
||||
msg = CloudFunc.formatMsg('set current file', file, 'error');
|
||||
Util.log(msg);
|
||||
} else {
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
CloudCmd.execFromModule(lModule, 'show');
|
||||
DOM.setCurrentFile(current);
|
||||
CloudCmd.execFromModule(module, 'show');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -312,7 +313,7 @@ var Util, DOM, CloudFunc;
|
|||
},
|
||||
|
||||
function(callback) {
|
||||
Util.exec(obj, calback);
|
||||
Util.exec(obj, callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue