• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revision017521b5596b16c021281b1b42f085d3d0f01588 (tree)
Time2020-03-22 00:44:54
Authorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2508 Fix Search result for halfwidth kigo chars

Change Summary

Incremental Difference

--- a/skin/search2.js
+++ b/skin/search2.js
@@ -262,9 +262,9 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function
262262 */
263263 function textToRegex (searchText) {
264264 if (!searchText) return null
265- // 1: Alphabet 2:Katakana 3:Hiragana 4:Other symbols
266- var regRep = /([a-zA-Z0-9])|([\u30a1-\u30f6])|([\u3041-\u3096])|([\u0021-\u007e])/ig
267- var replacementFunc = function (m, m1, m2, m3, m4) {
265+ // 1: Alphabet 2:Katakana 3:Hiragana 4:Wa kigo 5:Other symbols
266+ var regRep = /([a-zA-Z0-9])|([\u30a1-\u30f6])|([\u3041-\u3096])|([\u30fb\u30fc\u300c\u300d\u3001\u3002])|([\u0021-\u007e])/ig
267+ var replacementFunc = function (m, m1, m2, m3, m4, m5) {
268268 if (m1) {
269269 // [a-zA-Z0-9]
270270 return '[' + m1 + toZenkaku(m1) + ']'
@@ -287,8 +287,14 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function
287287 r2 += ')'
288288 return r2
289289 } else if (m4) {
290+ // Wa kigo
291+ if (kanaMap[m4]) {
292+ return '[' + m4 + kanaMap[m4] + ']'
293+ }
294+ return m4
295+ } else if (m5) {
290296 // Other symbols
291- return '[' + '\\' + m4 + toZenkaku(m4) + ']'
297+ return '[' + '\\' + m5 + toZenkaku(m5) + ']'
292298 }
293299 return m
294300 }
Show on old repository browser