forked from dave-p/TVHadmin-JS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.html
108 lines (108 loc) · 3.81 KB
/
search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="TVHadmin">
<link rel="manifest" href="manifest.webmanifest" crossorigin="use-credentials">
<title>TVHadmin - Search</title>
<script src="include.js"></script>
</head>
<body>
<div id="container">
<div id="navigation">
<div class="logo">
<img src="images/logo.png" alt="TVHeadend Logo" width="150">
</div>
<div class="nav_bar">
<div class="navi"><a href="now.html">What's On Now</a></div>
<div class="navi"><a href="timeline.html">Timeline</a></div>
<div class="navi"><a href="channels.html">Channels</a></div>
<div class="navi"><a href="favourites.html">Favourite Channels</a></div>
<div class="navi"><a href="timers.html">Timers</a></div>
<div class="navi"><a href="recordings.html">Recordings</a></div>
<div class="navi"><a href="links.html">Series Links</a></div>
<div class="navi"><a href="status.html">Status</a></div>
<div class="navi"><a href="config.html">Configuration</a></div>
<form action="search.html" method="GET" name="search" class="search" onsubmit="return checkForm()">
<input type="text" name="find"><br>
<input type="submit" name="submit" value="Search">
</form>
</div>
</div>
<div id='layout'>
<div id='banner'>
<table>
<tr>
<td class='col_title'><div id='mobmenu'>☰</div><div id='title'></div></td>
</tr>
</table>
</div>
<div id='wrapper'>
<div id='content'>
</div>
</div>
</div>
</div>
<script>
async function main() {
const params = new URLSearchParams(window.location.search);
var needle = params.get('find');
if (needle == "") return;
var links = await get_links();
var slinks = []
links.forEach(function(l) {
slinks[l["serieslink"]] = 1;
});
var title = document.getElementById("title");
title.innerHTML = `<h1>Search Results for "${needle}"</h1>`;
var table = document.createElement("TABLE");
table.className = 'list';
var last_date = ' ';
var results = await search_epg("", needle);
for (e of results) {
let d = strftime("%A %d/%n", e.start);
if (d != last_date) {
row = table.insertRow(-1);
row.className = 'newday';
row.innerHTML = `<td colspan='5'><span class='date_long'>${d}</span></td>`;
last_date = d;
}
row = table.insertRow(-1);
row.className = 'row_alt';
let start = strftime("%H:%M", e.start);
let stop = strftime("%H:%M", e.stop);
let desc = '';
if (e.summary) desc = e.summary;
else if (e.description) desc = e.description;
let s = `<td class='col_duration'><span class='time_duration'>${start} - ${stop}</span></td>` +
`<td class='col_channel'><div class='channel_name'>${e.channelName}</div></td>` +
`<td class='col_title'>` +
`<div class='epg_title'>${e.title}</div>` +
`<div class='epg_subtitle'>${desc}</div></td>`;
if (e.dvrState == 'scheduled' || e.dvrState == 'recording') {
if (slinks[e.serieslinkUri]) {
s += "<td></td><td><img src='images/rec.png' title='Series recording scheduled'></td>";
}
else {
s += "<td><img src='images/rec.png' title='Recording scheduled'></td>";
}
}
else {
s += `<td><a href='search.html' onclick='create_by_event(event, "${e.eventId}", this)'><img src='images/rec_button1.png' title='record'></a></td>`;
if (e.serieslinkUri) {
s += `<td><a href='search.html' onclick='create_by_series(event, "${e.eventId}", this)'><img src='images/rec_buttonS.png' title='record series'></a></td>`;
}
else {
s += "<td></td>";
}
}
row.innerHTML = s;
}
var content = document.getElementById("content");
content.appendChild(table);
}
main();
</script>
</body>
</html>