Do not display notifications when popup is open (and remove traces)

This commit is contained in:
fermin831 2017-11-27 19:14:31 +01:00
parent 0b3c42bb03
commit 5c9822111d
3 changed files with 11 additions and 13 deletions

View File

@ -65,12 +65,17 @@ function getEvents(reply){
// Discriminate the new events
newEvents=fetchNewEvents(fetchedEvents,storedEvents);
// Display the notifications
// Display the notifications only if popup is not showing
var views = chrome.extension.getViews({ type: "popup" });
if (views.length == 0) {
for(var k=0;k<newEvents.length;k++){
localStorage["new_events"]++;
displayNotification (newEvents[k])
alertsSound(newEvents[k]);
}
} else {
localStorage["new_events"] = 0;
}
storedEvents = fetchedEvents;
@ -114,6 +119,7 @@ function parseReplyEvents (reply) {
for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
fetchedEvents.push({
'id' : event[0],

View File

@ -92,12 +92,6 @@ function disable(state){
}
}
function windowClose() {
//window.close();
console.log("close");
}
//Add callbacks to elements
$(document).ready (function () {
@ -167,5 +161,4 @@ $(document).ready (function () {
$("#close").click (function () {
window.close();
});
});

View File

@ -64,7 +64,6 @@ function showError(text){
function showEvents(){
clearError();
console.log("showEvents!!");
$('#events').empty();
var e_refr = document.getElementById('event_temp');
if(e_refr){