From 043bf9c874c0395df986a9a240affced2e5f8f59 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 6 Jul 2015 08:53:33 -0400 Subject: [PATCH] feature(view) add ability to view next/previous image --- lib/client/view.js | 47 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/client/view.js b/lib/client/view.js index 8778f0fe..4594052f 100644 --- a/lib/client/view.js +++ b/lib/client/view.js @@ -184,18 +184,43 @@ var CloudCmd, Util, DOM, CloudFunc, $; $.fancybox.close(); } - function showImage(path) { - var config; + function showImage() { + var config, + current = Info.name, + files = [].slice.call(Info.files), + names = DOM.getSelectedNames(files) + .filter(isImage) + .filter(function(name) { + return name !== current; + }).map(function(name) { + return { + href: name, + title: name + }; + }); + + names.unshift({ + href: current, + title: current + }); config = Util.copyObj({ }, Config); config = Util.copyObj(config, { autoSize : true, - type : 'image' + type : 'image', + prevEffect : 'none', + nextEffect : 'none', + arrows : true, + keys : true, + helpers : { + overlay : null, + title : {} + } }); - $.fancybox.open(path, config); + $.fancybox.open(names, config); } function isImage(name) { @@ -296,11 +321,15 @@ var CloudCmd, Util, DOM, CloudFunc, $; DOM.load.css(prefix + '/css/view.css', callback); DOM.load.style({ - id : 'view-css', - inner : '#fancybox-loading {' + - 'display: none' + - '}' - }); + id : 'view-inlince-css', + inner : [ + '.fancybox-title-float-wrap .child {', + '-webkit-border-radius: 0;', + '-moz-border-radius: 0;', + 'border-radius: 0;', + '}' + ].join('') + }); }); }