-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacters2.html
62 lines (51 loc) · 1.83 KB
/
Characters2.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
<html>
<head>
<title>Characters</title>
<style>
body { font-family: sans-serif; }
label { width: 50px; }
img { max-width: 10vw; cursor: pointer; }
img:-moz-broken { width: 0; }
</style>
</head>
<body>
<h1>Characters</h1>
<div>
<label>From:</label><input id="min-index" value="1001"></input>
<label>To:</label><input id="max-index" value="2692"></input>
<button onclick="load()">Load</button>
<button onclick="clear_imgs()">Clear</button>
</div>
<hr>
</body>
<script>
const URL = "https://p-img.danmachixi.com/card/mypage_n/";
function load() {
let el_min = document.getElementById("min-index");
let el_max = document.getElementById("max-index");
load_imgs(
parseInt(el_min.value),
parseInt(el_max.value)
);
}
function clear_imgs() {
document.body.innerHTML = document.body.innerHTML.split("<br>")[0] + "<br>";
}
function load_imgs(start, end) {
clear_imgs();
let count = start;
let fragment = document.createDocumentFragment();
while (count <= end) {
let img_src = URL + count + ".png";
let img_new = document.createElement("img");
img_new.src = img_src;
img_new.href = img_src;
img_new.onclick = () => window.open(img_src);
img_new.title = `${count}.png`;
fragment.appendChild(img_new);
count++;
}
document.body.appendChild(fragment);
}
</script>
</html>