1(function($) { 2 'use strict'; 3 4 var urlParams = new URLSearchParams(window.location.search); 5 var showAds = (urlParams.has('showAds') || (window.ai_dummy != undefined) ) ? $('body').addClass('show-ad') : ''; 6 7 // End for all pages 8 $.extend({ 9 bionews: { 10 adcontainer: function(module, extraClass, type) { 11 if (module && module.length > 0) { 12 for (var i = 0; i < module.length; i++) { 13 var container = module[i]; 14 var styleNames = ['bio-ad-block', extraClass]; 15 styleNames = styleNames.join(' '); 16 var eqParam = i>0 ? ':eq('+i+')' : ''; 17 var cleanStyleName = '.' + styleNames.replaceAll(' ', '.').replace(/\.$/, "") + eqParam; 18 var containerLayout = $('<div />', { 19 'class': styleNames, 20 'data-helper-text': cleanStyleName, 21 'onclick': 'jQuery.bionews.copyToClipboard("'+cleanStyleName+'")' 22 }); 23 if(extraClass === 'mobile-pop-up') { 24 containerLayout = $('<div />', { 25 'class': styleNames, 26 }).append( 27 $('<div class="close-button" onclick="jQuery.bionews.closeMobilePopUp(this)"/>') 28 ); 29 } 30 31 switch (type) { 32 case 'append': 33 $(container).append(containerLayout); 34 break; 35 case 'prepend': 36 $(container).prepend(containerLayout); 37 break; 38 case 'before': 39 $(container).before(containerLayout); 40 break; 41 case 'after': 42 $(container).after(containerLayout); 43 break; 44 } 45 } 46 } 47 }, 48 addBlockNumber: function() { 49 // This adds the helper text when using the showAds param 50 var allAdcontainers = $('.bio-ad-block'); 51 if (allAdcontainers && allAdcontainers.length > 0) { 52 allAdcontainers.each(function(index) { 53 var classList = $(this).attr('class'); 54 classList = classList.replaceAll(' ', '.').replace(/\.$/, ""); 55 var classes = $(this).attr('class'); 56 $(this).find('code').text('.' + classList ); 57 }); 58 } 59 }, 60 copyToClipboard: function(copytarget) { 61 var $temp = $("<textarea>"); 62 $("body").append($temp); 63 $temp.val(copytarget).select(); 64 document.execCommand("copy"); 65 $temp.remove(); 66 }, 67 closeMobilePopUp: function(event) { 68 var blockId = $('.mobile-pop-up .ads_container').attr('id'); 69 $('.mobile-pop-up').remove(); 70 $.each(window.activeAds, function() { 71 if(this.elementId === blockId){ 72 var adBlock = this.adBlock; 73 googletag.cmd.push(() => { 74 googletag.destroySlots([ adBlock ]); 75 }) 76 } 77 }); 78 }, 79 getCookie: function(name) { 80 var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); 81 if (match) return match[2]; 82 }, 83 setCookie(name,value,days) { 84 var expires = ""; 85 if (days) { 86 var date = new Date(); 87 date.setTime(date.getTime() + (days*24*60*60*1000)); 88 expires = "; expires=" + date.toUTCString(); 89 } 90 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 91 } 92 } 93 94 }); 95 96 var ContentModules = $('#footer'); 97 $.bionews.adcontainer(ContentModules, 'footer before', 'before'); 98 var mobilePopCookie = $.bionews.getCookie('MOBILE_POPUP'); 99 if(!mobilePopCookie){ 100 $.bionews.adcontainer(ContentModules, 'mobile-pop-up', 'after'); 101 } 102 103})(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.