mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10737] Adding delayed keyup and removing target_blank.
PHPBB3-10737
This commit is contained in:
parent
6ef4e4e790
commit
a60d9a7f86
3 changed files with 39 additions and 28 deletions
|
@ -513,8 +513,17 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Listen live search box events
|
// Listen live search box events
|
||||||
|
var delay = (function(){
|
||||||
|
var timer = 0;
|
||||||
|
return function(callback, ms){
|
||||||
|
clearTimeout (timer);
|
||||||
|
timer = setTimeout(callback, ms);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
$('.live-search-input').keyup(function() {
|
$('.live-search-input').keyup(function() {
|
||||||
var str = this.value;
|
var str = this.value;
|
||||||
|
delay(function(){
|
||||||
if (str.length < 3) {
|
if (str.length < 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -536,14 +545,16 @@ $('.live-search-input').keyup(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}, 2000 );
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.live-search-input').blur(function() {
|
$(document).click(function(event) {
|
||||||
setTimeout(function () {
|
var target = $( event.target );
|
||||||
|
if(!target.is("#livesearch, #livesearch *, .live-search-input")) {
|
||||||
var clone = $("#user-search-row-tpl").clone();
|
var clone = $("#user-search-row-tpl").clone();
|
||||||
$("#livesearch").html("");
|
$("#livesearch").html("");
|
||||||
clone.appendTo("#livesearch");
|
clone.appendTo("#livesearch");
|
||||||
}, 500);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle notification list
|
// Toggle notification list
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox live-search-input" autocomplete="off" />
|
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox live-search-input" autocomplete="off" />
|
||||||
<table class="table1 zebra-list" id="livesearch">
|
<table class="table1 zebra-list" id="livesearch">
|
||||||
<tr id="user-search-row-tpl" style="display: none;">
|
<tr id="user-search-row-tpl" style="display: none;">
|
||||||
<td><a class="user-search-link user-search-name" target="_blank"></a></td>
|
<td><a class="user-search-link user-search-name" ></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<input class="post live-search-input" type="text" name="username" value="{USERNAME}" autocomplete="off" />
|
<input class="post live-search-input" type="text" name="username" value="{USERNAME}" autocomplete="off" />
|
||||||
<table class="tablebg" id="livesearch">
|
<table class="tablebg" id="livesearch">
|
||||||
<tr id="user-search-row-tpl" style="display: none;">
|
<tr id="user-search-row-tpl" style="display: none;">
|
||||||
<td><a class="user-search-link user-search-name" target="_blank"></a></td>
|
<td><a class="user-search-link user-search-name" ></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue