Basic extension setup and basic downlading capability
This commit is contained in:
25
goodies/chrome-extension/background.js
Normal file
25
goodies/chrome-extension/background.js
Normal file
@@ -0,0 +1,25 @@
|
||||
function Queue(info) {
|
||||
|
||||
// Select either the current page location, or the target of a href (if the user clicked on one)
|
||||
urlToDownload = typeof(info.linkUrl) != 'undefined' ? info.linkUrl : info.pageUrl;
|
||||
|
||||
axios.post("http://tub.io/api", {
|
||||
request: "queue_download",
|
||||
video_url: urlToDownload,
|
||||
mode: "video",
|
||||
quality: "best"
|
||||
}).then(function(response){
|
||||
console.log("Queued successfully...");
|
||||
}).catch(function(response){
|
||||
console.log("Something went wrong...");
|
||||
console.log(response);
|
||||
});
|
||||
}
|
||||
|
||||
chrome.contextMenus.create({
|
||||
"title" : "Queue in Tubio",
|
||||
"contexts": ["all"],
|
||||
"type" : "normal",
|
||||
"onclick" : Queue
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user