GilbertClaus commited on
Commit
2eabeb3
·
1 Parent(s): 18df17a
Files changed (2) hide show
  1. ArkReCode/script.js +23 -1
  2. ArkReCode/style.css +18 -1
ArkReCode/script.js CHANGED
@@ -62,7 +62,8 @@ function fetchData() {
62
 
63
  } else {
64
  const name = document.getElementById("charName").value;
65
- alert(`Fungsi fetchData untuk karakter "${name}" belum diimplementasikan`);
 
66
  }
67
  }
68
 
@@ -81,3 +82,24 @@ window.onload = () => {
81
  });
82
  });
83
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  } else {
64
  const name = document.getElementById("charName").value;
65
+ showNotif(`Fungsi fetchData untuk karakter "${name}" belum diimplementasikan`);
66
+
67
  }
68
  }
69
 
 
82
  });
83
  });
84
  };
85
+
86
+ function showNotif(message, duration = 3000) {
87
+ const notif = document.createElement("div");
88
+ notif.className = "notif";
89
+ notif.textContent = message;
90
+
91
+ document.body.appendChild(notif);
92
+
93
+ // Trigger fade-in
94
+ requestAnimationFrame(() => {
95
+ notif.style.opacity = 1;
96
+ });
97
+
98
+ // Auto-hide
99
+ setTimeout(() => {
100
+ notif.style.opacity = 0;
101
+ setTimeout(() => {
102
+ notif.remove();
103
+ }, 500); // Tunggu animasi selesai
104
+ }, duration);
105
+ }
ArkReCode/style.css CHANGED
@@ -76,4 +76,21 @@ button:hover {
76
  .chara {
77
  display: none;
78
  }
79
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  .chara {
77
  display: none;
78
  }
79
+
80
+ .notif {
81
+ position: fixed;
82
+ top: 50%;
83
+ left: 50%;
84
+ transform: translate(-50%, -50%);
85
+ background-color: rgba(255, 193, 7, 0.9);
86
+ color: white;
87
+ padding: 12px 24px;
88
+ border-radius: 10px;
89
+ font-size: 16px;
90
+ text-align: center;
91
+ max-width: 80%;
92
+ z-index: 9999;
93
+ opacity: 0;
94
+ transition: opacity 0.5s ease;
95
+ pointer-events: none;
96
+ }