summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-09-29 23:06:50 +0200
committertomsmeding <tom.smeding@gmail.com>2016-09-29 23:06:50 +0200
commit3e876de648dfc274ee456f7faaaaa47409a57034 (patch)
treec656f4b176816b07bd22c9940474b83dd365fd93 /modules
parentd62a9b33dd3d03da942e98c360815a7d8ab7327a (diff)
Fix server bugs
Diffstat (limited to 'modules')
-rw-r--r--modules/changes/changes.html6
-rw-r--r--modules/changes/changes.js17
2 files changed, 18 insertions, 5 deletions
diff --git a/modules/changes/changes.html b/modules/changes/changes.html
index e084f2f..bdd0fa3 100644
--- a/modules/changes/changes.html
+++ b/modules/changes/changes.html
@@ -125,6 +125,10 @@ function makeURLtr(url){
ev.stopPropagation();
if(!confirm("Delete the following url?\n"+url))return;
fetch("DELETE","/changes/url",url,function(status,body){
+ if(status!=200){
+ alert("Error deleting: ("+status+") "+body);
+ return;
+ }
var tlh=document.getElementById("timelineheader");
if(tlh.firstChild&&tlh.firstChild.nodeValue==url){
document.getElementById("timelinecontainer").classList.remove("visible");
@@ -150,7 +154,7 @@ function makeURLtr(url){
function updateURLs(){
fetch("GET","/changes/urls",function(status,body){
urls=JSON.parse(body);
- if(!urls){
+ if(status!=200||!urls){
urls=[];
alert("Error retrieving URLs!");
return;
diff --git a/modules/changes/changes.js b/modules/changes/changes.js
index 7c21326..04b7f6e 100644
--- a/modules/changes/changes.js
+++ b/modules/changes/changes.js
@@ -20,10 +20,19 @@ persist.initSync();
//url: String
//URLobject: {url, timeline: [[Date, hash, contents]]}
var urls=persist.getItemSync("urls");
-if(!urls){
- urls={};
- persist.setItemSync("urls",urls);
-}
+(function(){
+ if(!urls){
+ urls={};
+ persist.setItemSync("urls",urls);
+ } else {
+ var url,i;
+ for(url in urls){
+ for(i=0;i<urls[url].timeline.length;i++){
+ urls[url].timeline[i][0]=new Date(urls[url].timeline[i][0]);
+ }
+ }
+ }
+})();
function URLobject(url){