From c449a5af9a7af03bcfe5e617c00a78be8e93061c Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 1 Jan 2011 16:40:08 -0500 Subject: [PATCH] Don't reload the same gallery if requested twice in a row, clear the thumbs container --- ansel/js/mobile.js | 10 +++++++++- ansel/lib/Ajax/Application.php | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ansel/js/mobile.js b/ansel/js/mobile.js index 72c1d3fbc..d0173a6fc 100644 --- a/ansel/js/mobile.js +++ b/ansel/js/mobile.js @@ -13,6 +13,8 @@ */ var AnselMobile = { + currentGallery: null, + /** * Build a gallery list */ @@ -46,8 +48,14 @@ var AnselMobile = { */ galleryLoaded: function(r) { - $('#galleryview h1').text(r.n); // TODO: error checks, build any subgallery lists etc... + if (r.id == AnselMobile.currentGallery) { + $.mobile.changePage('galleryview', 'slide', false, true); + return; + } + AnselMobile.currentGallery = r.id; + $('#thumbs').text(''); + $('#galleryview h1').text(r.n); $.mobile.changePage('galleryview', 'slide', false, true); $.each(r.imgs, function(k, i) { var img = $('
  • ').append($('').attr({ src: i.url })); diff --git a/ansel/lib/Ajax/Application.php b/ansel/lib/Ajax/Application.php index 7cd096ec6..a47199dd3 100644 --- a/ansel/lib/Ajax/Application.php +++ b/ansel/lib/Ajax/Application.php @@ -25,6 +25,7 @@ class Ansel_Ajax_Application extends Horde_Core_Ajax_Application * @return mixed False on failure, object representing the gallery with * the following structure: *
    +     * 'id' - gallery id
          * 'n'  - gallery name
          * 'dc' - date created
          * 'dm' - date modified
    -- 
    2.11.0