diff --git a/src/background.js b/src/background.js index f67d5e6..3d4a5cf 100644 --- a/src/background.js +++ b/src/background.js @@ -54,13 +54,25 @@ chrome.contextMenus.onClicked.addListener(function(item, tab) { }); chrome.action.onClicked.addListener(function(tab) { - chrome.storage.sync.get(['metube'], function(data) { + chrome.storage.sync.get(['metube', 'sendOnClick'], function(data) { if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") { openTab(chrome.runtime.getURL('options.html'), tab); return } - - openTab(data.metube, tab); + chrome.tabs.query({ + active: true, + lastFocusedWindow: true + }, function(tabs) { + // use this tab to get the youtube video URL + let videoUrl = tabs[0].url; + if (data.sendOnClick) { + sendVideoUrlToMetubeAndSwitchTab(videoUrl, data.metube, tab); + } + else { + console.log("Going to Metube URL..."); + openTab(data.metube, tab); + } + }); }); }); diff --git a/src/options.html b/src/options.html index 22f7df5..97c2e75 100644 --- a/src/options.html +++ b/src/options.html @@ -32,6 +32,8 @@

Settings

+
+

Additional sites

Youtube-dl support many another sites except youtube. You can add mask url's of this sites in textfield bellow but it can affect performance and we have not tested them support