diff --git a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js index a6e7177..5ee71ec 100644 --- a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js +++ b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js @@ -15,7 +15,6 @@ var settings = Drupal.settings.viewsSlideshowCycle[fullId]; settings.targetId = '#' + $(fullId + " :first").attr('id'); settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', ''); - settings.paused = false; settings.opts = { speed:settings.speed, @@ -103,17 +102,14 @@ $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(function() { Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); }, function() { - if (!settings.paused) { - Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId }); - } + Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId }); }); } // Pause on clicking of the slide. if (settings.pause_on_click) { $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() { - settings.paused = true; - Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); + Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); }); } @@ -309,7 +305,7 @@ // Start Paused if (settings.start_paused) { - Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); + Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); } // Pause if hidden. @@ -319,10 +315,10 @@ // otherwise if the slideshow is not visible and it is not paused then // pause it. var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible); - if (visible && settings.paused) { + if (visible) { Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId }); } - else if (!visible && !settings.paused) { + else { Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); } } diff --git a/js/views_slideshow.js b/js/views_slideshow.js index cf87573..c8dc99b 100644 --- a/js/views_slideshow.js +++ b/js/views_slideshow.js @@ -88,10 +88,10 @@ var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); $(this).click(function() { if (Drupal.settings.viewsSlideshow[uniqueID].paused) { - Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); + Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); } else { - Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); + Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); } return false; }); @@ -383,9 +383,24 @@ // If we are using pause or play switch paused state accordingly. if (options.action == 'pause') { Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; + // If the calling method is forcing a pause then mark it as such. + if (options.force) { + Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; + } } else if (options.action == 'play') { - Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; + // If the slideshow isn't forced pause or we are forcing a play then play + // the slideshow. + // Otherwise return telling the calling method that it was forced paused. + if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { + Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; + Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; + } + else { + status.value = false; + status.text += ' ' + Drupal.t('This slideshow is forced paused.'); + return status; + } } // We use a switch statement here mainly just to limit the type of actions