# HG changeset patch # User Sebastien Jodogne # Date 1347283400 -7200 # Node ID 42a449dac41570c253c361a349b724aef9945976 # Parent 293038baf8f181cf50af7afd2547e478018e9221 multi-frame images in the explorer diff -r 293038baf8f1 -r 42a449dac415 PalanthirExplorer/explorer.js --- a/PalanthirExplorer/explorer.js Mon Sep 10 15:17:02 2012 +0200 +++ b/PalanthirExplorer/explorer.js Mon Sep 10 15:23:20 2012 +0200 @@ -586,11 +586,36 @@ $('#instance-preview').live('click', function(e) { - jQuery.slimbox('/instances/' + $.mobile.pageData.uuid + '/preview', '', { - overlayFadeDuration : 1, - resizeDuration : 1, - imageFadeDuration : 1 - }); + if ($.mobile.pageData) { + GetSingleResource('instances', $.mobile.pageData.uuid + '/frames', function(frames) { + if (frames.length == 1) + { + // Viewing a single-frame image + jQuery.slimbox('/instances/' + $.mobile.pageData.uuid + '/preview', '', { + overlayFadeDuration : 1, + resizeDuration : 1, + imageFadeDuration : 1 + }); + } + else + { + // Viewing a multi-frame image + + var images = []; + for (var i = 0; i < frames.length; i++) { + images.push([ '/instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]); + } + + jQuery.slimbox(images, 0, { + overlayFadeDuration : 1, + resizeDuration : 1, + imageFadeDuration : 1, + loop : true + }); + } + }); + + } }); $('#series-preview').live('click', function(e) {