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

View File

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

View File

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