• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

修订版20d617b41561d5d93d6cf3ffd5ea22b038f290bf (tree)
时间2017-09-18 08:00:36
作者umorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2433 Control Search Request interval

更改概述

差异

--- a/plugin/search2.inc.php
+++ b/plugin/search2.inc.php
@@ -11,6 +11,7 @@ define('PLUGIN_SEARCH2_MAX_BASE', 16); // #search(1,2,3,...,15,16)
1111
1212 define('PLUGIN_SEARCH2_RESULT_RECORD_LIMIT', 500);
1313 define('PLUGIN_SEARCH2_RESULT_RECORD_LIMIT_START', 100);
14+define('PLUGIN_SEARCH2_SEARCH_WAIT_MILLISECONDS', 1000);
1415
1516 // Show a search box on a page
1617 function plugin_search2_convert()
@@ -196,6 +197,7 @@ EOD;
196197 }
197198 $_search2_result_notfound = htmlsc($_msg_notfoundresult);
198199 $_search2_result_found = htmlsc($_msg_andresult);
200+ $_search2_search_wait_milliseconds = PLUGIN_SEARCH2_SEARCH_WAIT_MILLISECONDS;
199201 $result_page_panel =<<<EOD
200202 <div id="_plugin_search2_search_status"></div>
201203 <div id="_plugin_search2_message"></div>
@@ -203,6 +205,7 @@ EOD;
203205 <input type="hidden" id="_plugin_search2_msg_searching" value="$_search_searching">
204206 <input type="hidden" id="_plugin_search2_msg_result_notfound" value="$_search2_result_notfound">
205207 <input type="hidden" id="_plugin_search2_msg_result_found" value="$_search2_result_found">
208+<input type="hidden" id="_search2_search_wait_milliseconds" value="$_search2_search_wait_milliseconds">
206209 EOD;
207210 if ($h_search_text == '') {
208211 $result_page_panel = '';
--- a/skin/search2.js
+++ b/skin/search2.js
@@ -10,7 +10,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
1010 var aroundLines = 2;
1111 var maxResultLines = 20;
1212 var minBlockLines = 5;
13- var searchWaitMilliseconds = 100;
13+ var minSearchWaitMilliseconds = 100;
1414 function escapeHTML (s) {
1515 if(typeof s !== 'string') {
1616 s = '' + s;
@@ -114,9 +114,19 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
114114 ul.appendChild(fragment);
115115 });
116116 if (!obj.search_done && obj.next_start_index) {
117+ var waitE = document.querySelector('#_search2_search_wait_milliseconds');
118+ var interval = minSearchWaitMilliseconds;
119+ try {
120+ interval = parseInt(waitE.value);
121+ } catch (e) {
122+ interval = minSearchWaitMilliseconds;
123+ }
124+ if (interval < minSearchWaitMilliseconds) {
125+ interval = minSearchWaitMilliseconds;
126+ }
117127 setTimeout(function(){
118128 doSearch(searchText, session, obj.next_start_index);
119- }, searchWaitMilliseconds);
129+ }, interval);
120130 }
121131 }
122132 function textToRegex(searchText) {