chore(client) route

This commit is contained in:
coderaiser 2014-02-17 03:56:43 -05:00
parent 612ebed2ac
commit 86028587de

View file

@ -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);
});
};