-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
49 lines (40 loc) · 1.48 KB
/
script.js
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
const show = document.getElementById("show");
const copy = document.getElementById("copy");
const music = new Audio("assets/music.mp3");
const notCookies = document.getElementById("notCookies");
// then the show button is clicked then show a embed youtube video
show.addEventListener("click", () => {
// show the video
const video = document.getElementById("video");
// play the music
music.play();
music.loop = true;
music.volume = 0.3;
// add styles to the video
video.classList.add("display-block");
notCookies.classList.add("display-none");
// add the button to a not allowed button
show.classList.add("c-not-allowed");
show.innerText = "Stop";
// change the "Want a cookie?" text to "No cookie to you!"
document.getElementById("cookieText").innerText = "No cookie to you!";
// set the local storage to true (just for fun 🥴)
localStorage.setItem("cookie", "no");
localStorage.setItem("rickrolled", "yes");
});
// the button to copy the website url
copy.addEventListener("click", () => {
let url = "https://www.yourcookie.ml";
// the function to copy the url
navigator.clipboard.writeText(url).then(function () {
console.log("Copied to clipboard");
});
// remove cookie bg & text
document.getElementById("remove").remove();
// show the notification
const notification = document.getElementById("notification");
notification.classList.add("display-block");
setTimeout(() => {
notification.classList.remove("display-block");
}, 2000);
});