peteshow 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/dist/peteshow.js CHANGED
@@ -1386,11 +1386,14 @@ window.Peteshow = Peteshow;
1386
1386
  }
1387
1387
 
1388
1388
  getDomain = function() {
1389
- var i = 0, d = document.domain, p = d.split('.')
1390
- while(i < (p.length - 1)){
1391
- d = p.slice(-1-(++i)).join('.');
1392
- }
1393
- return d == 'localhost' ? '' : d;
1389
+ // http://rossscrivener.co.uk/blog/javascript-get-domain-exclude-subdomain
1390
+ var i=0, domain=document.domain, p=domain.split('.'), s='_gd'+(new Date()).getTime();
1391
+ while(i<(p.length-1) && document.cookie.indexOf(s+'='+s)==-1){
1392
+ domain = p.slice(-1-(++i)).join('.');
1393
+ document.cookie = s+"="+s+";domain="+domain+";";
1394
+ }
1395
+ document.cookie = s+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+domain+";";
1396
+ return domain;
1394
1397
  }
1395
1398
 
1396
1399
  Peteshow.clearSaved = function() {