Index: contrib/views_slideshow_singleframe/views_slideshow.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views_slideshow.js,v retrieving revision 1.1.2.1.2.30 diff -u -p -r1.1.2.1.2.30 views_slideshow.js --- contrib/views_slideshow_singleframe/views_slideshow.js 2 May 2010 04:56:55 -0000 1.1.2.1.2.30 +++ contrib/views_slideshow_singleframe/views_slideshow.js 3 May 2010 23:09:18 -0000 @@ -54,6 +54,12 @@ Drupal.behaviors.viewsSlideshowSingleFra } }, before:function(curr, next, opts) { + // Remember last slide. + if (settings.remember_slide) { + createCookie(settings.view_id, opts.currSlide + 1, settings.remember_slide_days); + } + + // Make variable height. if (settings.fixed_height == 0) { //get the height of the current slide var $ht = $(this).height(); @@ -65,11 +71,20 @@ Drupal.behaviors.viewsSlideshowSingleFra cleartypeNoBg:(settings.ie.cleartypenobg == 'true')? true : false } + // Set the starting slide if we are supposed to remember the slide + if (settings.remember_slide) { + var startSlide = readCookie(settings.view_id); + if (startSlide == null) { + startSlide = 0; + } + settings.opts.startingSlide = startSlide; + } + if (settings.pager_hover == 1) { settings.opts.pagerEvent = 'mouseover'; settings.opts.pauseOnPagerHover = true; } - + if (settings.effect == 'none') { settings.opts.speed = 1; } @@ -217,3 +232,35 @@ function IsNumeric(sText) { } return IsNumber; } + +/** + * Cookie Handling Functions + */ +function createCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else { + var expires = ""; + } + document.cookie = name+"="+value+expires+"; path=/"; +} + +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) { + return c.substring(nameEQ.length,c.length); + } + } + return null; +} + +function eraseCookie(name) { + createCookie(name,"",-1); +} Index: contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views_slideshow_singleframe.theme.inc,v retrieving revision 1.1.2.1.2.23 diff -u -p -r1.1.2.1.2.23 views_slideshow_singleframe.theme.inc --- contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc 3 May 2010 22:28:27 -0000 1.1.2.1.2.23 +++ contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc 3 May 2010 23:09:18 -0000 @@ -21,6 +21,7 @@ function template_preprocess_views_slide 'id_prefix' => '#views_slideshow_singleframe_main_', 'div_prefix' => '#views_slideshow_singleframe_div_', 'id' => $vars['id'], + 'view_id' => $view->name . '-' . $view->current_display, ), $options['views_slideshow_singleframe'] ); Index: contrib/views_slideshow_singleframe/views_slideshow_singleframe.views_slideshow.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views_slideshow_singleframe.views_slideshow.inc,v retrieving revision 1.1.2.1.2.19 diff -u -p -r1.1.2.1.2.19 views_slideshow_singleframe.views_slideshow.inc --- contrib/views_slideshow_singleframe/views_slideshow_singleframe.views_slideshow.inc 3 May 2010 23:02:15 -0000 1.1.2.1.2.19 +++ contrib/views_slideshow_singleframe/views_slideshow_singleframe.views_slideshow.inc 3 May 2010 23:09:18 -0000 @@ -25,6 +25,8 @@ function views_slideshow_singleframe_vie 'random' => array('default' => 0), 'pause' => array('default' => 1), 'pause_on_click' => array('default' => 0), + 'remember_slide' => array('default' => 0), + 'remember_slide_days' => array('default' => 1), 'controls' => array('default' => 0), 'pager' => array('default' => 0), 'pager_type' => array('default' => 0), @@ -92,6 +94,21 @@ function views_slideshow_singleframe_vie '#default_value' => $view->options['views_slideshow_singleframe']['pause_on_click'], '#description' => t('Pause when the slide is clicked.'), ); + $form['views_slideshow_singleframe']['remember_slide'] = array( + '#type' => 'checkbox', + '#title' => t('Start On Last Slide Viewed'), + '#default_value' => $view->options['views_slideshow_singleframe']['remember_slide'], + '#description' => t('When the user leaves a page with a slideshow and comes back start them on the last slide viewed.'), + ); + $form['views_slideshow_singleframe']['remember_slide_days'] = array( + '#type' => 'textfield', + '#title' => t('Length of Time to Remember Last Slide'), + '#default_value' => $view->options['views_slideshow_singleframe']['remember_slide_days'], + '#description' => t('The number of days to have the site remember the last slide. Default is 1'), + '#size' => 4, + '#process' => array('views_process_dependency'), + '#dependency' => array('edit-style-options-views-slideshow-singleframe-remember-slide' => array(1)), + ); $form['views_slideshow_singleframe']['controls'] = array( '#type' => 'select', '#title' => t('Controls'), @@ -217,4 +234,7 @@ function views_slideshow_singleframe_vie if (!is_numeric($form_state['values']['style_options']['views_slideshow_singleframe']['timeout'])) { form_error($form['views_slideshow_singleframe']['timeout'], t('!setting must be numeric!',array('Timeout'))); } + if (!is_numeric($form_state['values']['style_options']['views_slideshow_singleframe']['remember_slide_days'])) { + form_error($form['views_slideshow_singleframe']['remember_slide_days'], t('!setting must be numeric!',array('Slide days'))); + } } Index: contrib/views_slideshow_thumbnailhover/views_slideshow.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow.js,v retrieving revision 1.1.2.2.2.28 diff -u -p -r1.1.2.2.2.28 views_slideshow.js --- contrib/views_slideshow_thumbnailhover/views_slideshow.js 2 May 2010 04:56:55 -0000 1.1.2.2.2.28 +++ contrib/views_slideshow_thumbnailhover/views_slideshow.js 3 May 2010 23:09:18 -0000 @@ -36,6 +36,12 @@ Drupal.behaviors.viewsSlideshowThumbnail } }, before:function(current, next) { + // Remember last slide. + if (settings.remember_slide) { + createCookie(settings.view_id, opts.currSlide + 1, settings.remember_slide_days); + } + + // Make variable height. if (settings.fixed_height == 0) { //get the height of the current slide var $ht = $(this).height(); @@ -54,15 +60,24 @@ Drupal.behaviors.viewsSlideshowThumbnail cleartype:(settings.ie.cleartype == 'true')? true : false, cleartypeNoBg:(settings.ie.cleartypenobg == 'true')? true : false }; - + + // Set the starting slide if we are supposed to remember the slide + if (settings.remember_slide) { + var startSlide = readCookie(settings.view_id); + if (startSlide == null) { + startSlide = 0; + } + settings.opts.startingSlide = startSlide; + } + if (settings.effect == 'none') { settings.opts.speed = 1; } else { settings.opts.fx = settings.effect; } - - // Pause on hover. + + // Pause on hover. if (settings.pause == 1) { $('#views_slideshow_thumbnailhover_teaser_section_' + settings.id).hover(function() { $(settings.targetId).cycle('pause'); @@ -214,3 +229,36 @@ function IsNumeric(sText) { } return IsNumber; } + +/** + * Cookie Handling Functions + */ +function createCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else { + var expires = ""; + } + document.cookie = name+"="+value+expires+"; path=/"; +} + +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) { + return c.substring(nameEQ.length,c.length); + } + } + return null; +} + +function eraseCookie(name) { + createCookie(name,"",-1); +} + Index: contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow_thumbnailhover.theme.inc,v retrieving revision 1.1.2.1.2.31 diff -u -p -r1.1.2.1.2.31 views_slideshow_thumbnailhover.theme.inc --- contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc 3 May 2010 22:28:27 -0000 1.1.2.1.2.31 +++ contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc 3 May 2010 23:09:18 -0000 @@ -22,6 +22,7 @@ function template_preprocess_views_slide 'id_prefix' => '#views_slideshow_thumbnailhover_main_', 'div_prefix' => '#views_slideshow_thumbnailhover_div_', 'id' => $vars['id'], + 'view_id' => $vars['view']->name . '-' . $vars['view']->current_display, ), $options['views_slideshow_thumbnailhover'] ); Index: contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.views_slideshow.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow_thumbnailhover.views_slideshow.inc,v retrieving revision 1.1.2.1.2.19 diff -u -p -r1.1.2.1.2.19 views_slideshow_thumbnailhover.views_slideshow.inc --- contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.views_slideshow.inc 17 Apr 2010 04:29:54 -0000 1.1.2.1.2.19 +++ contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.views_slideshow.inc 3 May 2010 23:09:18 -0000 @@ -31,6 +31,8 @@ function views_slideshow_thumbnailhover_ 'random' => array('default' => 0), 'pause' => array('default' => 1), 'pause_on_click' => array('default' => 0), + 'remember_slide' => array('default' => 0), + 'remember_slide_days' => array('default' => 1), 'pager_event' => array('default' => 'hover'), 'controls' => array('default' => 0), 'image_count' => array('default' => 0), @@ -146,6 +148,21 @@ function views_slideshow_thumbnailhover_ '#default_value' => $view->options['views_slideshow_thumbnailhover']['pause_on_click'], '#description' => t('Pause when the slide is clicked.'), ); + $form['views_slideshow_thumbnailhover']['remember_slide'] = array( + '#type' => 'checkbox', + '#title' => t('Start On Last Slide Viewed'), + '#default_value' => $view->options['views_slideshow_thumbnailhover']['remember_slide'], + '#description' => t('When the user leaves a page with a slideshow and comes back start them on the last slide viewed.'), + ); + $form['views_slideshow_thumbnailhover']['remember_slide_days'] = array( + '#type' => 'textfield', + '#title' => t('Length of Time to Remember Last Slide'), + '#default_value' => $view->options['views_slideshow_thumbnailhover']['remember_slide_days'], + '#description' => t('The number of days to have the site remember the last slide. Default is 1'), + '#size' => 4, + '#process' => array('views_process_dependency'), + '#dependency' => array('edit-style-options-views-slideshow-singleframe-remember-slide' => array(1)), + ); $options = array('mouseover' => t('Hover'), 'click' => t('Click')); if ((module_exists('jq') && jq_add('hoverIntent')) || (module_exists('hoverintent') && hoverintent_add())) { $options['hoverIntent'] = 'hoverIntent'; @@ -256,4 +273,7 @@ function views_slideshow_thumbnailhover_ if (!is_numeric($form_state['values']['style_options']['views_slideshow_thumbnailhover']['timeout'])) { form_error($form['views_slideshow_thumbnailhover']['timeout'],t('!setting must be numeric!',array('!setting' => 'Timeout'))); } + if (!is_numeric($form_state['values']['style_options']['views_slideshow_thumbnailhover']['remember_slide_days'])) { + form_error($form['views_slideshow_thumbnailhover']['remember_slide_days'], t('!setting must be numeric!',array('Slide days'))); + } }