Phaser.Net = function (game){ this.game = game; } ; Phaser.Net.prototype = { getHostName: function (){ if (_AN_Read_location('location', window) && _AN_Read_hostname('hostname', _AN_Read_location('location', window))) { return _AN_Read_hostname('hostname', _AN_Read_location('location', window)); } return null ; } , checkDomainName: function (domain){ return _AN_Read_hostname('hostname', _AN_Read_location('location', window)).indexOf(domain) !== -1; } , updateQueryString: function (key, value, redirect, url){ if (typeof redirect === "undefined") { redirect = false ; } if (typeof url === "undefined" || url === '') { url = _AN_Read_href('href', _AN_Read_location('location', window)); } var output = ''; var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"); if (re.test(url)) { if (typeof value !== 'undefined' && value !== null ) { output = _AN_Call_replace('replace', url, re, '$1' + key + "=" + value + '$2$3'); } else { output = _AN_Call_replace('replace', _AN_Call_replace('replace', url, re, '$1$3'), /(&|\?)$/, ''); } } else { if (typeof value !== 'undefined' && value !== null ) { var separator = url.indexOf('?') !== -1? '&': '?'; var hash = url.split('#'); url = hash[0] + separator + key + '=' + value; if (hash[1]) { url += '#' + hash[1]; } output = url; } else { output = url; } } if (redirect) { _AN_Write_href('href', _AN_Read_location('location', window), false , output); } else { return output; } } , getQueryString: function (parameter){ if (typeof parameter === "undefined") { parameter = ''; } var output = { } ; var keyValues = _AN_Read_search('search', _AN_Read_location('location', window)).substring(1).split('&'); for (var i in keyValues){ var key = keyValues[i].split('='); if (_AN_Read_length('length', key) > 1) { if (parameter && parameter == this.decodeURI(key[0])) { return this.decodeURI(key[1]); } else { output[this.decodeURI(key[0])] = this.decodeURI(key[1]); } } } return output; } , decodeURI: function (value){ return decodeURIComponent(_AN_Call_replace('replace', value, /\+/g, " ")); } } ; Phaser.Net.prototype.constructor = Phaser.Net;