From 251bbd5704ba25a0147b287103eb67f5e90e1734 Mon Sep 17 00:00:00 2001 From: flop25 Date: Tue, 2 Jul 2013 19:29:24 +0000 Subject: bug:2848 The "More Info" link now works and redirects to the picture page git-svn-id: http://piwigo.org/svn/trunk@23745 68402e56-0260-453c-a942-63ccdbb3a9ee --- themes/smartpocket/js/smartpocket.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'themes/smartpocket/js/smartpocket.js') diff --git a/themes/smartpocket/js/smartpocket.js b/themes/smartpocket/js/smartpocket.js index 629fe668c..9ee1027c4 100644 --- a/themes/smartpocket/js/smartpocket.js +++ b/themes/smartpocket/js/smartpocket.js @@ -1,26 +1,32 @@ (function(window, $, PhotoSwipe){ $(document).ready(function(){ + var more_link var options = { jQueryMobile: true, loop: var_loop, captionAndToolbarAutoHideDelay: var_autohide, imageScaleMethod: "fitNoUpscale", getToolbar: function(){ -return '
'+var_trad+'
';}, +return '
';}, getImageMetaData:function(el){ return { picture_url: $(el).attr('data-picture-url') };} }; var myPhotoSwipe = $(".thumbnails a").photoSwipe(options); - myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onDisplayImage, function(e){ + // onShow - store a reference to our "more_link" button + myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onShow, function(e){ + more_link = window.document.querySelectorAll('#more_link')[0]; + }); + // onToolbarTap - listen out for when the toolbar is tapped + myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onToolbarTap, function(e){ + if (e.toolbarAction === PhotoSwipe.Toolbar.ToolbarAction.none){ + if (e.tapTarget === more_link || Util.DOM.isChildOf(e.tapTarget, more_link)){ var currentImage = myPhotoSwipe.getCurrentImage(); - $("#more_link").attr("href", currentImage.metaData.picture_url); - }); - $(document).bind('orientationchange', set_thumbnails_width); - $("#more_link").click(function(){ - console.log($(this).attr('href')); - }); + window.location=currentImage.metaData.picture_url; + } + } +}); $(document).bind('orientationchange', set_thumbnails_width); set_thumbnails_width(); }); }(window, window.jQuery, window.Code.PhotoSwipe)); -- cgit v1.2.3