Revision | aeca84f13eb57ee3b3cc02cdf0952f330d81dca2 (tree) |
---|---|
Zeit | 2019-08-16 02:23:09 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2489 search2 plugin - Async search now refers $show_passage
@@ -227,6 +227,7 @@ function get_html_scripting_data($page, $in_editing) | ||
227 | 227 | global $external_link_cushion_page, $external_link_cushion; |
228 | 228 | global $topicpath_title; |
229 | 229 | global $ticket_jira_default_site; |
230 | + global $show_passage; | |
230 | 231 | if (!isset($ticket_link_sites) || !is_array($ticket_link_sites)) { |
231 | 232 | return ''; |
232 | 233 | } |
@@ -240,10 +241,12 @@ function get_html_scripting_data($page, $in_editing) | ||
240 | 241 | EOS; |
241 | 242 | return $empty_data; |
242 | 243 | } |
244 | + $is_show_passage = (bool)($show_passage !== 0); | |
243 | 245 | // Site basic Properties |
244 | 246 | $props = array( |
245 | 247 | 'is_utf8' => $is_utf8, |
246 | 248 | 'json_enabled' => $json_enabled, |
249 | + 'show_passage' => $is_show_passage, | |
247 | 250 | 'base_uri_pathname' => get_base_uri(PKWK_URI_ROOT), |
248 | 251 | 'base_uri_absolute' => get_base_uri(PKWK_URI_ABSOLUTE) |
249 | 252 | ); |
@@ -658,6 +658,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
658 | 658 | * @param {boolean} insertTop |
659 | 659 | */ |
660 | 660 | function addSearchResult(results, searchText, searchRegex, parentElement, insertTop) { |
661 | + var props = getSiteProps(); | |
661 | 662 | var now = new Date(); |
662 | 663 | var parentFragment = document.createDocumentFragment(); |
663 | 664 | results.forEach(function(val) { |
@@ -670,8 +671,12 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
670 | 671 | decoratedName = escapeHTML(val.name); |
671 | 672 | } |
672 | 673 | var updatedAt = val.updatedAt; |
673 | - var liHtml = '<a href="' + escapeHTML(href) + '">' + decoratedName + '</a> ' + | |
674 | - getPassage(now, updatedAt); | |
674 | + var passageHtml = ''; | |
675 | + if (props.show_passage) { | |
676 | + passageHtml = ' ' + getPassage(now, updatedAt); | |
677 | + } | |
678 | + var liHtml = '<a href="' + escapeHTML(href) + '">' + | |
679 | + decoratedName + '</a>' + passageHtml; | |
675 | 680 | li.innerHTML = liHtml; |
676 | 681 | li.setAttribute('data-pagename', val.name); |
677 | 682 | fragment.appendChild(li); |