summaryrefslogtreecommitdiffstats
path: root/assets/js/playlist_widget.js
blob: 0ec27859aad0311741da0b31cc7b89c75b743b2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var playlist_data = JSON.parse(document.getElementById('playlist_data').innerHTML);

function add_playlist_video(target) {
    var select = target.parentNode.children[0].children[1];
    var option = select.children[select.selectedIndex];

    var url = '/playlist_ajax?action_add_video=1&redirect=false' +
        '&video_id=' + target.getAttribute('data-id') +
        '&playlist_id=' + option.getAttribute('data-plid');
    var xhr = new XMLHttpRequest();
    xhr.responseType = 'json';
    xhr.timeout = 10000;
    xhr.open('POST', url, true);
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
            if (xhr.status == 200) {
                option.innerText = '✓' + option.innerText;
            }
        }
    }

    xhr.send('csrf_token=' + playlist_data.csrf_token);
}

function add_playlist_item(target) {
    var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode;
    tile.style.display = 'none';

    var url = '/playlist_ajax?action_add_video=1&redirect=false' +
        '&video_id=' + target.getAttribute('data-id') +
        '&playlist_id=' + target.getAttribute('data-plid');
    var xhr = new XMLHttpRequest();
    xhr.responseType = 'json';
    xhr.timeout = 10000;
    xhr.open('POST', url, true);
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
            if (xhr.status != 200) {
                tile.style.display = '';
            }
        }
    }

    xhr.send('csrf_token=' + playlist_data.csrf_token);
}

function remove_playlist_item(target) {
    var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode;
    tile.style.display = 'none';

    var url = '/playlist_ajax?action_remove_video=1&redirect=false' +
        '&set_video_id=' + target.getAttribute('data-index') +
        '&playlist_id=' + target.getAttribute('data-plid');
    var xhr = new XMLHttpRequest();
    xhr.responseType = 'json';
    xhr.timeout = 10000;
    xhr.open('POST', url, true);
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
            if (xhr.status != 200) {
                tile.style.display = '';
            }
        }
    }

    xhr.send('csrf_token=' + playlist_data.csrf_token);
}
'/invidious/commit/src/invidious/views/watch.ecr?id=8125ddca06c57898f7615eca55ee2a5979150bdd&follow=1'>Replace inline styling for download widget with css filejt404 2023-10-10alpine v3.18 & Update Helm release postgresql (#4103)xbdm Co-authored-by: Samantaz Fox <coding@samantaz.fr> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> 2023-10-09Get "author_verified" using the instance method instead of using the info hash.RadoslavL Co-authored-by: Samantaz Fox <coding@samantaz.fr> 2023-10-08Captions: Use 'fmt=vtt' instead of 'format=vtt'Samantaz Fox 2023-10-07Update translation filesHosted Weblate Updated by "Squash Git commits" hook in Weblate. Translation: Invidious/Invidious Translations Translate-URL: https://hosted.weblate.org/projects/invidious/translations/ 2023-10-07Update Norwegian Bokmål translationHosted Weblate Co-authored-by: Petter Reinholdtsen <pere-weblate@hungry.com> 2023-10-07Update Serbian (cyrillic) translationHosted Weblate Co-authored-by: NEXI <nexiphotographer@gmail.com> 2023-10-07Update Chinese (Simplified) translationHosted Weblate Co-authored-by: Eric <hamburger2048@users.noreply.hosted.weblate.org> 2023-10-07Update Chinese (Traditional) translationHosted Weblate Co-authored-by: Jeff Huang <s8321414@gmail.com> 2023-10-07Update Slovenian translationHosted Weblate Co-authored-by: Damjan Gerl <damjan@damjan.net> 2023-10-07Update Korean translationHosted Weblate Co-authored-by: xrfmkrh <rF3nMd7sRKezjF2vcEQo@protonmail.com> 2023-10-07Update Albanian translationHosted Weblate Co-authored-by: Besnik Bleta <besnik@programeshqip.org> Co-authored-by: Hosted Weblate <hosted@weblate.org> Co-authored-by: Radoslav Lelchev <rlelchev@abv.bg> Translate-URL: https://hosted.weblate.org/projects/invidious/translations/ Translation: Invidious/Invidious Translations 2023-10-07Update Serbian translationHosted Weblate Co-authored-by: NEXI <nexiphotographer@gmail.com> 2023-10-07Update French translationHosted Weblate Update French translation Update French translation Co-authored-by: Samantaz Fox <translator-weblate@samantaz.fr> 2023-10-07Update Spanish translationHosted Weblate Update Spanish translation Co-authored-by: Jorge Maldonado Ventura <jorgesumle@freakspot.net> Co-authored-by: gallegonovato <fran-carro@hotmail.es> 2023-10-07Update Indonesian translationHosted Weblate Co-authored-by: Reza Almanda <rezaalmanda27@gmail.com> 2023-10-07Update Arabic translationHosted Weblate Co-authored-by: Rex_sa <rex.sa@pm.me> 2023-10-07Update Italian translationHosted Weblate Co-authored-by: Random <random-r@users.noreply.hosted.weblate.org> 2023-10-07Update Polish translationHosted Weblate Co-authored-by: Matthaiks <kitynska@gmail.com> 2023-10-07Update Croatian translationHosted Weblate Co-authored-by: Milo Ivir <mail@milotype.de> 2023-10-07Update Czech translationHosted Weblate Co-authored-by: Fjuro <ifjuro@proton.me> 2023-10-07Update Catalan translationHosted Weblate Co-authored-by: victor dargallo <victordargallo@disroot.org> 2023-10-07Update Japanese translationHosted Weblate Co-authored-by: maboroshin <maboroshin@users.noreply.hosted.weblate.org> 2023-10-07Update Ukrainian translationHosted Weblate Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>