mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) add prefix support
This commit is contained in:
parent
67d9b7981e
commit
a74e49f4ab
6 changed files with 29 additions and 12 deletions
|
|
@ -8,11 +8,11 @@
|
|||
<link rel="icon" href="/favicon.ico" />
|
||||
<title>{{ title }}</title>
|
||||
|
||||
<link rel=stylesheet href=/cloudcmd/css/urls.css>
|
||||
<link rel=stylesheet href=/cloudcmd/join:css/reset.css:css/style.css:css/icons.css:css/help.css>
|
||||
<link rel=stylesheet href="{{ prefix }}/css/urls.css">
|
||||
<link rel=stylesheet href="{{ prefix }}/join:css/reset.css:css/style.css:css/icons.css:css/help.css">
|
||||
|
||||
<noscript>
|
||||
<link rel=stylesheet href="/cloudcmd/css/nojs.css">
|
||||
<link rel=stylesheet href="{{ prefix }}/css/nojs.css">
|
||||
</noscript>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<button id=~ class="cmd-button reduce-text icon-console" title="console" >~</button>
|
||||
<button id=contact class="cmd-button reduce-text icon-contact" title="contact" ></button>
|
||||
</div>
|
||||
<script src="/cloudcmd/cloudcmd.js"></script>
|
||||
<script src="{{ prefix }}/cloudcmd.js"></script>
|
||||
<script>
|
||||
!(function() {
|
||||
'use strict';
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
function load() {
|
||||
window.removeEventListener('DOMContentLoaded', load);
|
||||
CloudCmd();
|
||||
CloudCmd('{{ prefix }}');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ var Util, DOM, CloudFunc, join;
|
|||
});
|
||||
};
|
||||
|
||||
CloudCmd.PREFIX = prefix;
|
||||
CloudCmd.PREFIX = prefix;
|
||||
CloudCmd.LIBDIR = prefix + '/lib/';
|
||||
CloudCmd.LIBDIRCLIENT = prefix + '/lib/client/';
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ var CloudCmd;
|
|||
urlFiles = getJoinURL(files);
|
||||
|
||||
if (!prefix)
|
||||
prefix = '/cloudcmd';
|
||||
prefix = '';
|
||||
|
||||
createScript(prefix + urlFiles, function() {
|
||||
CloudCmd.init(prefix);
|
||||
|
|
|
|||
|
|
@ -1065,6 +1065,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
this.setHistory = function(data, pTitle, url) {
|
||||
var ret = window.history;
|
||||
|
||||
url = CloudCmd.PREFIX + url;
|
||||
|
||||
if (ret)
|
||||
history.pushState(data, pTitle, url);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
module.exports = function(params) {
|
||||
var keys,
|
||||
p = params || {},
|
||||
prefix = p.prefix || '/cloudcmd';
|
||||
prefix = p.prefix || '';
|
||||
|
||||
if (params) {
|
||||
keys = Object.keys(params);
|
||||
|
|
@ -47,6 +47,9 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (p.socket)
|
||||
module.exports.listen(p.socket);
|
||||
|
||||
return cloudcmd(prefix);
|
||||
};
|
||||
|
||||
|
|
@ -110,7 +113,9 @@
|
|||
root : root
|
||||
}),
|
||||
rest,
|
||||
route,
|
||||
route({
|
||||
prefix: prefix
|
||||
}),
|
||||
|
||||
join({
|
||||
dir : DIR_ROOT,
|
||||
|
|
|
|||
|
|
@ -36,13 +36,22 @@
|
|||
|
||||
Template = {},
|
||||
|
||||
Prefix,
|
||||
FS = CloudFunc.FS;
|
||||
|
||||
module.exports = function(req, res, next) {
|
||||
module.exports = function(params) {
|
||||
var p = params || {};
|
||||
|
||||
Prefix = p.prefix || '';
|
||||
|
||||
return middle;
|
||||
};
|
||||
|
||||
function middle(req, res, next) {
|
||||
readFiles(function() {
|
||||
route(req, res, next);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* additional processing of index file
|
||||
|
|
@ -77,7 +86,8 @@
|
|||
|
||||
data = rendy(data, {
|
||||
title : CloudFunc.getTitle(),
|
||||
fm : left + right
|
||||
fm : left + right,
|
||||
prefix : Prefix
|
||||
});
|
||||
|
||||
return data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue