リビジョン | 06e9aa8418ee14e3db091607e0c3c7576be2673a (tree) |
---|---|
日時 | 2017-10-05 04:33:10 |
作者 | umorigu <umorigu@gmai...> |
コミッター | umorigu |
Color simple qwq
@@ -286,13 +286,6 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
286 | 286 | var liHtml = '<a href="' + escapeHTML(href) + '">' + decoratedName + '</a> ' + |
287 | 287 | getPassage(now, updatedAt); |
288 | 288 | li.innerHTML = liHtml; |
289 | - var a = li.querySelector('a'); | |
290 | - if (a && a.hash) { | |
291 | - if (a.hash !== hash) { | |
292 | - // Some browser execute encodeHTML(hash) automatically. Support them. | |
293 | - a.href = val.url + '#encq=' + encodeSearchTextForHash(searchText); | |
294 | - } | |
295 | - } | |
296 | 289 | li.setAttribute('data-pagename', val.name); |
297 | 290 | fragment.appendChild(li); |
298 | 291 | var div = document.createElement('div'); |
@@ -724,7 +717,6 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
724 | 717 | return null; |
725 | 718 | } |
726 | 719 | function getSearchTextInLocationHash() { |
727 | - // TODO Cross browser | |
728 | 720 | var hash = location.hash; |
729 | 721 | if (!hash) return ''; |
730 | 722 | var q = ''; |
@@ -733,6 +725,10 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
733 | 725 | } else if (hash.substr(0, 6) === '#encq=') { |
734 | 726 | q = decodeURIComponent(hash.substr(6).replace(/\+/g, ' ')); |
735 | 727 | } |
728 | + var decodedQ = decodeURIComponent(q); | |
729 | + if (q !== decodedQ) { | |
730 | + q = decodedQ + ' OR ' + q; | |
731 | + } | |
736 | 732 | return q; |
737 | 733 | } |
738 | 734 | function colorSearchTextInBody() { |