PageSourceSearch

https://vildmarken.se/wp-content/plugins/tv-schedule/js/tvschedule.js?ver=1.5.2

js vildmarken.se collected 2026-09-26 15:23:52 UTC 17,911 bytes, 489 lines download raw bytes

1;(function($){
2	'use strict';
3	
4	$(document).ready(function() {
5
6		var ex_html_width;
7		ex_html_width = $('html').width();
8		$( window ).resize(function() {
9			$('html').css("max-width","");
10
11			ex_html_width = $('html').width();
12			if ($(".extvs_modal.extvs-modal-active").css("display") =='block') {
13				$('html').css("max-width",ex_html_width);
14			}
15		});
16
17		$('.extvs-collapse .ex-parent-simple').on('click','.item-tvs', function(event) {
18			if(event.target.tagName.toLowerCase() == "a"){
19		        return;
20		    }
21			event.preventDefault();    
22			$(this).toggleClass('item-tvs-expand');
23	    });
24		$('.extvs-modal .ex-parent-simple, .extvs-modal .extvs-advance-parent').on('click','.item-tvs', function(event) {
25			event.preventDefault();
26			var $this_click = $(this);
27			var data = $this_click.find('.extvs-show-modal').html();
28			var image_url = $this_click.find('.tvs_modal_img').attr('data-img');
29			if (data.includes("#chanel_image")) {
30				data = data.replace("#chanel_image", image_url);
31			}
32			
33			$("#extvs_modal").empty();
34			$("#extvs_modal").append(data);
35			$('html').css("max-width",ex_html_width);
36	        $("html").fadeIn("slow", function() {
37			    $(this).addClass('extvs-hidden-scroll');
38			});
39			$("#extvs_modal").css("display", "block");
40			$("#extvs_modal").addClass('extvs-modal-active');
41	    });
42
43	    $(".extvs-collapse .extvs-advance-parent").on({
44		    mouseenter: function () {
45		        var $this_click = $(this);
46		        var data = $this_click.find('.tvs-collapse-content').html();
47				var image_url = $this_click.find('input[name=collapse_img]').val();
48				if(image_url != undefined && image_url!=''){
49					data = data.replace("#collapse_image", image_url);
50				}
51				$this_click.find('.tvs-collapse-content').empty();
52				$this_click.find('.tvs-collapse-content').append(data);
53			},
54		    mouseleave: function () {
55		        var $this_click = $(this);
56		    }
57		},'.item-tvs');
58		function extvs_qtip($id){
59			if($id==''){
60				var $elm = '.ex-tvs-advance.extvs-collapse .item-tvs';
61			}else{
62				var $elm = '#'+$id+'.ex-tvs-advance.extvs-collapse .item-tvs';
63			}
64		    $($elm).each(function() {
65				$(this).qtip({
66					style: {
67						tip: {
68							corner: false,
69							width: 12
70						},
71						classes: 'extvs-qtip'
72					},
73					content: {
74						text: $(this).find('.extvs-show-collapse')
75					},
76					position: {
77						target:'mouse',
78						viewport: $('.extvs-advance-info'),
79					},
80				});
81			});
82		}
83		extvs_qtip('');
84		$(".ex-tvs-plug #extvs_modal").on("click", ".extvs_close",function(event){
85	    	event.preventDefault();
86	    	var $this = $(this);
87	        $("#extvs_modal").css("display", "none");
88			$('html').removeClass('extvs-hidden-scroll');
89			$("#extvs_modal").removeClass('extvs-modal-active');
90			$('html').css("max-width","");
91	    });
92		$('.ex-tvs-plug .extvs_modal').on('click', function (event) {
93			if (event.target.className == 'extvs_modal extvs-modal-active') {
94				event.preventDefault();
95				$(this).css("display", "none");
96				$('html').removeClass('extvs-hidden-scroll');
97				$(this).removeClass('extvs-modal-active');
98				$('html').css("max-width","");
99			}
100		});
101		// Dropdown select chanel
102		$('.extvs-dropdown').on('click', function () {
103		        //$(this).attr('tabindex', 1).focus();
104		        $(this).toggleClass('extvs-active');
105		        $(this).find('.extvs-dropdown-chanel').slideToggle(300);
106		    });
107		$('.extvs-dropdown').on('focusout', function () {
108		    $(this).removeClass('extvs-active');
109		    $(this).find('.extvs-dropdown-chanel').slideUp(300);
110		});
111		$('.extvs-dropdown .extvs-dropdown-chanel li').on('click', function (event) {
112			event.preventDefault();
113	    	var $this_click = $(this);
114		    $(this).closest('.extvs-dropdown').find('span').text($(this).data('display'));
115		    var id_parent = $this_click.closest(".ex-tvs-simple").attr('id');
116		    
117		    var date = $('#'+id_parent+' .extvs-date-day-at').data('date');
118		    var chanel = $this_click.data('value');
119		    $('#'+id_parent+' input[name=chanel_selected]').val(chanel);
120		    extvs_simple_load(date,chanel,id_parent);
121		});
122		// End Dropdown
123
124	    $('.ex-tvs-simple .ex-date-list-parent .extvs-date-day').on('click', function(event) {
125	    	event.preventDefault();
126	    	var $this_click = $(this);
127	    	var id_parent = $this_click.closest(".ex-tvs-simple").attr('id');
128	    	$('#'+id_parent).find('.extvs-date-day').removeClass('extvs-date-day-at');
129	    	$this_click.addClass('extvs-date-day-at');
130	    	
131	    	var date = $this_click.data('date');
132	    	var chanel = $('#'+id_parent+' input[name=chanel_selected]').val();
133	    	extvs_simple_load(date,chanel,id_parent);
134	    });
135
136	    $('.ex-chanel-list .extvs-inline-select, .extvs-style3-chanel .extvs-inline-select').on('click', function(event) {
137			event.preventDefault();
138			var $this_click = $(this);
139			var id_parent = $this_click.closest(".ex-tvs-simple").attr('id');
140			$('#'+id_parent).find('.extvs-inline-select').removeClass('extvs-inline-at');
141	    	$this_click.addClass('extvs-inline-at');
142			var date = $('#'+id_parent+' .extvs-date-day-at').data('date');
143	    	var chanel = $this_click.data('value');
144	    	$('#'+id_parent+' input[name=chanel_selected]').val(chanel);
145	    	extvs_simple_load(date,chanel,id_parent);
146			return false;
147		});
148
149	    $('.ex-chanel-list select[name=extvs_channel]').on('change',function(event) {
150			event.preventDefault();
151			var $this_click = $(this);
152			var id_parent = $this_click.closest(".ex-tvs-simple").attr('id');
153			var date = $('#'+id_parent+' .extvs-date-day-at').data('date');
154	    	var chanel = $this_click.val();
155	    	$('#'+id_parent+' input[name=chanel_selected]').val(chanel);
156	    	extvs_simple_load(date,chanel,id_parent);
157			return false;
158		});
159	    function extvs_simple_load(date,chanel,id_crsc){
160	    	if($('#'+id_crsc).hasClass('ex-loading')){return;}
161	    	$('#'+id_crsc).addClass('ex-loading');
162	    	var ajax_url  		= $('#'+id_crsc+' input[name=ajax_url]').val();
163	    	var param_shortcode  		= $('#'+id_crsc+' input[name=param_shortcode]').val();
164	    	var param = {
165				action: 'extvs_get_schedule_simple',
166				param_shortcode: param_shortcode,
167				date: date,
168				chanel: chanel,
169			};
170			$.ajax({
171				type: "post",
172				url: ajax_url,
173				dataType: 'json',
174				data: (param),
175				success: function(data){
176					if(data != '0')
177					{
178						var $showin = $('#'+id_crsc+' .ex-parent-simple');
179						$($showin).fadeOut({
180							duration:0,
181							complete:function(){
182								$( this ).empty();
183								$showin.append(data.html).fadeIn();
184							}
185						});
186						
187						$('#'+id_crsc).removeClass('ex-loading');
188						if (data.current_day == 'no') {
189							$('#'+id_crsc).find('.extvs-hide-ps').css("display", "none");
190						}else{
191							$('#'+id_crsc).find('.extvs-hide-ps').css("display", "block");
192						}
193					}else{}
194				}
195			});
196	    }
197
198	    //Advance load
199	    $('.extvs-advance-date .extvs-addate-day').on('click', function(event) {
200	    	event.preventDefault();
201	    	var $this_click = $(this);
202	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
203	    	$('#'+id_parent).find('.extvs-addate-day').removeClass('extvs-addate-day-at');
204	    	$this_click.addClass('extvs-addate-day-at');
205	    	
206	    	var date = $this_click.data('date');
207	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
208	    	extvs_advance_load(date,id_parent);
209	    });
210
211	    $('.ex-tvs-advance .ex-date-list-parent .extvs-date-day').on('click', function(event) {
212	    	event.preventDefault();
213	    	var $this_click = $(this);
214	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
215	    	$('#'+id_parent).find('.extvs-date-day').removeClass('extvs-date-day-at');
216	    	$this_click.addClass('extvs-date-day-at');
217	    	
218	    	var date = $this_click.data('date');
219	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
220	    	extvs_advance_load(date,id_parent);
221	    });
222
223	    $('.ex-tvs-advance .extvs-ad-list-week .extvs-date-adweek').on('click', function(event) {
224	    	event.preventDefault();
225	    	var $this_click = $(this);
226	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
227	    	$('#'+id_parent).find('.extvs-date-adweek').removeClass('extvs-ad-list-week-ac');
228	    	$this_click.addClass('extvs-ad-list-week-ac');
229	    	
230	    	var date = $this_click.data('date');
231	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
232	    	extvs_advance_load(date,id_parent);
233	    });
234
235	    function extvs_advance_load(date,id_crsc){
236	    	if($('#'+id_crsc).hasClass('ex-loading')){return;}
237	    	$('#'+id_crsc).addClass('ex-loading');
238	    	var ajax_url  		= $('#'+id_crsc+' input[name=ajax_url]').val();
239	    	var param_shortcode  		= $('#'+id_crsc+' input[name=param_shortcode]').val();
240	    	var param = {
241				action: 'extvs_get_schedule_advance',
242				param_shortcode: param_shortcode,
243				date: date,
244			};
245			$.ajax({
246				type: "post",
247				url: ajax_url,
248				dataType: 'json',
249				data: (param),
250				success: function(data){
251					if(data != '0')
252					{
253						var $showin = $('#'+id_crsc+' .extvs-advance-program');
254						$($showin).fadeOut({
255							duration:0,
256							complete:function(){
257								$( this ).empty();
258							}
259						});
260						$showin.append(data.html).fadeIn();
261						extvs_qtip(id_crsc);
262						$('#'+id_crsc).removeClass('ex-loading');
263					}else{}
264				}
265			});
266	    }
267	    // Date carousel
268		jQuery('.ex-tvs-simple').each(function(){
269			var $this = jQuery(this);
270			var id =  $this.attr('id');
271			var slidesshow =  $this.data('slidesshow');
272			var slidesscroll =  $this.data('slidesscroll');
273			if(slidesshow==''){ slidesshow = 7;}
274			if (slidesscroll==''){ slidesscroll = 3;}
275			var start_on =  $this.data('start_on') >= 0 ? $this.data('start_on') : 5;
276			var item_tablet =  $this.data('item_tablet') > 0 ? $this.data('item_tablet') : 3;
277			var rtl_mode = $this.data('rtl');
278			if($this.data('infinite')=='0'){
279			  var infinite = 0;
280			}else{
281			  var infinite =  $this.data('infinite') == 'yes' || $this.data('infinite') == '1' ? true : false;
282			}
283			extvs_carousel('#'+id+' .ex-date-list',infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode);
284		});
285		extvs_scroll();
286		function extvs_scroll(){
287			jQuery('.ex-tvs-advance').each(function(){
288				var $this = jQuery(this);
289				var id_parent =  $this.attr('id');
290				var pixel_perminutes = 0;
291				var total_width;
292				if ($this.hasClass('extvs-range-5m')) {
293					pixel_perminutes = 24;
294					total_width = 34560;
295					/*- 24h * 16sl( 1 = 16slots) * 6 (1sl = 5) *20  -*/
296				}else
297				if ($this.hasClass('extvs-range-10m')) {
298					pixel_perminutes = 12;
299					total_width = 17280;
300				}else
301				if ($this.hasClass('extvs-range-15m')) {
302					pixel_perminutes = 8;
303					total_width = 11520;
304				}else
305				if ($this.hasClass('extvs-range-30m')) {
306					pixel_perminutes = 4;
307					total_width = 5760;
308				}else if($this.hasClass('extvs-range-1h')){
309					pixel_perminutes = 2;
310					total_width = 2880;
311				}else{
312					pixel_perminutes = 1;
313					total_width = 1440;
314				}
315				var array_time,hours,minutes;
316				var scroll_to_time = $('#'+id_parent+' input[name=tvs_scroll_time]').val().replace(/\s/g,'');
317				if (scroll_to_time !='') {
318					array_time = scroll_to_time.split(":");
319					hours = parseInt(array_time[0]);
320					minutes = parseInt(array_time[1]);
321				}else{
322					array_time = $('#extvs_current_input').val().split(",");
323					hours = parseInt(array_time[0]);
324					minutes = parseInt(array_time[1]);
325				}
326
327				var scroll = (hours*60 + minutes) * pixel_perminutes;
328				var min_time = $('#'+id_parent+' input[name=tvs_min_time]').val();
329				if(min_time!=''){
330					scroll = parseInt((hours*60 + minutes) - parseInt(min_time)) * pixel_perminutes;
331				}$('#'+id_parent+' .extvs-advance-detail').attr('data-scroll',scroll);
332				if (scroll > 240) {
333					scroll = scroll - 240;
334				}
335				var rtl_mode = $('#'+id_parent).data('rtl');
336				if (rtl_mode == 'yes') {
337					scroll = total_width - scroll - 480;
338					$('#'+id_parent+' .extvs-advance-detail').scrollLeft(scroll);
339				}else{
340					$('#'+id_parent+' .extvs-advance-detail').scrollLeft(scroll);
341				}
342			});
343		}
344
345		jQuery('.ex-tvs-advance').each(function(){
346			var $this = jQuery(this);
347			var id =  $this.attr('id');
348			var slidesshow =  $this.data('slidesshow');
349			var slidesscroll =  $this.data('slidesscroll');
350			if(slidesshow=='' || slidesshow < 0){ slidesshow = 7;}
351			if (slidesscroll=='' || slidesscroll < 0){ slidesscroll = 3;}
352			var start_on =  $this.data('start_on') >= 0 ? $this.data('start_on') : 5;
353			var item_tablet =  $this.data('item_tablet') > 0 ? $this.data('item_tablet') : 3;
354			var rtl_mode = $this.data('rtl');
355			if($this.data('infinite')=='0'){
356			  var infinite = 0;
357			}else{
358			  var infinite =  $this.data('infinite') == 'yes' || $this.data('infinite') == '1' ? true : false;
359			}
360			extvs_carousel('#'+id+' .ex-date-list',infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode);
361		});
362
363		function extvs_carousel(id_clas,infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode){
364			var $center = $(id_clas).closest('.ex-tvs-simple, .ex-tvs-advance').data('center')=='no' ? false : true ;
365			if($(window).width() < 767){
366				var $before = $(id_clas).closest('.ex-tvs-simple, .ex-tvs-advance').attr('data-before');
367				start_on = $before > 0 ? $before : start_on;
368			}
369			$(id_clas).exo_wlCarousel({
370			    loop:false,
371			    // margin:10,
372			    nav:false,
373			    dots: false,
374			    center: $center,
375			    items:slidesshow,
376			    startPosition:start_on,
377			    rtl: rtl_mode =='yes' ? true : false,
378			    // animateOut: 'fadeOut',
379			    slideBy:slidesscroll,
380			    responsive:{
381			        0:{
382			            items:1
383			        },
384			        600:{
385			            items:item_tablet
386			        },
387			        1000:{
388			            items:slidesshow
389			        }
390			    }
391			});
392			$(id_clas).on('changed.exo_wl.carousel', function(event) {
393		        var currentItem = event.item.index;
394		        var total = event.item.count;
395		        var id_parent = $(id_clas).closest(".ex-tvs-simple").attr('id');
396		        if(currentItem == 0){
397		        	$('#'+id_parent+' .extvs-prev-bt').addClass('disabled');
398		        }else if(currentItem == (total -1)){
399		        	$('#'+id_parent+' .extvs-next-bt').addClass('disabled');
400		        }else{
401		        	$('#'+id_parent+' .extvs-prev-bt').removeClass('disabled');
402		        	$('#'+id_parent+' .extvs-next-bt').removeClass('disabled');
403		        }
404		        
405		    });
406		}
407
408		jQuery('.extvs-prev-bt').on('click', function(event) {
409			var $this = jQuery(this);
410			var id_advance = $this.closest(".ex-tvs-advance").attr('id');
411			if (id_advance != undefined) {
412				var exo_wl = $('#'+id_advance+' .ex-date-list');
413				exo_wl.trigger('prev.exo_wl.carousel');
414				return false;
415			}
416			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
417			var exo_wl = $('#'+id_parent+' .ex-date-list');
418			var rtl_mode =$('#'+id_parent).data('rtl');
419			if (rtl_mode == 'yes') {
420				exo_wl.trigger('next.exo_wl.carousel');
421			}else{
422				exo_wl.trigger('prev.exo_wl.carousel');
423			}
424			if ($('#'+id_parent).hasClass('ex-tvs-slide1')) {
425				$('#'+id_parent+' .extvs-date-day.extvs-date-day-at').removeClass('extvs-date-day-at');
426				$('#'+id_parent+' .ex-date-list .exo_wl-stage .exo_wl-item.active .extvs-date-day').addClass('extvs-date-day-at');
427				var date = $('#'+id_parent+' .extvs-date-day.extvs-date-day-at').data('date');
428		    	var chanel = $('#'+id_parent+' input[name=chanel_selected]').val();
429		    	extvs_simple_load(date,chanel,id_parent);
430			}
431			return false;
432		});
433		jQuery('.extvs-next-bt').on('click', function(event) {
434			var $this = jQuery(this);
435			var id_advance = $this.closest(".ex-tvs-advance").attr('id');
436			if (id_advance != undefined) {
437				var exo_wl = $('#'+id_advance+' .ex-date-list');
438				exo_wl.trigger('next.exo_wl.carousel');
439				return false;
440			}
441			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
442			var exo_wl = $('#'+id_parent+' .ex-date-list');
443			var rtl_mode =$('#'+id_parent).data('rtl');
444			if (rtl_mode == 'yes') {
445				exo_wl.trigger('prev.exo_wl.carousel');
446			}else{
447				exo_wl.trigger('next.exo_wl.carousel');
448			}
449			if ($('#'+id_parent).hasClass('ex-tvs-slide1')) {
450				$('#'+id_parent+' .extvs-date-day.extvs-date-day-at').removeClass('extvs-date-day-at');
451				$('#'+id_parent+' .ex-date-list .exo_wl-stage .exo_wl-item.active .extvs-date-day').addClass('extvs-date-day-at');
452				var date = $('#'+id_parent+' .extvs-date-day.extvs-date-day-at').data('date');
453		    	var chanel = $('#'+id_parent+' input[name=chanel_selected]').val();
454		    	extvs_simple_load(date,chanel,id_parent);
455			}
456			return false;
457		});
458
459		$('.ex-tvs-simple .extvs-hide-ps1').on('click', function(event) {
460			event.preventDefault();
461			var $this = jQuery(this);
462			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
463			if ($('#'+id_parent).hasClass('extvs-hide-past')) {
464				$('#'+id_parent).removeClass('extvs-hide-past');
465			}else{
466				$('#'+id_parent).addClass('extvs-hide-past');
467			}
468
469	    });
470	    // open lightbox
471	    var hash = window.location.hash.substr(1);
472		//console.log(hash);
473		if(hash!=''){
474			var contenId = '.item-tvs a[href="#'+hash+'"]';
475			//console.log(contenId);
476			if($(contenId).length){
477				$(contenId).closest('.item-tvs').trigger('click');
478				return;
479			}
480		}
481		//
482		$('.md-date.extvs-ical a').click(function(e){
483		   e.stopPropagation();
484		});
485		
486
487    });
488    // sort table
489}(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.