PageSourceSearch

https://www.francobolli-italia.it/modules/views_slideshow/contrib/…ideshow_thumbnailhover/views_slideshow.js?b

js francobolli-italia.it collected 2026-09-27 10:18:13 UTC 7,875 bytes, 213 lines download raw bytes

1// $Id: views_slideshow.js,v 1.1.2.2.2.26 2010/04/19 22:44:33 redndahead Exp $
2
3/**
4 * @file
5 * A simple jQuery ThumbnailHover Div Slideshow Rotator.
6 */
7
8/**
9 * This will set our initial behavior, by starting up each individual slideshow.
10 */
11Drupal.behaviors.viewsSlideshowThumbnailHover = function (context) {
12  $('.views_slideshow_thumbnailhover_main:not(.viewsSlideshowThumbnailHover-processed)', context).addClass('viewsSlideshowThumbnailHover-processed').each(function() {
13    var fullId = '#' + $(this).attr('id');
14    var settings = Drupal.settings.viewsSlideshowThumbnailHover[fullId];
15    settings.targetId = '#' + $(fullId + " :first").attr('id');
16		settings.paused = false;
17		
18    settings.opts = {
19      speed:settings.speed,
20      timeout:parseInt(settings.timeout),
21      delay:parseInt(settings.delay),
22      sync:settings.sync==1,
23      random:settings.random==1,
24      pause:false,
25      allowPagerClickBubble:(settings.pager_event=='click')? false : true,
26      pager:(settings.pager_event == 'hoverIntent') ? null : '#views_slideshow_breakout_teasers_' + settings.id,
27      nowrap:parseInt(settings.nowrap),
28      pagerAnchorBuilder:(settings.pager_event == 'hoverIntent') ? null : function(idx, slide) { 
29        return '#views_slideshow_thumbnailhover_div_breakout_teaser_' + settings.id + '_' + idx; 
30      },
31      after:function(curr, next, opts) {
32        // Used for Image Counter.
33        if (settings.image_count) {
34          $('#views_slideshow_thumbnailhover_image_count_' + settings.id + ' span.num').html(opts.currSlide + 1);
35          $('#views_slideshow_thumbnailhover_image_count_' + settings.id + ' span.total').html(opts.slideCount);
36        }
37      },
38      before:function(current, next) {
39        if (settings.fixed_height == 0) {
40          //get the height of the current slide
41          var $ht = $(this).height();
42          //set the container's height to that of the current slide
43          $(this).parent().animate({height: $ht});
44        }
45        
46        var currId = (currId=$(current).attr('id')).substring(currId.lastIndexOf('_')+1)
47        var nextId = (nextId=$(next).attr('id')).substring(nextId.lastIndexOf('_')+1)
48        $('#views_slideshow_thumbnailhover_div_breakout_teaser_' + settings.id + '_' + currId).removeClass('activeSlide');
49        $('#views_slideshow_thumbnailhover_div_breakout_teaser_' + settings.id + '_' + nextId).addClass('activeSlide');
50      },
51      pagerEvent: (settings.pager_event == 'hoverIntent') ? null : settings.pager_event,
52      prev:(settings.controls > 0)?'#views_slideshow_thumbnailhover_prev_' + settings.id:null,
53      next:(settings.controls > 0)?'#views_slideshow_thumbnailhover_next_' + settings.id:null,
54      cleartype:(settings.ie.cleartype == 'true')? true : false,
55      cleartypeNoBg:(settings.ie.cleartypenobg == 'true')? true : false
56    };
57    
58    if (settings.effect == 'none') {
59      settings.opts.speed = 1;
60    }
61    else {
62      settings.opts.fx = settings.effect;
63    }
64		
65		// Pause on hover.
66    if (settings.pause == 1) {
67      $('#views_slideshow_thumbnailhover_teaser_section_' + settings.id).hover(function() {
68        $(settings.targetId).cycle('pause');
69      }, function() {
70        if (settings.paused == false) {
71          $(settings.targetId).cycle('resume');
72        }
73      });
74    }
75
76    // Pause on clicking of the slide.
77    if (settings.pause_on_click == 1) {
78      $('#views_slideshow_thumbnailhover_teaser_section_' + settings.id).click(function() { 
79        viewsSlideshowPause(settings);
80      });
81    }
82    
83    // Add additional settings.
84		if (settings.advanced != "\n") {
85      var advanced = settings.advanced.split("\n");
86      for (i=0; i<advanced.length; i++) {
87        var prop = '';
88        var value = '';
89        var property = advanced[i].split(":");
90        for (j=0; j<property.length; j++) {
91          if (j == 0) {
92            prop = property[j];
93          }
94          else if (j == 1) {
95            value = property[j];
96          }
97          else {
98            value += ":" + property[j];
99          }
100        }
101
102        // Need to evaluate so true, false and numerics aren't a string.
103        if (value == 'true' || value == 'false' || IsNumeric(value)) {
104          value = eval(value);
105        }
106        else {
107          // Parse strings into functions.
108          var func = value.match(/function\s*\((.*?)\)\s*\{(.*)\}/i);
109          if (func) {
110            value = new Function(func[1].match(/(\w+)/g), func[2]);
111          }
112        }
113	
114        // Call both functions if prop was set previously.
115        if (typeof(value) == "function" && prop in settings.opts) {
116          var callboth = function(before_func, new_func) {
117            return function() {
118              before_func.apply(null, arguments);
119              new_func.apply(null, arguments);
120            };
121          };
122          settings.opts[prop] = callboth(settings.opts[prop], value);
123        }
124        else {
125          settings.opts[prop] = value;
126        }
127      }
128    }
129
130    $(settings.targetId).cycle(settings.opts);
131    
132    // Show image count for people who have js enabled.
133    $('#views_slideshow_thumbnailhover_image_count_' + settings.id).show();
134    
135    if (settings.pager_event == 'hoverIntent') {
136      $('#views_slideshow_thumbnailhover_breakout_teasers_' + settings.id + ' .views_slideshow_thumbnailhover_div_breakout_teaser').each(function(i,obj) {
137        $(obj).hoverIntent(
138          function() {
139            $('.views_slideshow_thumbnailhover_div_breakout_teaser').removeClass('activeSlide');
140            var id = $(this).attr('id');
141            id = parseInt(id.substring(id.lastIndexOf('_')+1));
142            $(settings.targetId).cycle(id);
143            $('#views_slideshow_thumbnailhover_div_breakout_teaser_' + settings.id + '_' + id).addClass('activeSlide');
144            $(settings.targetId).cycle('stop');
145          },
146          function() {
147            var id = $(this).attr('id');
148            settings.opts.startingSlide = parseInt(id.substring(id.lastIndexOf('_')+1));
149            $(settings.targetId).cycle(settings.opts);
150          }
151        );
152      });
153    }
154
155    if (settings.controls > 0) {
156      // Show controls for people who have js enabled browsers.
157      $('#views_slideshow_thumbnailhover_controls_' + settings.id).show();
158      
159      $('#views_slideshow_thumbnailhover_playpause_' + settings.id).click(function(e) {
160        if (settings.paused) {
161          viewsSlideshowThumbnailHoverResume(settings);
162        }
163        else {
164          viewsSlideshowThumbnailHoverPause(settings);
165        }
166        e.preventDefault();
167      });
168    }
169  });
170}
171
172// Pause the slideshow 
173viewsSlideshowThumbnailHoverPause = function (settings) {
174  $(settings.targetId).cycle('pause');
175  if (settings.controls > 0) {
176    $('#views_slideshow_thumbnailhover_playpause_' + settings.id)
177      .addClass('views_slideshow_thumbnailhover_play')
178      .addClass('views_slideshow_play')
179      .removeClass('views_slideshow_thumbnailhover_pause')
180      .removeClass('views_slideshow_pause')
181      .text('Resume');
182  }
183  settings.paused = true;
184}
185
186// Resume the slideshow
187viewsSlideshowThumbnailHoverResume = function (settings) {
188  $(settings.targetId).cycle('resume');
189  if (settings.controls > 0) {
190    $('#views_slideshow_thumbnailhover_playpause_' + settings.id)
191      .addClass('views_slideshow_thumbnailhover_pause')
192      .addClass('views_slideshow_pause')
193      .removeClass('views_slideshow_thumbnailhover_play')
194      .removeClass('views_slideshow_play')
195      .text('Pause');
196  }
197  settings.paused = false;
198}
199
200// Verify that the value is a number.
201function IsNumeric(sText) {
202  var ValidChars = "0123456789";
203  var IsNumber=true;
204  var Char;
205
206  for (i=0; i < sText.length && IsNumber == true; i++) { 
207    Char = sText.charAt(i); 
208    if (ValidChars.indexOf(Char) == -1) {
209      IsNumber = false;
210    }
211  }
212  return IsNumber;
213}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.