From 957f468c59002760a9d0c6acfad6325bcb35ccd8 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 15 Oct 2017 12:04:40 +0200 Subject: [PATCH] Improvement: Add bookmark without sheme add http:// --- src/js/background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 533ede3..111b339 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -487,14 +487,16 @@ app.GridNodes.setNodeIndex = function(gridNode, index, newIndex, callback){ // S } app.GridNodes.createBookmark = function(gridNode, url, title, callback){ // Create a new Bookmark in a GridNode. callback(gridNode, newGridNode) browser.bookmarks.onCreated.removeListener(app.Bookmarks._onCreated); + var prefix = ''; + if(url.indexOf('://')<0) prefix = 'http://'; browser.bookmarks.create({ parentId: gridNode.id, title: title || url, - url: url + url: prefix + url }).then(function(bookmarkItem){ if(!gridNode) return; // ??? Why this method are called a second time with gridNode = null ??? browser.bookmarks.onCreated.addListener(app.Bookmarks._onCreated); - var newGridNode = { id: bookmarkItem.id, type: app.GridNodes.GridNodeType.bookmark, url: url, title }; + var newGridNode = { id: bookmarkItem.id, type: app.GridNodes.GridNodeType.bookmark, url: prefix + url, title }; var EmptyCellFound = false; for(var i=0; i