GilbertClaus commited on
Commit
899d1e1
·
1 Parent(s): 1d818b8
Files changed (4) hide show
  1. Ark ReCode/index.html +3 -26
  2. Ark ReCode/s.js +111 -0
  3. Ark ReCode/script.js +32 -108
  4. Ark ReCode/style.css +72 -67
Ark ReCode/index.html CHANGED
@@ -18,37 +18,14 @@
18
  <input type="text" id="charName" placeholder="Masukkan nama karakter...">
19
  <button onclick="fetchData()">Cari</button>
20
  <br>
21
- <button onclick="playVideo('Edalia')">Edalia</button>
22
- <button onclick="playVideo('Ermes')">Ermes</button>
23
  <div id="result"></div>
24
  </div>
25
 
26
  <!-- Tempat Video Ditampilkan -->
27
  <div id="videoWrapper"></div>
28
 
29
- <script>
30
- function playVideo(charName) {
31
- const fileName = `Ark Re Code - ${charName}.mp4`;
32
- const videoPath = `https://gilbertclaus.pythonanywhere.com/video/Ark ReCode/${fileName}`;
33
- const encodedURL = encodeURI(videoPath);
34
-
35
- const wrapper = document.getElementById("videoWrapper");
36
- wrapper.innerHTML = "";
37
-
38
- const video = document.createElement("video");
39
- video.src = encodedURL;
40
- video.width = 360;
41
- video.controls = true;
42
- video.autoplay = true;
43
- video.volume = 0.1;
44
- video.style.marginTop = "20px";
45
- wrapper.appendChild(video);
46
- }
47
-
48
- function fetchData() {
49
- const name = document.getElementById("charName").value;
50
- alert(`Fungsi fetchData untuk karakter "${name}" belum diimplementasikan`);
51
- }
52
- </script>
53
  </body>
54
  </html>
 
18
  <input type="text" id="charName" placeholder="Masukkan nama karakter...">
19
  <button onclick="fetchData()">Cari</button>
20
  <br>
21
+ <button class="chara" onclick="playVideo('Edalia')">Edalia</button>
22
+ <button class="chara" onclick="playVideo('Ermes')">Ermes</button>
23
  <div id="result"></div>
24
  </div>
25
 
26
  <!-- Tempat Video Ditampilkan -->
27
  <div id="videoWrapper"></div>
28
 
29
+ <script src="script.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  </body>
31
  </html>
Ark ReCode/s.js ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ async function fetchData() {
3
+ const charName = document.getElementById("charName").value;
4
+ const resultDiv = document.getElementById("result");
5
+
6
+ if (!charName) {
7
+ resultDiv.innerHTML = "<p>Masukkan nama karakter terlebih dahulu!</p>";
8
+ return;
9
+ }
10
+
11
+ try {
12
+ const response = await fetch(`http://localhost:3000/api?name=${charName}`);
13
+ const data = await response.json();
14
+
15
+ if (data.error) {
16
+ resultDiv.innerHTML = `<p>${data.error}</p>`;
17
+ return;
18
+ }
19
+
20
+ let output = "<h2>Hasil Pencarian:</h2>";
21
+
22
+ if (data.skills) {
23
+ output += `<h3>Skill & Discipline</h3>`;
24
+ output += `<p>Karakter: ${data.skills.Karakter}</p>`;
25
+ output += `<p>Link Skill 3: <a href="${data.skills.Skill3}" target="_blank">${data.skills.Skill3}</a></p>`;
26
+ output += `<p>Link Idle + Tap: <a href="${data.skills.Tap}" target="_blank">${data.skills.Tap}</a></p>`;
27
+ }
28
+
29
+ if (data.story) {
30
+ output += `<h3>Story Part II</h3>`;
31
+ output += `<p>Member: ${data.story.Member}</p>`;
32
+ output += `<p>Video: <a href="${data.story.Video}" target="_blank">${data.story.Video}</a></p>`;
33
+ }
34
+
35
+ if (data.chatAnimations) {
36
+ output += `<h3>Chat Animations</h3>`;
37
+ output += `<p>Karakter: ${data.chatAnimations.Karakter}</p>`;
38
+ output += `<p>Video: <a href="${data.chatAnimations.Video}" target="_blank">${data.chatAnimations.Video}</a></p>`;
39
+ }
40
+
41
+ if (data.illustration) {
42
+ output += `<h3>Illustrations</h3>`;
43
+ output += `<p>Karakter: ${data.illustration.Karakter}</p>`;
44
+ output += `<img src="${data.illustration.Image}" alt="Illustration" width="300">`;
45
+ }
46
+
47
+ resultDiv.innerHTML = output;
48
+ } catch (error) {
49
+ resultDiv.innerHTML = "<p>Gagal mengambil data.</p>";
50
+ }
51
+ }
52
+
53
+ const express = require("express");
54
+ const cors = require("cors");
55
+ const fetch = require("node-fetch");
56
+ const cheerio = require("cheerio");
57
+
58
+ const app = express();
59
+ app.use(cors());
60
+
61
+ const headers = {
62
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
63
+ };
64
+
65
+ async function fetchHtml(url) {
66
+ const response = await fetch(url, { headers });
67
+ return response.text();
68
+ }
69
+
70
+ function parseData(cari, html) {
71
+ const $ = cheerio.load(html);
72
+ const rows = $("tr").slice(1);
73
+ let result = null;
74
+
75
+ rows.each((index, row) => {
76
+ const cols = $(row).find("td");
77
+ const characterName = $(cols[0]).find("a").text().trim();
78
+ let skill3Link = $(cols[2]).find("a[href*='SK3']").attr("href") || "";
79
+ let tapLink = $(cols[3]).find("a[href*='Tap']").attr("href") || "";
80
+
81
+ if (characterName.includes(cari)) {
82
+ result = { Karakter: characterName, Skill3: skill3Link, Tap: tapLink };
83
+ return false; // Keluar dari loop
84
+ }
85
+ });
86
+
87
+ return result;
88
+ }
89
+
90
+ app.get("/api", async (req, res) => {
91
+ const cari = req.query.name;
92
+ if (!cari) return res.json({ error: "Masukkan nama karakter!" });
93
+
94
+ const url = "https://arkrecodewiki.miraheze.org/wiki/Love_Link";
95
+ try {
96
+ const html = await fetchHtml(url);
97
+ const segments = html.split("Show Spoilers");
98
+
99
+ if (segments.length < 7) return res.json({ error: "Data tidak ditemukan" });
100
+
101
+ const skillData = parseData(cari, segments[1]);
102
+
103
+ res.json({ skills: skillData || "Tidak ditemukan" });
104
+ } catch (error) {
105
+ res.json({ error: "Gagal mengambil data" });
106
+ }
107
+ });
108
+
109
+ app.listen(3000, () => {
110
+ console.log("Server berjalan di http://localhost:3000");
111
+ });
Ark ReCode/script.js CHANGED
@@ -1,111 +1,35 @@
1
-
2
- async function fetchData() {
3
- const charName = document.getElementById("charName").value;
4
- const resultDiv = document.getElementById("result");
5
-
6
- if (!charName) {
7
- resultDiv.innerHTML = "<p>Masukkan nama karakter terlebih dahulu!</p>";
8
- return;
9
- }
10
-
11
- try {
12
- const response = await fetch(`http://localhost:3000/api?name=${charName}`);
13
- const data = await response.json();
14
-
15
- if (data.error) {
16
- resultDiv.innerHTML = `<p>${data.error}</p>`;
17
- return;
18
- }
19
-
20
- let output = "<h2>Hasil Pencarian:</h2>";
21
-
22
- if (data.skills) {
23
- output += `<h3>Skill & Discipline</h3>`;
24
- output += `<p>Karakter: ${data.skills.Karakter}</p>`;
25
- output += `<p>Link Skill 3: <a href="${data.skills.Skill3}" target="_blank">${data.skills.Skill3}</a></p>`;
26
- output += `<p>Link Idle + Tap: <a href="${data.skills.Tap}" target="_blank">${data.skills.Tap}</a></p>`;
27
- }
28
-
29
- if (data.story) {
30
- output += `<h3>Story Part II</h3>`;
31
- output += `<p>Member: ${data.story.Member}</p>`;
32
- output += `<p>Video: <a href="${data.story.Video}" target="_blank">${data.story.Video}</a></p>`;
33
- }
34
-
35
- if (data.chatAnimations) {
36
- output += `<h3>Chat Animations</h3>`;
37
- output += `<p>Karakter: ${data.chatAnimations.Karakter}</p>`;
38
- output += `<p>Video: <a href="${data.chatAnimations.Video}" target="_blank">${data.chatAnimations.Video}</a></p>`;
39
- }
40
-
41
- if (data.illustration) {
42
- output += `<h3>Illustrations</h3>`;
43
- output += `<p>Karakter: ${data.illustration.Karakter}</p>`;
44
- output += `<img src="${data.illustration.Image}" alt="Illustration" width="300">`;
45
- }
46
-
47
- resultDiv.innerHTML = output;
48
- } catch (error) {
49
- resultDiv.innerHTML = "<p>Gagal mengambil data.</p>";
50
- }
51
  }
52
 
53
- const express = require("express");
54
- const cors = require("cors");
55
- const fetch = require("node-fetch");
56
- const cheerio = require("cheerio");
57
-
58
- const app = express();
59
- app.use(cors());
60
-
61
- const headers = {
62
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
63
- };
64
-
65
- async function fetchHtml(url) {
66
- const response = await fetch(url, { headers });
67
- return response.text();
68
- }
69
-
70
- function parseData(cari, html) {
71
- const $ = cheerio.load(html);
72
- const rows = $("tr").slice(1);
73
- let result = null;
74
-
75
- rows.each((index, row) => {
76
- const cols = $(row).find("td");
77
- const characterName = $(cols[0]).find("a").text().trim();
78
- let skill3Link = $(cols[2]).find("a[href*='SK3']").attr("href") || "";
79
- let tapLink = $(cols[3]).find("a[href*='Tap']").attr("href") || "";
80
-
81
- if (characterName.includes(cari)) {
82
- result = { Karakter: characterName, Skill3: skill3Link, Tap: tapLink };
83
- return false; // Keluar dari loop
84
- }
85
- });
86
-
87
- return result;
88
- }
89
-
90
- app.get("/api", async (req, res) => {
91
- const cari = req.query.name;
92
- if (!cari) return res.json({ error: "Masukkan nama karakter!" });
93
-
94
- const url = "https://arkrecodewiki.miraheze.org/wiki/Love_Link";
95
- try {
96
- const html = await fetchHtml(url);
97
- const segments = html.split("Show Spoilers");
98
-
99
- if (segments.length < 7) return res.json({ error: "Data tidak ditemukan" });
100
-
101
- const skillData = parseData(cari, segments[1]);
102
-
103
- res.json({ skills: skillData || "Tidak ditemukan" });
104
- } catch (error) {
105
- res.json({ error: "Gagal mengambil data" });
106
  }
107
- });
108
-
109
- app.listen(3000, () => {
110
- console.log("Server berjalan di http://localhost:3000");
111
- });
 
1
+ function playVideo(charName) {
2
+ const fileName = `Ark Re Code - ${charName}.mp4`;
3
+ const videoPath = `https://gilbertclaus.pythonanywhere.com/video/Ark ReCode/${fileName}`;
4
+ const encodedURL = encodeURI(videoPath);
5
+
6
+ const wrapper = document.getElementById("videoWrapper");
7
+ wrapper.innerHTML = "";
8
+
9
+ const video = document.createElement("video");
10
+ video.src = encodedURL;
11
+ video.width = 360;
12
+ video.controls = true;
13
+ video.autoplay = true;
14
+ video.volume = 0.1;
15
+ video.style.marginTop = "20px";
16
+ wrapper.appendChild(video);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
+ function fetchData() {
20
+ const input = document.getElementById("charName").value.trim();
21
+ const charaBtn = document.getElementById("chara");
22
+
23
+ if (input === "") {
24
+ // Ambil status tombol pertama sebagai acuan
25
+ const isHidden = charaBtns[0].style.display === "none" || charaBtns[0].style.display === "";
26
+
27
+ // Toggle semua tombol
28
+ charaBtns.forEach(btn => {
29
+ btn.style.display = isHidden ? "inline-block" : "none";
30
+ });
31
+ } else {
32
+ const name = document.getElementById("charName").value;
33
+ alert(`Fungsi fetchData untuk karakter "${name}" belum diimplementasikan`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
+ }
 
 
 
 
Ark ReCode/style.css CHANGED
@@ -4,70 +4,75 @@ body {
4
  text-align: center;
5
  padding: 20px;
6
  margin: 0;
7
- }
8
-
9
- .container {
10
- background: rgba(128, 128, 128, 0.5);
11
- padding: 20px;
12
- border-radius: 10px;
13
- box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
14
- max-width: 500px;
15
- margin: auto;
16
- }
17
-
18
- h1 {
19
- font-size: 22px;
20
- color: #333;
21
- }
22
-
23
- input {
24
- width: 80%;
25
- padding: 8px;
26
- margin: 10px 0;
27
- border: 1px solid #ccc;
28
- border-radius: 5px;
29
- }
30
-
31
- button {
32
- background: #007bff;
33
- color: white;
34
- padding: 8px 15px;
35
- border: none;
36
- cursor: pointer;
37
- border-radius: 5px;
38
- margin: 5px;
39
- }
40
-
41
- button:hover {
42
- background: #0056b3;
43
- }
44
-
45
- #result {
46
- margin-top: 15px;
47
- text-align: left;
48
- padding: 10px;
49
- }
50
-
51
- #videoWrapper {
52
- display: flex;
53
- justify-content: center;
54
- margin-top: 20px;
55
- }
56
-
57
- #videoWrapper video {
58
- width: 360px;
59
- height: auto;
60
- border-radius: 10px;
61
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
62
- }
63
-
64
- #bgVideo {
65
- position: fixed;
66
- top: 50%;
67
- left: 50%;
68
- transform: translate(-50%, -50%);
69
- min-width: 100%;
70
- min-height: 100%;
71
- z-index: -1;
72
- object-fit: cover;
73
- }
 
 
 
 
 
 
4
  text-align: center;
5
  padding: 20px;
6
  margin: 0;
7
+ }
8
+
9
+ .container {
10
+ background: rgba(128, 128, 128, 0.5);
11
+ padding: 20px;
12
+ border-radius: 10px;
13
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
14
+ max-width: 500px;
15
+ margin: auto;
16
+ }
17
+
18
+ h1 {
19
+ font-size: 22px;
20
+ color: #333;
21
+ }
22
+
23
+ input {
24
+ width: 80%;
25
+ padding: 8px;
26
+ margin: 10px 0;
27
+ border: 1px solid #ccc;
28
+ border-radius: 5px;
29
+ }
30
+
31
+ button {
32
+ background: #007bff;
33
+ color: white;
34
+ padding: 8px 15px;
35
+ border: none;
36
+ cursor: pointer;
37
+ border-radius: 5px;
38
+ margin: 5px;
39
+ }
40
+
41
+ button:hover {
42
+ background: #0056b3;
43
+ }
44
+
45
+ #result {
46
+ margin-top: 15px;
47
+ text-align: left;
48
+ padding: 10px;
49
+ }
50
+
51
+ #videoWrapper {
52
+ display: flex;
53
+ justify-content: center;
54
+ margin-top: 20px;
55
+ }
56
+
57
+ #videoWrapper video {
58
+ width: 360px;
59
+ height: auto;
60
+ border-radius: 10px;
61
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
62
+ }
63
+
64
+ #bgVideo {
65
+ position: fixed;
66
+ top: 50%;
67
+ left: 50%;
68
+ transform: translate(-50%, -50%);
69
+ min-width: 100%;
70
+ min-height: 100%;
71
+ z-index: -1;
72
+ object-fit: cover;
73
+ }
74
+
75
+ .chara {
76
+ display: none;
77
+ }
78
+