From e1339f37721c5480651e743068317cce33dbbbdc Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Tue, 2 Jan 2018 20:28:56 -0800 Subject: [PATCH] Make bookmarkMoved compatible with IE/Edge --- js/editBookmarks.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/js/editBookmarks.js b/js/editBookmarks.js index a9e02df..8b2b6c7 100644 --- a/js/editBookmarks.js +++ b/js/editBookmarks.js @@ -93,19 +93,20 @@ function bookmarkMoved(dropEvt) { var db = openEvt.target.result; var groupsStore = db.transaction("Groups", "readwrite").objectStore("Groups"); - groupsStore.getAll().onsuccess = function (getAllEvt) { - var groups = getAllEvt.target.result; + groupsStore.get(oldGroupIndex).onsuccess = function (getOldEvt) { + var oldGroupData = getOldEvt.target.result; - var oldGroupData = groups[oldGroupIndex]; - var newGroupData = groups[newGroupIndex]; + groupsStore.get(newGroupIndex).onsuccess = function (getNewEvt) { + var newGroupData = getNewEvt.target.result; - oldGroupData.bookmarks = removeFromArray(oldGroupData.bookmarks, oldIndex); - groupsStore.put(oldGroupData); + oldGroupData.bookmarks = removeFromArray(oldGroupData.bookmarks, oldIndex); + groupsStore.put(oldGroupData); - newGroupData.bookmarks = addToArray(newGroupData.bookmarks, itemData, newIndex); - groupsStore.put(newGroupData); + newGroupData.bookmarks = addToArray(newGroupData.bookmarks, itemData, newIndex); + groupsStore.put(newGroupData); - db.close(); + db.close(); + } } }