Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCommunication
chat_webview
Commits
95d6a023
Commit
95d6a023
authored
Jun 08, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed chat -add-user js
parent
582948f7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
74 deletions
+109
-74
public_new/js/chat-add-user.js
+109
-74
No files found.
public_new/js/chat-add-user.js
View file @
95d6a023
// 名前空間
var
CHAT_ADD_USER
=
{};
document
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
// メンバー検索
$
(
'#chat_add_user .search_form input[type="search"]'
).
click
(
function
(
e
)
{
bindMemberSearch
();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent
();
});
// ユーザー検索
CHAT_ADD_USER
.
searchUser
=
function
(
keyword
)
{
const
isAllGroup
=
$
(
"#tabAllGroupOnAddUser"
).
is
(
":checked"
);
const
overlayMessage
=
$
(
".overlay_src_msg"
);
overlayMessage
.
empty
();
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
const
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
searchGroupData
(
groupList
);
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
(
keyword
);
searchUserData
(
userList
);
// Set NoResult
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMessage
=
getNoResultMessage
();
overlayMessage
.
append
(
noResultMessage
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
(
keyword
);
searchUserData
(
userList
);
if
(
userList
.
length
==
0
)
{
const
noResultMessage
=
getNoResultMessage
();
overlayMessage
.
append
(
noResultMessage
);
}
}
};
/** UTILS */
var
bindMemberSearch
=
function
()
{
const
searchInput
=
$
(
'#chat_add_user .search_form input[type="search"]'
);
searchInput
.
click
(
function
(
e
)
{
//画面タイトル設定
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
"#addUserTitle"
).
text
(
contactListTitle
);
});
$
(
'#chat_add_user .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
var
keyword
=
$
(
'#chat_add_user .search_form input[type="search"]'
).
val
();
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
if
(
keyword
!=
""
&&
keyword
.
length
!=
0
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
searchInput
.
keyup
(
function
(
e
)
{
const
keyword
=
searchInput
.
val
();
const
enterKeyPressed
=
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
;
const
keywordNotEmpty
=
keyword
!=
""
&&
keyword
.
length
!=
0
;
const
keywordEmpty
=
keyword
==
""
||
keyword
.
length
<
2
;
if
(
enterKeyPressed
)
{
if
(
keywordNotEmpty
)
{
searchInput
.
blur
();
return
false
;
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
}
else
if
(
keyword
Empty
)
{
$
(
".overlay_src_msg"
).
empty
();
return
false
;
}
CHAT_ADD_USER
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
if
(
enterKeyPressed
)
{
searchInput
.
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#chat_add_user .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
};
var
bindiOSKeyBoardEvent
=
function
()
{
searchInput
.
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#chat_add_user .search_form input[type="search"]'
).
val
();
var
keyword
=
searchInput
.
val
();
CHAT_ADD_USER
.
searchUser
(
keyword
);
}
}
});
};
var
searchGroupData
=
function
(
groupList
)
{
const
groupTemplate
=
getGroupTemplate
();
groupList
.
forEach
(
function
(
group
)
{
let
html
=
renderGroupTemplate
(
groupTemplate
,
group
.
groupName
,
group
.
groupId
);
});
// ユーザー検索
CHAT_ADD_USER
.
searchUser
=
function
(
keyword
)
{
var
isAllGroup
=
$
(
"#tabAllGroupOnAddUser"
).
is
(
":checked"
);
$
(
".overlay_src_msg"
).
empty
()
;
let
obj
=
jQuery
.
parseHTML
(
html
);
overlayMessage
.
append
(
obj
);
}
);
}
;
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
var
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
getGroupTemplate
=
function
()
{
var
groupTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
},
...
...
@@ -56,50 +107,28 @@ CHAT_ADD_USER.searchUser = function (keyword) {
groupTemplate
=
text
;
}
);
return
groupTemplate
;
};
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
var
renderGroupTemplate
=
function
(
groupTemplate
,
groupName
,
groupID
)
{
return
Mustache
.
render
(
groupTemplate
,
{
name
:
groupName
,
id
:
groupID
,
});
};
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
var
searchUserData
=
function
(
userList
)
{
const
userTemplate
=
getUserTemplate
();
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
setUserProfile
(
user
);
checkUser
(
user
);
});
let
html
=
renderUserTemplate
(
userTemplate
,
userList
);
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
(
keyword
);
overlayMessage
.
append
(
obj
);
};
var
getUserTemplate
=
function
()
{
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
...
...
@@ -107,27 +136,33 @@ CHAT_ADD_USER.searchUser = function (keyword) {
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
return
userTemplate
;
};
var
setUserProfile
=
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
};
var
checkUser
=
function
(
user
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
};
var
renderUserTemplate
=
function
(
userTemplate
,
userList
)
{
return
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
)
;
$
(
".overlay_src_msg"
).
html
(
obj
);
if
(
userList
.
length
==
0
)
{
}
;
var
getNoResultMessage
=
function
(
)
{
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
}
return
noResultMsg
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment