mods not yet commited
authorhackbard <hackbard@hackdaworld.org>
Thu, 12 Oct 2017 15:39:33 +0000 (17:39 +0200)
committerhackbard <hackbard@hackdaworld.org>
Thu, 12 Oct 2017 15:39:33 +0000 (17:39 +0200)
idb.js
utils.js

diff --git a/idb.js b/idb.js
index 2e4c9e9..f574688 100644 (file)
--- a/idb.js
+++ b/idb.js
@@ -95,6 +95,15 @@ var idb = {
                req.onerror=idb.onerror;
                req.onblocked=idb.onblocked;
        },
+       del_store: function(store,callback) {
+               var tx=db.handle.transaction(store,'readwrite');
+               var store=tx.objectStore(store);
+               var req=store.clear();
+               req.onsuccess=function() {
+                       cl("db: store "+store.name+" deleted");
+                       callback();
+               };
+       },
        add_store_item: function(store,item,callback) {
                var tx=idb.handle.transaction(store,'readwrite');
                var store=tx.objectStore(store);
@@ -106,15 +115,6 @@ var idb = {
                        cl("idb: add item error, "+error);
                };
        },
-       del_store: function(store,callback) {
-               var tx=db.handle.transaction(store,'readwrite');
-               var store=tx.objectStore(store);
-               var req=store.clear();
-               req.onsuccess=function() {
-                       cl("db: store "+store.name+" deleted");
-                       callback();
-               };
-       },
        del_store_item: function(store,num,callback) {
                var tx=db.handle.transaction(store,'readwrite');
                var store=tx.objectStore(store);
@@ -303,10 +303,11 @@ var idb = {
 
                };
        },
-       del: function() {
+       del: function(callback) {
                var req=indexedDB.deleteDatabase(idb.name);
                req.onsuccess=function() {
                        cl("idb: deleted database '"+idb.name+"'");
+                       callback();
                };
                req.onblocked=function() {
                        cl("idb: database delete blocked");
index 30190b4..0d78e8b 100644 (file)
--- a/utils.js
+++ b/utils.js
@@ -17,3 +17,35 @@ function objdbg(obj) {
        cl(msg);
 }
 
+function anddbg(obj) {
+       var msg="debug object:\n";
+       for(var k in obj) {
+               msg=msg+"--> "+k+": "+obj[k]+"\n";
+       }
+       alert(msg);
+}
+
+function vert_align_text(trg) {
+       $(trg).each(function() {
+               var lh=$(this).height();
+               $(this).css('line-height',lh+'px');
+               $(this).css('vertical-align','middle');
+       });
+}
+
+function html2ascii(str) {
+       str=str.replace(/\&auml\;/g,"ä");
+       str=str.replace(/\&ouml\;/g,"ö");
+       str=str.replace(/\&uuml\;/g,"ü");
+       str=str.replace(/\&szlig\;/g,"ß");
+       return str;
+}
+
+function ascii2html(str) {
+       str=str.replace(/ä/g,"&auml;");
+       str=str.replace(/ö/g,"&ouml;");
+       str=str.replace(/ü/g,"&uuml;");
+       str=str.replace(/ß/g,"&szlig;");
+       return str;
+}
+