-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
542 lines (513 loc) · 17.1 KB
/
404.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>News</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="NEWS">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js'></script>
<!-- <script src="https://unpkg.com/compromise"></script> -->
<script src="https://fwd.dev/js/vue.js"></script>
<script src="https://fwd.dev/js/axios.js"></script>
<style>
@import url("https://fonts.googleapis.com/css?family=Francois+One|Inconsolata:400,700");
@-webkit-keyframes loading {
0% {
transform: rotate(0);
}
100% {
transform: rotate(359deg);
}
}
@keyframes loading {
0% {
transform: rotate(0);
}
100% {
transform: rotate(359deg);
}
}
* {
box-sizing: border-box;
}
body {
font-family: "Inconsolata", monospace;
background-color: #000;
color: #FFF;
line-height: 1.4;
}
.defs-only {
position: absolute;
width: 0;
height: 0;
}
a {
color: #304FFE;
font-weight: bold;
text-decoration: none;
border-bottom: 1px #304FFE dotted;
}
a:hover {
border-bottom: 1px #304FFE solid;
}
header {
border-bottom: 1px dotted #304FFE;
padding-bottom: 20px;
margin-bottom: 20px;
display: flex;
align-items: center;
}
header h1 {
line-height: 1;
}
header h1 a {
border-bottom: none;
position: relative;
}
header h1 a:after {
content: "";
position: absolute;
height: 100%;
width: 50px;
left: -60px;
top: 0;
background-image: url("../img/icon-2.png");
background-repeat: no-repeat;
background-position: center left;
background-size: contain;
}
header h1 a:hover {
border-bottom: none;
}
h1 {
margin: 0;
text-shadow: 2px 0 0 #F48FB1;
margin-right: 0;
font-size: 48px;
text-align: center;
}
h2 {
text-shadow: 2px 0 0 #F48FB1;
margin-top: 50px;
font-size: 32px;
}
h3 {
font-size: 24px;
}
h1,
h2,
h3 {
font-family: "Francois One";
font-weight: normal;
/*text-transform: uppercase;*/
}
blockquote {
font-size: 1.1em;
border: 1px #304FFE solid;
padding: 20px;
background-color: rgba(48, 79, 254, 0.1);
line-height: 1.2;
}
#page {
max-width: 1200px;
position: relative;
z-index: 99;
margin: 50px auto;
}
@media only screen and (max-width: 1240px) {
#page {
margin: 50px 20px;
}
}
nav.nav {
margin-bottom: 50px;
text-align: right;
}
nav.nav ul {
list-style: none;
margin: 0;
padding: 0;
}
nav.nav ul li {
display: inline-block;
}
p.subtitle {
font-style: italic;
}
#app {
max-width: 768px;
margin: 20px auto;
}
#load-more i {
display: none;
}
#load-more.loading i {
display: inline-block;
-webkit-animation: loading 1s infinite;
animation: loading 1s infinite;
}
#search-filter {
margin-bottom: 35px;
zoom: 1.3;
}
#search-filter a {
border-bottom: none;
border: 2px #304FFE solid;
margin: 3px;
border-radius: 4px;
padding: 5px 10px;
overflow: hidden;
display: inline-block;
vertical-align: middle;
background-color: rgba(48, 79, 254, 0);
}
#search-filter a:hover, #search-filter a.selected {
background-color: #304FFE;
color: #FCE4EC;
}
#search-filter label {
font-family: "Francois One";
text-transform: uppercase;
}
#search-filter > div {
margin: 10px 0;
}
input[type=text],
input[type=search],
input[type=number],
input[type=url],
textarea {
border: 2px #304FFE solid;
border-radius: 3px;
background-color: transparent;
padding: 5px 10px;
font-size: 16px;
color: #304FFE;
font-family: "Inconsolata";
width: 100%;
}
input[type=text],
input[type=number],
input[type=url],
textarea {
width: 100%;
}
select {
border: 2px #304FFE solid;
background-color: transparent;
padding: 5px 10px;
font-size: 16px;
color: #304FFE;
font-family: "Inconsolata";
}
.button,
input[type=submit] {
background-color: #304FFE;
border-radius: 3px;
padding: 5px 10px;
font-size: 20px;
font-family: "Inconsolata";
color: #FCE4EC;
}
.row {
margin: 0;
}
.form-row {
margin-bottom: 1em;
}
.form-row label {
display: block;
font-weight: bold;
}
#add-row {
margin-bottom: 50px;
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
opacity: 0;
pointer-events: none;
background-color: rgba(244, 143, 177, 0.5);
transform: scale(0);
transition: 0.5s;
}
#overlay.show {
opacity: 1;
pointer-events: all;
transform: scale(1);
}
#overlay form {
background-color: #FCE4EC;
padding: 20px;
box-sizing: border-box;
min-width: 300px;
max-width: 768px;
flex-grow: 1;
}
#overlay .close {
position: absolute;
top: 20px;
right: 20px;
color: #304FFE;
border-bottom: none;
font-size: 40px;
}
#overlay h2 {
margin: 0 0 20px;
}
#posts.grid {
display: flex;
flex-wrap: wrap;
}
#posts.grid article {
width: 30%;
margin-right: 5%;
}
#posts.grid article:nth-child(3n+3) {
margin-right: 0;
}
#posts.grid article:after {
top: -10px;
left: -10px;
}
@media only screen and (max-width: 568px) {
#posts.grid article {
width: 45%;
}
#posts.grid article:nth-child(3n+3) {
margin-right: 5%;
}
#posts.grid article:nth-child(2n+2) {
margin-right: 0 !important;
}
}
article {
padding-bottom: 40px;
margin-bottom: 40px;
position: relative;
box-sizing: border-box;
background-color: #15161b;
color: #FCE4EC;
padding: 20px;
padding-bottom: calc(4em + 20px);
cursor: pointer;
}
article.hidden {
display: none;
}
article .tags {
margin-top: 10px;
}
article .tags a {
border-bottom: 2px #F48FB1 solid;
zoom: 1.4;
letter-spacing: 0.3px;
/*background-color: rgb(203, 207, 88);*/
color: #000;
padding: 1px 3px;
}
article .tags a:hover {
border-color: #EC407A;
}
article:after {
content: "";
width: 100%;
height: 100%;
position: absolute;
z-index: -1;
top: -15px;
left: -15px;
background-image: linear-gradient(to bottom left, #a1f48fde, #ffbd00);
}
article h3 {
margin-top: 0;
margin-bottom: 0;
box-shadow: 1px 1px 1px #181e13;
}
article a {
color: #FCE4EC;
}
article .meta {
position: absolute;
width: 100%;
bottom: 0;
left: 0;
border-top: 1px #F48FB1 dotted;
padding: 0 20px 20px;
box-sizing: border-box;
zoom: 1.3;
}
article .meta p {
margin-bottom: 0;
font-size: 14px;
}
article .gallery,
article .slides {
width: 61%;
}
@media only screen and (max-width: 768px) {
article {
flex-wrap: wrap;
}
article .info,
article .gallery,
article .slides {
width: 100%;
}
article .info {
order: 1;
}
article .gallery,
article .slides {
order: 2;
}
}
.sticky {
position: fixed;
z-index: 99;
top: 0;
background: #000;
width: 100%;
left: 0;
padding: 5px 10px;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div id="app">
<h1 @click="query = ''">NEWS</h1>
<form @submit.prevent="check()" id="search-filter" :class="`${sticky ? 'sticky' : ''}`">
<div id="search">
<input type="search" value="" id="s" v-model.lazy="query" placeholder="Search keywords" />
</div>
</form>
<div id="posts">
<article v-for="i in filtered">
<!-- <article v-for="i in filtered" :style="`background-color: ${stringToColour(i.domain)} `" @click="open(i)"> -->
<h3>
<span @click="i.length > 3 ? clickTag(i) : ''" v-for="i of i.title.split(' ')"> {{ i }} </span>
</h3>
<p class="tags" @click="clickTag('#' + i.category)"><a :style="`background-color: ${guessColor(i.category).bg};color:${guessColor(i.category).color};border-color:${guessColor(i.category).border}`">#{{ i.category }}</a></p>
<!-- A walkthrough of a few methods for truncating text to a certain number of lines for any device or viewport size -->
<div class="meta">
<p class="date">{{ moment.unix(i.timestamp).fromNow() }} |
<a :href="i.link" target="_blank">View article <i class="fa fa-external-link-square"></i></a>
</p>
</div>
</article>
</div>
</div>
<!-- partial -->
<!-- <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js'></script> -->
<!-- <script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js'></script> -->
<script>
var app = new Vue({
el: '#app',
data: {
sticky: false,
query: '',
headlines: [],
moment
},
mounted() {
var self = this
var top = document.getElementById('app').offsetTop;
window.onscroll = function() {
var y = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
if (y >= top) {
self.sticky = true
}
else {
self.sticky = false
}
}
var query = window.location.pathname
query = query.split('/news').join('')
query = query.split('/').join('')
if (query) {
this.query = query
}
this.load()
},
watch: {
query() {
var query = window.location.pathname.replace('/', '').replace('#', '')
if (query !== this.query && !this.query.includes(' ')) window.history.pushState("", "", `/${this.query.replace('#', '')}`)
}
},
computed: {
filtered() {
if (this.query) {
return this.headlines.filter(a => {
return a.title.toLowerCase().includes(`${this.query.replace('#', '').toLowerCase()}`)
})
return
}
// if (this.query && !this.query.includes('"')) {
// var found = []
// this.query.split(' ').map(b => {
// this.headlines.filter(a => a.title.toLowerCase().includes(b.toLowerCase())).map(c => found.push(c))
// })
// return found
// }
// if (this.query && this.query.includes('"')) {
// var found = []
// this.headlines.filter(a => a.title.toLowerCase().includes(this.query.split('"').join(''))).map(c => found.push(c))
// return found
// }
return this.headlines.slice(0, 100)
}
},
methods: {
tags(sentence) {
// return sentence.split(' ')
// console.log( nlp(sentence).sentences().subjects() )
},
clickArticle(i) {
window.open(i.link, '_blank').focus();
},
clickTag(i) {
this.query = i
this.$forceUpdate()
},
guessColor(str) {
if (str.toLowerCase().includes('ukraine')) return { color: '#FFF', bg: '#0057b7', border: '#ffd700' }
if (str.toLowerCase().includes('florida')) return { color: '#FFF', bg: 'rgb(0 0 0)', border: '' }
if (str.toLowerCase().includes('miami')) return { color: '#FFF', bg: '#F48FB1', border: 'red' }
return { color: '#000', bg: this.stringToColour(str), border: '#FFF' }
},
stringToColour(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour = '#';
for (var i = 0; i < 3; i++) {
var value = (hash >> (i * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
return colour;
},
load() {
axios.get('headlines.json').then((res) => {
this.headlines = res.data
})
}
},
})
</script>
</body>
</html>