diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/css/darktheme.css | 7 | ||||
| -rw-r--r-- | assets/js/embed.js | 6 | ||||
| -rw-r--r-- | assets/js/playlist_widget.js | 47 | ||||
| -rw-r--r-- | assets/js/watch.js | 6 |
4 files changed, 60 insertions, 6 deletions
diff --git a/assets/css/darktheme.css b/assets/css/darktheme.css index 1b70956b..92da15b6 100644 --- a/assets/css/darktheme.css +++ b/assets/css/darktheme.css @@ -21,10 +21,9 @@ body { color: #f0f0f0; } -.pure-form > fieldset > input, -.pure-control-group > input, -.pure-form > fieldset > select, -.pure-control-group > select { +input, +select, +textarea { color: rgba(35, 35, 35, 1); } diff --git a/assets/js/embed.js b/assets/js/embed.js index d9af1f5b..074a9d8d 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -12,7 +12,8 @@ function get_playlist(plid, retries) { '&format=html&hl=' + video_data.preferences.locale; } else { var plid_url = '/api/v1/playlists/' + plid + - '?continuation=' + video_data.id + + '?index=' + video_data.index + + '&continuation' + video_data.id + '&format=html&hl=' + video_data.preferences.locale; } @@ -45,6 +46,9 @@ function get_playlist(plid, retries) { } url.searchParams.set('list', plid); + if (!plid.startsWith('RD')) { + url.searchParams.set('index', xhr.response.index); + } location.assign(url.pathname + url.search); }); } diff --git a/assets/js/playlist_widget.js b/assets/js/playlist_widget.js new file mode 100644 index 00000000..5d6ddf87 --- /dev/null +++ b/assets/js/playlist_widget.js @@ -0,0 +1,47 @@ +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); +}
\ No newline at end of file diff --git a/assets/js/watch.js b/assets/js/watch.js index 0f3e8123..80cb1769 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -133,7 +133,8 @@ function get_playlist(plid, retries) { '&format=html&hl=' + video_data.preferences.locale; } else { var plid_url = '/api/v1/playlists/' + plid + - '?continuation=' + video_data.id + + '?index=' + video_data.index + + '&continuation=' + video_data.id + '&format=html&hl=' + video_data.preferences.locale; } @@ -168,6 +169,9 @@ function get_playlist(plid, retries) { } url.searchParams.set('list', plid); + if (!plid.startsWith('RD')) { + url.searchParams.set('index', xhr.response.index); + } location.assign(url.pathname + url.search); }); } |
