... | ... |
@@ -79,26 +79,18 @@ |
79 | 79 |
var book_id_str = $(this).attr('id'); |
80 | 80 |
var ret = book_id_str.match(/book-(\d+)/); |
81 | 81 |
var book_id = ret[1]; |
82 |
- var word; |
|
83 |
- % if ($word_length) { |
|
84 |
- % my $word_quote = $word; |
|
85 |
- % $word_quote =~ s/'/\'/g; |
|
86 |
- word = '<%= $word %>'; |
|
87 |
- % } |
|
88 | 82 |
|
89 | 83 |
$.get('/api/book/' + book_id + '/content', function (result) { |
90 | 84 |
|
91 |
- if (word) { |
|
85 |
+ if (current_word) { |
|
92 | 86 |
var i = 1; |
93 | 87 |
var replace_cb = function (all, group1) { |
94 | 88 |
var after = '<a style="background:#00ffff" id="word-' + i + '">' + group1 + '</a>'; |
95 | 89 |
i = i + 1; |
96 | 90 |
return after; |
97 | 91 |
}; |
98 |
- // var word_regex_quote = word.replace(/([^0-9A-Za-z_])/g, '\\$1'); |
|
99 |
- //alert(word_regex_quote); |
|
100 | 92 |
|
101 |
- var word_re = new RegExp('(' + word + ')', 'g'); |
|
93 |
+ var word_re = new RegExp('(' + current_word + ')', 'g'); |
|
102 | 94 |
result.content = result.content.replace(word_re, function (all, group1) { return replace_cb(all, group1); }); |
103 | 95 |
} |
104 | 96 |
|
... | ... |
@@ -126,6 +118,8 @@ |
126 | 118 |
$(this).find('.word-count').text(word_count_h[book_id]); |
127 | 119 |
} |
128 | 120 |
}); |
121 |
+ |
|
122 |
+ $('#word-count-header').text('回数'); |
|
129 | 123 |
}); |
130 | 124 |
|
131 | 125 |
current_word = word; |
... | ... |
@@ -173,7 +167,7 @@ |
173 | 167 |
<td> |
174 | 168 |
書 |
175 | 169 |
</td> |
176 |
- <td style="text-align:right"> |
|
170 |
+ <td id="word-count-header" style="text-align:right"> |
|
177 | 171 |
% if ($word_length) { |
178 | 172 |
回数 |
179 | 173 |
% } |