AnkiNoteTemplate/templates/Japanese fallback/template.json
2021-07-10 14:30:25 -03:00

32 lines
13 KiB
JSON

{
"modelName": "Japanese fallback",
"inOrderFields": [
"SentKanji",
"SentFurigana",
"SentEng",
"SentAudio",
"MorphManFocus",
"VocabKanji",
"VocabFurigana",
"VocabPitchPattern",
"VocabPitchNum",
"VocabDef",
"VocabAudio",
"Image",
"Notes",
"MakeProductionCard"
],
"css": "@charset \"utf-8\";\n@font-face {\n\tfont-family: \"KanjiStrokeOrders\";\n\tsrc:\n\t\tlocal(\"KanjiStrokeOrders\"),\n\t\turl(\"_kso.ttf\");\n}\n@font-face {\n\tfont-family: \"Yu Mincho\";\n\tsrc:\n\t\tlocal(\"Yu Mincho\"),\n\t\tlocal(\"\u6e38\u660e\u671d\"),\n\t\turl(\"_yumin.ttf\");\n}\n@font-face {\n\tfont-family: \"Yu Mincho\";\n\tsrc:\n\t\tlocal(\"Yu Mincho Demibold\"),\n\t\tlocal(\"\u6e38\u660e\u671d Demibold\"),\n\t\turl(\"_yumindb.ttf\");\n\tfont-weight: 600;\n}\n\n* { box-sizing: border-box; padding: 0; margin: 0; }\n.card {\n\tbackground-color: #FFFAF0;\n\tcolor: #2A1B0A;\n\tfont-family:\t\"Noto Serif\",\n\t\t\t\t\t\t\t\t\t\"Noto Serif CJK JP\",\n\t\t\t\t\t\t\t\t\tYu Mincho,\n\t\t\t\t\t\t\t\t\t\"Liberation Serif\",\n\t\t\t\t\t\t\t\t\t\"Times New Roman\",\n\t\t\t\t\t\t\t\t\tTimes,\n\t\t\t\t\t\t\t\t\tGeorgia,\n\t\t\t\t\t\t\t\t\tSerif;\n\tfont-size: 24px;\n\ttext-align: left;\n\tline-height: 1.4;\n\tmax-width: 800px;\n\tmargin: 0 auto;\n}\n.card1 { }\n.card2 .jpsentence ruby rt { opacity: 0; }\n.card2 .jpsentence:hover ruby rt { opacity: 1; }\n\nhr { margin: 2px 0; clear: both; }\nb { font-weight: 600; }\n.jpsentence b { color: grey; }\n\n/* links */\na { color: gray; }\na:hover { color: #722a2a ; }\na.hint { text-decoration: none; text-align: left; display: block; }\n\n/* Hide furigana on front */\nnokana ruby rt { opacity:0.0; font-size:0; display: none; }\nnotext b { background-color: black; color:transparent; }\n\n/* Top */\nheader { font-size: 14px; line-height: 18px; clear: both; }\nheader > div:not(:last-child) { margin-right: 3px; }\n\n/* Space between elements */\n.images { margin-top: 16px; }\n.images > img { margin-bottom: 16px; }\n\n/* Japanese sentence */\n.jpsentence { font-size: 35px; }\n\n.tags {\n\tfont-family: \"Noto Sans\", \"Noto Sans CJK JP\", \"Liberation Sans\", Arial, Sans, sans-serif;\n\ttext-align: center;\n\tdisplay: inline-block;\n\ttext-transform: lowercase;\n\tbackground-color: #333;\n\tcolor: #FFFAF0;\n\tfont-weight: bold;\n\tpadding: 1px 3px;\n\tmargin: 0;\n\tcursor: pointer;\n\tborder-radius: 3px;\n\tfont-size: 12px;\n\tline-height: 14px;\n}\n\n/* AnkiDroid peplay button */\n.replaybutton { margin: 0; margin-right: 3px; text-decoration: none; }\n.replaybutton span { padding: 0; font-size: 16px; }\n.replaybutton span svg {\n\tfill: #FFFAF0;\n\tbackground: #333;\n\tborder-radius: 3px;\n\tvertical-align: top; \n\tmin-width: 16px;\n\tmin-height: 16px;\n}\n\n/* PC peplay button */\na.replay-button { top: -.125em; position: relative; }\na.replay-button svg {\n\theight: 1em;\n\twidth: 1em;\n}\na.replay-button svg path { fill: #FFFAF0; }\na.replay-button svg circle { fill: #333; }\n\n/* Footer and links */\nfooter {font-size: 16px; text-align: center; }\nfooter>a { text-decoration: none; }\nfooter > a:after {content:\"\u00b7\"; color: brown; display: inline-block; width: 6px; }\nfooter > a:last-child:after {content:\"\"; width: 0; }\n\n/* Vocab */\n.vocab { margin-top: 16px; }\n.vocab div { display: inline-block; }\n.vocab br { display: none; }\n.vocab > .tags { vertical-align: top; }\n.notes > .tags { vertical-align: bottom; }\n\n/* Images */\n.images {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tflex-direction: row;\n\talign-items: flex-start;\n\talign-content: space-between;\n\tjustify-content: space-evenly;\n}\n.images > img {\n\tmax-width: 47%;\n\tborder-radius: 4px;\n\tfilter: sepia(33%);\n}\n.images>img:only-child {\n max-width: 100%;\n}\n\n/* Production cards */\n.production b { visibility: hidden; }\n.strokeorder {\n\ttext-align: center;\n\tfont-size: 150px;\n\tfont-family: KanjiStrokeOrders;\n}\n\n/* Morphman coloring */\n.fside .jpsentence:hover [mtype=unknown] { background-color: #ffff99; }\n.fside .jpsentence:hover [mtype=seen] { background-color: #ffd1b3; }\n.fside .jpsentence:hover [mtype=known] { background-color: #b3e6cc; }\n.fside .jpsentence:hover [mtype=mature] { background-color: transparent; }\n.fside .jpsentence:hover [priority=true] { }\n.fside .jpsentence:hover [frequency=true] { }\n\ndel.MorphManHide, del.morphmanhide {display:none;}\n\n/* Fix for Yomichan defs */\nul, ol {\n list-style-type: none; \n display: inline;\n margin: 0px;\n padding: 0px;\n}\n/* Fix for Yomichan pitch accents */\n.vocab ol > li { display: inline; }\n.vocab ol > li:after { content: \"\u30fb\"; }\n.vocab ol > li:last-child:after { content: \"\"; }\n\n/* Fallback config */\n\n/*\n#flip[data-line]::after {\n position:absolute;\n font-size: 50%; \n content: \"\u21f5\";\n}\n*/\n\n#flip[data-line=\"\"]::after {\n content: \"\";\n}\n \n#flip[data-line]:hover span, .hover[data-line] span {\n display:none;\n}\n \n#flip[data-line=\"\"]:hover span, .hover[data-line=\"\"] span {\n display:block;\n}\n \n#flip:hover::before, .hover::before {\n content: attr(data-line);\n}\n\n/* Fallback sentence */\n.fallback { font-size: 45px; }\n.fallback { text-align: center; }\n.fallback:hover { text-align: left; }\n\n/* Fallback config */",
"cardTemplates": [
{
"Name": "Recognition",
"Front": "\n<header>\n\t{{#MorphManFocus}}\n\t\t<div class=\"tags\">{{MorphManFocus}}</div>\n\t{{/MorphManFocus}}\n\t{{#Tags}}\n\t\t<div class=\"tags\">{{Tags}}</div>\n\t{{/Tags}}\n</header>\n\n<div class=\"fallback\" lang=\"ja\" id='flip' data-line='{{SentKanji}}'><span>{{furigana:VocabKanji}}</span></div>\n \n<script>\n //handle html that anki may put into the sentence field\n var s = document.getElementById(\"flip\").dataset.line;\n if (s.length > 0) {\n s = s.replace(/<br>|<div>/ig, '\\r\\n');\n s = s.replace(/<[^<]*>/ig, '');\n document.getElementById(\"flip\").dataset.line = s;\n \n //https://ankiweb.net/shared/info/1642550423\n document.addEventListener(\"keyup\", e=>{\n if(e.shiftKey) {\n if(document.getElementById(\"flip\").classList.contains(\"hover\"))\n document.getElementById(\"flip\").classList.remove(\"hover\");\n else\n document.getElementById(\"flip\").classList.add(\"hover\");\n }\n });\n }\n</script>\n\n<!--\n<div class=\"jpsentence\" lang=\"ja\">\n\t{{morphHighlight:furigana:SentKanji}}\n\t{{^SentKanji}}\n\t\t<nokana>{{kanji:SentFurigana}}</nokana>\n\t{{/SentKanji}}\n</div>\n-->\n\n<div style=\"display:none;\">\n\t<div id=\"pitchnum_hidden\">{{VocabPitchNum}}</div>\n\t<div id=\"kanaword_hidden\">{{kana:VocabFurigana}}</div>\n</div>\n\n<script>\n\t/* Paints the question word according to its Pitch Accent number.\n\t * blue for \u5e73\u677f\n\t * red for \u982d\u9ad8\n\t * orange for \u4e2d\u9ad8\n\t * green for \u5c3e\u9ad8\n\t */\n\tfunction markPitch() {\n\t\tvar pitchNumber = document.getElementById(\"pitchnum_hidden\");\n\t\tif (pitchNumber === null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tpitchNumber = pitchNumber.innerHTML.match(/\\d/);\n\t\t}\n\t\tif (pitchNumber === null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tpitchNumber = Number(pitchNumber);\n\t\t}\n\n\t\t/* Then decide what color to use and change font color accordingly. */\n\t\tif ( pitchNumber == 0 ) {\n\t\t\t// use blue for \u5e73\u677f\n\t\t\tpaintTargetWord(\"#3366CC\");\n\t\t} else if ( pitchNumber == 1 ) {\n\t\t\t// use red for \u982d\u9ad8\n\t\t\tpaintTargetWord(\"red\");\n\t\t} else if ( pitchNumber > 1 ) {\n\t\t\tif ( odaka(pitchNumber) ) {\n\t\t\t\t// use green for \u5c3e\u9ad8\n\t\t\t\tpaintTargetWord(\"green\");\n\t\t\t} else {\n\t\t\t\t// use orange for \u4e2d\u9ad8\n\t\t\t\tpaintTargetWord(\"#ff6207\");\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction paintTargetWord(color) {\n\t\tfor (sentence of document.getElementsByClassName(\"jpsentence\")) {\n\t\t\tfor (word of sentence.getElementsByTagName(\"b\")) {\n\t\t\t\tword.style.color = color;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction odaka(pitch_num) {\n\t\t// word is odaka if number of moras is equal to pitch accent position\n\t\tconst vocab_kana = document.getElementById(\"kanaword_hidden\");\n\t\tif (vocab_kana === null) {\n\t\t\treturn false;\n\t\t}\n\t\t// small \u3063 is one mora; \u3083\u3085\u3087 are parts of single mora\n\t\tconst n_moras = vocab_kana.innerHTML.replace(/[\u30e3\u30e5\u30e7\u3083\u3085\u3087]/g, '').length;\n\t\tif ( n_moras == pitch_num ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/* Splits tags into separate divs */\n\tfunction splitTagDiv() {\n\t\tconst header = document.getElementsByTagName(\"header\")[0];\n\t\tif (!header) return;\n\t\tconst tags = \"{{MorphManFocus}} {{Tags}}\".split(\" \");\n\t\theader.innerHTML = \"\";\n\n\t\tfor (const tag of tags){\n\t\t\tif (tag.length < 1)\n\t\t\t\tcontinue;\n\t\t\tconst tag_elem = document.createElement(\"div\");\n\t\t\ttag_elem.className = \"tags\";\n\t\t\ttag_elem.innerHTML = tag;\n\t\t\theader.appendChild(tag_elem);\n\t\t}\n\t}\n\n\tdocument.addEventListener('DOMContentLoaded', markPitch(), false);\n\tdocument.addEventListener('DOMContentLoaded', splitTagDiv(), false);\n</script>",
"Back": "<div class=\"fside\">{{FrontSide}}</div>\n<hr id=\"answer\">\n<div class=\"jpsentence\" lang=\"ja\">\n\t{{morphHighlight:furigana:SentFurigana}}\n\t{{^SentFurigana}}{{furigana:SentKanji}}{{/SentFurigana}}\n</div>\n\n{{#SentEng}}\n<details>\n <summary><div class=\"tags\">eng</summary>\n\t<div lang=\"en\">\n\t\t{{SentEng}}\n</div>\n</details>\n{{/SentEng}}\n\n<div class=\"vocab\">\n{{VocabAudio}}{{SentAudio}}\n{{VocabPitchPattern}}{{^VocabPitchPattern}}{{kana:VocabFurigana}}{{/VocabPitchPattern}}\n{{#VocabPitchNum}}<span class=\"tags\" id=\"pitchnum\">{{VocabPitchNum}}</span>{{/VocabPitchNum}}{{#VocabKanji}}\u3010{{kanji:VocabKanji}}\u3011{{/VocabKanji}}\n</div>\n\n{{#VocabDef}}\t\n<div class=\"definitions\">{{furigana:VocabDef}}</div>\n{{/VocabDef}}\n\n{{#Image}}<div class=\"images\" >{{Image}}</div>{{/Image}}\n\n{{#Notes}}\n<details>\n <summary><div class=\"tags\">Notes</summary>\n<div class=\"notes\">\n\t<div>{{furigana:Notes}}</div>\n</div>\n</details>\n{{/Notes}}\n\n<hr>\n\n<footer>{{#SentKanji}}<a \n\thref=\"https://jisho.org/search?keyword={{kanji:text:SentKanji}}\" title=\"Sentence on Jisho\">Jisho</a><a\nhref=\"https://ichi.moe/cl/qr/?q={{kanji:text:SentKanji}} &r=kana\" title=\"Sentence on Ichi.moe\">Ichi.moe</a>{{/SentKanji}}{{#VocabKanji}}<a\n\thref=\"https://www.google.co.jp/search?q={{kanji:text:VocabKanji}}&tbm=isch\" title=\"Search images\">Images</a><a\n\thref=\"http://www.weblio.jp/content/{{text:VocabKanji}}\" title=\"Vocab on Weblio\">Weblio</a><a\n\thref=\"https://sentencesearch.neocities.org/#{{text:VocabKanji}}\" title=\"Vocab on SentenceSearch\">Sentences</a>{{/VocabKanji}}</footer\n>\n\n<script>\n\tfunction removePitchBrackets() {\n\t\tconst tags = document.getElementById(\"pitchnum\");\n\t\tif (tags !== null) {\n\t\t\ttags.innerHTML = tags.innerHTML.replace(/(\\[(?=\\d)|(?<=\\d)\\])/g, \"\");\n\t\t}\n\t}\n\tdocument.addEventListener('DOMContentLoaded', markPitch(), false);\n\tdocument.addEventListener('DOMContentLoaded', removePitchBrackets(), false);\t\n</script>"
},
{
"Name": "Production",
"Front": "{{#MakeProductionCard}}\n{{#SentKanji}}\n\n<header>{{#Tags}}<div class=\"tags\">{{Tags}}</div>{{/Tags}}</header>\n{{#Image}}<div class=\"images\" >{{Image}}</div>{{/Image}}\n<div class=\"jpsentence production\">{{furigana:SentFurigana}}</div>\n<div style=\"text-align: center;\">{{VocabAudio}}{{SentAudio}}</div>\n<script>\n\tdocument.addEventListener('DOMContentLoaded', threeDots(), false);\n\n\tfunction threeDots() {\n\t\tconst sent = document.getElementsByClassName(\"production\")[0];\n\t\tif (sent) {\n\t\t\tconst hidden = sent.getElementsByTagName(\"b\");\n\t\t\tfor (i = 0; i < hidden.length; i++) {\n\t\t\t\tif (hidden[i]) {\n\t\t\t\t\thidden[i].style.visibility = \"visible\";\n\t\t\t\t\t//hidden[i].innerText = \"\u3010{{kana:VocabFurigana}}\u3011\";\n\t\t\t\t\thidden[i].innerText = \"\u3010\"+hidden[i].innerText.replace(/[^\u3041-\u3093\u30a1-\u30f3]/g, \"\")+\"\u3011\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</script>\n\n{{/SentKanji}}\n{{/MakeProductionCard}}",
"Back": "{{FrontSide}}\n\n<hr>\n\n<div lang=\"en\" >{{SentEng}}</div>\n<div class=\"strokeorder\">{{VocabKanji}}</div>\n\n{{#VocabKanji}}\n\t<div class=\"vocab\">\n\t\t{{VocabPitchPattern}}\n\t\t{{^VocabPitchPattern}}{{kana:VocabFurigana}}{{/VocabPitchPattern}}\n\t\t{{#VocabPitchNum}}\n\t\t\t<span class=\"tags\">{{VocabPitchNum}}</span>\n\t\t{{/VocabPitchNum}}\n\t\t\u3010{{VocabKanji}}\u3011\n\t</div>\n{{/VocabKanji}}\n\n{{#VocabDef}}\t\n\t<div class=\"definitions\">\n\t\t{{furigana:VocabDef}}\n\t</div>\n{{/VocabDef}}\n\n{{#Notes}}\t\n\t<div class=\"notes\">\n\t\t<div class=\"tags\">Notes</div>\n\t\t<div>{{furigana:Notes}}</div>\n\t</div>\n{{/Notes}}\n\n<hr>\n\n<footer>{{#SentKanji}}<a href=\"https://jisho.org/search?keyword={{text:SentKanji}}\" title=\"Sentence on Jisho\">Jisho</a><a href=\"https://www.google.co.jp/search?q={{text:SentKanji}}&tbm=isch\" title=\"Search images\">Images</a>{{/SentKanji}}{{#VocabKanji}}<a href=\"http://tangorin.com/dict.php?dict=general&s={{text:VocabKanji}}\">Tangorin</a><a href=\"http://www.weblio.jp/content/{{text:VocabKanji}}\">Weblio</a><a href=\"https://wadoku.de/search/?q={{text:VocabKanji}}\">Wadoku</a>\t{{/VocabKanji}}</footer>"
}
]
}