diff options
Diffstat (limited to 'js/index.js')
| -rw-r--r-- | js/index.js | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/js/index.js b/js/index.js index 17ca007..88e891c 100644 --- a/js/index.js +++ b/js/index.js @@ -16,25 +16,41 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +function setDNT(dnt){ + _paq.push(['setDoNotTrack', dnt]) + window.localStorage.setItem('dnt', dnt); + $('#disclaimerpopup').popup('close'); +} + function track(what){ _paq.push(['trackPageView', what]); } +document.addEventListener('pause', function(){ + track('event/pause'); +}); + +document.addEventListener('resume', function(){ + track('event/resume'); +}); + // Login-Popup beim Start -//$(document).bind('pageinit', function(){ document.addEventListener('deviceready', function(){ - _paq.push(['setCustomVariable', 0, 'Modell', device.model, 'visit']); - _paq.push(['setCustomVariable', 1, 'Version', device.version, 'visit']); - _paq.push(['trackPageView', 'load']); + _paq.push(['setCustomVariable', 1, 'Modell', device.model, 'visit']); + _paq.push(['setCustomVariable', 2, 'Version', device.version, 'visit']); + track('event/load'); - setTimeout(function(){ + var dnt = window.localStorage.getItem('dnt'); + + if(dnt == 'undefined' || dnt == null || dnt == ''){ + setTimeout(function(){ + $('#lnkdisclaimer').click(); + }, 2000); + }else{ fillform(); load(); - }, 1000); - - setTimeout(function(){ trylogin(); - }, 2000); + } }, false); /* der Loader wird nur angezeigt, wenn das Popup zu ist */ @@ -42,6 +58,12 @@ $('#loginpopup').on('popupafteropen', function(){ $.mobile.loading('hide'); }); +$('#disclaimerpopup').on('popupafterclose', function(){ + fillform(); + load(); + trylogin(); +}); + /* füllt die Loginform mit gespeicherten Werten */ function fillform(){ var username = window.localStorage.getItem('username'); |
