diff --git a/js/aside-script.js b/js/aside-script.js index 997146c..22f8331 100644 --- a/js/aside-script.js +++ b/js/aside-script.js @@ -156,9 +156,16 @@ function AddCollection(collection) i.onclick = function () { RestoreTabs(i.parentElement.parentElement) }; }); - list.querySelectorAll("div > div:last-child > div > span").forEach(i => + list.querySelectorAll("div > div:last-child > div > span").forEach(i => { - i.onclick = function () { window.open(i.getAttribute("value"), '_blank'); }; + i.onclick = function () { + chrome.runtime.sendMessage( + { + command: "openTab", + url: i.getAttribute("value") + } + ); + }; }) document.querySelectorAll(".tabsAside.pane > section > div > div:first-child > button").forEach(i => diff --git a/js/background.js b/js/background.js index 6e50923..22cbd1e 100644 --- a/js/background.js +++ b/js/background.js @@ -2,6 +2,25 @@ chrome.browserAction.onClicked.addListener(function (tab) { if (tab.url.startsWith("http")) { + chrome.tabs.insertCSS( + { + file: "css/style.css", + allFrames: true, + runAt: "document_idle" + }); + chrome.tabs.insertCSS( + { + file: "css/style.generic.css", + allFrames: true, + runAt: "document_idle" + }); + chrome.tabs.insertCSS( + { + file: "css/style.dark.css", + allFrames: true, + runAt: "document_idle" + }); + chrome.tabs.executeScript(tab.id, { file: "js/aside-script.js", @@ -98,6 +117,9 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { switch (message.command) { + case "openTab": + chrome.tabs.create({ url: message.url }); + break; case "loadData": sendResponse(collections); break; diff --git a/manifest.json b/manifest.json index 10374e1..b370507 100644 --- a/manifest.json +++ b/manifest.json @@ -1,15 +1,14 @@ { "name": "Tabs Aside", - "version": "0.1", + "version": "1.0", "manifest_version": 2, - "description": "Classic Microsoft Edge \"Tabs Aside\" feature for Chromium browers", + "description": "Classic Microsoft Edge \"Tabs Aside\" feature for Chromium browsers", "author": "Michael \"XFox\" Gordeev", "permissions": [ "tabs", "unlimitedStorage", - "", - "bookmarks" + "activeTab" ], "icons": @@ -22,19 +21,6 @@ "browser_action": { "default_icon": "icons/light/empty/32.png" }, "web_accessible_resources": [ "*" ], - "content_scripts": - [ - { - "matches": [ "" ], - "css": - [ - "css/style.css", - "css/style.generic.css", - "css/style.dark.css" - ], - "run_at": "document_idle" - } - ], "background": { "scripts": [ "js/background.js" ],