1jQuery(function ($) { 2 const $selector = $('a.mobile_app_link, a[href^="https://amarkets.onelink.me/"]'); 3 4 setTimeout(set_link, 5000); 5 6 function set_link() { 7 // URL не ÑазбиÑаем: пÑомокод из ÑÑÑлки Ñже оÑиÑен и запиÑан в кÑÐºÑ ÑкÑипÑом 8 // ampc-auto.js, коÑоÑÑй подклÑÑаеÑÑÑ ÑанÑÑе ÑÑого. 9 const promo_code_local = get_promo_code_internal() || get_cookie('promo_code'); 10 11 if (promo_code_local) { 12 set_promo_code_to_link(promo_code_local); 13 } 14 15 set_utm_to_link(); 16 } 17 18 function set_utm_to_link() { 19 const utm = get_utm_url() || get_utm_cookie(); 20 21 if (utm) { 22 const utm_string = `&af_sub1=${utm.utm_source}&af_sub2=${utm.utm_medium}&af_sub3=${utm.utm_campaign}&af_sub4=${utm.utm_content}&af_sub5=${utm.utm_term}`; 23 24 $selector.each(function (idx, link) { 25 link.href += utm_string; 26 }); 27 } 28 } 29 30 function get_utm_url() { 31 const url = window.location.search; 32 const search_params = new URLSearchParams(url); 33 let utm_params = null; 34 35 if (search_params.has('utm_source') || search_params.has('utm_medium') || search_params.has('utm_campaign') || search_params.has('utm_c
35ontent') || search_params.has('utm_term')) { 36 utm_params = { 37 'utm_source': search_params.get('utm_source') || 'direct', 38 'utm_medium': search_params.get('utm_medium') || 'none', 39 'utm_campaign': search_params.get('utm_campaign') || 'direct', 40 'utm_content': search_params.get('utm_content') || 'none', 41 'utm_term': search_params.get('utm_term') || 'none', 42 } 43 } 44 45 return utm_params; 46 } 47 48 function get_utm_cookie() { 49 let utmz_string = get_cookie('__utmz'); 50 51 const utm = (function () { 52 let ga = {}; 53 54 if (utmz_string) { 55 utmz_string = utmz_string.replace(/[{()}]/g, ''); 56 const pairs = utmz_string.split('.').slice(4).join('.').split('|'); 57 58 for (let i = 0; i < pairs.length; i++) { 59 let temp = pairs[i].split('='); 60 ga[temp[0]] = temp[1]; 61 } 62 } 63 64 return ga; 65 })(); 66 const { utmccn, utmcct, utmcmd, utmcsr, utmctr } = utm; 67 68 return utmz_string ? { 69 'utm_source': utmcsr || 'direct', 70 'utm_medium': utmcmd || 'none', 71 'utm_campaign': utmccn || 'direct', 72 'utm_content': utmcct || 'none', 73 'utm_term': utmctr || 'none', 74 } : null; 75 } 76 77 function set_promo_code_to_link(promo_code) { 78 const link = { 79 start: 'https://amarkets.onelink.me/E2NR?af_xp=mobile_app&pid=source', 80 end: '&af_dp=com.amarkets%3A%2F%2F', 81 } 82 const link_promo_code = link.start + '&deep_link_value=g_' + promo_code + '&deep_link_sub1=g_' + promo_code + link.end; 83 84 if (window.mobile_app && window.mobile_app.new_link) { 85 // еÑли Ð´Ð»Ñ ÑÑÑаниÑÑ Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ задаÑÑ Ð´ÑÑгÑÑ onelink ÑÑÑлкÑ, пеÑедаем пÑомокод в Ð½ÐµÑ 86 $selector.attr('href', window.mobile_app.new_link + '?g=' + promo_code); 87 } else { 88 $selector.attr('href', link_promo_code); 89 } 90 } 91 92 function get_promo_code_internal() { 93 return window.mobile_app_popup_promo_code; 94 } 95 96 function get_cookie(name) { 97 const matches = document.cookie.match(new RegExp( 98 '(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)' 99 )); 100 101 return matches ? decodeURIComponent(matches[1]) : undefined; 102 } 103});
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.