... | ... |
@@ -12,6 +12,7 @@ |
12 | 12 |
var current_word; |
13 | 13 |
var current_book_id; |
14 | 14 |
var found_book_ids = []; |
15 |
+ var max_search_pos; |
|
15 | 16 |
|
16 | 17 |
var fragment = location.hash; |
17 | 18 |
var current_pos; |
... | ... |
@@ -40,8 +41,16 @@ |
40 | 41 |
var current_pos = $('#word-pos').text(); |
41 | 42 |
var next_pos = current_pos - 0 + 1; |
42 | 43 |
|
43 |
- if (next_pos > 10) { |
|
44 |
- |
|
44 |
+ if (next_pos > max_search_pos) { |
|
45 |
+ var next_book_id; |
|
46 |
+ for (var i = 0; i < found_book_ids.length; i++) { |
|
47 |
+ if (found_book_ids[i] === current_book_id) { |
|
48 |
+ next_book_id = found_book_ids[i + 1]; |
|
49 |
+ } |
|
50 |
+ } |
|
51 |
+ if (next_book_id) { |
|
52 |
+ $('#books tr[id=book-' + next_book_id + ']').find('.book').trigger('click'); |
|
53 |
+ } |
|
45 | 54 |
} |
46 | 55 |
else { |
47 | 56 |
location.href = '#word-' + next_pos; |
... | ... |
@@ -64,12 +73,16 @@ |
64 | 73 |
i = i + 1; |
65 | 74 |
return after; |
66 | 75 |
}; |
67 |
- |
|
76 |
+ |
|
68 | 77 |
var word_re = new RegExp('(' + current_word + ')', 'g'); |
69 | 78 |
result.content = result.content.replace(word_re, function (all, group1) { return replace_cb(all, group1); }); |
79 |
+ max_search_pos = i; |
|
70 | 80 |
} |
71 | 81 |
|
72 | 82 |
$("#content").html(result.content); |
83 |
+ if (current_word) { |
|
84 |
+ location.href = '#word-1'; |
|
85 |
+ } |
|
73 | 86 |
current_book_id = book_id; |
74 | 87 |
|
75 | 88 |
$('#books tr').each(function () { |
... | ... |
@@ -112,6 +125,8 @@ |
112 | 125 |
$('#word-count-header').text('回数'); |
113 | 126 |
|
114 | 127 |
current_word = word; |
128 |
+ |
|
129 |
+ $('#up-down').css('display', 'inline'); |
|
115 | 130 |
}); |
116 | 131 |
|
117 | 132 |
} |
... | ... |
@@ -135,11 +150,11 @@ |
135 | 150 |
<div style="margin-bottom:10px;"> |
136 | 151 |
<table style="border-collapse: collapse;width:100%;color:#333333"> |
137 | 152 |
<tr> |
138 |
- <td style="width:90px"> |
|
153 |
+ <td style="width:90px;height:25px;"> |
|
139 | 154 |
<a href="<%= url_for('/') %>" style="color:blue">聖書</a> |
140 | 155 |
</td> |
141 | 156 |
<td> |
142 |
- <span id="up-down"> |
|
157 |
+ <span id="up-down" style="display:none"> |
|
143 | 158 |
<a id="up-arrow" href="javascript:void()">▲</a> |
144 | 159 |
<div id="word-pos" style="display:inline-block;border:1px solid #DDDDDD;padding:2px 5px;width:35px;text-align:center"> |
145 | 160 |
</div> |