Skip to content

Commit

Permalink
katakana is not hiragana
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Mar 13, 2022
1 parent b185a78 commit f36eabe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jpdb-freq-list.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @namespace https://github.com/MarvNC
// @match https://jpdb.io/deck
// @match https://jpdb.io/*/vocabulary-list*
// @version 1.14
// @version 1.15
// @require https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js
// @author Marv
Expand All @@ -14,6 +14,9 @@ let delayMs = 1200;

const kanaSymbol = '㋕';
const unusedSymbol = '❌';
const hiraganaRegex = /^[\u3040-\u309F]+$/;

const isHiragana = (str) => hiraganaRegex.test(str);

const fileName = (deckname) => `[Freq] ${deckname}_${new Date().toISOString()}.zip`;

Expand Down Expand Up @@ -141,7 +144,7 @@ const entriesPerPage = 50;
for (const entry of entries) {
const kanji = decodeURIComponent(entry.href).split('/')[5].replace('#a', '');
const entryID = entry.href.split('/')[4];
const isKana = !entry.querySelector('rt');
const isKana = !entry.querySelector('rt') ? isHiragana(kanji) : false;
const furi = [...entry.querySelectorAll('ruby')]
.map((ruby) => {
if (ruby.childElementCount > 0) {
Expand Down

0 comments on commit f36eabe

Please sign in to comment.