Update cl.js
Browse files
cl.js
CHANGED
@@ -10,13 +10,12 @@
|
|
10 |
width: 500px;
|
11 |
height: 350px;
|
12 |
background: rgba(0,0,0,0.8);
|
13 |
-
top:
|
14 |
left: 0;
|
15 |
right: 0;
|
16 |
-
margin: auto;
|
17 |
font-size: 0;
|
18 |
z-index: 100000;
|
19 |
-
cursor: move; /* ドラッグカーソルを追加 */
|
20 |
}
|
21 |
evalcontainer > textarea.EVALTEXTAREA {
|
22 |
width: 500px;
|
@@ -91,14 +90,20 @@
|
|
91 |
border: none;
|
92 |
padding: 5px;
|
93 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
`;
|
96 |
document.head.appendChild(s);
|
97 |
}
|
98 |
if (!document.querySelector('evalcontainer')) {
|
99 |
s=document.createElement("evalcontainer");
|
100 |
-
|
101 |
-
|
102 |
// 右上の「×」ボタンを追加
|
103 |
var closeButton = document.createElement("button");
|
104 |
closeButton.className = "close-button";
|
@@ -108,6 +113,12 @@
|
|
108 |
};
|
109 |
s.appendChild(closeButton);
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
var output=document.createElement("evaloutput");
|
112 |
function createOutputEntry(words) {
|
113 |
var t=document.createElement("evaloutputentry");
|
@@ -153,7 +164,7 @@
|
|
153 |
t.classList.add('EVALUNDEFINED');
|
154 |
break;
|
155 |
case 'symbol':
|
156 |
-
|
157 |
t.classList.add('EVALSTRING');
|
158 |
break;
|
159 |
}
|
@@ -181,22 +192,31 @@
|
|
181 |
}
|
182 |
};
|
183 |
|
184 |
-
// ドラッグ機能を実装
|
185 |
-
s.
|
186 |
-
e.dataTransfer.setData('text/plain', null); // Firefox用にデータをセット
|
187 |
-
};
|
188 |
|
189 |
-
|
190 |
-
e.
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
-
document.
|
194 |
e.preventDefault();
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
function merp(u,t) {
|
202 |
switch (typeof u) {
|
|
|
10 |
width: 500px;
|
11 |
height: 350px;
|
12 |
background: rgba(0,0,0,0.8);
|
13 |
+
top: 0;
|
14 |
left: 0;
|
15 |
right: 0;
|
16 |
+
margin: 50px auto;
|
17 |
font-size: 0;
|
18 |
z-index: 100000;
|
|
|
19 |
}
|
20 |
evalcontainer > textarea.EVALTEXTAREA {
|
21 |
width: 500px;
|
|
|
90 |
border: none;
|
91 |
padding: 5px;
|
92 |
cursor: pointer;
|
93 |
+
}
|
94 |
+
.draggable-icon {
|
95 |
+
position: absolute;
|
96 |
+
top: 5px;
|
97 |
+
left: 5px;
|
98 |
+
font-size: 20px;
|
99 |
+
cursor: move; /* ドラッグカーソルを追加 */
|
100 |
}
|
101 |
`;
|
102 |
document.head.appendChild(s);
|
103 |
}
|
104 |
if (!document.querySelector('evalcontainer')) {
|
105 |
s=document.createElement("evalcontainer");
|
106 |
+
|
|
|
107 |
// 右上の「×」ボタンを追加
|
108 |
var closeButton = document.createElement("button");
|
109 |
closeButton.className = "close-button";
|
|
|
113 |
};
|
114 |
s.appendChild(closeButton);
|
115 |
|
116 |
+
// ドラッグアイコンを追加
|
117 |
+
var dragIcon = document.createElement("div");
|
118 |
+
dragIcon.className = "draggable-icon";
|
119 |
+
dragIcon.innerText = "🖱️";
|
120 |
+
s.appendChild(dragIcon);
|
121 |
+
|
122 |
var output=document.createElement("evaloutput");
|
123 |
function createOutputEntry(words) {
|
124 |
var t=document.createElement("evaloutputentry");
|
|
|
164 |
t.classList.add('EVALUNDEFINED');
|
165 |
break;
|
166 |
case 'symbol':
|
167 |
+
evaloutput=evaloutput.toString();
|
168 |
t.classList.add('EVALSTRING');
|
169 |
break;
|
170 |
}
|
|
|
192 |
}
|
193 |
};
|
194 |
|
195 |
+
// ドラッグ機能を実装 (ドラッグアンドドロップAPIを使用)
|
196 |
+
s.setAttribute('draggable', true);
|
|
|
|
|
197 |
|
198 |
+
s.addEventListener('dragstart', function(e) {
|
199 |
+
e.dataTransfer.setData('text/plain', null); // Firefoxのためのダミーデータ
|
200 |
+
const rect = s.getBoundingClientRect();
|
201 |
+
e.dataTransfer.setData('text/plain', JSON.stringify({
|
202 |
+
offsetX: e.clientX - rect.left,
|
203 |
+
offsetY: e.clientY - rect.top
|
204 |
+
}));
|
205 |
+
});
|
206 |
|
207 |
+
document.addEventListener('dragover', function(e) {
|
208 |
e.preventDefault();
|
209 |
+
});
|
210 |
+
|
211 |
+
document.addEventListener('drop', function(e) {
|
212 |
+
e.preventDefault();
|
213 |
+
const data = e.dataTransfer.getData('text/plain');
|
214 |
+
if (data) {
|
215 |
+
const { offsetX, offsetY } = JSON.parse(data);
|
216 |
+
s.style.left = (e.clientX - offsetX) + 'px';
|
217 |
+
s.style.top = (e.clientY - offsetY) + 'px';
|
218 |
+
}
|
219 |
+
});
|
220 |
|
221 |
function merp(u,t) {
|
222 |
switch (typeof u) {
|