Completed chrome extension
This commit is contained in:
parent
c10a3f40f2
commit
5f3012948c
@ -1,6 +1,6 @@
|
||||
body {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
height: 310px;
|
||||
margin: 0 !important;
|
||||
}
|
||||
body .bgmask {
|
||||
|
@ -9,7 +9,17 @@ button {
|
||||
transform 0.15s ease;
|
||||
}
|
||||
|
||||
button.small {
|
||||
padding: 0.15em 1em;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: scale(1.075);
|
||||
color: #fff;
|
||||
background-color: #5954a4;
|
||||
}
|
||||
|
||||
button.special:hover {
|
||||
/*background-color: #5954a4;*/
|
||||
color: #fff;
|
||||
animation: color-cycle;
|
||||
|
@ -1,6 +1,6 @@
|
||||
* {
|
||||
font-family: 'ZillaSlab' !important;
|
||||
color: #ddd;
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
p,
|
||||
|
@ -24,12 +24,14 @@
|
||||
<div class="flex flex-col align-items-center">
|
||||
|
||||
<!-- Download this - button -->
|
||||
<button id="button-download" title="Will download this pages URL as a video of highest quality.">
|
||||
<button class="special" id="button-download" title="Will download this pages URL as a video of highest quality.">
|
||||
Download!
|
||||
</button>
|
||||
|
||||
<!-- Tubio config form -->
|
||||
<label for="tubio-address" style="margin-top: 3em;">Where can i reach tubio?</label>
|
||||
<input type="text" id="tubio-address" class="text-center" />
|
||||
<button class="small" id="button-save-settings" style="margin-top: 0.5em;">Save settings</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,3 +20,13 @@ $("#button-download").click(function() {
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
chrome.storage.local.get(['tubio_address'], function(result) {
|
||||
$("#tubio-address").val(result.tubio_address);
|
||||
});
|
||||
|
||||
$("#button-save-settings").click(function() {
|
||||
chrome.storage.local.set({
|
||||
tubio_address: $("#tubio-address").val()
|
||||
});
|
||||
});
|
||||
|
@ -1,21 +1,38 @@
|
||||
function QueueDownload(url, mode, quality, callback) {
|
||||
|
||||
console.log("Queuing '" + url + "'...");
|
||||
console.log("Queueing '" + url + "'...");
|
||||
|
||||
// Fetch tubio address
|
||||
chrome.storage.local.get(['tubio_address'], function(result) {
|
||||
|
||||
if ((typeof(result.tubio_address) == 'undefined') ||
|
||||
(result.tubio_address.length == 0)) {
|
||||
alert("Please first set an address to reach Tubio at in the extensions settings! (Click on the extensions icon in the toolbar).");
|
||||
return;
|
||||
} else {
|
||||
|
||||
tubioUrl = result.tubio_address;
|
||||
if (tubioUrl[tubioUrl.length-1] != '/') { // Has the user not appended a /?
|
||||
tubioUrl += '/';
|
||||
}
|
||||
|
||||
axios.post(tubioUrl + "api", {
|
||||
request: "queue_download",
|
||||
video_url: url,
|
||||
mode: mode,
|
||||
quality: quality
|
||||
}).then(function(response){
|
||||
console.log("Queued successfully...");
|
||||
if (typeof(callback) != 'undefined') callback(true, response);
|
||||
|
||||
}).catch(function(response){
|
||||
console.log("Something went wrong...");
|
||||
console.log(response);
|
||||
if (typeof(callback) != 'undefined') callback(false, response);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
axios.post("http://tub.io/api", {
|
||||
request: "queue_download",
|
||||
video_url: url,
|
||||
mode: mode,
|
||||
quality: quality
|
||||
}).then(function(response){
|
||||
console.log("Queued successfully...");
|
||||
if (typeof(callback) != 'undefined') callback(true, response);
|
||||
|
||||
}).catch(function(response){
|
||||
console.log("Something went wrong...");
|
||||
console.log(response);
|
||||
if (typeof(callback) != 'undefined') callback(false, response);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user