Added historical events on fail in chrome extension

This commit is contained in:
fermin831 2017-11-27 17:54:17 +01:00
parent c951999a81
commit 0b3c42bb03
3 changed files with 11 additions and 16 deletions

View File

@ -20,7 +20,6 @@ function initialise(){
disable(true); disable(true);
document.getElementById('sound_alert_f').checked=true; document.getElementById('sound_alert_f').checked=true;
} }
} }
function change(value, id){ function change(value, id){
@ -52,10 +51,7 @@ function change_o(value, id){
} }
function change_global(value,id){ function change_global(value,id){
console.log("value => "+value);
console.log("id => "+id);
bg=chrome.extension.getBackgroundPage(); bg=chrome.extension.getBackgroundPage();
bg.location.reload();
if(id=="ip_address"){ if(id=="ip_address"){
localStorage["ip_address"]=value; localStorage["ip_address"]=value;
} }

View File

@ -62,15 +62,15 @@ function showError(text){
} }
function showEvents(){ function showEvents(){
clearError(); clearError();
var wrapper = document.getElementById('event'); console.log("showEvents!!");
$('#events').empty();
var e_refr = document.getElementById('event_temp'); var e_refr = document.getElementById('event_temp');
if(e_refr){ if(e_refr){
wrapper.removeChild(e_refr); wrapper.removeChild(e_refr);
} }
var allEvents=bg.fetchEvents(); var allEvents=bg.fetchEvents();
var r = document.getElementById('e');
var res=document.createDocumentFragment();
var eve=document.createElement('div'); var eve=document.createElement('div');
eve.id="event_temp"; eve.id="event_temp";
eve.setAttribute("class","b"); eve.setAttribute("class","b");
@ -139,13 +139,12 @@ function showEvents(){
i++; i++;
} }
res.appendChild(eve); $('#events').append(eve);
r.parentNode.insertBefore(res,r);
$('img.pm').click(showHide); $('img.pm').click(showHide);
$('div.b').show(); $('div.b').show();
} else { } else {
showDataError(); showError("Error in fetching data!! Check your internet connection");
} }
localStorage["new_events"]=0; localStorage["new_events"]=0;

View File

@ -18,11 +18,11 @@
<div class="error"> <div class="error">
<h1>Error</h1> <h1>Error</h1>
<a href="options.html" target="_blank" /> <a href="options.html" target="_blank" ></a>
</div> </div>
<div class="result" id="result" > <div class="result" id="result">
<div class="b" id="event"> <h1>Events</h1>
<h1>Events</h1> <div class="b" id="events">
<div class="e" id="e" /> <div class="e" id="e" />
</div> </div>
</div> </div>