aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
authorSuhaib Khan <suhebjerk@gmail.com>2014-02-23 00:22:52 +0530
committerCesar G <prototech91@gmail.com>2014-04-23 09:11:39 -0700
commitaa23cf64cae6710f556c8d43528d28cff6d6a775 (patch)
treefe494d3588ff8f6945e410e8b0f81fd65040ea61 /phpBB/assets/javascript
parente644c67dcf4a505759533c42e0c511fab93028ae (diff)
downloadforums-aa23cf64cae6710f556c8d43528d28cff6d6a775.tar
forums-aa23cf64cae6710f556c8d43528d28cff6d6a775.tar.gz
forums-aa23cf64cae6710f556c8d43528d28cff6d6a775.tar.bz2
forums-aa23cf64cae6710f556c8d43528d28cff6d6a775.tar.xz
forums-aa23cf64cae6710f556c8d43528d28cff6d6a775.zip
[ticket/10737] Avoid hard-coding table row and use case-insensitive search.
PHPBB3-10737
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/core.js28
1 files changed, 18 insertions, 10 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index c2291c7001..82c78ae715 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -515,26 +515,34 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
// Listen live search box events
$('.liveinput').keyup(function() {
var str = this.value;
- var j = 0;
if (str.length < 3) {
- $("#livesearch").innerHTML="";
- return;
- }
-
+ 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) {
- j = (idx%2)+1;
- $("#livesearch").append("<tr class='bg" + j + " row" + j + "'><td><a href='memberlist.php?mode=viewprofile&u=" + elem.id + "' target='_blank'>" + elem.name + "</a></td></tr>");
- })
- }
+ 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");
+ });
+ }
});
});
$('.liveinput').blur(function() {
setTimeout(function () {
- document.getElementById("livesearch").innerHTML="";
+ var clone = $("#user-search-row-tpl").clone();
+ $("#livesearch").html("");
+ clone.appendTo("#livesearch");
}, 500);
});