PageSourceSearch

https://voiceofislam.co.uk/wp-content/themes/onair2/js/qt-main.js?ver=1.0.0

js voiceofislam.co.uk collected 2026-10-02 05:18:53 UTC 53,133 bytes, 1,742 lines download raw bytes

1/**====================================================================
2 *
3 *  OnAir2 Main Script File
4 *  @version  3.7.5 [2020 April 23]
5 *  
6 ====================================================================**/
7/*====================================================================
8
9	CODEKIT PREPENDS:
10	THESE BELOW ARE NOT COMMENTS, BUT THE CODEKIT'S PREPEND FILES 
11	ENQUEUED IN MAIN-MIN.JS
12
13	TO USE THE OPEN VERSION OF THE FILES FOR YOUR CUSTOMIZATIONS, 
14	ENABLE THE DEBUG OPTIONS IN THE THEME'S CUSTOMIZER
15
16====================================================================*/
17
18
19// @codekit-prepend "materializecss/bin/materialize.min.js";
20// @codekit-prepend "jquerycookie.js";
21// @codekit-prepend "../components/slick/slick.min.js";
22// @codekit-prepend "../components/countdown/js/jquery.knob.js";
23// @codekit-prepend "../components/countdown/js/jquery.throttle.js";
24// @codekit-prepend "../components/countdown/js/jquery.classycountdown.min.js";
25// @codekit-prepend "../components/soundmanager/script/excanvas.js";
26// @codekit-prepend "../components/soundmanager/script/berniecode-animator.js";
27// @codekit-prepend "../components/soundmanager/script/soundmanager2-nodebug.js";
28// @codekit-prepend "../components/soundmanager/script/shoutcast-ssl.js";
29// @codekit-prepend "../components/soundmanager/templates/qtradio-player/script/qt-360player-volumecontroller.js";
30// @codekit-prepend "../components/popup/popup.js";
31// @codekit-prepend "../components/fitvids/jquery.fitvids.js";
32// @codekit-prepend "../components/skrollr/skrollr.min.js";
33
34(function($) {
35	"use strict";
36
37	var qtShoutcastInterval;
38
39	$.onAir2Obj = {};
40	$.onAir2Obj.body = $("body");
41	$.onAir2Obj.htmlAndbody = $('html,body');
42
43	/**====================================================================
44	 *
45	 *
46	 * 	Function to go back in history used by form check
47	 *
48	 * 
49	 ====================================================================*/
50	window.goBack = function(e) {
51		var defaultLocation = "http://www.mysite.com";
52		var oldHash = window.location.hash;
53		history.back(); // Try to go back
54		var newHash = window.location.hash;
55		if (
56			newHash === oldHash &&
57			(typeof(document.referrer) !== "string" || document.referrer === "")
58		) {
59			window.setTimeout(function() {
60				// redirect to default location
61				window.location.href = defaultLocation;
62			}, 1000); // set timeout in ms
63		}
64		if (e) {
65			if (e.preventDefault){
66				e.preventDefault();
67			}
68			if (e.preventPropagation){
69				e.preventPropagation();
70			}
71		}
72		return false; // stop event propagation and browser default event
73	};
74
75
76	$.fn.qtIsMobileBrowser = function(content) {
77		if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
78			return true;
79		}
80		return false;
81	}
82
83	
84	/**====================================================================
85	 *
86	 *
87	 * Automatic link embed
88	 *
89	 * 
90	 ====================================================================*/
91	$.fn.embedMixcloudPlayer = function(content) {
92		var finalurl = ((encodeURIComponent(content)));
93		finalurl = finalurl.replace("https","http");
94		var embedcode ='<iframe data-state="0" class="mixcloudplayer" width="100%" height="80" src="//www.mixcloud.com/widget/iframe/?feed='+finalurl+'&embed_uuid=addfd1ba-1531-4f6e-9977-6ca2bd308dcc&stylecolor=&embed_type=widget_standard" frameborder="0"></iframe><div class="canc"></div>';    
95		return embedcode;
96	}
97
98	$.fn.embedVideo = function (content, width, height) {
99		height = width / 16 * 9;
100		var youtubeUrl = content;
101		var youtubeId = youtubeUrl.match(/=[\w-]{11}/);
102		var strId = youtubeId[0].replace(/=/, '');
103		var result = '<iframe width="'+width+'" height="'+height+'" src="'+window.location.protocol+'//www.youtube.com/embed/' + strId + '?html5=1" frameborder="0" class="youtube-player" allowfullscreen></iframe>';
104		return result;
105	}
106
107	$.fn.embedSpotify = function(mystring, width, height){
108		var trackID = mystring.split('https://open.spotify.com/track/').join('');
109		return '<iframe src="https://open.spotify.com/embed/track/'+trackID+'" width="'+width+'" height="'+height+'" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>';
110	};
111
112
113	/**====================================================================
114	 *
115	 *
116	 *	 Responsive video resize
117	 *
118	 * 
119	 ====================================================================*/
120	$.fn.NewYoutubeResize = function  (){
121		$("iframe").each(function(i,c){ // .youtube-player
122			var t = $(c);
123			if(t.attr("src")){
124				var href = t.attr("src");
125				if(href.match("youtube.com") || href.match("vimeo.com") || href.match("vevo.com")  || href.match("dailymotion.com")){
126					var width = t.parent().width(),
127						height = t.height();
128					t.css({"width":width});
129					t.height(width/16*9);
130				}; 
131			};
132		});
133	};
134
135	/**====================================================================
136	 *
137	 *
138	 * 	Check images loaded in a container
139	 *
140	 * 
141	 ====================================================================*/
142	$.fn.imagesLoaded = function () {
143			// get all the images (excluding those with no src attribute)
144		var $imgs = this.find('img[src!=""]');
145		// if there's no images, just return an already resolved promise
146		if (!$imgs.length) {return $.Deferred().resolve().promise();}
147		// for each image, add a deferred object to the array which resolves when the image is loaded (or if loading fails)
148		var dfds = [];  
149		$imgs.each(function(){
150			var dfd = $.Deferred();
151			dfds.push(dfd);
152			var img = new Image();
153			img.onload = function(){dfd.resolve();}
154			img.onerror = function(){dfd.resolve();}
155			img.src = this.src;
156		});
157		// return a master promise object which will resolve when all the deferred objects have resolved
158		// IE - when all the images are loaded
159		return $.when.apply($,dfds);
160	}
161
162	/**====================================================================
163	 *
164	 *
165	 * Transform link in embedded players
166	 *
167	 * 
168	 ====================================================================*/
169
170	$.fn.transformlinks = function (targetContainer) {
171		if(undefined === targetContainer) {
172			targetContainer = "body";
173		}
174
175		// Since 3.4.3
176		if($('body').hasClass('qt-autoembed-disable')){
177			return;
178		} // End
179
180		jQuery(targetContainer).find("a[href*='youtube.com'],a[href*='youtu.be'],a[href*='mixcloud.com'],a[href*='soundcloud.com'], [data-autoembed]").not('.qw-disableembedding').each(function(element) {
181			var that = jQuery(this);
182			
183			if(that.parent().hasClass('qw-disableembedding')) {
184				return;
185			}
186			var mystring = that.attr('href');
187			if(that.attr('data-autoembed')) {
188				mystring = that.attr('data-autoembed');
189			}
190			var width = that.parent().width();
191			
192			if(width === 0){
193				width = that.parent().parent().parent().width();
194			}
195			if(width === 0){
196				width = that.parent().parent().parent().width();
197			}
198			if(width === 0){
199				width = that.parent().parent().parent().parent().width();
200			}
201			var height = that.height();
202			var element = that;
203
204			//=== YOUTUBE https
205			var expression = /(http|https):\/\/(\w{0,3}\.)?youtube\.\w{2,3}\/watch\?v=[\w-]{11}/gi;
206			var videoUrl = mystring.match(expression);
207			if (videoUrl !== null) {
208				for (var count = 0; count < videoUrl.length; count++) {
209					mystring = mystring.replace(videoUrl[count], $.fn.embedVideo(videoUrl[count], width, (width/16*9)));
210					replacethisHtml(mystring);
211				}
212			}              
213
214			//=== SPOTIFY 
215			var expression = /https:\/\/open\.spotify\.\w{2,3}\/track\/[\w-]{22}/gi,
216				trackurl = mystring.match(expression);
217
218			if (trackurl !== null) {
219				for (var count = 0; count < trackurl.length; count++) {
220					mystring = mystring.replace( trackurl[count], $.fn.embedSpotify( trackurl[count], width, 80 ) );
221
222					replacethisHtml(mystring);
223				}
224			}  
225
226			//=== SOUNDCLOUD
227			var temphtml = '';
228			var iframeUrl = '';
229			var $temphtml;
230			var expression = /(http|https)(\:\/\/soundcloud.com\/+([a-zA-Z0-9\/\-_]*))/g;
231			var scUrl = mystring.match(expression);
232			if (scUrl !== null) {
233				for (count = 0; count < scUrl.length; count++) {
234					var finalurl = scUrl[count].replace(':', '%3A');
235					finalurl = finalurl.replace("https","http");
236					jQuery.getJSON(
237						'https://soundcloud.com/oembed?maxheight=140&format=js&url=' + finalurl + '&iframe=true&callback=?'
238						, function(response) {
239							temphtml = response.html;
240							if(that.closest("li").length > 0){
241								if(that.closest("li").hasClass("qt-collapsible-item")) {
242									$temphtml = $(temphtml);
243									iframeUrl = $temphtml.attr("src");
244									replacethisHtml('<div class="qt-dynamic-iframe" data-src="'+iframeUrl+'"></div>');
245								}
246							} else {
247								replacethisHtml(temphtml);
248							}
249					});
250				}
251			}
252			//=== MIXCLOUD
253			var expression = /(http|https)\:\/\/www\.mixcloud\.com\/[\w-]{0,150}\/[\w-]{0,150}\/[\w-]{0,1}/ig;
254			videoUrl = mystring.match(expression);
255			if (videoUrl !== null) {
256				for (count = 0; count < videoUrl.length; count++) {
257					mystring = mystring.replace(videoUrl[count], $.fn.embedMixcloudPlayer(videoUrl[count]));
258					replacethisHtml(mystring);
259				}
260			}
261			//=== STRING REPLACE (FINAL FUNCTION)
262			function replacethisHtml(mystring) {
263				element.replaceWith(mystring);
264				return true;
265			}
266			$.fn.NewYoutubeResize();
267		});
268		
269		/**
270		 * Fix for soundcloud loaded in collapsed div for the chart
271		 */
272		$.onAir2Obj.body.on("click",'.qt-collapsible li', function(e){
273			var that = $(this);
274			if(that.hasClass("active")){
275				var item = that.find(".qt-dynamic-iframe");
276				var itemurl = item.attr("data-src");
277				item.replaceWith('<iframe src="'+itemurl+'" frameborder="0"></iframe>');
278				$.fn.NewYoutubeResize();
279			}
280		});
281	}
282
283
284
285
286
287	/**====================================================================
288	 *
289	 * 
290	 *  Responsive videos using fitvids library
291	 *  https://github.com/davatron5000/FitVids.js
292	 *  
293	 * 
294	 ====================================================================*/
295	$.fn.qtFitvids = function() {
296		if(typeof($.fn.fitVids) === "undefined"){
297			return; // library is missing
298		}
299		$("#maincontent").fitVids();
300	};
301
302	/**====================================================================
303	 *
304	 * 
305	 *	12. Mobile navigation
306	 *	
307	 * 
308	 ====================================================================*/
309	$.fn.qtMobileNav = function() {
310		/*$.onAir2Obj.body.off("click", ".side-nav li.menu-item-has-children > a");
311		$.onAir2Obj.body.on("click", ".side-nav li.menu-item-has-children > a", function(e) {
312			var that = $(this).parent();
313			e.preventDefault();
314			if (that.hasClass("open")) {
315				that.removeClass("open");
316			} else {
317				that.addClass("open");
318			}
319			return true;
320		});*/
321
322		$.onAir2Obj.body.find( ".side-nav li.menu-item-has-children").each(function(i,c){
323			var that = $(c);
324			that.append("<a class='qt-openthis'><i class='dripicons-chevron-down'></i></a>");
325			that.on("click",".qt-openthis", function(e){
326				e.preventDefault();
327				that.toggleClass("open");
328				return;
329			});
330			return;
331		});
332
333
334		return true;
335	};
336
337
338	/**====================================================================
339	*
340	* 
341	*  	Slick gallery
342	*  
343	* 
344	====================================================================*/
345	$.fn.slickGallery = function() {
346		if($('.qt-slickslider, .qt-slick').length === 0) {
347			return;
348		}
349		$('.qt-slickslider, .qt-slick').not('.slick-initialized').each(function() {
350			var that = $(this),
351				slidesToShow = that.attr("data-slidestoshow"),
352				slidestoshowMobile = that.attr("data-slidestoshowmobile"),
353				slidestoshowIpad = that.attr("data-slidestoshowipad"),
354				appendArrows = that.attr("data-appendArrows");
355			if (slidesToShow === undefined || slidesToShow === "") {
356				slidesToShow = 1;
357			}
358			if (slidestoshowMobile === undefined || slidestoshowMobile === "") {
359				slidestoshowMobile = 1;
360			}
361			if (slidestoshowIpad === undefined || slidestoshowIpad === "") {
362				slidestoshowIpad = slidesToShow;
363			}
364			if (appendArrows === undefined || appendArrows === "") {
365				appendArrows = that; // append the arrows to the same container
366			} else {
367				appendArrows = that.closest(appendArrows); // or append arrows to other divs
368			}
369			that.slick({
370				// lazyLoad: 'progressive',
371				slidesToScroll: 1,
372				pauseOnHover: that.attr("data-pauseonhover") === "true",
373				infinite: that.attr("data-infinite") === "true",
374				autoplay: that.attr("data-autoplay") === "true",
375				autoplaySpeed: 4000,
376				centerPadding: 0,
377				slide: ".qt-item",
378				dots: that.attr("data-dots") === "true",
379				variableWidth: that.attr("data-variablewidth") === "true",
380				arrows: that.attr("data-arrows") === "true",
381				centerMode: that.attr("data-centermode") === "true",
382				slidesToShow: slidesToShow,
383				appendArrows: appendArrows,
384				responsive: [
385					{
386						breakpoint: 1170,
387						settings: {
388							slidesToShow: slidestoshowIpad, 
389							arrows: slidestoshowIpad === 1,
390							dots: slidestoshowIpad > 1
391						}
392					},
393					{
394						breakpoint: 600,
395						settings: {
396							arrows: that.attr("data-arrowsmobile") === "true",
397							centerMode: that.attr("data-centermodemobile") === "true",
398							centerPadding: 0,
399							variableWidth: that.attr("data-variablewidthmobile") === "true",
400							variableHeight: false,
401							dots: that.attr("data-dotsmobile") === "true",
402							slidesToShow: 1,//slidestoshowMobile,
403							draggable: false,
404							swipe: true,
405							touchMove: true,
406							infinite: that.attr("data-infinitemobile") === "true",
407						}
408					}
409
410				]
411			}).promise().done(function(){
412				that.removeClass("qt-invisible");
413			});
414		});
415	};
416
417	/**====================================================================
418	 *
419	 * 
420	 *	Generic class switcher (toggle class or toggleclass)
421	 *	
422	 * 
423	 ====================================================================*/
424	$.fn.qtQtSwitch = function() {
425		$.onAir2Obj.body.off("click", "[data-qtswitch]");
426		$.onAir2Obj.body.on("click", "[data-qtswitch]", function(e) {
427			var that = $(this);
428			e.preventDefault();
429			$(that.attr("data-target")).toggleClass(that.attr("data-qtswitch"));
430		});
431
432		$("[data-expandable]").each(function(i, c) {
433			var that = $(c),
434				selector = that.attr("data-expandable"),
435				target = $(selector);
436
437			if (selector !== "") {
438				if (target.hasClass("open")) {
439					target.velocity({
440						properties: {
441							height: target.find(".qt-expandable-inner").height() + "px"
442						},
443						options: {
444							duration: 50
445
446						}
447					});
448				}
449			}
450
451		});
452		$.onAir2Obj.body.off("click", "[data-expandable]");
453		$.onAir2Obj.body.on("click", "[data-expandable]", function(e) {
454			e.preventDefault();
455			var btn = $(this);
456			var that = $(btn.attr("data-expandable"));
457			if (!that.hasClass("open")) {
458				that.addClass("open");
459				that.velocity({
460					properties: {
461						height: that.find(".qt-expandable-inner").height() + "px"
462					},
463					options: {
464						duration: 300
465					}
466				});
467			} else {
468				that.removeClass("open");
469				// that.height(0);
470				that.velocity({
471					properties: {
472						height: 0
473					},
474					options: {
475						duration: 300
476					}
477				});
478			}
479		});
480	};
481
482
483	/**====================================================================
484	 *
485	 *
486	 * 	04. Parallax Backgrounds with blur by QantumThemes
487	 *
488	 * 
489	 ====================================================================*/
490
491	$.fn.parallaxV3 = function(options) {
492		var windowHeight = $(window).height(),
493			windowWidth = $(window).width(),
494			isMoz,
495			mozFix = 0;
496	
497
498		if( /Mozilla/i.test(navigator.userAgent) ) {
499			mozFix = 800;
500		}
501		
502
503		// Establish default settings
504		var settings = $.extend({
505			speed        : 0.15
506		}, options);
507		 
508
509		// Iterate over each object in collection
510		return this.each( function() {
511			var that = $(this);
512			var scrollTop = $(window).scrollTop();
513			var offset = that.offset().top;
514			var height = that.outerHeight();
515			var yBgPosition = Math.round((offset - scrollTop) * settings.speed);
516			var myspeed = settings.speed / 10;
517			that.initialBlur = that.attr("data-blurStart");
518			that.css('background-position', 'center ' + yBgPosition + 'px' );
519			that.scrolling =   that.attr("data-scrolling");
520
521			
522
523
524
525			if(that.hasClass('vc_parallax')){
526				that.css({"opacity": 1});
527			} else {
528				that.css({"opacity": 0.55});
529			}
530
531			that.css('background-attachment', 'fixed' );
532
533			if($.fn.qtIsMobileBrowser()  || windowWidth < 1279 ) {
534				that.css('background-attachment', 'local' );
535				that.css('background-position', 'center center');
536				return;
537			} else {
538				that.css('background-attachment', 'fixed' );
539			}
540
541
542			if(!$.onAir2Obj.body.hasClass("mobile")){
543				var eventThrottle = 5,
544					now = Date.now(), 
545					lastMove = now;
546				scrollTop = $(window).scrollTop();
547				offset = that.offset().top  - mozFix;
548				height = that.outerHeight();
549				yBgPosition = Math.round((offset - scrollTop) * myspeed);
550				that.css({'background-position': 'center ' + yBgPosition + 'px', 'min-height': height });
551
552				$(document).scroll(function(){
553					now = Date.now();
554					if (now > (lastMove + eventThrottle) ){
555						scrollTop = $(window).scrollTop();
556						offset = that.offset().top - mozFix; // -200 // firefox issue qould require -880
557
558						height = that.outerHeight();
559						if (offset + height <= scrollTop || offset >= scrollTop + windowHeight) {
560							return;
561						}
562						yBgPosition = Math.round((offset - scrollTop) * myspeed);
563						that.css('background-position', 'center ' + yBgPosition + 'px');
564						lastMove = now;
565					}
566				});
567			}
568		});
569	}
570
571
572
573	/**====================================================================
574	 *
575	 * 
576	 *  17. Dynamic backgrounds
577	 *  
578	 * 
579	 ====================================================================*/
580	$.fn.dynamicBackgrounds = function(targetContainer) {
581		if (undefined === targetContainer) {
582			targetContainer = "body";
583		}
584		$(targetContainer + " [data-bgimage]").each(function() {
585			var that = $(this),
586				bg = that.attr("data-bgimage"),
587				parallax = that.attr("data-parallax"),
588				myspeed = 1.5,
589				bgattachment = that.attr("data-bgattachment");
590			if (bgattachment === undefined) {
591				bgattachment = "static";
592			}
593			if (bg !== '') {
594				that.css({"background-image": "url("+bg+")",
595					"background-size":"cover",
596					"background-position":"center center",
597					"background-repeat":"no-repeat" , 
598					//"background-attachment":"loadingClass",
599					"-webkit-transform": "translate3d(0, 0, 0)" ,
600					"-webkit-backface-visibility": "hidden",
601					"-webkit-perspective": "1000"
602				});
603				if(parallax === "1") {
604					if(that.data('speed')){
605						myspeed = that.data('speed');
606					}
607					that.parallaxV3({  speed : myspeed  });
608				} else {
609					that.css({"opacity": 0.55});
610				}
611			}
612		});
613
614
615	};
616
617	/**====================================================================
618	 *
619	 * 
620	 *  Functions to run once on first page load
621	 *  
622	 * 
623	 ====================================================================*/
624	$.fn.qtPageloadInit = function() {
625		$(".button-collapse").sideNav();
626		// Channels list
627		$('.button-playlistswitch').sideNav({
628			menuWidth: 280, // Default is 240
629			edge: 'right', // Choose the horizontal origin
630			closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
631			draggable: false // Choose whether you can drag to open on touch screens
632		});
633
634		$.onAir2Obj.body.off("click", ".button-playlistswitch-close");
635		$.onAir2Obj.body.on("click", ".button-playlistswitch-close", function(e) {
636			e.preventDefault();
637			$('.button-playlistswitch').sideNav('hide');
638		});
639
640		$.onAir2Obj.body.off("click", ".qt-scrolltop");
641		$.onAir2Obj.body.on("click", ".qt-scrolltop", function(e) {
642			e.preventDefault();
643			$("html, body").animate({
644				scrollTop: 0
645			}, "slow");
646		});
647	};
648
649	/**====================================================================
650	 *
651	 * 
652	 *  Pushpin (uses materializecss library) 
653	 *  
654	 * 
655	 ====================================================================*/
656	$.fn.qtPushpin = function() {
657		if(typeof($.fn.pushpin) !== "undefined"){
658			if ($(window).width() > 1280 && $('.qt-pushpin').length > 0) {
659				$('.qt-pushpin').css({
660					"width": $('.qt-pushpin').width()
661				});
662				var containerPushpin = $('.qt-pushpin-container').parent(),
663					bottom = containerPushpin.offset().top + containerPushpin.outerHeight(true) - ($(".qt-sharepage").outerHeight(true) + 40),
664					top = $('.qt-pushpin-container').offset().top,
665					offset = 0;
666				if($('body').hasClass('qt-playertype-header') && $('body').hasClass('qt-stickymenu')) {
667					offset += 140;
668					top -= 140;
669					bottom-= 140;
670				} else {
671					offset += 50;
672					top -= 50;
673					bottom-= 140;
674				}
675				if($('body').hasClass('qt-stickymenu')) {
676					offset += 80;
677					top -= 250;
678					bottom-= 250;
679				}
680				$('.qt-pushpin').pushpin({
681					top: top,
682					offset: offset,
683					bottom: bottom
684				});
685			}
686		}
687	};
688
689	/**====================================================================
690	 *
691	 * 
692	 *  Event countdown (requires library component) 
693	 *  
694	 * 
695	 ====================================================================*/
696
697	 function parseDate(input) {
698	  var parts = input.match(/(\d+)/g);
699	  // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
700	  return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based
701	}
702
703
704	$.fn.qtCountdown = function() {
705		$.each($('.qt-countdown'), function(i, c) {
706			var that = $(c),
707				enddate = that.attr("data-end"),
708				nowdate = that.data('now'),
709				endtime, nowtime,
710				difference,
711				end;
712
713			if (enddate !== undefined && enddate !== "") {
714				enddate = new Date(enddate);
715				nowdate = new Date(nowdate);
716				endtime = enddate.getTime();
717				nowtime = nowdate.getTime();
718				difference = endtime - nowtime;
719				$(c).ClassyCountdown({
720					theme: "white-wide",
721					end: $.now() + (difference / 1000)
722				});
723				that.find(".ClassyCountdown-days .ClassyCountdown-value span").html(that.attr("data-dayslabel"));
724				that.find(".ClassyCountdown-hours .ClassyCountdown-value span").html(that.attr("data-hourslabel"));
725				that.find(".ClassyCountdown-minutes .ClassyCountdown-value span").html(that.attr("data-minuteslabel"));
726				that.find(".ClassyCountdown-seconds .ClassyCountdown-value span").html(that.attr("data-secondslabel"));
727			}
728		});
729	};
730
731
732	
733
734	/**====================================================================
735	 *
736	 * 
737	 *  Share link
738	 *  
739	 * 
740	 ====================================================================*/
741	$.fn.qtSharelink = function() {
742		$(".qt-sharelink").each(function(){
743
744			// deprecated
745			// 
746			return;
747				
748			var that = $(this),
749				urlencoded = encodeURIComponent(window.location.href) /* Get page URL here and encode it */, // window.location.href
750				sharetype = that.attr("data-sharetype"),
751				finalurl = '';
752			switch (sharetype) {
753				case "facebook":
754					finalurl = 'https://www.facebook.com/sharer/sharer.php?u='+urlencoded;
755				break;
756				case "twitter":
757					finalurl = 'https://twitter.com/intent/tweet?url='+urlencoded;
758				break;
759				case "google":
760					finalurl = 'https://plus.google.com/share?url='+urlencoded;
761				break;
762				case "pinterest":
763					finalurl = 'https://pinterest.com/pin/create/bookmarklet/?url='+urlencoded;
764				break;
765			}
766			that.attr("href",finalurl);
767		});
768	};
769
770	/**====================================================================
771	 *
772	 *
773	 *	Masonry templates (based on default Wordpress Masonry)
774	 *
775	 * 
776	 ====================================================================*/
777	$.fn.qtMasonry = function(targetContainer){
778		if(undefined === targetContainer) {
779			targetContainer = "body";
780		}
781		$(targetContainer).find('.qt-masonry').each( function(i,c){
782			var idc = $(c).attr("id");
783			var container = document.querySelector('#'+idc);
784			if(container){
785				var msnry = new Masonry( container, {  itemSelector: '.qt-ms-item',   columnWidth: '.qt-ms-item' });
786			}
787		});
788
789		$.onAir2Obj.body.imagesLoaded().then(function(){
790			$(targetContainer).find('.gallery').each( function(i,c){
791				var idc = $(c).attr("id");
792				var container = document.querySelector('#'+idc);
793				if(container){
794					var msnry = new Masonry( container, {  itemSelector: '.gallery-item',   columnWidth: '.gallery-item' });
795				}
796			});
797		});
798
799		
800		return true;
801	};
802
803	/**====================================================================
804	*
805	*  Sound destroy
806	* 
807	====================================================================*/
808	$.fn.destroyAll360Sounds = function(){
809		if(threeSixtyPlayer !== undefined) {
810			threeSixtyPlayer.sounds.forEach(function(element, index, array){
811				soundManager.stop(element.id);
812				soundManager.destroySound(element.id);
813			});
814		}
815	}
816
817	/**====================================================================
818	*
819	*  360 player
820	* 
821	====================================================================*/
822	$.fn.qt360player = function(targetContainer, action){
823		var playerContainer = $("#qtplayercontainer"),
824			mp3url = '',
825			fullstop = playerContainer.data('fullstop'),
826			qtBody = $("body");
827			
828		soundManager.setup({
829			url: playerContainer.attr("data-soundmanagerurl"),
830			allowScriptAccess: 'always',
831			useHighPerformance: true,
832			consoleOnly: true,
833			debugMode: false,
834			debugFlash: false,
835			bufferTime: 2// this adds 2 seconds buffer
836		});
837
838		soundManager.flash9Options.useWaveformData = true; 
839		soundManager.flash9Options.useEQData = true;
840		soundManager.flash9Options.usePeakData = true;
841		soundManager.preferFlash = true;
842		soundManager.flashVersion = 9;
843		var playerVolume = false;
844		if(!navigator.userAgent.match(/mobile/i) && playerContainer.attr("data-playervolume") === "true") {
845			playerVolume = true;
846		}
847		threeSixtyPlayer = new ThreeSixtyPlayer();
848		threeSixtyPlayer.config = {
849			fullStop: fullstop, // since 3.6.7 passed to qt-360player-volumecontroller.js
850			playNext: false,
851			autoPlay: false,
852			allowMultiple: false,
853			playervolume:  true,
854			loadRingColor: playerContainer.attr("data-textcolor"), // ACCENT COLOR
855			playRingColor:  playerContainer.attr("data-accentcolor"), // DARKER
856			backgroundRingColor:playerContainer.attr("data-accentcolordark"),
857			circleDiameter: 280,
858			circleRadius: 140,
859			animDuration: 500,
860			animTransition: Animator.tx.bouncy,
861			showHMSTime: true,
862			useWaveformData: true,
863			waveformDataColor: '#fff',
864			waveformDataDownsample: 3,
865			waveformDataOutside: false,
866			waveformDataConstrain: false,
867			waveformDataLineRatio: 0.8,
868			useEQData: true,
869			eqDataColor: '#FFF',
870			eqDataDownsample: 2,
871			eqDataOutside: true,
872			eqDataLineRatio: 0.73,
873			usePeakData: true,
874			peakDataColor: '#FFF',
875			peakDataOutside: true,
876			peakDataLineRatio: 1.8,
877			scaleArcWidth: 0.80,
878			useAmplifier: true,
879			useFavIcon: true
880		}
881		// hook into SM2 init
882		soundManager.onready(threeSixtyPlayer.init);
883
884
885
886
887		/**
888		 * ================================ custom states hooks
889		 */
890		
891		var onplay360 = threeSixtyPlayer.events.play;
892		var onresume360 = threeSixtyPlayer.events.resume;
893		var onfinish360 = threeSixtyPlayer.events.finish;
894		var onpause360 = threeSixtyPlayer.events.pause;
895		var onstop360 = threeSixtyPlayer.events.stop;
896
897		// @since 3.6.7
898		// If the customizer option of the radio says to stop, disconnects completely
899		if( fullstop ){
900			onpause360 = threeSixtyPlayer.events.stop;
901		}
902
903
904
905		$("#qtpausebtn .pause").hide();
906		
907		var myOnplay = function(){
908			smState = 'play';
909			qtlistenbutton.addClass("qt-btn-primary");
910			$("#qtpausebtn i").addClass("dripicons-media-pause").removeClass("dripicons-media-play");
911			$("#qtpausebtn .pause").show();
912			$("#qtpausebtn .play").hide();
913			onplay360.apply(this); // forces the scope to 'this' = the sound object
914		};
915		threeSixtyPlayer.events.play = myOnplay;
916
917		var  qtlistenbutton = $(".qtlistenbutton");
918		var myOnresume = function(){
919			qtlistenbutton.addClass("qt-btn-primary");
920			$("#qtpausebtn i").addClass("dripicons-media-pause").removeClass("dripicons-media-play");
921			$("#qtpausebtn .pause").show();
922			$("#qtpausebtn .play").hide();
923			onplay360.apply(this); 
924		};
925		threeSixtyPlayer.events.resume = myOnresume;
926
927		var myOnfinish = function(){
928			onfinish360.apply(this); // forces the scope to 'this' = the sound object
929		};
930		threeSixtyPlayer.events.finish = myOnfinish;
931
932		var myOnpause = function(){
933			qtlistenbutton.removeClass("qt-btn-primary");
934			$("#qtpausebtn i").removeClass("dripicons-media-pause").addClass("dripicons-media-play");
935			$("#qtpausebtn .pause").hide();
936			$("#qtpausebtn .play").show();
937			onpause360.apply(this); // forces the scope to 'this' = the sound object
938			if( fullstop ){
939				$.fn.destroyAll360Sounds();
940			}
941		};
942		threeSixtyPlayer.events.pause = myOnpause;
943
944		var myOnstop = function(){
945			qtlistenbutton.removeClass("qt-btn-primary");
946			$("#qtpausebtn i").removeClass("dripicons-media-pause").addClass("dripicons-media-play");
947			$("#qtpausebtn .pause").hide();
948			$("#qtpausebtn .play").show();
949			$.fn.destroyAll360Sounds();
950			onstop360.apply(this); // forces the scope to 'this' = the sound object
951		};
952		threeSixtyPlayer.events.stop = myOnstop;
953
954
955
956
957		////////////////////////////////////////////////////
958		///
959		
960		threeSixtyPlayer.config.useWaveformData = true;
961		threeSixtyPlayer.config.useEQData = true;
962		// enable this in SM2 as well, as needed
963		if (threeSixtyPlayer.config.useWaveformData) {
964		  soundManager.flash9Options.useWaveformData = true;
965		}
966		if (threeSixtyPlayer.config.useEQData) {
967		  soundManager.flash9Options.useEQData = true;
968		}
969		if (threeSixtyPlayer.config.usePeakData) {
970		  soundManager.flash9Options.usePeakData = true;
971		}
972		if (threeSixtyPlayer.config.useWaveformData || threeSixtyPlayer.flash9Options.useEQData || threeSixtyPlayer.flash9Options.usePeakData) {
973		  // even if HTML5 supports MP3, prefer flash so the visualization features can be used.
974		  soundManager.preferFlash = false;
975		}
976		threeSixtyPlayer.config.fullStop = fullstop;
977
978		if(action === "destroy") {
979			$.fn.destroyAll360Sounds();
980		}
981		if(undefined === targetContainer) {
982			targetContainer = "body";
983		};
984		var url, actualplaying, player, target, smState = false, playtrack, firstloaded = false, 
985			qtTracktitle = $(targetContainer).find("#qtradiotitle"),
986			qtradiosubtitle = $(targetContainer).find("#qtradiosubtitle"),
987			playClass = 'dripicons-media-play',
988			pauseClass= "dripicons-media-pause",
989			loadingClass = "dripicons-media-play", 
990			trackextension = '';
991
992		// Load a track in the player
993		//================================================
994		function loadInPlayer (c, autoplay){
995			$.fn.destroyAll360Sounds();
996			playtrack = c.attr( "data-playtrack");
997			if(playtrack === undefined) {
998				return;
999			}
1000			mp3url =  c.attr( "data-playtrack").split("geo-sample").join("sample");
1001			soundManager.stopAll();
1002			var player = $('.qt-ui360');
1003			player.empty();
1004			var random = Math.floor(Math.random()*1000000);
1005			player.append('<a id="playerlink" href="' + mp3url + '?ver=' + random + '"></a>');
1006			if(autoplay){
1007				threeSixtyPlayer.config.autoPlay = true;
1008				$(targetContainer).find("a.beingplayed").removeClass("beingplayed").find("i").removeClass(pauseClass).addClass(playClass);
1009				actualplaying = mp3url;
1010				c.addClass("beingplayed").find("i").removeClass(playClass).addClass(pauseClass);
1011			} else {
1012				$(targetContainer).find("a.beingplayed").removeClass("beingplayed").find("i").removeClass(pauseClass).addClass(playClass);				
1013				threeSixtyPlayer.config.autoPlay = false;
1014			}
1015			var background = c.attr("data-background"),
1016				logo = c.attr("data-logo"),
1017				title = c.attr("data-title"),
1018				subtitle = c.attr("data-subtitle");
1019			qtTracktitle.html(title);
1020			qtradiosubtitle.html(subtitle);
1021			$("#playerimage").attr("data-bgimage", background).css({"background-image": "url("+background+")"});
1022			$("#playerimage img").attr("src", background);
1023			threeSixtyPlayer.init();
1024			return;
1025		};
1026		// MP3 link click
1027		//================================================
1028		qtBody.off("click", "a[data-playtrack]");
1029		qtBody.on("click", "a[data-playtrack]", function(e) {
1030			e.preventDefault();
1031			var c = $(this);
1032			if(c.hasClass("beingplayed")){
1033				loadInPlayer($(this), false);
1034			} else {
1035				loadInPlayer(c, true);
1036			}
1037			$(".activeRadioChannel").removeClass("activeRadioChannel");
1038			c.addClass("activeRadioChannel");
1039			// We update the feed here:==================
1040			var qtShoutcastFeedData = $("#qtShoutcastFeedData"); // where we store the data (in the player container hidden div)
1041			
1042			var	qtIcyMetadata = c.attr("data-icymetadata"), // since 3.7.3
1043				qtPlaytrack = c.attr("data-playtrack"),
1044				qtradiofeedHost = c.attr("data-host"),
1045				qtradiofeedPort =  c.attr("data-port"),
1046				qtradiofeedChannel =  c.attr("data-channel"),
1047				qtradiofeedProtocol =  c.attr("data-protocol"), // 2019 08 10
1048				qtIcecasturl =  c.attr("data-icecasturl"),
1049				qticemount =  c.attr("data-icecastmountpoint"),
1050				qticechannel =  c.attr("data-icecastchannel"),
1051				qtradiodotco =  c.attr("data-radiodotco"),
1052				qtairtime =  c.attr("data-airtime"),
1053				qtradionomy =  c.attr("data-radionomy"),
1054				qtlive365 =  c.attr("data-live365"),
1055				qtSecuresystems =  c.attr("data-securesystems"),
1056				qtWinMedia =  c.attr("data-winmedia"),
1057				qttextfeed = c.attr("data-textfeed"),
1058				qtJazler = c.attr("data-jazler"),
1059				qtFeedStyle = qtShoutcastFeedData.attr("data-style");
1060			if(qtradiofeedChannel === '' || qtradiofeedChannel === undefined){
1061				qtradiofeedChannel = '1';
1062			}
1063			qtShoutcastFeedData.attr("data-playtrack",qtPlaytrack); // since 3.7.3
1064			qtShoutcastFeedData.attr("data-icymetadata",qtIcyMetadata); // since 3.7.3
1065			qtShoutcastFeedData.attr("data-host",qtradiofeedHost);
1066			qtShoutcastFeedData.attr("data-port",qtradiofeedPort);
1067			qtShoutcastFeedData.attr("data-icecasturl",qtIcecasturl);
1068			qtShoutcastFeedData.attr("data-icecastmountpoint",qticemount);
1069			qtShoutcastFeedData.attr("data-icecastchannel",qticechannel);
1070			qtShoutcastFeedData.attr("data-channel",qtradiofeedChannel);
1071			qtShoutcastFeedData.attr("data-protocol",qtradiofeedProtocol);// 2019 08 10
1072			qtShoutcastFeedData.attr("data-radiodotco",qtradiodotco);
1073			qtShoutcastFeedData.attr("data-airtime",qtairtime);
1074			qtShoutcastFeedData.attr("data-radionomy",qtradionomy);
1075			qtShoutcastFeedData.attr("data-live365",qtlive365);
1076			qtShoutcastFeedData.attr("data-securesystems",qtSecuresystems);
1077			qtShoutcastFeedData.attr("data-winmedia",qtWinMedia);
1078			qtShoutcastFeedData.attr("data-textfeed",qttextfeed);
1079			qtShoutcastFeedData.attr("data-jazler",qtJazler);
1080			$("#qtPlayerTrackInfo").hide();
1081			$.fn.qtShoutcastFeedNew();
1082			return false;
1083		});
1084
1085		qtBody.on("click", "#qtpausebtn", function(e) {
1086			e.preventDefault();
1087			$(".activeRadioChannel").click();
1088		});
1089		// Preload radio channel
1090		var autoselect = $('.qt-autoselect-channel');
1091		if(autoselect.length > 0){
1092			loadInPlayer(autoselect, false);
1093		}
1094		
1095	};
1096
1097
1098	/**====================================================================
1099	 *
1100	 * 
1101	 *  Autoplay
1102	 *  
1103	 * 
1104	 ====================================================================*/
1105	$.fn.qtRadioAutoplay = function() {
1106		jQuery("#qtfirstchannel").click();
1107	};
1108
1109	/**====================================================================
1110	*
1111	* SHOTCAST XML Feed Info
1112	* 
1113	====================================================================*/
1114
1115	$.fn.qtApplyTitle = function(result){
1116		if(result){
1117			var feedsplit = result.split(" - "), author, title;
1118			if(feedsplit.length > 1){
1119				author = feedsplit[0],
1120				title = feedsplit[1];
1121			} else {
1122				author = "";
1123				title = result;
1124			}
1125			$('#qtFeedPlayerTrack').html(title);
1126			$('#qtFeedPlayerAuthor').html(author);
1127			$("#qtPlayerTrackInfo").show();
1128			$('.qt-short-nowonairtextual span').html(' '+author+' - '+title);
1129		}
1130		return;
1131	}
1132
1133	$.fn.qtShoutcastFeedNew = function(){
1134
1135
1136		if( $("#qtShoutcastFeedData").length === 0 ){
1137			return;
1138		}
1139
1140
1141		var proxyURL = $("#qantumthemesproxyurl").data('proxyurl');
1142
1143
1144
1145		var qtShoutcastFeedData = $("#qtShoutcastFeedData"),
1146			qtPlaytrack =  qtShoutcastFeedData.attr("data-playtrack"), // since 3.7.3
1147			qtIcyMetadata = qtShoutcastFeedData.attr("data-icymetadata"), // since 3.7.3
1148			qtradiofeedHost = qtShoutcastFeedData.attr("data-host"),
1149			qtradiofeedPort =  qtShoutcastFeedData.attr("data-port"),
1150			qtradiofeedProtocol =  qtShoutcastFeedData.attr("data-protocol"),
1151			qticecasturl =  qtShoutcastFeedData.attr("data-icecasturl"),
1152			qticecastmountpoint=  qtShoutcastFeedData.attr("data-icecastmountpoint"),
1153			qticecastchannel=  qtShoutcastFeedData.attr("data-icecastchannel"),
1154			qtradiodotco=  qtShoutcastFeedData.attr("data-radiodotco"),
1155			qtairtime =  qtShoutcastFeedData.attr("data-airtime"),
1156			qtradionomy =  qtShoutcastFeedData.attr("data-radionomy"),
1157			qtlive365 =  qtShoutcastFeedData.attr("data-live365"),
1158
1159			qtSecuresystems =  qtShoutcastFeedData.attr("data-securesystems"),
1160			qtWinMedia =  qtShoutcastFeedData.attr("data-winmedia"),
1161
1162			qttextfeed =  qtShoutcastFeedData.attr("data-textfeed"),
1163			qtSCuseproxy =  qtShoutcastFeedData.attr("data-useproxy"),
1164			qtJazler =  qtShoutcastFeedData.attr("data-jazler"),
1165			qtFeedPlayerTrack = $('#qtFeedPlayerTrack'),
1166			qtFeedPlayerAuthor = $('#qtFeedPlayerAuthor'),
1167			theChannel = qtShoutcastFeedData.attr("data-channel"),
1168			qtPlayerTrackInfo = $("#qtPlayerTrackInfo"),
1169			author, title, result, feedsplit;
1170
1171			if(qtSecuresystems ==='' && qtWinMedia === '' && qtIcyMetadata ==='' && qtJazler === '' && qttextfeed === '' && qtradionomy === '' && qtlive365 === '' && qtairtime === '' && (qtradiofeedHost === '' || qtradiofeedPort === '' || typeof(qtradiofeedHost)=== 'undefined') && (qticecasturl === '' || typeof(qticecasturl)=== 'undefined') && (qtradiodotco === '' || typeof(qtradiodotco) === 'undefined')) {
1172				return;
1173			} else {
1174
1175				if(qtIcyMetadata === '1' || qtIcyMetadata === 1){
1176					if(!qtPlaytrack || qtPlaytrack === ''){
1177						return;
1178					}
1179					$.ajax({
1180					   	type: 'GET',
1181						url: proxyURL,
1182					    jsonpCallback: 'parseMusic',
1183						async: true,
1184						cache: false,
1185						data: { 
1186							"qtproxycall": qtPlaytrack, 
1187							'icymetadata': '1'  
1188						},
1189						success: function(data) {
1190							$.fn.qtApplyTitle( data );
1191						},
1192						error: function(e){
1193							console.log('Your stream does not provide ICY metadata. Please contact your streaming provider or use another server format.');
1194							console.log(e);
1195						}
1196					});
1197
1198				} else if( qtSecuresystems !== ''){
1199
1200					$.ajax({
1201						type: 'GET',
1202						cache: false,
1203						url: qtSecuresystems,
1204						async: true,
1205						dataType: "xml",
1206						success: function(data) {
1207							$.fn.qtApplyTitle( $(data).find('artists').html()+ ' - ' + $(data).find('title').html() );
1208						},
1209						error: function(e){
1210						}
1211					});
1212
1213
1214				} else if( qtlive365 !== ''){
1215					$.ajax({
1216						type: 'GET',
1217						cache: false,
1218						url: 'https://api.live365.com/station/'+qtlive365,
1219						async: true,
1220						success: function(jsondata) {
1221							$.fn.qtApplyTitle(jsondata['current-track'].artist+' - '+jsondata['current-track'].title);
1222						},
1223						error: function(e){
1224						}
1225					});
1226				} else if(qttextfeed !== ''){
1227					var jsondata, title;
1228
1229					if( qtSCuseproxy !== '1') {
1230						$.ajax({
1231							type: 'GET',
1232							cache: false,
1233							url: qttextfeed,
1234							async: true,
1235							dataType: "html",
1236							success: function(data) {
1237								$.fn.qtApplyTitle( data );
1238							},
1239							error: function(e){
1240							}
1241						});
1242					} else {
1243						$.ajax({
1244							type: 'GET',
1245							cache: false,
1246							url: proxyURL,
1247							async: true,
1248							data: { 
1249								"qtproxycall": qttextfeed,
1250							},
1251							dataType: "html",
1252							success: function(data) {
1253								$.fn.qtApplyTitle( data );
1254							},
1255							error: function(e){
1256							}
1257						});
1258					}
1259
1260				} else if(qtradionomy !== '' ) {
1261					$.ajax({
1262						type: 'GET',
1263						url: qtradionomy,
1264						async: true,
1265						cache: false,
1266						dataType: "xml",
1267						success: function(data) {
1268							$.fn.qtApplyTitle( $(data).find('artists').html()+ ' - ' + $(data).find('title').html() );
1269						},
1270						error: function(e){
1271						}
1272					});
1273				} else if(qtairtime !== '' && qtairtime !== 'undefined' && qtairtime !== undefined && typeof(qtairtime) !== 'undefined'){
1274					var jsondata, title;
1275					$.ajax({
1276						type: 'GET',
1277						cache: false,
1278						url: proxyURL,
1279						async: true,
1280						data: {
1281							"qtproxycall": qtairtime,
1282						},
1283						contentType: "application/json",
1284						success: function(data) {
1285							jsondata = JSON.parse(data);
1286							title = jsondata.tracks.current.name;
1287							$.fn.qtApplyTitle(title);
1288						},
1289						error: function(e) {
1290						}
1291					});
1292
1293					
1294				}
1295				else if(qticecasturl !== '' && typeof(qticecasturl) !== 'undefined') {
1296					if( qtSCuseproxy !== '1') {
1297						
1298						$.ajax({
1299							type: 'GET', 
1300							url: qticecasturl,
1301							async: true,						    
1302							jsonpCallback: "parseMusic",
1303
1304							/// Open mode
1305							jsonp: false,
1306
1307							// Closed mode 
1308							// IT SEEMS THAT MANY ICECAST PROVIDERS ARE NOT DELIVERING THE CORRECT HTTP HEADERS SO THIS DOESN'T WORK
1309							// contentType: "application/json",
1310							// dataType: 'jsonp',
1311							// jsonp: true,
1312							
1313							success : function(json){
1314								if('object' === typeof( json )){
1315									var source = json.icestats.source;
1316									if('undefined' === typeof(source)){ return; }
1317									if(qticecastmountpoint !== '') {
1318										result = source[0][qticecastmountpoint]['title'];
1319										if(source[0][qticecastmountpoint]['artist']){
1320											result = source[0][qticecastmountpoint]['artist']+' - '+result;
1321										}
1322									} else {
1323										if(source[0]){
1324											result = source[0]['title'];
1325											if(source[0]['artist']){
1326												result = source[0]['artist']+' - '+result;
1327											}
1328										} else if( source['title'] ){
1329											result = source['title'];
1330											if(source['artist']){
1331												result = source['artist']+' - '+result;
1332											}
1333										}
1334									}
1335								} else if('array' === typeof( json )){
1336									if(qticecastmountpoint !== '') {
1337										if("undefined" !== typeof( json[qticecastmountpoint]) ){
1338											result = json[qticecastmountpoint]['title'];
1339										} else if( "undefined" !== typeof( json['source'][qticecastmountpoint] ) ){
1340											result = json['source'][qticecastmountpoint]['title'];
1341										}
1342									} else if(json['icestats']['source']['title']){
1343										result = (json['icestats']['source']['title']);
1344
1345										if(json['icestats']['source']['artist']){
1346											result = json['icestats']['source']['artist']+' - '+result;
1347										}
1348									} else if(json['icestats']['source'][0]['title']){
1349										result = (json['icestats']['source'][0]['title']);
1350										if(json['icestats']['source']['artist']){
1351											result = json['icestats']['source']['artist']+' - '+result;
1352										}
1353									}
1354								}
1355								$.fn.qtApplyTitle(result);
1356							},
1357							error: function(e) {
1358								console.log("Error: your icecast feed is not available.");
1359								console.log(e);
1360							}
1361						});
1362
1363					} else {
1364						var jsondata, title;
1365						$.ajax({
1366							type: 'GET',
1367							cache: false,
1368							url: proxyURL,
1369							async: true,
1370							data: { 
1371								"qtproxycall": qticecasturl,
1372							},
1373							contentType: "application/json",
1374							success: function(data) {
1375								jsondata = JSON.parse(data);
1376								if (qticecastchannel) {
1377									if(jsondata.icestats.source[qticecastchannel].title){
1378										title = jsondata.icestats.source[qticecastchannel].title;
1379									} else if(jsondata.icestats.source[qticecastchannel].title) {
1380										title = jsondata.icestats.source[qticecastchannel].title;
1381									} else if(jsondata.icestats.source[qticecastchannel].title) {
1382										title = jsondata.icestats.source[qticecastchannel].title
1383									}
1384
1385								} else {
1386
1387									// console.log(jsondata);
1388									if(jsondata.icestats.source.title){
1389										title = jsondata.icestats.source.title;
1390									} else if(jsondata.icestats.source[1].title) {
1391										title = jsondata.icestats.source[1].title;
1392									} else if(jsondata.icestats.source[0].title) {
1393										title = jsondata.icestats.source[0].title
1394									}
1395								}
1396								$.fn.qtApplyTitle(title);
1397							},
1398							error: function(e) {
1399							}
1400						});
1401
1402					}
1403				} else if (qtradiofeedHost !== '' && qtradiofeedPort !== '' && typeof(qtradiofeedHost) !== 'undefined'){
1404					var qtscurl 		= 'http://'+qtradiofeedHost+':'+qtradiofeedPort+'/stats?sid='+theChannel+'&json=1',
1405						jsondata, title;
1406
1407					if(qtSCuseproxy === '1'){
1408						// 2017 12 16 with ssl support
1409						
1410						$.ajax({
1411							type: 'GET',
1412							cache: false,
1413							url: proxyURL,
1414							async: true,
1415							data: { 
1416								"qtproxycall": qtscurl,
1417							},
1418							contentType: "application/json",
1419							success: function(data) {
1420								jsondata = JSON.parse(data);
1421								$.fn.qtApplyTitle(jsondata.songtitle);
1422							},
1423							error: function(e) {
1424								console.log(e);
1425							}
1426						});
1427					} else {
1428						
1429						$.SHOUTcast({
1430							host : qtradiofeedHost,
1431							port : qtradiofeedPort,
1432							protocol: qtradiofeedProtocol,
1433							interval: 10000,
1434							stream : theChannel,
1435							stats_path : 'stats',
1436							stats : function(){
1437								if(this.onAir()){
1438									result = this.get('songtitle');
1439									$.fn.qtApplyTitle(result);
1440								}
1441							}
1442						}).startStats();
1443					}
1444				} else if (qtradiodotco !== '' && typeof(qtradiodotco) !== 'undefined'){
1445					var rUrl = 'https://public.radio.co/stations/'+qtradiodotco+'/status'
1446					$.ajax({
1447						type: 'GET',
1448						cache: false,
1449						url: rUrl,
1450						async: true,
1451						contentType: "application/json",
1452						success: function(data) {
1453							title = data['current_track']['title'];
1454							$.fn.qtApplyTitle(title);
1455						},
1456						error: function(e) {
1457							// console.log(e);
1458						}
1459					});
1460				}
1461				
1462			}
1463			
1464		return;
1465	}
1466
1467
1468	/**====================================================================
1469	 *
1470	 * 
1471	 *  Skrollr initialize
1472	 *  
1473	 * 
1474	 ====================================================================*/
1475	$.fn.qtSkrollrInit = function(){
1476		// disable skrollr if using handheld device
1477		if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
1478			return;
1479		}
1480		$.skrollrInstance = skrollr.init({
1481			smoothScrolling: true,
1482			forceHeight: false
1483		});
1484	}
1485
1486
1487
1488	/**====================================================================
1489	 *
1490	 * 
1491	 *  Popup opener (requires library component) 
1492	 *  
1493	 * 
1494	 ====================================================================*/
1495	$.fn.qtPopupwindow = function() {
1496		if(typeof($.fn.popupwindow) !== "undefined"){
1497			$.fn.popupwindow();
1498		}
1499		$.onAir2Obj.body.on('click', "#qtmainmenucontainer .qt-popupwindow", function(i,c){
1500			$('.sm2_playing .sm2-360btn').click();
1501		});
1502	};
1503
1504	
1505
1506	/**====================================================================
1507	 *
1508	 * 
1509	 *  Ajax elements refresh
1510	 *  
1511	 * 
1512	 ====================================================================*/
1513	$.fn.qtAjaxElementsRefresh = function(){
1514		var currentpageUrlBox = $("#qtcurrentpermalink");
1515		if(currentpageUrlBox.length <= 0){
1516			return;
1517		}
1518		var originalContainer, newContent, oldContent;
1519		var link = window.location.href,//currentpageUrlBox.attr("data-permalink"),
1520			itemsToRefresh = new Array("#qtonairhero", "#qtupcomingshowscarousel", "#qtshowslidercontainer", ".qtautoupdate-element", ".qtnowonairwidget", '.qt-upcoming-refresh');
1521		$.ajax({
1522			url: link,
1523			success:function(data) {
1524				$.ajaxData = data;
1525				itemsToRefresh.forEach(function(theselector){
1526					$(theselector).animate({opacity: 0}, 0, function(){
1527						$(theselector).html( $($.ajaxData).find(theselector).html() ).animate({opacity: 1}, 0, function(){
1528							$.fn.dynamicBackgrounds(theselector);
1529							$.fn.slickGallery();
1530						});
1531					});
1532				});
1533			}
1534		});
1535	}
1536	setInterval(function() {
1537		$.fn.qtAjaxElementsRefresh();
1538	},120000);
1539
1540
1541	/**====================================================================
1542	 *
1543	 * 
1544	 *  Open header bar player
1545	 *  
1546	 * 
1547	 ====================================================================*/
1548	$.fn.qtOpenPlayerBar = function(){
1549		$.onAir2Obj.body.on('click', ".qt-openplayerbar", function(e){
1550			e.preventDefault();
1551			$.onAir2Obj.body.toggleClass("qt-playerbar-open");
1552			return true;
1553		});
1554	}
1555	
1556
1557
1558	/**====================================================================
1559	 *
1560	 *	Reinitialize visual composer functions after ajax loading
1561	 * 
1562	 ====================================================================*/
1563	$.fn.initializeVisualComposerAfterAjax = function(){
1564		if(typeof vc_toggleBehaviour === "function"){
1565			vc_toggleBehaviour();
1566		}
1567		if(typeof vc_tabsBehaviour === "function"){
1568			vc_tabsBehaviour();
1569		}
1570		if(typeof vc_accordionBehaviour === "function"){
1571			vc_accordionBehaviour();
1572		}
1573		if(typeof vc_teaserGrid === "function"){
1574			vc_teaserGrid();
1575		}
1576		if(typeof vc_carouselBehaviour === "function"){
1577			vc_carouselBehaviour();
1578		}
1579		if(typeof vc_slidersBehaviour === "function"){
1580			vc_slidersBehaviour();
1581		}
1582		if(typeof vc_prettyPhoto === "function"){
1583			vc_prettyPhoto();
1584		}
1585		if(typeof vc_googleplus === "function"){
1586			vc_googleplus();
1587		}
1588		if(typeof vc_pinterest === "function"){
1589			vc_pinterest();
1590		}
1591		if(typeof vc_initVideoBackgrounds === "function"){
1592			vc_initVideoBackgrounds();
1593		}
1594
1595		
1596		// Reinitialize Page Builder animation
1597		window.setTimeout(function() {
1598			
1599			
1600			jQuery(".wpb_animate_when_almost_visible:not(.wpb_start_animation)").each(function() {
1601				var $el = jQuery(this);
1602				$el.vcwaypoint(function() {
1603					$el.addClass("wpb_start_animation animated");
1604				}, {
1605					offset: "85%"
1606				})
1607			});
1608
1609		}, 250); // set timeout in ms
1610
1611		
1612
1613
1614		$("body [data-bgimagevc]").each(function() {
1615			var that = $(this),
1616				bg = that.attr("data-bgimagevc"),
1617				bgattachment = that.attr("data-bgattachment");
1618			if (bgattachment === undefined) {
1619				bgattachment = "static";
1620			}
1621			if (bg !== '') {
1622				that.css({
1623					"background-image": "url(" + bg + ")",
1624					"background-attachment": "fixed"
1625				});
1626			}
1627		});
1628
1629	}
1630
1631
1632
1633
1634	/**====================================================================
1635	 *
1636	 *	Onlu After ajax page initialization
1637	 * 	Used by QT Ajax Pageloader. 
1638	 * 	MUST RETURN TRUE IF ALL OK.
1639	 * 
1640	 ====================================================================*/
1641	$.fn.initializeOnlyAfterAjax = function(){
1642		var autoselect = $('.qt-autoselect-channel');
1643		if(autoselect.length > 0){
1644			autoselect.click();
1645		}
1646	}
1647
1648	
1649
1650	/**====================================================================
1651	 *
1652	 *	After ajax page initialization
1653	 * 	Used by QT Ajax Pageloader. 
1654	 * 	MUST RETURN TRUE IF ALL OK.
1655	 * 
1656	 ====================================================================*/
1657	$.fn.initializeAfterAjax = function(){
1658
1659		$.fn.slickGallery();
1660		$.fn.qtQtSwitch();
1661		$.fn.dynamicBackgrounds();
1662		$(".qt-pageheader").attr("data-start", "@class: qt-pageheader qt-js qt-negative").attr("data-10-start", "@class: qt-pageheader qt-js qt-negative qt-pageheader-scrolled").promise().done(function(){
1663			$.fn.qtSkrollrInit();
1664		});
1665		if( "undefined" !== typeof($.skrollrInstance)) {
1666			$.skrollrInstance.refresh();
1667		}
1668		
1669		$.fn.qtSharelink();
1670		$.fn.qtMasonry();
1671		$.fn.qtCountdown();
1672		$.fn.qtFitvids();
1673		$.fn.qtPushpin();
1674		$.fn.transformlinks("#maincontent");
1675		$.fn.NewYoutubeResize();
1676
1677		// $(".not-collapse").on("click", function(e) { e.stopPropagation();  });
1678		if( "undefined" !== typeof($.fn.qtChartvoteInit)) {
1679			$.fn.qtChartvoteInit();
1680		}
1681		$('.qt-collapsible').collapsible();
1682
1683
1684		jQuery('ul.tabs').tabs();
1685		
1686		if(false === $.fn.qtIsMobileBrowser() && $(window).width() > 1279 ) {
1687			$('.qt-tooltipped').tooltip({delay: 50});
1688		}
1689		
1690		if(typeof jQuery.vdl_Init === "function"){
1691			jQuery.vdl_Init();
1692		}
1693
1694
1695		if(typeof $.qtSwipeboxFunction === "function"){
1696			$.qtSwipeboxFunction();
1697		}
1698
1699
1700		if(typeof $.fn.qtDynamicMaps === "function"){
1701			$.fn.qtDynamicMaps();
1702		}
1703		if(typeof $.fn.qtPlacesInit === "function"){
1704			$.fn.qtPlacesInit();
1705		}
1706		$( "#qwShowDropdown" ).on("change", function() {
1707			$(this).closest('.qt-show-schedule').find("#"+this.value).click();
1708		});
1709
1710		$.fn.qtPopupwindow();
1711		if(!$('body').hasClass('qt-html5audio-disable')){
1712			jQuery('video').mediaelementplayer();
1713			jQuery('audio').mediaelementplayer();
1714		}
1715
1716		return true;
1717	}
1718	
1719	/**====================================================================
1720	 *
1721	 *	Page Ready Trigger
1722	 * 	This needs to call only $.fn.qtInitTheme
1723	 * 
1724	 ====================================================================*/
1725	jQuery(document).ready(function() {
1726		$.fn.qtPageloadInit();
1727		$.fn.qtMobileNav();
1728		$.fn.qt360player();
1729		$.fn.qtShoutcastFeedNew();
1730		$.fn.qtOpenPlayerBar ();
1731		qtShoutcastInterval = setInterval( function() { $.fn.qtShoutcastFeedNew(); }
1731 , 15000);
1732		$.fn.initializeAfterAjax();
1733		$.fn.qtRadioAutoplay();  //Chrome 66 update: autoplay deprecated
1734		/* If not in debug mode, the console messages are suppressed ============*/
1735		if(!$.onAir2Obj.body.hasClass("qt-debug")) {
1736			/*var console = {};
1737			console.log = function(){};
1738			window.console = console;*/
1739		}
1740	});
1741
1742})(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.