-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
43 lines (29 loc) · 1.17 KB
/
popup.js
File metadata and controls
43 lines (29 loc) · 1.17 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
import { getActiveTabURL } from "./utils";
const addNewOrder = (orders,order) => {
const orderTitleElement = document.createElement("div");
const controlsElement = document.createElement("div");
const newOrderElement = document.createElement("div");
orderTitleElement.textContent = bookmark.desc;
orderTitleElement.className = "order-title";
controlsElement.className = "order-controls";
newOrderElement.id = "order-" + order.time;
newOrderElement.className = "order";
newOrderElement.setAttribute("timestamp", order.time);
newOrderElement.appendChild(orderTitleElement);
newOrderElement.appendChild(controlsElement);
orders.appendChild(newOrderElement);
};
const viewOrders = (currentOrders=[]) => {
const ordersElement = document.getElementById("orders");
ordersElement.innerHTML = "";
if(currentOrders.length > 0){
for(let i =0; i <currentOrders.length;i++){
const order = currentOrders[i];
addNewOrder(ordersElement,order);
}
}else{
ordersElement.innerHTML = '<i class="row">No orders to show</i>';
}
return;
};
document.addEventListener("DOMContentLoaded", async () => {});