PageSourceSearch

https://chco.tv/wp-content/plugins/tv-schedule/js/tvschedule.js?ver=1.5.21

js chco.tv collected 2026-10-10 01:05:31 UTC 19,036 bytes, 526 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	    function extvs_now_reload(id_crsc){
199	    	if($('#'+id_crsc).hasClass('ex-loading')){return;}
200	    	$('#'+id_crsc).addClass('ex-loading');
201	    	var ajax_url  		= $('#'+id_crsc+' input[name=ajax_url]').val();
202	    	var param_shortcode  		= $('#'+id_crsc+' input[name=param_shortcode]').val();
203	    	var param = {
204				action: 'extvs_get_schedule_now',
205				param_shortcode: param_shortcode,
206			};
207			$.ajax({
208				type: "post",
209				url: ajax_url,
210				dataType: 'json',
211				data: (param),
212				success: function(data){
213					if(data != '0')
214					{
215						var $showin = $('#'+id_crsc+' .ex-parent-simple');
216						$($showin).fadeOut({
217							duration:0,
218							complete:function(){
219								$( this ).empty();
220								$showin.append(data.html).fadeIn();
221							}
222						});
223						
224						$('#'+id_crsc).removeClass('ex-loading');
225					}else{}
226				}
227			});
228	    }
229	    $('.extvs-reload').on('click', function(event) {
230	    	event.preventDefault();
231	    	var $this_click = $(this);
232	    	var id_crsc = $this_click.closest(".ex-tvs-now").attr('id');
233	    	extvs_now_reload(id_crsc);
234	    });
235	    //Advance load
236	    $('.extvs-advance-date .extvs-addate-day').on('click', function(event) {
237	    	event.preventDefault();
238	    	var $this_click = $(this);
239	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
240	    	$('#'+id_parent).find('.extvs-addate-day').removeClass('extvs-addate-day-at');
241	    	$this_click.addClass('extvs-addate-day-at');
242	    	
243	    	var date = $this_click.data('date');
244	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
245	    	extvs_advance_load(date,id_parent);
246	    });
247
248	    $('.ex-tvs-advance .ex-date-list-parent .extvs-date-day').on('click', function(event) {
249	    	event.preventDefault();
250	    	var $this_click = $(this);
251	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
252	    	$('#'+id_parent).find('.extvs-date-day').removeClass('extvs-date-day-at');
253	    	$this_click.addClass('extvs-date-day-at');
254	    	
255	    	var date = $this_click.data('date');
256	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
257	    	extvs_advance_load(date,id_parent);
258	    });
259
260	    $('.ex-tvs-advance .extvs-ad-list-week .extvs-date-adweek').on('click', function(event) {
261	    	event.preventDefault();
262	    	var $this_click = $(this);
263	    	var id_parent = $this_click.closest(".ex-tvs-advance").attr('id');
264	    	$('#'+id_parent).find('.extvs-date-adweek').removeClass('extvs-ad-list-week-ac');
265	    	$this_click.addClass('extvs-ad-list-week-ac');
266	    	
267	    	var date = $this_click.data('date');
268	    	$('#'+id_parent+' input[name=tvs_date_select]').val(date);
269	    	extvs_advance_load(date,id_parent);
270	    });
271
272	    function extvs_advance_load(date,id_crsc){
273	    	if($('#'+id_crsc).hasClass('ex-loading')){return;}
274	    	$('#'+id_crsc).addClass('ex-loading');
275	    	var ajax_url  		= $('#'+id_crsc+' input[name=ajax_url]').val();
276	    	var param_shortcode  		= $('#'+id_crsc+' input[name=param_shortcode]').val();
277	    	var param = {
278				action: 'extvs_get_schedule_advance',
279				param_shortcode: param_shortcode,
280				date: date,
281			};
282			$.ajax({
283				type: "post",
284				url: ajax_url,
285				dataType: 'json',
286				data: (param),
287				success: function(data){
288					if(data != '0')
289					{
290						var $showin = $('#'+id_crsc+' .extvs-advance-program');
291						$($showin).fadeOut({
292							duration:0,
293							complete:function(){
294								$( this ).empty();
295							}
296						});
297						$showin.append(data.html).fadeIn();
298						extvs_qtip(id_crsc);
299						$('#'+id_crsc).removeClass('ex-loading');
300					}else{}
301				}
302			});
303	    }
304	    // Date carousel
305		jQuery('.ex-tvs-simple').each(function(){
306			var $this = jQuery(this);
307			var id =  $this.attr('id');
308			var slidesshow =  $this.data('slidesshow');
309			var slidesscroll =  $this.data('slidesscroll');
310			if(slidesshow==''){ slidesshow = 7;}
311			if (slidesscroll==''){ slidesscroll = 3;}
312			var start_on =  $this.data('start_on') >= 0 ? $this.data('start_on') : 5;
313			var item_tablet =  $this.data('item_tablet') > 0 ? $this.data('item_tablet') : 3;
314			var rtl_mode = $this.data('rtl');
315			if($this.data('infinite')=='0'){
316			  var infinite = 0;
317			}else{
318			  var infinite =  $this.data('infinite') == 'yes' || $this.data('infinite') == '1' ? true : false;
319			}
320			extvs_carousel('#'+id+' .ex-date-list',infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode);
321		});
322		extvs_scroll();
323		function extvs_scroll(){
324			jQuery('.ex-tvs-advance').each(function(){
325				var $this = jQuery(this);
326				var id_parent =  $this.attr('id');
327				var pixel_perminutes = 0;
328				var total_width;
329				if ($this.hasClass('extvs-range-5m')) {
330					pixel_perminutes = 24;
331					total_width = 34560;
332					/*- 24h * 16sl( 1 = 16slots) * 6 (1sl = 5) *20  -*/
333				}else
334				if ($this.hasClass('extvs-range-10m')) {
335					pixel_perminutes = 12;
336					total_width = 17280;
337				}else
338				if ($this.hasClass('extvs-range-15m')) {
339					pixel_perminutes = 8;
340					total_width = 11520;
341				}else
342				if ($this.hasClass('extvs-range-30m')) {
343					pixel_perminutes = 4;
344					total_width = 5760;
345				}else if($this.hasClass('extvs-range-1h')){
346					pixel_perminutes = 2;
347					total_width = 2880;
348				}else{
349					pixel_perminutes = 1;
350					total_width = 1440;
351				}
352				var array_time,hours,minutes;
353				var scroll_to_time = $('#'+id_parent+' input[name=tvs_scroll_time]').val().replace(/\s/g,'');
354				if (scroll_to_time !='') {
355					array_time = scroll_to_time.split(":");
356					hours = parseInt(array_time[0]);
357					minutes = parseInt(array_time[1]);
358				}else{
359					array_time = $('#extvs_current_input').val().split(",");
360					hours = parseInt(array_time[0]);
361					minutes = parseInt(array_time[1]);
362				}
363
364				var scroll = (hours*60 + minutes) * pixel_perminutes;
365				var min_time = $('#'+id_parent+' input[name=tvs_min_time]').val();
366				if(min_time!=''){
367					scroll = parseInt((hours*60 + minutes) - parseInt(min_time)) * pixel_perminutes;
368				}$('#'+id_parent+' .extvs-advance-detail').attr('data-scroll',scroll);
369				if (scroll > 240) {
370					scroll = scroll - 240;
371				}
372				var rtl_mode = $('#'+id_parent).data('rtl');
373				if (rtl_mode == 'yes') {
374					scroll = total_width - scroll - 480;
375					$('#'+id_parent+' .extvs-advance-detail').scrollLeft(scroll);
376				}else{
377					$('#'+id_parent+' .extvs-advance-detail').scrollLeft(scroll);
378				}
379			});
380		}
381
382		jQuery('.ex-tvs-advance').each(function(){
383			var $this = jQuery(this);
384			var id =  $this.attr('id');
385			var slidesshow =  $this.data('slidesshow');
386			var slidesscroll =  $this.data('slidesscroll');
387			if(slidesshow=='' || slidesshow < 0){ slidesshow = 7;}
388			if (slidesscroll=='' || slidesscroll < 0){ slidesscroll = 3;}
389			var start_on =  $this.data('start_on') >= 0 ? $this.data('start_on') : 5;
390			var item_tablet =  $this.data('item_tablet') > 0 ? $this.data('item_tablet') : 3;
391			var rtl_mode = $this.data('rtl');
392			if($this.data('infinite')=='0'){
393			  var infinite = 0;
394			}else{
395			  var infinite =  $this.data('infinite') == 'yes' || $this.data('infinite') == '1' ? true : false;
396			}
397			extvs_carousel('#'+id+' .ex-date-list',infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode);
398		});
399
400		function extvs_carousel(id_clas,infinite,start_on,slidesshow,slidesscroll,item_tablet,rtl_mode){
401			var $center = $(id_clas).closest('.ex-tvs-simple, .ex-tvs-advance').data('center')=='no' ? false : true ;
402			if($(window).width() < 767){
403				var $before = $(id_clas).closest('.ex-tvs-simple, .ex-tvs-advance').attr('data-before');
404				start_on = $before > 0 ? $before : start_on;
405			}
406			$(id_clas).exo_wlCarousel({
407			    loop:false,
408			    // margin:10,
409			    nav:false,
410			    dots: false,
411			    center: $center,
412			    items:slidesshow,
413			    startPosition:start_on,
414			    rtl: rtl_mode =='yes' ? true : false,
415			    // animateOut: 'fadeOut',
416			    slideBy:slidesscroll,
417			    responsive:{
418			        0:{
419			            items:1
420			        },
421			        600:{
422			            items:item_tablet
423			        },
424			        1000:{
425			            items:slidesshow
426			        }
427			    }
428			});
429			$(id_clas).on('changed.exo_wl.carousel', function(event) {
430		        var currentItem = event.item.index;
431		        var total = event.item.count;
432		        var id_parent = $(id_clas).closest(".ex-tvs-simple").attr('id');
433		        if(currentItem == 0){
434		        	$('#'+id_parent+' .extvs-prev-bt').addClass('disabled');
435		        }else if(currentItem == (total -1)){
436		        	$('#'+id_parent+' .extvs-next-bt').addClass('disabled');
437		        }else{
438		        	$('#'+id_parent+' .extvs-prev-bt').removeClass('disabled');
439		        	$('#'+id_parent+' .extvs-next-bt').removeClass('disabled');
440		        }
441		        
442		    });
443		}
444
445		jQuery('.extvs-prev-bt').on('click', function(event) {
446			var $this = jQuery(this);
447			var id_advance = $this.closest(".ex-tvs-advance").attr('id');
448			if (id_advance != undefined) {
449				var exo_wl = $('#'+id_advance+' .ex-date-list');
450				exo_wl.trigger('prev.exo_wl.carousel');
451				return false;
452			}
453			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
454			var exo_wl = $('#'+id_parent+' .ex-date-list');
455			var rtl_mode =$('#'+id_parent).data('rtl');
456			if (rtl_mode == 'yes') {
457				exo_wl.trigger('next.exo_wl.carousel');
458			}else{
459				exo_wl.trigger('prev.exo_wl.carousel');
460			}
461			if ($('#'+id_parent).hasClass('ex-tvs-slide1')) {
462				$('#'+id_parent+' .extvs-date-day.extvs-date-day-at').removeClass('extvs-date-day-at');
463				$('#'+id_parent+' .ex-date-list .exo_wl-stage .exo_wl-item.active .extvs-date-day').addClass('extvs-date-day-at');
464				var date = $('#'+id_parent+' .extvs-date-day.extvs-date-day-at').data('date');
465		    	var chanel = $('#'+id_parent+' input[name=chanel_selected]').val();
466		    	extvs_simple_load(date,chanel,id_parent);
467			}
468			return false;
469		});
470		jQuery('.extvs-next-bt').on('click', function(event) {
471			var $this = jQuery(this);
472			var id_advance = $this.closest(".ex-tvs-advance").attr('id');
473			if (id_advance != undefined) {
474				var exo_wl = $('#'+id_advance+' .ex-date-list');
475				exo_wl.trigger('next.exo_wl.carousel');
476				return false;
477			}
478			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
479			var exo_wl = $('#'+id_parent+' .ex-date-list');
480			var rtl_mode =$('#'+id_parent).data('rtl');
481			if (rtl_mode == 'yes') {
482				exo_wl.trigger('prev.exo_wl.carousel');
483			}else{
484				exo_wl.trigger('next.exo_wl.carousel');
485			}
486			if ($('#'+id_parent).hasClass('ex-tvs-slide1')) {
487				$('#'+id_parent+' .extvs-date-day.extvs-date-day-at').removeClass('extvs-date-day-at');
488				$('#'+id_parent+' .ex-date-list .exo_wl-stage .exo_wl-item.active .extvs-date-day').addClass('extvs-date-day-at');
489				var date = $('#'+id_parent+' .extvs-date-day.extvs-date-day-at').data('date');
490		    	var chanel = $('#'+id_parent+' input[name=chanel_selected]').val();
491		    	extvs_simple_load(date,chanel,id_parent);
492			}
493			return false;
494		});
495
496		$('.ex-tvs-simple .extvs-hide-ps1').on('click', function(event) {
497			event.preventDefault();
498			var $this = jQuery(this);
499			var id_parent = $this.closest(".ex-tvs-simple").attr('id');
500			if ($('#'+id_parent).hasClass('extvs-hide-past')) {
501				$('#'+id_parent).removeClass('extvs-hide-past');
502			}else{
503				$('#'+id_parent).addClass('extvs-hide-past');
504			}
505
506	    });
507	    // open lightbox
508	    var hash = window.location.hash.substr(1);
509		//console.log(hash);
510		if(hash!=''){
511			var contenId = '.item-tvs a[href="#'+hash+'"]';
512			//console.log(contenId);
513			if($(contenId).length){
514				$(contenId).closest('.item-tvs').trigger('click');
515				return;
516			}
517		}
518		//
519		$('.md-date.extvs-ical a').click(function(e){
520		   e.stopPropagation();
521		});
522		
523
524    });
525    // sort table
526}(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.