peteshow 0.8.0 → 0.8.1

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
@@ -1373,11 +1373,11 @@ window.Peteshow = Peteshow;
1373
1373
 
1374
1374
  savedFieldsExist = function() {
1375
1375
  var saved = _options.cookies ? $.cookie('peteshow') : localStorage.getItem('peteshow')
1376
- return (saved != undefined || saved != null)
1376
+ return saved != undefined || saved != null
1377
1377
  }
1378
1378
 
1379
1379
  Peteshow.setSavedFields = function(data) {
1380
- _options.cookies ? $.cookie('peteshow', data) : localStorage.setItem('peteshow', data)
1380
+ _options.cookies ? $.cookie('peteshow', data, {domain: getDomain()}) : localStorage.setItem('peteshow', data)
1381
1381
  }
1382
1382
 
1383
1383
  Peteshow.getSavedFields = function() {
@@ -1385,6 +1385,14 @@ window.Peteshow = Peteshow;
1385
1385
  return (saved != undefined || saved != null) ? JSON.parse(saved) : {}
1386
1386
  }
1387
1387
 
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;
1394
+ }
1395
+
1388
1396
  Peteshow.clearSaved = function() {
1389
1397
  Peteshow.clearLocalStorage()
1390
1398
  Peteshow.clearCookies()