PageSourceSearch

https://www.hotelfelice.com/templates/template_3/js/ticker-slides.js

js hotelfelice.com collected 2026-10-02 00:07:00 UTC 22,053 bytes, 646 lines download raw bytes

1// Generated by CoffeeScript 1.6.1
2(function() {
3
4  (function($, window, document) {
5    var Plugin, defaults, pluginName;
6    pluginName = "slidesjs";
7    defaults = {
8      width: 940,
9      height: 528,
10      start: 1,
11      navigation: {
12        active: true,
13        effect: "slide"
14      },
15      pagination: {
16        active: true,
17        effect: "slide"
18      },
19      play: {
20        active: false,
21        effect: "slide",
22        interval: 5000,
23        auto: false,
24        swap: true,
25        pauseOnHover: false,
26        restartDelay: 2500
27      },
28      effect: {
29        slide: {
30          speed: 500
31        },
32        fade: {
33          speed: 300,
34          crossfade: true
35        }
36      },
37      callback: {
38        loaded: function() {},
39        start: function() {},
40        complete: function() {}
41      }
42    };
43    Plugin = (function() {
44
45      function Plugin(element, options) {
46        this.element = element;
47        this.options = $.extend(true, {}, defaults, options);
48        this._defaults = defaults;
49        this._name = pluginName;
50        this.init();
51      }
52
53      return Plugin;
54
55    })();
56    Plugin.prototype.init = function() {
57      var $element, nextButton, pagination, playButton, prevButton, stopButton,
58        _this = this;
59      $element = $(this.element);
60      this.data = $.data(this);
61      $.data(this, "animating", false);
62      $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length);
63      $.data(this, "current", this.options.start - 1);
64      $.data(this, "vendorPrefix", this._getVendorPrefix());
65      if (typeof TouchEvent !== "undefined") {
66        $.data(this, "touch", true);
67        this.options.effect.slide.speed = this.options.effect.slide.speed / 2;
68      }
69      $element.css({
70        overflow: "hidden"
71      });
72      $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("<div class='slidesjs-container'>", $element).parent().css({
73        overflow: "hidden",
74        position: "relative"
75      });
76      $(".slidesjs-container", $element).wrapInner("<div class='slidesjs-control'>", $element).children();
77      $(".slidesjs-control", $element).css({
78        position: "relative",
79        left: 0
80      });
81      $(".slidesjs-control", $element).children().addClass("slidesjs-slide").css({
82        position: "absolute",
83        top: 0,
84        left: 0,
85        width: "100%",
86        zIndex: 0,
87        display: "none",
88        webkitBackfaceVisibility: "hidden"
89      });
90      $.each($(".slidesjs-control", $element).children(), function(i) {
91        var $slide;
92        $slide = $(this);
93        return $slide.attr("slidesjs-index", i);
94      });
95      if (this.data.touch) {
96        $(".slidesjs-control", $element).on("touchstart", function(e) {
97          return _this._touchstart(e);
98        });
99        $(".slidesjs-control", $element).on("touchmove", function(e) {
100          return _this._touchmove(e);
101        });
102        $(".slidesjs-control", $element).on("touchend", function(e) {
103          return _this._touchend(e);
104        });
105      }
106      $element.fadeIn(0);
107      this.update();
108      if (this.data.touch) {
109        this._setuptouch();
110      }
111      $(".slidesjs-control", $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() {
112        return $(this).css({
113          zIndex: 10
114        });
115      });
116      if (this.options.navigation.active) {
117        prevButton = $("<a>", {
118          "class": "slidesjs-previous slidesjs-navigation",
119          href: "#",
120          title: "Previous",
121          text: "Previous"
122        }).appendTo($element);
123        nextButton = $("<a>", {
124          "class": "slidesjs-next slidesjs-navigation",
125          href: "#",
126          title: "Next",
127          text: "Next"
128        }).appendTo($element);
129      }
130      $(".slidesjs-next", $element).click(function(e) {
131        e.preventDefault();
132        _this.stop(true);
133        return _this.next(_this.options.navigation.effect);
134      });
135      $(".slidesjs-previous", $element).click(function(e) {
136        e.preventDefault();
137        _this.stop(true);
138        return _this.previous(_this.options.navigation.effect);
139      });
140      if (this.options.play.active) {
141        playButton = $("<a>", {
142          "class": "slidesjs-play slidesjs-navigation",
143          href: "#",
144          title: "Play",
145          text: "Play"
146        }).appendTo($element);
147        stopButton = $("<a>", {
148          "class": "slidesjs-stop slidesjs-navigation",
149          href: "#",
150          title: "Stop",
151          text: "Stop"
152        }).appendTo($element);
153        playButton.click(function(e) {
154          e.preventDefault();
155          return _this.play(true);
156        });
157        stopButton.click(function(e) {
158          e.preventDefault();
159          return _this.stop(true);
160        });
161        if (this.options.play.swap) {
162          stopButton.css({
163            display: "none"
164          });
165        }
166      }
167      if (this.options.pagination.active) {
168        pagination = $("<ul>", {
169          "class": "slidesjs-pagination"
170        }).appendTo($element);
171        $.each(new Array(this.data.total), function(i) {
172          var paginationItem, paginationLink;
173          paginationItem = $("<li>", {
174            "class": "slidesjs-pagination-item"
175          }).appendTo(pagination);
176          paginationLink = $("<a>", {
177            href: "#",
178            "data-slidesjs-item": i,
179            html: i + 1
180          }).appendTo(paginationItem);
181          return paginationLink.click(function(e) {
182            e.preventDefault();
183            _this.stop(true);
184            return _this.goto(($(e.currentTarget).attr("data-slidesjs-item") * 1) + 1);
185          });
186        });
187      }
188      this._setActive();
189      if (this.options.play.auto) {
190        this.play();
191      }
192      return this.options.callback.loaded(this.options.start);
193    };
194    Plugin.prototype._setActive = function(number) {
195      var $element, current;
196      $element = $(this.element);
197      this.data = $.data(this);
198      current = number > -1 ? number : this.data.current;
199      $(".active", $element).removeClass("active");
200      return $(".slidesjs-pagination li:eq(" + current + ") a", $element).addClass("active");
201    };
202    Plugin.prototype.update = function() {
203      var $element, height, width;
204      $element = $(this.element);
205      this.data = $.data(this);
206      $(".slidesjs-control", $element).children(":not(:eq(" + this.data.current + "))").css({
207        display: "none",
208        left: 0,
209        zIndex: 0
210      });
211      width = $element.width();
212      height = (this.options.height / this.options.width) * width;
213      this.options.width = width;
214      this.options.height = height;
215      return $(".slidesjs-control, .slidesjs-container", $element).css({
216        width: width,
217        height: height
218      });
219    };
220    Plugin.prototype.next = function(effect) {
221      var $element;
222      $element = $(this.element);
223      this.data = $.data(this);
224      $.data(this, "direction", "next");
225      if (effect === void 0) {
226        effect = this.options.navigation.effect;
227      }
228      if (effect === "fade") {
229        return this._fade();
230      } else {
231        return this._slide();
232      }
233    };
234    Plugin.prototype.previous = function(effect) {
235      var $element;
236      $element = $(this.element);
237      this.data = $.data(this);
238      $.data(this, "direction", "previous");
239      if (effect === void 0) {
240        effect = this.options.navigation.effect;
241      }
242      if (effect === "fade") {
243        return this._fade();
244      } else {
245        return this._slide();
246      }
247    };
248    Plugin.prototype.goto = function(number) {
249      var $element, effect;
250      $element = $(this.element);
251      this.data = $.data(this);
252      if (effect === void 0) {
253        effect = this.options.pagination.effect;
254      }
255      if (number > this.data.total) {
256        number = this.data.total;
257      } else if (number < 1) {
258        number = 1;
259      }
260      if (typeof number === "number") {
261        if (effect === "fade") {
262          return this._fade(number);
263        } else {
264          return this._slide(number);
265        }
266      } else if (typeof number === "string") {
267        if (number === "first") {
268          if (effect === "fade") {
269            return this._fade(0);
270          } else {
271            return this._slide(0);
272          }
273        } else if (number === "last") {
274          if (effect === "fade") {
275            return this._fade(this.data.total);
276          } else {
277            return this._slide(this.data.total);
278          }
279        }
280      }
281    };
282    Plugin.prototype._setuptouch = function() {
283      var $element, next, previous, slidesControl;
284      $element = $(this.element);
285      this.data = $.data(this);
286      slidesControl = $(".slidesjs-control", $element);
287      next = this.data.current + 1;
288      previous = this.data.current - 1;
289      if (previous < 0) {
290        previous = this.data.total - 1;
291      }
292      if (next > this.data.total - 1) {
293        next = 0;
294      }
295      slidesControl.children(":eq(" + next + ")").css({
296        display: "block",
297        left: this.options.width
298      });
299      return slidesControl.children(":eq(" + previous + ")").css({
300        display: "block",
301        left: -this.options.width
302      });
303    };
304    Plugin.prototype._touchstart = function(e) {
305      var $element, touches;
306      $element = $(this.element);
307      this.data = $.data(this);
308      touches = e.originalEvent.touches[0];
309      this._setuptouch();
310      $.data(this, "touchtimer", Number(new Date()));
311      $.data(this, "touchstartx", touches.pageX);
312      $.data(this, "touchstarty", touches.pageY);
313      return e.stopPropagation();
314    };
315    Plugin.prototype._touchend = function(e) {
316      var $element, duration, prefix, slidesControl, timing, touches, transform,
317        _this = this;
318      $element = $(this.element);
319      this.data = $.data(this);
320      touches = e.originalEvent.touches[0];
321      slidesControl = $(".slidesjs-control", $element);
322      if (slidesControl.position().left > this.options.width * 0.5 || slidesControl.position().left > this.options.width * 0.1 && (Number(new Date()) - this.data.touchtimer < 250)) {
323        $.data(this, "direction", "previous");
324        this._slide();
325      } else if (slidesControl.position().left < -(this.options.width * 0.5) || slidesControl.position().left < -(this.options.width * 0.1) && (Number(new Date()) - this.data.touchtimer < 250)) {
326        $.data(this, "direction", "next");
327        this._slide();
328      } else {
329        prefix = this.data.vendorPrefix;
330        transform = prefix + "Transform";
331        duration = prefix + "TransitionDuration";
332        timing = prefix + "TransitionTimingFunction";
333        slidesControl[0].style[transform] = "translateX(0px)";
334        slidesControl[0].style[duration] = this.options.effect.slide.speed * 0.85 + "ms";
335      }
336      slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
337        prefix = _this.data.vendorPrefix;
338        transform = prefix + "Transform";
339        duration = prefix + "TransitionDuration";
340        timing = prefix + "TransitionTimingFunction";
341        slidesControl[0].style[transform] = "";
342        slidesControl[0].style[duration] = "";
343        return slidesControl[0].style[timing] = "";
344      });
345      return e.stopPropagation();
346    };
347    Plugin.prototype._touchmove = function(e) {
348      var $element, prefix, slidesControl, touches, transform;
349      $element = $(this.element);
350      this.data = $.data(this);
351      touches = e.originalEvent.touches[0];
352      prefix = this.data.vendorPrefix;
353      slidesControl = $(".slidesjs-control", $element);
354      transform = prefix + "Transform";
355      $.data(this, "scrolling", Math.abs(touches.pageX - this.data.touchstartx) < Math.abs(touches.pageY - this.data.touchstarty));
356      if (!this.data.animating && !this.data.scrolling) {
357        e.preventDefault();
358        this._setuptouch();
359        slidesControl[0].style[transform] = "translateX(" + (touches.pageX - this.data.touchstartx) + "px)";
360      }
361      return e.stopPropagation();
362    };
363    Plugin.prototype.play = function(next) {
364      var $element, currentSlide, slidesContainer,
365        _this = this;
366      $element = $(this.element);
367      this.data = $.data(this);
368      if (!this.data.playInterval) {
369        if (next) {
370          currentSlide = this.data.current;
371          this.data.direction = "next";
372          if (this.options.play.effect === "fade") {
373            this._fade();
374          } else {
375            this._slide();
376          }
377        }
378        $.data(this, "playInterval", setInterval((function() {
379          currentSlide = _this.data.current;
380          _this.data.direction = "next";
381          if (_this.options.play.effect === "fade") {
382            return _this._fade();
383          } else {
384            return _this._slide();
385          }
386        }), this.options.play.interval));
387        slidesContainer = $(".slidesjs-container", $element);
388        if (this.options.play.pauseOnHover) {
389          slidesContainer.unbind();
390          slidesContainer.bind("mouseenter", function() {
391            return _this.stop();
392          });
393          slidesContainer.bind("mouseleave", function() {
394            if (_this.options.play.restartDelay) {
395              return $.data(_this, "restartDelay", setTimeout((function() {
396                return _this.play(true);
397              }), _this.options.play.restartDelay));
398            } else {
399              return _this.play();
400            }
401          });
402        }
403        $.data(this, "playing", true);
404        $(".slidesjs-play", $element).addClass("slidesjs-playing");
405        if (this.options.play.swap) {
406          $(".slidesjs-play", $element).hide();
407          return $(".slidesjs-stop", $element).show();
408        }
409      }
410    };
411    Plugin.prototype.stop = function(clicked) {
412      var $element;
413      $element = $(this.element);
414      this.data = $.data(this);
415      clearInterval(this.data.playInterval);
416      if (this.options.play.pauseOnHover && clicked) {
417        $(".slidesjs-container", $element).unbind();
418      }
419      $.data(this, "playInterval", null);
420      $.data(this, "playing", false);
421      $(".slidesjs-play", $element).removeClass("slidesjs-playing");
422      if (this.options.play.swap) {
423        $(".slidesjs-stop", $element).hide();
424        return $(".slidesjs-play", $element).show();
425      }
426    };
427    Plugin.prototype._slide = function(number) {
428      var $element, currentSlide, direction, duration, next, prefix, slidesControl, timing, transform, value,
429        _this = this;
430      $element = $(this.element);
431      this.data = $.data(this);
432      if (!this.data.animating && number !== this.data.current + 1) {
433        $.data(this, "animating", true);
434        currentSlide = this.data.current;
435        if (number > -1) {
436          number = number - 1;
437          value = number > currentSlide ? 1 : -1;
438          direction = number > currentSlide ? -this.options.width : this.options.width;
439          next = number;
440        } else {
441          value = this.data.direction === "next" ? 1 : -1;
442          direction = this.data.direction === "next" ? -this.options.width : this.options.width;
443          next = currentSlide + value;
444        }
445        if (next === -1) {
446          next = this.data.total - 1;
447        }
448        if (next === this.data.total) {
449          next = 0;
450        }
451        this._setActive(next);
452        slidesControl = $(".slidesjs-control", $element);
453        if (number > -1) {
454          slidesControl.children(":not(:eq(" + currentSlide + "))").css({
455            display: "none",
456            left: 0,
457            zIndex: 0
458          });
459        }
460        slidesControl.children(":eq(" + next + ")").css({
461          display: "block",
462          left: value * this.options.width,
463          zIndex: 10
464        });
465        this.options.callback.start(currentSlide + 1);
466        if (this.data.vendorPrefix) {
467          prefix = this.data.vendorPrefix;
468          transform = prefix + "Transform";
469          duration = prefix + "TransitionDuration";
470          timing = prefix + "TransitionTimingFunction";
471          slidesControl[0].style[transform] = "translateX(" + direction + "px)";
472          slidesControl[0].style[duration] = this.options.effect.slide.speed + "ms";
473          return slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
474            slidesControl[0].style[transform] = "";
475            slidesControl[0].style[duration] = "";
476            slidesControl.children(":eq(" + next + ")").css({
477              left: 0
478            });
479            slidesControl.children(":eq(" + currentSlide + ")").css({
480              display: "none",
481              left: 0,
482              zIndex: 0
483            });
484            $.data(_this, "current", next);
485            $.data(_this, "animating", false);
486            slidesControl.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd");
487            slidesControl.children(":not(:eq(" + next + "))").css({
488              display: "none",
489              left: 0,
490              zIndex: 0
491            });
492            if (_this.data.touch) {
493              _this._setuptouch();
494            }
495            return _this.options.callback.complete(next + 1);
496          });
497        } else {
498          return slidesControl.stop().animate({
499            left: direction
500          }, this.options.effect.slide.speed, (function() {
501            slidesControl.css({
502              left: 0
503            });
504            slidesControl.children(":eq(" + next + ")").css({
505              left: 0
506            });
507            return slidesControl.children(":eq(" + currentSlide + ")").css({
508              display: "none",
509              left: 0,
510              zIndex: 0
511            }, $.data(_this, "current", next), $.data(_this, "animating", false), _this.options.callback.complete(next + 1));
512          }));
513        }
514      }
515    };
516    Plugin.prototype._fade = function(number) {
517      var $element, currentSlide, next, slidesControl, value,
518        _this = this;
519      $element = $(this.element);
520      this.data = $.data(this);
521      if (!this.data.animating && number !== this.data.current + 1) {
522        $.data(this, "animating", true);
523        currentSlide = this.data.current;
524        if (number) {
525          number = number - 1;
526          value = number > currentSlide ? 1 : -1;
527          next = number;
528        } else {
529          value = this.data.direction === "next" ? 1 : -1;
530          next = currentSlide + value;
531        }
532        if (next === -1) {
533          next = this.data.total - 1;
534        }
535        if (next === this.data.total) {
536          next = 0;
537        }
538        this._setActive(next);
539        slidesControl = $(".slidesjs-control", $element);
540        slidesControl.children(":eq(" + next + ")").css({
541          display: "none",
542          left: 0,
543          zIndex: 10
544        });
545        this.options.callback.start(currentSlide + 1);
546        if (this.options.effect.fade.crossfade) {
547          slidesControl.children(":eq(" + this.data.current + ")").stop().fadeOut(this.options.effect.fade.speed);
548          return slidesControl.children(":eq(" + next + ")").stop().fadeIn(this.options.effect.fade.speed, (function() {
549            slidesControl.children(":eq(" + next + ")").css({
550              zIndex: 0
551            });
552            $.data(_this, "animating", false);
553            $.data(_this, "current", next);
554            return _this.options.callback.complete(next + 1);
555          }));
556        } else {
557          return slidesControl.children(":eq(" + currentSlide + ")").stop().fadeOut(this.options.effect.fade.speed, (function() {
558            slidesControl.children(":eq(" + next + ")").stop().fadeIn(_this.options.effect.fade.speed, (function() {
559              return slidesControl.children(":eq(" + next + ")").css({
560                zIndex: 10
561              });
562            }));
563            $.data(_this, "animating", false);
564            $.data(_this, "current", next);
565            return _this.options.callback.complete(next + 1);
566          }));
567        }
568      }
569    };
570    Plugin.prototype._getVendorPrefix = function() {
571      var body, i, style, transition, vendor;
572      body = document.body || document.documentElement;
573      style = body.style;
574      transition = "transition";
575      vendor = ["Moz", "Webkit", "Khtml", "O", "ms"];
576      transition = transition.charAt(0).toUpperCase() + transition.substr(1);
577      i = 0;
578      while (i < vendor.length) {
579        if (typeof style[vendor[i] + transition] === "string") {
580          return vendor[i];
581        }
582        i++;
583      }
584      return false;
585    };
586    return $.fn[pluginName] = function(options) {
587      return this.each(function() {
588        if (!$.data(this, "plugin_" + pluginName)) {
589          return $.data(this, "plugin_" + pluginName, new Plugin(this, options));
590        }
591      });
592    };
593  })(jQuery, window, document);
594
595}).call(this);
596
597/** Get Ticker **/
598
599function getTickerHer(){
600    var num_slide = $(".tickerSmall").children().length;
601
602    if(num_slide > 1){
603
604	$(".tickerSmall").slidesjs({
605	    width: 250,
606	    height: 250,
607	    navigation: {active: false, effect: 'slide'},
608	    pagination: {active: true, effect: 'slide'},
609	    effect: {
610		slide: {speed: 1000}
611	    },
612	    play: {
613		active: false,
614		auto: true,
615		interval: 4000,
616		swap: true,
617		effect: 'slide',
618		pauseOnHover: true
619	    }
620	});
621    }
622}
623
624function getTickerDianmico(){
625    var num_slide_ticker_manuale = $("#slidesticker").children().length;
626
627    if(num_slide_ticker_manuale > 1){
628	$("#slidesticker").slidesjs({
629	    width: 250,
630	    height: 250,
631	    navigation: {active: false, effect: 'slide'},
632	    pagination: {active: false, effect: 'slide'},
633	    effect: {
634		slide: {speed: 1000}
635	    },
636	    play: {
637		active: false,
638		auto: true,
639		interval: 4000,
640		swap: true,
641		effect: 'slide',
642		pauseOnHover: true
643	    }
644	});
645    }
646}

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.