• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionecfda231c93a5d24f1477316fe687d05eae8445e (tree)
Zeit2019-08-16 02:48:47
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2490 search2 plugin: Only li element allowed as ul child

Ändern Zusammenfassung

Diff

--- a/plugin/search2.inc.php
+++ b/plugin/search2.inc.php
@@ -352,10 +352,10 @@ EOD;
352352 <p>$_msg_unsupported_webbrowser $alt_msg</p>
353353 </noscript>
354354 <style>
355-input#_plugin_search2_detail:checked ~ ul > div.search-result-detail {
355+input#_plugin_search2_detail:checked ~ ul > li > div.search-result-detail {
356356 display:block;
357357 }
358-input#_plugin_search2_detail ~ ul > div.search-result-detail {
358+input#_plugin_search2_detail ~ ul > li > div.search-result-detail {
359359 display:none;
360360 }
361361 ._plugin_search2_search_status {
--- a/skin/search2.js
+++ b/skin/search2.js
@@ -654,15 +654,14 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
654654 * @param {Array<Object>} results
655655 * @param {string} searchText
656656 * @param {RegExp} searchRegex
657- * @param {Element} parentElement
657+ * @param {Element} parentUlElement
658658 * @param {boolean} insertTop
659659 */
660- function addSearchResult(results, searchText, searchRegex, parentElement, insertTop) {
660+ function addSearchResult(results, searchText, searchRegex, parentUlElement, insertTop) {
661661 var props = getSiteProps();
662662 var now = new Date();
663663 var parentFragment = document.createDocumentFragment();
664664 results.forEach(function(val) {
665- var fragment = document.createDocumentFragment();
666665 var li = document.createElement('li');
667666 var hash = '#q=' + encodeSearchTextForHash(searchText);
668667 var href = val.url + hash;
@@ -679,7 +678,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
679678 decoratedName + '</a>' + passageHtml;
680679 li.innerHTML = liHtml;
681680 li.setAttribute('data-pagename', val.name);
682- fragment.appendChild(li);
681+ // Page detail div
683682 var div = document.createElement('div');
684683 div.classList.add('search-result-detail');
685684 var head = document.createElement('div');
@@ -693,13 +692,14 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
693692 div.appendChild(pre);
694693 }
695694 div.setAttribute('data-pagename', val.name);
696- fragment.appendChild(div);
697- parentFragment.appendChild(fragment);
695+ // Add li to ul (parentUlElement)
696+ li.appendChild(div);
697+ parentFragment.appendChild(li);
698698 });
699- if (insertTop && parentElement.firstChild) {
700- parentElement.insertBefore(parentFragment, parentElement.firstChild);
699+ if (insertTop && parentUlElement.firstChild) {
700+ parentUlElement.insertBefore(parentFragment, parentUlElement.firstChild);
701701 } else {
702- parentElement.appendChild(parentFragment);
702+ parentUlElement.appendChild(parentFragment);
703703 }
704704 }
705705 function removeCachedResultsBase(keepTodayCache) {