diff --git a/extension/popup.js b/extension/popup.js index 5cd27f4..f4cbb6b 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -1,6 +1,7 @@ var config = new Config(); var gsites = new Sites(config); +//Add to ignored sites function addIgnoredSite(new_site) { return function() { chrome.extension.sendRequest( @@ -11,6 +12,7 @@ function addIgnoredSite(new_site) { }; } +//Convert seconds to time in string format function secondsToString(seconds) { if (config.timeDisplayFormat == Config.timeDisplayFormatEnum.MINUTES) { return (seconds/60).toFixed(2); @@ -39,6 +41,7 @@ function secondsToString(seconds) { return s; } +//Creates the table display in the popup function addLocalDisplay() { var old_tbody = document.getElementById("stats_tbody"); var tbody = document.createElement("tbody"); @@ -47,9 +50,9 @@ function addLocalDisplay() { /* Sort sites by time spent */ var sites = gsites.sites; - var sortedSites = new Array(); + var sortedSites = []; var totalTime = 0; - for (site in sites) { + for (var site in sites) { sortedSites.push([site, sites[site]]); totalTime += sites[site]; } diff --git a/extension/sites.js b/extension/sites.js index 85331c0..02c1650 100644 --- a/extension/sites.js +++ b/extension/sites.js @@ -3,6 +3,7 @@ * * The primary interface to this class is through setCurrentFocus. */ + //Note: Can probable use as is with no changes function Sites(config) { this._config = config; if (!localStorage.sites) { @@ -68,7 +69,7 @@ Sites.prototype._updateTime = function() { Sites.prototype.setCurrentFocus = function(url) { console.log("setCurrentFocus: " + url); this._updateTime(); - if (url == null) { + if (url === null) { this._currentSite = null; this._startTime = null; } else { diff --git a/extension/tracker.js b/extension/tracker.js index 957dbca..b6c3125 100644 --- a/extension/tracker.js +++ b/extension/tracker.js @@ -1,6 +1,8 @@ /** * Responsible for detecting focus change from tabs and windows. */ + //Note: Can probable use as is with no changes + function Tracker(config, sites) { this._sites = sites; var self = this;