From 5e0713231657483c77dcaa7decad425f637ff1c6 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 10 Nov 2017 23:40:13 +0100 Subject: [PATCH] Improvement: Bookmarks sync --- src/js/background.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/js/background.js b/src/js/background.js index 0017b98..87f8cd1 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -612,6 +612,12 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of delete gridNode.__isLoading; app.GridNodes.saveNode(gridNode); if(callback) callback({ title: gridNode.title, screenshot: gridNode.image }); + /* + browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged); + browser.bookmarks.update(gridNode.id, { title: gridNode.title }).then(function(){ + browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged); + }); + */ break; case app.GridNodes.GridNodeType.bookmark: app.SiteInfos.fromFrame(gridNode.url, function(infos){ @@ -624,6 +630,10 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of delete gridNode.__isLoading; app.GridNodes.saveNode(gridNode); if(callback) callback(infos); + browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged); + browser.bookmarks.update(gridNode.id, { title: gridNode.title, url: gridNode.url }).then(function(){ + browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged); + }); }); break; } @@ -660,6 +670,10 @@ app.GridNodes.capturePage = function(gridNode, callback){ delete gridNode.__isLoading; app.GridNodes.saveNode(gridNode); if(callback) callback(infos); + browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged); + browser.bookmarks.update(gridNode.id, { title: gridNode.title, url: gridNode.url }).then(function(){ + browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged); + }); }); break; }