PeertubeInfo/templates/index.html

87 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2020-04-12 15:48:58 +00:00
{% extends "base.html" %}
{% block container %}
<table id="tableSeances" class="table table-striped table-hover"></table>
{% endblock %}
{% block scripts %}
<script>
function getFilms(callback){
$("#tableSeances").DataTable( {
"ajax": {
"url": "{{ url_for('get_videos') }}",
"dataSrc": ""
},
"order": [[ 2, "desc" ]],
2020-04-12 15:48:58 +00:00
"columns": [
{ "data": "name" },
{ "data": "views" },
{ "data": "created_at" },
],
"columnDefs": [{
"targets": 0,
"title": "Titre",
"data": "name",
"render": function (data, type, row, meta) {
return '<a href="' + gen_link_video(row['uuid']) + '">' + data + '</a>';
}},
{
"targets": 1,
"title": "Vues",
"data": "views",
"render": function (data, type, row, meta) {
return data;
}},
{
"targets": 2,
"title": "Date upload",
"data": "created_at",
"render": function (data, type, row, meta) {
return hr_date(data);
2020-04-17 04:24:59 +00:00
}},
{
"targets": 3,
"title": "id",
"data": "uuid",
"render": function (data, type, row, meta) {
return data;
2020-04-12 15:48:58 +00:00
}}
]
});
callback();
}
function gen_link_video(uuid){
2020-04-12 17:21:45 +00:00
return 'https://cinematheque.tube/videos/watch/' + uuid;
2020-04-12 15:48:58 +00:00
}
function gen_iframe(name, embed_path){
iframe = '<iframe allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups" src="https://cinematheque.tube' + embed_path + '?title=0&amp;warningTitle=0" title="' + name + '" frameborder="0"></iframe>';
return escapeHtml(iframe);
}
function hr_date(datetz){
var date = new Date(datetz).toLocaleString('en-US');
2020-04-12 15:48:58 +00:00
return date;
};
function escapeHtml(text) {
var map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;'
};
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}
$( document ).ready(function() {
getFilms();
});
</script>
{% endblock %}