diff --git a/html/view/image.html b/html/view/image.html
index 12bbd746..5bf60ab8 100644
--- a/html/view/image.html
+++ b/html/view/image.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/lib/client/view.js b/lib/client/view.js
index abf2cf89..6812086c 100644
--- a/lib/client/view.js
+++ b/lib/client/view.js
@@ -13,13 +13,14 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Key = CloudCmd.Key,
Images = DOM.Images,
View = Util.exec.bind(Util),
- Element, TemplateAudio,
+ Element, TemplateAudio, TemplateImage,
Config = {
beforeShow : function() {
Images.hideLoad();
Key.unsetBind();
},
beforeClose : Key.setBind,
+ fitToView : true,
loop : false,
openEffect : 'none',
closeEffect : 'none',
@@ -28,7 +29,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
width : '100%',
minWidth : 0,
minHeight : 0,
- padding : 0
+ padding : 0
};
View.show = show;
@@ -84,7 +85,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
path = CloudFunc.FS + Info.path;
if (isImage(path))
- $.fancybox({ href : path }, Config);
+ getImageElement(path, function(element) {
+ $.fancybox.open(element, Config);
+ });
else if (isMusic(path))
getMusicElement(path, function(element) {
$.fancybox.open(element, {
@@ -125,6 +128,24 @@ var CloudCmd, Util, DOM, CloudFunc, $;
return isMatch;
}
+ function getImageElement(src, callback) {
+ CloudCmd.getTemplate(TemplateImage, 'view/image', function(template) {
+ var rendered, element;
+
+ if (!TemplateImage)
+ TemplateImage = template;
+
+ rendered = Util.render(TemplateImage, {
+ src: src,
+ name: Info.name
+ });
+
+ element = $(rendered);
+
+ Util.exec(callback, element);
+ });
+ }
+
function getMusicElement(src, callback) {
CloudCmd.getTemplate(TemplateAudio, 'view/audio', function(template) {
var rendered, element;