mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
feature(client) add route
This commit is contained in:
parent
ab227efec2
commit
43d8e46fb0
1 changed files with 25 additions and 4 deletions
|
|
@ -131,6 +131,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
CloudCmd.init = function(){
|
||||
var lCallBack = function(){
|
||||
Util.loadOnLoad([
|
||||
Util.retExec(route, location.hash),
|
||||
initKeysPanel,
|
||||
initModules,
|
||||
baseInit
|
||||
|
|
@ -265,10 +266,11 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
Events.add("popstate", function(pEvent) {
|
||||
var lPath = pEvent.state + '?json';
|
||||
|
||||
if(lPath)
|
||||
ajaxLoad(lPath, {
|
||||
nohistory: true
|
||||
});
|
||||
if (pEvent.state) {
|
||||
lPath = pEvent.state + '?json';
|
||||
ajaxLoad(lPath, {nohistory: true});
|
||||
} else
|
||||
route(location.hash);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
|
@ -322,6 +324,25 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
CloudCmd.Key();
|
||||
}
|
||||
|
||||
function route(pPath){
|
||||
var lQuery, lModule, lFile, lCurrent;
|
||||
|
||||
if (pPath.length > 0) {
|
||||
lQuery = pPath.split('/');
|
||||
|
||||
if (lQuery.length > 0) {
|
||||
lModule = Util.getStrBigFirst(lQuery[1]);
|
||||
lFile = lQuery[2];
|
||||
lCurrent = DOM.getCurrentFileByName(lFile);
|
||||
if (lFile && !lCurrent)
|
||||
Util.log('set current file: error("' + lFile + '")');
|
||||
else {
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
CloudCmd.execFromModule(lModule, 'show');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSystemFile(pGlobal, pURL){
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue