-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.html
122 lines (118 loc) · 2.65 KB
/
ui.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<style>
:root {
font-family: Inter, sans-serif;
font-size: 14px;
color: rgba(0, 0, 0, 0.8);
}
body {
margin: 14px;
}
a {
text-decoration: none;
color: #18a0fb;
cursor: pointer;
}
p {
margin: 0;
line-height: 1.5;
}
p.info {
font-size: 12px;
opacity: 0.75;
}
.layer-name {
margin-left: 2px;
padding: 3px 2px 2px;
border-bottom: 1px dashed #ddd;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
line-height: 1.2;
}
.primary-button {
min-width: 100px;
height: 30px;
margin: 20px 0;
display: block;
cursor: pointer;
background: #18a0fb;
border: 1px solid #18a0fb;
border-radius: 6px;
padding: 0 16px;
color: #fff;
font-size: 11px;
box-sizing: border-box;
}
.primary-button:hover {
border: 2px solid rgba(0, 0, 0, 0.2);
padding: 0 15px;
}
.layer-order {
margin: 10px 0;
padding: 6px 12px 8px;
border-radius: 2px;
background: #fafafa;
display: flex;
flex-direction: column;
gap: 6px;
}
.layer-order p {
line-height: 2;
display: flex;
align-items: center;
}
.layer-order .subtitle {
opacity: 0.6;
min-width: 40px;
font-weight: 500;
}
#exchange {
font-size: 13px;
}
#exchange:hover {
font-weight: 500;
}
</style>
<p class="info">Choose 2 layers and set the order, then click "Go".</p>
<div class="layer-order">
<p>
<span class="subtitle">from</span
><span class="layer-name" id="origin-layer"></span>
</p>
<p>
<span class="subtitle">to</span
><span class="layer-name" id="target-layer"></span>
</p>
</div>
<a id="exchange">⇌ Exchange order</a>
<button id="create" class="primary-button">Go</button>
<script>
let order = false;
let layerArray, originLayer, targetLayer;
function showOrder(order) {
// console.log("order is " + order);
if (order) {
document.getElementById("origin-layer").innerHTML = layerArray[1];
document.getElementById("target-layer").innerHTML = layerArray[0];
} else {
document.getElementById("origin-layer").innerHTML = layerArray[0];
document.getElementById("target-layer").innerHTML = layerArray[1];
}
}
onmessage = (event) => {
layerArray = event.data.pluginMessage;
console.log("got this from the plugin code", layerArray);
showOrder(order);
};
document.getElementById("exchange").onclick = () => {
order = !order;
// console.log(order);
showOrder(order);
};
document.getElementById("create").onclick = () => {
parent.postMessage(
{ pluginMessage: { type: "selection-order", order } },
"*"
);
};
</script>