1(function () { 2 'use strict'; 3 4 var OVERLAY_ID = 'iab-warning-overlay'; 5 var STYLE_ID = 'iab-warning-styles'; 6 7 var texts = { 8 title: 'Navigateur Web', 9 subtitle: 'Pour accéder au site :', 10 stepOne: 'Clique sur "â¯" en haut à droite de ton écran', 11 stepTwo: 'Puis sélectionne "Ouvrir dans le navigateur"', 12 helper: 'Cette étape permet d\'ouvrir le site dans ton navigateur (Chrome, Safari, etc.) pour un affichage optimal.', 13 iosHint: 'Sur iPhone, tu peux aussi utiliser le bouton de partage puis "Ouvrir dans Safari".' 14 }; 15 16 var logos = { 17 econeto: '/presentation/docs-assets/ico/apple-touch-icon-144-precomposed.png', 18 fallback: '/image/swoax-pnglogo-pdf.png' 19 }; 20 21 var scriptNetwork = detectNetworkId(); 22 var cachedIosDevice = false; 23 var orientationHandlerAttached = false; 24 25 function detectNetworkId() { 26 var scriptTag = document.currentScript; 27 28 if (!scriptTag || !hasNetworkAttribute(scriptTag)) { 29 scriptTag = findScriptByName('inapp-browser-warning.js'); 30 } 31 32 if (scriptTag && hasNetworkAttribute(scriptTag)) { 33 return (scriptTag.getAttribute('data-network') || '').toLowerCase(); 34 } 35 36 return ''; 37 } 38 39 function hasNetworkAttribute(node) { 40 return node && node.getAttribute && node.getAttribute('data-network'); 41 } 42 43 function findScriptByName(name) { 44 var scripts = document.getElementsByTagName('script'); 45 for (var i = scripts.length - 1; i >= 0; i -= 1) { 46 var src = scripts[i].getAttribute('src') || ''; 47 if (src.indexOf(name) !== -1) { 48 return scripts[i]; 49 } 50 } 51 return null; 52 } 53 54 function getLogoSrc() { 55 if (scriptNetwork === 'econeto') { 56 return logos.econeto; 57 } 58 return logos.fallback; 59 } 60 61 function isInAppBrowser(userAgent) { 62 var ua = (userAgent || '').toLowerCase(); 63 var patterns = [ 64 /fban|fbav|fb_iab|fbios|fb4a|fbforiphone/, 65 /messenger/, 66 /instagram/, 67 /tiktok/, 68 /twitter|x\//, 69 /snapchat/, 70 /wechat/, 71 /pinterest/, 72 /line\//, 73 /kakaotalk/, 74 /miuibrowser/ 75 ]; 76 77 for (var i = 0; i < patterns.length; i += 1) { 78 if (patterns[i].test(ua)) { 79 return true; 80 } 81 } 82 83 if (isLinkedInInApp(ua)) { 84 return true; 85 } 86 87 var isAndroid = ua.indexOf('android') !== -1; 88 var isFirefox = ua.indexOf('firefox') !== -1 || ua.indexOf('fxios') !== -1; 89 var hasWvToken = ua.indexOf(' wv') !== -1 || (ua.indexOf('version/') !== -1 && ua.indexOf('chrome/') !== -1 && ua.indexOf('safari/') === -1 && !isFirefox); 90 var isIos = (ua.indexOf('iphone') !== -1 || ua.indexOf('ipad') !== -1 || ua.indexOf('ipod') !== -1); 91 var iOSWebView = isIos && ua.indexOf('safari') === -1 && !isFirefox; 92 93 return (isAndroid && hasWvToken) || iOSWebView; 94 } 95 96 function isLinkedInInApp(ua) { 97 var ref = (document.referrer || '').toLowerCase(); 98 var hasLinkedInUA = ua.indexOf('linkedin') !== -1 && ua.indexOf('linkedinbot') === -1; 99 100 if (hasLinkedInUA && (ua.indexOf('linkedinapp') !== -1 || ua.indexOf('liapp') !== -1 || ua.indexOf('liinternal') !== -1)) { 101 return true; 102 } 103 104 if (hasLinkedInUA && (ua.indexOf('app') !== -1 || ua.indexOf('inapp') !== -1)) { 105 return true; 106 } 107 108 if (ref.indexOf('linkedin') === -1 && !hasLinkedInUA) { 109 return false; 110 } 111 112 if (ua.indexOf('version/') !== -1 && ua.indexOf('chrome/') !== -1 && ua.indexOf('safari/') === -1) { 113 return true; 114 } 115 116 if (ua.indexOf(' wv') !== -1 || ua.indexOf('; wv)') !== -1) { 117 return true; 118 } 119 120 if (ua.indexOf('crios') !== -1 && ua.indexOf('safari/') === -1) { 121 return true; 122 } 123 124 return false; 125 } 126 127 function injectStyles() { 128 if (document.getElementById(STYLE_ID)) { 129 return; 130 } 131 132 var style = document.createElement('style'); 133 style.id = STYLE_ID; 134 style.type = 'text/css'; 135 style.appendChild(document.createTextNode( 136 '#' + OVERLAY_ID + ' { position:fixed; top:0; left:0; width:100%; height:100%; background:#f7f9fc; color:#1b1b1f; z-index:999999; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; display:flex; align-items:center; justify-content:center; padding:32px; box-sizing:border-box; }' + 137 '#' + OVERLAY_ID + ' * { box-sizing:border-box; }' + 138 '#' + OVERLAY_ID + ' .iab-card { max-width:420px; width:100%; text-align:center; }' + 139 '#' + OVERLAY_ID + ' .iab-logo { display:block; width:96px; height:96px; margin:0 auto 20px; object-fit:contain; }' + 140 '#' + OVERLAY_ID + ' .iab-title { font-size:24px; font-weight:700; margin-bottom:8px; }' + 141 '#' + OVERLAY_ID + ' .iab-subtitle { font-size:16px; margin-bottom:24px; color:#3d3d45; }' + 142 '#' + OVERLAY_ID + ' .iab-steps { text-align:left; margin-bottom:24px; }' + 143 '#' + OVERLAY_ID + ' .iab-step { display:flex; align-items:flex-start; margin-bottom:16px; }' + 144 '#' + OVERLAY_ID + ' .iab-step-number { width:36px; height:36px; line-height:36px; border-radius:50%; background:#e5f2ff; color:#1b6ad9; font-weight:600; text-align:center; margin-right:12px; flex-shrink:0; }' + 145 '#' + OVERLAY_ID + ' .iab-step-text { font-size:16px; color:#2a2a33; line-height:1.4; }' + 146 '#' + OVERLAY_ID + ' .iab-helper { font-size:14px; color:#5a5a66; line-height:1.5; }' + 147 '#' + OVERLAY_ID + ' .iab-ios-hint { margin-top:12px; font-size:14px; color:#5a5a66; }' + 148 'body.iab-lock-scroll { overflow:hidden; }' 149 )); 150 151 document.head.appendChild(style); 152 } 153 154 function buildStep(number, text) { 155 var wrapper = document.createElement('div'); 156 wrapper.className = 'iab-step'; 157 158 var badge = document.createElement('div'); 159 badge.className = 'iab-step-number'; 160 badge.appendChild(document.createTextNode(number)); 161 162 var label = document.createElement('div'); 163 label.className = 'iab-step-text'; 164 label.appendChild(document.createTextNode(text)); 165 166 wrapper.appendChild(badge); 167 wrapper.appendChild(label); 168 return wrapper; 169 } 170 171 function createOverlay(isIos) { 172 if (document.getElementById(OVERLAY_ID)) { 173 return; 174 } 175 176 injectStyles(); 177
178 var overlay = document.createElement('div'); 179 overlay.id = OVERLAY_ID; 180 181 var card = document.createElement('div'); 182 card.className = 'iab-card'; 183 184 var logo = document.createElement('img'); 185 logo.className = 'iab-logo'; 186 logo.alt = 'Logo'; 187 logo.src = getLogoSrc(); 188 189 var title = document.createElement('div'); 190 title.className = 'iab-title'; 191 title.appendChild(document.createTextNode(texts.title)); 192 193 var subtitle = document.createElement('div'); 194 subtitle.className = 'iab-subtitle'; 195 subtitle.appendChild(document.createTextNode(texts.subtitle)); 196 197 var stepsWrapper = document.createElement('div'); 198 stepsWrapper.className = 'iab-steps'; 199 stepsWrapper.appendChild(buildStep('1', texts.stepOne)); 200 stepsWrapper.appendChild(buildStep('2', texts.stepTwo)); 201 202 var helper = document.createElement('div'); 203 helper.className = 'iab-helper'; 204 helper.appendChild(document.createTextNode(texts.helper)); 205 206 card.appendChild(logo); 207 card.appendChild(title); 208 card.appendChild(subtitle); 209 card.appendChild(stepsWrapper); 210 card.appendChild(helper); 211 212 if (isIos && texts.iosHint) { 213 var iosHint = document.createElement('div'); 214 iosHint.className = 'iab-ios-hint'; 215 iosHint.appendChild(document.createTextNode(texts.iosHint)); 216 card.appendChild(iosHint); 217 } 218 219 overlay.appendChild(card); 220 document.body.appendChild(overlay); 221 222 if (document.body.className.indexOf('iab-lock-scroll') === -1) { 223 document.body.className += (document.body.className ? ' ' : '') + 'iab-lock-scroll'; 224 } 225 } 226 227 function runGuard() { 228 try { 229 var ua = navigator.userAgent || ''; 230 var ios = /iphone|ipad|ipod/i.test(ua); 231 232 if (!isInAppBrowser(ua)) { 233 return; 234 } 235 236 cachedIosDevice = ios; 237 attachOrientationHandlers(); 238 239 if (!isPortraitViewport()) { 240 removeOverlay(); 241 return; 242 } 243 244 createOverlay(ios); 245 } catch (error) { 246 if (window.console && typeof window.console.error === 'function') { 247 console.error('InAppBrowser warning failed:', error); 248 } 249 } 250 } 251 252 if (document.readyState === 'loading') { 253 document.addEventListener('DOMContentLoaded', runGuard); 254 } else { 255 runGuard(); 256 } 257 258 if (!window.InAppBrowserWarning) { 259 window.InAppBrowserWarning = {}; 260 } 261 262 window.InAppBrowserWarning.isInAppBrowser = isInAppBrowser; 263 264 function isPortraitViewport() { 265 var hasWindowSize = typeof window.innerHeight === 'number' && typeof window.innerWidth === 'number'; 266 var sizePortrait = false; 267 if (hasWindowSize) { 268 sizePortrait = window.innerHeight >= window.innerWidth; 269 } 270 271 if (window.matchMedia && typeof window.matchMedia === 'function') { 272 var query = window.matchMedia('(orientation: portrait)'); 273 if (query && typeof query.matches !== 'undefined') { 274 if (query.matches) { 275 return true; 276 } 277 if (hasWindowSize) { 278 return sizePortrait; 279 } 280 if (typeof window.orientation === 'number') { 281 return window.orientation === 0 || window.orientation === 180; 282 } 283 return false; 284 } 285 } 286 287 if (hasWindowSize) { 288 return sizePortrait; 289 } 290 291 if (typeof window.orientation === 'number') { 292 return window.orientation === 0 || window.orientation === 180; 293 } 294 295 return true; 296 } 297 298 function attachOrientationHandlers() { 299 if (orientationHandlerAttached || !window.addEventListener) { 300 return; 301 } 302 303 var handler = function () { 304 if (isPortraitViewport()) { 305 if (!document.getElementById(OVERLAY_ID)) { 306 createOverlay(cachedIosDevice); 307 } 308 } else { 309 removeOverlay(); 310 } 311 }; 312 313 window.addEventListener('orientationchange', handler, false); 314 window.addEventListener('resize', handler, false); 315 orientationHandlerAttached = true; 316 } 317 318 function removeOverlay() {
319 var overlay = document.getElementById(OVERLAY_ID); 320 if (overlay && overlay.parentNode) { 321 overlay.parentNode.removeChild(overlay); 322 } 323 var body = document.body; 324 if (!body || !body.className) { 325 return; 326 } 327 if (body.className.indexOf('iab-lock-scroll') === -1) { 328 return; 329 } 330 var classes = body.className.split(/\s+/); 331 var filtered = []; 332 for (var i = 0; i < classes.length; i += 1) { 333 if (classes[i] && classes[i] !== 'iab-lock-scroll') { 334 filtered.push(classes[i]); 335 } 336 } 337 body.className = filtered.join(' '); 338 } 339}()); 340
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.