Created
March 14, 2018 19:39
-
-
Save junaidpv/5ec3cbbedc6f66885fa027131bca6743 to your computer and use it in GitHub Desktop.
Patch for views_slideshow module to support slideshows within RPP enabled panes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/contrib/views_slideshow_cycle/js/rpp-slideshows.js b/contrib/views_slideshow_cycle/js/rpp-slideshows.js | |
| new file mode 100644 | |
| index 0000000..513a816 | |
| --- /dev/null | |
| +++ b/contrib/views_slideshow_cycle/js/rpp-slideshows.js | |
| @@ -0,0 +1,20 @@ | |
| +(function ($) { | |
| + // Update the window dimensions on each resize. | |
| + $(window).on("resize", function () { | |
| + Drupal.behaviors.views_slideshow_test.onResize(); | |
| + }); | |
| + | |
| + Drupal.behaviors.views_slideshow_test = { | |
| + | |
| + attach: function (context) { | |
| + }, | |
| + | |
| + onResize: function () { | |
| + $('.rpp-load-always:visible').once('rpp-views-slideshow', function(){ | |
| + Drupal.behaviors.viewsSlideshowCycle.attach(this); | |
| + }); | |
| + } | |
| + | |
| + }; | |
| + | |
| +})(jQuery); | |
| diff --git a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| index 1950093..35b1035 100644 | |
| --- a/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| +++ b/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js | |
| @@ -1,3 +1,4 @@ | |
| +//@ sourceURL=views_slideshow_cycle.js | |
| /** | |
| * @file | |
| * A simple jQuery Cycle Div Slideshow Rotator. | |
| @@ -9,7 +10,7 @@ | |
| (function ($) { | |
| Drupal.behaviors.viewsSlideshowCycle = { | |
| attach: function (context) { | |
| - $('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function() { | |
| + $('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).filter(':visible').addClass('viewsSlideshowCycle-processed').each(function() { | |
| var fullId = '#' + $(this).attr('id'); | |
| var settings = Drupal.settings.viewsSlideshowCycle[fullId]; | |
| settings.targetId = '#' + $(fullId + " :first").attr('id'); | |
| diff --git a/contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc b/contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc | |
| index 8987880..b19678f 100644 | |
| --- a/contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc | |
| +++ b/contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc | |
| @@ -103,6 +103,7 @@ function template_preprocess_views_slideshow_cycle_main_frame(&$vars) { | |
| // Load our cycle js. | |
| drupal_add_js($module_path . '/js/views_slideshow_cycle.js'); | |
| + drupal_add_js($module_path . '/js/rpp-slideshows.js'); | |
| // Load the pause library. | |
| if (!empty($settings['pause_in_middle']) && $pause_path = _views_slideshow_cycle_pause_library_path()) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment