Skip to content

Commit

Permalink
Add comments, Clean up code based on linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Josephine-Chen committed Feb 23, 2017
1 parent 1a2d303 commit ae8cd9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions extension/popup.js
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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];
}
Expand Down
3 changes: 2 additions & 1 deletion extension/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions extension/tracker.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit ae8cd9d

Please sign in to comment.