From 948256ab3702624452939d234a8af632a85f1e40 Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Fri, 29 Dec 2017 20:22:57 -0800 Subject: [PATCH] Fix scroll point on export dialog, better handle getting bookmark data --- js/importExport.js | 14 ++++++-------- js/main.js | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/js/importExport.js b/js/importExport.js index 00a474d..34bf814 100644 --- a/js/importExport.js +++ b/js/importExport.js @@ -7,6 +7,8 @@ $(document).ready(function () { function showImportModal(e) { $("#copyExportTxt").removeClass("text-success text-danger").addClass("text-muted").text("Copy"); + $("#exportText").val(""); + $("#importText").val(""); } function showBookmarkData() { @@ -15,12 +17,10 @@ function showBookmarkData() { openDBRequest.onsuccess = function (e) { var db = e.target.result; - db.transaction("Groups").objectStore("Groups").getAllKeys().onsuccess = function (evt) { - var data = JSON.stringify(bookmarkList, null, 4); - if (data != null) - $("#exportText").text(data); - else - $("#exportText").text("[]"); + db.transaction("Groups").objectStore("Groups").getAll().onsuccess = function (evt) { + var res = evt.target.result; + var data = JSON.stringify(res, null, 4); + $("#exportText").val(data); } } } @@ -44,8 +44,6 @@ function importBookmarks() { function setList(data) { // empty the DB and fill it with the new data - bookmarkList = data; - var openDBRequest = window.indexedDB.open("bookmarks"); openDBRequest.onsuccess = function (e) { diff --git a/js/main.js b/js/main.js index 1995d25..8399082 100644 --- a/js/main.js +++ b/js/main.js @@ -1,5 +1,4 @@ // use this when making changes so that there is no need to parse the page -var bookmarkList; var backgroundList = ["img/1.png", "img/2.png", "img/3.png", "img/4.png", "img/5.png", "img/6.png", "img/7.png", "img/8.png"];