PageSourceSearch

https://www.podcast.elmeezan.com/wp-content/themes/wpcast/js/qt-main.js

js elmeezan.com collected 2026-10-02 20:04:03 UTC 12,884 bytes, 430 lines download raw bytes

1/**====================================================================
2 *
3 *  Main Script File
4 *
5 *====================================================================*/
6(function($) {
7	"use strict";
8
9	var wpcastDebugEnabled = 0, // set to 1 to enable console logging
10	wpcastDebug = function(msg){
11		if(wpcastDebugEnabled){
12			if ( typeof(console) !== 'undefined' ) { 
13				if( typeof(console.log) === 'function' ){
14					console.log(msg);
15				}
16			}
17		}
18	};
19
20	$.qantumthemesMainObj = {
21		/**
22		 * Global function variables and main objects
23		 */
24		body: $("body"),
25		window: $(window),
26		document: $(document),
27		htmlAndbody: $('html,body'),
28		scrolledTop: 0, // global value of the amount of top scrolling
29		oldScroll: 0,
30		scroDirect: false,
31		clock: false,
32		OTS: $("#wpcast-Sticky"), // Object To Stick
33
34		/**
35		 * ======================================================================================================================================== |
36		 * 																																			|
37		 * 																																			|
38		 * START SITE FUNCTIONS 																													|
39		 * 																																			|
40		 *																																			|
41		 * ======================================================================================================================================== |
42		 */
43		
44		fn: {
45			isExplorer: function(){
46				return /Trident/i.test(navigator.userAgent) ;
47			},
48			isSafari: function(){
49				return /Safari/i.test(navigator.userAgent) ;
50			},
51			isMobile: function(){
52				return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || $.qantumthemesMainObj.window.width() < 1170 ;
53			},
54
55			/** random id when required
56			====================================================================*/
57			uniqId: function() {
58			  return Math.round(new Date().getTime() + (Math.random() * 100));
59			},
60
61			/** Check if pics are loaded for given cotnainer
62			====================================================================*/
63			imagesLoaded: function (container) {
64				var f = $.wpcastXtendObj.fn;
65				var $imgs = $(container).find('img[src!=""]');
66				if (!$imgs.length) {return $.Deferred().resolve().promise();}
67				var dfds = [];  
68				$imgs.each(function(){
69					var dfd = $.Deferred();
70					dfds.push(dfd);
71					var img = new Image();
72					img.onload = function(){dfd.resolve();}
73					img.onerror = function(){dfd.resolve();}
74					img.src = this.src;
75				});
76				// return a master promise object which will resolve when all the deferred objects have resolved
77				// IE - when all the images are loaded
78				return $.when.apply($,dfds);
79			},
80
81			// Website tree menu			
82			treeMenu: function() {
83				$( ".wpcast-menu-tree li.menu-item-has-children" ).each(function(i,c){
84					var t = $(c);
85					t.find('> a').after("<a class='wpcast-openthis'><i class='material-icons'>keyboard_arrow_down</i></a>");
86					t.on("click","> .wpcast-openthis", function(e){
87						e.preventDefault();
88						t.toggleClass("wpcast-open");
89						return false;
90					});
91					return;
92				});
93				return true;
94			},
95			
96			/* activates
97			*  Adds and removes the class "wpcast-active" from the target item	
98			====================================================================*/
99			activates: function(){
100				var t, // target
101					o = $.qantumthemesMainObj,
102					s = false;
103				o.body.off("click", "[data-wpcast-activates]");
104				o.body.on("click", "[data-wpcast-activates]", function(e){
105					e.preventDefault();
106					s = $(this).attr("data-wpcast-activates")
107					t = $(s);
108					if(!s || s === ''){
109						t = $(this);
110					}
111					if( s == 'parent'){
112						t = $(this).parent();
113					}
114					if( s == 'gparent'){
115						t = $(this).parent().parent();
116					}
117					t.toggleClass("wpcast-active");
118					return;
119				});
120			},
121
122			/* switchClass
123			*  toggles the class defined with "data-wpcast-switch" from the target element data-wpcast-target
124			*  used to change state of other items (search and similar)
125			====================================================================*/
126			switchClass: function(){
127
128				var t,tc, // target
129					c, // class to switch
130					o = $.qantumthemesMainObj;
131				o.body.off("click", "[data-wpcast-switch]");
132				o.body.on("click", "[data-wpcast-switch]", function(e){
133					e.preventDefault();
134					tc = $(this).attr("data-wpcast-target");
135					t = $(tc);
136					c = $(this).attr("data-wpcast-switch");
137					t.toggleClass(c);
138					if(tc === '#wpcastSearchBar'){
139						if(t.hasClass(c)){
140							setTimeout(function() { $('#wpcast-searchbar-input').focus() }, 200);
141						} else {
142							$('#wpcast-searchbar-input').blur();
143						}
144					}
145				});
146			},
147
148			extractYoutubeId: function(url){
149				if(void 0===url)return!1;
150				var id=url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
151				return null!==id&&id[1];
152			},
153
154			/**
155			 * Fix video background Page Builder rows su ajax load
156			 */
157			qtVcVideobg: function(){
158				var o = $.qantumthemesMainObj,
159					f = o.fn,
160					ytu, t, vid;
161				jQuery("[data-wpcast-video-bg]").each(
162					function(){
163						t = $(this);
164						if( typeof( insertYoutubeVideoAsBackground ) == 'function' && typeof(vcResizeVideoBackground) == 'function' ){
165							insertYoutubeVideoAsBackground(t, f.extractYoutubeId( t.data("wpcast-video-bg") ) );
166							vcResizeVideoBackground(t);
167						}
168					}
169				);
170			},
171
172			/* Responsive video resize
173			====================================================================*/
174			YTreszr: function  (){
175				jQuery("iframe").each(function(i,c){ // .youtube-player
176					var t = jQuery(this);
177					if(t.attr("src")){
178						var href = t.attr("src");
179						if(href.match("youtube.com") || href.match("vimeo.com") || href.match("vevo.com") ){
180							var width = t.parent().width(),
181								height = t.height();
182							t.css({"width":width});
183							t.height(width/16*9);
184						}; 
185					};
186				});
187			},
188
189		
190
191			/* Trigger custom functions on window resize, with a delay for performance enhacement
192			====================================================================*/
193			windoeResized: function(){
194				var rst,
195					o = $.qantumthemesMainObj,
196					f = o.fn,
197					w = o.window,
198					ww = w.width(),
199					wh = w.height();
200				
201				$(window).on('resize', function(e) {
202					clearTimeout(rst);
203					rst = setTimeout(function() {
204						if (w.height() != wh) {
205							f.stickyHeaderPrep();
206							f.themeScroll();
207						}
208						if (w.width() != ww){
209							f.stickyHeaderPrep();
210							f.YTreszr();
211						}
212					}, 80);
213				});
214			},
215
216			ipadBgFix: function(){
217				var o = $.qantumthemesMainObj,
218					f = o.fn;
219				if(f.isMobile() && f.isSafari()){
220					o.body.addClass('wpcast-safari-mobile');
221				}
222			},
223
224			/**===================================================================
225			* REINITIALIZATION FOR AJAX ELEMENTS
226			* --------------------------------------------------------------------
227			* IMPORTANT: this function needs to be always called wpcastreinit in order
228			* to work properly with the plugins (in particular the xTend)
229			* ====================================================================
230			* */
231			wpcastreinit: function(cont){
232				if(undefined === cont) {
233					return;
234				}
235				var f = $.qantumthemesMainObj.fn;
236				$(cont+' audio').mediaelementplayer();
237			},
238
239			/* Parallax background
240			====================================================================*/
241			qtParallax: function(){
242				if('undefined'  == typeof($.stellar) ){
243					return;
244				}
245				var o = $.qantumthemesMainObj,
246					b = o.body;
247				if(o.fn.isMobile()){return;}
248				b.stellar('destroy');
249				b.stellar({
250					hideDistantElements: false,
251				});
252			},
253
254
255			/* scrolledTop: set a global parameter with the amount of top scrolling
256			*	Used by themeScroll
257			====================================================================*/
258			scrolledTop: function(){
259				var o = $.qantumthemesMainObj,
260					s = window.pageYOffset || document.documentElement.scrollTop,
261					d = 0;
262				d = o.scrolledTop - s;
263				if(d != 0){
264					o.scroDirect = d;
265				}
266				o.scrolledTop = s;
267				return s;
268			},
269
270			/* Sticky header preparation
271			====================================================================*/
272			stickyHeaderPrep: function  (){
273				var o = $.qantumthemesMainObj;
274				o.OTS.css({'height': o.OTS.outerHeight()+'px'});
275			},
276			/* Sticky header
277			====================================================================*/
278			stickyHeader: function  (st){
279				var o = $.qantumthemesMainObj; // object to stick
280				if(o.fn.isMobile()){
281					return;
282				}
283				if(o.OTS.length == 0 ){return;}
284				if( o.OTS.position().top < st ){
285					o.OTS.addClass("wpcast-stickme");
286				} else {
287					o.OTS.removeClass("wpcast-stickme");
288				}
289			},
290			
291
292			/* Theme clock: perform some actions at some interval
293			====================================================================*/
294			themeScroll: function(){
295				var o = $.qantumthemesMainObj,
296					f = o.fn,
297					st, // scrolled top, global
298					os; // old scrolled top value
299				
300				if(o.clock !== false){
301					clearInterval( o.clock );
302				}	
303				o.clock = setInterval(
304					function(){
305						f.scrolledTop(); // updates the static value o.scrolledTop
306						st = o.scrolledTop;
307						os = o.oldScroll;
308						if( os !== st  ){
309							o.oldScroll = st;
310							// be sure we perofm only when scroll changes
311							f.stickyHeader(st);
312						}
313					},80
314				);
315			},
316
317			/* Reinitialize manually the Page Builder functions after ajax page load
318			====================================================================*/
319			initializeVisualComposerAfterAjax: function(){
320				if(typeof vc_toggleBehaviour === "function"){
321					vc_toggleBehaviour();
322				}
323				if(typeof vc_tabsBehaviour === "function"){
324					vc_tabsBehaviour();
325				}
326				if(typeof vc_accordionBehaviour === "function"){
327					vc_accordionBehaviour();
328				}
329				if(typeof vc_teaserGrid === "function"){
330					vc_teaserGrid();
331				}
332				if(typeof vc_carouselBehaviour === "function"){
333					vc_carouselBehaviour();
334				}
335				if(typeof vc_slidersBehaviour === "function"){
336					vc_slidersBehaviour();
337				}
338				if(typeof vc_prettyPhoto === "function"){
339					vc_prettyPhoto();
340				}
341				if(typeof vc_googleplus === "function"){
342					vc_googleplus();
343				}
344				if(typeof vc_pinterest === "function"){
345					vc_pinterest();
346				}
347				// $(".not-collapse").on("click", function(e) { e.stopPropagation();  });
348				if( typeof($.fn.qtChartvoteInit) === "function") {
349					$.fn.qtChartvoteInit();
350				}
351				$("body [data-bgimagevc]").each(function() {
352					var that = $(this),
353						bg = that.attr("data-bgimagevc"),
354						bgattachment = that.attr("data-bgattachment");
355					if (bgattachment === undefined) {
356						bgattachment = "static";
357					}
358					if (bg !== '') {
359						that.css({
360							"background-image": "url(" + bg + ")",
361							"background-attachment": "fixed"
362						});
363					}
364				});
365			},
366
367			resetOverlay: function(){
368				$('.wpcast-overlayopen').removeClass('wpcast-overlayopen');
369			},
370
371			/**====================================================================
372			 *
373			 *	After ajax page initialization
374			 * 	Used by QT Ajax Pageloader. 
375			 * 	MUST RETURN TRUE IF ALL OK.
376			 * 
377			 ====================================================================*/
378			initializeAfterAjax: function(){
379				var f = $.qantumthemesMainObj.fn;
380				f.resetOverlay();
381				f.YTreszr();
382				f.switchClass();
383				f.activates();
384				f.ipadBgFix();
385				f.qtParallax();
386				f.qtVcVideobg();
387				if(typeof $.qtSwipeboxFunction === "function"){
388					$.qtSwipeboxFunction();
389				}
390				if(typeof $.fn.qtPlacesInit === "function"){
391					$.fn.qtPlacesInit();
392				}
393				return true;
394			},
395
396			/**====================================================================
397			 *
398			 * 
399			 *  Functions to run once on first page load
400			 *  
401			 *
402			 ====================================================================*/
403			init: function() {
404				var f = $.qantumthemesMainObj.fn;
405				f.treeMenu();
406				f.stickyHeaderPrep();
407				f.themeScroll();
408				f.initializeAfterAjax();
409				f.windoeResized();// Always last
410			},
411		}
412		/**
413		 * ======================================================================================================================================== |
414		 * 																																			|
415		 * 																																			|
416		 * END SITE FUNCTIONS 																														|
417		 * 																																			|
418		 *																																			|
419		 * ======================================================================================================================================== |
420		 */
421	};
422	/**====================================================================
423	 *
424	 *	Page Ready Trigger
425	 * 
426	 ====================================================================*/
427	jQuery(document).ready(function() {
428		$.qantumthemesMainObj.fn.init();		
429	});
430})(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.