PageSourceSearch

https://allnews.ch/themes/simple/assets/js/main.js?tlrjnp

js allnews.ch collected 2026-09-24 09:22:50 UTC 9,342 bytes, 325 lines download raw bytes

1var videoElement;
2// Define a variable to track whether there are ads loaded and initially set it to false
3var adsLoaded = false;
4var adContainer;
5var adDisplayContainer;
6var adsLoader;
7var adsManager;
8
9
10window.addEventListener('load', function(event) {
11  videoElement = document.getElementById('video-element');
12  initializeIMA();
13  if(videoElement != null) {
14
15    videoElement.addEventListener('play', function(event) {
16      loadAds(event);
17    });
18xs  }
19});
20
21window.addEventListener('resize', function(event) {
22  if(adsManager) {
23    var width = videoElement.clientWidth;
24    var height = videoElement.clientHeight;
25    adsManager.resize(width, height, google.ima.ViewMode.NORMAL);
26  }
27});
28
29function initializeIMA() {
30  adContainer = document.getElementById('div-gpt-ad-1631872125800-0');
31  if (adContainer !== null) {
32    adContainer.addEventListener('click', adContainerClick);
33    
34    adDisplayContainer = new google.ima.AdDisplayContainer(adContainer, videoElement);
35    adsLoader = new google.ima.AdsLoader(adDisplayContainer);
36    
37    adsLoader.addEventListener(
38      google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
39      onAdsManagerLoaded,
40      false);
41    adsLoader.addEventListener(
42      google.ima.AdErrorEvent.Type.AD_ERROR,
43      onAdError,
44      false);
45    
46    
47    if(videoElement != null) {
48      // Let the AdsLoader know when the video has ended
49      videoElement.addEventListener('ended', function() {
50        adsLoader.contentComplete();
51      });
52      
53      var adsRequest = new google.ima.AdsRequest();
54      adsRequest.adTagUrl = 'https://pubads.g.doubleclick.net/gampad/ads?' +
55        'iu=/1631872125800/external/allnews_wide&sz=400x300&' +
56        'cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&' +
57        'gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=';
58      
59      // Specify the linear and nonlinear slot sizes. This helps the SDK to
60      // select the correct creative if multiple are returned.
61      adsRequest.linearAdSlotWidth = videoElement.clientWidth;
62      adsRequest.linearAdSlotHeight = videoElement.clientHeight;
63      adsRequest.nonLinearAdSlotWidth = videoElement.clientWidth;
64      adsRequest.nonLinearAdSlotHeight = videoElement.clientHeight / 3;
65      
66      // Pass the request to the adsLoader to request ads
67      adsLoader.requestAds(adsRequest);
68    }
69  }
70}
71
72function onAdsManagerLoaded(adsManagerLoadedEvent) {
73  // Instantiate the AdsManager from the adsLoader response and pass it the video element
74  adsManager = adsManagerLoadedEvent.getAdsManager(
75    videoElement);
76
77  adsManager.addEventListener(
78    google.ima.AdErrorEvent.Type.AD_ERROR,
79    onAdError);
80
81  adsManager.addEventListener(
82    google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
83    onContentPauseRequested);
84  adsManager.addEventListener(
85    google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
86    onContentResumeRequested);
87  adsManager.addEventListener(
88    google.ima.AdEvent.Type.LOADED,
89    onAdLoaded);
90}
91
92function onAdLoaded(adEvent) {
93  var ad = adEvent.getAd();
94  if (!ad.isLinear() && videoElement != null) {
95    videoElement.play();
96  }
97}
98
99function onContentPauseRequested() {
100  if(videoElement != null) {
101    videoElement.pause();
102  }
103}
104
105function onContentResumeRequested() {
106  if(videoElement != null) {
107    videoElement.play();
108  }
109}
110
111function onAdError(adErrorEvent) {
112  // Handle the error logging.
113  if(adsManager) {
114    adsManager.destroy();
115  }
116}
117
118function adContainerClick(event) {
119  if(videoElement.paused) {
120    videoElement.play();
121  } else {
122    videoElement.pause();
123  }
124}
125
126function loadAds(event) {
127  // Prevent this function from running on if there are already ads loaded
128  if(adsLoaded) {
129    return;
130  }
131  adsLoaded = true;
132
133  // Prevent triggering immediate playback when ads are loading
134  event.preventDefault();
135
136  // Initialize the container. Must be done via a user action on mobile devices.
137  videoElement.load();
138  adDisplayContainer.initialize();
139
140  var width = videoElement.clientWidth;
141  var height = videoElement.clientHeight;
142  try {
143    adsManager.init(width, height, google.ima.ViewMode.NORMAL);
144    adsManager.start();
145  } catch (adError) {
146    // Play the video without ads, if an error occurs
147    videoElement.play();
148  }
149  
150}
151
152(function ($, Drupal){
153  $(window).on("load",function() {
154
155    var modal = document.querySelectorAll('.mc-modal-bg');
156
157    if (typeof modal[0] !=  'undefined') {
158      modal[0].addEventListener('click', function(event) {
159        document.querySelectorAll('#PopupSignupForm_0')[0].setAttribute('style','display:none');
160        // Stop the click event from propagating to the parent
161        event.stopPropagation();
162      });
163    }
164    
165    var links = document.querySelectorAll('#background a');
166    
167    // Add click event listener to each link
168    links.forEach(function(link) {
169      link.addEventListener('click', function(event) {
170        // Stop the click event from propagating to the parent
171        event.stopPropagation();
172      });
173    });
174    
175    jQuery('.partner-logos .flexslider').flexslider({
176      animation: "slide",
177      itemWidth: 132,
178      itemMargin: 10
179    });
180
181   $('.article-content img').click(function(){
182    if (jQuery(this).parent()[0].tagName != 'A') {
183      var jQuerysrc = jQuery(this).attr("src");
184      jQuery(".showpop").fadeIn();
185      jQuery(".img-show img").attr("src", jQuerysrc);
186    }
187  });
188   
189  jQuery("button, .overlay, .img-show").click(function () {
190      jQuery(".showpop").fadeOut();
191  });
192    
193    jQuery('.flexslider').flexslider({
194      animation: "slide"
195    });
196    
197    
198    jQuery('html').addClass('redpandas-will-rule-the-world');
199    jQuery('html').addClass('js');
200    
201    
202    if(Modernizr.input.placeholder) {
203      jQuery('html').addClass('placeholder');
204    } else {
205      jQuery('html').addClass('no-placeholder');
206    }
207    
208    if ( !("placeholder" in document.createElement("input")) ) {
209      jQuery("input[placeholder], textarea[placeholder]").each(function() {
210        var val = jQuery(this).attr("placeholder");
211        if ( this.value == "" ) {
212          this.value = val;
213        }
214        jQuery(this).focus(function() {
215          if ( this.value == val ) {
216            this.value = "";
217          }
218        }).blur(function() {
219          if ( jQuery.trim(this.value) == "" ) {
220            this.value = val;
221          }
222        })
223      });
224      
225      // Clear default placeholder values on form submit
226      jQuery('form').submit(function() {
227        jQuery(this).find("input[placeholder], textarea[placeholder]").each(function() {
228          if ( this.value == jQuery(this).attr("placeholder") ) {
229            this.value = "";
230          }
231        });
232      });
233    }
234    
235    jQuery("#menu-toggle").click(function(event){
236      jQuery("body").toggleClass("offcanvas");
237      jQuery(this).toggleClass("close");
238      jQuery(".site-header .searchform-container").toggleClass("hidden");
239      event.preventDefault();
240    });
241    
242    // Toggle search form
243    
244    jQuery(".site-header .searchform-container").addClass("hidden");
245    
246    jQuery(".searchform-controller").click(function(event){
247      
248      var searchContainer = jQuery(this).siblings(".site-header .searchform-container");
249      var hiddenValue = searchContainer.attr("class");
250      var searchField = searchContainer.find(".search-field");
251      
252      searchContainer.toggleClass("hidden");
253      jQuery("body").toggleClass("offcanvas");
254      jQuery("#menu-toggle").toggleClass("close");
255      
256      if ( ! searchContainer.hasClass("hidden") ) {
257        searchField.focus();
258      }
259      event.preventDefault();
260    });
261
262 const tablist = $("[role='tablist']").find("[role='tab']");
263 
264 function tabsClickHandler(){  
265   var thisTabId = $(this).attr('id');
266   var thisTabList = $(this).parents("[role='tablist']").find("[role='tab']");  
267   
268   thisTabList.each(function(){ 
269     var thisTabPanel = $("[role='tabpanel'][id='"+$(this).attr('aria-controls')+"']");
270     if($(this).attr('id') == thisTabId){
271       thisTabPanel.removeClass("hide"); 
272       $(this).attr('aria-selected', true)
273         .attr('tabindex', '0');   
274     } else {  
275       thisTabPanel.addClass("hide");
276       $(this).attr('aria-selected', false)
277         .attr('tabindex', '-1');
278     }
279   });
280 }
281 
282 function tabsHandler(event){
283   
284   var index = tablist.index($(this));
285   var numbTabs = tablist.length;
286   var nextId;
287 
288   if(numbTabs>1){
289 
290     if(event.keyCode == 40 || event.keyCode == 39) { // DOWN or RIGHT
291       nextId = tablist.eq(index+1);
292 
293       if(index == numbTabs-1){ // if it is the last not empty tab, then go to first not empty tab
294         nextId = tablist.eq(0);
295       }
296 
297       nextId.focus(); // focus on next tab
298       nextId.click();
299     }
300 
301     if(event.keyCode == 38 || event.keyCode == 37) { // UP or LEFT
302       nextId = tablist.eq(index-1);
303 
304       if(index == 0){ // if it is the last not empty tab, then go to first not empty tab
305         nextId = tablist.eq(numbTabs-1);
306       }
307 
308       nextId.focus(); // focus on next tab
309       nextId.click();
310     }
311   }
312 }
313 
314 tablist.on('keydown', tabsHandler);
315 tablist.on('click', tabsClickHandler);
316 
317    $("[role='tablist'] [role='tab'][aria-selected='true']").click();
318    
319    
320    jQuery(".close-search").click(function(event){
321      
322    });
323  });
324})(jQuery, Drupal);
325

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.