Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
krmanik committed Oct 5, 2022
1 parent dd9923c commit d6794a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
6 changes: 3 additions & 3 deletions card templates/Card 2/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<script>
if (Persistence.isAvailable()) {
if (Persistence.getItem("text-pinyin") == "true" && Persistence.getItem("text-zhuyin") == "false") {
document.querySelector(".question").innerHTML = "pinyin";
document.querySelector(".question-sub-text").innerHTML = "pinyin";
} else if (Persistence.getItem("text-pinyin") == "false" && Persistence.getItem("text-zhuyin") == "true") {
document.querySelector(".question").innerHTML = "zhuyin";
document.querySelector(".question-sub-text").innerHTML = "zhuyin";
} else {
document.querySelector(".question").innerHTML = "pinyin & zhuyin";
document.querySelector(".question-sub-text").innerHTML = "pinyin & zhuyin";
}
}

Expand Down
8 changes: 7 additions & 1 deletion card templates/Card 3/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,22 @@
}

var pinyinList = document.getElementById("char_pinyin").children;
var pinyinQuestionList = []
for (var pinyin of pinyinList) {
pinyin.innerText = removeToneMarks(pinyin);
var removedTone = removeToneMarks(pinyin);
if (!pinyinQuestionList.includes(removedTone)) {
pinyinQuestionList.push(removedTone)
}
}
document.getElementById("char_pinyin").innerText = pinyinQuestionList.join(", ");

var zhuyinList = document.getElementById("char_zhuyin").children;
var zhuyinQuestionList = []
for (var zhuyin of zhuyinList) {
zhuyin.innerText = zhuyin.innerText.replace("ˋ", "");
zhuyin.innerText = zhuyin.innerText.replace("ˊ", "");
zhuyin.innerText = zhuyin.innerText.replace("˙", "");
zhuyin.innerText = zhuyin.innerText.replace("ˇ", "");

if (!zhuyinQuestionList.includes(zhuyin.innerText)) {
zhuyinQuestionList.push(zhuyin.innerText)
Expand Down
16 changes: 10 additions & 6 deletions card templates/Card 5/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ <h3>xie hanzi</h3>
function setPrefs(e) {
if (e.id == "practice-select") {
Persistence.setItem(e.id, e.selectedIndex);
characters = document.getElementById("practice-select").selectedIndex == "0"
? document.getElementById('char_sim').innerHTML
: document.getElementById('char_trad').innerHTML;
doPractice();
}

if (e.type == "checkbox") {
Expand Down Expand Up @@ -480,6 +484,12 @@ <h3>xie hanzi</h3>
async function writeFunction(c) {
// Wrap the code inside a Promise constructor callback
return new Promise(function (resolve, reject) {
if (Persistence.getItem("text-grid") == "true") {
document.getElementById("char_grid").style.display = "block";
} else {
document.getElementById("char_grid").style.display = "none";
}

var writer = HanziWriter.create('grid-background-target', c, {
onLoadCharDataSuccess: function (data) {
document.getElementById("ch_load_status").style.color = "#4caf50";
Expand All @@ -501,12 +511,6 @@ <h3>xie hanzi</h3>
padding: 5
});

if (Persistence.getItem("text-grid") == "true") {
document.getElementById("char_grid").style.display = "block";
} else {
document.getElementById("char_grid").style.display = "none";
}

var revealClickCount = 0;
document.getElementById("btnRevealChar").onclick = function () {
btnTapAudio();
Expand Down

0 comments on commit d6794a6

Please sign in to comment.