Files
go2rtc/www/devices.html
T
2022-08-26 10:43:35 +03:00

82 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>go2rtc</title>
<style>
table {
background-color: white;
text-align: left;
border-collapse: collapse;
}
table td, table th {
border: 1px solid black;
padding: 5px 5px;
}
table tbody td {
font-size: 13px;
}
table thead {
background: #CFCFCF;
background: linear-gradient(to bottom, #dbdbdb 0%, #d3d3d3 66%, #CFCFCF 100%);
border-bottom: 3px solid black;
}
table thead th {
font-size: 15px;
font-weight: bold;
color: black;
text-align: center;
}
.header {
padding: 5px 5px;
}
</style>
</head>
<body>
<div class="header">
<input id="src" type="text" placeholder="url">
<a id="add" href="#">add</a>
</div>
<table id="devices">
<thead>
<tr>
<th>Kind</th>
<th>Name</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
const baseUrl = location.origin + location.pathname.substr(
0, location.pathname.lastIndexOf("/")
);
function reload() {
fetch(`${baseUrl}/api/devices`).then(r => {
r.json().then(data => {
let html = '';
data.forEach(function (item) {
html += `<tr><td>${item.kind}</td><td>${item.title}</td></tr>`;
})
let content = document.getElementById('devices').getElementsByTagName('tbody')[0];
content.innerHTML = html
});
})
}
reload();
</script>
</body>
</html>