mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Do not display notifications when popup is open (and remove traces)
This commit is contained in:
parent
0b3c42bb03
commit
5c9822111d
@ -65,11 +65,16 @@ function getEvents(reply){
|
||||
// Discriminate the new events
|
||||
newEvents=fetchNewEvents(fetchedEvents,storedEvents);
|
||||
|
||||
// Display the notifications
|
||||
for(var k=0;k<newEvents.length;k++){
|
||||
localStorage["new_events"]++;
|
||||
displayNotification (newEvents[k])
|
||||
alertsSound(newEvents[k]);
|
||||
// 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],
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user