diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-01-29 17:42:29 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-01-29 17:42:29 +0100 |
commit | e87f29e017a75af15d228d537bc20b9fc78ace24 (patch) | |
tree | cc4a7b76192d32290b569bedbcd8fedec9d7cda2 /yomichan-user | |
parent | 34ea3829e7cb435a4357b43fcfff514fdd39083e (diff) |
update sentense-export to work with user.js
Diffstat (limited to 'yomichan-user')
-rw-r--r-- | yomichan-user/.gitignore | 7 | ||||
-rw-r--r-- | yomichan-user/conf.d/custom.css (renamed from yomichan-user/custom.css) | 0 | ||||
-rw-r--r-- | yomichan-user/conf.d/sentence-export.css.m4 | 1 | ||||
-rw-r--r-- | yomichan-user/conf.d/sentence-export.js (renamed from yomichan-user/sentence-export.js) | 10 | ||||
-rw-r--r-- | yomichan-user/header.txt.m4 | 5 | ||||
-rw-r--r-- | yomichan-user/makefile | 32 | ||||
-rw-r--r-- | yomichan-user/readme.md | 28 | ||||
-rw-r--r-- | yomichan-user/sentence-export.css | 1 |
8 files changed, 51 insertions, 33 deletions
diff --git a/yomichan-user/.gitignore b/yomichan-user/.gitignore new file mode 100644 index 0000000..6230d27 --- /dev/null +++ b/yomichan-user/.gitignore @@ -0,0 +1,7 @@ +*.b64 +header.txt +user.css +user.js +yomichan-user.css +yomichan-user.js +conf.d/sentence-export.css diff --git a/yomichan-user/custom.css b/yomichan-user/conf.d/custom.css index 7ce95f8..7ce95f8 100644 --- a/yomichan-user/custom.css +++ b/yomichan-user/conf.d/custom.css diff --git a/yomichan-user/conf.d/sentence-export.css.m4 b/yomichan-user/conf.d/sentence-export.css.m4 new file mode 100644 index 0000000..eb0b5ac --- /dev/null +++ b/yomichan-user/conf.d/sentence-export.css.m4 @@ -0,0 +1 @@ +.icon[data-icon=copy] { --icon-image: url`(data:image/svg+xml;base64,'undivert(copy.svg.b64)`)'; } diff --git a/yomichan-user/sentence-export.js b/yomichan-user/conf.d/sentence-export.js index 3b2a476..fb034d1 100644 --- a/yomichan-user/sentence-export.js +++ b/yomichan-user/conf.d/sentence-export.js @@ -63,23 +63,13 @@ function patchSearchBar() { searchBarOuter.insertBefore(button, searchBarOuter.childNodes[2]); } -function patchCSS() { - var csslink = document.createElement("link"); - csslink.setAttribute("rel", "stylesheet"); - csslink.setAttribute("type", "text/css"); - csslink.setAttribute("href", "/css/sentence-export.css"); - document.head.appendChild(csslink); -} - function run() { if (document.body.classList.contains("patched")) return; patchSearchBar(); - patchCSS(); document.body.classList.add("patched"); } run(); -window.onload = () => run(); diff --git a/yomichan-user/header.txt.m4 b/yomichan-user/header.txt.m4 new file mode 100644 index 0000000..f7f4152 --- /dev/null +++ b/yomichan-user/header.txt.m4 @@ -0,0 +1,5 @@ +include(`common.m4')dnl +/* yomichan user config version VERSION() + generated at TIMESTAMP() + https://git.pipeframe.xyz/lonkaars/refold-tools */ + diff --git a/yomichan-user/makefile b/yomichan-user/makefile new file mode 100644 index 0000000..b965974 --- /dev/null +++ b/yomichan-user/makefile @@ -0,0 +1,32 @@ +.PHONY: clean + +all: yomichan-user.js yomichan-user.css + +user.js: conf.d/sentence-export.js +user.css: conf.d/sentence-export.css + +user.css: conf.d/custom.css + +include ../common.mk + +copy.svg.b64: copy.svg + +conf.d/sentence-export.css: copy.svg.b64 +conf.d/sentence-export.css: conf.d/sentence-export.css.m4 + +user.js: + cat $^ > $@ + +user.css: + cat $^ > $@ + +header.txt: header.txt.m4 + +yomichan-user.js: header.txt user.min.js + cat $^ > $@ +yomichan-user.css: header.txt user.min.css + cat $^ > $@ + +clean: + $(RM) user.js user.css user.min.js user.min.css header.txt yomichan-user.css yomichan-user.js + diff --git a/yomichan-user/readme.md b/yomichan-user/readme.md index e82bb00..6b0e0ed 100644 --- a/yomichan-user/readme.md +++ b/yomichan-user/readme.md @@ -1,32 +1,16 @@ # yomichan stuff -## custom css +this is a folder containing yomichan stuff -this is just a custom theme, and can be easily installed by pasting the -contents of [custom.css](custom.css) into yomichan's settings. +all .js and .css files in conf.d get minified into user.min.js and +user.min.css, and can be pasted into yomichan (with [user script +patch](../yomichan/readme.md)) ## sentence export -this patches the yomichan plugin files to add an export button to the search -bar for copying a sentence with furigana into my custom anki card template. +adds an export button to the search bar for copying a sentence with furigana +into [my custom anki card template](../anki-card-template/readme.md). ![new copy button in yomichan search bar](../assets/copy-button-yomichan.png) ![copied sentence in anki](../assets/copy-button-anki.png) -### set-up - -to download the latest yomichan version and patch it, leaving all files exposed -for later updating (unpacked extension), run the following command: - -``` -make patch -``` - -to patch yomichan and convert it back to a zip (packed extension, non-signed, -for use with kiwi browser), run: - -``` -make yomichan-chrome-patched.zip -``` - -if you want to update the patch or zip, replace `make` with `make -B`. diff --git a/yomichan-user/sentence-export.css b/yomichan-user/sentence-export.css deleted file mode 100644 index eb2ecea..0000000 --- a/yomichan-user/sentence-export.css +++ /dev/null @@ -1 +0,0 @@ -.icon[data-icon=copy] { --icon-image: url(/images/copy.svg); } |