Anki Template to search in Kanji Study app (android) with 1 tap!

So with the help of Copilot and android debugging, I've got an anki template that when clicking a kanji searches the kanji study app if its installed and set up. It only runs on Ankidroid, and is very editable by going to browse cards –> Fields. Then just changing {{Word}} and wordField to whatever the name of your anki card field is i.e. {{Term}} and {{termField}}.
Unfortunately I could only get the search to work and not a one click pathway to the kanji index pages, but if anyone knows how please share (╯˘ -˘ )╯

If it's working the kanji will be in blue, with a line under it when hovered.

Figured this would be a good idea to keep using Kanji Study as I move to anki, because I have the outlier dictionary and a bunch of similar but more semantic etymological explanations I found online for free put in my notes section (Kanji networks' ones).

**Front Template*\*

<div id="wordField">{{Word}}</div>

<script>

function lookupKanji(char) {

const uri = "intent:#Intent;action=android.intent.action.PROCESS_TEXT;"

+ "component=com.mindtwisted.kanjistudy/.activity.SearchActivity;"

+ "S.android.intent.extra.PROCESS_TEXT=" + encodeURIComponent(char) + ";end";

window.location.href = uri;

}

function makeClickable(text) {

return text.split('').map(c => {

if (/[\u4E00-\u9FFF]/.test(c)) {

return "<span class='kanji-clickable' onclick=\\"lookupKanji('" + c + "')\\">" + c + "</span>";

} else {

return c;

}

}).join('');

}

// Only run this on AnkiDroid (Android WebView)

if (navigator.userAgent.toLowerCase().includes("android")) {

const wordDiv = document.getElementById("wordField");

wordDiv.innerHTML = makeClickable(wordDiv.innerText);

}

</script>

**CSS*\*

.card {

font-family: arial;

font-size: 20px;

line-height: 1.5;

text-align: center;

color: black;

background-color: white;

}

#wordField .kanji-clickable {

cursor: pointer;

color: #2a5db0;

}

#wordField .kanji-clickable:hover {

text-decoration: underline;

}

by NoMotivation1717