aboutsummaryrefslogtreecommitdiff
path: root/yomichan-user/conf.d
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-09 20:19:22 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-09 20:19:22 +0200
commit99146502259dfc324ec427169e25554aaa91ab97 (patch)
tree4e8273c24d3a50926b65c481a20eebe6910946f9 /yomichan-user/conf.d
parent67e7e2eee2c4a09b35470711fe5ac10453841d8c (diff)
WIP handwriting panel (added libs + button to search bar)
Diffstat (limited to 'yomichan-user/conf.d')
-rw-r--r--yomichan-user/conf.d/handwriting.css.m41
-rw-r--r--yomichan-user/conf.d/handwriting.js24
-rw-r--r--yomichan-user/conf.d/sentence-export.js8
-rw-r--r--yomichan-user/conf.d/word-export.js8
4 files changed, 37 insertions, 4 deletions
diff --git a/yomichan-user/conf.d/handwriting.css.m4 b/yomichan-user/conf.d/handwriting.css.m4
new file mode 100644
index 0000000..6b3727b
--- /dev/null
+++ b/yomichan-user/conf.d/handwriting.css.m4
@@ -0,0 +1 @@
+.icon[data-icon=draw] { --icon-image: url`(data:image/svg+xml;base64,'undivert(draw.svg.b64)`)'; }
diff --git a/yomichan-user/conf.d/handwriting.js b/yomichan-user/conf.d/handwriting.js
new file mode 100644
index 0000000..7e63224
--- /dev/null
+++ b/yomichan-user/conf.d/handwriting.js
@@ -0,0 +1,24 @@
+{
+
+function patchSearchBar() {
+ var searchBarOuter = document.getElementsByClassName("search-textbox-container")[0];
+ var button = document.createElement("button");
+ button.id = "handwriting-input-toggle";
+ button.classList.add("search-button");
+ button.onclick = () => console.log("AAAA");
+ var icon = document.createElement("span");
+ icon.classList.add("icon");
+ icon.setAttribute("data-icon", "draw");
+ button.appendChild(icon);
+ searchBarOuter.insertBefore(button, searchBarOuter.childNodes[2]);
+}
+
+(() => {
+ if (document.body.classList.contains("handwriting-patched")) return;
+
+ patchSearchBar();
+
+ document.body.classList.add("handwriting-patched");
+})();
+
+}
diff --git a/yomichan-user/conf.d/sentence-export.js b/yomichan-user/conf.d/sentence-export.js
index 176cdcd..f187b64 100644
--- a/yomichan-user/conf.d/sentence-export.js
+++ b/yomichan-user/conf.d/sentence-export.js
@@ -1,3 +1,5 @@
+{
+
async function exportSentence() {
var inputHTML = document.getElementById("query-parser-content");
var output = "";
@@ -43,10 +45,12 @@ function patchSearchBar() {
}
(() => {
- if (document.body.classList.contains("patched")) return;
+ if (document.body.classList.contains("sentence-export-patched")) return;
patchSearchBar();
- document.body.classList.add("patched");
+ document.body.classList.add("sentence-export-patched");
})();
+}
+
diff --git a/yomichan-user/conf.d/word-export.js b/yomichan-user/conf.d/word-export.js
index de036e4..8f512d6 100644
--- a/yomichan-user/conf.d/word-export.js
+++ b/yomichan-user/conf.d/word-export.js
@@ -1,3 +1,5 @@
+{
+
function exportWord(entry) {
var wordElement = entry.getElementsByClassName("headword-term")[0];
var hasKanji = false;
@@ -43,7 +45,7 @@ function exportWord(entry) {
function addWordCopyButtons() {
var definitions = document.getElementById("dictionary-entries").getElementsByClassName("entry");
for (var definition of definitions) {
- if (definition.classList.contains("patched")) continue;
+ if (definition.classList.contains("word-export-patched")) continue;
var actions = definition.getElementsByClassName("actions")[0];
var button = document.createElement("button");
@@ -59,7 +61,7 @@ function addWordCopyButtons() {
icon.setAttribute("data-title-default", title);
button.appendChild(icon);
actions.insertBefore(button, actions.childNodes[0]);
- definition.classList.add("patched");
+ definition.classList.add("word-export-patched");
}
}
@@ -75,3 +77,5 @@ function addWordCopyButtons() {
exportWord(document.getElementsByClassName("entry-current")[0]);
});
})();
+
+}