Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- Fraudshield Tracking Code -->
  2. <script>
  3.     var fsPassedParameters = {
  4.     }
  5. </script>
  6.  
  7. <script>
  8. var parseUrl = function(str, component) {
  9.   var query, key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port',
  10.       'relative', 'path', 'directory', 'file', 'query', 'fragment'
  11.     ],
  12.     ini = (this.php_js && this.php_js.ini) || {},
  13.     mode = (ini['phpjs.parse_url.mode'] &&
  14.       ini['phpjs.parse_url.mode'].local_value) || 'php',
  15.     parser = {
  16.       php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
  17.       strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
  18.       loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this)
  19.     };
  20.  
  21.   var m = parser[mode].exec(str),
  22.     uri = {},
  23.     i = 14;
  24.   while (i--) {
  25.     if (m[i]) {
  26.       uri[key[i]] = m[i];
  27.     }
  28.   }
  29.  
  30.   if (component) {
  31.     return uri[component.replace('PHP_URL_', '')
  32.       .toLowerCase()];
  33.   }
  34.   if (mode !== 'php') {
  35.     var name = (ini['phpjs.parse_url.queryKey'] &&
  36.       ini['phpjs.parse_url.queryKey'].local_value) || 'queryKey';
  37.     parser = /(?:^|&)([^&=]*)=?([^&]*)/g;
  38.     uri[name] = {};
  39.     query = uri[key[12]] || '';
  40.     query.replace(parser, function($0, $1, $2) {
  41.       if ($1) {
  42.         uri[name][$1] = $2;
  43.       }
  44.     });
  45.   }
  46.   delete uri.source;
  47.   return uri;
  48. }
  49.  
  50. var parseInnoGames = function(components, params) {
  51.   var host = components.host;
  52.  
  53.   if(host) {
  54.     var hostParts = host.split('.');
  55.     var mapping = {
  56.       countryServer: 0,
  57.       product: 1,
  58.       domainExtension: 2
  59.     }
  60.  
  61.     for(var param in mapping) {
  62.       if(mapping.hasOwnProperty(param)) {
  63.         params.push({
  64.           key: param,
  65.           value: hostParts[mapping[param]]
  66.         });
  67.       }
  68.     }
  69.   }
  70.  
  71.   return params;
  72. }
  73.  
  74. var parseUrlForParams = function() {
  75.       var uri = document.location.href;
  76.       var components = parseUrl(uri);
  77.       var params = [];
  78.      
  79.       params = parseInnoGames(components, params);
  80.  
  81.       return params;
  82.     }
  83.  
  84. var fetchValueForKey = function(key) {
  85.       var params = parseUrlForParams();
  86.  
  87.       for(var idx in params) {
  88.         if(params.hasOwnProperty(idx) && params[idx].key == key) {
  89.           return params[idx].value;
  90.         }
  91.       }
  92.  
  93.       return null;
  94.     }
  95.  
  96. // function MUST be declared with this exact name.
  97. var fsPreApiCallHook = function(payload) {
  98.     var countryServer = fetchValueForKey('countryServer');
  99.  
  100.     // filter out the numbers from server name
  101.     countryServer = countryServer.replace(/\d+/g, '');
  102.  
  103.     if(countryServer !== null) {
  104.       payload['fs_transaction_id'] = "{PLAYER_ID}" + "_" + countryServer;
  105.     }
  106.  
  107.    payload['innoPlayerId'] = "{PLAYER_ID}";
  108.  
  109.   return payload;
  110. }
  111. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement