diff --git a/html/audio.html b/html/view/audio.html
similarity index 100%
rename from html/audio.html
rename to html/view/audio.html
diff --git a/html/view/image.html b/html/view/image.html
new file mode 100644
index 00000000..12bbd746
--- /dev/null
+++ b/html/view/image.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/client.js b/lib/client.js
index 88f6f596..6c640936 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -282,6 +282,13 @@ var Util, DOM, CloudFunc;
Util.exec(pCallBack);
}
+ this.getTemplate = function(data, name, callback) {
+ var path = DIR_HTML + name +'.html',
+ func = getSystemFile(data, path);
+
+ func(callback);
+ };
+
function getSystemFile(pGlobal, pURL) {
function lGetSysFile(pCallBack) {
diff --git a/lib/client/config.js b/lib/client/config.js
index ffe2d7e2..fb9bc4a0 100644
--- a/lib/client/config.js
+++ b/lib/client/config.js
@@ -15,7 +15,7 @@ var CloudCmd, Util, DOM;
}),
INPUT = 'INPUT',
CONFIG,
- TEMPLATE,
+ Template,
Notify = DOM.Notify,
Config = this;
@@ -35,7 +35,7 @@ var CloudCmd, Util, DOM;
this.show = function() {
var funcs = [
- getTemplate,
+ Util.bind(CloudCmd.getTemplate, Template, 'config'),
cssLoad
];
@@ -52,21 +52,10 @@ var CloudCmd, Util, DOM;
});
}
- function getTemplate(callback) {
- Util.ifExec(TEMPLATE, callback, function (execCall) {
- DOM.ajax({
- url : '/html/config.html',
- success : function(data) {
- TEMPLATE = data;
- execCall();
- },
- error : Images.showError
- });
-
- });
- }
-
- function fillTemplate() {
+ function fillTemplate(template) {
+ if (!Template)
+ Template = template;
+
CloudCmd.getConfig(function(config) {
var i, n, div, data, inputs, input, inputFirst,
focus, obj;
@@ -74,7 +63,7 @@ var CloudCmd, Util, DOM;
CONFIG = config;
obj = Util.copyObj(CONFIG);
changeConfig(obj);
- data = Util.render(TEMPLATE, obj);
+ data = Util.render(Template, obj);
div = DOM.anyload({
name : 'div',
className : 'config',
diff --git a/lib/client/view.js b/lib/client/view.js
index d9c71a50..abf2cf89 100644
--- a/lib/client/view.js
+++ b/lib/client/view.js
@@ -13,8 +13,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Key = CloudCmd.Key,
Images = DOM.Images,
View = Util.exec.bind(Util),
- Element,
-
+ Element, TemplateAudio,
Config = {
beforeShow : function() {
Images.hideLoad();
@@ -85,7 +84,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
path = CloudFunc.FS + Info.path;
if (isImage(path))
- $.fancybox.open({ href : path }, Config);
+ $.fancybox({ href : path }, Config);
else if (isMusic(path))
getMusicElement(path, function(element) {
$.fancybox.open(element, {
@@ -127,17 +126,20 @@ var CloudCmd, Util, DOM, CloudFunc, $;
}
function getMusicElement(src, callback) {
- DOM.ajax({
- url : '/html/audio.html',
- success : function(template) {
- var rendered = Util.render(template, {
- src: src,
- name: Info.name
- }),
+ CloudCmd.getTemplate(TemplateAudio, 'view/audio', function(template) {
+ var rendered, element;
- element = $(rendered);
- Util.exec(callback, element);
- }
+ if (!TemplateAudio)
+ TemplateAudio = template;
+
+ rendered = Util.render(TemplateAudio, {
+ src: src,
+ name: Info.name
+ });
+
+ element = $(rendered);
+
+ Util.exec(callback, element);
});
}