aboutsummaryrefslogtreecommitdiff
path: root/yomichan-user
diff options
context:
space:
mode:
Diffstat (limited to 'yomichan-user')
-rw-r--r--yomichan-user/.gitignore1
-rw-r--r--yomichan-user/assets/draw.svg5
-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
m---------yomichan-user/lib/handwriting.js0
-rw-r--r--yomichan-user/makefile10
-rw-r--r--yomichan-user/readme.md6
9 files changed, 59 insertions, 4 deletions
diff --git a/yomichan-user/.gitignore b/yomichan-user/.gitignore
index 6473ba0..513b772 100644
--- a/yomichan-user/.gitignore
+++ b/yomichan-user/.gitignore
@@ -6,3 +6,4 @@ yomichan-user.css
yomichan-user.js
conf.d/sentence-export.css
conf.d/word-export.css
+conf.d/handwriting.css
diff --git a/yomichan-user/assets/draw.svg b/yomichan-user/assets/draw.svg
new file mode 100644
index 0000000..fe0cfb9
--- /dev/null
+++ b/yomichan-user/assets/draw.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M14.8351 2.45796C15.055 2.66802 15.055 3.02813 14.8351 3.2482L13.8157 4.25852L11.737 2.17787L12.7564 1.15755C12.9663 0.947484 13.326 0.947484 13.5359 1.15755L14.8351 2.45796Z" fill="currentColor"/>
+<path d="M7 9V6.91935L11.1474 2.76805L13.2261 4.8487L9.0787 9H7Z" fill="currentColor"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.95795 11.151C5.29309 11.032 4.80508 10.8883 4.49736 10.7398C4.43508 10.7098 4.3871 10.6831 4.35042 10.6605C4.39679 10.6138 4.46685 10.5518 4.57183 10.4746C4.93206 10.2096 5.54937 9.88435 6.50509 9.50933L5.95718 8.11298C4.95588 8.50588 4.19815 8.8874 3.68311 9.2662C3.21741 9.60871 2.71998 10.1196 2.77558 10.8014C2.83182 11.491 3.41238 11.8818 3.84547 12.0908C4.33272 12.3259 4.97503 12.4989 5.69365 12.6275C6.10515 12.7012 6.42398 12.7797 6.66454 12.8566C5.53946 13.2603 3.27761 13.4716 1.14956 12.9557L0.796188 14.4135C3.21654 15.0002 5.82977 14.7754 7.24994 14.2395C7.60311 14.1062 7.95739 13.9267 8.21164 13.6775C8.34289 13.5489 8.47947 13.3704 8.5485 13.1374C8.62266 12.8871 8.60269 12.6257 8.49369 12.3886C8.30225 11.9723 7.8873 11.7309 7.52883 11.578C7.13196 11.4087 6.60801 11.2674 5.95795 11.151ZM4.23993 10.5751L4.24163 10.5774L4.23993 10.5751Z" fill="currentColor"/>
+</svg>
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]);
});
})();
+
+}
diff --git a/yomichan-user/lib/handwriting.js b/yomichan-user/lib/handwriting.js
new file mode 160000
+Subproject 6d41109d3293295a7d7678d0cb97f483d28f47e
diff --git a/yomichan-user/makefile b/yomichan-user/makefile
index e0e543d..68a103b 100644
--- a/yomichan-user/makefile
+++ b/yomichan-user/makefile
@@ -2,27 +2,37 @@
M4FLAGS += -I./assets/
+JSMIN := uglifyjs
+CSSMIN := uglifycss
+
all: yomichan-user.js yomichan-user.css
user.js: conf.d/lib.js
+user.js: lib/handwriting.js/handwriting.canvas.js
+
user.js: conf.d/sentence-export.js
user.css: conf.d/sentence-export.css
user.css: conf.d/custom.css
user.js: conf.d/word-export.js
user.css: conf.d/word-export.css
user.js: conf.d/shortcuts.js
+user.js: conf.d/handwriting.js
+user.css: conf.d/handwriting.css
include ../common.mk
assets/copy.svg.b64: assets/copy.svg
assets/copy-bitmap.svg.b64: assets/copy-bitmap.svg
+assets/draw.svg.b64: assets/draw.svg
GARBAGE += assets/copy.svg.b64
GARBAGE += assets/copy-bitmap.svg.b64
+GARBAGE += assets/draw.svg.b64
# extra dependencies
conf.d/sentence-export.css: assets/copy.svg.b64
conf.d/sentence-export.css: conf.d/sentence-export.css.m4
conf.d/word-export.css: assets/copy-bitmap.svg.b64
+conf.d/handwriting.css: assets/draw.svg.b64
user.js:
cat $^ > $@
diff --git a/yomichan-user/readme.md b/yomichan-user/readme.md
index cead831..50f9423 100644
--- a/yomichan-user/readme.md
+++ b/yomichan-user/readme.md
@@ -35,3 +35,9 @@ adds the following shortcuts to yomichan:
|<kbd>Alt</kbd>+<kbd>J</kbd>|select next definition (move down)|
|<kbd>Alt</kbd>+<kbd>K</kbd>|select previous definition (move up)|
|<kbd>Alt</kbd>+<kbd>G</kbd>|scroll back to top|
+
+## handwriting
+
+adds handwriting input panel to yomichan (WIP)
+
+