-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (40 loc) · 1.1 KB
/
index.js
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
const html = String.raw
class Component extends HTMLElement {
name = { ru: "DevTools" }
input = {}
output = {}
property = {}
static observedAttributes = ["mobile"];
constructor() {
super()
this.attachShadow({ mode: "closed" })
if (this.hasAttribute("mobile")) {
if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2)
this.render()
} else
this.render()
}
render() {
import("//cdn.jsdelivr.net/npm/eruda").then(() => {
eruda.init({
default: {
displaySize: 40,
transparency: 1,
theme: "Material Oceanic",
},
})
if (localStorage.getItem("eruda-active") === "true") eruda.show()
eruda._entryBtn._$el[0].addEventListener("click", (event) => {
setTimeout(() => {
localStorage.setItem(
"eruda-active",
eruda._$el[0].children[0].style.display === "block" ? "true" : "false"
)
}, 300)
})
})
}
connectedCallback() { }
attributeChangedCallback(attrName, oldValue, newValue) { }
}
customElements.define("dev-tools", Component)