-
Notifications
You must be signed in to change notification settings - Fork 0
/
onepiece.html
89 lines (83 loc) · 2.45 KB
/
onepiece.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>One Piece</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
.top{
width: 100%;
height: 10%;
}
.bottom{
width: 100%;
height: 90%;
}
</style>
</head>
<body>
<div class="top">
<button type="button" onclick="prev()">Prev</button>
<select id="pages" value="01" onchange="sel()">
<option value = "01">01</option>
</select>
<button type="button" onclick="next()">Next</button>
</div>
<br>
<div class="bottom"><img id="opimg" src="onepiece/"></img><br>
<button type="button" onclick="prev()">Prev</button>
<button type="button" onclick="next()">Next</button>
</div>
<script>
function requestParam(val) {
var reg = new RegExp("(^|&)" + val + "=([^&]*)(&|$)");
var result = window.location.search.substr(1).match(reg);
return result ? decodeURIComponent(result[2]) : null;
}
let maxpage=requestParam("m");
let chapter=requestParam("c");
let ext="jpg";
if (requestParam("e") == null || requestParam("e")=="" ){
} else {
ext=requestParam("e");
}
document.getElementById("opimg").src="onepiece/"+chapter+"/OnePiece-"+chapter+"-01."+ext;
document.getElementById("pages").value="01";
for (var i=2; i<=Number(maxpage); i++){
let p=("0"+i).slice(-2);
document.getElementById("pages").options.add(new Option(p,p));
}
function sel(){
if(chapter!=""){
let npage=document.getElementById("pages").value;
document.getElementById("opimg").src="onepiece/"+chapter+"/OnePiece-"+chapter+"-"+npage+"."+ext;
}
}
function prev(){
if(chapter!=""){
let cpage=document.getElementById("pages").value;
if(Number(cpage)==1){
alert("First Page");
return;
}
let npage=("0"+(Number(cpage)-1)).slice(-2);
document.getElementById("opimg").src="onepiece/"+chapter+"/OnePiece-"+chapter+"-"+npage+"."+ext;
document.getElementById("pages").value=npage;
}
}
function next(){
if(chapter!=""){
let cpage=document.getElementById("pages").value;
if(cpage==maxpage){
alert("Last Page");
return;
}
let npage=("0"+(Number(cpage)+1)).slice(-2);
document.getElementById("opimg").src="onepiece/"+chapter+"/OnePiece-"+chapter+"-"+npage+"."+ext;
document.getElementById("pages").value=npage;
}
}
</script>
</body>
</html>