Skip to content

Commit

Permalink
Make the IPA setting work without local storage
Browse files Browse the repository at this point in the history
Fixes #108.
  • Loading branch information
Willem3141 committed May 28, 2024
1 parent 9f6f973 commit bb99b6e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fraporu/ayvefya/reykunyu.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ $(function () {
});
$('#settings-modal button').popup();

$('#ipa-checkbox').prop('checked',
localStorage.getItem('reykunyu-ipa') === '1');
const dialect = localStorage.getItem('reykunyu-dialect');
$('#dialect-fn-radiobutton').prop('checked', dialect === 'FN');
$('#dialect-both-radiobutton').prop('checked', dialect === 'combined');
$('#dialect-rn-radiobutton').prop('checked', dialect === 'RN');
$('#settings-button').on("click", function () {
$('#ipa-checkbox').prop('checked',
localStorage.getItem('reykunyu-ipa') === '1');
$('#settings-modal').modal("show");
});

Expand Down Expand Up @@ -109,6 +109,10 @@ function getDialect() {
}
}

function getIPASetting() {
return $('#ipa-checkbox').is(':checked');
}

function setUpAutocomplete() {
let url = null;
if (getMode() === 'reykunyu') {
Expand Down Expand Up @@ -1232,7 +1236,7 @@ function createResultBlock(i, r) {
$resultWord.append(statusBadge(r["status"]));
}

if (localStorage.getItem('reykunyu-ipa') === '1') {
if (getIPASetting()) {
$resultWord.append(pronunciationSectionIpa(r["pronunciation"], r["type"]));
} else {
$resultWord.append(pronunciationSection(r["pronunciation"], r["type"]));
Expand Down

0 comments on commit bb99b6e

Please sign in to comment.