1function defineRunFunctions ($rootScope, $http, $location, $cookieStore, $browser, $timeout, $route, $state, $window, $localStorage, $cookies, $sce, authenticationService, alertService, subscService, newsService, apiService, flyersService, offersService, stateChangecallBack){ 2 //console.log('defineRunFunctions()'); 3 4 // logout 5 $rootScope.logout = function () { 6 //console.log('$rootScope.logout() in defineRunFunctions()'); 7 authenticationService.clearSubscCredentials(); 8 authenticationService.logout(function (response) { 9 if (response.success) { 10 $state.reload(); 11 } else { 12 alertService.addAlert('danger', response.message, true); 13 } 14 }); 15 }; 16 $rootScope.clearSubscCredentials = function () { 17 //console.log('$rootScope.clearSubscCredentials() in defineRunFunctions()'); 18 if ($rootScope.loggedInSubsc != null){ 19 authenticationService.clearSubscCredentials(); 20// here it is: 21 $state.reload(); 22 } 23 }; 24 $rootScope.closeAlert = function (index, alertsVar) { 25 //console.log('$rootScope.closeAlert() in defineRunFunctions()'); 26 alertService.closeAlert(index, alertsVar); 27 }; 28 $rootScope.closeAllAlerts = function (alertsVar) { 29 //console.log('$rootScope.closeAlerts() in defineRunFunctions()'); 30 alertService.closeAllAlerts(alertsVar); 31 }; 32 33 /* DISABLED while I figure out exceeding max cookie length 34 // Session Vals 35 // session vals are used even if a subsc is NOT logged in. This is to keep site usage preferences in the session 36 $rootScope.getSessionVal = function(key){ 37 //console.log('$rootScope.getSessionalVal() in defineRunFunctions()'); 38 var vals = $rootScope.sessionVals; 39 if (!vals) return null; 40 return vals[key]; 41 }; 42 $rootScope.setSessionVal = function(key, val){ 43 //console.log('$rootScope.setSessionalVal() in defineRunFunctions()'); 44 var vals = $rootScope.sessionVals; 45 if (vals == null) vals = new Object(); 46 vals[key] = val; 47 48 $rootScope.recordSessionVals(vals); 49 $rootScope.loadSessionVals(vals); 50 51 }; 52 53 // () -> null 54 // Get cookie session vals and store on $rootScope 55 // - Note: only do this when app loads or when values change 56 var sessionValsName = 'sessionVals'; 57 $rootScope.loadSessionVals = function(){ 58 //console.log('$rootScope.loadSessionalVals() in defineRunFunctions()'); 59 $rootScope.sessionVals = $cookieStore.get(sessionValsName); 60 }; 61 62 // ({}) -> null 63 // Store sessionVals on cookies 64 $rootScope.recordSessionVals = function(vals){ 65 //console.log('$rootScope.recordSessionalVals() in defineRunFunctions()'); 66 $cookieStore.put(sessionValsName, vals); 67 }; 68 69 // ({}) -> null 70 // Delete sessionVals from cookies 71 $rootScope.deleteSessionVals = function(){ 72 //console.log('$rootScope.deleteSessionalVals() in defineRunFunctions()'); 73 $cookieStore.remove(sessionValsName); 74 };*/ 75 76 $rootScope.reload = function() { 77 //console.log('$rootScope.reload() in defineRunFunctions()'); 78 $state.reload(); 79 } 80 81 // () -> null 82 // Refresh $rootScope details from data sources 83 $rootScope.refresh = function(){ 84 //console.log('$rootScope.refresh() in defineRunFunctions()'); 85 authenticationService.setupRootScopeSubsc(); 86 } 87 88 $rootScope.initApp = function(){ 89 //console.log('$rootScope.initApp() in defineRunFunctions()'); 90 $rootScope.rootScopeLoading = true; 91 $rootScope.initState().then(function successCallback () { 92 //console.log('$rootScope.initState() successCallback in $rootScope.initApp() in defineRunFunctions()'); 93 $rootScope.rootScopeLoading = false; 94 $rootScope.$apply(); 95 }, function failureCallback () { 96 console.error('$rootScope.initState() failureCallback in $rootScope.initApp() in defineRunFunctions()'); 97 $rootScope.rootScopeLoading = false; 98 $rootScope.$apply(); 99 }); 100 }; 101 102 // () -> Promise().then( () -> null, () -> null ) 103 $rootScope.initState = function(){ 104 //console.log('$rootScope.initState() in defineRunFunctions()'); 105 return new Promise( function(resolve, reject){ 106 var url = '/api/init.php?action=init'; 107 var postData = {}; 108 apiService.callAPI(url, {}, 'POST', postData, function (response) { 109 //console.log('apiService.callAPI() url="' + url +'" callback in $rootScope.initState() in defineRunFunctions()'); 110 if (response.success) { 111 112 // Setup $rootScope 113 //console.log('response='); console.dir(response); 114 var apiData = response.apiResponse.data.data[0]; 115 //console.log('apiData='); console.dir(apiData); 116 $rootScope.initData = apiData['initData']; 117 $rootScope.maintenance = apiData['initData']['maintenance']; 118 119 // Setup Subsc 120 authenticationService.setSubscCredentials(apiData['loggedInSubsc'], apiData['browsingSubsc']); 121 122 // Resolve 123 resolve(); 124 125 } else { 126 // Else, assume defaults 127 console.error('Failure response in apiService.callAPI() url="' + url +'" callback in $rootScope.initState() in defineRunFunctions()'); 128 console.error('response='); console.dir(response); 129 130 // Reject 131 reject(); 132 133 } 134 135 // Initialize some things 136 $rootScope.initFacebook(); 137 $rootScope.initGoogleAds(); 138 $rootScope.initShareIt(); 139 140 }); 141 }); 142 }; 143 144 $rootScope.initFacebook = function(){ 145 //console.log('initFacebook() in defineRunFunctions()'); 146 var mobile=0; 147 var hasCart=$rootScope.initData['hasCart']; 148 149 var appID = '142555202539802'; 150 var site = 'royaldraw'; 151 var siteT = 'Royal Draw'; 152 var siteM = 'Winning made easy!'; 153 var siteL = 'logo-fb.png'; 154 var siteD = 'Free prizes given away every day'; 155 var twActions = new Object(); 156 twActions.tag = ( $rootScope.initData['countryName'] == 'canada' ) ? '@royaldrawcanada' : '@royaldraw'; 157 var fbActions = new Object(); 158 fbActions.pageID = ( $rootScope.initData['countryName'] == 'canada' ) ? '428571667258177' : '195121917180056'; 159 160 if ( $rootScope.initData['myAccountTab'] == 'social' ) { 161 fbActions.setFBID=true; 162 } 163 164 fbActions.fbid=$rootScope.initData['fbid']; 165 if ( ! $rootScope.loggedInSubsc ) { 166 fbActions.rdemail=$rootScope.initData['browsingEmail']; 167 } 168 if ( $rootScope.initData['doFBPost'] && $rootScope.initData['fbPosts'] ) { 169 fbActions.doPost = 1; 170 if ( $rootScope.initData['drid'] ) { 171 fbActions.message=$rootScope.initData['draw']['title']; 172 fbActions.name=$rootScope.initData['draw']['title']; 173 fbActions.description=siteD; 174 fbActions.caption=siteT + '. ' + siteM; 175 fbActions.picture="https://www.royaldraw.com" + $rootScope.initData['draw']['imgPath']; 176 fbActions.link="https://www.royaldraw.com/draws?drid=" + $rootScope.initData['drid'] + "&rcsr
176c=" + $rootScope.initData['sources']['facebookAutoPost']; 177 } else if ( $rootScope.initData['did'] ) { 178 fbActions.message=$rootScope.initData['deal']['title']; 179 fbActions.name=$rootScope.initData['deal']['title']; 180 fbActions.description=siteD; 181 fbActions.caption=siteT + '. ' + siteM; 182 fbActions.picture="https://www.royaldraw.com" + $rootScope.initData['deal']['imgPath']; 183 fbActions.link="https://www.royaldraw.com/draws?drid=" + $rootScope.initData['drid'] + "&rcsrc=" + $rootScope.initData['sources']['facebookAutoPost']; 184 } 185 } 186 }; 187 188 /* IMPORTANT! SYNC WITH templates/ads/header.tmpl */ 189 $rootScope.initGoogleAds = function(){ 190 //console.log('initGoogleAds() in defineRunFunctions()'); 191 192 // Skip if ads disabled 193 //console.log('$rootScope.initData='); console.dir($rootScope.initData); 194 if ( ! $rootScope.initData['ads'] ) { 195 //console.log('Ads disabled in initGoogleAds()'); 196 return; 197 } 198 199 // Google Adsense Auto Ads 200 var autoAds = ( $rootScope.initData['ads'] && $rootScope.initData['autoAds'] ) ? true : false; 201 (adsbygoogle = window.adsbygoogle || []).push({ 202 google_ad_client: "ca-pub-9108024708504496", 203 enable_page_level_ads: autoAds 204 }); 205 206 /* 207 // DFP script code - all ads migrated to AdSense 208 if ( $rootScope.initData['ads'] ) { 209 var googletag = googletag || {}; 210 googletag.cmd = googletag.cmd || []; 211 (function() { 212 var gads = document.createElement('script'); 213 gads.async = true; 214 gads.type = 'text/javascript'; 215 var useSSL = 'https:' == document.location.protocol; 216 gads.src = (useSSL ? 'https:' : 'http:') + 217 '//www.googletagservices.com/tag/js/gpt.js'; 218 var node = document.getElementsByTagName('script')[0]; 219 node.parentNode.insertBefore(gads, node); 220 })(); 221 } 222 223 googletag.cmd.push(function() { 224 225 //console.log('initData[tab]=' + $rootScope.initData['tab'] + ' in initGoogleAds()'); 226 if ( $rootScope.initData['tab'] == 'intro' ) { 227 //console.log('intro in initGoogleAds()'); 228 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 229 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 230 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 231 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 232 googletag.defineSlot('/7636035/Royal_Draw_Intro_Top', [728, 90], 'div-gpt-ad-1428520153061-0').addService(googletag.pubads()); 233 } else if ( $rootScope.initData['tab'] == 'home' ) { 234 //console.log('home in initGoogleAds()'); 235 // Draws 236 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 237 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 238 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 239 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 240 googletag.defineSlot('/7636035/Royal_Draw_Draw_Top', [728, 90], 'div-gpt-ad-1410891841850-0').addService(googletag.pubads()); 241 //googletag.defineSlot('/7636035/Royal_Draw_Draw_Middle', [336, 280], 'div-gpt-ad-1428518430313-0').addService(googletag.pubads()); 242 googletag.defineSlot('/7636035/Royal_Draw_Draw_Middle2', [728, 90], 'div-gpt-ad-1434140150685-0').addService(googletag.pubads()); 243 //googletag.defineSlot('/7636035/Royal_Draw_Draws_Middle', [[336, 280]], 'div-gpt-ad-1410378479927-0').addService(googletag.pubads()); 244 //googletag.defineSlot('/7636035/Royal_Draw_Draws_Middle2', [728, 90], 'div-gpt-ad-1433958162354-0').addService(googletag.pubads()); 245 } else if ( $rootScope.initData['tab'] == 'home_1' ) { 246 //console.log('home_1 in initGoogleAds()'); 247 } else if ( $rootScope.initData['tab'] == 'past-draws' ) { 248 //console.log('past-draws in initGoogleAds()'); 249 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 250 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 251 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 252 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 253 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 254 } else if ( $rootScope.initData['tab'] == 'enter-draw' ) { 255 //console.log('enter-draw in initGoogleAds()'); 256 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 257 //googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 258 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 259 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 260 googletag.defineSlot('/7636035/Royal_Draw_Draw_Enter_Top', [728, 90], 'div-gpt-ad-1410890491392-0').addService(googletag.pubads()); 261 //googletag.defineSlot('/7636035/Royal_Draw_Draw_Enter_Middle', [336, 280], 'div-gpt-ad-1410890365751-0').addService(googletag.pubads()); 262 //googletag.defineSlot('/7636035/Royal_Draw_Draws_Middle', [[336, 280]], 'div-gpt-ad-1410378479927-0').addService(googletag.pubads()); 263 googletag.defineSlot('/7636035/Royal_Draw_Draw_Enter_Middle2', [728, 90], 'div-gpt-ad-1434553358469-0').addService(googletag.pubads()); 264 } else if ( $rootScope.initData['tab'] == 'thankYou' ) { 265 //console.log('thankYou in initGoogleAds()'); 266 // Draw Thanks 267 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 268 //googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 269 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 270 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 271 googletag.defineSlot('/7636035/Royal_Draw_Draw_Thanks_Top', [728, 90], 'div-gpt-ad-1410891723741-0').addService(googletag.pubads()); 272 //googletag.defineSlot('/7636035/Royal_Draw_Draw_Thanks_Middle', [336,280], 'div-gpt-ad-1410890927076-0').addService(googletag.pubads()); 273 //googletag.defineSlot('/7636035/Royal_Draw_Draws_Middle', [[336, 280]], 'div-gpt-ad-1410378479927-0').addService(googletag.pubads()); 274 googletag.defineSlot('/7636035/Royal_Draw_Draw_Thanks_Middle2', [728, 90], 'div-gpt-ad-1434553161906-0').addService(googletag.pubads()); 275 } else if ( $rootScope.initData['tab'] == 'coupons' ) { 276 //console.log('coupons in initGoogleAds()'); 277 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 278 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 279 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 280 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 281 googletag.defineSlot('/7636035/Royal_Draw_Deal_Top', [728, 90], 'div-gpt-ad-1410894562941-0').addService(googletag.pubads()); 282 //googletag.defineSlot('/7636035/Royal_Draw_Deal_Middle', [728, 90], 'div-gpt-ad-1410894302122-0').addService(googletag.pubads()); 283 } else if ( $rootScope.initData['tab'] == 'get-coupon' ) {
284 //console.log('get-coupon in initGoogleAds()'); 285 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 286 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 287 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 288 googletag.defineSlot('/7636035/Royal_Draw_Deal_Get_Top', [728, 90], 'div-gpt-ad-1410894224386-0').addService(googletag.pubads()); 289 //googletag.defineSlot('/7636035/Royal_Draw_Deal_Get_Middle', [728, 90], 'div-gpt-ad-1410894143506-0').addService(googletag.pubads()); 290 } else if ( $rootScope.initData['tab'] == 'thankYou-coupon' ) { 291 //console.log('thankYou-coupon in initGoogleAds()'); 292 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 293 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 294 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 295 googletag.defineSlot('/7636035/Royal_Draw_Deal_Thanks_Top', [728, 90], 'div-gpt-ad-1410894489810-0').addService(googletag.pubads()); 296 //googletag.defineSlot('/7636035/Royal_Draw_Deal_Thanks_Middle', [728, 90], 'div-gpt-ad-1410894384292-0').addService(googletag.pubads()); 297 } else if ( $rootScope.initData['tab'] == 'grocery' ) { 298 //console.log('grocery in initGoogleAds()'); 299 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 300 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 301 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 302 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 303 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 304 } else if ( $rootScope.initData['tab'] == 'past-coupons' ) { 305 //console.log('past-coupons in initGoogleAds()'); 306 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 307 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 308 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 309 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 310 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 311 } else if ( $rootScope.initData['tab'] == 'offers' ) { 312 //console.log('offers in initGoogleAds()'); 313 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 314 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 315 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 316 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 317 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 318 //googletag.defineSlot('/7636035/Royal_Draw_Offers_Top', [728, 90], 'div-gpt-ad-1410892915640-0').addService(googletag.pubads()); 319 } else if ( $rootScope.initData['tab'] == 'offer' ) { 320 //console.log('offer in initGoogleAds()'); 321 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 322 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 323 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 324 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 325 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 326 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 327 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 328 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 329 } else if ( $rootScope.initData['tab'] == 'surveys' ) { 330 //console.log('surveys in initGoogleAds()'); 331 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 332 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 333 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 334 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 335 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 336 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 337 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 338 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 339 } else if ( $rootScope.initData['tab'] == 'games' || $rootScope.initData['tab'] == 'games_home' ) { 340 //console.log('games or games_home in initGoogleAds()'); 341 googletag.defineSlot('/7636035/Royal_Draw_Games_Home_Top', [728, 90], 'div-gpt-ad-1410284877259-0').addService(googletag.pubads()); 342 googletag.defineSlot('/7636035/Royal_Draw_Games_Home_Middle', [300, 250], 'div-gpt-ad-1410286351539-0').addService(googletag.pubads()); 343 googletag.defineSlot('/7636035/Royal_Draw_Games_Home_Middle2', [728, 90], 'div-gpt-ad-1410286364200-0').addService(googletag.pubads()); 344 //googletag.defineSlot('/7636035/Royal_Draw_Games_Home_Bottom', [728, 90], 'div-gpt-ad-1410286105421-0').addService(googletag.pubads()); 345 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 346 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 347 } else if ( $rootScope.initData['tab'] == 'games_pregame_disabled' ) { 348 //console.log('games_pregame_disabled in initGoogleAds()'); 349 googletag.defineSlot('/7636035/Royal_Draw_Games_PreGame_Top', [728, 90], 'div-gpt-ad-1410284972054-0').addService(googletag.pubads()); 350 googletag.defineSlot('/7636035/Royal_Draw_Games_PreGame_Middle', [300, 250], 'div-gpt-ad-1410285153610-0').addService(googletag.pubads()); 351 googletag.defineSlot('/7636035/Royal_Draw_Games_PreGame_Bottom', [728, 90], 'div-gpt-ad-1410286066676-0').addService(googletag.pubads()); 352 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 353 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 354 } else if ( $rootScope.initData['tab'] == 'games_game' ) { 355 //console.log('games_game in initGoogleAds()'); 356 googletag.defineSlot('/7636035/Royal_Draw_Games_Game_Top', [728, 90], 'div-gpt-ad-1410291893545-0').addService(googletag.pubads()); 357 //googletag.defineSlot('/7636035/Royal_Draw_Games_Game_Middle', [300, 250], 'div-gpt-ad-1410291903454-0').addService(googletag.pubads()); 358 googletag.defineSlot('/7636035/Royal_Draw_Games_Game_Bottom', [728, 90], 'div-gpt-ad-1410291917580-0').addService(googletag.pubads()); 359 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 360 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 361 } else if ( $rootScope.initData['tab'] == 'games_cat' ) { 362 //console.log('games_cat in initGoogleAds()'); 363 googletag.defineSlot('/7636035/Royal_Draw_Games_Cat_Top', [728, 90], 'div-gpt-ad-1410285561058-0').addService(googletag.pubads()); 364 googletag.defineSlot('/7636035/Royal_Draw_Games_Cat_Middle', [300, 250], 'div-gpt-ad-1410285588195-0').addService(googletag.pubads()); 365 googletag.defineSlot('/7636035/Royal_Draw_Games_Cat_Bottom', [728, 90], 'div-gpt-ad-1410286028624-0').addService(googletag.pubads()); 366 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 367 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 368 } else if ( $rootScope.initData['tab'] == 'games_search' ) { 369 //console.log('games_search in initGoogleAds()'); 370 googletag.defineSlot('/7636035/Royal_Draw_Games_Search_Top', [728, 90], 'div-gpt-ad-1412103229078-0').addService(googletag.pubads()); 371 googletag.defineSlot('/7636035/Royal_Draw_Games_Search_Middle', [300, 250], 'div-gpt-ad-1412353437468-0').addService(googletag.pubads()); 372 googletag.defineSlot('/7636035/Royal_Draw_Games_Search_Bottom', [728, 90], 'div-gpt-ad-1412103257197-0').addService(googletag.pubads()); 373 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 374 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 375 } else if ( $rootScope.initData['tab'] == 'games_author_disabled' ) { 376 //console.log('games_author_disabled in initGoogleAds()'); 377 googletag.defineSlot('/7636035/Royal_Draw_Games_Author_Top', [728, 90], 'div-gpt-ad-1410285972689-0').addService(googletag.pubads()); 378 //googletag.defineSlot('/7636035/Royal_Draw_Games_Author_Middle', [300, 250], 'div-gpt-ad-1410285982330-0').addService(googletag.pubads()); 379 googletag.defineSlot('/7636035/Royal_Draw_Games_Author_Bottom', [728, 90], 'div-gpt-ad-1410285992198-0').addService(googletag.pubads()); 380 googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Top', [300, 250], 'div-gpt-ad-1412351074163-0').addService(googletag.pubads()); 381 //googletag.defineSlot('/7636035/Royal_Draw_Games_Sidebar_Bottom', [300, 250], 'div-gpt-ad-1410378921196-0').addService(googletag.pubads()); 382 } else if ( $rootScope.initData['tab'] == 'royal-points' ) { 383 //console.log('royal-points in initGoogleAds()'); 384 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 385 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 386 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 387 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 388 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 389 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 390 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 391 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 392 } else if ( $rootScope.initData['tab'] == 'drawPicker' ) { 393 //console.log('drawPicker in initGoogleAds()'); 394 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 395 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 396 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 397 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 398 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 399 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 400 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 401 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 402 } else if ( $rootScope.initData['tab'] == 'redeemPoints' ) { 403 //console.log('redeemPoints in initGoogleAds()'); 404 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 405 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 406 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 407 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 408 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 409 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 410 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 411 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 412 } else if ( $rootScope.initData['tab'] == 'winners-wall' ) { 413 //console.log('winners-wall in initGoogleAds()'); 414 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 415 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 416 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 417 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 418 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 419 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 420 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 421 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 422 } else if ( $rootScope.initData['tab'] == 'how' ) { 423 //console.log('how in initGoogleAds()'); 424 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 425 googletag.defineSlot('/
4257636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 426 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 427 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 428 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 429 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 430 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 431 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 432 } else if ( $rootScope.initData['tab'] == 'amazon' ) { 433 //console.log('amazon in initGoogleAds()'); 434 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 435 googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 436 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 437 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 438 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 439 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Offer', [728, 90], 'div-gpt-ad-1408054894199-0').addService(googletag.pubads()); 440 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Below_Title', [728, 90], 'div-gpt-ad-1408054998302-0').addService(googletag.pubads()); 441 //googletag.defineSlot('/7636035/Royal_Draw_Offer_Top', [728, 90], 'div-gpt-ad-1410892832011-0').addService(googletag.pubads()); 442 } else { 443 // Otherwise, default set of ads 444 //console.log('ELSE in initGoogleAds()'); 445 446 googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 447 googletag.defineSlot('/7636035/Royal_Draw_Tile', [300, 250], 'div-gpt-ad-1353688901926-0').addService(googletag.pubads()); 448 449 if ( $rootScope.initData['tab'] != 'home' && 450 $rootScope.initData['tab'] != 'enter-draw' && 451 $rootScope.initData['tab'] != 'thankYou' ) { 452 //console.log('Royal_Draw_Tile_bottom in initGoogleAds()'); 453 googletag.defineSlot('/7636035/Royal_Draw_Tile_bottom', [300, 250], 'div-gpt-ad-1344015818722-3').addService(googletag.pubads()); 454 } 455 456 googletag.defineSlot('/7636035/Royal_Draw_Top', [728, 90], 'div-gpt-ad-1344015818722-4').addService(googletag.pubads()); 457 //googletag.defineSlot('/7636035/Royal_Draw_Tower_Bottom', [160, 600], 'div-gpt-ad-1378442377241-0').addService(googletag.pubads()); 458 } 459 460 if ( $rootScope.initData['tab'] != 'games' && 461 $rootScope.initData['tab'] != 'games_home' && 462 $rootScope.initData['tab'] != 'games_game' && 463 $rootScope.initData['tab'] != 'games_cat' && 464 $rootScope.initData['tab'] != 'games_search' && 465 $rootScope.initData['tab'] != 'home' && 466 $rootScope.initData['tab'] != 'home_1' && 467 $rootScope.initData['tab'] != 'enter-draw' && 468 $rootScope.initData['tab'] != 'thankYou' && 469 $rootScope.initData['tab'] != 'intro' ) { 470 //console.log('Royal_Draw_Right_Middle in initGoogleAds()'); 471 //googletag.defineSlot('/7636035/Royal_Draw_Right_Middle', [160, 600], 'div-gpt-ad-1426615282336-0').addService(googletag.pubads()); 472 } 473 474 //// Index Right Tower uses this as a fallback (include even though a ?googfc warning will be issued when Index doesn't use it) 475 //googletag.defineSlot('/7636035/Royal_Draw_Right', [160, 600], 'div-gpt-ad-1344015818722-1').addService(googletag.pubads()); 476 477 googletag.pubads().enableSingleRequest(); 478 googletag.enableServices(); 479 });*/ 480 }; 481 482 $rootScope.initShareIt = function(){ 483 //console.log('initShareIt() in defineRunFunctions()'); 484 if ( $rootScope.initData['shareWith'] ) { 485 setTimeout("shareIt('" + $rootScope.initData['shareWith'] + "')", 500); 486 } 487 }; 488 489 /* DISABLED: Needs work. Probably needs to be converted to a Directive. 490 $rootScope.showSurvey = function(){ 491 //console.log('showSurvey() in defineRunFunctions()'); 492 setTimeout(function() { 493 //console.log('setTimeout() callback in showSurvey() in defineRunFunctions()'); 494 $('#surveyBar').slideDown(); 495 }, 1000); 496 };*/ 497 498 $rootScope.changeCityPage = changeCityPage; 499 500} 501 502function runApp ($rootScope, $http, $location, $cookieStore, $browser, $timeout, $route, $state, $window, $localStorage, $cookies, $sce, authenticationService, alertService, subscService, newsService, apiService, flyersService, offersService, stateChangecallBack){ 503 //console.log('runApp()'); 504 $rootScope.$on("$routeChangeSuccess", function (scope, next, current) { 505 //console.log('$routeChangeSuccess() in runApp()'); 506 $rootScope.part = $route.current.activetab; 507 }); 508 509 $rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams){ 510 //console.log('$stateChangeStart() in runApp()'); 511 //console.log('toState='); console.dir(toState); 512 //console.log('fromState='); console.dir(fromState); 513 document.body.scrollTop = document.documentElement.scrollTop = 0; 514 $rootScope.closeAlert(); 515 $rootScope.title = toState.title; 516 $rootScope.imgDir = getConfValue('web.images_db_url_path') + "/"; 517 if(toState.name != 'login'){ 518 var index = $location.$$absUrl.indexOf("com"); 519 var url = $location.$$absUrl.substring(index+3); 520 $rootScope.afterLogin = (utils.isDefined(toState.afterLogin)) ? toState.afterLogin : url; 521 } 522 $rootScope.stateName = toState.name; 523 524 //auth 525 $rootScope.refresh(); 526 527 if (toState.authenticate && !$rootScope.loggedInSubsc){ 528 //console.log('Redirecting to login (toState.authenticate && !$rootScope.loggedInSubsc) in $stateChangeStart() in runApp()'); 529 // User isnât authenticated 530 //$rootScope.urlBeforeLogin = toState.url; 531 $state.transitionTo("login"); 532 event.preventDefault(); 533 } 534 535 // Refresh Subsc every state change (make sure we're still logged in, etc.) 536 if ($rootScope.loggedInSubsc){ 537 authenticationService.refreshSubsc($rootScope); 538 } 539 540 // Get the template for the header announcement 541 $rootScope.$broadcast('loadAnnouncement'); 542 543 if(stateChangecallBack != null) { 544 stateChangecallBack(event, toState, toParams, fromState, fromParams); 545 } 546 547 }); 548 549 // Determine mobile vs desktop 550 $rootScope.isMobile = ( $window.innerWidth < 768 ) ? true : false; // Bootstrap CSS XS is < 768px (https://getbootstrap.com/docs/3.3/css/#grid) 551 552 // Init app 553 $rootScope.initApp(); 554 555}
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.