| ... | ... |
@@ -15,6 +15,7 @@ |
| 15 | 15 |
var max_search_pos; |
| 16 | 16 |
var current_word_count_h; |
| 17 | 17 |
var current_pos; |
| 18 |
+ var keep_current_pos = false; |
|
| 18 | 19 |
|
| 19 | 20 |
$("#word-pos").text('-');
|
| 20 | 21 |
|
| ... | ... |
@@ -31,6 +32,7 @@ |
| 31 | 32 |
} |
| 32 | 33 |
if (prev_book_id) {
|
| 33 | 34 |
current_pos = current_word_count_h[prev_book_id]; |
| 35 |
+ keep_current_pos = true; |
|
| 34 | 36 |
$('#books tr[id=book-' + prev_book_id + ']').find('.book').trigger('click');
|
| 35 | 37 |
} |
| 36 | 38 |
} else {
|
| ... | ... |
@@ -55,6 +57,7 @@ |
| 55 | 57 |
} |
| 56 | 58 |
if (next_book_id) {
|
| 57 | 59 |
current_pos = 1; |
| 60 |
+ keep_current_pos = true; |
|
| 58 | 61 |
$('#books tr[id=book-' + next_book_id + ']').find('.book').trigger('click');
|
| 59 | 62 |
} |
| 60 | 63 |
} |
| ... | ... |
@@ -89,14 +92,6 @@ |
| 89 | 92 |
} |
| 90 | 93 |
|
| 91 | 94 |
$("#content").html(result.content);
|
| 92 |
- if (current_word) {
|
|
| 93 |
- if (!current_pos) {
|
|
| 94 |
- current_pos = 1; |
|
| 95 |
- } |
|
| 96 |
- location.href = '#word-' + current_pos; |
|
| 97 |
- scroll_little_up (); |
|
| 98 |
- $('#word-pos').text(current_pos);
|
|
| 99 |
- } |
|
| 100 | 95 |
current_book_id = book_id; |
| 101 | 96 |
|
| 102 | 97 |
$('#books tr').each(function () {
|
| ... | ... |
@@ -111,6 +106,16 @@ |
| 111 | 106 |
} |
| 112 | 107 |
} |
| 113 | 108 |
}); |
| 109 |
+ |
|
| 110 |
+ if (current_word) {
|
|
| 111 |
+ if (!keep_current_pos || !current_pos) {
|
|
| 112 |
+ current_pos = 1; |
|
| 113 |
+ } |
|
| 114 |
+ $('#word-pos').text(current_pos);
|
|
| 115 |
+ location.href = '#word-' + current_pos; |
|
| 116 |
+ scroll_little_up (); |
|
| 117 |
+ } |
|
| 118 |
+ keep_current_pos = false; |
|
| 114 | 119 |
}); |
| 115 | 120 |
}); |
| 116 | 121 |
|
| ... | ... |
@@ -174,7 +179,7 @@ |
| 174 | 179 |
|
| 175 | 180 |
<div id="side"> |
| 176 | 181 |
<div style="margin-bottom:5px"> |
| 177 |
- <input type="text" name="word", style = "width:160px"> |
|
| 182 |
+ <input type="text" name="word", style = "width:160px" value="アブラハム"> |
|
| 178 | 183 |
<button id="search" style="width:50px;padding:2px;">検索</button> |
| 179 | 184 |
</div> |
| 180 | 185 |
<div style="margin-bottom:10px;"> |