Spaces:
Running
Running
Commit
·
3607be8
1
Parent(s):
a58ee91
fix esltoolbtn
Browse files- public/esltool.js +26 -1
- public/utils.js +1 -1
public/esltool.js
CHANGED
|
@@ -24,29 +24,41 @@ toolbar.style.padding = "10px"; // Add some padding
|
|
| 24 |
const askButton = document.createElement("button");
|
| 25 |
askButton.id = "ask-btn";
|
| 26 |
askButton.textContent = "Ask";
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
const correctBtn = document.createElement("button");
|
| 31 |
correctBtn.id = "correct-btn";
|
| 32 |
correctBtn.textContent = "Correct";
|
|
|
|
|
|
|
| 33 |
|
| 34 |
const translateBtn = document.createElement("button");
|
| 35 |
translateBtn.id = "translate-btn";
|
| 36 |
translateBtn.textContent = "Translate";
|
|
|
|
|
|
|
| 37 |
|
| 38 |
const explainBtn = document.createElement("button");
|
| 39 |
explainBtn.id = "explain-btn";
|
| 40 |
explainBtn.textContent = "Explain";
|
|
|
|
|
|
|
| 41 |
|
| 42 |
const defineBtn = document.createElement("button");
|
| 43 |
defineBtn.id = "define-btn";
|
| 44 |
defineBtn.textContent = "Define";
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
const removeButton = document.createElement("button");
|
| 48 |
removeButton.id = "remove-btn";
|
| 49 |
removeButton.textContent = "Hide";
|
|
|
|
|
|
|
| 50 |
|
| 51 |
// Append buttons to toolbar
|
| 52 |
toolbar.appendChild(askButton);
|
|
@@ -57,6 +69,12 @@ toolbar.appendChild(defineBtn);
|
|
| 57 |
toolbar.appendChild(removeButton);
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
// Create content area
|
| 61 |
const contentArea = document.createElement("div");
|
| 62 |
contentArea.id = "content";
|
|
@@ -156,5 +174,12 @@ this code \`\${value}\`
|
|
| 156 |
\`\`\`
|
| 157 |
`)
|
| 158 |
view.createMenu(window.innerWidth*0.9, 300);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
}, 1000);
|
|
|
|
| 24 |
const askButton = document.createElement("button");
|
| 25 |
askButton.id = "ask-btn";
|
| 26 |
askButton.textContent = "Ask";
|
| 27 |
+
askButton.classList.add('esltool-btn');
|
| 28 |
+
askButton.addEventListener('pointerdown', e=>{
|
| 29 |
+
e.preventDefault();
|
| 30 |
+
});
|
| 31 |
|
| 32 |
|
| 33 |
const correctBtn = document.createElement("button");
|
| 34 |
correctBtn.id = "correct-btn";
|
| 35 |
correctBtn.textContent = "Correct";
|
| 36 |
+
correctBtn.classList.add('esltool-btn');
|
| 37 |
+
|
| 38 |
|
| 39 |
const translateBtn = document.createElement("button");
|
| 40 |
translateBtn.id = "translate-btn";
|
| 41 |
translateBtn.textContent = "Translate";
|
| 42 |
+
translateBtn.classList.add('esltool-btn');
|
| 43 |
+
|
| 44 |
|
| 45 |
const explainBtn = document.createElement("button");
|
| 46 |
explainBtn.id = "explain-btn";
|
| 47 |
explainBtn.textContent = "Explain";
|
| 48 |
+
explainBtn.classList.add('esltool-btn');
|
| 49 |
+
|
| 50 |
|
| 51 |
const defineBtn = document.createElement("button");
|
| 52 |
defineBtn.id = "define-btn";
|
| 53 |
defineBtn.textContent = "Define";
|
| 54 |
+
defineBtn.classList.add('esltool-btn');
|
| 55 |
|
| 56 |
|
| 57 |
const removeButton = document.createElement("button");
|
| 58 |
removeButton.id = "remove-btn";
|
| 59 |
removeButton.textContent = "Hide";
|
| 60 |
+
removeButton.classList.add('esltool-btn');
|
| 61 |
+
|
| 62 |
|
| 63 |
// Append buttons to toolbar
|
| 64 |
toolbar.appendChild(askButton);
|
|
|
|
| 69 |
toolbar.appendChild(removeButton);
|
| 70 |
|
| 71 |
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
| 78 |
// Create content area
|
| 79 |
const contentArea = document.createElement("div");
|
| 80 |
contentArea.id = "content";
|
|
|
|
| 174 |
\`\`\`
|
| 175 |
`)
|
| 176 |
view.createMenu(window.innerWidth*0.9, 300);
|
| 177 |
+
let allEslToolBtns=document.querySelectorAll('.esltool-btn');
|
| 178 |
+
for (const btn of allEslToolBtns) {
|
| 179 |
+
console.log(btn);
|
| 180 |
+
btn.addEventListener('pointerdown', e=>{
|
| 181 |
+
e.preventDefault();
|
| 182 |
+
});
|
| 183 |
+
}
|
| 184 |
|
| 185 |
}, 1000);
|
public/utils.js
CHANGED
|
@@ -281,7 +281,7 @@ const utils = {
|
|
| 281 |
|
| 282 |
container.style.display = "block";
|
| 283 |
container.style.position = "fixed";
|
| 284 |
-
container.style.
|
| 285 |
container.style.right = "0";
|
| 286 |
container.style.height = 'fit-content'
|
| 287 |
|
|
|
|
| 281 |
|
| 282 |
container.style.display = "block";
|
| 283 |
container.style.position = "fixed";
|
| 284 |
+
container.style.top = "20px";
|
| 285 |
container.style.right = "0";
|
| 286 |
container.style.height = 'fit-content'
|
| 287 |
|