diff options
Diffstat (limited to 'www/js/index.js')
| -rw-r--r-- | www/js/index.js | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/www/js/index.js b/www/js/index.js index 7d2cf5c..978a639 100644 --- a/www/js/index.js +++ b/www/js/index.js @@ -13,7 +13,7 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ version = '1.0.1'; @@ -49,7 +49,7 @@ function istPremium(benutzer, key){ // Supersicherer Keygenerator :P Inspiriert function updateCheck(){ var request = $.ajax({ - url: 'http://klimaag.***REMOVED***/app/www/knockout.html', + url: 'https://klimaag.***REMOVED***/app/www/knockout.html', cache: false }); @@ -90,15 +90,6 @@ function updateCheck(){ request.fail(fail); } -function track(what){ - _paq.push(['setCustomUrl', what]); - _paq.push(['trackPageView', what]); -} - -function trackPlan(vdate){ - track('plan/' + vdate.format('YYYY/MM/DD')); -} - $('#settingspanel').change(function(){ localStorage.setItem('dntrack', $('#dntflip').val()); localStorage.setItem('classes', $('#addclass').val().toUpperCase()); @@ -129,6 +120,21 @@ $('#mainpage').on('swiperight', function(){ $('#settingspanel').panel('open'); }); +String.prototype.hashCode = function() { + var hash = 0, i, chr, len; + if (this.length === 0) return hash; + for (i = 0, len = this.length; i < len; i++) { + chr = this.charCodeAt(i); + hash = ((hash << 5) - hash) + chr; + hash |= 0; // Convert to 32bit integer + } + return hash; +}; + +function uglyUsername(user) { + return Math.abs(user.hashCode()).toString(16); +} + var _paq = _paq || []; $('#mainpage').on('pagebeforeshow', function(){ /* Versionsnummer zeigen */ @@ -138,7 +144,7 @@ $('#mainpage').on('pagebeforeshow', function(){ moment.lang('de'); /* Nutzungsstatistiken */ - _paq.push(['setTrackerUrl', 'http://klimaag.***REMOVED***/piwik/piwik.php']); // Https wäre schön. + _paq.push(['setTrackerUrl', 'https://klimaag.***REMOVED***/piwik/piwik.php']); _paq.push(['setSiteId', 5]); console.log('Piwik initialisiert'); @@ -207,7 +213,6 @@ $('#mainpage').on('pagebeforeshow', function(){ /* Piwik initialisieren */ _paq.push(['setCustomVariable', 4, 'DNT', dntrack, 'visit']); - _paq.push(['setDoNotTrack', Boolean(dntrack)]); }); // Login-Popup beim Start @@ -218,10 +223,12 @@ document.addEventListener('deviceready', function(){ } /* los geht's */ - _paq.push(['setCustomVariable', 1, 'Modell', device.model, 'visit']); - _paq.push(['setCustomVariable', 2, 'Version', device.version, 'visit']); - _paq.push(['setCustomVariable', 3, 'Appversion', version, 'visit']); - track('load'); + if(! $('#dntflip').val()) { + _paq.push(['setCustomVariable', 1, 'Modell', device.model, 'visit']); + _paq.push(['setCustomVariable', 2, 'Version', device.version, 'visit']); + _paq.push(['setCustomVariable', 3, 'Appversion', version, 'visit']); + } + _paq.push(['trackPageView', 'load']); fillForm(); @@ -725,9 +732,6 @@ function neuesPlanTab(fname){ $('#vplannavbar').navbar('destroy'); $('#vplannavbar ul').append('<li><a href="#' + name + '">' + name.replace(/_/g, '.') + '</a></li>'); - $('#vplannavbar ul li:last').click(function(){ - trackPlan(vdate); - }); $('#vplannavbar').navbar(); @@ -862,8 +866,7 @@ function loggedIn(resultHtml){ $('#error_passwd').show('fast'); return; } - - _paq.push(['setUserId', username]); + _paq.push(['setUserId', uglyUsername(username)]); localStorage.setItem('overviewlink', link); console.log('Eingeloggt'); getOverview(link); |
