Skip to content
Browse files

Add support for selecting between multiple dictionaries.

  • Loading branch information...
1 parent 9f12090 commit e75da74e80326c3ff548d37d44b4eaa697daef72 @valderman committed Jan 17, 2012
Showing with 81 additions and 2 deletions.
  1. +25 −0 assets/js/exquisitioner.js
  2. +1 −0 assets/js/ready.js
  3. +46 −0 dicts/basic46.lst
  4. +1 −0 index.html
  5. +8 −2 style.css
View
25 assets/js/exquisitioner.js
@@ -7,6 +7,31 @@ function Exquisitioner(list){
this.currentQIndex = undefined;
this.list = {};
this.ansField;
+ this.dictList = $("#dictList");
+
+ var that = this;
+ this.dictList.change(function() {
+ that.loadList(that.dictList[0].value);
+ });
+
+ // Refresh the list of dictionaries the user can choose from
+ this.refreshLists = function() {
+ $.ajax({
+ url: 'api.php?do=getDicts',
+ error: function(a, b) {
+ console.log(a, b);
+ },
+ success: function(res) {
+ var lists = $.parseJSON(res);
+ that.dictList.empty();
+ for(var i in lists) {
+ var v = lists[i];
+ var elem = $('<option value="'+v+'">'+v+'</option>');
+ that.dictList.append(elem);
+ }
+ }
+ });
+ }
// Attempt to get a list of questions from the list loader.
// If the attempt fails, the active list remains unchanged.
View
1 assets/js/ready.js
@@ -1,5 +1,6 @@
$(document).ready(function (){
var quiz = new Exquisitioner();
quiz.loadList('hiragana');
+ quiz.refreshLists();
quiz.setAnsField($("#answer"));
});
View
46 dicts/basic46.lst
@@ -0,0 +1,46 @@
+a:あ
+i:い
+u:う
+e:え
+o:お
+ka:か
+ki:き
+ku:く
+ke:け
+ko:こ
+sa:さ
+shi:し
+su:す
+se:せ
+so:そ
+ta:た
+chi:ち
+tsu:つ
+te:て
+to:と
+na:な
+ni:に
+nu:ぬ
+ne:ね
+no:の
+ha:は
+hi:ひ
+fu:ふ
+he:へ
+ho:ほ
+ma:ま
+mi:み
+mu:む
+me:め
+mo:も
+ya:や
+yu:ゆ
+yo:よ
+ra:ら
+ri:り
+ru:る
+re:れ
+ro:ろ
+wa:わ
+wo:を
+n:ん
View
1 index.html
@@ -17,6 +17,7 @@
<div id="masterWrapper">
<div id="menu">
<h1>Glosie</h1>
+ <select id="dictList"></select>
</div>
<div id="main">
View
10 style.css
@@ -92,5 +92,11 @@ body {
font-style: normal;
}
-
-
+#dictList {
+ position: absolute;
+ top: 0em;
+ right: 0em;
+ float: right;
+ margin-top: 0.75em;
+ margin-right: 1em;
+}

0 comments on commit e75da74

Please sign in to comment.
Something went wrong with that request. Please try again.