Skip to content

Commit

Permalink
Fix time-counting in private/non-private tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
proginosko committed Dec 27, 2024
1 parent eab7653 commit 27a0281
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,19 @@ function clockPageTime(id, open, focus) {

// Update time data if necessary
if (secsOpen > 0 || secsFocus > 0) {
updateTimeData(gTabs[id].url, gTabs[id].referrer, gTabs[id].audible, secsOpen, secsFocus);
updateTimeData(id, secsOpen, secsFocus);
}
}

// Update time data for specified page
//
function updateTimeData(url, referrer, audible, secsOpen, secsFocus) {
//log("updateTimeData: " + url + " " + secsOpen + " " + secsFocus);
function updateTimeData(id, secsOpen, secsFocus) {
//log("updateTimeData: " + id + " " + secsOpen + " " + secsFocus);

let referrer = gTabs[id].referrer;
let url = gTabs[id].url;
let incog = gTabs[id].incog;
let audible = gTabs[id].audible;

// Get parsed URL for this page
let parsedURL = getParsedURL(url);
Expand All @@ -884,6 +889,10 @@ function updateTimeData(url, referrer, audible, secsOpen, secsFocus) {
let referRE = gRegExps[set].refer;
if (!blockRE && !referRE) continue; // no block for this set

// Check incognito mode
let incogMode = gOptions[`incogMode${set}`];
if ((incogMode == 1 && incog) || (incogMode == 2 && !incog)) continue;

// Get option for counting time only when tab is playing audio
let countAudio = gOptions[`countAudio${set}`];
if (countAudio && !audible) continue; // no audio playing
Expand Down

0 comments on commit 27a0281

Please sign in to comment.