2016-11-29 04:16:16 +00:00
|
|
|
<!DOCTYPE html5>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{% import "header.html" as header %}
|
|
|
|
<title>Channels</title>
|
|
|
|
<meta charset="UTF-8">
|
2020-01-07 05:55:01 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
2020-05-22 02:43:45 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/common.css">
|
2020-09-03 18:52:51 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/ycdl.css">
|
2020-05-22 02:43:45 +00:00
|
|
|
<script src="/static/js/common.js"></script>
|
2020-06-17 21:13:33 +00:00
|
|
|
<script src="/static/js/api.js"></script>
|
2020-06-17 21:15:50 +00:00
|
|
|
<script src="/static/js/spinner.js"></script>
|
2016-11-29 04:16:16 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
#content_body
|
|
|
|
{
|
2020-09-03 18:52:51 +00:00
|
|
|
grid-gap: unset;
|
2016-11-29 04:16:16 +00:00
|
|
|
}
|
|
|
|
#new_channel_textbox,
|
|
|
|
#new_channel_button
|
|
|
|
{
|
|
|
|
width: 200px;
|
|
|
|
}
|
2020-05-22 00:22:07 +00:00
|
|
|
.channel_card_no_pending,
|
2016-11-29 04:16:16 +00:00
|
|
|
.channel_card_pending
|
|
|
|
{
|
2020-09-03 18:52:51 +00:00
|
|
|
margin: 8px 0;
|
2016-11-29 04:16:16 +00:00
|
|
|
padding: 10px;
|
|
|
|
border-radius: 4px;
|
|
|
|
border: 1px solid #000;
|
|
|
|
}
|
|
|
|
.channel_card_pending
|
|
|
|
{
|
|
|
|
background-color: #ffffaa;
|
|
|
|
}
|
2020-05-22 00:22:07 +00:00
|
|
|
.channel_card_no_pending
|
2016-11-29 04:16:16 +00:00
|
|
|
{
|
|
|
|
background-color: #aaffaa;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
{{header.make_header()}}
|
|
|
|
<div id="content_body">
|
2020-09-04 17:37:49 +00:00
|
|
|
<div><button class="refresh_button button_with_spinner" onclick="return refresh_all_channels_form(false);">Refresh new videos</button></div>
|
|
|
|
<div><button class="refresh_button button_with_spinner" onclick="return refresh_all_channels_form(true);">Refresh everything</button></div>
|
2016-11-29 04:16:16 +00:00
|
|
|
<div>
|
2020-09-03 18:44:49 +00:00
|
|
|
<input type="text" id="new_channel_textbox" placeholder="Channel id">
|
2020-09-04 17:37:49 +00:00
|
|
|
<button id="new_channel_button" class="button_with_spinner" onclick="return add_channel_form();">Add new channel</button>
|
2016-11-29 04:16:16 +00:00
|
|
|
</div>
|
2020-09-03 18:52:51 +00:00
|
|
|
|
|
|
|
<div id="channels">
|
2016-11-29 04:16:16 +00:00
|
|
|
{% for channel in channels %}
|
2020-04-04 22:13:01 +00:00
|
|
|
{% if channel.has_pending() %}
|
2016-11-29 04:16:16 +00:00
|
|
|
<div class="channel_card_pending">
|
|
|
|
{% else %}
|
2020-05-22 00:22:07 +00:00
|
|
|
<div class="channel_card_no_pending">
|
2016-11-29 04:16:16 +00:00
|
|
|
{% endif %}
|
2020-04-04 22:13:01 +00:00
|
|
|
<a href="/channel/{{channel.id}}">{{channel.name}}</a> <a href="/channel/{{channel.id}}/pending">(p)</a>
|
2020-05-22 00:26:12 +00:00
|
|
|
{% if channel.automark not in [none, "pending"] %}
|
|
|
|
<span>automark: {{channel.automark}}</span>
|
|
|
|
{% endif %}
|
2016-11-29 04:16:16 +00:00
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2020-09-03 18:52:51 +00:00
|
|
|
</div>
|
2016-11-29 04:16:16 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var box = document.getElementById('new_channel_textbox');
|
|
|
|
var button = document.getElementById('new_channel_button');
|
2020-04-04 22:13:01 +00:00
|
|
|
common.bind_box_to_button(box, button);
|
2016-11-29 04:16:16 +00:00
|
|
|
|
2020-08-20 22:09:37 +00:00
|
|
|
function add_channel_form()
|
2016-11-29 04:16:16 +00:00
|
|
|
{
|
2020-09-04 18:24:08 +00:00
|
|
|
if (box.value === "")
|
2016-11-29 04:16:16 +00:00
|
|
|
{
|
2020-09-04 18:24:08 +00:00
|
|
|
return spinner.BAIL;
|
2016-11-29 04:16:16 +00:00
|
|
|
}
|
2020-09-04 18:24:08 +00:00
|
|
|
api.channels.add_channel(box.value, add_channel_callback);
|
2016-11-29 04:16:16 +00:00
|
|
|
}
|
2020-05-22 03:37:34 +00:00
|
|
|
function add_channel_callback(response)
|
2016-11-29 04:16:16 +00:00
|
|
|
{
|
2020-06-28 23:57:32 +00:00
|
|
|
if (response.meta.status == 200)
|
2020-05-22 03:37:34 +00:00
|
|
|
{
|
2020-06-28 23:57:32 +00:00
|
|
|
window.location.href = "/channel/" + response.data.id;
|
2020-05-22 03:37:34 +00:00
|
|
|
}
|
2020-06-17 21:15:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function refresh_all_channels_form(force)
|
|
|
|
{
|
|
|
|
console.log(`Refreshing all channels, force=${force}.`);
|
|
|
|
api.channels.refresh_all_channels(force, refresh_all_channels_callback)
|
|
|
|
}
|
|
|
|
function refresh_all_channels_callback(response)
|
|
|
|
{
|
2020-06-28 23:57:32 +00:00
|
|
|
if (response.meta.status == 200)
|
2020-06-17 21:15:50 +00:00
|
|
|
{
|
|
|
|
common.refresh();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
}
|
2020-05-22 03:37:34 +00:00
|
|
|
}
|
2016-11-29 04:16:16 +00:00
|
|
|
</script>
|
|
|
|
</html>
|