-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
187 lines (165 loc) · 10.7 KB
/
index.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<!-- Main app CSS -->
<link href="css/main.css" rel="stylesheet">
<title>Youtube Search App</title>
</head>
<body>
<div class="container">
<!-- Welcome panel -->
<div class="card card-body">
<h5 class="card-title">Bem vindo ao Youtube Search App</h5>
<h6 class="card-subtitle mb-2 text-muted">Informe sua chave do Google e um termo de pesquisa!</h6>
<form class="row" data-bind="submit: doSearch" novalidate>
<div class="col-6">
<label class="form-label" for="txfKeyGoogle">Chave Google</label>
<input type="text" data-bind="value: googleKey, disable: isSearching() || exampleEnabled()" name="txfKeyGoogle" id="txfKeyGoogle" class="form-control" placeholder="Chave API Google">
</div>
<div class="col-6">
<label class="form-label" for="txfSearchTerm">Termo de pesquisa</label>
<input type="text" class="form-control" data-bind="value: searchTerm, disable: isSearching() || exampleEnabled()" name="txfSearchTerm" id="txfSearchTerm" placeholder="Termo de pesquisa">
</div>
<div class="col-12">
<div class="form-check mt-3">
<input class="form-check-input" type="checkbox" id="flexCheckDefault" data-bind="checked: exampleEnabled">
<label class="form-check-label" for="flexCheckDefault">
Caso de exemplo proposto
</label>
</div>
</div>
<div class="col-12 mt-3">
<button class="btn btn-primary" type="submit" data-bind="disable: isSearching()">Pesquisar</button>
<button class="btn btn-secondary" type="button" data-bind="click: doLimpar, disable: isSearching()">Limpar</button>
</div>
<div class="col-12 mt-3" data-bind="visible: errorMsg() !== ''">
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Oops!</strong> <span data-bind="text: errorMsg"></span>
<button type="button" class="btn-close" data-bind="click: closeOops" aria-label="Close"></button>
</div>
</div>
</form>
</div>
<!-- Results panel -->
<div class="card card-body" data-bind="visible: showResultPanel() && !exampleEnabled()">
<h5 class="card-title">Resultado da pesquisa:
<span data-bind="text: totalResults"></span> vídeo(s) encontrados!
</h5>
<h6 class="card-subtitle mb-2 text-muted">Serão considerados apenas os 200 primeiros vídeos!</h6>
<div class="accordion" id="accordionExample">
<!-- ko foreach: resultItems -->
<div class="accordion-item">
<h2 class="accordion-header" data-bind="attr: {'id': 'headingOne' + $index()}">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" aria-expanded="false" data-bind="attr: {'data-bs-target': '#collapseOne' + $index(), 'aria-controls': 'collapseOne' + $index()}">
<span data-bind="html: snippet.title"></span>
</button>
</h2>
<div data-bind="attr: {'id': 'collapseOne' + $index()}" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
<div class="accordion-body">
<p><b>Descrição:</b> <span data-bind="text: snippet.description"></span></p>
<p><b>Canal:</b> <span data-bind="text: snippet.channelTitle"></span></p>
<p><b>Data da publicação:</b> <span data-bind="text: snippet.publishedAt"></span></p>
<p><b>Duração:</b> <span data-bind="text: duration"></span></p>
</div>
</div>
</div>
<!-- /ko -->
</div>
<nav aria-label="Page navigation" class=" mt-3" data-bind="visible: showPagination">
<ul class="pagination">
<li class="page-item" data-bind="css: {'disabled': currentPage() === 1}">
<button type="button" class="page-link" data-bind="click: prevPage, attr: {'aria-disabled': currentPage() === 1? 'true' : 'false'}">Previous</button>
</li>
<!-- ko foreach: pages -->
<li class="page-item" aria-current="page" data-bind="css: {'active': $data === $root.currentPage()}">
<button class="page-link" type="button" data-bind="click: $root.goToPage, text: $data"></button>
</li>
<!-- /ko -->
<li class="page-item" data-bind="css: {'disabled': currentPage() === maxPages()}">
<button type="button" class="page-link" data-bind="click: nextPage, attr: {'aria-disabled': currentPage() === maxPages()? 'true' : 'false'}">Next</button>
</li>
</ul>
</nav>
<small class="card-text text-muted mt-3">Clique no título do vídeo para expandir.</small>
</div>
<!-- Stats panel -->
<div class="card card-body" data-bind="visible: showResultPanel">
<h5 class="card-title">Análises a partir dos resultados</h5>
<h6 class="card-subtitle mb-2 text-muted">Top 5 palavras mais frequentes e dias necessários para assistir a todos os vídeos!</h6>
<div data-bind="visible: !exampleEnabled()">
<p>Top 5 palavras que mais se repetem</p>
<p>
<!-- ko foreach: wordsResult -->
- <b>Palavra:</b> <span data-bind="text: palavra"></span> - <b>Total:</b> <span data-bind="text: total"></span><br>
<!-- /ko -->
</p>
</div>
<div class="alert alert-primary" role="alert">
Tempo total dos vídeos: <span data-bind="text: totalDurationResuls"></span>
</div>
<hr>
<p class="text-muted">Tempo disponível por dia (em minutos), informe para cada dia</p>
<form class="row" data-bind="submit: doUpdateTime" novalidate>
<div class="col-1">
<label class="form-label" for="txfMinAvSun">Domingo</label>
<input id="txfMinAvSun" name="txfMinAvSun" type="text" data-bind="value: minAvSun" class="form-control" placeholder="15">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvMon">Segunda</label>
<input id="txfMinAvMon" name="txfMinAvMon" type="text" data-bind="value: minAvMon" class="form-control" placeholder="120">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvTue">Terça</label>
<input id="txfMinAvTue" name="txfMinAvTue" type="text" data-bind="value: minAvTue" class="form-control" placeholder="30">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvWed">Quarta</label>
<input id="txfMinAvWed" name="txfMinAvWed" type="text" data-bind="value: minAvWed" class="form-control" placeholder="150">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvThu">Quinta</label>
<input id="txfMinAvThu" name="txfMinAvThu" type="text" data-bind="value: minAvThu" class="form-control" placeholder="20">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvFri">Sexta</label>
<input id="txfMinAvFri" name="txfMinAvFri" type="text" data-bind="value: minAvFri" class="form-control" placeholder="40">
</div>
<div class="col-1">
<label class="form-label" for="txfMinAvSat">Sábado</label>
<input id="txfMinAvSat" name="txfMinAvSat" type="text" data-bind="value: minAvSat" class="form-control" placeholder="90">
</div>
<div class="col-12 mt-3">
<button class="btn btn-primary" type="submit">Calcular</button>
</div>
<div class="col-12 mt-3" data-bind="visible: updateErrorMsg() !== ''">
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Oops!</strong> <span data-bind="text: updateErrorMsg"></span>
<button type="button" class="btn-close" data-bind="click: closeUpdateMsg" aria-label="Close"></button>
</div>
</div>
</form>
<div class="alert alert-success mt-3" role="alert" data-bind="visible: numDays() !== '' && parseInt(numDays()) > 0">
Dias necessários para assistir todos os vídeos do resultado: <b><span data-bind="text: numDays"></span> dias.</b>
</div>
</div>
</div>
<!-- Popper and Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js" integrity="sha384-q2kxQ16AaE6UbzuKqyBE9/u/KzioAlnx2maXQHiDX9d4/zp8Ok3f+M7DPm+Ib6IU" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.min.js" integrity="sha384-pQQkAEnwaBkjpqZ8RU1fF1AKtTcHJwFl3pblpTlHXybJjHpMYo79HY3hIi4NKxyj" crossorigin="anonymous"></script>
<!-- KnockoutJS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/knockout.mapping@2.4.3/knockout.mapping.min.js"></script>
<!-- Sweet alert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<!-- Own scripts -->
<script src="js/functions.js"></script>
<script src="js/urls.js"></script>
<script src="js/ajax.js"></script>
<script src="mvvm/index.js"></script>
</body>
</html>