-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
47 lines (44 loc) · 1.89 KB
/
main.js
File metadata and controls
47 lines (44 loc) · 1.89 KB
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
let index = 0;
randomquote.addEventListener("click", (eo) => {
const citeArr = [
`Prophet Muhammad`,
`Prophet Muhammad`,
`Prophet Muhammad`,
`Prophet Muhammad`,
`Prophet Muhammad`,
`Omar Bin Al Khattab`,
`Omar Bin Al Khattab`,
`Omar Bin Al Khattab`,
`Omar Bin Al Khattab`,
`Omar Bin Al Khattab`
];
const qouteBlockArr = [
`“ Do not waste water even if you were at a running stream. ”`,
`“ The best richness is the richness of the soul. ”`,
`“ speak a good word or remain silent. ”`,
`“ The Strong man is not the good wrestler, the strong man is only the one who controls himself when he is angry. ”`,
`“ Fulfill the trust for the one who entrusted you and do not cheat the one who cheated you. ”`,
`“ The most beloved of people to me is he that points out my flaws to me. ”`,
`“ I have never regretted my silence, as for my speech I’ve regretted it many times. ”`,
`“ Patience is the healthiest ingredient of our life. ”`,
`“ Don’t forget your own self while preaching to others ”`,
`“ No amount of guilt can change the past and no amount of worrying can change the future. ”`,
]
cite.innerHTML = citeArr[index];
qouteBlock.innerHTML = qouteBlockArr[index];
index++;
if (index == qouteBlockArr.length) {
index = 0;
}
});
sound.addEventListener("click", () => {
let utterance = new SpeechSynthesisUtterance(`${qouteBlock.innerHTML} by ${cite.innerHTML}`);
speechSynthesis.speak(utterance);
});
copy.addEventListener("click", () => {
navigator.clipboard.writeText(qouteBlock.innerHTML);
});
twitter.addEventListener("click", () => {
let tweetUrl = `https://twitter.com/intent/tweet?url=${qouteBlock.innerHTML}`;
window.open(tweetUrl, "_blank");
});