Commit 7f83361b by Lee Munkyeong

メッセージ検索

parent 51874fc0
......@@ -21,11 +21,11 @@
<!-- ナビメニュー -->
<nav>
<div class="chat_room_src_form none">
<form class="d-flex flex-row h-100 align-items-center">
<div class="d-flex flex-row h-100 align-items-center">
<input type="search" name="search" placeholder="ユーザー検索">
<span class="src_icon"></span>
<a href="#" class="cancel">キャンセル</a>
</form>
</div>
</div>
<div class="row nav_item_wrap h-100 align-items-center">
<div class="col-4 pr-0">
......
......@@ -414,20 +414,23 @@ $(function() {
// チャットルーム
// メッセージ検索イベント
$('.chat_room_src_form input[type="search"]').keyup(function(e){
var keyword = $('.chat_room_src_form input[type="search"]').val();
if (e.key == "Enter" || e.KeyCode == 13) {
$('.chat_room_src_form input[type="search"]').blur();
return ;
if (keyword != '' && keyword.length != 0) {
$('.chat_room_src_form input[type="search"]').blur();
return;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
return;
}
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
$('.overlay_src_msg').empty();
var checkedUserList = [];
$('.img_wrap.filter').each(function(user) {
var selectedUser = $('.img_wrap.filter')[user];
checkedUserList.push($(selectedUser).data('user-id'));
})
if (keyword.length < 2) { return; }
var messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(','));
var userMessageTemplate;
$.get({ url: "./template/template_user_message.html", async: false }
......@@ -476,6 +479,10 @@ $(function() {
noResultMsg.append(getLocalizedString("noResult"))
jQueryMessages.append(noResultMsg);
}
if (e.key == "Enter" || e.KeyCode == 13) {
$('#contact .search_form input[type="search"]').blur();
return;
}
});
$('.filter_img').on('click', function() {
......@@ -487,7 +494,7 @@ $(function() {
var selectedUser = $('.img_wrap.filter')[user];
checkedUserList.push($(selectedUser).data('user-id'));
})
if (keyword.length < 2) { return; }
if (keyword.length == 1) { return; }
var messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(','));
var userMessageTemplate;
$.get({ url: "./template/template_user_message.html", async: false }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment