diff --git a/extension/background.js b/extension/background.js index 4c80320..eec2297 100644 --- a/extension/background.js +++ b/extension/background.js @@ -1,35 +1,13 @@ -// (function() { -// var httpRequest; -// document.getElementById("ajaxButton").onclick = function() { makeRequest('localhost:7777/api/users/'); }; - -// function makeRequest(url) { -// console.log('making request'); -// httpRequest = new XMLHttpRequest(); - -// if (!httpRequest) { -// console.log('Giving up :( Cannot create an XMLHTTP instance'); -// //alert('Giving up :( Cannot create an XMLHTTP instance'); -// return false; -// } -// httpRequest.onreadystatechange = showContents; -// httpRequest.open('GET', url); -// httpRequest.send(); -// } - -// function showContents() { -// if (httpRequest.readyState === XMLHttpRequest.DONE) { -// if (httpRequest.status === 200) { -// console.log(httpRequest.responseText); -// //alert(httpRequest.responseText); -// } else { -// console.log('There was a problem with the request.'); -// //alert('There was a problem with the request.'); -// } -// } -// } -// })(); +// Notification +chrome.alarms.create("notificationAlarm", {periodInMinutes: 2}); +chrome.alarms.onAlarm.addListener(function(alarm) { + if (alarm.name === "notificationAlarm") { + console.log('alarm'); + chrome.notifications.create('notificationAlarm', {type: 'basic', iconUrl: 'icon128.png', title: 'Notification', message: 'This is a notification!'}); + } +}); -//Clear stats +// Clear stats function clearStats() { if (config.clearStatsInterval < 3600) { config.nextTimeToClear = 0; diff --git a/extension/config.js b/extension/config.js index 605c86c..44f0fde 100644 --- a/extension/config.js +++ b/extension/config.js @@ -12,7 +12,7 @@ function Config() { } //Handle time display format Config.timeDisplayFormatEnum = { - PRETTY: 0, + //PRETTY: 0, MINUTES: 1 }; @@ -43,7 +43,7 @@ Config.prototype.isIgnoredSite = function(site) { Object.defineProperty(Config.prototype, "timeDisplayFormat", { get: function() { if (!localStorage.timeDisplayFormat) { - localStorage.timeDisplayFormat = Config.timeDisplayFormatEnum.PRETTY; + localStorage.timeDisplayFormat = Config.timeDisplayFormatEnum.MINUTES; } return localStorage.timeDisplayFormat; }, diff --git a/extension/options.html b/extension/options.html index b7c752d..c50e389 100644 --- a/extension/options.html +++ b/extension/options.html @@ -5,6 +5,10 @@ + Auth0 ID: + + +
Time Display: