1jQuery(function ($) { 2 var isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/); 3 4 document.addEventListener("smartbanner.init", function () { 5 $("html").css("margin-top", "0 !important"); 6 setTimeout(function () { 7 var currentOptions = smartbanner.options; 8 if (typeof currentOptions !== "undefined") { 9 var platform = smartbanner.platform; 10 var html = ""; 11 if (platform === "ios") { 12 html += "<a href='javascript:void(0);' class='smartbanner__exit js_smartbanner__exit' aria-label='" + smartbanner.closeLabel + "'></a>"; 13 } 14 if (typeof smartbanner.icon !== "undefined") { 15 let onClick = 'window.open("' + smartbanner.buttonUrl + '", "_blank")'; 16 html += "<div class='smartbanner__icon' style='background-image: url(" + smartbanner.icon + ");' onclick='" + onClick + "'></div>"; 17 } 18 html += "<div class='smartbanner__info'><div>"; 19 if (typeof currentOptions.title !== "undefined") { 20 html += "<div class='smartbanner__info__title'>" + currentOptions.title + "</div>"; 21 } 22 if (typeof currentOptions.author !== "undefined") { 23 html += "<div class='smartbanner__info__author'>" + currentOptions.author + "</div>"; 24 } 25 if (typeof currentOptions.price !== "undefined") { 26 //html += "<div class='smartbanner__info__price'>" + currentOptions.price + smartbanner.priceSuffix + "</div>"; 27 } 28 if (platform === 'ios') { 29 html += "<div class='smartbanner__info__star'><span></span></div>"; 30 } 31 html += "</div></div>"; 32 if (platform === 'android') { 33 currentOptions.button = 'INSTALL'; 34 html += "<a href='javascript:void(0);' class='smartbanner__close js_smartbanner__exit' aria-label='" + smartbanner.closeLabel + "'>No Thanks</a>"; 35 } 36 if (typeof smartbanner.buttonUrl !== "undefined" && typeof currentOptions.button !== "undefined") { 37 html += "<a href='" + smartbanner.buttonUrl + "' target='_blank' class='smartbanner__button js_smartbanner__button' rel='noopener' aria-label='" + currentOptions.button + "'>" + 38 "<span class='smartbanner__button__label'>" + currentOptions.button + "</span>" + 39 "</a>"; 40 } 41 42 if ((!isSafari && iOS()) || !iOS()) { 43 smartbanner.publish(); 44 } 45 46 $("body").find(".smartbanner").prependTo("body").html(html).show(); 47 let stickyHeader = window.msabStickyElement; 48 if (stickyHeader) { 49 if ($(stickyHeader).length && ("fixed" === $(stickyHeader).css("position") || "flex" === $(stickyHeader).css("position")) && $(".smartbanner").length) { 50 let bannerHeight = $(".smartbanner").innerHeight(), 51 bodyMargin = $('#wpadminbar').length > 0 ? bannerHeight - 46 : bannerHeight; 52 $("<div class='msab-spacer'></div>").insertBefore(stickyHeader); 53 $("body").addClass("msab-active"); 54 let styleForStickyHeader = "<style type='text/css' id='msab-custom-css'>"; 55 styleForStickyHeader += ".msab-active{padding-top:" + bodyMargin + "px;}"; 56 styleForStickyHeader += ".smartbanner{position:absolute !important;}"; 57 styleForStickyHeader += stickyHeader + "{top:" + bannerHeight + "px;}"; 58 styleForStickyHeader += "</style>"; 59 $("head").append(styleForStickyHeader); 60 61 $(window).scroll(function () { 62 let stickyHeaderTop = (bannerHeight - window.pageYOffset) > 0 ? bannerHeight - window.pageYOffset : 0; 63 if (!$("body").find(".smartbanner").length) { 64 stickyHeaderTop = 0; 65 } 66 $(".smartbanner").css({"top": "-" + window.pageYOffset});
67 $(stickyHeader).css({"top": stickyHeaderTop}); 68 69 }) 70 } 71 72 } 73 //Add event to close banner on Android 74 var closeIcon = document.querySelector(".js_smartbanner__exit"); 75 if (closeIcon) { 76 closeIcon.addEventListener("click", function (event) { 77 $(".msab-spacer").remove(); 78 $(".msab-active").css({"margin-top": ""}); 79 $("body").removeClass("msab-active"); 80 $(stickyHeader).css({"top": ""}); 81 $("#msab-custom-css").remove(); 82 smartbanner.exit(); 83 }); 84 } 85 } 86 }, 100); 87 }); 88 89 function iOS() { 90 return [ 91 "iPad Simulator", 92 "iPhone Simulator", 93 "iPod Simulator", 94 "iPad", 95 "iPhone", 96 "iPod" 97 ].includes(navigator.platform) 98 // iPad on iOS 13 detection 99 || (navigator.userAgent.includes("Mac") && "ontouchend" in document && window.navigator.userAgent.indexOf("Mobile") === -1) 100 } 101});
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.