-
Notifications
You must be signed in to change notification settings - Fork 0
/
manga.html
738 lines (690 loc) · 24.8 KB
/
manga.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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="img/game_item_default.png" />
<link rel="stylesheet" href="css/vuetify-gfont.css" />
<link rel="stylesheet" href="css/materialdesignicons.min.css" />
<link rel="stylesheet" href="css/vuetify.min.css" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
/>
<meta property="og:title" content="Red Mantis Portal" />
<meta property="og:locale" content="en_US" />
<meta
name="description"
content="Free Web Services, Informations, Medias and Entertainment all in one Application without annoying Ads"
/>
<meta
property="og:description"
content="Free Web Services, Informations, Medias and Entertainment all in one Application without annoying Ads"
/>
<link rel="canonical" href="https://eru123.github.io/" />
<meta property="og:url" content="https://eru123.github.io/" />
<meta property="og:site_name" content="Red Mantis Portal" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Red Mantis Portal" />
<meta name="twitter:site" content="@EruRoraito9" />
<title>Manga Reader</title>
<style>
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #333;
}
.app-flex-parent {
display: flex;
flex-wrap: wrap;
}
.app-flex-child-5 {
flex: 1 0 20%;
padding: 8px;
}
.app-flex-child-4 {
flex: 1 0 25%;
padding: 8px;
}
.app-flex-child-3 {
flex: 1 0 33.33%;
padding: 8px;
}
.app-flex-child-2 {
flex: 1 0 50%;
padding: 8px;
}
.app-flex-child-1 {
flex: 1 0 100%;
padding: 8px;
}
/* On screens that are 992px or less, set the background color to blue */
@media screen and (max-width: 900px) {
.app-flex-child-lg-5 {
flex: 1 0 20%;
padding: 8px;
}
.app-flex-child-lg-4 {
flex: 1 0 25%;
padding: 8px;
}
.app-flex-child-lg-3 {
flex: 1 0 33.33%;
padding: 8px;
}
.app-flex-child-lg-2 {
flex: 1 0 50%;
padding: 8px;
}
.app-flex-child-lg-1 {
flex: 1 0 100%;
padding: 8px;
}
}
@media screen and (max-width: 720px) {
.app-flex-child-md-5 {
flex: 1 0 20%;
padding: 8px;
}
.app-flex-child-md-4 {
flex: 1 0 25%;
padding: 8px;
}
.app-flex-child-md-3 {
flex: 1 0 33.33%;
padding: 8px;
}
.app-flex-child-md-2 {
flex: 1 0 50%;
padding: 8px;
}
.app-flex-child-md-1 {
flex: 1 0 100%;
padding: 8px;
}
}
/* On screens that are 600px or less, set the background color to olive */
@media screen and (max-width: 600px) {
.app-flex-child-sm-5 {
flex: 1 0 20%;
padding: 8px;
}
.app-flex-child-sm-4 {
flex: 1 0 25%;
padding: 8px;
}
.app-flex-child-sm-3 {
flex: 1 0 33.33%;
padding: 8px;
}
.app-flex-child-sm-2 {
flex: 1 0 50%;
padding: 8px;
}
.app-flex-child-sm-1 {
flex: 1 0 100%;
padding: 8px;
}
}
</style>
</head>
<body background-color="#fff" style="display: none">
<div id="app">
<div v-if="error">{{error}}</div>
<router-view v-if="!error"></router-view>
</div>
<script type="text/x-template" id="main">
<v-app>
<v-navigation-drawer v-model="drawer" app>
<v-subheader>MENU</v-subheader>
<v-list shaped>
<v-list-item link href="#/app">
<v-list-item-action><v-icon>mdi-home</v-icon></v-list-item-action>
<v-list-item-content><v-list-item-title>Home</v-list-item-title></v-list-item-content>
</v-list-item>
<v-list-item link href="#/app/search">
<v-list-item-action><v-icon>mdi-magnify</v-icon></v-list-item-action>
<v-list-item-content><v-list-item-title>Search</v-list-item-title></v-list-item-content>
</v-list-item>
<v-list-item link href="#/app/history">
<v-list-item-action><v-icon>mdi-history</v-icon></v-list-item-action>
<v-list-item-content><v-list-item-title>History</v-list-item-title></v-list-item-content>
</v-list-item>
<v-list-item link href="#/app/about">
<v-list-item-action><v-icon>mdi-information</v-icon></v-list-item-action>
<v-list-item-content><v-list-item-title>About</v-list-item-title></v-list-item-content>
</v-list-item>
</v-list>
</v-navigation-drawer>
<v-app-bar app color="primary" dark elevate-on-scroll elevation="6">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title>Manga Reader</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon link href="#/app/search"><v-icon>mdi-magnify</v-icon></v-btn>
</v-app-bar>
<v-main>
<router-view></router-view>
</v-main>
</v-app>
</script>
<script type="text/x-template" id="home">
<v-container fluid>
<v-sheet class="pa-3" v-if="loading">
<v-skeleton-loader class="mx-auto" max-width="600" type="article, actions"></v-skeleton-loader>
<v-skeleton-loader class="mx-auto" max-width="600" type="card"></v-skeleton-loader>
</v-sheet>
<div v-if="updates.length > 0">
<v-card max-width="600" class="mx-auto" elevation="0">
<v-list>
<v-subheader>Latest chapter updates</v-subheader>
<v-list-item v-for="(r,i) in updates" :key="i" link :href="'#/manga/' + r.code">
<v-list-item-avatar>
<v-avatar color="primary" size="48" >
<span class="white--text headline">{{i + 1}}</span>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="r.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</div>
<div v-if="popular.length > 0">
<v-card max-width="600" class="mx-auto" elevation="0">
<v-list>
<v-subheader>Popular Manga</v-subheader>
<v-list-item v-for="(r,i) in popular" :key="i" link :href="'#/manga/' + r.code">
<v-list-item-avatar>
<v-avatar color="teal" size="48" >
<span class="white--text headline">{{i + 1}}</span>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="r.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</div>
<div v-if="latest.length > 0">
<v-card max-width="600" class="mx-auto" elevation="0">
<v-list>
<v-subheader>Newest Manga</v-subheader>
<v-list-item v-for="(r,i) in latest" :key="i" link :href="'#/manga/' + r.code">
<v-list-item-avatar>
<v-avatar color="purple" size="48" >
<span class="white--text headline">{{i + 1}}</span>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="r.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</div>
</v-container>
</script>
<script type="text/x-template" id="search">
<v-container>
<v-text-field label="Search" :loading="loading" :disabled="loading" v-model="query">
<v-btn icon slot="append" @click="search" link><v-icon color="primary">mdi-magnify</v-icon></v-btn>
</v-text-field>
<v-alert border="left" colored-border type="error" elevation="2" v-if="error" @click="error = ''">{{error}}</v-alert>
<div v-if="!searched" class="py-8 text-center">
<v-icon size="200" class="mx-auto pa-4" color="primary" style="background:#cceeff;border-radius:50%">mdi-magnify</v-icon>
</div>
<v-subheader v-if="searched && !error" class="text-center">{{results.length || 0}} RESULTS</v-subheader>
<div v-for="(r,i) in results" :key="i" class="mb-4">
<v-card outlined elevation="0">
<div style="display:flex">
<div>
<v-img :src="r.cover" width="150"></v-img>
</div>
<div class="pa-2" style="flex:1">
<h3 class="mb-2">
<a :href="'#/manga/' + r.link" style="color:#333;text-decoration:none;">{{r.title}}</a>
</h3>
<small color="secondary">
<div><b>Description:</b> {{r.description}}</div>
<div><b>Genre:</b> {{r.genre}}</div>
</small>
</div>
</div>
</v-card>
</div>
</v-container>
</script>
<script type="text/x-template" id="history">
<v-container fluid>
<div v-if="items">
<v-card max-width="600" class="mx-auto" elevation="0">
<v-list>
<v-subheader>Previously read/visit</v-subheader>
<v-list-item v-for="(r,i) in items" :key="i">
<v-list-item-avatar>
<v-btn color="primary" icon size="48" link :href="'#/manga/' + i">
<v-icon>mdi-book-open-variant</v-icon>
</v-btn>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="i.replaceAll('-',' ') + ' ' + (r ? ' - Chapter ' + r : '')"></v-list-item-title>
</v-list-item-content>
<v-spacer></v-spacer>
<v-btn icon link @click="delfh(i)">
<v-icon >mdi-delete</v-icon>
</v-btn>
</v-list-item>
</v-list>
</v-card>
</div>
</v-container>
</script>
<script type="text/x-template" id="about">
<div>
<h1>about</h1>
</div>
</script>
<script type="text/x-template" id="manga">
<div>
<v-app>
<v-app-bar color="white" elevate-on-scroll app>
<v-btn icon link @click="goBack"> <v-icon>mdi-arrow-left</v-icon> </v-btn>
<v-toolbar-title>{{ manga.title || 'Manga Reader'}}</v-toolbar-title>
<v-spacer></v-spacer>
</v-app-bar>
<v-main v-if="loading">
<v-sheet class="pa-3">
<v-skeleton-loader class="mx-auto" max-width="600" type="article, actions"></v-skeleton-loader>
<v-skeleton-loader class="mx-auto" max-width="600" type="card"></v-skeleton-loader>
</v-sheet>
</v-main>
<v-main v-if="!loading">
<v-container>
<v-card max-width="600" class="mx-auto mb-4" elevation="6">
<v-img :src="manga.cover" max-height="600"></v-img>
<v-card-title>{{ manga.name || (manga.title || 'Unknown')}}</v-card-title>
<v-card-text>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Description:</b> {{ manga.description || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Author:</b> {{ manga.author || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Artist:</b> {{ manga.artist || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Year of release:</b> {{ manga.year_of_release || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Status:</b> {{ manga.status || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Reading Direction:</b> {{ manga.reading_direction || ''}}</div>
<div class="text--secondary font-weight-light text-justify pr-3"><b>Genre:</b> {{ manga.genre || ''}}</div>
</v-card-text>
</v-card>
<v-card max-width="600" class="mx-auto" elevation="0">
<v-subheader>Chapters ({{chapterCount}})</v-subheader>
<v-list>
<v-list-item v-for="(c,i) in manga.chapters" :key="i" link :href="'#/manga/' + c.code">
<v-list-item-avatar>
<v-avatar color="teal" size="48" >
<span class="white--text headline">{{i + 1}}</span>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="c.chapter"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</v-container>
</v-main>
</v-app>
</div>
</script>
<script type="text/x-template" id="chapter">
<div>
<v-app>
<v-app-bar color="white" elevate-on-scroll app>
<v-btn icon link @click="goBack"> <v-icon>mdi-arrow-left</v-icon> </v-btn>
<v-toolbar-title>{{ title}}</v-toolbar-title>
<v-spacer></v-spacer>
</v-app-bar>
<v-main v-if="loading">
<v-sheet class="pa-3">
<v-skeleton-loader class="mx-auto" max-width="600" type="article, actions"></v-skeleton-loader>
<v-skeleton-loader class="mx-auto" max-width="600" type="card"></v-skeleton-loader>
</v-sheet>
</v-main>
<v-main v-if="!loading">
<v-img v-for="(img,i) in images" :key="i" :src="img.u" max-width="600" class="mx-auto white lighten-2" lazy-src="">
<template v-slot:placeholder>
<v-row
class="fill-height ma-0"
align="center"
justify="center"
>
<v-progress-circular
indeterminate
color="grey"
></v-progress-circular>
</v-row>
</template>
</v-img>
</v-main>
</v-app>
</div>
</script>
<!-- Production -->
<!-- <script src="js/vue.min.js"></script> -->
<!-- Development -->
<script src="js/dev-vue.js"></script>
<script src="js/vue-router.js"></script>
<script src="js/vuex.js"></script>
<script src="js/vuetify.js"></script>
<script src="js/axios.min.js"></script>
<script src="js/red-mantis-webparser.js"></script>
<script src="js/red-mantis-webscraper-mangareader.js"></script>
<script>
const bus = new Vue()
const reader = new MangaReader()
const error = {
cors : "Please check your internet connection and make sure have CORS enabled "
}
const app__history = function(){
if (!localStorage.getItem('app__history') || localStorage.getItem('app__history') == "{}") {
}
var history = JSON.parse(localStorage.getItem('app__history') || "{}")
return {
history: history,
data: history,
add(code,chap = ""){
if (chap == "" && !history[code]) {
history[code] = chap
localStorage.setItem('app__history',JSON.stringify(history))
} else if (chap !== "" && code){
history[code] = chap
localStorage.setItem('app__history',JSON.stringify(history))
}
},
del(code){
var th = {}
reader.forEachValue(history,function(v,k){
if (k !== code) {
th[k] = v
}
})
localStorage.setItem('app__history',JSON.stringify(th))
}
}
}
Vue.use(Vuetify);
const routes = [
{
path : "",
redirect: "/app"
},
{
path: "/app",
component: {
template: "#main",
data(){
return {
drawer: null,
recent: [],
updates: [],
popular: [],
search: ""
}
}
},
children: [
{
name: "Home",
path: "",
component: {
template: "#home",
data(){
return {
popular: [],
latest: [],
updates: [],
loading: false
}
},
mounted(){
this.getResource()
},
methods: {
getResource : async function(){
if (localStorage.getItem('home')) {
var h = JSON.parse(localStorage.getItem('home') || "{}")
this.popular = h.popular
this.latest = h.latest
this.updates = h.updates
} else {
this.loading = true
}
reader.home()
.then(e => {
localStorage.setItem('home', JSON.stringify(e))
this.popular = e.popular
this.latest = e.latest
this.updates = e.updates
})
.catch(e => {
})
.finally(() => {
this.loading = false
})
}
}
}
},
{
name: "Search",
path: "search",
component: {
template: "#search",
data(){
return {
query: "",
loading: false,
searched: false,
error: "",
results: []
}
},
methods: {
search(){
this.searched = false;
this.loading = true
reader.search(this.query)
.then(e => {
console.log(e)
this.results = e
})
.catch(e => {
this.error = e
})
.finally(() => {
this.searched = true;
this.loading = false
})
}
}
}
},
{
name: "History",
path: "history",
component: {
template: "#history",
data(){
return {
items: {}
}
},
created(){
this.getHistory()
},
methods: {
delfh(code){
app__history().del(code)
this.getHistory()
},
getHistory(){
this.items = app__history().data
}
}
}
},
{
name: "About",
path: "about",
component: {
template: "#about"
}
}
]
},
{
path: "/manga",
component: {
template: "<router-view></router-view>"
},
children: [
{
name: "Manga",
path: ":manga",
component: {
template: "#manga",
data() {
return {
loading: false,
chapterCount: 0,
manga: {}
}
},
mounted(){
this.fetchResource()
},
methods: {
countChapter(){
if (this.manga.chapters) {
this.chapterCount = this.manga.chapters.length
} else {
this.chapterCount = 0
}
},
fetchResource(){
var title = this.$router.currentRoute.params.manga
if(localStorage.getItem(title)){
this.manga = JSON.parse(localStorage.getItem(title) || "[]");
} else {
this.loading = true
}
app__history().add(title)
reader.manga(title)
.then(e => {
if (e && e.chapters.length >= 0) {
this.manga = e
localStorage.setItem(title,JSON.stringify(e))
}
})
.catch(e => {
bus.$emit('error', error.cors)
})
.finally(()=> {
this.loading = false
this.countChapter()
})
this.countChapter()
},
goBack() {
window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/')
}
}
}
},
{
name: "Chapter",
path: ":manga/:chapter",
component: {
template: "#chapter",
data() {
return {
title:"",
prev:"",
next:"",
loading: false,
images: []
}
},
mounted(){
this.fetchResource()
},
methods: {
fetchResource(){
var title = this.$router.currentRoute.params.manga
var chapter = this.$router.currentRoute.params.chapter
var cc = title + "/" + chapter;
this.title = "Chapter " + chapter + " - "+title.replaceAll("_"," ");
if (localStorage.getItem(cc)) {
this.images = JSON.parse(localStorage.getItem(cc) || "[]")
if (this.images.length> 0) {
app__history().add(title,chapter)
}
this.loading = false
} else {
this.loading = true
}
reader.chapter(title + "/" + chapter)
.then(e => {
if (e && e.length > 0) {
console.log(e)
this.images = e
localStorage.setItem(cc,JSON.stringify(e))
app__history().add(title,chapter)
}
})
.catch(e => {
bus.$emit('error',error.cors)
})
.finally(() => {
this.loading = false
})
},
goBack() {
window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/')
}
}
}
}
]
},
]
const router = new VueRouter({ routes: routes });
const app = new Vue({
el: "#app",
data(){
return {
loading: true,
error: ""
}
},
created(){
document.body.style.display = "block"
bus.$on('error',(value) => {
this.error = value
})
},
router,
vuetify: new Vuetify({}),
});
</script>
</body>
</html>