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
1a39aefa
Commit
1a39aefa
authored
Jun 08, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adopt js lint
parent
d1e0e0f0
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1467 additions
and
1015 deletions
+1467
-1015
public_new/js/archive.js
+24
-18
public_new/js/chat-add-user.js
+62
-46
public_new/js/chat-db.js
+116
-73
public_new/js/chat-error.js
+2
-2
public_new/js/chat-room.js
+6
-6
public_new/js/chat-util.js
+59
-55
public_new/js/chat-websocket.js
+244
-190
public_new/js/chat.js
+426
-256
public_new/js/chatMakeRoom.js
+62
-46
public_new/js/collaboration.js
+90
-82
public_new/js/common.js
+26
-27
public_new/js/constant.js
+38
-38
public_new/js/contact.js
+49
-34
public_new/js/loading.js
+4
-3
public_new/js/share.js
+259
-139
No files found.
public_new/js/archive.js
View file @
1a39aefa
// 名前空間
var
ARCHIVE_UI
=
{};
$
(
function
()
{
$
(
function
()
{
// アーカイブ検索
$
(
'#archive .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#archive .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
var
keyword
=
$
(
'#archive .search_form input[type="search"]'
).
val
();
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
if
(
keyword
.
length
!=
0
&&
keyword
!=
''
)
{
if
(
keyword
.
length
!=
0
&&
keyword
!=
""
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
$
(
'.overlay_src_msg'
).
empty
();
$
(
".overlay_src_msg"
).
empty
();
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
...
...
@@ -25,26 +25,31 @@ $(function() {
// 検索結果を表示
});
// iOSキーボード変換検知用
$
(
'#archive .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
()
{
$
(
'#archive .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#archive .search_form input[type="search"]'
).
val
();
$
(
'.overlay_src_msg'
).
empty
();
$
(
".overlay_src_msg"
).
empty
();
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
}
});
}
);
});
ARCHIVE_UI
.
refreshSearchScreen
=
function
(
keyword
)
{
ARCHIVE_UI
.
refreshSearchScreen
=
function
(
keyword
)
{
var
archiveList
=
CHAT_DB
.
getArchiveByName
(
keyword
);
var
archiveTemplate
;
$
.
get
({
url
:
"./template/template_archive_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_archive_list.html"
,
async
:
false
},
function
(
text
)
{
archiveTemplate
=
text
;
});
}
);
archiveList
.
forEach
(
function
(
archive
)
{
archiveList
.
forEach
(
function
(
archive
)
{
var
typeImage
=
""
;
switch
(
archive
.
archiveType
)
{
switch
(
archive
.
archiveType
)
{
case
0
:
// 画像
typeImage
=
"icon/icon_collabo_picture.png"
;
break
;
...
...
@@ -57,7 +62,8 @@ ARCHIVE_UI.refreshSearchScreen = function(keyword) {
case
3
:
// 文書
typeImage
=
"icon/icon_collabo_document.png"
;
break
;
default
:
// その他
default
:
// その他
typeImage
=
""
;
}
...
...
@@ -65,10 +71,10 @@ ARCHIVE_UI.refreshSearchScreen = function(keyword) {
archiveId
:
archive
.
archiveId
,
fileName
:
archive
.
archiveName
,
insertDate
:
archive
.
archiveDate
,
typeImage
:
typeImage
typeImage
:
typeImage
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
$
(
".overlay_src_msg"
).
append
(
obj
);
});
};
public_new/js/chat-add-user.js
View file @
1a39aefa
// 名前空間
var
CHAT_ADD_USER
=
{};
$
(
function
()
{
$
(
function
()
{
// メンバー検索
$
(
'#chat_add_user .search_form input[type="search"]'
).
click
(
function
(
e
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
click
(
function
(
e
)
{
//画面タイトル設定
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
'#addUserTitle'
).
text
(
contactListTitle
);
})
$
(
"#addUserTitle"
).
text
(
contactListTitle
);
})
;
$
(
'#chat_add_user .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#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
)
{
if
(
keyword
!=
""
&&
keyword
.
length
!=
0
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
return
false
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
false
;
}
CHAT_ADD_USER
.
searchUser
(
keyword
);
...
...
@@ -27,91 +27,107 @@ $(function() {
}
});
// iOSキーボード変換検知用
$
(
'#chat_add_user .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
()
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#chat_add_user .search_form input[type="search"]'
).
val
();
var
keyword
=
$
(
'#chat_add_user .search_form input[type="search"]'
).
val
();
CHAT_ADD_USER
.
searchUser
(
keyword
);
}
});
}
);
});
// ユーザー検索
CHAT_ADD_USER
.
searchUser
=
function
(
keyword
)
{
var
isAllGroup
=
$
(
'#tabAllGroupOnAddUser'
).
is
(
':checked'
);
$
(
'.overlay_src_msg'
).
empty
();
CHAT_ADD_USER
.
searchUser
=
function
(
keyword
)
{
var
isAllGroup
=
$
(
"#tabAllGroupOnAddUser"
).
is
(
":checked"
);
$
(
".overlay_src_msg"
).
empty
();
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
var
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
({
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
});
}
);
groupList
.
forEach
(
function
(
group
)
{
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
);
})
$
(
".overlay_src_msg"
).
append
(
obj
);
});
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
});
if
(
findObj
)
{
user
.
checked
=
'checked'
;
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
$
(
".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
);
}
//連絡先画面
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
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
});
if
(
findObj
)
{
user
.
checked
=
'checked'
;
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
html
(
obj
);
$
(
".overlay_src_msg"
).
html
(
obj
);
if
(
userList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
}
};
public_new/js/chat-db.js
View file @
1a39aefa
...
...
@@ -8,37 +8,39 @@ function callNativeApp(iosKey, jsonData) {
try
{
var
key
=
iosKey
;
var
data
=
jsonData
;
var
payload
=
{
key
:
key
,
data
:
data
};
var
payload
=
{
key
:
key
,
data
:
data
};
// payloadの形 {"type":"SJbridge","data":{"name":"abc","role":"dev"}}
// resにObjective-cからのレスポンスが返る
result
=
prompt
(
JSON
.
stringify
(
payload
));
result
=
prompt
(
JSON
.
stringify
(
payload
));
console
.
log
(
result
);
}
catch
(
err
)
{
console
.
log
(
'The native context does not exist yet'
);
}
catch
(
err
)
{
console
.
log
(
"The native context does not exist yet"
);
}
return
result
;
}
//ロカールDBからルーム一覧情報を取得
CHAT_DB
.
getRoomList
=
function
(
roomType
,
keyWord
)
{
CHAT_DB
.
getRoomList
=
function
(
roomType
,
keyWord
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
"roomType"
:
roomType
,
"keyWord"
:
keyWord
}));
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
roomType
:
roomType
,
keyWord
:
keyWord
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getRoomList
(
roomType
,
keyWord
));
}
};
CHAT_DB
.
callGetRoomList
=
function
(
roomType
)
{
CHAT_DB
.
callGetRoomList
=
function
(
roomType
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
"roomType"
:
roomType
}));
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
roomType
:
roomType
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getRoomList
(
roomType
));
}
}
}
;
//ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB
.
getMyInfo
=
function
()
{
CHAT_DB
.
getMyInfo
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyInfo"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -47,16 +49,16 @@ CHAT_DB.getMyInfo = function() {
}
};
CHAT_DB
.
getMessages
=
function
(
roomId
)
{
CHAT_DB
.
getMessages
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMessages"
,
{
"roomId"
:
roomId
}));
return
JSON
.
parse
(
callNativeApp
(
"getMessages"
,
{
roomId
:
roomId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMessageList
(
roomId
));
}
};
CHAT_DB
.
getFavoriteUsersNotInRoom
=
function
()
{
CHAT_DB
.
getFavoriteUsersNotInRoom
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -65,7 +67,7 @@ CHAT_DB.getFavoriteUsersNotInRoom = function() {
}
};
CHAT_DB
.
getFavoriteUsers
=
function
()
{
CHAT_DB
.
getFavoriteUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -74,7 +76,7 @@ CHAT_DB.getFavoriteUsers = function() {
}
};
CHAT_DB
.
getFavoriteGroups
=
function
()
{
CHAT_DB
.
getFavoriteGroups
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteGroups"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -83,7 +85,7 @@ CHAT_DB.getFavoriteGroups = function() {
}
};
CHAT_DB
.
getMyGroupUsers
=
function
()
{
CHAT_DB
.
getMyGroupUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -92,25 +94,27 @@ CHAT_DB.getMyGroupUsers = function() {
}
};
CHAT_DB
.
getGroupInfo
=
function
(
groupId
)
{
CHAT_DB
.
getGroupInfo
=
function
(
groupId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getGroupInfo"
,
{
"groupId"
:
groupId
}));
return
JSON
.
parse
(
callNativeApp
(
"getGroupInfo"
,
{
groupId
:
groupId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupInfo
(
groupId
));
}
};
CHAT_DB
.
getGroupInfoForAddUser
=
function
(
groupId
)
{
CHAT_DB
.
getGroupInfoForAddUser
=
function
(
groupId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getGroupInfoForAddUser"
,
{
"groupId"
:
groupId
}));
return
JSON
.
parse
(
callNativeApp
(
"getGroupInfoForAddUser"
,
{
groupId
:
groupId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupInfoForAddUser
(
groupId
));
}
};
CHAT_DB
.
loadSelectedUsers
=
function
()
{
CHAT_DB
.
loadSelectedUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getSelectedUserList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -118,72 +122,96 @@ CHAT_DB.loadSelectedUsers = function() {
console
.
log
(
JSON
.
parse
(
android
.
getSelectedUserList
()));
return
JSON
.
parse
(
android
.
getSelectedUserList
());
}
}
}
;
CHAT_DB
.
getNameCardData
=
function
(
shopMemberId
)
{
CHAT_DB
.
getNameCardData
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getNameCardData"
,
{
"shopMemberId"
:
shopMemberId
}));
return
JSON
.
parse
(
callNativeApp
(
"getNameCardData"
,
{
shopMemberId
:
shopMemberId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getNameCardData
(
shopMemberId
));
}
};
CHAT_DB
.
getMyGroupShopMemberByName
=
function
(
shopMemberName
)
{
CHAT_DB
.
getMyGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberByName"
,
{
"shopMemberName"
:
shopMemberName
}));
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberByName
(
shopMemberName
));
}
};
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberNotInRoomByName"
,
{
"shopMemberName"
:
shopMemberName
}));
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberNotInRoomByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberNotInRoomByName
(
shopMemberName
));
return
JSON
.
parse
(
android
.
getMyGroupShopMemberNotInRoomByName
(
shopMemberName
)
);
}
};
CHAT_DB
.
getAllGroupShopMemberByName
=
function
(
shopMemberName
)
{
CHAT_DB
.
getAllGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberByName"
,
{
"shopMemberName"
:
shopMemberName
}));
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberByName
(
shopMemberName
));
}
};
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberNotInRoomByName"
,
{
"shopMemberName"
:
shopMemberName
}));
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberNotInRoomByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberNotInRoomByName
(
shopMemberName
));
return
JSON
.
parse
(
android
.
getAllGroupShopMemberNotInRoomByName
(
shopMemberName
)
);
}
};
CHAT_DB
.
getGroupByName
=
function
(
groupName
)
{
CHAT_DB
.
getGroupByName
=
function
(
groupName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getGroupByName"
,
{
"groupName"
:
groupName
}));
return
JSON
.
parse
(
callNativeApp
(
"getGroupByName"
,
{
groupName
:
groupName
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupByName
(
groupName
));
}
};
CHAT_DB
.
getUsersInRoom
=
function
(
roomId
)
{
CHAT_DB
.
getUsersInRoom
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUsersInRoom"
,
{
"roomId"
:
roomId
}));
return
JSON
.
parse
(
callNativeApp
(
"getUsersInRoom"
,
{
roomId
:
roomId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getUsersInRoom
(
roomId
));
}
}
}
;
// アーカイブ一覧
CHAT_DB
.
getArchiveList
=
function
()
{
CHAT_DB
.
getArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -191,7 +219,7 @@ CHAT_DB.getArchiveList = function() {
}
};
CHAT_DB
.
updateArchiveList
=
function
()
{
CHAT_DB
.
updateArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveList
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -200,24 +228,28 @@ CHAT_DB.updateArchiveList = function() {
};
// アーカイブ一覧検索
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveByName"
,
{
"archiveName"
:
archiveName
}));
return
JSON
.
parse
(
callNativeApp
(
"getArchiveByName"
,
{
archiveName
:
archiveName
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveListByName
(
archiveName
));
}
};
// アーカイブ詳細
CHAT_DB
.
getArchiveDetail
=
function
(
archiveId
)
{
CHAT_DB
.
getArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveDetail"
,
{
"archiveId"
:
archiveId
}));
return
JSON
.
parse
(
callNativeApp
(
"getArchiveDetail"
,
{
archiveId
:
archiveId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveDetail
(
archiveId
));
}
};
CHAT_DB
.
updateArchiveDetail
=
function
(
archiveId
)
{
CHAT_DB
.
updateArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveDetail
.
postMessage
(
archiveId
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -225,15 +257,17 @@ CHAT_DB.updateArchiveDetail = function(archiveId) {
}
};
CHAT_DB
.
searchMessages
=
function
(
keyword
,
userList
)
{
CHAT_DB
.
searchMessages
=
function
(
keyword
,
userList
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"searchMessages"
,
{
"keyWord"
:
keyword
,
"userList"
:
userList
}));
return
JSON
.
parse
(
callNativeApp
(
"searchMessages"
,
{
keyWord
:
keyword
,
userList
:
userList
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
searchMessages
(
keyword
,
userList
));
}
};
CHAT_DB
.
getMyGroupUsersNotInRoom
=
function
()
{
CHAT_DB
.
getMyGroupUsersNotInRoom
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -242,33 +276,37 @@ CHAT_DB.getMyGroupUsersNotInRoom = function() {
}
};
CHAT_DB
.
getUserInfo
=
function
(
shopMemberId
)
{
CHAT_DB
.
getUserInfo
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUserInfo"
,
{
"shopMemberId"
:
shopMemberId
}));
return
JSON
.
parse
(
callNativeApp
(
"getUserInfo"
,
{
shopMemberId
:
shopMemberId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getUserInfo
(
shopMemberId
));
}
};
CHAT_DB
.
getBeforeRoomType
=
function
()
{
CHAT_DB
.
getBeforeRoomType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getBeforeRoomType"
,
{});
}
};
CHAT_DB
.
getRoomType
=
function
()
{
CHAT_DB
.
getRoomType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getRoomType"
,
{}),
10
);
}
};
CHAT_DB
.
removeFavoriteUser
=
function
(
shopMemberId
)
{
CHAT_DB
.
removeFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteUser"
,
{
"shopMemberId"
:
shopMemberId
});
var
result
=
callNativeApp
(
"removeFavoriteUser"
,
{
shopMemberId
:
shopMemberId
,
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
...
...
@@ -277,10 +315,12 @@ CHAT_DB.removeFavoriteUser = function(shopMemberId) {
}
};
CHAT_DB
.
addFavoriteUser
=
function
(
shopMemberId
)
{
CHAT_DB
.
addFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteUser"
,
{
"shopMemberId"
:
shopMemberId
});
var
result
=
callNativeApp
(
"addFavoriteUser"
,
{
shopMemberId
:
shopMemberId
,
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
...
...
@@ -289,10 +329,10 @@ CHAT_DB.addFavoriteUser = function(shopMemberId) {
}
};
CHAT_DB
.
removeFavoriteGroup
=
function
(
groupId
)
{
CHAT_DB
.
removeFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteGroup"
,
{
"groupId"
:
groupId
});
var
result
=
callNativeApp
(
"removeFavoriteGroup"
,
{
groupId
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
...
...
@@ -301,10 +341,10 @@ CHAT_DB.removeFavoriteGroup = function(groupId) {
}
};
CHAT_DB
.
addFavoriteGroup
=
function
(
groupId
)
{
CHAT_DB
.
addFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteGroup"
,
{
"groupId"
:
groupId
});
var
result
=
callNativeApp
(
"addFavoriteGroup"
,
{
groupId
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
...
...
@@ -313,8 +353,7 @@ CHAT_DB.addFavoriteGroup = function(groupId) {
}
};
CHAT_DB
.
getContentList
=
function
()
{
CHAT_DB
.
getContentList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO ローカルDBからダウンロード済のコンテンツを取得
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -322,51 +361,55 @@ CHAT_DB.getContentList = function() {
}
};
CHAT_DB
.
getUserListByLoginId
=
function
(
loginIdList
)
{
CHAT_DB
.
getUserListByLoginId
=
function
(
loginIdList
)
{
console
.
log
(
loginIdList
);
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUserListByLoginId"
,
{
"loginIdList"
:
loginIdList
.
join
(
","
)}));
return
JSON
.
parse
(
callNativeApp
(
"getUserListByLoginId"
,
{
loginIdList
:
loginIdList
.
join
(
","
),
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getUserListByLoginId
(
loginIdList
.
join
(
","
)));
}
}
}
;
CHAT_DB
.
getCollaborationJoinFlg
=
function
()
{
CHAT_DB
.
getCollaborationJoinFlg
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getCollaborationJoinFlg"
,
{});
}
};
CHAT_DB
.
getUserInfoList
=
function
(
shopMemberId
)
{
CHAT_DB
.
getUserInfoList
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getUserInfoList"
,
{
"shopMemberId"
:
shopMemberId
});
return
callNativeApp
(
"getUserInfoList"
,
{
shopMemberId
:
shopMemberId
});
}
};
CHAT_DB
.
createContentView
=
function
()
{
CHAT_DB
.
createContentView
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"createContentView"
,
{}));
}
};
CHAT_DB
.
getToMoveGroupId
=
function
()
{
CHAT_DB
.
getToMoveGroupId
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getToMoveGroupId"
,
{});
}
};
CHAT_DB
.
getJoinCollaborationType
=
function
()
{
CHAT_DB
.
getJoinCollaborationType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getJoinCollaborationType"
,
{}),
10
);
}
};
CHAT_DB
.
getHostRequestFlg
=
function
()
{
CHAT_DB
.
getHostRequestFlg
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getHostRequestFlg"
,
{}),
10
);
...
...
public_new/js/chat-error.js
View file @
1a39aefa
jQuery
(
'#homeButton'
).
on
(
'click'
,
function
()
{
jQuery
(
"#homeButton"
).
on
(
"click"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
goHome
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
@@ -6,7 +6,7 @@ jQuery('#homeButton').on('click', function() {
}
});
jQuery
(
'#reloadButton'
).
on
(
'click'
,
function
()
{
jQuery
(
"#reloadButton"
).
on
(
"click"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要。
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
...
...
public_new/js/chat-room.js
View file @
1a39aefa
var
lastscrollvalue
;
window
.
onscroll
=
function
()
{
window
.
onscroll
=
function
()
{
beforeScroll
=
window
.
scrollY
;
}
}
;
$
(
'#roomNameChangeBtn'
).
click
(
function
()
{
var
changeRoomName
=
$
(
'#roomNameInput'
).
val
();
var
trimmedRoomName
=
$
(
'#roomNameInput'
).
val
().
trim
();
$
(
"#roomNameChangeBtn"
).
click
(
function
()
{
var
changeRoomName
=
$
(
"#roomNameInput"
).
val
();
var
trimmedRoomName
=
$
(
"#roomNameInput"
).
val
().
trim
();
if
(
trimmedRoomName
.
length
==
0
)
{
alert
(
getLocalizedString
(
"error_empty_room_name"
));
return
;
...
...
@@ -15,7 +15,7 @@ $('#roomNameChangeBtn').click(function() {
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
changeRoomName
(
changeRoomName
);
}
})
})
;
/*
$('#messages').scroll(function() {
...
...
public_new/js/chat-util.js
View file @
1a39aefa
// 名前空間
var
CHAT_UTIL
=
{};
CHAT_UTIL
.
isAndroid
=
function
()
{
return
PLATFORM
==
'android'
;
CHAT_UTIL
.
isAndroid
=
function
()
{
return
PLATFORM
==
"android"
;
};
CHAT_UTIL
.
isIOS
=
function
()
{
return
PLATFORM
==
'ios'
;
CHAT_UTIL
.
isIOS
=
function
()
{
return
PLATFORM
==
"ios"
;
};
CHAT_UTIL
.
isMobile
=
function
()
{
return
IS_MOBILE
==
'true'
;
CHAT_UTIL
.
isMobile
=
function
()
{
return
IS_MOBILE
==
"true"
;
};
CHAT_UTIL
.
formatDate
=
function
(
date
)
{
CHAT_UTIL
.
formatDate
=
function
(
date
)
{
const
REFERENCE
=
moment
();
const
TODAY
=
REFERENCE
.
clone
().
startOf
(
'day'
);
const
TODAY
=
REFERENCE
.
clone
().
startOf
(
"day"
);
let
createdAt
=
moment
(
date
);
if
(
date
.
length
==
14
)
{
createdAt
=
moment
(
date
,
'YYYYMMDDhhmmss'
);
createdAt
=
moment
(
date
,
"YYYYMMDDhhmmss"
);
}
else
{
createdAt
=
moment
(
date
);
}
// #36171
const
createdAtDay
=
createdAt
.
format
(
'MMM Do'
);
const
createdAtTime
=
createdAt
.
format
(
'HH:mm'
);
if
(
createdAt
.
isSame
(
TODAY
,
'd'
))
{
const
createdAtDay
=
createdAt
.
format
(
"MMM Do"
);
const
createdAtTime
=
createdAt
.
format
(
"HH:mm"
);
if
(
createdAt
.
isSame
(
TODAY
,
"d"
))
{
createdAt
=
createdAtTime
;
}
else
{
createdAt
=
createdAtDay
;
...
...
@@ -36,59 +36,62 @@ CHAT_UTIL.formatDate = function(date) {
rntDate
.
createdAtTime
=
createdAtTime
;
rntDate
.
createdAt
=
createdAt
;
return
rntDate
;
}
}
;
CHAT_UTIL
.
htmlDecode
=
function
(
input
)
{
var
e
=
document
.
createElement
(
'textarea'
);
CHAT_UTIL
.
htmlDecode
=
function
(
input
)
{
var
e
=
document
.
createElement
(
"textarea"
);
e
.
innerHTML
=
input
;
// handle case of empty input
return
e
.
childNodes
.
length
===
0
?
""
:
e
.
childNodes
[
0
].
nodeValue
;
}
}
;
//generates a unique id, not obligator a UUID
CHAT_UTIL
.
generateUUID
=
function
()
{
CHAT_UTIL
.
generateUUID
=
function
()
{
var
d
=
new
Date
().
getTime
();
var
uuid
=
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.
replace
(
/
[
xy
]
/g
,
function
(
c
)
{
var
r
=
(
d
+
Math
.
random
()
*
16
)
%
16
|
0
;
d
=
Math
.
floor
(
d
/
16
);
return
(
c
==
'x'
?
r
:
(
r
&
0x3
|
0x8
)).
toString
(
16
);
});
var
uuid
=
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.
replace
(
/
[
xy
]
/g
,
function
(
c
)
{
var
r
=
(
d
+
Math
.
random
()
*
16
)
%
16
|
0
;
d
=
Math
.
floor
(
d
/
16
);
return
(
c
==
"x"
?
r
:
(
r
&
0x3
)
|
0x8
).
toString
(
16
);
}
);
return
uuid
;
};
CHAT_UTIL
.
systemDay
=
function
(
date
)
{
CHAT_UTIL
.
systemDay
=
function
(
date
)
{
let
createdAt
=
moment
(
date
);
createdAt
=
moment
(
date
,
'YYYYMMDDhhmmss'
);
const
createdAtDow
=
createdAt
.
format
(
'YYYY-MM-DD'
);
createdAt
=
moment
(
date
,
"YYYYMMDDhhmmss"
);
const
createdAtDow
=
createdAt
.
format
(
"YYYY-MM-DD"
);
let
systemDay
=
new
Object
();
systemDay
.
year
=
createdAt
.
format
(
'YYYY'
);
systemDay
.
month
=
createdAt
.
format
(
'MM'
);
systemDay
.
day
=
createdAt
.
format
(
'DD'
);
systemDay
.
year
=
createdAt
.
format
(
"YYYY"
);
systemDay
.
month
=
createdAt
.
format
(
"MM"
);
systemDay
.
day
=
createdAt
.
format
(
"DD"
);
systemDay
.
dow
=
moment
(
createdAtDow
).
day
();
return
systemDay
;
}
}
;
CHAT_UTIL
.
findDow
=
function
(
data
)
{
CHAT_UTIL
.
findDow
=
function
(
data
)
{
let
dow
=
""
;
if
(
data
==
0
)
{
dow
=
getLocalizedString
(
'sunday'
);
dow
=
getLocalizedString
(
"sunday"
);
}
else
if
(
data
==
1
)
{
dow
=
getLocalizedString
(
'monday'
);
dow
=
getLocalizedString
(
"monday"
);
}
else
if
(
data
==
2
)
{
dow
=
getLocalizedString
(
'thusday'
);
dow
=
getLocalizedString
(
"thusday"
);
}
else
if
(
data
==
3
)
{
dow
=
getLocalizedString
(
'wednesday'
);
dow
=
getLocalizedString
(
"wednesday"
);
}
else
if
(
data
==
4
)
{
dow
=
getLocalizedString
(
'thursday'
);
dow
=
getLocalizedString
(
"thursday"
);
}
else
if
(
data
==
5
)
{
dow
=
getLocalizedString
(
'friday'
);
dow
=
getLocalizedString
(
"friday"
);
}
else
if
(
data
==
6
)
{
dow
=
getLocalizedString
(
'sunday'
);
dow
=
getLocalizedString
(
"sunday"
);
}
return
dow
;
}
}
;
function
msToTime
(
s
)
{
var
ms
=
s
%
1000
;
...
...
@@ -98,27 +101,27 @@ function msToTime(s) {
var
mins
=
s
%
60
;
var
hrs
=
(
s
-
mins
)
/
60
;
return
hrs
+
':'
+
mins
+
':'
+
secs
;
return
hrs
+
":"
+
mins
+
":"
+
secs
;
}
function
updateDuration
()
{
var
now
=
new
Date
();
$
(
'.collaboration_duration'
).
each
(
function
(
index
,
item
)
{
var
insertDateString
=
$
(
item
).
data
(
'insertdate'
);
$
(
".collaboration_duration"
).
each
(
function
(
index
,
item
)
{
var
insertDateString
=
$
(
item
).
data
(
"insertdate"
);
insertDateString
=
insertDateString
.
toString
();
var
year
=
insertDateString
.
substring
(
0
,
4
);
var
month
=
insertDateString
.
substring
(
4
,
6
);
var
day
=
insertDateString
.
substring
(
6
,
8
);
var
hour
=
insertDateString
.
substring
(
8
,
10
);
var
min
=
insertDateString
.
substring
(
10
,
12
);
var
sec
=
insertDateString
.
substring
(
12
,
14
);
var
insertDate
=
new
Date
(
year
,
month
-
1
,
day
,
hour
,
min
,
sec
);
var
year
=
insertDateString
.
substring
(
0
,
4
);
var
month
=
insertDateString
.
substring
(
4
,
6
);
var
day
=
insertDateString
.
substring
(
6
,
8
);
var
hour
=
insertDateString
.
substring
(
8
,
10
);
var
min
=
insertDateString
.
substring
(
10
,
12
);
var
sec
=
insertDateString
.
substring
(
12
,
14
);
var
insertDate
=
new
Date
(
year
,
month
-
1
,
day
,
hour
,
min
,
sec
);
$
(
item
).
html
(
msToTime
(
now
-
insertDate
));
});
}
CHAT_UTIL
.
getCollaborationType
=
function
(
key
)
{
switch
(
key
)
{
CHAT_UTIL
.
getCollaborationType
=
function
(
key
)
{
switch
(
key
)
{
case
collaborationTypeKey
.
AUDIO
:
return
COLLABORATION_TYPE
.
AUDIO
;
case
collaborationTypeKey
.
CAMERA
:
...
...
@@ -130,10 +133,12 @@ CHAT_UTIL.getCollaborationType = function(key) {
default
:
return
0
;
}
}
}
;
CHAT_UTIL
.
getCoviewTypeFromCollaborationType
=
function
(
joinCollaborationType
)
{
switch
(
joinCollaborationType
)
{
CHAT_UTIL
.
getCoviewTypeFromCollaborationType
=
function
(
joinCollaborationType
)
{
switch
(
joinCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
console
.
log
(
collaborationTypeKey
.
AUDIO
);
return
collaborationTypeKey
.
AUDIO
;
...
...
@@ -149,4 +154,4 @@ CHAT_UTIL.getCoviewTypeFromCollaborationType = function(joinCollaborationType) {
default
:
return
0
;
}
}
\ No newline at end of file
};
public_new/js/chat-websocket.js
View file @
1a39aefa
...
...
@@ -3,16 +3,14 @@ var socket;
// 名前空間
var
CHAT_SOCKET
=
{};
CHAT_SOCKET
.
socketCheck
=
function
()
{
if
(
socket
==
null
||
socket
.
disconnected
)
{
if
(
socket
==
null
||
socket
.
disconnected
)
{
window
.
location
.
reload
();
}
}
}
;
CHAT_SOCKET
.
connectSocket
=
function
()
{
if
(
IS_ONLINE
==
'true'
)
{
if
(
IS_ONLINE
==
"true"
)
{
socket
=
io
(
CHAT_SERVER_URL
);
setSocketAction
();
}
else
{
...
...
@@ -20,7 +18,6 @@ CHAT_SOCKET.connectSocket = function () {
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOSの場合
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
}
}
};
...
...
@@ -28,10 +25,10 @@ CHAT_SOCKET.connectSocket = function () {
/* ---------------------------------------------------
* Socket Connect/Disconnectc
* --------------------------------------------------- */
function
setSocketAction
()
{
socket
.
on
(
'connect'
,
function
()
{
function
setSocketAction
()
{
socket
.
on
(
"connect"
,
function
()
{
// socketが接続されたらチャット画面で画面を更新する
$
(
'.overlay'
).
removeClass
(
'active undismissable'
);
$
(
".overlay"
).
removeClass
(
"active undismissable"
);
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
...
...
@@ -43,14 +40,14 @@ function setSocketAction () {
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
'disconnect'
,
function
()
{
socket
.
on
(
"disconnect"
,
function
()
{
//socketが切断されたら黒画面で画面を更新する
$
(
'.overlay'
).
addClass
(
'active undismissable'
);
$
(
".overlay"
).
addClass
(
"active undismissable"
);
//alert('Disconnected from the server');
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
'connect_error'
,
function
()
{
socket
.
on
(
"connect_error"
,
function
()
{
CHAT_UI
.
dismissLoadingIndicator
();
});
...
...
@@ -167,28 +164,39 @@ function setSocketAction () {
// New Message
// #36170
socket
.
on
(
'newMessage'
,
function
(
message
,
roomId
,
roomName
)
{
socket
.
on
(
"newMessage"
,
function
(
message
,
roomId
,
roomName
)
{
console
.
log
(
message
);
var
userMessageTemplate
;
$
.
get
({
url
:
"./template/template_user_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_user_message.html"
,
async
:
false
},
function
(
text
)
{
userMessageTemplate
=
text
;
});
}
);
var
myMessageTemplate
;
$
.
get
({
url
:
"./template/template_my_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_my_message.html"
,
async
:
false
},
function
(
text
)
{
myMessageTemplate
=
text
;
});
}
);
var
systemMessageTemplate
;
$
.
get
({
url
:
"./template/template_system_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_system_message.html"
,
async
:
false
},
function
(
text
)
{
systemMessageTemplate
=
text
;
});
}
);
var
openCollaborationMessageTemplate
;
$
.
get
({
url
:
"./template/template_open_collaboration_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_open_collaboration_message.html"
,
async
:
false
,
},
function
(
text
)
{
openCollaborationMessageTemplate
=
text
;
});
}
);
let
template
=
userMessageTemplate
;
if
(
message
.
id
===
socket
.
id
)
{
...
...
@@ -196,33 +204,43 @@ function setSocketAction () {
template
=
myMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
createdAt
);
message
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
message
.
profileImagePath
)
message
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
message
.
profileImagePath
);
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
)
}
catch
(
e
)
{
message
.
text
=
message
.
text
message
.
text
=
decodeURIComponent
(
message
.
text
);
}
catch
(
e
)
{
message
.
text
=
message
.
text
;
}
let
type
;
let
collaborationType
;
if
(
message
.
text
.
includes
(
messageSeperator
)
)
{
if
(
message
.
text
.
includes
(
messageSeperator
)
)
{
let
text
=
message
.
text
.
split
(
messageSeperator
);
message
.
text
=
text
[
0
];
type
=
text
[
1
];
if
(
type
==
messageType
.
COMMUNICATIONSTART
||
type
==
messageType
.
COMMUNICATIONEND
)
{
if
(
type
==
messageType
.
COMMUNICATIONSTART
||
type
==
messageType
.
COMMUNICATIONEND
)
{
collaborationType
=
text
[
2
];
var
meetingId
=
0
;
if
(
collaborationType
==
CHAT_UTIL
.
getCollaborationType
(
collaborationTypeKey
.
DOCUMENT
))
{
if
(
collaborationType
==
CHAT_UTIL
.
getCollaborationType
(
collaborationTypeKey
.
DOCUMENT
)
)
{
meetingId
=
text
[
3
];
}
var
userInCollaboration
;
if
(
CHAT_UTIL
.
isIOS
())
{
userInCollaboration
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
));
userInCollaboration
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
)
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
userInCollaboration
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
));
userInCollaboration
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
)
);
}
userInCollaboration
.
forEach
(
function
(
user
)
{
userInCollaboration
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
})
});
template
=
openCollaborationMessageTemplate
;
let
html
=
Mustache
.
render
(
template
,
{
roomName
:
roomName
,
...
...
@@ -234,12 +252,15 @@ function setSocketAction () {
meetingId
:
meetingId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isOtherYear
:
false
isOtherYear
:
false
,
});
$
(
'#messages'
).
append
(
html
);
$
(
"#messages"
).
append
(
html
);
}
else
{
var
replacePath
=
message
.
text
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
text
=
replacePath
;
var
messageSender
;
if
(
CHAT_UTIL
.
isIOS
())
{
...
...
@@ -254,11 +275,15 @@ function setSocketAction () {
shopMemberId
:
message
.
userId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isToday
:
true
isToday
:
true
,
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
'attachedImages'
)
||
message
.
text
.
includes
(
'attachedVideos'
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
$
(
'#messages'
).
append
(
html
);
html
=
message
.
text
.
includes
(
"attachedImages"
)
||
message
.
text
.
includes
(
"attachedVideos"
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
$
(
"#messages"
).
append
(
html
);
}
}
...
...
@@ -269,83 +294,89 @@ function setSocketAction () {
});
// Notification
socket
.
on
(
'newNotification'
,
function
(
keyword
,
event
)
{
var
notificationString
=
getLocalizedString
(
event
,
keyword
)
$
(
'#messageNotification'
).
finish
().
text
(
notificationString
).
delay
(
500
).
slideDown
().
delay
(
1500
).
slideUp
();
socket
.
on
(
"newNotification"
,
function
(
keyword
,
event
)
{
var
notificationString
=
getLocalizedString
(
event
,
keyword
);
$
(
"#messageNotification"
)
.
finish
()
.
text
(
notificationString
)
.
delay
(
500
)
.
slideDown
()
.
delay
(
1500
)
.
slideUp
();
});
// 新しいメッセージを受信する場合の処理
// #36170
// socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
// let jQueryMessages = $('#messages');
// // スクロールの変化を防ぐため以前画面の高さを保存する
// let beforeHeight = jQueryMessages.prop('scrollHeight');
// // メッセージ文字列の生成
// let workVal = "";
// messages.forEach(function(message) {
// let template = $('#message-template').html();
// if (message.shopMemberId == shopMemberId) {
// template = $('#message-template-me').html();
// }
// let messageTime = CHAT_UTIL.formatDate(message.time.time);
//
// if (users != undefined) {
// let user = users.find((user) => user.loginId == message.loginId)
//
// // userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
// if (user) {
// message.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl("")
// }
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
// }
//
// // #36147
// message.message = message.message.toString();
// var replacePath = message.message;
// replacePath = replacePath.replaceAll('/acms',CHAT_SERVER_URL+'/acms');
// message.message = replacePath;
// let html = Mustache.render(template, {
// text: message.message,
// from: message.loginId,
// profileImage: message.profileImagePath,
// createdAtDay: messageTime.createdAtDay,
// createdAtTime: messageTime.createdAtTime
// });
// html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
// workVal = html + workVal;
// })
//
// // メッセージの画面描画
// jQueryMessages.prepend(workVal);
// if (beforeHeight !== 0) {
// // 追加のメッセージ読み込み時は読み込み前のスクロール位置を維持
// setTimeout(function () {
// jQueryMessages.scrollTop(jQueryMessages.prop('scrollHeight') - beforeHeight);
// }, 400);
// } else {
// // 新規に入室の場合は最下部へスクロール
// CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
// // タブレット等、画面サイズが大きい場合、スクロール出来なくならないよう追加で10件メッセージを取得
// if ($(window).height() > jQueryMessages.height()) {
// $('#messages').scroll();
// }
// }
//
// // ユーザ削除ボタン表示しない
// $("#userSelectionDeleteBtn").hide();
//
// CHAT_UI.dismissLoadingIndicator();// add some...
//
// // チャットに遷移する
// $('#pills-chat-tab').tab('show');
// });
// socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
// let jQueryMessages = $('#messages');
// // スクロールの変化を防ぐため以前画面の高さを保存する
// let beforeHeight = jQueryMessages.prop('scrollHeight');
// // メッセージ文字列の生成
// let workVal = "";
// messages.forEach(function(message) {
// let template = $('#message-template').html();
// if (message.shopMemberId == shopMemberId) {
// template = $('#message-template-me').html();
// }
// let messageTime = CHAT_UTIL.formatDate(message.time.time);
//
// if (users != undefined) {
// let user = users.find((user) => user.loginId == message.loginId)
//
// // userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
// if (user) {
// message.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl("")
// }
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
// }
//
// // #36147
// message.message = message.message.toString();
// var replacePath = message.message;
// replacePath = replacePath.replaceAll('/acms',CHAT_SERVER_URL+'/acms');
// message.message = replacePath;
// let html = Mustache.render(template, {
// text: message.message,
// from: message.loginId,
// profileImage: message.profileImagePath,
// createdAtDay: messageTime.createdAtDay,
// createdAtTime: messageTime.createdAtTime
// });
// html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
// workVal = html + workVal;
// })
//
// // メッセージの画面描画
// jQueryMessages.prepend(workVal);
// if (beforeHeight !== 0) {
// // 追加のメッセージ読み込み時は読み込み前のスクロール位置を維持
// setTimeout(function () {
// jQueryMessages.scrollTop(jQueryMessages.prop('scrollHeight') - beforeHeight);
// }, 400);
// } else {
// // 新規に入室の場合は最下部へスクロール
// CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
// // タブレット等、画面サイズが大きい場合、スクロール出来なくならないよう追加で10件メッセージを取得
// if ($(window).height() > jQueryMessages.height()) {
// $('#messages').scroll();
// }
// }
//
// // ユーザ削除ボタン表示しない
// $("#userSelectionDeleteBtn").hide();
//
// CHAT_UI.dismissLoadingIndicator();// add some...
//
// // チャットに遷移する
// $('#pills-chat-tab').tab('show');
// });
// Update User List In Room
// サイドバーのユーザーリストアップデート。
/* socket.on('updateUserList', function(users, onlineUsers) {
/* socket.on('updateUserList', function(users, onlineUsers) {
console.log(users);
console.log(onlineUsers);
...
...
@@ -389,26 +420,30 @@ function setSocketAction () {
});*/
// Update Group List(Invite)
socket
.
on
(
'refreshGroupList'
,
function
(
groups
,
isInvite
)
{
$
(
'#group_list'
).
html
(
''
);
const
template
=
$
(
'#group-template'
).
html
();
socket
.
on
(
"refreshGroupList"
,
function
(
groups
,
isInvite
)
{
$
(
"#group_list"
).
html
(
""
);
const
template
=
$
(
"#group-template"
).
html
();
if
(
groups
.
length
===
0
)
{
$
(
'#group_list'
).
append
(
'<center class="text-secondary">'
+
getLocalizedString
(
everyoneIsHere
)
+
'</center>'
);
$
(
"#group_list"
).
append
(
'<center class="text-secondary">'
+
getLocalizedString
(
everyoneIsHere
)
+
"</center>"
);
}
// グループ名と人数を表記する。
groups
.
forEach
(
function
(
group
)
{
groups
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
template
,
{
name
:
group
.
groupName
,
info
:
group
.
memberCnt
+
getLocalizedString
(
"people"
)
info
:
group
.
memberCnt
+
getLocalizedString
(
"people"
),
});
// グループをクリックすると、該当グループのユーザーリストを読み込むようにイベントを与える
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
()
{
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
'getUserListInGroup'
,
group
.
groupId
,
isInvite
);
$
(
'#groupName'
).
text
(
group
.
groupName
);
socket
.
emit
(
"getUserListInGroup"
,
group
.
groupId
,
isInvite
);
$
(
"#groupName"
).
text
(
group
.
groupName
);
});
$
(
'#group_list'
).
append
(
obj
);
$
(
"#group_list"
).
append
(
obj
);
});
// Rotate
...
...
@@ -417,41 +452,47 @@ function setSocketAction () {
}
// Set Title
let
memberSelectTitle
=
getLocalizedString
(
"groupSearch"
)
let
memberSelectTitle
=
getLocalizedString
(
"groupSearch"
);
$
(
'#pills-group-tab'
).
tab
(
'show'
);
$
(
"#pills-group-tab"
).
tab
(
"show"
);
$
(
'#backButton'
).
show
();
$
(
"#backButton"
).
show
();
if
(
isInvite
)
{
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
$
(
'#newRoomName, .roomListIcon, .chatRoomIcon'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
$
(
".titleRoomName"
).
text
(
memberSelectTitle
);
$
(
"#newRoomName, .roomListIcon, .chatRoomIcon"
).
hide
();
$
(
"#userSelectionConfirmBtn"
).
show
();
$
(
"#userSelectionConfirmBtn"
)
.
off
()
.
on
(
"click"
,
function
()
{
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
}
else
{
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
$
(
'.roomListIcon, .chatRoomIcon, #newRoomName'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
$
(
".titleRoomName"
).
text
(
memberSelectTitle
);
$
(
".roomListIcon, .chatRoomIcon, #newRoomName"
).
hide
();
$
(
"#userSelectionConfirmBtn"
).
show
();
$
(
"#userSelectionConfirmBtn"
)
.
off
()
.
on
(
"click"
,
function
()
{
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
}
if
(
CHAT
.
globalSelectedUserList
.
length
>
0
)
{
$
(
'#userSelectionLength'
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
$
(
"#userSelectionLength"
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
}
else
{
$
(
'#userSelectionLength'
).
text
(
''
);
$
(
"#userSelectionLength"
).
text
(
""
);
}
$
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
$
(
"#backButton"
)
.
off
()
.
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
if
(
isInvite
)
{
$
(
'#pills-chat-tab'
).
tab
(
'show'
);
$
(
"#pills-chat-tab"
).
tab
(
"show"
);
}
else
{
if
(
IS_ONLINE
==
'true'
)
{
if
(
IS_ONLINE
==
"true"
)
{
android
.
updateRoomList
();
CHAT_UI
.
refreshRoomList
(
chatRoomType
.
DM
);
CHAT_UI
.
dismissLoadingIndicator
();
...
...
@@ -462,57 +503,63 @@ function setSocketAction () {
// Update User List(Invite)
// #36170
socket
.
on
(
'refreshUserListInGroup'
,
function
(
users
,
groupId
,
isInvite
)
{
$
(
'#user_list'
).
html
(
''
);
const
template
=
$
(
'#user-template'
).
html
();
socket
.
on
(
"refreshUserListInGroup"
,
function
(
users
,
groupId
,
isInvite
)
{
$
(
"#user_list"
).
html
(
""
);
const
template
=
$
(
"#user-template"
).
html
();
// Set Title
let
memberSelectTitle
=
getLocalizedString
(
"userSearch"
)
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
let
memberSelectTitle
=
getLocalizedString
(
"userSearch"
);
$
(
".titleRoomName"
).
text
(
memberSelectTitle
);
users
.
forEach
(
function
(
user
)
{
users
.
forEach
(
function
(
user
)
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
user
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
user
.
profileImagePath
)
user
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
user
.
profileImagePath
);
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
name
:
user
.
loginId
,
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
()
{
if
(
$
(
this
).
find
(
'.userCheckBox.active'
).
length
>
0
)
{
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
"click"
,
function
()
{
if
(
$
(
this
).
find
(
".userCheckBox.active"
).
length
>
0
)
{
// remove
CHAT
.
globalSelectedUserList
=
CHAT
.
globalSelectedUserList
.
filter
(
function
(
element
)
{
CHAT
.
globalSelectedUserList
=
CHAT
.
globalSelectedUserList
.
filter
(
function
(
element
)
{
return
user
.
loginId
!=
element
.
loginId
;
});
}
);
}
else
{
// add
CHAT
.
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
});
CHAT
.
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
,
});
}
$
(
this
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
$
(
this
).
find
(
".userCheckBox"
).
toggleClass
(
"active"
);
if
(
CHAT
.
globalSelectedUserList
.
length
>
0
)
{
$
(
'#userSelectionLength'
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
$
(
"#userSelectionLength"
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
}
else
{
$
(
'#userSelectionLength'
).
text
(
''
);
$
(
"#userSelectionLength"
).
text
(
""
);
}
});
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
})
});
if
(
findObj
)
{
$
(
obj
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
$
(
obj
).
find
(
".userCheckBox"
).
toggleClass
(
"active"
);
}
$
(
'#user_list'
).
append
(
obj
);
})
$
(
'.userCheckBox'
).
show
();
$
(
"#user_list"
).
append
(
obj
);
});
$
(
".userCheckBox"
).
show
();
// Rotate
if
(
CHAT_UI
.
isLandscapeMode
())
{
...
...
@@ -520,53 +567,57 @@ function setSocketAction () {
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
}
$
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
$
(
"#backButton"
)
.
off
()
.
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
'getGroupList'
,
isInvite
)
socket
.
emit
(
"getGroupList"
,
isInvite
);
});
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
$
(
"#userSelectionConfirmBtn"
)
.
off
()
.
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
$
(
'#backButton'
).
show
();
$
(
'.roomListIcon, .chatRoomIcon'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
'.userCheckBox'
).
show
();
$
(
'#pills-user-tab'
).
tab
(
'show'
);
$
(
"#backButton"
).
show
();
$
(
".roomListIcon, .chatRoomIcon"
).
hide
();
$
(
"#userSelectionConfirmBtn"
).
show
();
$
(
".userCheckBox"
).
show
();
$
(
"#pills-user-tab"
).
tab
(
"show"
);
});
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
socket
.
on
(
'showServerError'
,
function
(
message
)
{
socket
.
on
(
"showServerError"
,
function
(
message
)
{
// #36174
// #36215
if
(
message
.
includes
(
"SC_FORBIDDEN"
))
{
alert
(
'SC_FORBIDDEN'
);
if
(
message
.
includes
(
"SC_FORBIDDEN"
))
{
alert
(
"SC_FORBIDDEN"
);
return
;
}
if
(
message
==
'server error Ocurred'
)
{
if
(
message
==
"server error Ocurred"
)
{
message
=
getLocalizedString
(
"serverErrorOccured"
);
}
else
if
(
message
==
'Room not found'
)
{
}
else
if
(
message
==
"Room not found"
)
{
message
=
getLocalizedString
(
"errorRoomNotFound"
);
}
$
(
"#customAlertTitle"
).
text
(
message
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
'#customAlert'
).
appendTo
(
"body"
).
modal
({
backdrop
:
'static'
,
keyboard
:
false
$
(
"#customAlert"
)
.
appendTo
(
"body"
)
.
modal
({
backdrop
:
"static"
,
keyboard
:
false
,
})
.
on
(
'click'
,
'#customAlertOk'
,
function
(
e
)
{
});
.
on
(
"click"
,
"#customAlertOk"
,
function
(
e
)
{});
CHAT_UI
.
dismissLoadingIndicator
();
if
(
message
==
"Room not found"
)
{
...
...
@@ -586,31 +637,34 @@ function setSocketAction () {
// androidでの場合
android
.
getLoginParameter
();
}
else
{
CHAT_UI
.
htmlElementTextInitialize
(
"ko"
)
CHAT_UI
.
htmlElementTextInitialize
(
"ko"
);
// webでのsocket connect
socket
.
emit
(
'join'
,
params
,
function
(
err
)
{
socket
.
emit
(
"join"
,
params
,
function
(
err
)
{
if
(
err
)
{
// #36174
$
(
"#customAlertTitle"
).
text
(
err
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
'#customAlert'
).
appendTo
(
"body"
).
modal
({
backdrop
:
'static'
,
keyboard
:
false
$
(
"#customAlert"
)
.
appendTo
(
"body"
)
.
modal
({
backdrop
:
"static"
,
keyboard
:
false
,
})
.
on
(
'click'
,
'#customAlertOk'
,
function
(
e
)
{
});
.
on
(
"click"
,
"#customAlertOk"
,
function
(
e
)
{});
}
else
{
if
(
params
.
roomName
!=
undefined
)
{
$
(
'.titleRoomName'
).
text
(
params
.
roomName
).
data
(
'roomName'
,
params
.
roomName
);
$
(
".titleRoomName"
)
.
text
(
params
.
roomName
)
.
data
(
"roomName"
,
params
.
roomName
);
}
else
{
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
)
$
(
'.titleRoomName'
).
text
(
roomListTitle
)
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
);
$
(
".titleRoomName"
).
text
(
roomListTitle
);
}
}
// loadingIndicatorを表示しない
CHAT_UI
.
dismissLoadingIndicator
();
});
}
})
});
}
public_new/js/chat.js
View file @
1a39aefa
...
...
@@ -15,78 +15,96 @@ var beforeHeight = window.innerHeight;
var
beforeWidth
=
window
.
innerWidth
;
var
beforeScroll
;
CHAT
.
saveRoomInfo
=
function
(
roomId
,
roomName
)
{
CHAT
.
saveRoomInfo
=
function
(
roomId
,
roomName
)
{
CHAT
.
globalLoginParameter
.
roomId
=
roomId
;
CHAT
.
globalLoginParameter
.
roomName
=
roomName
;
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
roomInfosaveMessageHandlerId
.
postMessage
({
"roomId"
:
roomId
,
"roomName"
:
roomName
});
webkit
.
messageHandlers
.
roomInfosaveMessageHandlerId
.
postMessage
({
roomId
:
roomId
,
roomName
:
roomName
,
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
if
(
roomId
==
undefined
&&
roomName
==
undefined
)
{
android
.
saveVisitRoomInfo
(
''
,
''
);
android
.
saveVisitRoomInfo
(
""
,
""
);
}
else
{
android
.
saveVisitRoomInfo
(
roomId
,
roomName
);
}
}
}
}
;
// #36170 画像パスが存在しない場合はデフォルトの画像を返す
// 存在する場合はプロフィール画像取得用APIのURLを生成して返す
CHAT
.
getProfileImgUrl
=
function
(
path
)
{
CHAT
.
getProfileImgUrl
=
function
(
path
)
{
if
(
path
==
undefined
||
path
==
""
)
{
return
ASSET_PATH
+
'img/noImage.png'
;
return
ASSET_PATH
+
"img/noImage.png"
;
}
else
{
if
(
path
.
includes
(
'/mnt'
))
{
if
(
path
.
includes
(
"/mnt"
))
{
var
userInfo
=
path
.
split
(
"/"
).
reverse
();
return
CMS_SERVER_URL
+
'/chatapi/user?profileFileName='
+
userInfo
[
0
]
+
'&profileGetLoginId='
+
userInfo
[
1
]
+
'&sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&cmd=12'
;
return
(
CMS_SERVER_URL
+
"/chatapi/user?profileFileName="
+
userInfo
[
0
]
+
"&profileGetLoginId="
+
userInfo
[
1
]
+
"&sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&cmd=12"
);
}
else
{
return
path
;
}
}
}
}
;
// Video のサムネイルファイル生成する
CHAT
.
createVideoThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
CHAT
.
createVideoThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
var
fileReader
=
new
FileReader
();
fileReader
.
onload
=
function
()
{
var
blob
=
new
Blob
([
fileReader
.
result
],
{
type
:
sourceImage
.
type
});
fileReader
.
onload
=
function
()
{
var
blob
=
new
Blob
([
fileReader
.
result
],
{
type
:
sourceImage
.
type
});
var
url
=
URL
.
createObjectURL
(
blob
);
var
video
=
document
.
createElement
(
'video'
);
var
timeupdate
=
function
()
{
var
video
=
document
.
createElement
(
"video"
);
var
timeupdate
=
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
video
.
removeEventListener
(
"timeupdate"
,
timeupdate
);
video
.
pause
();
}
};
video
.
addEventListener
(
'loadeddata'
,
function
()
{
video
.
addEventListener
(
"loadeddata"
,
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
video
.
removeEventListener
(
"timeupdate"
,
timeupdate
);
}
});
var
snapImage
=
function
()
{
var
canvas
=
document
.
createElement
(
'canvas'
);
var
snapImage
=
function
()
{
var
canvas
=
document
.
createElement
(
"canvas"
);
canvas
.
width
=
video
.
videoWidth
;
canvas
.
height
=
video
.
videoHeight
;
canvas
.
getContext
(
'2d'
).
drawImage
(
video
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
canvas
.
getContext
(
"2d"
)
.
drawImage
(
video
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
fetch
(
canvas
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
.
then
(
function
(
buf
)
{
// 回転された画像をFormDataに保存
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
});
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
,
});
callback
(
newFile
,
true
);
// ajax End
}).
catch
((
error
)
=>
{
// fetch Error catch Block
})
.
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
);
}
});
return
true
;
};
video
.
addEventListener
(
'timeupdate'
,
timeupdate
);
video
.
preload
=
'metadata'
;
video
.
addEventListener
(
"timeupdate"
,
timeupdate
);
video
.
preload
=
"metadata"
;
video
.
src
=
url
;
// Load video in Safari / IE11
video
.
muted
=
true
;
...
...
@@ -94,15 +112,16 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
video
.
pause
();
};
fileReader
.
readAsArrayBuffer
(
sourceImage
);
}
}
;
// Ajaxでイメージをアップロードする
CHAT
.
uploadImage
=
function
(
formData
)
{
formData
.
append
(
'roomId'
,
CHAT
.
globalLoginParameter
.
roomId
);
formData
.
append
(
'sid'
,
CHAT
.
globalLoginParameter
.
sid
);
jQuery
.
ajax
({
CHAT
.
uploadImage
=
function
(
formData
)
{
formData
.
append
(
"roomId"
,
CHAT
.
globalLoginParameter
.
roomId
);
formData
.
append
(
"sid"
,
CHAT
.
globalLoginParameter
.
sid
);
jQuery
.
ajax
({
async
:
true
,
url
:
CMS_SERVER_URL
+
"/chatapi/file/upload"
,
url
:
CMS_SERVER_URL
+
"/chatapi/file/upload"
,
type
:
"post"
,
data
:
formData
,
contentType
:
false
,
...
...
@@ -110,136 +129,228 @@ CHAT.uploadImage = function(formData) {
error
:
function
()
{
alert
(
"読み込み失敗"
);
CHAT_UI
.
dismissLoadingIndicator
();
}
}).
done
(
function
(
res
)
{
var
imgPath
=
CMS_SERVER_URL
+
'/chatapi/file/getImage?fileName='
+
res
.
fileName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
var
imageName
=
res
.
fileName
},
})
.
done
(
function
(
res
)
{
var
imgPath
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?fileName="
+
res
.
fileName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
var
imageName
=
res
.
fileName
;
// uploadFileの判断
var
extension
=
imageName
.
substr
(
imageName
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
var
extension
=
imageName
.
substr
(
imageName
.
lastIndexOf
(
"."
)
+
1
)
.
toLowerCase
();
// 画像の処理
if
(
res
.
fileType
==
"jpeg"
||
res
.
fileType
==
"jpg"
||
res
.
fileType
==
"png"
)
{
if
(
res
.
fileType
==
"jpeg"
||
res
.
fileType
==
"jpg"
||
res
.
fileType
==
"png"
)
{
if
(
res
.
thumbnailPath
&&
res
.
thumbnailPath
.
length
>
0
)
{
imgPath
=
CMS_SERVER_URL
+
'/chatapi/file/getImage?fileName='
+
res
.
thumbImageFileName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
imgPath
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?fileName="
+
res
.
thumbImageFileName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
imageName
=
res
.
thumbImageFileName
;
}
let
downloadPath
=
CMS_SERVER_URL
+
'/chatapi/file/download?fileName='
+
imageName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
let
downloadPath
=
CMS_SERVER_URL
+
"/chatapi/file/download?fileName="
+
imageName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const
lightbox
=
$
(
'<a/>'
,
{
'data-lightbox'
:
'attachedImages'
,
'data-title'
:
imageName
});
const
image
=
$
(
'<img/>'
,
{
src
:
imgPath
,
width
:
'auto'
,
style
:
'max-width:100%'
,
'data-toggle'
:
'modal'
,
onclick
:
'imageModal(this);'
});
const
downloadIcon
=
$
(
'<a/>'
,
{
href
:
downloadPath
,
class
:
'fa fa-download'
,
download
:
res
.
fileName
});
const
lightbox
=
$
(
"<a/>"
,
{
"data-lightbox"
:
"attachedImages"
,
"data-title"
:
imageName
,
});
const
image
=
$
(
"<img/>"
,
{
src
:
imgPath
,
width
:
"auto"
,
style
:
"max-width:100%"
,
"data-toggle"
:
"modal"
,
onclick
:
"imageModal(this);"
,
});
const
downloadIcon
=
$
(
"<a/>"
,
{
href
:
downloadPath
,
class
:
"fa fa-download"
,
download
:
res
.
fileName
,
});
lightbox
.
append
(
image
);
lightbox
.
append
(
downloadIcon
);
let
text
=
lightbox
.
prop
(
'outerHTML'
)
let
encodedText
let
text
=
lightbox
.
prop
(
"outerHTML"
);
let
encodedText
;
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
encodeURIComponent
(
text
);
}
catch
(
e
)
{
encodedText
=
text
;
}
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
IMAGE
},
1
);
}
else
{
// 動画の処理
socket
.
emit
(
"createMessage"
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
IMAGE
,
},
1
);
}
else
{
// 動画の処理
if
(
res
.
thumbnailPath
&&
res
.
thumbnailPath
.
length
>
0
)
{
imgPath
=
CMS_SERVER_URL
+
'/chatapi/file/getImage?fileName='
+
res
.
thumbImageFileName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
}
let
downloadPath
=
CMS_SERVER_URL
+
'/chatapi/file/download?fileName='
+
imageName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
var
videoSrc
=
CMS_SERVER_URL
+
'/chatapi/file/getImage?fileName='
+
res
.
fileName
+
'&roomId='
+
CHAT
.
globalLoginParameter
.
roomId
;
const
totalDiv
=
$
(
'<div/>'
,
{
id
:
"attachedImages"
});
const
videoTag
=
$
(
'<video/>'
,
{
controls
:
"true"
,
width
:
'auto'
,
style
:
'max-width:100%'
});
const
source
=
$
(
'<source/>'
,
{
src
:
videoSrc
});
const
downloadIcon
=
$
(
'<a/>'
,{
href
:
downloadPath
,
class
:
'fa fa-download'
,
download
:
res
.
fileName
});
imgPath
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?fileName="
+
res
.
thumbImageFileName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
}
let
downloadPath
=
CMS_SERVER_URL
+
"/chatapi/file/download?fileName="
+
imageName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
var
videoSrc
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?fileName="
+
res
.
fileName
+
"&roomId="
+
CHAT
.
globalLoginParameter
.
roomId
;
const
totalDiv
=
$
(
"<div/>"
,
{
id
:
"attachedImages"
});
const
videoTag
=
$
(
"<video/>"
,
{
controls
:
"true"
,
width
:
"auto"
,
style
:
"max-width:100%"
,
});
const
source
=
$
(
"<source/>"
,
{
src
:
videoSrc
});
const
downloadIcon
=
$
(
"<a/>"
,
{
href
:
downloadPath
,
class
:
"fa fa-download"
,
download
:
res
.
fileName
,
});
videoTag
.
append
(
source
);
totalDiv
.
append
(
videoTag
);
totalDiv
.
append
(
downloadIcon
);
let
text
=
totalDiv
.
prop
(
'outerHTML'
);
let
encodedText
let
text
=
totalDiv
.
prop
(
"outerHTML"
);
let
encodedText
;
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
encodeURIComponent
(
text
);
}
catch
(
e
)
{
encodedText
=
text
;
}
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
VIDEO
},
1
);
socket
.
emit
(
"createMessage"
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
VIDEO
,
},
1
);
}
$
(
'.overlay'
).
removeClass
(
'active undismissable'
);
$
(
'.loader'
).
removeClass
(
'active'
);
$
(
".overlay"
).
removeClass
(
"active undismissable"
);
$
(
".loader"
).
removeClass
(
"active"
);
CHAT_UI
.
dismissLoadingIndicator
();
})
}
})
;
}
;
CHAT
.
createGetDataUrl
=
function
(
fileName
,
roomId
)
{
var
filePath
=
CMS_SERVER_URL
+
'/chatapi/file/getImage?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
+
fileName
+
'&roomId='
+
roomId
;
CHAT
.
createGetDataUrl
=
function
(
fileName
,
roomId
)
{
var
filePath
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
+
fileName
+
"&roomId="
+
roomId
;
return
filePath
;
}
}
;
// Thumbnailのファイルを生成する。
CHAT
.
createThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
CHAT
.
createThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
const
fileReader
=
new
FileReader
();
const
img
=
new
Image
();
fileReader
.
onloadend
=
function
()
{
img
.
src
=
fileReader
.
result
}
fileReader
.
onloadend
=
function
()
{
img
.
src
=
fileReader
.
result
;
};
img
.
onload
=
function
()
{
const
elem
=
document
.
createElement
(
'canvas'
);
var
rate
var
width
=
img
.
width
var
height
=
img
.
height
if
((
img
.
width
<=
500
)
&&
(
img
.
height
<=
500
))
{
callback
(
undefined
,
false
)
return
img
.
onload
=
function
()
{
const
elem
=
document
.
createElement
(
"canvas"
);
var
rate
;
var
width
=
img
.
width
;
var
height
=
img
.
height
;
if
(
img
.
width
<=
500
&&
img
.
height
<=
500
)
{
callback
(
undefined
,
false
);
return
;
}
if
(
img
.
width
>
img
.
height
)
{
rate
=
500
/
img
.
width
if
(
img
.
width
>
img
.
height
)
{
rate
=
500
/
img
.
width
;
}
else
{
rate
=
500
/
img
.
height
rate
=
500
/
img
.
height
;
}
elem
.
width
=
width
*
rate
;
elem
.
height
=
height
*
rate
;
const
ctx
=
elem
.
getContext
(
'2d'
)
ctx
.
drawImage
(
img
,
0
,
0
,
img
.
width
,
img
.
height
,
0
,
0
,
elem
.
width
,
elem
.
height
);
const
ctx
=
elem
.
getContext
(
"2d"
);
ctx
.
drawImage
(
img
,
0
,
0
,
img
.
width
,
img
.
height
,
0
,
0
,
elem
.
width
,
elem
.
height
);
// ctx.drawImage(img, 0, 0, width, height);
fetch
(
elem
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
});
callback
(
newFile
,
true
)
.
then
(
function
(
buf
)
{
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
,
});
}).
catch
((
error
)
=>
{
// fetch Error catch Block
callback
(
newFile
,
true
);
})
.
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
);
}
});
}
};
fileReader
.
readAsDataURL
(
sourceImage
);
}
}
;
// 該当チャットルームに参加するためログイン情報をサーバに渡す
getLoginParameter
=
function
(
sid
,
loginId
,
shopName
,
roomId
=
undefined
,
roomName
=
undefined
,
languageCode
,
shopMemberId
)
{
var
loginParam
=
new
Object
()
getLoginParameter
=
function
(
sid
,
loginId
,
shopName
,
roomId
=
undefined
,
roomName
=
undefined
,
languageCode
,
shopMemberId
)
{
var
loginParam
=
new
Object
();
loginParam
.
sid
=
sid
;
loginParam
.
loginId
=
loginId
;
loginParam
.
shopName
=
shopName
;
...
...
@@ -250,12 +361,12 @@ getLoginParameter = function(sid, loginId, shopName, roomId = undefined, roomNam
CHAT
.
globalLoginParameter
=
loginParam
;
if
(
!
languageCode
)
{
languageCode
=
"en"
languageCode
=
"en"
;
}
// fermi coview share
globalUserInfo
.
sid
=
sid
;
globalUserInfo
.
loginId
=
shopName
+
'_'
+
loginId
;
globalUserInfo
.
loginId
=
shopName
+
"_"
+
loginId
;
globalUserInfo
.
shopName
=
shopName
;
globalUserInfo
.
roomId
=
roomId
;
globalUserInfo
.
roomName
=
roomName
;
...
...
@@ -263,209 +374,231 @@ getLoginParameter = function(sid, loginId, shopName, roomId = undefined, roomNam
CHAT_UI
.
htmlElementTextInitialize
(
languageCode
);
CHAT_UI
.
dismissLoadingIndicator
();
}
}
;
CHAT
.
leaveRoom
=
function
()
{
socket
.
emit
(
'leaveRoom'
,
function
()
{
});
}
CHAT
.
leaveRoom
=
function
()
{
socket
.
emit
(
"leaveRoom"
,
function
()
{});
};
$
(
function
()
{
$
(
function
()
{
// ルーム名変更イベント
$
(
'.change_room_name_btn button'
).
click
(
function
()
{
$
(
'form'
).
submit
();
$
(
".change_room_name_btn button"
).
click
(
function
()
{
$
(
"form"
).
submit
();
});
// 検索アイコン押下イベント
$
(
'.nav_item_wrap .search_menu'
).
click
(
function
()
{
$
(
'.nav_item_wrap'
).
addClass
(
'none'
);
$
(
'.footer-wrap'
).
addClass
(
'none'
);
$
(
'.chat_room_src_form'
).
removeClass
(
'none'
);
$
(
'.room_container'
).
addClass
(
'none'
);
$
(
'.overlay_src_msg'
).
removeClass
(
'none'
);
$
(
".nav_item_wrap .search_menu"
).
click
(
function
()
{
$
(
".nav_item_wrap"
).
addClass
(
"none"
);
$
(
".footer-wrap"
).
addClass
(
"none"
);
$
(
".chat_room_src_form"
).
removeClass
(
"none"
);
$
(
".room_container"
).
addClass
(
"none"
);
$
(
".overlay_src_msg"
).
removeClass
(
"none"
);
// フィルタ表示
$
(
'#filter'
).
removeClass
(
'none'
);
$
(
'#user_list'
).
addClass
(
'none'
);
$
(
"#filter"
).
removeClass
(
"none"
);
$
(
"#user_list"
).
addClass
(
"none"
);
$
(
'.chat_room_src_form input[type="search"]'
).
focus
();
$
(
'#searchMessage'
).
addClass
(
'onfocus'
);
$
(
'.chat_list'
).
removeClass
(
'none'
);
});
$
(
'.chat_room_src_form .cancel'
).
click
(
function
()
{
$
(
'.nav_item_wrap'
).
removeClass
(
'none'
);
$
(
'.footer-wrap'
).
removeClass
(
'none'
);
$
(
'.chat_room_src_form'
).
addClass
(
'none'
);
$
(
'.chat_room_src_form input'
).
val
(
''
);
$
(
'.room_container'
).
removeClass
(
'none'
);
$
(
'.overlay_src_msg'
).
empty
();
$
(
"#searchMessage"
).
addClass
(
"onfocus"
);
$
(
".chat_list"
).
removeClass
(
"none"
);
});
$
(
".chat_room_src_form .cancel"
).
click
(
function
()
{
$
(
".nav_item_wrap"
).
removeClass
(
"none"
);
$
(
".footer-wrap"
).
removeClass
(
"none"
);
$
(
".chat_room_src_form"
).
addClass
(
"none"
);
$
(
".chat_room_src_form input"
).
val
(
""
);
$
(
".room_container"
).
removeClass
(
"none"
);
$
(
".overlay_src_msg"
).
empty
();
// ユーザーリスト表示
$
(
'#filter'
).
addClass
(
'none'
);
$
(
'#user_list'
).
removeClass
(
'none'
);
$
(
"#filter"
).
addClass
(
"none"
);
$
(
"#user_list"
).
removeClass
(
"none"
);
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
'.chat_list'
).
addClass
(
'none'
);
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
$
(
".chat_list"
).
addClass
(
"none"
);
CHAT_UI
.
scrollToBottom
();
});
$
(
'.chat_room_src_form input[type="search"]'
).
click
(
function
()
{
if
(
$
(
'#searchMessage'
).
hasClass
(
'onfocus'
))
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
'#searchMessage'
).
blur
();
$
(
'.chat_room_src_form input[type="search"]'
).
click
(
function
()
{
if
(
$
(
"#searchMessage"
).
hasClass
(
"onfocus"
))
{
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
$
(
"#searchMessage"
).
blur
();
}
else
{
$
(
'#searchMessage'
).
addClass
(
'onfocus'
);
$
(
'#searchMessage'
).
focus
();
$
(
"#searchMessage"
).
addClass
(
"onfocus"
);
$
(
"#searchMessage"
).
focus
();
}
})
});
$
(
'#searchMessage'
).
blur
(
function
()
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
})
$
(
"#searchMessage"
).
blur
(
function
()
{
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
});
// フィルタ選択イベント
$
(
document
).
on
(
'click'
,
'#filter .img_wrap'
,
function
(
event
)
{
$
(
document
).
on
(
"click"
,
"#filter .img_wrap"
,
function
(
event
)
{
// チェックアイコン追加
$
(
this
).
toggleClass
(
"filter"
);
});
$
(
'#chat .search_form input[type="search"]'
).
click
(
function
()
{
$
(
'#chat .search_form input[type="search"]'
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"room_search_placeholder"
);
$
(
'#chatTitle'
).
text
(
roomListTitle
);
$
(
"#chatTitle"
).
text
(
roomListTitle
);
});
$
(
'#chat .search_form .cancel'
).
click
(
function
()
{
$
(
"#chat .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
);
$
(
'#chatTitle'
).
text
(
roomListTitle
);
$
(
"#chatTitle"
).
text
(
roomListTitle
);
});
$
(
'#chat_add_user .search_form .cancel'
).
click
(
function
()
{
$
(
"#chat_add_user .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"inviteUsersSubtitle"
);
$
(
'#addUserTitle'
).
text
(
roomListTitle
);
$
(
"#addUserTitle"
).
text
(
roomListTitle
);
});
$
(
'#chatMakeRoom .search_form .cancel'
).
click
(
function
()
{
$
(
"#chatMakeRoom .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"createRoomTitle"
);
$
(
'#makeRoomTitle'
).
text
(
roomListTitle
);
$
(
"#makeRoomTitle"
).
text
(
roomListTitle
);
});
// チャットメンバー検索
$
(
'#chat .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#chat .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
var
rooms
;
var
keyword
=
$
(
'#chat .search_form input[type="search"]'
).
val
();
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
if
(
keyword
.
length
!=
0
&&
keyword
!=
''
)
{
if
(
keyword
.
length
!=
0
&&
keyword
!=
""
)
{
$
(
'#chat .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
CHAT
.
searchRoom
(
keyword
,
rooms
);
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
$
(
'#chat .search_form input[type="search"]'
).
blur
();
return
;
return
;
}
});
// iOSキーボード変換検知用
$
(
'#chat .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
(){
$
(
'#chat .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
rooms
;
var
keyword
=
$
(
'#chat .search_form input[type="search"]'
).
val
();
CHAT
.
searchRoom
(
keyword
,
rooms
);
}
}
);
}
);
var
footerHeight
=
$
(
'.footer-wrap'
).
height
();
window
.
addEventListener
(
"resize"
,
function
()
{
var
footerHeight
=
$
(
".footer-wrap"
).
height
();
window
.
addEventListener
(
"resize"
,
function
()
{
var
afterHeight
=
window
.
innerHeight
;
var
afterWidth
=
window
.
innerWidth
;
var
moreScroll
=
beforeHeight
-
afterHeight
;
if
(
beforeHeight
>
afterHeight
&&
(
beforeHeight
-
afterHeight
)
>
50
)
{
if
(
beforeHeight
>
afterHeight
&&
beforeHeight
-
afterHeight
>
50
)
{
if
(
beforeWidth
==
afterWidth
)
{
//キーボード表示時
$
(
'.room_container'
).
css
(
'margin-bottom'
,
0
);
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
-
$
(
'.footer_content_b'
).
height
());
$
(
".room_container"
).
css
(
"margin-bottom"
,
0
);
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
-
$
(
".footer_content_b"
).
height
()
);
}
else
{
//画面回転時
window
.
scrollTo
(
0
,
beforeScroll
+
(
moreScroll
*
2
)
-
$
(
'.footer_content_b'
).
height
());
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
*
2
-
$
(
".footer_content_b"
).
height
()
);
}
}
else
if
(
beforeHeight
<
afterHeight
)
{
$
(
'.room_container'
).
css
(
'margin-bottom'
,
footerHeight
);
$
(
".room_container"
).
css
(
"margin-bottom"
,
footerHeight
);
if
(
beforeWidth
==
afterWidth
)
{
//キーボード非表示
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
+
$
(
'.footer_content_b'
).
height
());
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
+
$
(
".footer_content_b"
).
height
()
);
}
else
{
//画面回転時
window
.
scrollTo
(
0
,
beforeScroll
+
(
moreScroll
*
2
)
+
$
(
'.footer_content_b'
).
height
());
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
*
2
+
$
(
".footer_content_b"
).
height
()
);
}
}
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
});
$
(
'#messageInput'
).
focusin
(
function
(
e
)
{
$
(
"#messageInput"
).
focusin
(
function
(
e
)
{
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
beforeScroll
=
window
.
scrollY
;
})
});
// チャットルーム
// メッセージ検索イベント
$
(
'.chat_room_src_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'.chat_room_src_form input[type="search"]'
).
keyup
(
function
(
e
)
{
let
workVal
=
""
;
var
keyword
=
$
(
'.chat_room_src_form input[type="search"]'
).
val
();
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
if
(
keyword
!=
''
&&
keyword
.
length
!=
0
)
{
if
(
keyword
!=
""
&&
keyword
.
length
!=
0
)
{
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
CHAT
.
searchMessage
(
keyword
,
workVal
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'.chat_room_src_form input[type="search"]'
).
on
(
'compositionend'
,
function
(){
$
(
'.chat_room_src_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
let
workVal
=
""
;
var
keyword
=
$
(
'.chat_room_src_form input[type="search"]'
).
val
();
CHAT
.
searchMessage
(
keyword
,
workVal
);
}
});
}
);
$
(
document
).
on
(
'click'
,
'.filter_img'
,
function
(
event
)
{
$
(
document
).
on
(
"click"
,
".filter_img"
,
function
(
event
)
{
let
workVal
=
""
;
var
keyword
=
$
(
'.chat_room_src_form input[type="search"]'
).
val
();
$
(
'.overlay_src_msg'
).
empty
();
$
(
".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
==
1
)
{
return
;
}
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
','
));
$
(
".img_wrap.filter"
).
each
(
function
(
user
)
{
var
selectedUser
=
$
(
".img_wrap.filter"
)[
user
];
checkedUserList
.
push
(
$
(
selectedUser
).
data
(
"user-id"
));
});
if
(
keyword
.
length
==
1
)
{
return
;
}
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
","
));
var
userMessageTemplate
;
$
.
get
({
url
:
"./template/template_user_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_user_message.html"
,
async
:
false
},
function
(
text
)
{
userMessageTemplate
=
text
;
});
}
);
var
myMessageTemplate
;
$
.
get
({
url
:
"./template/template_my_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_my_message.html"
,
async
:
false
},
function
(
text
)
{
myMessageTemplate
=
text
;
});
}
);
let
jQueryMessages
=
$
(
'.overlay_src_msg'
);
messages
.
forEach
(
function
(
message
)
{
let
jQueryMessages
=
$
(
".overlay_src_msg"
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
...
...
@@ -477,13 +610,16 @@ $(function() {
// ユーザの様式を読み込む
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
)
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
);
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
)
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
);
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
...
...
@@ -492,93 +628,117 @@ $(function() {
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
createdAtTime
:
messageTime
.
createdAtTime
,
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
||
message
.
message
.
includes
(
'attachedVideos'
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
html
=
message
.
message
.
includes
(
"attachedImages"
)
||
message
.
message
.
includes
(
"attachedVideos"
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
workVal
=
html
+
workVal
;
})
});
jQueryMessages
.
prepend
(
workVal
);
});
});
// チャットルーム検索
CHAT
.
searchRoom
=
function
(
keyword
,
rooms
)
{
$
(
'.overlay_src_msg'
).
empty
();
CHAT
.
searchRoom
=
function
(
keyword
,
rooms
)
{
$
(
".overlay_src_msg"
).
empty
();
rooms
=
CHAT_DB
.
getRoomList
(
chatRoomType
.
ALL
,
keyword
);
let
roomListTitle
=
getLocalizedString
(
"room_search_placeholder"
);
$
(
'#chatTitle'
).
text
(
roomListTitle
);
$
(
"#chatTitle"
).
text
(
roomListTitle
);
var
template
;
$
.
get
({
url
:
"./template/template_room_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_room_list.html"
,
async
:
false
},
function
(
text
)
{
template
=
text
;
});
rooms
.
forEach
(
function
(
room
)
{
room
.
profileImagePath
=
ASSET_PATH
+
'images/user-profile.png'
}
);
rooms
.
forEach
(
function
(
room
)
{
room
.
profileImagePath
=
ASSET_PATH
+
"images/user-profile.png"
;
if
(
room
.
message
)
{
room
.
message
=
room
.
message
.
toString
()
room
.
message
=
room
.
message
.
toString
();
}
else
{
room
.
message
=
getLocalizedString
(
"noMessages"
)
room
.
message
=
getLocalizedString
(
"noMessages"
);
}
var
displayMsg
;
if
(
room
.
messageType
==
messageType
.
TEXT
||
room
.
messageType
==
messageType
.
SYSTEM
)
displayMsg
=
room
.
message
;
if
(
room
.
messageType
==
messageType
.
IMAGE
)
displayMsg
=
getLocalizedString
(
"image"
);
if
(
room
.
messageType
==
messageType
.
VIDEO
)
displayMsg
=
getLocalizedString
(
"video"
);
if
(
room
.
messageType
==
messageType
.
TEXT
||
room
.
messageType
==
messageType
.
SYSTEM
)
displayMsg
=
room
.
message
;
if
(
room
.
messageType
==
messageType
.
IMAGE
)
displayMsg
=
getLocalizedString
(
"image"
);
if
(
room
.
messageType
==
messageType
.
VIDEO
)
displayMsg
=
getLocalizedString
(
"video"
);
if
(
room
.
messageType
==
messageType
.
TEXT
)
displayMsg
=
room
.
message
;
if
(
room
.
messageType
==
messageType
.
COMMUNICATIONSTART
)
displayMsg
=
getLocalizedString
(
"collaboration_start"
);
if
(
room
.
messageType
==
messageType
.
COMMUNICATIONEND
)
displayMsg
=
getLocalizedString
(
"collaboration_end"
);
if
(
room
.
messageType
==
messageType
.
COMMUNICATIONSTART
)
displayMsg
=
getLocalizedString
(
"collaboration_start"
);
if
(
room
.
messageType
==
messageType
.
COMMUNICATIONEND
)
displayMsg
=
getLocalizedString
(
"collaboration_end"
);
var
attendUserName
=
[];
room
.
attendUsers
.
forEach
(
function
(
user
)
{
room
.
attendUsers
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
attendUserName
.
push
(
user
.
shopMemberName
);
});
var
thumbnailCount
=
room
.
attendUsers
.
length
>
4
?
4
:
room
.
attendUsers
.
length
;
var
thumbnailCount
=
room
.
attendUsers
.
length
>
4
?
4
:
room
.
attendUsers
.
length
;
if
(
room
.
chatRoomName
==
""
)
{
room
.
chatRoomName
=
attendUserName
.
join
(
', '
);
room
.
chatRoomName
=
attendUserName
.
join
(
", "
);
}
let
html
=
Mustache
.
render
(
template
,
{
thumbnailCount
:
thumbnailCount
,
roomName
:
room
.
chatRoomName
,
roomId
:
room
.
chatRoomId
,
profileImage
:
room
.
profileImagePath
,
lastMessage
:
displayMsg
,
time
:
room
.
insertDate
?
CHAT_UTIL
.
formatDate
(
room
.
insertDate
).
createdAt
:
''
,
unreadMsgCnt
:
room
.
unreadCount
==
0
?
''
:
room
.
unreadCount
,
lastMessage
:
displayMsg
,
time
:
room
.
insertDate
?
CHAT_UTIL
.
formatDate
(
room
.
insertDate
).
createdAt
:
""
,
unreadMsgCnt
:
room
.
unreadCount
==
0
?
""
:
room
.
unreadCount
,
userCnt
:
room
.
attendUsers
.
length
+
1
,
attendUsers
:
room
.
attendUsers
attendUsers
:
room
.
attendUsers
,
});
// Click event
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
$
(
".overlay_src_msg"
).
append
(
obj
);
});
if
(
rooms
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
};
// メッセージ検索
CHAT
.
searchMessage
=
function
(
keyword
,
workVal
)
{
$
(
'.overlay_src_msg'
).
empty
();
CHAT
.
searchMessage
=
function
(
keyword
,
workVal
)
{
$
(
".overlay_src_msg"
).
empty
();
var
checkedUserList
=
[];
$
(
'.img_wrap.filter'
).
each
(
function
(
user
)
{
var
selectedUser
=
$
(
'.img_wrap.filter'
)[
user
];
checkedUserList
.
push
(
$
(
selectedUser
).
data
(
'user-id'
));
})
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
','
));
$
(
".img_wrap.filter"
).
each
(
function
(
user
)
{
var
selectedUser
=
$
(
".img_wrap.filter"
)[
user
];
checkedUserList
.
push
(
$
(
selectedUser
).
data
(
"user-id"
));
});
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
","
));
var
userMessageTemplate
;
$
.
get
({
url
:
"./template/template_user_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_user_message.html"
,
async
:
false
},
function
(
text
)
{
userMessageTemplate
=
text
;
});
}
);
var
myMessageTemplate
;
$
.
get
({
url
:
"./template/template_my_message.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_my_message.html"
,
async
:
false
},
function
(
text
)
{
myMessageTemplate
=
text
;
});
}
);
let
jQueryMessages
=
$
(
'.overlay_src_msg'
);
messages
.
forEach
(
function
(
message
)
{
let
jQueryMessages
=
$
(
".overlay_src_msg"
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
...
...
@@ -588,13 +748,16 @@ CHAT.searchMessage = function(keyword, workVal) {
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
insertDate
);
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
)
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
);
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
)
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
);
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
...
...
@@ -602,15 +765,22 @@ CHAT.searchMessage = function(keyword, workVal) {
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
createdAtTime
:
messageTime
.
createdAtTime
,
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
||
message
.
message
.
includes
(
'attachedVideos'
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
html
=
message
.
message
.
includes
(
"attachedImages"
)
||
message
.
message
.
includes
(
"attachedVideos"
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
workVal
=
html
+
workVal
;
})
});
jQueryMessages
.
prepend
(
workVal
);
if
(
messages
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
jQueryMessages
.
append
(
noResultMsg
);
}
};
public_new/js/chatMakeRoom.js
View file @
1a39aefa
// 名前空間
var
CHAT_MAKE_ROOM
=
{};
$
(
function
()
{
$
(
function
()
{
// メンバー検索
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
click
(
function
(
e
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
click
(
function
(
e
)
{
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
'#makeRoomTitle'
).
text
(
contactListTitle
);
$
(
"#makeRoomTitle"
).
text
(
contactListTitle
);
});
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
//画面タイトル設定
var
keyword
=
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
val
();
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
if
(
keyword
!=
''
&&
keyword
.
length
!=
0
)
{
if
(
keyword
!=
""
&&
keyword
.
length
!=
0
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
blur
();
return
false
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
false
;
}
CHAT_MAKE_ROOM
.
searchUser
(
keyword
);
...
...
@@ -26,91 +26,107 @@ $(function() {
}
});
// iOSキーボード変換検知用
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
()
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
val
();
var
keyword
=
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
val
();
CHAT_MAKE_ROOM
.
searchUser
(
keyword
);
}
});
}
);
});
// メンバー検索
CHAT_MAKE_ROOM
.
searchUser
=
function
(
keyword
)
{
var
isAllGroup
=
$
(
'#tabAllGroupOnMakeRoom'
).
is
(
':checked'
);
$
(
'.overlay_src_msg'
).
empty
();
CHAT_MAKE_ROOM
.
searchUser
=
function
(
keyword
)
{
var
isAllGroup
=
$
(
"#tabAllGroupOnMakeRoom"
).
is
(
":checked"
);
$
(
".overlay_src_msg"
).
empty
();
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
var
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
({
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
});
}
);
groupList
.
forEach
(
function
(
group
)
{
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
);
})
$
(
".overlay_src_msg"
).
append
(
obj
);
});
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
});
if
(
findObj
)
{
user
.
checked
=
'checked'
;
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
$
(
".overlay_src_msg"
).
append
(
obj
);
if
(
groupList
.
length
==
0
&&
userList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
}
//連絡先画面
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
});
if
(
findObj
)
{
user
.
checked
=
'checked'
;
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
html
(
obj
);
$
(
".overlay_src_msg"
).
html
(
obj
);
if
(
userList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
}
}
}
;
public_new/js/collaboration.js
View file @
1a39aefa
function
recordStart
()
{
MainManRecord
(
'on'
);
$
(
'#recordBtn'
).
removeClass
(
'bg_gray'
);
$
(
'#recordBtn'
).
addClass
(
'bg_red'
);
MainManRecord
(
"on"
);
$
(
"#recordBtn"
).
removeClass
(
"bg_gray"
);
$
(
"#recordBtn"
).
addClass
(
"bg_red"
);
}
function
recordStop
(
callback
)
{
...
...
@@ -9,62 +9,66 @@ function recordStop(callback) {
screenLock
();
// アーカイブ保存処理
MainManRecordWithCollaboration
(
'stop'
,
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
,
callback
);
MainManRecordWithCollaboration
(
"stop"
,
CMS_SERVER_URL
+
"/chatapi/file/uploadArchive"
,
callback
);
}
function
MainManRecordWithCollaboration
(
action
,
url
,
callback
)
{
mediaRecorder
.
stop
();
console
.
log
(
'Recorded Blobs: '
,
recordedBlobs
);
console
.
log
(
"Recorded Blobs: "
,
recordedBlobs
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
log
(
"Recoding File upload.."
);
const
blob
=
new
Blob
(
recordedBlobs
,
{
type
:
'video/webm'
});
console
.
log
(
blob
)
const
blob
=
new
Blob
(
recordedBlobs
,
{
type
:
"video/webm"
});
console
.
log
(
blob
)
;
var
uploadFileName
=
"record_"
+
g_webroom
+
"_"
+
g_shareCount
+
".webm"
;
g_shareCount
++
;
var
formData
=
new
FormData
();
formData
.
append
(
"fileData"
,
blob
,
uploadFileName
);
formData
.
append
(
'sid'
,
globalUserInfo
.
sid
);
formData
.
append
(
'roomId'
,
globalUserInfo
.
roomId
);
formData
.
append
(
"fileData"
,
blob
,
uploadFileName
);
formData
.
append
(
"sid"
,
globalUserInfo
.
sid
);
formData
.
append
(
"roomId"
,
globalUserInfo
.
roomId
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
formData
.
append
(
'archiveType'
,
1
);
formData
.
append
(
"archiveType"
,
1
);
}
else
{
formData
.
append
(
'archiveType'
,
2
);
formData
.
append
(
"archiveType"
,
2
);
}
console
.
log
(
uploadFileName
)
console
.
log
(
uploadFileName
)
;
$
.
ajax
({
type
:
'post'
,
type
:
"post"
,
url
,
data
:
formData
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
recordFinished
();
callback
();
console
.
log
(
res
)
}
,
error
:
function
(
err
)
{
console
.
log
(
res
);
},
error
:
function
(
err
)
{
recordFinished
();
callback
();
console
.
log
(
err
);
}
},
});
},
1000
);
}
function
screenLock
(){
function
screenLock
()
{
// ロック用のdivを生成
var
element
=
document
.
createElement
(
'div'
);
var
element
=
document
.
createElement
(
"div"
);
element
.
id
=
"screenLock"
;
// ロック用のスタイル
element
.
style
.
height
=
'100%'
;
element
.
style
.
left
=
'0px'
;
element
.
style
.
position
=
'fixed'
;
element
.
style
.
top
=
'0px'
;
element
.
style
.
width
=
'100%'
;
element
.
style
.
zIndex
=
'9999'
;
element
.
style
.
opacity
=
'0'
;
element
.
style
.
height
=
"100%"
;
element
.
style
.
left
=
"0px"
;
element
.
style
.
position
=
"fixed"
;
element
.
style
.
top
=
"0px"
;
element
.
style
.
width
=
"100%"
;
element
.
style
.
zIndex
=
"9999"
;
element
.
style
.
opacity
=
"0"
;
var
objBody
=
document
.
getElementsByTagName
(
"body"
).
item
(
0
);
objBody
.
appendChild
(
element
);
...
...
@@ -78,10 +82,10 @@ function delete_dom_obj(id_name) {
}
function
recordFinished
()
{
$
(
'#recordBtn'
).
addClass
(
'bg_gray'
);
$
(
'#recordBtn'
).
removeClass
(
'bg_red'
);
$
(
"#recordBtn"
).
addClass
(
"bg_gray"
);
$
(
"#recordBtn"
).
removeClass
(
"bg_red"
);
// ロック画面の削除
delete_dom_obj
(
'screenLock'
);
delete_dom_obj
(
"screenLock"
);
}
$
(
function
()
{
...
...
@@ -94,7 +98,6 @@ $(function () {
.
toggleClass
(
"slidein"
)
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
$
(
"#collabo_main"
).
toggleClass
(
"noscroll"
);
});
// ユーザーリストオーバーレイ表示
...
...
@@ -107,7 +110,6 @@ $(function () {
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
$
(
"#collabo_main"
).
toggleClass
(
"noscroll"
);
if
(
$
(
"#overlay_user_list.overlay"
).
hasClass
(
"noscroll"
))
{
$
(
"#overlay_user_list.overlay"
).
removeClass
(
"noscroll"
);
}
else
{
...
...
@@ -159,86 +161,92 @@ $(function () {
CHAT_UI
.
showLoadingIndicator
();
CHAT
.
globalSelectedUserList
=
[];
CHAT_UI
.
refreshMyGroupForAddUserInCollaboration
();
$
(
'#addUserConfirmBtnInCollaboration'
).
off
().
on
(
'click'
,
function
()
{
$
(
'#addUserInCollaboration'
).
modal
(
'hide'
);
if
(
typeof
(
android
)
!=
"undefined"
)
{
$
(
"#addUserConfirmBtnInCollaboration"
)
.
off
()
.
on
(
"click"
,
function
()
{
$
(
"#addUserInCollaboration"
).
modal
(
"hide"
);
if
(
typeof
android
!=
"undefined"
)
{
android
.
saveSelectedUserList
(
CHAT
.
globalSelectedUserList
.
join
(
","
));
}
else
{
webkit
.
messageHandlers
.
saveSelectedUserList
.
postMessage
(
CHAT
.
globalSelectedUserList
.
join
(
","
));
webkit
.
messageHandlers
.
saveSelectedUserList
.
postMessage
(
CHAT
.
globalSelectedUserList
.
join
(
","
)
);
}
CHAT_UI
.
confirmInviteUserListInCollaboration
();
});
});
$
(
'#penBtn'
).
click
(
function
()
{
$
(
'#coviewPenCtrBtn'
).
click
();
if
(
$
(
'#penBtn'
).
hasClass
(
'bg_red'
))
{
$
(
'#penBtn'
).
removeClass
(
'bg_red'
);
$
(
'#penBtn'
).
addClass
(
'bg_blue'
);
$
(
"#penBtn"
).
click
(
function
()
{
$
(
"#coviewPenCtrBtn"
).
click
();
if
(
$
(
"#penBtn"
).
hasClass
(
"bg_red"
))
{
$
(
"#penBtn"
).
removeClass
(
"bg_red"
);
$
(
"#penBtn"
).
addClass
(
"bg_blue"
);
}
else
{
$
(
'#penBtn'
).
addClass
(
'bg_red'
);
$
(
'#penBtn'
).
removeClass
(
'bg_blue'
);
$
(
"#penBtn"
).
addClass
(
"bg_red"
);
$
(
"#penBtn"
).
removeClass
(
"bg_blue"
);
}
})
})
;
$
(
'#photo_open_place_holder'
).
click
(
function
()
{
$
(
"#photo_open_place_holder"
).
click
(
function
()
{
$
(
"#open_file_upload"
).
trigger
(
"click"
);
})
})
;
$
(
'#eraserBtn'
).
click
(
function
()
{
$
(
'#coviewEraserCtrBtn'
).
click
();
})
$
(
"#eraserBtn"
).
click
(
function
()
{
$
(
"#coviewEraserCtrBtn"
).
click
();
})
;
$
(
'#micBtn'
).
click
(
function
()
{
$
(
'#coviewMicCtrBtn'
).
click
();
if
(
$
(
'#micBtn'
).
hasClass
(
'bg_red'
))
{
$
(
"#micBtn"
).
click
(
function
()
{
$
(
"#coviewMicCtrBtn"
).
click
();
if
(
$
(
"#micBtn"
).
hasClass
(
"bg_red"
))
{
micOn
();
}
else
{
micOff
();
}
})
})
;
$
(
'#captureBtn'
).
click
(
function
()
{
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
$
(
"#captureBtn"
).
click
(
function
()
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_red"
))
{
screenLock
();
recordStop
(
function
()
{
$
(
'#screenLock'
).
remove
();
coview_api
.
Capture
(
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
);
recordStop
(
function
()
{
$
(
"#screenLock"
).
remove
();
coview_api
.
Capture
(
CMS_SERVER_URL
+
"/chatapi/file/uploadArchive"
);
});
}
else
{
coview_api
.
Capture
(
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
);
coview_api
.
Capture
(
CMS_SERVER_URL
+
"/chatapi/file/uploadArchive"
);
}
})
})
;
$
(
'#captureRequestBtn'
).
click
(
function
()
{
fw
.
sendToMsg
(
'others'
,
'CAPTURE_REQUEST'
,
{
"name"
:
CHAT
.
globalLoginParameter
.
loginId
});
})
$
(
"#captureRequestBtn"
).
click
(
function
()
{
fw
.
sendToMsg
(
"others"
,
"CAPTURE_REQUEST"
,
{
name
:
CHAT
.
globalLoginParameter
.
loginId
,
});
});
$
(
'#recordBtn'
).
click
(
function
()
{
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_gray'
))
{
$
(
"#recordBtn"
).
click
(
function
()
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_gray"
))
{
recordStart
();
}
else
{
recordStop
(
null
);
}
})
})
;
});
function
penOff
()
{
if
(
$
(
'#penBtn'
).
hasClass
(
'bg_blue'
))
{
$
(
'#coviewPenCtrBtn'
).
click
();
$
(
'#penBtn'
).
addClass
(
'bg_red'
);
$
(
'#penBtn'
).
removeClass
(
'bg_blue'
);
if
(
$
(
"#penBtn"
).
hasClass
(
"bg_blue"
))
{
$
(
"#coviewPenCtrBtn"
).
click
();
$
(
"#penBtn"
).
addClass
(
"bg_red"
);
$
(
"#penBtn"
).
removeClass
(
"bg_blue"
);
}
}
;
}
function
micOn
()
{
coview_api
.
MicMuteControl
(
'off'
);
$
(
'#micBtn'
).
addClass
(
'bg_blue'
);
$
(
'#micBtn'
).
removeClass
(
'bg_red'
);
}
;
coview_api
.
MicMuteControl
(
"off"
);
$
(
"#micBtn"
).
addClass
(
"bg_blue"
);
$
(
"#micBtn"
).
removeClass
(
"bg_red"
);
}
function
micOff
()
{
coview_api
.
MicMuteControl
(
'on'
);
$
(
'#micBtn'
).
removeClass
(
'bg_blue'
);
$
(
'#micBtn'
).
addClass
(
'bg_red'
);
}
;
coview_api
.
MicMuteControl
(
"on"
);
$
(
"#micBtn"
).
removeClass
(
"bg_blue"
);
$
(
"#micBtn"
).
addClass
(
"bg_red"
);
}
public_new/js/common.js
View file @
1a39aefa
// アコーディオン
$
(
'.category'
).
on
(
'click'
,
function
()
{
$
(
".category"
).
on
(
"click"
,
function
()
{
$
(
this
).
toggleClass
(
"open"
);
$
(
this
).
next
().
slideToggle
();
});
$
(
'.home_btn'
).
on
(
'click'
,
function
()
{
$
(
".home_btn"
).
on
(
"click"
,
function
()
{
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
goHome
();
}
else
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
goHome
.
postMessage
({});
}
});
$
(
function
()
{
$
(
function
()
{
var
h
=
$
(
window
).
height
();
//画面の高さを取得
// ローディング表示
...
...
@@ -29,41 +29,40 @@ $(function() {
$
(
'.search_form input[type="search"]'
).
click
(
function
()
{
$
(
this
).
addClass
(
"focus"
);
// キャンセルボタン表示
$
(
'.cancel'
).
removeClass
(
'none'
);
$
(
'.search_form form'
).
addClass
(
'd-flex flex-row h-100 align-items-center'
);
$
(
'.content'
).
addClass
(
'none'
);
$
(
'.craeteRoomButton'
).
addClass
(
'none'
);
$
(
".cancel"
).
removeClass
(
"none"
);
$
(
".search_form form"
).
addClass
(
"d-flex flex-row h-100 align-items-center"
);
$
(
".content"
).
addClass
(
"none"
);
$
(
".craeteRoomButton"
).
addClass
(
"none"
);
});
// 共通検索フォーム キャンセルボタン押下イベント
$
(
'.search_form .cancel'
).
click
(
function
()
{
$
(
this
).
addClass
(
'none'
);
$
(
'.search_form input'
).
removeClass
(
'focus'
);
$
(
'.search_form input'
).
val
(
''
);
$
(
'.search_form form'
).
removeClass
();
$
(
'.content'
).
removeClass
(
'none'
);
$
(
'.overlay_src_msg'
).
empty
();
$
(
'.craeteRoomButton'
).
removeClass
(
'none'
);
$
(
".search_form .cancel"
).
click
(
function
()
{
$
(
this
).
addClass
(
"none"
);
$
(
".search_form input"
).
removeClass
(
"focus"
);
$
(
".search_form input"
).
val
(
""
);
$
(
".search_form form"
).
removeClass
();
$
(
".content"
).
removeClass
(
"none"
);
$
(
".overlay_src_msg"
).
empty
();
$
(
".craeteRoomButton"
).
removeClass
(
"none"
);
});
$
(
'.message_input_form'
).
on
(
'focus'
,
function
(
e
)
{
setTimeout
(
function
()
{
$
(
'.message_input_send'
).
removeClass
(
'none'
);
$
(
'.attach_file'
).
addClass
(
'none'
);
$
(
'.footer_content_b'
).
addClass
(
'none'
);
$
(
".message_input_form"
).
on
(
"focus"
,
function
(
e
)
{
setTimeout
(
function
()
{
$
(
".message_input_send"
).
removeClass
(
"none"
);
$
(
".attach_file"
).
addClass
(
"none"
);
$
(
".footer_content_b"
).
addClass
(
"none"
);
},
10
);
});
$
(
'.message_input_form'
).
on
(
'focusout'
,
function
(
e
)
{
setTimeout
(
function
()
{
if
(
$
(
e
.
relatedTarget
).
hasClass
(
'message_input_send'
))
{
$
(
".message_input_form"
).
on
(
"focusout"
,
function
(
e
)
{
setTimeout
(
function
()
{
if
(
$
(
e
.
relatedTarget
).
hasClass
(
"message_input_send"
))
{
CHAT_UI
.
sendMessage
();
}
else
{
$
(
'.message_input_send'
).
addClass
(
'none'
);
$
(
'.attach_file'
).
removeClass
(
'none'
);
$
(
'.footer_content_b'
).
removeClass
(
'none'
);
$
(
".message_input_send"
).
addClass
(
"none"
);
$
(
".attach_file"
).
removeClass
(
"none"
);
$
(
".footer_content_b"
).
removeClass
(
"none"
);
}
},
10
);
});
});
public_new/js/constant.js
View file @
1a39aefa
...
...
@@ -10,62 +10,62 @@ const readyState = {
};
const
messageType
=
{
TEXT
:
0
,
IMAGE
:
1
,
VIDEO
:
2
,
SYSTEM
:
3
,
COMMUNICATIONSTART
:
4
,
COMMUNICATIONEND
:
5
}
TEXT
:
0
,
IMAGE
:
1
,
VIDEO
:
2
,
SYSTEM
:
3
,
COMMUNICATIONSTART
:
4
,
COMMUNICATIONEND
:
5
,
}
;
const
userAPICmd
=
{
MYINFO
:
9
}
MYINFO
:
9
,
}
;
const
chatRoomType
=
{
DM
:
"1"
,
GROUP
:
"0"
,
ALL
:
"2"
}
DM
:
"1"
,
GROUP
:
"0"
,
ALL
:
"2"
,
}
;
const
groupSearchFlg
=
{
ROOT
:
"0"
}
ROOT
:
"0"
,
}
;
const
nameCardAreaId
=
{
MY
:
"myNamecard"
,
USER
:
"userNamecard"
}
MY
:
"myNamecard"
,
USER
:
"userNamecard"
,
}
;
const
collaborationTypeKey
=
{
AUDIO
:
"audio"
,
CAMERA
:
"camera"
,
VIDEO
:
"video"
,
DOCUMENT
:
"document"
,
BOARD
:
"board"
}
AUDIO
:
"audio"
,
CAMERA
:
"camera"
,
VIDEO
:
"video"
,
DOCUMENT
:
"document"
,
BOARD
:
"board"
,
}
;
const
COLLABORATION_TYPE
=
{
AUDIO
:
0
,
CAMERA
:
2
,
VIDEO
:
3
,
DOCUMENT
:
4
,
BOARD
:
5
}
AUDIO
:
0
,
CAMERA
:
2
,
VIDEO
:
3
,
DOCUMENT
:
4
,
BOARD
:
5
,
}
;
const
makeRoomFlg
=
{
NAME_CARD
:
0
,
MAKE_ROOM
:
1
}
NAME_CARD
:
0
,
MAKE_ROOM
:
1
,
}
;
const
ANDROID_SDK_VERSION
=
{
O
:
26
}
O
:
26
,
}
;
const
HOST_REQUEST_FLG
=
{
DONE
:
0
,
DOING
:
1
}
DONE
:
0
,
DOING
:
1
,
}
;
const
messageSeperator
=
"<::split>"
;
const
dataMessageScheme
=
"::NOT_MESSAGE"
;
public_new/js/contact.js
View file @
1a39aefa
...
...
@@ -3,15 +3,15 @@ var CONTACT = {};
$
(
function
()
{
// メンバー検索
$
(
'#contact .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#contact .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
var
keyword
=
$
(
'#contact .search_form input[type="search"]'
).
val
();
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
if
(
keyword
!=
''
&&
keyword
.
length
!=
0
)
{
if
(
keyword
!=
""
&&
keyword
.
length
!=
0
)
{
$
(
'#contact .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
CONTACT
.
searchUser
(
keyword
);
...
...
@@ -21,80 +21,95 @@ $(function () {
}
});
// iOSキーボード変換検知用
$
(
'#contact .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
()
{
$
(
'#contact .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#contact .search_form input[type="search"]'
).
val
();
CONTACT
.
searchUser
(
keyword
);
}
});
}
);
});
// ユーザー検索
CONTACT
.
searchUser
=
function
(
keyword
)
{
CONTACT
.
searchUser
=
function
(
keyword
)
{
var
groupList
;
$
(
'.overlay_src_msg'
).
empty
();
var
isAllGroup
=
$
(
'#tabAllGroup'
).
is
(
':checked'
);
$
(
".overlay_src_msg"
).
empty
();
var
isAllGroup
=
$
(
"#tabAllGroup"
).
is
(
":checked"
);
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
({
url
:
"./template/template_group_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
});
}
);
groupList
.
forEach
(
function
(
group
)
{
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
isFavorite
:
group
.
isFavorite
isFavorite
:
group
.
isFavorite
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
})
$
(
".overlay_src_msg"
).
append
(
obj
);
});
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
$
(
".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
);
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
$
.
get
(
{
url
:
"./template/template_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
html
(
obj
);
$
(
".overlay_src_msg"
).
html
(
obj
);
if
(
userList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
}
};
public_new/js/loading.js
View file @
1a39aefa
$
(
window
).
on
(
'load'
,
function
()
{
//読み込み完了したら実行する
$
(
'#loader-bg'
).
delay
(
900
).
fadeOut
(
800
);
//ローディングを隠す
$
(
'#loader'
).
delay
(
600
).
fadeOut
(
300
);
$
(
window
).
on
(
"load"
,
function
()
{
//読み込み完了したら実行する
$
(
"#loader-bg"
).
delay
(
900
).
fadeOut
(
800
);
//ローディングを隠す
$
(
"#loader"
).
delay
(
600
).
fadeOut
(
300
);
});
$
(
function
()
{
...
...
public_new/js/share.js
View file @
1a39aefa
...
...
@@ -119,10 +119,10 @@ $(function () {
console
.
log
(
"=============> READY : ready for coview api"
);
Coview_addLoginId
(
globalUserInfo
.
loginId
);
coview_api
.
Login
(
globalUserInfo
.
loginId
);
initCollaborationUI
(
joinCollaborationType
)
fw
.
socket
.
on
(
'message'
,
async
function
(
data
)
{
console
.
log
(
'====> message::data: '
,
data
);
if
(
data
.
type
===
"CHANGE_COLLABORATION"
)
{
initCollaborationUI
(
joinCollaborationType
)
;
fw
.
socket
.
on
(
"message"
,
async
function
(
data
)
{
console
.
log
(
"====> message::data: "
,
data
);
if
(
data
.
type
===
"CHANGE_COLLABORATION"
)
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
...
...
@@ -131,8 +131,12 @@ $(function () {
}
}
if
(
CHAT_UTIL
.
isAndroid
()
&&
data
.
payload
.
collaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
'not_support_version'
));
if
(
CHAT_UTIL
.
isAndroid
()
&&
data
.
payload
.
collaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
"not_support_version"
));
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
}
else
{
joinCollaborationType
=
data
.
payload
.
collaborationType
;
...
...
@@ -141,53 +145,80 @@ $(function () {
initCollaborationUI
(
joinCollaborationType
);
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
joinChangedCollaboration
.
postMessage
({
"joinCollaborationType"
:
joinCollaborationType
,
"meetingId"
:
data
.
payload
.
newMeetingId
});
webkit
.
messageHandlers
.
joinChangedCollaboration
.
postMessage
({
joinCollaborationType
:
joinCollaborationType
,
meetingId
:
data
.
payload
.
newMeetingId
,
});
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
webkit
.
messageHandlers
.
joinMeetingRoom
.
postMessage
(
data
.
payload
.
newMeetingId
);
webkit
.
messageHandlers
.
joinMeetingRoom
.
postMessage
(
data
.
payload
.
newMeetingId
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
joinChangedCollaboration
(
joinCollaborationType
,
data
.
payload
.
newMeetingId
);
android
.
joinChangedCollaboration
(
joinCollaborationType
,
data
.
payload
.
newMeetingId
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
android
.
joinMeetingRoom
(
data
.
payload
.
newMeetingId
);
}
}
}
else
if
(
data
.
type
===
"SHARE_FILE"
)
{
}
else
if
(
data
.
type
===
"SHARE_FILE"
)
{
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
initCollaborationUI
(
COLLABORATION_TYPE
.
CAMERA
);
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
fw
.
sendToMsg
(
'others'
,
'SHARE_FILE_HOST'
,
{
"collaborationType"
:
COLLABORATION_TYPE
.
CAMERA
});
fw
.
sendToMsg
(
"others"
,
"SHARE_FILE_HOST"
,
{
collaborationType
:
COLLABORATION_TYPE
.
CAMERA
,
});
}
}
else
if
(
data
.
type
===
"SHARE_FILE_HOST"
)
{
}
else
if
(
data
.
type
===
"SHARE_FILE_HOST"
)
{
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
&&
g_isMainMan
)
{
initCollaborationUI
(
COLLABORATION_TYPE
.
CAMERA
);
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
}
}
else
if
(
data
.
type
===
"CAPTURE_REQUEST"
&&
g_isMainMan
)
{
if
(
confirm
(
data
.
payload
.
name
+
getLocalizedString
(
"request_capture"
)))
{
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
if
(
confirm
(
data
.
payload
.
name
+
getLocalizedString
(
"request_capture"
))
)
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_red"
))
{
screenLock
();
recordStop
(
function
()
{
$
(
'#screenLock'
).
remove
();
captureAndShareImage
(
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
,
data
.
payload
.
name
);
recordStop
(
function
()
{
$
(
"#screenLock"
).
remove
();
captureAndShareImage
(
CMS_SERVER_URL
+
"/chatapi/file/uploadArchive"
,
data
.
payload
.
name
);
});
}
else
{
captureAndShareImage
(
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
,
data
.
payload
.
name
);
captureAndShareImage
(
CMS_SERVER_URL
+
"/chatapi/file/uploadArchive"
,
data
.
payload
.
name
);
}
}
}
else
if
(
data
.
type
===
"HOST_CHANGE_REQUEST"
)
{
if
(
data
.
payload
.
loginId
==
globalUserInfo
.
loginId
)
{
fw
.
sendToMsg
(
'others'
,
'HOST_CHANGE_RESPONSE'
,
{
"isAndroid"
:
CHAT_UTIL
.
isAndroid
(),
"isAble"
:
androidVersion
>=
ANDROID_SDK_VERSION
.
O
,
"loginId"
:
CHAT
.
globalLoginParameter
.
loginId
});
fw
.
sendToMsg
(
"others"
,
"HOST_CHANGE_RESPONSE"
,
{
isAndroid
:
CHAT_UTIL
.
isAndroid
(),
isAble
:
androidVersion
>=
ANDROID_SDK_VERSION
.
O
,
loginId
:
CHAT
.
globalLoginParameter
.
loginId
,
});
}
}
else
if
(
data
.
type
===
"HOST_CHANGE_RESPONSE"
)
{
var
isAndroid
=
data
.
payload
.
isAndroid
;
var
isAble
=
data
.
payload
.
isAble
if
(
g_isMainMan
&&
isAndroid
&&
!
isAble
&&
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
alert
(
getLocalizedString
(
'err_target_android_version_not_support'
));
}
else
if
(
g_isMainMan
){
var
isAble
=
data
.
payload
.
isAble
;
if
(
g_isMainMan
&&
isAndroid
&&
!
isAble
&&
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
alert
(
getLocalizedString
(
"err_target_android_version_not_support"
));
}
else
if
(
g_isMainMan
)
{
Coview_changeHost
(
getFermiLoginId
(
data
.
payload
.
loginId
));
}
}
else
if
(
data
.
type
===
"API_SEND_OWNER_CHANGE_COMPLETE"
)
{
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_red"
))
{
recordStop
(
penOff
);
}
else
{
penOff
();
...
...
@@ -196,35 +227,54 @@ $(function () {
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
setHostRequestFlg
(
HOST_REQUEST_FLG
.
DOING
);
}
else
{
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DOING
);
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DOING
);
}
if
(
g_isMainMan
)
{
if
(
confirm
(
getLocalizedString
(
'norify_request_host_change'
,
data
.
payload
.
hostId
)))
{
if
(
confirm
(
getLocalizedString
(
"norify_request_host_change"
,
data
.
payload
.
hostId
)
)
)
{
Coview_changeHost
(
getFermiLoginId
(
data
.
payload
.
hostId
));
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
setHostRequestFlg
(
HOST_REQUEST_FLG
.
DONE
);
}
else
{
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
}
}
else
{
fw
.
sendToMsg
(
'others'
,
'HOST_REQUEST_REJECT'
,
{
"hostId"
:
data
.
payload
.
hostId
});
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_REJECT"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
fw
.
sendToMsg
(
'others'
,
'HOST_REQUEST_DONE'
,
{
"hostId"
:
data
.
payload
.
hostId
});
fw
.
sendToMsg
(
"others"
,
"HOST_REQUEST_DONE"
,
{
hostId
:
data
.
payload
.
hostId
,
});
}
}
else
if
(
data
.
type
===
"HOST_REQUEST_DONE"
)
{
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
setHostRequestFlg
(
HOST_REQUEST_FLG
.
DONE
);
}
else
{
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
}
}
else
if
(
data
.
type
===
"HOST_REQUEST_REJECT"
)
{
if
(
data
.
payload
.
hostId
==
CHAT
.
globalLoginParameter
.
loginId
)
{
alert
(
'REJECT for owner user'
);
alert
(
"REJECT for owner user"
);
}
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
setHostRequestFlg
(
HOST_REQUEST_FLG
.
DONE
);
}
else
{
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DONE
);
}
}
});
...
...
@@ -386,14 +436,19 @@ $(function () {
console
.
log
(
"consoleLog"
,
json
);
break
;
case
"fileChange"
:
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
break
;
}
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
break
;
}
LoadMobileShareFile
(
json
.
fileName
);
backgroundFileName
=
json
.
fileName
;
console
.
log
(
"fileChange"
,
json
);
break
;
case
"ReceiveMediaResponse"
:
if
(
isBoard
&&
g_isMainMan
)
{
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
"api"
:
"fileChange"
,
"fileName"
:
backgroundFileName
});
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
api
:
"fileChange"
,
fileName
:
backgroundFileName
,
});
}
break
;
default
:
...
...
@@ -424,101 +479,115 @@ function changeCollaboration(changeCollaborationType) {
}
}
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
setJoinCollaborationType
.
postMessage
(
changeCollaborationType
);
webkit
.
messageHandlers
.
setJoinCollaborationType
.
postMessage
(
changeCollaborationType
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
if
(
changeCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
'not_support_version'
));
if
(
changeCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
"not_support_version"
));
return
;
}
android
.
setJoinCollaborationType
(
changeCollaborationType
);
}
joinCollaborationType
=
changeCollaborationType
;
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_red"
))
{
recordStop
(
null
);
}
initCollaborationUI
(
changeCollaborationType
);
switch
(
changeCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
coview_api
.
ChangeCollaboration
(
'audio'
);
coview_api
.
ChangeCollaboration
(
"audio"
);
break
;
case
COLLABORATION_TYPE
.
CAMERA
:
coview_api
.
ChangeCollaboration
(
'image'
);
coview_api
.
ChangeCollaboration
(
"image"
);
break
;
case
COLLABORATION_TYPE
.
VIDEO
:
coview_api
.
ChangeCollaboration
(
'video'
);
coview_api
.
ChangeCollaboration
(
"video"
);
break
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
coview_api
.
ChangeCollaboration
(
'audio'
);
coview_api
.
ChangeCollaboration
(
"audio"
);
if
(
CHAT_UTIL
.
isIOS
())
{
newMeetingId
=
CHAT_DB
.
createContentView
();
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
newMeetingId
=
android
.
createContentView
();
console
.
log
(
'newMeetingId = '
+
newMeetingId
);
console
.
log
(
"newMeetingId = "
+
newMeetingId
);
}
break
;
case
COLLABORATION_TYPE
.
BOARD
:
coview_api
.
ChangeCollaboration
(
'audio'
);
coview_api
.
ChangeCollaboration
(
"audio"
);
break
;
}
if
(
$
(
'#micBtn'
).
hasClass
(
'bg_red'
))
{
if
(
$
(
"#micBtn"
).
hasClass
(
"bg_red"
))
{
micOff
();
}
else
{
micOn
();
}
penOff
();
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
changeCollaboration
.
postMessage
({
"changeCollaborationType"
:
changeCollaborationType
,
"meetingId"
:
newMeetingId
});
webkit
.
messageHandlers
.
changeCollaboration
.
postMessage
({
changeCollaborationType
:
changeCollaborationType
,
meetingId
:
newMeetingId
,
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
changeCollaboration
(
changeCollaborationType
,
newMeetingId
);
}
fw
.
sendToMsg
(
'others'
,
'CHANGE_COLLABORATION'
,
{
"collaborationType"
:
changeCollaborationType
,
"newMeetingId"
:
newMeetingId
});
fw
.
sendToMsg
(
"others"
,
"CHANGE_COLLABORATION"
,
{
collaborationType
:
changeCollaborationType
,
newMeetingId
:
newMeetingId
,
});
}
var
scrollLock
=
function
(
e
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
if
(
$
(
e
.
target
).
closest
(
'.add_user_modal'
).
length
>
0
||
$
(
e
.
target
).
closest
(
'#overlay_user_list'
).
length
>
0
||
$
(
e
.
target
).
closest
(
'.pip_indicator'
).
length
>
0
)
{
if
(
$
(
e
.
target
).
closest
(
".add_user_modal"
).
length
>
0
||
$
(
e
.
target
).
closest
(
"#overlay_user_list"
).
length
>
0
||
$
(
e
.
target
).
closest
(
".pip_indicator"
).
length
>
0
)
{
e
.
stopPropagation
();
}
else
{
e
.
preventDefault
();
}
}
}
}
;
let
collaboScreen
=
document
.
getElementById
(
'collabo_main'
);
let
collaboScreen
=
document
.
getElementById
(
"collabo_main"
);
function
scrollLockON
()
{
collaboScreen
.
addEventListener
(
'touchmove'
,
scrollLock
,
{
passive
:
false
});
collaboScreen
.
addEventListener
(
"touchmove"
,
scrollLock
,
{
passive
:
false
});
}
function
scrollLockOFF
()
{
collaboScreen
.
removeEventListener
(
'touchmove'
,
scrollLock
,
{
passive
:
false
});
collaboScreen
.
removeEventListener
(
"touchmove"
,
scrollLock
,
{
passive
:
false
,
});
}
function
initCollaborationUI
(
changeCollaborationType
){
$
(
'#coviewEraserCtrBtn'
).
click
();
if
(
$
(
'.user_btn'
).
hasClass
(
"hide"
))
{
$
(
'.user_btn'
).
click
();
function
initCollaborationUI
(
changeCollaborationType
)
{
$
(
"#coviewEraserCtrBtn"
).
click
();
if
(
$
(
".user_btn"
).
hasClass
(
"hide"
))
{
$
(
".user_btn"
).
click
();
}
if
(
$
(
'.menu_btn'
).
hasClass
(
"hide"
))
{
if
(
$
(
".menu_btn"
).
hasClass
(
"hide"
))
{
$
(
".menu_btn"
).
click
();
}
if
(
CHAT_UTIL
.
isIOS
)
{
roomType
=
CHAT_DB
.
getRoomType
();
if
(
roomType
==
chatRoomType
.
DM
)
{
$
(
'.add_user_btn'
).
removeClass
(
'none'
);
$
(
".add_user_btn"
).
removeClass
(
"none"
);
}
}
$
(
"link[href='./css/collaboration_board.css']"
).
remove
();
penOff
();
switch
(
changeCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.voice_contents'
).
removeClass
(
'none'
);
var
w
=
$
(
'.user_btn'
).
width
();
$
(
'.user_btn'
).
toggleClass
(
"hide"
);
$
(
".collaboration_contents"
).
addClass
(
"none"
);
$
(
".voice_contents"
).
removeClass
(
"none"
);
var
w
=
$
(
".user_btn"
).
width
();
$
(
".user_btn"
).
toggleClass
(
"hide"
);
$
(
"#overlay_user_list.overlay"
)
.
toggleClass
(
"slidein"
)
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
...
...
@@ -531,20 +600,20 @@ function initCollaborationUI(changeCollaborationType){
break
;
case
COLLABORATION_TYPE
.
CAMERA
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.picture_contents'
).
removeClass
(
'none'
);
$
(
".collaboration_contents"
).
addClass
(
"none"
);
$
(
".picture_contents"
).
removeClass
(
"none"
);
break
;
case
COLLABORATION_TYPE
.
VIDEO
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.video_contents'
).
removeClass
(
'none'
);
$
(
".collaboration_contents"
).
addClass
(
"none"
);
$
(
".video_contents"
).
removeClass
(
"none"
);
break
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.document_contents'
).
removeClass
(
'none'
);
var
w
=
$
(
'.user_btn'
).
width
();
$
(
'.user_btn'
).
toggleClass
(
"hide"
);
$
(
".collaboration_contents"
).
addClass
(
"none"
);
$
(
".document_contents"
).
removeClass
(
"none"
);
var
w
=
$
(
".user_btn"
).
width
();
$
(
".user_btn"
).
toggleClass
(
"hide"
);
$
(
"#overlay_user_list.overlay"
)
.
toggleClass
(
"slidein"
)
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
...
...
@@ -557,9 +626,11 @@ function initCollaborationUI(changeCollaborationType){
break
;
case
COLLABORATION_TYPE
.
BOARD
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.board_contents'
).
removeClass
(
'none'
);
$
(
'head'
).
append
(
'<link rel="stylesheet" href="./css/collaboration_board.css">'
);
$
(
".collaboration_contents"
).
addClass
(
"none"
);
$
(
".board_contents"
).
removeClass
(
"none"
);
$
(
"head"
).
append
(
'<link rel="stylesheet" href="./css/collaboration_board.css">'
);
break
;
}
}
...
...
@@ -573,7 +644,7 @@ function Coview_exitCollaboration(isDocument = false) {
android
.
exitMeetingRoom
();
}
}
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
if
(
$
(
"#recordBtn"
).
hasClass
(
"bg_red"
))
{
recordStop
(
Coview_finishCollaboration
);
}
else
{
Coview_finishCollaboration
();
...
...
@@ -587,11 +658,11 @@ function Coview_finishCollaboration() {
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
finishCollaboration
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
finishCollaboration
()
android
.
finishCollaboration
();
}
}
};
isLeaved
=
true
;
if
(
collaborationJoinFlg
!=
'2'
)
{
if
(
collaborationJoinFlg
!=
"2"
)
{
CHAT_UI
.
joinRoom
(
CHAT
.
globalLoginParameter
.
roomId
,
CHAT
.
globalLoginParameter
.
name
...
...
@@ -614,26 +685,29 @@ function Coview_addLoginId(loginId) {
console
.
log
(
"addUser loginId = "
+
loginId
);
var
url
=
"https://biztaskyell.abookcloud.com/auth/getuser"
;
$
.
ajax
({
url
:
url
,
method
:
'post'
,
data
:
{
id
:
loginId
url
:
url
,
method
:
"post"
,
data
:
{
id
:
loginId
,
},
success
:
function
(
result
)
{
success
:
function
(
result
)
{
console
.
log
(
"result"
,
result
);
if
(
result
.
statusCode
!=
200
)
{
coview_api
.
addUser
(
loginId
);
}
},
error
:
function
(
err
)
{
error
:
function
(
err
)
{
console
.
log
(
err
.
toString
());
}
}
,
});
}
function
applyForHostChange
()
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
'not_support_version'
));
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
"not_support_version"
));
return
;
}
var
hostRequestFlg
=
0
;
...
...
@@ -643,16 +717,20 @@ function applyForHostChange() {
hostRequestFlg
=
CHAT_DB
.
getHostRequestFlg
();
}
if
(
hostRequestFlg
==
HOST_REQUEST_FLG
.
DOING
)
{
alert
(
getLocalizedString
(
'already_processing_host_request'
));
alert
(
getLocalizedString
(
"already_processing_host_request"
));
return
;
}
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
setHostRequestFlg
(
HOST_REQUEST_FLG
.
DOING
);
}
else
{
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DOING
);
webkit
.
messageHandlers
.
setHostRequestFlg
.
postMessage
(
HOST_REQUEST_FLG
.
DOING
);
}
fw
.
sendToMsg
(
'others'
,
'CHANGE_HOST_APPLY'
,
{
"hostId"
:
CHAT
.
globalLoginParameter
.
loginId
});
};
fw
.
sendToMsg
(
"others"
,
"CHANGE_HOST_APPLY"
,
{
hostId
:
CHAT
.
globalLoginParameter
.
loginId
,
});
}
function
Coview_connect_audio_collaboration
()
{
globalUserInfo
.
coWorkType
=
collaborationTypeKey
.
AUDIO
;
...
...
@@ -666,43 +744,63 @@ function hostSearchInterval() {
let
hostName
=
""
;
function
hostSearch
()
{
if
(
g_isMainMan
)
{
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
$
(
'.host_contents'
).
removeClass
(
'none'
);
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
$
(
".host_contents"
).
removeClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
'.photo_select_button'
).
removeClass
(
'none'
);
$
(
".photo_select_button"
).
removeClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
'.video_contents_host'
).
removeClass
(
'none'
);
$
(
'.video_contents_user'
).
addClass
(
'none'
);
$
(
".video_contents_host"
).
removeClass
(
"none"
);
$
(
".video_contents_user"
).
addClass
(
"none"
);
}
if
(
CHAT_UTIL
.
isIOS
())
isIos
=
true
;
}
else
{
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
removeClass
(
"host"
);
$
(
'.host_contents'
).
addClass
(
'none'
);
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
removeClass
(
"host"
);
$
(
".host_contents"
).
addClass
(
"none"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
'.photo_select_button'
).
addClass
(
'none'
);
$
(
".photo_select_button"
).
addClass
(
"none"
);
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
'.video_contents_user'
).
removeClass
(
'none'
);
$
(
'.video_contents_host'
).
addClass
(
'none'
);
$
(
".video_contents_user"
).
removeClass
(
"none"
);
$
(
".video_contents_host"
).
addClass
(
"none"
);
}
}
if
(
hostName
!=
g_isMainManUsername
)
{
if
(
hostName
!=
""
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
removeClass
(
"host"
);
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
removeClass
(
"host"
);
}
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
g_isMainManUsername
)).
addClass
(
"host"
);
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
g_isMainManUsername
)
).
addClass
(
"host"
);
hostName
=
g_isMainManUsername
;
}
else
{
if
(
hostName
==
""
)
{
if
(
!
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
())
{
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
if
(
!
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
()
)
{
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
}
}
else
{
if
(
!
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
hasClass
(
'host'
))
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
addClass
(
"host"
);
if
(
!
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
hasClass
(
"host"
)
)
{
$
(
"#collaboration_user_"
+
getReplacedLoginId
(
hostName
)).
addClass
(
"host"
);
}
}
}
}
...
...
@@ -710,23 +808,25 @@ function hostSearchInterval() {
}
function
hostChangeRequest
(
loginId
)
{
fw
.
sendToMsg
(
'others'
,
'HOST_CHANGE_REQUEST'
,
{
"loginId"
:
getFermiLoginId
(
loginId
)});
fw
.
sendToMsg
(
"others"
,
"HOST_CHANGE_REQUEST"
,
{
loginId
:
getFermiLoginId
(
loginId
),
});
}
function
getFermiLoginId
(
loginId
)
{
return
globalUserInfo
.
shopName
+
'_'
+
loginId
;
return
globalUserInfo
.
shopName
+
"_"
+
loginId
;
}
function
getReplacedLoginId
(
loginId
)
{
return
loginId
.
replaceAll
(
globalUserInfo
.
shopName
+
'_'
,
''
);
return
loginId
.
replaceAll
(
globalUserInfo
.
shopName
+
"_"
,
""
);
}
function
captureAndShareImage
(
urls
,
changeHostName
)
{
addCaptureEffect
();
$
(
this
).
removeClass
(
"on"
);
var
w
,
h
;
var
w
,
h
;
var
video
=
document
.
getElementById
(
"localVideo"
);
var
canvas
=
document
.
createElement
(
'canvas'
);
var
canvas
=
document
.
createElement
(
"canvas"
);
if
(
clientOrientaionState
==
1
)
{
canvas
.
width
=
w
=
680
;
canvas
.
height
=
h
=
515
;
...
...
@@ -735,32 +835,44 @@ function captureAndShareImage(urls, changeHostName) {
canvas
.
height
=
h
=
515
;
}
if
(
canvas
.
getContext
)
{
var
ctx
=
canvas
.
getContext
(
'2d'
);
var
ctx
=
canvas
.
getContext
(
"2d"
);
ctx
.
drawImage
(
video
,
0
,
0
,
w
,
h
);
ctx
.
drawImage
(
document
.
getElementById
(
"canvasRemote"
),
0
,
0
,
w
,
h
);
}
canvas
.
toBlob
(
function
(
blob
)
{
var
newImg
=
document
.
createElement
(
'img'
)
canvas
.
toBlob
(
function
(
blob
)
{
var
newImg
=
document
.
createElement
(
"img"
);
var
url
=
URL
.
createObjectURL
(
blob
);
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundSize
=
"contain"
;
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
));
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
)
);
$
(
canvasRemote
).
attr
(
"width"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"width"
));
console
.
log
(
'url'
,
URL
.
createObjectURL
(
blob
));
if
(
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
/
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
<
$
(
canvas
).
attr
(
"width"
)
/
$
(
canvas
).
attr
(
"height"
))
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
*
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
w
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
);
console
.
log
(
"url"
,
URL
.
createObjectURL
(
blob
));
if
(
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
/
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
<
$
(
canvas
).
attr
(
"width"
)
/
$
(
canvas
).
attr
(
"height"
)
)
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
*
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
w
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
);
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
(
-
h
/
2
)
);
$
(
canvasRemote
).
css
(
"margin-left"
,
(
-
w
/
2
)
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
else
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
);
var
w
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
/
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
h
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
);
var
w
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
/
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
(
-
h
/
2
)
);
$
(
canvasRemote
).
css
(
"margin-left"
,
(
-
w
/
2
)
);
$
(
canvasRemote
).
css
(
"margin-top"
,
-
h
/
2
);
$
(
canvasRemote
).
css
(
"margin-left"
,
-
w
/
2
);
}
$
(
".canvas_wrap"
).
css
(
"background-color"
,
"#000"
);
$
(
".clear_img"
).
show
();
...
...
@@ -769,34 +881,42 @@ function captureAndShareImage(urls, changeHostName) {
//Fermi側にイメージ保存。
var
formData
=
new
FormData
();
var
uploadFileName
=
"capture_share_"
+
g_webroom
+
"_"
+
g_shareCount
+
".png"
var
uploadFileName
=
"capture_share_"
+
g_webroom
+
"_"
+
g_shareCount
+
".png"
;
g_shareCount
++
;
formData
.
append
(
"imgFile"
,
blob
,
uploadFileName
);
var
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
":"
+
location
.
port
+
"/upload/create"
;
var
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
":"
+
location
.
port
+
"/upload/create"
;
if
(
!
location
.
port
)
{
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
"/upload/create"
;
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
"/upload/create"
;
}
$
.
ajax
({
type
:
'post'
,
type
:
"post"
,
url
:
g_coviewapiserverADDR
+
"/upload/create"
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
res
)
{
setTimeout
(
function
()
{
success
:
function
(
res
)
{
setTimeout
(
function
()
{
SendFileShare
(
uploadFileName
);
$
(
"#coviewCaptureCtrBtn"
).
hide
();
$
(
"#coviewRecCtrBtn"
).
hide
();
$
(
".coview_share_title_name"
).
text
(
"LIVE(CAPTURE IMAGE)"
);
$
(
".coview_on_media_btn_back"
).
show
();
//アーカイブ保存。
ArchiveFileManage
(
blob
,
uploadFileName
,
urls
);
ArchiveFileManage
(
blob
,
uploadFileName
,
urls
);
},
1500
);
},
error
:
function
(
err
)
{
error
:
function
(
err
)
{
console
.
log
(
err
);
}
}
,
});
});
}
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