Bento/assets/js/lists.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-08-14 11:47:18 -05:00
// ┬ ┬┌─┐┌┬┐┌─┐
// │ │└─┐ │ └─┐
// ┴─┘┴└─┘ ┴ └─┘
2021-07-20 20:50:46 -05:00
2021-08-14 12:02:43 -05:00
// Print the first List
2021-07-20 20:50:46 -05:00
const printFirstList = () => {
let icon = `<i class="list__head" data-feather="${CONFIG.firstListIcon}"></i>`;
2021-08-14 11:47:18 -05:00
const position = 'beforeend';
2021-07-20 20:50:46 -05:00
list_1.insertAdjacentHTML(position, icon);
for (const link of CONFIG.lists.firstList) {
2021-08-14 12:02:43 -05:00
// List item
2021-07-20 20:50:46 -05:00
let item = `
<a
2021-08-14 11:47:18 -05:00
target="${CONFIG.openInNewTab ? '_blank' : ''}"
2021-07-20 20:50:46 -05:00
href="${link.link}"
class="list__link"
>${link.name}</a
>
`;
2021-08-14 11:47:18 -05:00
const position = 'beforeend';
2021-07-20 20:50:46 -05:00
list_1.insertAdjacentHTML(position, item);
}
};
2021-08-14 12:02:43 -05:00
// Print the second List
2021-07-20 20:50:46 -05:00
const printSecondList = () => {
2021-07-20 21:28:00 -05:00
let icon = `<i class="list__head" data-feather="${CONFIG.secondListIcon}"></i>`;
2021-08-14 11:47:18 -05:00
const position = 'beforeend';
2021-07-20 21:28:00 -05:00
list_2.insertAdjacentHTML(position, icon);
2021-07-20 20:50:46 -05:00
for (const link of CONFIG.lists.secondList) {
2021-08-14 12:02:43 -05:00
// List item
2021-07-20 20:50:46 -05:00
let item = `
<a
2021-08-14 11:47:18 -05:00
target="${CONFIG.openInNewTab ? '_blank' : ''}"
2021-07-20 20:50:46 -05:00
href="${link.link}"
class="list__link"
>${link.name}</a
>
`;
2021-08-14 11:47:18 -05:00
const position = 'beforeend';
2021-07-20 20:50:46 -05:00
list_2.insertAdjacentHTML(position, item);
}
};
printFirstList();
printSecondList();