PageSourceSearch

https://www.hotelilio.com/wp-content/themes/voyager/js/slideshow.js?ver=4.8.25

js hotelilio.com collected 2026-10-02 12:06:15 UTC 5,734 bytes, 250 lines download raw bytes

1( function( $ ) {
2
3	var THB_RoyalSliderSlideshow = function( $el, options ) {
4
5		var slideshow = this,
6			royalSliderInstance = null,
7			is_mobile = $( "body" ).hasClass( "thb-mobile" );
8
9		options = $.extend( {}, options );
10
11		this.init = function() {
12			$el.royalSlider( options );
13			royalSliderInstance = $el.data( "royalSlider" );
14
15			slideshow.bind();
16		};
17
18		this.bind = function() {
19			royalSliderInstance.ev.on( "rsAfterContentSet rsAfterSlideChange", function() {
20				var slide = slideshow.getCurrentSlide();
21				slide.removeClass( "thb-muted" );
22
23				slideshow.setupSlide( slide );
24
25				if ( slide.data( "autoplay" ) == "1" ) {
26					slideshow.playVideo();
27				}
28			} );
29
30			royalSliderInstance.ev.on( "rsVideoPlay", function() {
31				slideshow.setupSlide( slideshow.getCurrentSlide() );
32			} );
33
34			royalSliderInstance.ev.on( "rsBeforeMove", function() {
35				slideshow.stopVideo();
36			} );
37
38			var slide = slideshow.getCurrentSlide();
39
40			slideshow.setupSlide( slide );
41
42			if ( slide.data( "autoplay" ) == "1" ) {
43				slideshow.playVideo();
44			}
45		};
46
47		this.getCurrentSlide = function() {
48			var slide = $( ".rsActiveSlide .slide", $el );
49
50			if ( ! slide.length ) {
51				slide = $( ".slide", $el ).first();
52			}
53
54			return slide;
55		};
56
57		this.videoCallback = function( state ) {
58			if ( state == "playing" ) {
59				$el.addClass( "rsVideoPlaying" );
60				slideshow.bindVolumeEvents( slideshow.getCurrentSlide() );
61			}
62			else {
63				$el.removeClass( "rsVideoPlaying" );
64
65				royalSliderInstance.stopVideo();
66
67				if ( options.autoPlay && options.autoPlay.enabled ) {
68					royalSliderInstance.startAutoPlay();
69				}
70			}
71		};
72
73		this.bindVolumeEvents = function( slide ) {
74			var video = slideshow.getVideo( slide, true );
75
76			$( ".thb-video-mute", slide ).off( ".thb" );
77			$( ".thb-video-unmute", slide ).off( ".thb" );
78
79			$( ".thb-video-mute", slide ).on( "click.thb", function() {
80				video.data( "player" ).mute();
81				slide.addClass( "thb-muted" );
82
83				return false;
84			} );
85
86			$( ".thb-video-unmute", slide ).on( "click.thb", function() {
87				video.data( "player" ).unMute();
88				slide.removeClass( "thb-muted" );
89
90				return false;
91			} );
92		};
93
94		this.setupSlide = function( slide ) {
95			if ( slide.attr( "data-fill" ) == "1" ) {
96				if ( slide.data( "embed-iframe" ) ) {
97					thb_video_holders( slide, ".rsVideoFrameHolder" );
98				}
99				else {
100					thb_video_holders( slide );
101				}
102			}
103			else {
104				thb_video_holders_off( slide );
105			}
106
107			if ( slide.hasClass( "slide-type-embed" ) ) {
108				if ( ! $( ".thb-video-play", slide ).data( "thbClickBound" ) ) {
109					$( ".thb-video-play", slide ).data( "thbClickBound", true );
110
111					$( ".thb-video-play", slide ).on( "click", function() {
112						slideshow.playVideo();
113						return false;
114					} );
115				}
116
117				if ( ! $( ".thb-video-stop", slide ).data( "thbClickBound" ) ) {
118					$( ".thb-video-stop", slide ).data( "thbClickBound", true );
119
120					$( ".thb-video-stop", slide ).on( "click", function() {
121						slideshow.stopVideo();
122						return false;
123					} );
124				}
125			}
126
127			var video = slideshow.getVideo( slide, true );
128
129			if ( video ) {
130
131				if ( slide.data( "embed-iframe" ) ) {
132					video.get(0).src += '&enablejsapi=1&api=1';
133
134					if ( slide.data( "loop" ) == "1" ) {
135						video.get(0).src += '&loop=1&playlist=' + slide.data( "code" );
136					}
137				}
138				else {
139					if ( slide.data( "muted" ) == "1" ) {
140						video.attr( "muted", "1" );
141					}
142				}
143
144				thb_boot_iframe_video( video );
145
146				if ( video.hasClass( "thb-video-loaded" ) ) {
147					video.off( ".thb" );
148					video.on( "change.thb", function( e, state ) {
149						slideshow.videoCallback( state );
150
151						if ( slide.data( "muted" ) == "1" ) {
152							video.data( "player" ).mute();
153						}
154					} );
155
156					slideshow.bindVolumeEvents( slide );
157				}
158				else {
159					video.off( ".thb" );
160					video.on( "thb-video-loaded.thb", function() {
161						video.on( "change.thb", function( e, state ) {
162							slideshow.videoCallback( state );
163						} );
164
165						if ( slide.data( "muted" ) == "1" ) {
166							video.data( "player" ).mute();
167						}
168
169						slideshow.bindVolumeEvents( slide );
170					} );
171				}
172			}
173
174			$el.trigger( "thbSetupSlide", [ $el, slide ] );
175		};
176
177		this.getVideos = function() {
178			return $( "video", $el );
179		};
180
181		this.getVideo = function( slide, all ) {
182			var selector = "video";
183
184			if ( all ) {
185				selector += ",iframe";
186			}
187
188			var video = $( selector, slide ).first();
189
190			if ( ! video.length ) {
191				video = false;
192			}
193
194			return video;
195		};
196
197		this.playVideo = function() {
198			if ( options.autoPlay && options.autoPlay.enabled ) {
199				royalSliderInstance.stopAutoPlay();
200			}
201
202			var slide = slideshow.getCurrentSlide();
203
204			if ( slide.data( "embed-iframe" ) ) {
205				$el.addClass( "rsVideoPlaying" );
206				royalSliderInstance.playVideo();
207			}
208			else {
209				var video = slideshow.getVideo( slide, true );
210
211				if ( video && video.get( 0 ).play !== undefined ) {
212					$el.addClass( "rsVideoPlaying" );
213
214					setTimeout( function() {
215						video.get( 0 ).play();
216					}, 10 );
217				}
218			}
219		};
220
221		this.stopVideo = function() {
222			var slide = slideshow.getCurrentSlide(),
223				video = slideshow.getVideo( slide, true );
224
225			if ( video ) {
226				if ( slide.data( "embed-iframe" ) ) {
227					royalSliderInstance.stopVideo();
228					slideshow.videoCallback( "finished" );
229				}
230				else {
231					if ( video.get( 0 ).pause !== undefined ) {
232						video.get( 0 ).pause();
233					}
234				}
235			}
236		};
237
238		this.init();
239
240	};
241
242	$.fn.thbRoyalSliderSlideshow = function( options ) {
243		return this.each( function() {
244			if ( ! $( this ).data( "thbRoyalSliderSlideshow" ) ) {
245				$( this ).data( "thbRoyalSliderSlideshow", new THB_RoyalSliderSlideshow( $( this ), options ) );
246			}
247		} );
248	};
249
250} )( jQuery );

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.