From a18b96494931b8175fe730c54d0e59607e492f3d Mon Sep 17 00:00:00 2001 From: dethe Date: Fri, 20 Dec 2013 16:18:19 -0800 Subject: [PATCH] switch to new domain for data --- data/aggregate.js | 28 ++++++++++++++++++++++++++-- data/dialog.js | 3 +++ data/lightbeam.js | 6 ++---- data/ui.js | 2 +- package.json | 4 ++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/data/aggregate.js b/data/aggregate.js index 1b9799f..705f8e2 100644 --- a/data/aggregate.js +++ b/data/aggregate.js @@ -479,13 +479,37 @@ function switchFilter(name){ aggregate.switchFilter = switchFilter; -aggregate.update = function update(){ +// Underscore debounce function +// +// Returns a function, that, as long as it continues to be invoked, will not +// be triggered. The function will be called after it stops being called for +// N milliseconds. If `immediate` is passed, trigger the function on the +// leading edge, instead of the trailing. +var debounce = function debounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; +}; + +aggregate.update = debounce(function update(){ // FIXME: Don't do this for clock view, maybe not for list view + if (currentVisualization.name !== 'graph'){ + console.log('do not update aggregate for %s view', currentVisualization.name); + } if (aggregate.initialized){ global.filteredAggregate = currentFilter(); aggregate.emit('update'); } updateStatsBar(); -} +}); })(this); diff --git a/data/dialog.js b/data/dialog.js index 917194b..719f349 100644 --- a/data/dialog.js +++ b/data/dialog.js @@ -154,6 +154,9 @@ function addDialogEventHandlers(modal,options,callback){ function addToDoNotShowAgainList(dialogName){ var dnsPref = localStorage.dnsDialogs || "[]"; + if (dnsPref === 'undefined'){ + dnsPref = "[]"; + } dnsPref = JSON.parse(dnsPref); dnsPref.push(dialogName); localStorage.dnsDialogs = JSON.stringify(dnsPref); diff --git a/data/lightbeam.js b/data/lightbeam.js index a15d862..474b5aa 100644 --- a/data/lightbeam.js +++ b/data/lightbeam.js @@ -11,9 +11,7 @@ try{ }catch(e){ userSettings = {}; } -// FIXME: Read this from config file -//var uploadServer = 'http://collusiondb.mofostaging.net/shareData'; -var uploadServer = 'http://collusiondb.mofoprod.net/shareData'; +var uploadServer = 'https://lightbeamdb.org/shareData'; var isRobot = false; // Used for spidering the web only var uploadTimer; var saveTimer; @@ -90,7 +88,7 @@ function elem(name, attributes, children){ }; window.addEventListener('load', function(evt){ - localStorage.numLaunch = parseInt(localStorage.numLaunch)+1 || 1; + localStorage.numLaunch = parseInt(localStorage.numLaunch, 10)+1 || 1; // Wire up events document.querySelector('[data-value=' + (localStorage.visualization || 'Graph') + ']').setAttribute("data-selected", true); var visualization = localStorage.visualization ? ( localStorage.visualization.toLowerCase() ) : "graph"; diff --git a/data/ui.js b/data/ui.js index 9d096f9..daf9afd 100644 --- a/data/ui.js +++ b/data/ui.js @@ -527,7 +527,7 @@ function showPromptToShareDialog(){ today = formattedDate(Date.now()); shownToday = showTimes.indexOf(today) > -1; belowLimit = showTimes.length < promptToShareDialogShowLimit; - if ( localStorage.numLaunch > 1 && !doNotShowDialog(dialogNames.promptToShare) && !shownToday && belowLimit){ + if ( Number(localStorage.numLaunch) > 1 && !doNotShowDialog(dialogNames.promptToShare) && !shownToday && belowLimit){ showTimes.push(today); localStorage.promptToShareDialogShowTimes = JSON.stringify(showTimes); showPromptToShareDialog(function(confirmed){ diff --git a/package.json b/package.json index 9b1ebb9..c2227d3 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "description": "Lightbeam is a Firefox add-on that allows you to see the third parties that are collecting information about your browsing activity, with and without your consent. Using interactive visualizations, Lightbeam shows you the relationships between these third parties and the sites you visit.", "author": "Mozilla Foundation", "license": "MPL 2.0", - "version": "1.0.4", + "version": "1.0.5", "id": "jid1-F9UJ2thwoAm5gQ", "permissions": { "private-browsing": true } -} \ No newline at end of file +}