Faizan15 commited on
Commit
424219c
1 Parent(s): 322c296

Create search.html

Browse files
Files changed (1) hide show
  1. search.html +324 -0
search.html ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <link rel="icon" href="/data/favicon.ico" type="image/vnd.microsoft.icon">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>Sentiment Analyzer</title>
9
+ <style>
10
+ @font-face {
11
+ font-family: 'HPSimplified';
12
+ src: url('/data/HPSimplified.ttf') format('truetype');
13
+ font-weight: normal;
14
+ font-style: normal;
15
+ }
16
+ ::-webkit-scrollbar {
17
+ width: 0.6vw;
18
+ }
19
+ ::-webkit-scrollbar-track {
20
+ background: #0000;
21
+ }
22
+ ::-webkit-scrollbar-thumb {
23
+ background: #eee;
24
+ border-radius: 0.5vw;
25
+ }
26
+ ::-webkit-scrollbar-thumb:hover {
27
+ background: #999;
28
+ }
29
+ body {
30
+ font-family: Arial, sans-serif;
31
+ background-size: cover;
32
+ background-attachment: fixed;
33
+ background-color: #000;
34
+ margin: 0;
35
+ padding: 0;
36
+ overflow: hidden;
37
+ font-family: 'HPSimplified';
38
+ color: white;
39
+ }
40
+ .bg {
41
+ position: fixed;
42
+ bottom: 0;
43
+ left: 50%;
44
+ transform: translate(-50%);
45
+ height: 100vh;
46
+ width: 100vw;
47
+ z-index: -1;
48
+ opacity: 0.2;
49
+ object-fit: cover;
50
+ }
51
+ a {
52
+ text-decoration: none;
53
+ color: white;
54
+ }
55
+ .header {
56
+ background-color: #111b;
57
+ border-bottom: white solid 0.4vh;
58
+ height: 10vh;
59
+ padding: 2vh;
60
+ text-align: left;
61
+ display: flex;
62
+ font-size: 6vh;
63
+ font-weight: bold;
64
+ }
65
+ .header > span {
66
+ margin: auto 0;
67
+ }
68
+ .header > span:hover {
69
+ text-decoration: underline;
70
+ }
71
+ #search-form {
72
+ display: block;
73
+ right: 0;
74
+ position: absolute;
75
+ margin: auto 1vw;
76
+ }
77
+ #search-form > input {
78
+ width: 30vw;
79
+ border: initial;
80
+ background-color: #000;
81
+ color:white;
82
+ height: 6vh;
83
+ font-size: 2vh;
84
+ border-radius: 0.5vw;
85
+ margin-right: 1vh;
86
+ padding-left: 2vh;
87
+ }
88
+ #search-form > button {
89
+ height: 6vh;
90
+ font-size: 2vh;
91
+ width: 11vh;
92
+ border: initial;
93
+ border-radius: 0.5vw;
94
+ background-color: #000;
95
+ color: white;
96
+ }
97
+
98
+ #search-form > input:hover {
99
+ background-color: #111;
100
+ }
101
+
102
+ #search-form > button:hover {
103
+ background-color: #111;
104
+ cursor: pointer;
105
+ }
106
+ input, button {
107
+ font-family: 'HPSimplified';
108
+ }
109
+ #search-results {
110
+ overflow-y: scroll;
111
+ overflow-wrap: break-word;
112
+ max-height: 70vh;
113
+ width: 90vw;
114
+ background-color: #222;
115
+ padding: 1vw;
116
+ position: relative;
117
+ margin-top: 3vh;
118
+ left: 50%;
119
+ transform: translate(-50%);
120
+ border-radius: 1vw;
121
+ }
122
+ ul {
123
+ padding: 0%;
124
+ }
125
+ .search-list {
126
+ list-style-type: none;
127
+ background-color: #000;
128
+ padding: 10px;
129
+ border-radius: 5px;
130
+ margin-bottom: 10px;
131
+ cursor: pointer;
132
+ }
133
+ .search-list:hover {
134
+ background-color: #111;
135
+ }
136
+ #no-links-form {
137
+ display: none;
138
+ text-align: center;
139
+ padding: 20px;
140
+ border-radius: 5px;
141
+ margin-top: 20px;
142
+ }
143
+ #no-links-form > label {
144
+ color: white;
145
+ margin-right: 10px;
146
+ }
147
+ #no-links-form > input {
148
+ width: 60%;
149
+ padding: 10px;
150
+ border: none;
151
+ border-radius: 5px;
152
+ background-color: #222;
153
+ color: white;
154
+ margin: 10px;
155
+ }
156
+ #no-links-form > input:hover {
157
+ background-color: #111;
158
+ }
159
+ #no-links-form > button {
160
+ padding: 10px 20px;
161
+ border: none;
162
+ border-radius: 5px;
163
+ background-color: #222;
164
+ color: white;
165
+ cursor: pointer;
166
+ margin: 10px;
167
+ }
168
+ #no-links-form > button:hover {
169
+ background-color: #111;
170
+ }
171
+ .logo{
172
+ position: fixed;
173
+ bottom: 0;
174
+ right: 0;
175
+ width: -moz-fit-content;
176
+ width: fit-content;
177
+ margin: 1vw;
178
+ font-size: 0.5em
179
+ }
180
+ .logo > img {
181
+ height: 4.53vh;
182
+ }
183
+ #loading {
184
+ position: fixed;
185
+ top: 0;
186
+ left: 0;
187
+ height: 100vh;
188
+ width: 100vw;
189
+ background-color: #000a;
190
+ backdrop-filter: blur(8px);
191
+ -webkit-backdrop-filter: blur(8px);
192
+ z-index: 2;
193
+ display: none;
194
+ }
195
+ #loading > img {
196
+ position: absolute;
197
+ top: 50%;
198
+ left: 50%;
199
+ transform: translate(-50%, -50%);
200
+ max-height: 90vh;
201
+ max-width: 90vw;
202
+ z-index: 3;
203
+ }
204
+ @media screen and (orientation: portrait) {
205
+ .header {
206
+ font-size: 10vw;
207
+ text-align: center;
208
+ display: block;
209
+ height: 25vw;
210
+ }
211
+ #search-form {
212
+ position: relative;
213
+ margin: auto;
214
+ }
215
+ #search-form > input {
216
+ width: 40vw;
217
+ height: 8vw;
218
+ font-size: 2.67vw;
219
+ }
220
+ #search-form > button {
221
+ height: 8vw;
222
+ width: 16vw;
223
+ font-size: 2.67vw;
224
+ }
225
+ main {
226
+ font-size: 3vw;
227
+ }
228
+ #search-results {
229
+ margin-top: 3vw;
230
+ max-height: calc(93vh - 25vw - 4vw - 5vw);
231
+ }
232
+ .search-list {
233
+ padding: 2vw;
234
+ border-radius: 1vw;
235
+ margin-bottom: 2vw;
236
+ }
237
+ .logo > img {
238
+ height: 5vw;
239
+ }
240
+ #no-links-form > input {
241
+ padding: 2vw;
242
+ border-radius: 1vw;
243
+ margin: 2vw;
244
+ font-size: 3.8vw;
245
+ }
246
+ #no-links-form > button {
247
+ padding: 2vw 4vw;
248
+ border-radius: 1vw;
249
+ margin: 2vw;
250
+ font-size: 3.8vw;
251
+ }
252
+ }
253
+ </style>
254
+ </head>
255
+ <body>
256
+ <img src="../data/bg.png" class="bg">
257
+ <div class="header">
258
+ <span><a href="/">Sentiment Analyzer</a></span>
259
+ <form id="search-form">
260
+ <input type="text" id="search-input" name="search-input" required placeholder="Search for a Movie/Show">
261
+ <button type="submit">Search</button>
262
+ </form>
263
+ </div>
264
+ <main>
265
+ <div id="search-results"></div>
266
+ <form id="no-links-form" onsubmit="submitManualLink(event)">
267
+ <label for="manual-link">{{Err}}, please enter the link to main page of movie from rotten tomatoes manually:</label><br>
268
+ <input type="text" id="manual-link" name="manual-link" required>
269
+ <button type="submit">Submit</button>
270
+ </form>
271
+ <a href="https://www.rottentomatoes.com">
272
+ <div class="logo">
273
+ <span>Powered by: </span> <img src="https://images.fandango.com/cms/assets/2d5a3340-be84-11ed-9d20-83ee649e98bd--rt25-logo-mainnav-161x50.svg" alt="Rotten tomatoes logo">
274
+ </div>
275
+ </a>
276
+ </main>
277
+ <div id="loading">
278
+ <img src="">
279
+ </div>
280
+
281
+ <script>
282
+ document.onload = load()
283
+ function load(){
284
+ const query = new URLSearchParams(window.location.search).get('query')
285
+ const links = {{ links|tojson|safe }};
286
+ if (links.length === 0) {
287
+ document.getElementById('no-links-form').style.display = 'block';
288
+ document.getElementById('search-results').style.display = 'none';
289
+ } else {
290
+ const linksString = links.map(obj => Object.entries(obj).map(([key, value]) => `<a href="/review?url=${encodeURIComponent(value)}"><li class="search-list"><span style="font-size:1.5em">${key}</span><br><span style="color:#2168ff" class="url">${value}</span></li>`).join('')).join('')
291
+ const msg = "<span style='font-size: 1.5em'>Please select the correct link from search results: </span><br>"
292
+ const finalString = msg+`<ul>${linksString}</ul>`
293
+ document.getElementById('search-results').innerHTML = finalString;
294
+ }
295
+ }
296
+ document.querySelectorAll('.search-list').forEach(list => {
297
+ list.addEventListener('click', ()=>{
298
+ document.querySelector('#loading > img').src = "../data/search.gif"
299
+ document.getElementById('loading').style.display = 'block';
300
+ })
301
+ })
302
+ document.getElementById('search-form').addEventListener('submit', (event) => {
303
+ event.preventDefault();
304
+ let query = document.getElementById('search-input').value;
305
+ let redirectURL = '/search?query=' + encodeURIComponent(query);
306
+ window.location.href = redirectURL;
307
+ });
308
+ function submitManualLink(event) {
309
+ event.preventDefault()
310
+ document.querySelector('#loading > img').src = "../data/search.gif"
311
+ document.getElementById('loading').style.display = 'block';
312
+ const manualLink = document.getElementById('manual-link').value;
313
+ if (manualLink.trim() !== '') {
314
+ if(!manualLink.startsWith('https://www.rottentomatoes.com/')){
315
+ alert( "Please enter a valid link from rotten tomatoes starting with https://www.rottentomatoes.com/")
316
+ document.getElementById('manualLink').value = ""
317
+ } else {
318
+ window.location.href = '/review?url=' + encodeURIComponent(manualLink);
319
+ }
320
+ }
321
+ }
322
+ </script>
323
+ </body>
324
+ </html>