var isCookieExists = false; var tmcProductCode = 'hrsat24com'; var isNiederschlagsradar = tmcProductCode == 'wwwniederschlagsradarde'; var tmcApplicationProducts = []; tmcApplicationProducts.push(tmcProductCode); // default product first in list // List all products from shared application var api = 'cashier.sat24.com'; tmcApplicationProducts.push('nlsat24com'); tmcApplicationProducts.push('ensat24com'); tmcApplicationProducts.push('desat24com'); tmcApplicationProducts.push('rusat24com'); tmcApplicationProducts.push('ptsat24com'); tmcApplicationProducts.push('elsat24com'); tmcApplicationProducts.push('svsat24com'); tmcApplicationProducts.push('husat24com'); tmcApplicationProducts.push('itsat24com'); tmcApplicationProducts.push('essat24com'); tmcApplicationProducts.push('sesat24com'); tmcApplicationProducts.push('plsat24com'); tmcApplicationProducts.push('frsat24com'); $(document).ready(function () { // Validate token if cookie exists or check at server for authentication ticket var t = new Subscription(); t.hostname = api; i = 0; //for (i = 0; i < tmcApplicationProducts.length; i++) { var c = $.cookie(tmcApplicationProducts[i]); if (c) { isCookieExists = true; t = new Subscription(); t.hostname = api; t.token = c; t.validateToken(doBogus); } else { // no client side cookie found, check for http only cookie t = new Subscription(); t.hostname = api; t.token = ''; t.productCode = tmcApplicationProducts[i]; t.validateToken(refreshPage); //return; } //} }); function refreshPage(data) { // ns.de requires reload if (!isCookieExists && data.IsValid && isNiederschlagsradar) { location.reload(); } return; } function doBogus() { return; } function opm_DeleteCookie(data) { for (i = 0; i < tmcApplicationProducts.length; i++) { $.cookie(tmcApplicationProducts[i], '', $.extend({}, { domain: '.sat24.com', path: '/' }, { expires: -1 })); $.removeCookie(tmcApplicationProducts[i], { path: '/' }); } }