Fix scroll point on export dialog, better handle getting bookmark data

This commit is contained in:
Neil Brommer 2017-12-29 20:22:57 -08:00
parent 333d5378ae
commit 948256ab37
2 changed files with 6 additions and 9 deletions

View file

@ -7,6 +7,8 @@ $(document).ready(function () {
function showImportModal(e) { function showImportModal(e) {
$("#copyExportTxt").removeClass("text-success text-danger").addClass("text-muted").text("Copy"); $("#copyExportTxt").removeClass("text-success text-danger").addClass("text-muted").text("Copy");
$("#exportText").val("");
$("#importText").val("");
} }
function showBookmarkData() { function showBookmarkData() {
@ -15,12 +17,10 @@ function showBookmarkData() {
openDBRequest.onsuccess = function (e) { openDBRequest.onsuccess = function (e) {
var db = e.target.result; var db = e.target.result;
db.transaction("Groups").objectStore("Groups").getAllKeys().onsuccess = function (evt) { db.transaction("Groups").objectStore("Groups").getAll().onsuccess = function (evt) {
var data = JSON.stringify(bookmarkList, null, 4); var res = evt.target.result;
if (data != null) var data = JSON.stringify(res, null, 4);
$("#exportText").text(data); $("#exportText").val(data);
else
$("#exportText").text("[]");
} }
} }
} }
@ -44,8 +44,6 @@ function importBookmarks() {
function setList(data) { function setList(data) {
// empty the DB and fill it with the new data // empty the DB and fill it with the new data
bookmarkList = data;
var openDBRequest = window.indexedDB.open("bookmarks"); var openDBRequest = window.indexedDB.open("bookmarks");
openDBRequest.onsuccess = function (e) { openDBRequest.onsuccess = function (e) {

View file

@ -1,5 +1,4 @@
// use this when making changes so that there is no need to parse the page // 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", 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"]; "img/5.png", "img/6.png", "img/7.png", "img/8.png"];