Repository navigation
Expand file tree
/
Copy pathDOMUtils.js
More file actions
58 lines (52 loc) · 1.61 KB
/
Copy pathDOMUtils.js
File metadata and controls
58 lines (52 loc) · 1.61 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
const DOMUtils = (() => {
const setAttributes = (element, attributes) => {
for (var key in attributes) element.setAttribute(key, attributes[key]);
};
const getMainContainer = (type) =>
getContainer("ts-" + type + "-container ts-main-container");
const getContainer = (className) => {
let container = document.createElement("div");
DOMUtils.setAttributes(container, {
class: className,
});
return container;
};
const getActionButton = (type) => {
let button = document.createElement("button");
setAttributes(button, {
class: "ts-" + type + "-btn ts-action-btn",
});
return button;
};
const getRemoveIcon = () => {
let taskRemoveIconSVG = document.createElementNS(
"http://www.w3.org/2000/svg",
"svg"
),
taskRemoveIconTop = document.createElementNS(
"http://www.w3.org/2000/svg",
"path"
),
taskRemoveIconBottom = document.createElementNS(
"http://www.w3.org/2000/svg",
"path"
);
setAttributes(taskRemoveIconSVG, { viewbox: "0 0 32 32" });
setAttributes(taskRemoveIconTop, {
class: "ts-remove-icon ts-remove-icon-top",
});
setAttributes(taskRemoveIconBottom, {
class: "ts-remove-icon ts-remove-icon-bottom",
});
taskRemoveIconSVG.appendChild(taskRemoveIconTop);
taskRemoveIconSVG.appendChild(taskRemoveIconBottom);
return taskRemoveIconSVG;
};
return {
setAttributes: setAttributes,
getMainContainer: getMainContainer,
getContainer: getContainer,
getActionButton: getActionButton,
getRemoveIcon: getRemoveIcon,
};
})();