1"use strict" 2var MobileAppBanner = function () { 3 var that = this; 4 //B stands for Banner 5 var B = { 6 iPhone_iPad: "https://goo.gl/cEVq4X", 7 Android: "Intent://app/#Intent;scheme=eforologia;package=com.epsilonnet.eforologia;end", 8 isAndroid: false, 9 isiPhone_iPad: false, 10 isWindowsPhone: false, 11 Url: "", 12 BannerContent: null, 13 BlockBanner: false, 14 Type: null 15 }; 16 MobileAppBanner.prototype.constructor = function () { 17 18 } 19 B.Init = function () { 20 $("#msgDiv").on('click', function () { 21 B.Template.Redirect(); 22 }); 23 $("#closeBtn").on('click', function () { 24 B.Template.Close(); 25 }); 26 } 27 B.Template = { 28 Create: function () { 29 30 var msgDiv = $('<div/>', { 31 id: 'msgDiv', 32 'class': 'msg-div', 33 //onclick: 'mobileBanner.Template.Redirect(event);return false;' 34 //text: 'ÎείÏε Ïη νÎα Î¼Î±Ï ÎµÏαÏμογή! ' 35 }); 36 37 var svgImg = $('<svg/>', { 38 id: 'svgImg', 39 xmlns: 'http://www.w3.org/2000/svg', 40 viewbox: '0 0 20 20' 41 }) 42 43 var svgPath1 = $('<path/>', { 44 d: "M3.3 2.1h10.5v3.1H15V2.3c0-.8-.6-1.4-1.4-1.4H3.5c-.8 0-1.4.6-1.4 1.4V16c0 .8.6 1.4 1.4 1.4h6.8v-2.8h-7V2.1zm5.2 13.2c.4 0 .7.3.7.7s-.3.7-.7.7-.7-.3-.7-.7.3-.7.7-.7z" 45 }); 46 var svgPath2 = $('<path/>', { 47 d: "M16 5.9h-3.5c-.8 0-1.4.6-1.4 1.4v10.1c0 .8.6 1.4 1.4 1.4H16c.8 0 1.4-.6 1.4-1.4v-10c.1-.8-.6-1.5-1.4-1.5zm.8 10.8h-5.1V7.3h5.1v9.4z" 48 }); 49 svgPath1.appendTo(svgImg); 50 svgPath2.appendTo(svgImg); 51 52 var closeDiv = $('<div/>', { 53 id: 'closeDivBtn' 54 }); 55 56 var closeSpan = $('<span/>', { 57 id: 'closeBtn', 58 'class': 'mn__close', 59 //onclick: 'B.Template.Close()', 60 text: 'Close' 61 }); 62
63 var container = $('<div/>', { 64 id: 'divBannerMobApp', 65 'class': 'mn-container' 66 //text: 'ÎιαβάÏÏε ειδήÏÎµÎ¹Ï ÎºÎ±Î¹ εÏÏÎ½Ï Î¼Î· αÏθÏογÏαÏία ÏÏη νÎα Î¼Î±Ï ÎµÏαÏμογή!', 67 }); 68 //append svg to msg 69 svgImg.appendTo(msgDiv); 70 //append msg div to container 71 msgDiv.appendTo(container); 72 //append close icon to div 73 closeSpan.appendTo(closeDiv); 74 //append div containing close icon to container 75 closeDiv.appendTo(container); 76 $("body").prepend(container[0]); 77 $("#msgDiv").children(":last").after("ÎείÏε Ïη νÎα Î¼Î±Ï mobile εÏαÏμογή!"); 78 }, 79 Show: function () { 80 $("#divBannerMobApp").html($("#divBannerMobApp").html());//hack for svg images //check if cookie exists 81 if (B.Cookie.Read()) { 82 //do nothing 83 } else { 84 if (!B.BlockBanner) {//dont show for specific userAgents or excluded ones 85 if ($("#divBannerMobApp").length > 0) { 86 $("#divBannerMobApp").fadeIn('slow'); 87 } 88 } 89 } 90 }, 91 Hide: function () { 92 if ($("#divBannerMobApp").length > 0) { 93 $("#divBannerMobApp").fadeOut('slow'); 94 } 95 }, 96 Close: function () { 97 if ($("#closeBtn").length > 0) { 98 $("#divBannerMobApp").fadeOut('slow', function () { 99 //create cookie when X banner 100 if (B.Cookie.Read()) 101 {/*do nothing*/} 102 else 103 B.Cookie.Create(B.Cookie.cookieName, "", 2); 104 $(this).remove(); 105 }); 106 } 107 }, 108 Redirect: function () { 109 window.open(B.Url); 110 return false; 111 } 112 } 113 B.Data = { 114 DefineDevice: function () { 115 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Windows Phone|Mobi|Opera Mini/i.test(navigator.userAgent)) { 116 // mobiles, need to define which one 117 //alert(navigator.userAgent) 118 var nav = B.Data.DefineOS.any(); 119 B.Template.Create(B.Data.SetUrl(nav)); 120 B.Template.Show(); 121 } else { 122 // this is desktop 123 //B.Template.Create(B.Android); //use for testing 124 //B.Template.Show(); //use for testing 125 } 126 }, 127 DefineOS : { 128 Android: function () { 129 if (/Windows Phone/i.test(navigator.userAgent)) { 130 return B.Data.DefineOS.Windows(); 131 } else { 132 return navigator.userAgent.match(/Android/i); 133 } 134 //return navigator.userAgent.match(/Android/i); 135 }, 136 BlackBerry: function() { 137 return navigator.userAgent.match(/BlackBerry/i); 138 }, 139 iOS: function() { 140 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 141 }, 142 Opera: function() { 143 return navigator.userAgent.match(/Opera Mini/i); 144 }, 145 Windows: function() { 146 return navigator.userAgent.match(/IEMobile|Windows Phone/i); 147 }, 148 any: function() { 149 return (B.Data.DefineOS.Android() || B.Data.DefineOS.BlackBerry() || B.Data.DefineOS.iOS() || B.Data.DefineOS.Opera() || B.Data.DefineOS.Windows()); 150 } 151 }, 152 SetUrl: function (nav) { 153 //choose url 154 B.Url=""; 155 switch (nav[0]) { 156 case "Android": 157 B.Url = B.Android; 158 B.BlockBanner = false; 159 break; 160 case "iPad": 161 case "iPhone": 162 case "iPod": 163 case "BlackBerry": 164 B.Url = B.iPhone_iPad; 165 B.BlockBanner = false; 166 break; 167 case "IEMobile"://windows phone 168 case "Windows Phone": 169 case "Opera Mini": 170 B.BlockBanner = true; 171 break; 172 default: 173 B.BlockBanner = true; 174 break; 175 } 176 }, 177 CheckDeviceWithSreenSize: function () { 178 179 if (screen.width < 500) { 180 // mobile? 181 } 182 }, 183 } 184 B.Cookie = { 185 cookieIsLive: false, 186 cookieName: "mobiBanner", 187 Create: function (name,value,days) { 188 var date = new Date(); 189 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 190 var expires = "; expires=" + date.toGMTString(); 191 document.cookie = name + "=" + value + expires + "; path=/"; 192 }, 193 Read: function () { 194 var cookies = document.cookie.split(';');
195 cookies.forEach(function (item, index) { 196 if (B.Cookie.cookieIsLive)//break loop 197 return false; 198 if (item.split('=')[0].trim() == "mobiBanner") 199 { 200 B.Cookie.cookieIsLive = true; 201 return false; 202 } else 203 B.Cookie.cookieIsLive = false; 204 }); 205 return B.Cookie.cookieIsLive; 206 }, 207 Delete: function () { 208 B.Cookie.Read(); 209 B.Cookie.Create(B.Cookie.cookieName, "", -1); 210 }, 211 Exists: function () { 212 if (B.Cookie.Read())//B.Cookie.cookieIsLive 213 {/*do nothing*/ } 214 else 215 B.Cookie.Create(B.Cookie.cookieName, "", 2); 216 } 217 } 218 return B; 219}; 220 221var mobileBanner = new MobileAppBanner(); 222 223$(document).ready(function () { 224 225 mobileBanner.Data.DefineDevice(); 226 mobileBanner.Init(); 227 228 229 if ($('.slicknav_menu')[0] != undefined) { 230 var temp1Menu = $('.slicknav_menu'); 231 var temp1MobBanner = $('#divBannerMobApp'); 232 233 var Menu1 = temp1Menu.clone(); 234 var MobBanner1 = temp1MobBanner.clone(); 235 236 if (!temp1Menu.is(':empty')) { 237 temp1Menu.replaceWith(MobBanner1); 238 temp1MobBanner.replaceWith(Menu1); 239 } 240 } 241 242}); 243 244$(window).on('load',function () { 245 //menu loads on window.load not document.ready 246 if ($('.slicknav_menu')[0] != undefined) { 247 var temp1Menu = $('.slicknav_menu'); 248 var temp1MobBanner = $('#divBannerMobApp'); 249 if (temp1MobBanner[0] != undefined) { 250 var temp = document.createElement("div"); 251 temp1Menu[0].parentNode.insertBefore(temp, temp1Menu[0]); 252 253 // move obj1 to right before obj2 254 temp1MobBanner[0].parentNode.insertBefore(temp1Menu[0], temp1MobBanner[0]); 255 256 // move obj2 to right before where obj1 used to be 257 temp.parentNode.insertBefore(temp1MobBanner[0], temp); 258 259 // remove temporary marker node 260 temp.parentNode.removeChild(temp); 261 temp1Menu[0].style.position = "relative"; 262 } 263 } 264}); 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
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.