-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-list.html
50 lines (46 loc) · 2.57 KB
/
make-list.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tmp2</title>
</head>
<body>
<div><a href="https://taroyanaka.github.io/javascript/HTML/image-to-name.html">image-to-name</a><a
onclick="exe(event);"> +</a></div>
<div><a
href="https://taroyanaka.github.io/javascript/HTML/fill-in-the-blank-multiple-choice-question.html">fill-in-the-blank-multiple-choice-question</a><a
onclick="exe(event);"> +</a></div>
<div><a
href="https://taroyanaka.github.io/javascript/HTML/fill-in-the-blank-multiple-choice-question2.html">fill-in-the-blank-multiple-choice-question2</a><a
onclick="exe(event);"> +</a></div>
<div><a href="https://taroyanaka.github.io/javascript/HTML/question_list_maker.html">question_list_maker</a><a
onclick="exe(event);"> +</a></div>
<div><a href="https://taroyanaka.github.io/javascript/HTML/question_list_maker2.html">question_list_maker2</a><a
onclick="exe(event);"> +</a></div>
<div><a href="https://taroyanaka.github.io/javascript/HTML/word_scramble.html">word_scramble</a><a
onclick="exe(event);"> +</a></div>
<a href="https://yanaka.dev">on yanaka.dev</a>
<textarea name="urlToTitleFrom" class="urlToTitleFrom" cols="30" rows="10" oninput="urlToTitle()"></textarea>
<textarea name="urlToTitleTo" class="urlToTitleTo" cols="30" rows="10"></textarea>
</body>
<script>
const splitByLine = () => document.querySelector(`.urlToTitleFrom`).value.split("\n");
const urlToTitle = () => {
document.querySelector(`.urlToTitleTo`).value =
splitByLine().map(LINE => {
const URL = LINE;
const title = LINE.split("/").slice(-1)[0].split(".")[0];
return `<div><a href="${URL}">${title}</a><a onclick="exe(event);"> +</a></div>`;
}).join("\n");
};
const urlToTitleTest = () => {
document.querySelector(`.urlToTitleFrom`).value = `https://taroyanaka.github.io/javascript/etc/quiz.html
https://taroyanaka.github.io/javascript/HTML/vent.html`;
urlToTitle();
if (document.querySelector(`.urlToTitleTo`).value === `<div><a href="https://taroyanaka.github.io/javascript/etc/quiz.html">quiz</a><a onclick="exe(event);"> +</a></div>
<div><a href="https://taroyanaka.github.io/javascript/HTML/vent.html">vent</a><a onclick="exe(event);"> +</a></div>`) { console.log("OK") } else { console.log("NG") }
};
</script>
</html>