Minor code refactor in sendVideoUrlToMetube function as per suggestion
This commit is contained in:
parent
87704abeca
commit
45b3eb289a
|
|
@ -39,7 +39,9 @@ function sendVideoUrlToMetube(videoUrl, metubeUrl, callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
typeof callback === 'function' && callback();
|
if (typeof callback === 'function'){
|
||||||
|
callback();
|
||||||
|
}
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
console.log("Ran into an error :: ", e);
|
console.log("Ran into an error :: ", e);
|
||||||
});
|
});
|
||||||
|
|
@ -63,6 +65,19 @@ chrome.contextMenus.onClicked.addListener(function(item, tab) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
async function getCurrentTabUrl() {
|
||||||
|
chrome.tabs.query({
|
||||||
|
active: true,
|
||||||
|
lastFocusedWindow: true
|
||||||
|
}, function(tabs) {
|
||||||
|
// use this tab to get the youtube video URL
|
||||||
|
let videoUrl = tabs[0].url;
|
||||||
|
console.log("Got current tab URL", videoUrl);
|
||||||
|
return videoUrl;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chrome.action.onClicked.addListener(function(tab) {
|
chrome.action.onClicked.addListener(function(tab) {
|
||||||
chrome.storage.sync.get(['metube', 'clickBehavior'], function(data) {
|
chrome.storage.sync.get(['metube', 'clickBehavior'], function(data) {
|
||||||
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
if (data === undefined || !data.hasOwnProperty('metube') || data.metube === "") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue