diff -ur galleryformatter 2/galleryformatter.module galleryformatter/galleryformatter.module --- galleryformatter 2/galleryformatter.module 2012-12-18 08:51:28.000000000 +0100 +++ galleryformatter/galleryformatter.module 2014-02-20 15:31:30.000000000 +0100 @@ -19,6 +19,8 @@ 'link_to_full' => 1, 'link_to_full_style' => 0, 'modal' => 'none', + 'full_image_text' => t('View full image'), + 'galleryformatter_slideshow' => 0, ), 'description' => t('Display multi-value fields as an jQuery Image gallery.'), ), @@ -125,6 +127,45 @@ ) ); + $form['full_image_text'] = array( + '#type' => 'textfield', + '#title' => t('Full image text'), + '#default_value' => $settings['full_image_text'], + '#description' => t('Text to be displayed while hovering over magnifier glass icon. Leave this empty if you do not want any text there.'), + ); + + $form['galleryformatter_slideshow'] = array( + '#type' => 'select', + '#title' => t('Enable Slideshow for Gallery Formatter galleries'), + '#options' => array( + '0' => t('Disabled'), + '2000' => t('Enabled: 2 seconds delay'), + '2500' => t('Enabled: 2.5 seconds delay'), + '3000' => t('Enabled: 3 seconds delay'), + '3500' => t('Enabled: 3.5 seconds delay'), + '4000' => t('Enabled: 4 seconds delay'), + '4500' => t('Enabled: 4.5 seconds delay'), + '5000' => t('Enabled: 5 seconds delay'), + '6000' => t('Enabled: 6 seconds delay'), + '7000' => t('Enabled: 7 seconds delay'), + '8000' => t('Enabled: 8 seconds delay'), + '10000' => t('Enabled: 10 seconds delay'), + '-2000' => t('Enabled with autoplay: 2 seconds delay'), + '-2500' => t('Enabled with autoplay: 2.5 seconds delay'), + '-3000' => t('Enabled with autoplay: 3 seconds delay'), + '-3500' => t('Enabled with autoplay: 3.5 seconds delay'), + '-4000' => t('Enabled with autoplay: 4 seconds delay'), + '-4500' => t('Enabled with autoplay: 4.5 seconds delay'), + '-5000' => t('Enabled with autoplay: 5 seconds delay'), + '-6000' => t('Enabled with autoplay: 6 seconds delay'), + '-7000' => t('Enabled with autoplay: 7 seconds delay'), + '-8000' => t('Enabled with autoplay: 8 seconds delay'), + '-10000' => t('Enabled with autoplay: 10 second delay'), + ), + '#default_value' => $settings['galleryformatter_slideshow'], + '#description' => t('If Enabled, a "Slideshow" button will become visible for the default Gallery Formatter container.
Note: Modals, like [Colorbox] [Shadowbox] [Lightbox2], have built-in slideshow capability.
This does not affect Modal Galleries, it only enables slideshows in default gallery/node view.'), + ); + return $form; } @@ -149,6 +190,14 @@ $linking_method = ($settings['linking_method'] == 'onclick_full') ? t('On slide click') : t('Using a link'); $summary[] = t('Linking method: @value', array('@value' => $linking_method)); } + + $summary[] = t('Full image text: @value', array('@value' => (empty($settings['full_image_text']) ? t('Empty (no text)') : $settings['full_image_text']))); + + if ($settings['galleryformatter_slideshow'] == '0') { + $summary[] = t('Gallery Formatter Slideshow: Disabled'); + } else { + $summary[] = t('Gallery Formatter Slideshow: @value', array('@value' => ' Enabled - ' . $settings['galleryformatter_slideshow'] . 'ms delay')); + } return implode ('
', $summary); } @@ -328,7 +377,7 @@ $link_url = $settings['link_to_full_style'] ? image_style_url($settings['link_to_full_style'], $item['uri']) : file_create_url($item['uri']); // link the slide image and include the span for the icon - $link_content = ($settings['linking_method'] == 'show_full_link') ? ''. t('View the full image') .'' : ''; + $link_content = ($settings['linking_method'] == 'show_full_link') ? ''. t('View the full image') .'' : ''; $image_rendered = $renderitems['slides'][$delta]['image']; $link_content .= ($settings['linking_method'] == 'onclick_full') ? $image_rendered : ''; @@ -355,6 +404,13 @@ drupal_add_js($modulepath . '/theme/infiniteCarousel.js'); drupal_add_js($modulepath . '/theme/galleryformatter.js'); } + $js_settings = array( + // all available/current GF variables - uncomment to get CDATA (jQuery.extend(Drupal.settings,...) variables in source + // currently using 'gfslideshowSpeed'; �note�-variable names (e.g. 'gfslide_style') only matter to Javascripts + 'gffullimagetext' => variable_get('full_image_text', $settings['full_image_text']), + 'gfslideshowSpeed' => variable_get('galleryformatter_slideshow', $settings['galleryformatter_slideshow']), + ); + drupal_add_js(array('galleryformatter' => $js_settings), array('type' => 'setting', 'scope' => JS_DEFAULT)); galleryformatter_add_css($settings['style']); drupal_add_css($modulepath . '/theme/galleryformatter.css'); diff -ur galleryformatter 2/gallerystyles/greenarrows/greenarrows.css galleryformatter/gallerystyles/greenarrows/greenarrows.css --- galleryformatter 2/gallerystyles/greenarrows/greenarrows.css 2012-12-18 08:51:28.000000000 +0100 +++ galleryformatter/gallerystyles/greenarrows/greenarrows.css 2014-02-20 15:31:36.000000000 +0100 @@ -21,7 +21,7 @@ .galleryformatter-greenarrows .gallery-thumbs .wrapper { overflow: auto; line-height:0; - background-position: center -326px; + background-position: center -519px; background-repeat: repeat-x; border-bottom: 1px solid #EEEEEE; } @@ -47,8 +47,8 @@ display: block; padding: 19px 0 7px; } -.galleryformatter-greenarrows .gallery-thumbs li a:hover { background-position: center -307px; } -.galleryformatter-greenarrows .gallery-thumbs li.active a { background-position: center -303px; } +.galleryformatter-greenarrows .gallery-thumbs li a:hover { background-position: center -499px; } +.galleryformatter-greenarrows .gallery-thumbs li.active a { background-position: center -494px; } .galleryformatter-greenarrows .gallery-thumbs li.active img, .galleryformatter-greenarrows .gallery-thumbs li a:hover img { @@ -57,6 +57,7 @@ -moz-opacity:1; -khtml-opacity: 1; opacity: 1; + text-decoration:none; } .galleryformatter-greenarrows .gallery-thumbs li img { filter:alpha(opacity=60); @@ -109,9 +110,30 @@ background-position: top right; } .galleryformatter-greenarrows .slide-button:hover { - filter: alpha(opacity=100); + filter: alpha(opacity=100); -ms-filter: ”alpha(opacity=100)”; -moz-opacity: 1; -khtml-opacity: 1; opacity: 1; } + +/* slideshow button */ +#gfslideshowbutton{ + height:48px; width:48px; + left:46%; + float:left; + margin:10px; + left:0; top:0; +} + +.galleryformatter-greenarrows .gfslideshow { + background-position: center -301px; +} +.galleryformatter-greenarrows .gfslideshowon { + background-position: center -397px; +} +.galleryformatter-greenarrows .gfslideshowon:hover { + background-position: center -444px; +} +.galleryformatter-greenarrows .gfslideshow:hover { background-position: center -348px; } +/* end slideshow button */ Binary files galleryformatter 2/gallerystyles/greenarrows/images/sprite.png and galleryformatter/gallerystyles/greenarrows/images/sprite.png differ diff -ur galleryformatter 2/theme/galleryformatter.js galleryformatter/theme/galleryformatter.js --- galleryformatter 2/theme/galleryformatter.js 2012-12-18 08:51:28.000000000 +0100 +++ galleryformatter/theme/galleryformatter.js 2014-02-20 15:31:34.000000000 +0100 @@ -17,6 +17,8 @@ (function ($) { // var $settings = Drupal.settings.galleryformatter; $el = $(el); + var timer = null; + var $slides = $('li.gallery-slide', $el); var $slideContainer = $('div.gallery-slides', $el); @@ -26,7 +28,13 @@ var liWidth = $thumbsLi.outerWidth(); // includes padding var $wrapper = $('.wrapper', $el); var visibleWidth = $wrapper.outerWidth(); - + // get set a few simple slideshow vars (just 1 presently anything over '0' = enabled) + var $gfslideshowSpeed = Drupal.settings.galleryformatter.gfslideshowSpeed; + + var paused=false; + var showingPhoto=false; + var autoscrolling=false; + /* * Only start the thumbs carrousel if needed */ @@ -52,7 +60,7 @@ * @TODO: * figure out how to get this into proper functions reusing selections */ - $thumbslinks.click(function(e){ + $thumbslinks.bind('showThumb', function (e) { $hash = $(this.hash); if(!$hash.is(':visible')){ $thumbsLi.removeClass('active'); @@ -70,6 +78,12 @@ } e.preventDefault(); }); + + $thumbslinks.click(function(e){ + stopScrolling(); + $(this).trigger('showThumb'); + e.preventDefault(); + }); /* * Startup behaviour (when the page first loads) @@ -79,10 +93,78 @@ } var $locationHash = window.location.hash; // if we are being deeplinked to a specific slide, capture that + function moveThumb(thumb){ + thumb.trigger('showThumb'); + } + function showFirstSlide(){ // Activate the first slide - $('a', $thumbsLi.filter('.slide-0:not(".cloned")')).trigger('click'); - } + moveThumb($('a', $thumbsLi.filter('.slide-0:not(".cloned")'))); + } + + $(document).bind('cbox_open', function(){ showingPhoto=true; + }); + $(document).bind('cbox_closed', function(){ showingPhoto=false; + if(paused){ + startScrolling(); + scrollToNextSlide(); + } + }); + + + function clearTimer(){ + if(timer!=null){ + clearInterval(timer); + timer = null + } + } + + function startScrolling(){ + clearTimer(); + paused=false; + if(!autoscrolling){ + autoscrolling=true; + $('a#gfslideshowbutton', $el).removeClass("gfslideshow").addClass("gfslideshowon"); + } + timer=setInterval(function () { + if (autoscrolling) { + if(showingPhoto){ + paused=true; + clearTimer(); + }else{ + scrollToNextSlide(); + } + } + }, Math.abs($gfslideshowSpeed)); + } + + function stopScrolling(){ + if(autoscrolling){ + autoscrolling=false; + $('a#gfslideshowbutton', $el).removeClass("gfslideshowon").addClass("gfslideshow"); + clearTimer(); + } + } + function scrollToNextSlide(){ + var currentScroll = $wrapper.get(0).scrollLeft; + // this selector could be optimized perhaps, but + var $nextThumbLi = $thumbsLi.filter('.active').next(':not(".cloned, .empty, .active")'); + // if no results we are on the last element + if(!$nextThumbLi.size()) { + // select the first one + $nextThumbLi = $thumbsLi.not('.empty, .cloned').filter(':first'); + } + + var $slideToClick = $('a', $nextThumbLi); + var $nextIsVisible = (($nextThumbLi.get(0).offsetLeft >= currentScroll) && ($nextThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll))); + if($nextIsVisible) { + moveThumb($slideToClick); + } + else { + $thumbs.trigger('next'); + moveThumb($slideToClick); + } + } // if we have a hash in the url if ($locationHash) { @@ -109,6 +191,7 @@ */ // Shows the previous slide and scrolls to the previous page if necessary $thumbs.bind('showPrev', function (event) { + stopScrolling(); var currentScroll = $wrapper.get(0).scrollLeft; var $prevThumbLi = $thumbsLi.filter('.active').prev(':not(".cloned, .empty, .active")'); // if no results we are on the first element @@ -119,34 +202,17 @@ var $slideToClick = $('a', $prevThumbLi); var $prevIsVisible = (($prevThumbLi.get(0).offsetLeft >= currentScroll) && ($prevThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll))); if($prevIsVisible) { - $slideToClick.trigger('click'); + moveThumb($slideToClick); } else { $thumbs.trigger('prev'); - $slideToClick.trigger('click'); + moveThumb($slideToClick); } }); // Shows the next slide and scrolls to the next page if necessary $thumbs.bind('showNext', function (event) { - var currentScroll = $wrapper.get(0).scrollLeft; - // this selector could be optimized perhaps, but - var $nextThumbLi = $thumbsLi.filter('.active').next(':not(".cloned, .empty, .active")'); - // if no results we are on the last element - if(!$nextThumbLi.size()) { - // select the first one - $nextThumbLi = $thumbsLi.not('.empty, .cloned').filter(':first'); - } - - var $slideToClick = $('a', $nextThumbLi); - var $nextIsVisible = (($nextThumbLi.get(0).offsetLeft >= currentScroll) && ($nextThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll))); - if($nextIsVisible) { - var $slideToClick = $('a', $nextThumbLi); - $('a', $nextThumbLi).trigger('click'); - } - else { - $thumbs.trigger('next'); - $slideToClick.trigger('click'); - } + stopScrolling(); + scrollToNextSlide(); }); $('.shownext + img', $slideContainer).click(function(){ @@ -165,5 +231,29 @@ $thumbs.trigger('showNext'); }); } + + /* $tart testing Gallery Formatter Slideshow - DRIVE 08082011 $ */ + if ($gfslideshowSpeed != '0') { + autoscrolling=$gfslideshowSpeed<0; + $('.gallery-slides', $el).append('Slide'); + if(autoscrolling){ + startScrolling(); + } + + $('a#gfslideshowbutton', $el).click(function(e){ + if(autoscrolling){ + stopScrolling(); + }else{ + startScrolling(); + } + e.preventDefault(); + }); + // Slides and thumbs scroll in sync + + // 0btained from settings @ + // Structure --> Content Types --> [Your content type] --> + // Manage Display[image field you are using for Gallery Formatter] + } + })(jQuery); }