Move functions mark_state, start_download to api.js.

This commit is contained in:
voussoir 2020-06-03 13:01:53 -07:00
parent d996101152
commit 66f499c232
2 changed files with 22 additions and 20 deletions

View file

@ -41,3 +41,22 @@ function set_automark(channel_id, state, callback)
/**************************************************************************************************/
api.videos = {};
api.videos.mark_state =
function mark_state(video_ids, state, callback)
{
var url = "/mark_video_state";
data = new FormData();
data.append("video_ids", video_ids);
data.append("state", state);
return common.post(url, data, callback);
}
api.videos.start_download =
function start_download(video_ids, callback)
{
var url = "/start_download";
data = new FormData();
data.append("video_ids", video_ids);
return common.post(url, data, callback);
}

View file

@ -220,7 +220,7 @@ https://stackoverflow.com/a/35153397
{% else %}
class="video_action_pending"
{% endif %}
onclick="action_button_passthrough(event, mark_video_state, 'pending')"
onclick="action_button_passthrough(event, api.videos.mark_state, 'pending')"
>Revert to Pending</button>
<button
@ -229,7 +229,7 @@ https://stackoverflow.com/a/35153397
{% else %}
class="video_action_download hidden"
{% endif %}
onclick="action_button_passthrough(event, start_download)"
onclick="action_button_passthrough(event, api.videos.start_download)"
>Download</button>
<button
@ -238,7 +238,7 @@ https://stackoverflow.com/a/35153397
{% else %}
class="video_action_ignore hidden"
{% endif %}
onclick="action_button_passthrough(event, mark_video_state, 'ignored')"
onclick="action_button_passthrough(event, api.videos.mark_state, 'ignored')"
>Ignore</button>
</div>
<div class="embed_toolbox">
@ -483,22 +483,5 @@ function set_automark_hook(event)
{
api.channels.set_automark(CHANNEL_ID, event.target.value);
}
function mark_video_state(video_ids, state, callback)
{
var url = "/mark_video_state";
data = new FormData();
data.append("video_ids", video_ids);
data.append("state", state);
return common.post(url, data, callback);
}
function start_download(video_ids, callback)
{
var url = "/start_download";
data = new FormData();
data.append("video_ids", video_ids);
return common.post(url, data, callback);
}
</script>
</html>