jensechu/kanji — pull request #17 by rfindley (2014-09-14 03:07:14+00:00)
Title: Group WaniKani kanji by level

This pull causes WaniKani kanji to be sorted by WaniKani achievement level.

![image](https://cloud.githubusercontent.com/assets/3749564/4262786/edf15bb4-3bb7-11e4-82ca-393d73cb34e1.png)

Each WaniKani level is implemented as 'subcategory' under the top-level WaniKani 'category'. The header for each subcategory is clickable. Clicking will cause the selection status for all kanji in the corresponding level to be toggled. In other words, if you click "Level 1", all level 1 kanji will be selected. Click again and they will be deselected.

Regarding possible additional uses of this code:
Currently, all of the JLPT levels (N5 to N1) exist as top-level categories. This implementation would allow placing "JLPT" as the top-level category, and the N5 to N1 levels as subcategories. The levels would then be clickable, allowing all of the kanji in a level to be selected/deselected at once. This modification would be implemented by adding a subcategory field to the data structure in the current kanji.json database. Example:

```javascript
{
"category": "JLPT", // Top-level category becomes generic 'JLPT' instead of 'jlptn5'
"subcategory": "N5", // Subcategory is added, containing the JLPT level
"character": "日",
"onyomi": "ニチ ジツ -",
"kunyomi": "ひ -び",
"meaning": "day, sun, Japan"
}
```

In addition to JLPT, some users have expressed interest in adding support for the "Genki" and "Japanese for Busy People" textbooks, including separating the kanji by chapter or 'Lesson', This would be implemented in the same manner as described for JLPT.

This code also adds a 'natural' comparison function, which aids sorting of labels that contain numbers. For example, a normal string sort would place "Level 10" before "Level 2". Natural sort allows these to be sorted by numerical order instead of string order.