Commit MetaInfo

修订版cb43cde8df437edddec88f95f42c8eb1ecd24d89 (tree)
时间2018-05-14 00:57:11
作者umorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2433 search2 plugin: Show search progress

更改概述

差异

--- a/plugin/search2.inc.php
+++ b/plugin/search2.inc.php
@@ -300,6 +300,8 @@ EOD;
300300
301301 $plain_search_link = '<a href="' . $script . '?cmd=search' . '">' . htmlsc($_btn_search) . '</a>';
302302 $alt_msg = str_replace('$1', $plain_search_link, $_msg_use_alternative_link);
303+ $status_span_text = '<span class="_plugin_search2_search_status_text1"></span>' .
304+ '<span class="_plugin_search2_search_status_text2"></span>';
303305 $form =<<<EOD
304306 <form action="$script" method="GET" class="_plugin_search2_form">
305307 <div>
@@ -312,7 +314,7 @@ $base_option
312314 EOD;
313315 $second_form =<<<EOD
314316 <div class="_plugin_search2_second_form" style="display:none;">
315-<div class="_plugin_search2_search_status"></div>
317+<div class="_plugin_search2_search_status">$status_span_text</span></div>
316318 <div class="_plugin_search2_message"></div>
317319 $form
318320 </div>
@@ -349,12 +351,41 @@ EOD;
349351 <noscript>
350352 <p>$_msg_unsupported_webbrowser $alt_msg</p>
351353 </noscript>
354+<style>
355+input#_plugin_search2_detail:checked ~ ul > div.search-result-detail {
356+ display:block;
357+}
358+input#_plugin_search2_detail ~ ul > div.search-result-detail {
359+ display:none;
360+}
361+._plugin_search2_search_status {
362+ min-height:1.5em;
363+}
364+@keyframes plugin-search2-searching {
365+ 10% { opacity: 1; }
366+ 40% { opacity: 0; }
367+ 70% { opacity: 0; }
368+ 90% { opacity: 1; }
369+}
370+span.plugin-search2-progress {
371+ animation: plugin-search2-searching 1.5s infinite ease-out;
372+}
373+span.plugin-search2-progress1 {
374+ animation-delay: -1s;
375+}
376+span.plugin-search2-progress2 {
377+ animation-delay: -0.8s;
378+}
379+span.plugin-search2-progress3 {
380+ animation-delay: -0.6s;
381+}
382+</style>
352383 <p class="_plugin_search2_nosupport_message" style="display:none;">
353384 $_msg_unsupported_webbrowser $alt_msg
354385 </p>
355386 $search_props
356387 $form
357-<div class="_plugin_search2_search_status"></div>
388+<div class="_plugin_search2_search_status">$status_span_text</div>
358389 <div class="_plugin_search2_message"></div>
359390 $result_page_panel
360391 $second_form
--- a/skin/pukiwiki.css
+++ b/skin/pukiwiki.css
@@ -655,15 +655,6 @@ tr.bugtrack_state_undef td {
655655 }
656656
657657 /* search2.inc.php */
658-input#_plugin_search2_detail:checked ~ ul > div.search-result-detail {
659- display:block;
660-}
661-input#_plugin_search2_detail ~ ul > div.search-result-detail {
662- display:none;
663-}
664-._plugin_search2_search_status {
665- min-height:1.5em;
666-}
667658 .search-result-page-summary {
668659 font-size:70%;
669660 color:gray;
--- a/skin/search2.js
+++ b/skin/search2.js
@@ -289,10 +289,35 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
289289 /**
290290 * @param {string} statusText
291291 */
292- function setSearchStatus(statusText) {
292+ function setSearchStatus(statusText, statusText2) {
293293 var statusList = document.querySelectorAll('._plugin_search2_search_status');
294294 forEach(statusList, function(statusObj) {
295- statusObj.textContent = statusText;
295+ var textObj1 = statusObj.querySelector('._plugin_search2_search_status_text1');
296+ var textObj2 = statusObj.querySelector('._plugin_search2_search_status_text2');
297+ if (textObj1) {
298+ var prevText = textObj1.getAttribute('data-text');
299+ if (prevText !== statusText) {
300+ textObj1.setAttribute('data-text', statusText);
301+ if (statusText.substr(statusText.length - 3) === '...') {
302+ var firstHalf = statusText.substr(0, statusText.length - 3);
303+ textObj1.textContent = firstHalf;
304+ var span = document.createElement('span');
305+ span.innerHTML = '<span class="plugin-search2-progress plugin-search2-progress1">.</span>'
306+ + '<span class="plugin-search2-progress plugin-search2-progress2">.</span>'
307+ + '<span class="plugin-search2-progress plugin-search2-progress3">.</span>';
308+ textObj1.appendChild(span);
309+ } else {
310+ textObj1.textContent = statusText;
311+ }
312+ }
313+ }
314+ if (textObj2) {
315+ if (statusText2) {
316+ textObj2.textContent = ' ' + statusText2;
317+ } else {
318+ textObj2.textContent = '';
319+ }
320+ }
296321 });
297322 }
298323 /**
@@ -723,7 +748,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
723748 if (prevTimestamp) {
724749 setSearchStatus(searchProps.searchingMsg);
725750 } else {
726- setSearchStatus(searchProps.searchingMsg + ' ' +
751+ setSearchStatus(searchProps.searchingMsg,
727752 getSearchProgress(session));
728753 }
729754 if (searchDone) {
@@ -733,7 +758,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
733758 if (singlePageResult) {
734759 setSearchStatus('');
735760 } else {
736- setSearchStatus(searchProps.showingResultMsg + ' ' + progress);
761+ setSearchStatus(searchProps.showingResultMsg, progress);
737762 }
738763 }, 2000);
739764 }
@@ -777,7 +802,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
777802 localStorage[key] = JSON.stringify(session);
778803 // Stop API calling
779804 setSearchMessage(msg + ' ' + getOffsetLinks(session, maxResults));
780- setSearchStatus(searchProps.showingResultMsg + ' ' +
805+ setSearchStatus(searchProps.showingResultMsg,
781806 getSearchProgress(session));
782807 } else {
783808 setTimeout(function() {
@@ -823,7 +848,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
823848 var moreResultHtml = getOffsetLinks(session, maxResults);
824849 setSearchMessage(msg + ' ' + moreResultHtml);
825850 var progress = getSearchProgress(session);
826- setSearchStatus(searchProps.showingResultMsg + ' ' + progress);
851+ setSearchStatus(searchProps.showingResultMsg, progress);
827852 } else {
828853 setSearchStatus('');
829854 }
--- a/skin/tdiary.css
+++ b/skin/tdiary.css
@@ -531,15 +531,6 @@ tr.bugtrack_state_undef td {
531531 }
532532
533533 /* search2.inc.php */
534-input#_plugin_search2_detail:checked ~ ul > div.search-result-detail {
535- display:block;
536-}
537-input#_plugin_search2_detail ~ ul > div.search-result-detail {
538- display:none;
539-}
540-._plugin_search2_search_status {
541- min-height:1.5em;
542-}
543534 .search-result-page-summary {
544535 font-size:70%;
545536 color:gray;
Show on old repository browser