1$(document).ready(function() { 2 3 let SYSTEM_CODE_FOR_SPORT = cg_SYSTEM_CODE; 4 if(typeof cg_SYSTEM_CODE_CUSTOM_SPORT == 'string' && cg_SYSTEM_CODE_CUSTOM_SPORT){ 5 SYSTEM_CODE_FOR_SPORT = cg_SYSTEM_CODE_CUSTOM_SPORT; 6 } 7 8 const removeMultipleSlashes = function (pathname) { 9 let toReturn = pathname; 10 11 if(toReturn) { 12 toReturn = toReturn.replace(/\/+/mg,"/"); 13 } 14 15 return toReturn; 16 } 17 const seoMapping = JSON.parse(cg_SEO_URL_MAPPING_REVERSE); 18 const URL_PATH_MAPPINGS = Object.fromEntries(Object.entries(seoMapping).map(function(a){ 19 if(!(a[0] || '').startsWith("redirect:")){ 20 let r = [removeMultipleSlashes("/"+a[1]),removeMultipleSlashes("/"+a[0])]; 21 22 if(r[1] && r[1].startsWith("/sport")){ 23 r[1] = r[1].replace("/sport","/"+(seoMapping['sport']||'sport')) 24 }else if(r[1] && r[1].startsWith("/favorite-odds")){ 25 r[1] = r[1].replace("/favorite-odds","/"+(seoMapping['favorite-odds']||'favorite-odds')) 26 } 27 else if(r[1] && r[1].startsWith("/today-odds")){ 28 r[1] = r[1].replace("/today-odds","/"+(seoMapping['today-odds']||'today-odds')) 29 } 30 else if(r[1] && r[1].startsWith("/live-match")){ 31 r[1] = r[1].replace("/live-match","/"+(seoMapping['live-match']||'live-match')) 32 } 33 else if(r[1] && r[1].startsWith("/live-multi")){ 34 r[1] = r[1].replace("/live-multi","/"+(seoMapping['live-multi']||'live-multi')) 35 } 36 else if(r[1] && r[1].startsWith("/live")){ 37 r[1] = r[1].replace("/live","/"+(seoMapping['live']||'live')) 38 } 39 else if(r[1] && r[1].startsWith("/calendar")){ 40 r[1] = r[1].replace("/calendar","/"+(seoMapping['calendar']||'calendar')) 41 } 42 else if(r[1] && r[1].startsWith("/mybets")){ 43 r[1] = r[1].replace("/mybets","/"+(seoMapping['mybets']||'mybets')) 44 } 45 46 return r; 47 }else{ 48 return [] 49 } 50 51 52 }).filter(function([k,v]){return k !== undefined})); 53 54 var menuLinks = (function(){ 55 try { 56 const discarded = ['cg_scommesse_sport','cg_scommesse_livecenter','cg_scommesse_live_match','cg_scommesse_calendar','cg_scommesse_live_multi']; 57 const attrs = {'cg_scommesse_regole_sport':{'onclick':'windowOpen("{{HREF}}","cgMainWindow")'}, 58 'cg_scommesse_statistiche_sport':{'onclick':'windowOpen("{{HREF}}","cgMainWindow")'}, 59 'cg_scommesse_livescore_sport':{'onclick':'windowOpen("{{HREF}}","cgMainWindow")'}, 60 'cg_scommesse_news_sport':{'onclick':'windowOpen("{{HREF}}","cgMainWindow")'} 61 }; 62 let menuLinks; 63 64 $.ajax({ 65 url: cg_CONTEXT+'/listHeaderMenuSportButtons', 66 type: 'GET', 67 contentType: 'application/json; charset=utf-8', 68 async:false, 69 data: { 70 system_code: cg_SYSTEM_CODE 71 } 72 }).done(function(response) { 73 if(response !=null){ 74 menuLinks = response.filter(function(b){ 75 return !discarded.includes(b.internalId); 76 }).map(function(b){ 77 let bres = { 78 "label":b.descriptions[cg_LCODE.toUpperCase()], 79 "attrs":{ 80 "id": b.internalId || b.htmlId, 81 "data-href": b.internalId, 82 "onclick":attrs[b.internalId] && attrs[b.internalId]['onclick'] && attrs[b.internalId]['onclick'].replace("{{HREF}}",b.alternativeHref) 83 } 84 }; 85 86 if(!attrs[b.internalId] && b.alternativeHref){ 87 bres.attrs.href = b.alternativeHref; 88 bres.attrs.target = b.target ? '_blank' : '_self' 89 } 90 91 92 return bres; 93 }) 94 } 95 }); 96 return menuLinks; 97 }catch(err){ 98 console.log(err); 99 return []; 100 } 101 }()); 102 103 104 105 var selectButtonHandler = 106 function(section){ 107 if((section||null)==null){ 108 return; 109 } 110 111 var mDataRef = Object.keys(window.appConfig['ROUTES']['live']).includes(section)?'ingame' 112 : Object.keys(window.appConfig['ROUTES']['sport-home']).includes(section) 113 ? 'sport-home' 114 :'sport'; 115 var href = window.appConfig['ROUTES']['prematch'][section]||window.appConfig['ROUTES']['live'][section]; 116 117 if((href||null)==null) 118 return; 119 if(mDataRef) 120 $("body").attr("page",mDataRef); 121 122 href=window.appConfig['BASENAME']+href; 123 124 const f_toggleActive = function(currentActive,newActive){ 125 if(newActive){ 126 if(currentActive){ 127 currentActive.classList.remove('active'); 128 } 129 newActive.classList.add('active'); 130 } 131 } 132 133 const mActive = document.querySelector('.menu-principale .active'); 134 const btnM = document.querySelector('.menu-principale a[href="' + href + '"], .menu-principale a[data-ref="' + mDataRef + '"]'); 135 f_toggleActive(mActive,btnM); 136 const sActive = document.querySelector('.sottomenu-main .active'); 137 const btnS = document.querySelector('.sottomenu-main a[href="' + href + '"]'); 138 f_toggleActive(sActive,btnS); 139 } 140 141 var beforeInittHandler = 142 function(){ 143 addOpenSection(); 144 hideSottomenu(); 145 } 146 147 148 function hideSottomenu(){ 149 if(window.appConfig['MENU']['show']===true){ 150 var sm = document.querySelector(".sottomenu-main"); 151 if((sm||null)!=null) 152 sm.remove(); 153 }else{ 154 var sn = document.querySelector(".sottomenu-nav"); 155 if((sn||null)!=null){ 156 sn.classList.remove("cg-hide"); 157 } 158 } 159 160 } 161
162 function addOpenSection(){ 163 Object.keys(window.appConfig['ROUTES']).forEach(function(m){ 164 Object.keys(window.appConfig['ROUTES'][m]).reverse().forEach(function(s){// Looping backward to give high priority to the first occurrence 165 const value = window.appConfig['ROUTES'][m][s]; 166 const href = window.appConfig['BASENAME']+value; 167 $('.sottomenu-main a[href="' + href + '"], .menu-principale a[href="' + href + '"]').click(function(){ window.openSection(s); return false; }); 168 }); 169 }) 170 171 } 172 173 const cookieConsent = (function(){ 174 const consent = { 175 marketing: true, 176 preferences: true, 177 statistics: true 178 }; 179 180 try { 181 if(typeof Cookiebot == 'object'){ 182 consent.marketing = Cookiebot.consent.marketing; 183 consent.preferences = Cookiebot.consent.preferences; 184 consent.statistics = Cookiebot.consent.statistics; 185 } 186 } catch(error) { 187 console.log(error); 188 } 189 190 return consent; 191 }()); 192 193 const theme = (function(){ 194 const data = { 195 enabled: $('#cg-theme-switch').length > 0, 196 dark: false 197 }; 198 199 if(data.enabled) { 200 let checked = $('#cg-theme-switch').prop('checked'); 201 data.dark = checked; 202 } 203 204 return data; 205 }()); 206 207 window.appConfig = 208 { 209 "CONTAINER_ID":"cg_exa-sportAppContainer", 210 "BASENAME":cg_CONTEXT, 211 "SYSTEM_CODE": SYSTEM_CODE_FOR_SPORT, 212 "LANGUAGE": cg_LCODE, 213 "TOKEN":cg_TOKEN, 214 "ROUTES": { 215 "prematch":{ 216 "top-match": "/"+(seoMapping['sport']||'sport'), 217 "betslip": "/"+(seoMapping['betslip']||'betslip'), 218 "favorite-odds": "/"+(seoMapping['favorite-odds']||'favorite-odds'), 219 "today-odds" : "/"+(seoMapping['today-odds']||'today-odds'), 220 }, 221 "live": { 222 "live-suite": "/"+(seoMapping['live']||'live'), 223 "multi-bet": "/"+(seoMapping['live']||'live'), 224 "live-match": "/"+(seoMapping['live-match']||'live-match'), 225 "multi-live": "/"+(seoMapping['live-multi']||'live-multi'), 226 "calendar": "/"+(seoMapping['calendar']||'calendar'), 227 }, 228 "sport-home": { 229 "sport-home": `/${(seoMapping['sport-home'] || 'sport-home')}` 230 }, 231 "mybets":{ 232 "mybets": "/"+(seoMapping['mybets']||'mybets'), 233 }, 234 "checkbet":{ 235 "checkbet": "/"+(seoMapping['checkbet']||'checkbet'), 236 }, 237 "checksystembets":{ 238 "checksystembets": "/"+(seoMapping['checksystembets']||'checksystembets'), 239 } 240 }, 241 "MENU":{ 242 "show":true, 243 "items":menuLinks 244 }, 245 "INCLUDES":{ 246 "css":{ 247 "bootstrap":false, 248 "exa":false 249 }, 250 "js":{ 251 "jquery":false, 252 "bootstrap":false 253 } 254 }, 255 "HANDLERS":{ 256 "beforeInit":beforeInittHandler, 257 "selectMenuButton":selectButtonHandler, 258 "showLoginMask":cg_showLogin 259 }, 260 "SEO_ENABLED": (cg_XSEO_XSPORT_ENABLED == 'true'?true:false), 261 "COOKIE_CONSENT": cookieConsent, 262 "THEME": theme, 263 URL_PATH_MAPPINGS 264 } 265 266 if(typeof Cookiebot == 'object'){ 267 let mode = $('#Cookiebot').data("sportreload"); 268 269 if(mode != null && (mode == 'true' || mode)) { 270 window.addEventListener('CookiebotOnAccept', function (e) { 271 if(Cookiebot.changed){ 272 location.reload(); 273 } 274 }, false); 275 window.addEventListener('CookiebotOnDecline', function (e) { 276 if(Cookiebot.changed){ 277 location.reload(); 278 } 279 }, false); 280 } 281 } 282 283}); 284
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.