Make bookmarkMoved compatible with IE/Edge

This commit is contained in:
Neil Brommer 2018-01-02 20:28:56 -08:00
parent 42c0982a48
commit e1339f3772

View file

@ -93,19 +93,20 @@ function bookmarkMoved(dropEvt) {
var db = openEvt.target.result; var db = openEvt.target.result;
var groupsStore = db.transaction("Groups", "readwrite").objectStore("Groups"); var groupsStore = db.transaction("Groups", "readwrite").objectStore("Groups");
groupsStore.getAll().onsuccess = function (getAllEvt) { groupsStore.get(oldGroupIndex).onsuccess = function (getOldEvt) {
var groups = getAllEvt.target.result; var oldGroupData = getOldEvt.target.result;
var oldGroupData = groups[oldGroupIndex]; groupsStore.get(newGroupIndex).onsuccess = function (getNewEvt) {
var newGroupData = groups[newGroupIndex]; var newGroupData = getNewEvt.target.result;
oldGroupData.bookmarks = removeFromArray(oldGroupData.bookmarks, oldIndex); oldGroupData.bookmarks = removeFromArray(oldGroupData.bookmarks, oldIndex);
groupsStore.put(oldGroupData); groupsStore.put(oldGroupData);
newGroupData.bookmarks = addToArray(newGroupData.bookmarks, itemData, newIndex); newGroupData.bookmarks = addToArray(newGroupData.bookmarks, itemData, newIndex);
groupsStore.put(newGroupData); groupsStore.put(newGroupData);
db.close(); db.close();
}
} }
} }