diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-02-24 11:04:46 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-02-24 11:04:46 -0600 |
| commit | 1692f7640c74d83d909e121356b0f4c593c5ac59 (patch) | |
| tree | 61c14750785959fbaf3694f1a5fd81863f59cb38 /assets/js | |
| parent | ebcb21dbfe73e4d74465e796d595e0e4e704436c (diff) | |
| download | invidious-1692f7640c74d83d909e121356b0f4c593c5ac59.tar.gz invidious-1692f7640c74d83d909e121356b0f4c593c5ac59.tar.bz2 invidious-1692f7640c74d83d909e121356b0f4c593c5ac59.zip | |
Remove JS from download widget
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/watch.js | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/assets/js/watch.js b/assets/js/watch.js index 37ca4e43..7a68c30c 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -50,57 +50,3 @@ function hide_youtube_replies(target, inner_text, sub_text) { target.innerHTML = sub_text; target.setAttribute("onclick", "show_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')"); } - -function download_video(target) { - var title = target.getAttribute("data-title"); - var children = document.getElementById("download_widget").children; - var progress = document.getElementById("download-progress"); - var url = ""; - - document.getElementById("progress-container").style.display = ""; - - for (i = 0; i < children.length; i++) { - if (children[i].selected) { - url = children[i].getAttribute("data-url"); - } - } - - var xhr = new XMLHttpRequest(); - xhr.open("GET", url); - xhr.responseType = "arraybuffer"; - - xhr.onprogress = function(event) { - if (event.lengthComputable) { - progress.style.width = "" + (event.loaded / event.total)*100 + "%"; - } - }; - - xhr.onload = function(event) { - if (event.currentTarget.status != 200) { - console.log("Downloading " + title + " failed.") - document.getElementById("progress-container").style.display = "none"; - progress.style.width = "0%"; - - return; - } - - var data = new Blob([xhr.response], {'type' : 'video/mp4'}); - var videoFile = window.URL.createObjectURL(data); - - var link = document.createElement('a'); - link.href = videoFile; - link.setAttribute('download', title); - document.body.appendChild(link); - - window.requestAnimationFrame(function() { - var event = new MouseEvent('click'); - link.dispatchEvent(event); - document.body.removeChild(link); - }); - - document.getElementById("progress-container").style.display = "none"; - progress.style.width = "0%"; - }; - - xhr.send(null); -}
\ No newline at end of file |
