-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevBucket.js
More file actions
60 lines (52 loc) · 1.36 KB
/
Copy pathDevBucket.js
File metadata and controls
60 lines (52 loc) · 1.36 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
48
49
50
51
52
53
54
55
56
57
58
59
60
let quickLinks = [
{
title: "GitHub",
href: "https://github.com/",
icon: "fa-brands fa-github",
},
{
title: "ChatGPT",
href: "https://chat.openai.com",
svg: "/public/images/svg/icons8-chatgpt20.svg",
},
];
let quickLinksListElement = document.getElementById("quickLinks list-group");
function renderQuickLinks() {
quickLinks.forEach((item) => {
let li = document.createElement("li");
let a = document.createElement("a");
let i = document.createElement("i");
let img = document.createElement("img");
if (item.icon) {
i.className = item.icon;
} else {
const url = new URL(item.href);
img.src = url.protocol + "//" + url.hostname + "/favicon.ico";
img.style.height = '20px';
img.style.width = '20px';
}
a.className = "text-decoration-none fs-5 text-snow-storm-2";
a.href = item.href;
if (item.icon) {
a.appendChild(i)
} else {
a.appendChild(img)
}
a.insertAdjacentHTML("beforeend", " " + item.title);
li.className = "list-group-item p-3 border-bottom border-polar-night-0 fw-bold";
li.appendChild(a);
quickLinksListElement.appendChild(li);
});
}
function addQuickLink() {
console.log('functionality pending');
}
renderQuickLinks();
let currentDate;
setInterval(() => {
currentDate = new Date();
document.getElementById("time").innerText = currentDate.toLocaleTimeString(
"en-US",
{ hour12: false }
);
}, 1000);