PageSourceSearch

https://explore-mag.com/wp-content/themes/exploremag/js/theme.js?ver=20311324

js explore-mag.com collected 2026-10-02 03:38:15 UTC 10,696 bytes, 447 lines download raw bytes

1jQuery(document).ready(function(){
2	
3	jQuery('.ad-square-aside iframe').on('load', function() {
4		// Access the iframe's document
5		var iframeDocument = jQuery(this).contents();
6	
7		// Find the image element within the iframe
8		var image = iframeDocument.find('.img_ad, img');
9	
10		// Update the width attribute of the image
11		setTimeout(function() { 
12			image.attr('width', '100%'); // Set the new width (e.g., 300 pixels)
13			image.attr('height', 'auto');
14		},500);
15	});
16	
17	
18	// fix for in article images that have wrong extension
19		if (!jQuery('.articleImage.ignore').length>0) {
20			jQuery('.articleLink').find('.imageBox').each(function(){
21		  	var current_bg = jQuery(this).css('background');
22	
23				if(current_bg.indexOf('-jpg.webp') !=-1)
24		    	{
25		      	current_bg = current_bg.replace('-jpg.webp','.png');
26		      	jQuery(this).css('background',current_bg);
27		    	}
28			});
29		}
30	/////////
31	
32	// fix for in article images that have wrong extension
33		if (jQuery('img.lazyload').length>0) {
34			jQuery('img.lazyload').each(function(){
35			  var data_src = jQuery(this).data('src');
36			  
37			  	if(data_src !=-1) {
38				  jQuery(this).attr('src',data_src);
39				}
40			});
41		}
42	/////////
43	
44	
45	/// fix for more article image links from the bottom of articles where the image extension is wrong 
46	jQuery('.articleImage a').each(function(){
47	var el = jQuery(this);
48  var bg_image_url = el.attr('style');
49    if(typeof bg_image_url != 'undefined')
50    {
51
52	  if(bg_image_url.indexOf('url') !=-1)
53	    {
54	      // get url
55	
56	      var bg_url_end_pos = bg_image_url.indexOf(")");
57	      var bg_url_start_pos = bg_image_url.indexOf("(");
58	      bg_image_url = bg_image_url.substring(bg_url_start_pos,bg_url_end_pos);
59	      bg_image_url = bg_image_url.replace('("',"");
60	      bg_image_url = bg_image_url.replace('"','');
61	
62	      
63	      
64	       var url_attempt_1 = bg_image_url;
65			//url_attempt_1 = url_attempt_1.replace('.png','.jpg');
66		   	console.log(url_attempt_1);
67			jQuery.ajax({
68		   		url:url_attempt_1,
69		   		type:'get',
70		   		async: false,
71		   		error:function(response){
72		        
73		         var url_attempt_2 = bg_image_url;
74					url_attempt_2 = url_attempt_1.replace('.png','.jpg');
75				   	console.log(url_attempt_2);
76					jQuery.ajax({
77				   		url:url_attempt_2,
78				   		type:'get',
79				   		async: false,
80				   		error:function(response){
81				        
82				        
83				        
84				      },
85				    	success:function(response){
86								           	el.css('background','url("'+url_attempt_2+'") 50% 50% / cover');
87								
88				      },
89				    });
90
91		        
92		      },
93		    	success:function(response){
94						          // 	el.css('background','url("'+url_attempt_1+'") 50% 50% / cover');
95						
96		      },
97		    });
98		    
99	    }
100	  }
101});
102	
103	//// another fix for old article images
104	jQuery('.article-wrap img').error(function(){
105		//console.log(jQuery(this));
106		var el = jQuery(this);
107		
108		
109
110
111		//var el = 	jQuery(jQuery('.article-wrap img')[3]);
112	    var url_attempt_1 = el.attr('src');
113		url_attempt_1 = url_attempt_1.replace('-jpg.webp','.jpg');
114	    console.log(url_attempt_1);
115	   	
116		jQuery.ajax({
117	   		url:url_attempt_1,
118	   		type:'get',
119	   		async: false,
120	   		error:function(response){
121	        
122	          var url_attempt_2 = el.attr('src');
123		url_attempt_2 = url_attempt_2.replace('-jpg.webp','.png');
124	
125	        jQuery.ajax({
126	   		url:url_attempt_2,
127	   		type:'get',
128	   		async: false,
129	   		error:function(response){
130	        
131	        
132	          var url_attempt_3 = el.attr('src');
133						url_attempt_3 = url_attempt_3.replace('-jpg.webp','.jpg');
134						url_attempt_3 = url_attempt_3.replace('/2024/02','/2024/03');
135	        
136	        	 jQuery.ajax({
137	   		url:url_attempt_3,
138	   		type:'get',
139	   		async: false,
140	   		error:function(response){
141	        
142	        
143	          var url_attempt_4 = el.attr('src');
144						url_attempt_4 = url_attempt_4.replace('-jpg.webp','.png');
145						url_attempt_4 = url_attempt_4.replace('/2024/02','/2024/03');
146	        
147	         jQuery.ajax({
148	   		url:url_attempt_4,
149	   		type:'get',
150	   		async: false,
151	   		error:function(response){
152	        
153	        
154				
155				var url_attempt_5 = el.attr('src');
156				url_attempt_5 = url_attempt_5.replace('-jpeg.webp','.jpeg');
157						//url_attempt_5 = url_attempt_5.replace('/2024/02','/2024/03');
158				
159						
160				jQuery.ajax({
161				url:url_attempt_5,
162				type:'get',
163				async: false,
164				error:function(response){
165						
166					var url_attempt_6 = el.attr('src');
167						url_attempt_6 = url_attempt_6.replace('/2024/02','/2024/03');
168							//url_attempt_5 = url_attempt_5.replace('/2024/02','/2024/03');
169					
170							
171					jQuery.ajax({
172					url:url_attempt_6,
173					type:'get',
174					async: false,
175					error:function(response){
176					
177					
178					},
179					success:function(response){
180						el.attr('src',url_attempt_6);
181						
182					},
183					});
184		        
185
186				
187				},
188				success:function(response){
189					el.attr('src',url_attempt_5);
190					
191				},
192				});
193	        
194	      },
195	    	success:function(response){
196	       el.attr('src',url_attempt_4);
197					
198	      },
199	    });
200	        
201	      },
202	    	success:function(response){
203	       el.attr('src',url_attempt_3);
204					
205	      },
206	    });
207	        
208	      },
209	    	success:function(response){
210	       el.attr('src',url_attempt_2);
211					
212	      },
213	    });
214	    
215	        
216	        
217	        
218	      },
219	    	success:function(response){
220	       el.attr('src',url_attempt_1);
221					
222	      },
223	    });
224	    
225
226		
227		
228		
229		
230		
231	});
232	
233	
234	
235	
236	
237	
238	// Define Elements
239	
240	//REL.E.elementname = jQuery('#elementname');
241	
242	if (jQuery(window).width() >= 782) {
243	
244		var height = jQuery('.flyout-header').height() + 32;
245		
246		jQuery('.flyout-wrap').css("height", height + 'px');
247	
248	} else if (jQuery(window).width() < 767) {
249		var height = jQuery('.fixed-header').height()  + 35;
250		
251		jQuery('#content').css("padding-top", height + 'px');
252	} else {
253		
254	}
255	
256	if(jQuery('.popular-posts').length>0) {
257		jQuery('.popular-posts').slick({
258			autoplay: true,
259			arrows: true,
260			dots: true,
261			centermode: true,
262			slidesToShow: 3,
263			responsive: [
264				{
265				  breakpoint: 960,
266				  settings: {
267					slidesToShow: 2,
268					}
269				},{
270			  	breakpoint: 667,
271			  	settings: {
272					slidesToShow: 1,
273			  	  }
274				}  
275			]
276		});
277	}
278	
279	if(jQuery('.square').length>0) {
280		jQuery('.square').width(jQuery('.square').height());
281	}
282	
283	if(jQuery('.fetch-high').length>0) {
284		jQuery('.fetch-high img').each(function () {
285			jQuery(this).attr("fetchpriority","high");
286		});
287	}
288	
289	if(jQuery('.fetch-low').length>0) {
290		jQuery('.fetch-low img').each(function () {
291			jQuery(this).attr("fetchpriority","low");
292		});
293	}
294	
295	
296	
297	// subscribe menu
298	jQuery('.subscribe-menu a.wp-block-button__link').on('click', function() {
299		jQuery(this).toggleClass("is-active");
300		
301		jQuery('.subscribe-submenu').slideToggle();
302		jQuery('.subscribe-submenu').addClass("is-active");
303	});
304	
305	REL.init();
306});
307
308
309
310var REL = {};
311REL.E = {};
312
313REL.init = function() {
314	
315	if(jQuery('.contributors-list').length>0) {
316		REL.contributorsLoadMore();
317	}
318	
319}
320
321jQuery.fn.isInViewport = function() {
322	var elementTop = jQuery(this).offset().top;
323	var elementBottom = elementTop + jQuery(this).outerHeight();
324
325	var viewportTop = jQuery(window).scrollTop();
326	var viewportBottom = viewportTop + jQuery(window).height();
327
328	return elementBottom > viewportTop && elementTop < viewportBottom;
329};
330
331REL.contributorsLoadMore = function() {
332	
333	var jQuerycontainer = jQuery('.contributors-list').isotope({
334		itemSelector: '.contributor-item',
335		layoutMode: 'fitRows',
336	});
337	
338	var initShow = 20; //number of items loaded on init & onclick load more button
339	var counter = initShow; //counter for load more button
340	var iso = jQuerycontainer.data('isotope'); // get Isotope instance
341	var maxheight = 0;
342	jQuery('.contributor-item').each(function () {
343		maxheight = (jQuery(this).height() > maxheight ? jQuery(this).height() : maxheight); 
344	});
345	jQuery('.contributor-item').height(maxheight);
346	
347	loadMore(initShow); //execute function onload
348	
349	function loadMore(toShow) {
350		jQuerycontainer.find(".hidden").removeClass("hidden");
351		
352		var hiddenElems = iso.filteredItems.slice(toShow, iso.filteredItems.length).map(function(item) {
353			return item.element;
354		});
355		jQuery(hiddenElems).addClass('hidden');
356		jQuerycontainer.isotope('layout');
357		
358		//when no more to load, hide show more button
359		if (hiddenElems.length == 0) {
360			jQuery("#load-more").hide();
361		} else {
362			jQuery("#load-more").show();
363		};
364	}
365	
366	//append load more button
367	jQuerycontainer.after('<button id="load-more"> Load More</button>');
368	
369	//when load more button clicked
370	jQuery('#load-more').click(function() {
371		counter = counter + initShow;
372		
373		loadMore(counter);
374	});
375	
376	
377	jQuery(window).on('resize scroll', function() {
378		setTimeout(function() { 
379			if (jQuery('#load-more').isInViewport()) {
380				jQuery('#load-more').click();
381			}
382		},500);
383	});
384}
385
386
387
388REL.middleArticleAdPlacement = function () {
389	
390	function articleAdMiddleLoad() {
391		
392		
393					if (typeof jQuery != "undefined") {
394
395						var lastPosition = 0;
396						var minimumDistanceBetweenAds = 1200;
397						var minimumDistanceFromBottom = 1000;
398						var adsToPlace = 50;
399
400						for(var i = 1; i <= adsToPlace; i++) {
401
402							var spotFound = false;
403
404							// Loop through each HTML element in the article to find a spot for an ad.
405							jQuery(".entry-content").children('p').each(function() {
406								if(
407									jQuery(this).position().top - lastPosition > 0	// element is after last placed ad
408									&& !jQuery(this).hasClass("articleAdMiddle")		// element is not an ad
409									&& jQuery(".entry-content").height() - jQuery(this).position().top > minimumDistanceFromBottom	// enough space from the bottom of the article
410									&& (
411										jQuery(this).position().top - lastPosition > minimumDistanceBetweenAds 	// enough space between ads
412										|| 
413										jQuery(this).prev().hasClass("articleSlideshow") // previous element is a slideshow
414									)
415								) {
416									jQuery("#articleAdMiddle" + i).addClass('active');
417									jQuery(this).after(jQuery("#articleAdMiddle" + i));
418									googletag.display("div-ad-articleMiddle" + i);
419
420									lastPosition = jQuery(this).position().top;
421									spotFound = true;
422
423									return false;
424								}
425							});
426// console.log(spotFound);
427							// If no spot can be found, stop the loop and remove any remaining banner slots.
428							if(!spotFound) {
429								
430								for(var j = i; j <= adsToPlace; j++) {
431
432									jQuery("#articleAdMiddle" + j).remove();
433								}
434								break;
435							}
436						}
437					} else {
438
439						setTimeout(articleAdMiddleLoad, 500);
440					}
441				}
442
443				setTimeout(articleAdMiddleLoad, 500);
444}
445
446
447

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.