mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-28 04:20:32 +02:00
[ticket/10737] Adding delayed keyup and removing target_blank.
PHPBB3-10737
This commit is contained in:
@@ -513,37 +513,48 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
|
||||
};
|
||||
|
||||
// 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() {
|
||||
var str = this.value;
|
||||
if (str.length < 3) {
|
||||
return;
|
||||
}
|
||||
var link, name;
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
$.ajax({
|
||||
url:'memberlist.php?mode=livesearch&'+"&q="+str,
|
||||
success:function(result) {
|
||||
$.each(result, function(idx, elem) {
|
||||
link = "memberlist.php?mode=viewprofile&u=" + elem.id;
|
||||
name = elem.name;
|
||||
clone = $("#user-search-row-tpl").clone();
|
||||
clone.find(".user-search-link").attr("href", link);
|
||||
clone.find(".user-search-name").html(name);
|
||||
clone.attr("style", "");
|
||||
clone.appendTo("#livesearch");
|
||||
});
|
||||
delay(function(){
|
||||
if (str.length < 3) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
var link, name;
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
$.ajax({
|
||||
url:'memberlist.php?mode=livesearch&'+"&q="+str,
|
||||
success:function(result) {
|
||||
$.each(result, function(idx, elem) {
|
||||
link = "memberlist.php?mode=viewprofile&u=" + elem.id;
|
||||
name = elem.name;
|
||||
clone = $("#user-search-row-tpl").clone();
|
||||
clone.find(".user-search-link").attr("href", link);
|
||||
clone.find(".user-search-name").html(name);
|
||||
clone.attr("style", "");
|
||||
clone.appendTo("#livesearch");
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 2000 );
|
||||
});
|
||||
|
||||
$('.live-search-input').blur(function() {
|
||||
setTimeout(function () {
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
}, 500);
|
||||
$(document).click(function(event) {
|
||||
var target = $( event.target );
|
||||
if(!target.is("#livesearch, #livesearch *, .live-search-input")) {
|
||||
var clone = $("#user-search-row-tpl").clone();
|
||||
$("#livesearch").html("");
|
||||
clone.appendTo("#livesearch");
|
||||
}
|
||||
});
|
||||
|
||||
// Toggle notification list
|
||||
|
Reference in New Issue
Block a user