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
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2489 additions
and
2039 deletions
+2489
-2039
public_new/js/archive.js
+35
-29
public_new/js/chat-add-user.js
+108
-92
public_new/js/chat-db.js
+322
-279
public_new/js/chat-error.js
+13
-14
public_new/js/chat-room.js
+16
-16
public_new/js/chat-util.js
+125
-121
public_new/js/chat-websocket.js
+486
-433
public_new/js/chat.js
+713
-543
public_new/js/chatMakeRoom.js
+120
-104
public_new/js/collaboration.js
+115
-107
public_new/js/common.js
+27
-28
public_new/js/constant.js
+38
-38
public_new/js/contact.js
+100
-85
public_new/js/loading.js
+4
-3
public_new/js/share.js
+267
-147
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
!=
''
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
if
(
keyword
.
length
!=
0
&&
keyword
!=
""
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
$
(
'.overlay_src_msg'
).
empty
();
$
(
".overlay_src_msg"
).
empty
();
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
}
// 検索結果を表示
});
// iOSキーボード変換検知用
$
(
'#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
();
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
$
(
'#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
();
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
)
{
archiveTemplate
=
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
)
{
//画面タイトル設定
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
'#addUserTitle'
).
text
(
contactListTitle
);
})
$
(
'#chat_add_user .search_form input[type="search"]'
).
click
(
function
(
e
)
{
//画面タイトル設定
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
"#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
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
return
false
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
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
();
return
false
;
}
CHAT_ADD_USER
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
return
;
$
(
'#chat_add_user .search_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#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
();
$
(
'#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
();
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
)
{
groupTemplate
=
text
;
});
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
var
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
}
);
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
});
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
);
})
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
if
(
findObj
)
{
user
.
checked
=
'checked'
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
if
(
findObj
)
{
user
.
checked
=
'checked'
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.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
);
}
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
);
}
}
};
public_new/js/chat-db.js
View file @
1a39aefa
...
...
@@ -3,372 +3,415 @@ var CHAT_DB = {};
// ios用
function
callNativeApp
(
iosKey
,
jsonData
)
{
console
.
log
(
"callNativeApp called"
);
var
result
;
try
{
var
key
=
iosKey
;
var
data
=
jsonData
;
var
payload
=
{
key
:
key
,
data
:
data
};
// payloadの形 {"type":"SJbridge","data":{"name":"abc","role":"dev"}}
// resにObjective-cからのレスポンスが返る
result
=
prompt
(
JSON
.
stringify
(
payload
));
console
.
log
(
result
);
}
catch
(
err
)
{
console
.
log
(
'The native context does not exist yet'
);
}
return
result
;
console
.
log
(
"callNativeApp called"
);
var
result
;
try
{
var
key
=
iosKey
;
var
data
=
jsonData
;
var
payload
=
{
key
:
key
,
data
:
data
};
// payloadの形 {"type":"SJbridge","data":{"name":"abc","role":"dev"}}
// resにObjective-cからのレスポンスが返る
result
=
prompt
(
JSON
.
stringify
(
payload
));
console
.
log
(
result
);
}
catch
(
err
)
{
console
.
log
(
"The native context does not exist yet"
);
}
return
result
;
}
//ロカールDBからルーム一覧情報を取得
CHAT_DB
.
getRoomList
=
function
(
roomType
,
keyWord
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
"roomType"
:
roomType
,
"keyWord"
:
keyWord
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getRoomList
(
roomType
,
keyWord
));
}
CHAT_DB
.
getRoomList
=
function
(
roomType
,
keyWord
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getRoomList"
,
{
"roomType"
:
roomType
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getRoomList
(
roomType
));
}
}
CHAT_DB
.
callGetRoomList
=
function
(
roomType
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyInfo"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyInfo
());
}
CHAT_DB
.
getMyInfo
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyInfo"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyInfo
());
}
};
CHAT_DB
.
getMessages
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMessages"
,
{
"roomId"
:
roomId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMessageList
(
roomId
));
}
CHAT_DB
.
getMessages
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteUsersNotInRoom
());
}
CHAT_DB
.
getFavoriteUsersNotInRoom
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteUsersNotInRoom
());
}
};
CHAT_DB
.
getFavoriteUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteUsers
());
}
CHAT_DB
.
getFavoriteUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteUsers
());
}
};
CHAT_DB
.
getFavoriteGroups
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteGroups"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteGroups
());
}
CHAT_DB
.
getFavoriteGroups
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getFavoriteGroups"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteGroups
());
}
};
CHAT_DB
.
getMyGroupUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupUsers
());
}
CHAT_DB
.
getMyGroupUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsers"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupUsers
());
}
};
CHAT_DB
.
getGroupInfo
=
function
(
groupId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getGroupInfo"
,
{
"groupId"
:
groupId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupInfo
(
groupId
));
}
CHAT_DB
.
getGroupInfo
=
function
(
groupId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupInfoForAddUser
(
groupId
));
}
};
CHAT_DB
.
loadSelectedUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getSelectedUserList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
console
.
log
(
JSON
.
parse
(
android
.
getSelectedUserList
()));
return
JSON
.
parse
(
android
.
getSelectedUserList
());
}
}
CHAT_DB
.
loadSelectedUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getSelectedUserList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
console
.
log
(
JSON
.
parse
(
android
.
getSelectedUserList
()));
return
JSON
.
parse
(
android
.
getSelectedUserList
());
}
}
;
CHAT_DB
.
getNameCardData
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getNameCardData"
,
{
"shopMemberId"
:
shopMemberId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getNameCardData
(
shopMemberId
));
}
CHAT_DB
.
getNameCardData
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getNameCardData"
,
{
shopMemberId
:
shopMemberId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getNameCardData
(
shopMemberId
));
}
};
CHAT_DB
.
getMyGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberByName"
,
{
"shopMemberName"
:
shopMemberName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberByName
(
shopMemberName
));
}
CHAT_DB
.
getMyGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberNotInRoomByName"
,
{
"shopMemberName"
:
shopMemberName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberNotInRoomByName
(
shopMemberName
));
}
CHAT_DB
.
getMyGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupShopMemberNotInRoomByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberNotInRoomByName
(
shopMemberName
)
);
}
};
CHAT_DB
.
getAllGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberByName"
,
{
"shopMemberName"
:
shopMemberName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberByName
(
shopMemberName
));
}
CHAT_DB
.
getAllGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberNotInRoomByName"
,
{
"shopMemberName"
:
shopMemberName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberNotInRoomByName
(
shopMemberName
));
}
CHAT_DB
.
getAllGroupShopMemberNotInRoomByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getAllGroupShopMemberNotInRoomByName"
,
{
shopMemberName
:
shopMemberName
,
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberNotInRoomByName
(
shopMemberName
)
);
}
};
CHAT_DB
.
getGroupByName
=
function
(
groupName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getGroupByName"
,
{
"groupName"
:
groupName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupByName
(
groupName
));
}
CHAT_DB
.
getGroupByName
=
function
(
groupName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUsersInRoom"
,
{
"roomId"
:
roomId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getUsersInRoom
(
roomId
));
}
}
CHAT_DB
.
getUsersInRoom
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveList
());
}
CHAT_DB
.
getArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveList"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveList
());
}
};
CHAT_DB
.
updateArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveList
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
updateArchiveList
();
}
CHAT_DB
.
updateArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveList
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
updateArchiveList
();
}
};
// アーカイブ一覧検索
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveByName"
,
{
"archiveName"
:
archiveName
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveListByName
(
archiveName
));
}
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveByName"
,
{
archiveName
:
archiveName
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveListByName
(
archiveName
));
}
};
// アーカイブ詳細
CHAT_DB
.
getArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveDetail"
,
{
"archiveId"
:
archiveId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveDetail
(
archiveId
));
}
CHAT_DB
.
getArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getArchiveDetail"
,
{
archiveId
:
archiveId
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getArchiveDetail
(
archiveId
));
}
};
CHAT_DB
.
updateArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveDetail
.
postMessage
(
archiveId
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
updateArchiveDetail
(
archiveId
);
}
CHAT_DB
.
updateArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveDetail
.
postMessage
(
archiveId
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
updateArchiveDetail
(
archiveId
);
}
};
CHAT_DB
.
searchMessages
=
function
(
keyword
,
userList
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"searchMessages"
,
{
"keyWord"
:
keyword
,
"userList"
:
userList
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
searchMessages
(
keyword
,
userList
));
}
CHAT_DB
.
searchMessages
=
function
(
keyword
,
userList
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupUsersNotInRoom
());
}
CHAT_DB
.
getMyGroupUsersNotInRoom
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getMyGroupUsersNotInRoom"
,
{}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupUsersNotInRoom
());
}
};
CHAT_DB
.
getUserInfo
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUserInfo"
,
{
"shopMemberId"
:
shopMemberId
}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getUserInfo
(
shopMemberId
));
}
CHAT_DB
.
getUserInfo
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getBeforeRoomType"
,
{});
}
CHAT_DB
.
getBeforeRoomType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getBeforeRoomType"
,
{});
}
};
CHAT_DB
.
getRoomType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getRoomType"
,
{}),
10
);
}
CHAT_DB
.
getRoomType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getRoomType"
,
{}),
10
);
}
};
CHAT_DB
.
removeFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteUser"
,
{
"shopMemberId"
:
shopMemberId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
CHAT_DB
.
removeFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteUser"
,
{
shopMemberId
:
shopMemberId
,
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
}
};
CHAT_DB
.
addFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteUser"
,
{
"shopMemberId"
:
shopMemberId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
CHAT_DB
.
addFavoriteUser
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteUser"
,
{
shopMemberId
:
shopMemberId
,
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
}
};
CHAT_DB
.
removeFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteGroup"
,
{
"groupId"
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
CHAT_DB
.
removeFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"removeFavoriteGroup"
,
{
groupId
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
}
};
CHAT_DB
.
addFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteGroup"
,
{
"groupId"
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
CHAT_DB
.
addFavoriteGroup
=
function
(
groupId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
var
result
=
callNativeApp
(
"addFavoriteGroup"
,
{
groupId
:
groupId
});
if
(
result
==
"true"
)
{
return
true
;
}
else
{
return
false
;
}
}
};
CHAT_DB
.
getContentList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO ローカルDBからダウンロード済のコンテンツを取得
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getContentList
());
}
CHAT_DB
.
getContentList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO ローカルDBからダウンロード済のコンテンツを取得
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getContentList
());
}
};
CHAT_DB
.
getUserListByLoginId
=
function
(
loginIdList
)
{
console
.
log
(
loginIdList
);
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUserListByLoginId"
,
{
"loginIdList"
:
loginIdList
.
join
(
","
)}));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getUserListByLoginId
(
loginIdList
.
join
(
","
)));
}
}
CHAT_DB
.
getUserListByLoginId
=
function
(
loginIdList
)
{
console
.
log
(
loginIdList
);
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
callNativeApp
(
"getUserListByLoginId"
,
{
loginIdList
:
loginIdList
.
join
(
","
),
})
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getUserListByLoginId
(
loginIdList
.
join
(
","
)));
}
};
CHAT_DB
.
getCollaborationJoinFlg
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getCollaborationJoinFlg"
,
{});
}
CHAT_DB
.
getCollaborationJoinFlg
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getCollaborationJoinFlg"
,
{});
}
};
CHAT_DB
.
getUserInfoList
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getUserInfoList"
,
{
"shopMemberId"
:
shopMemberId
});
}
CHAT_DB
.
getUserInfoList
=
function
(
shopMemberId
)
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getUserInfoList"
,
{
shopMemberId
:
shopMemberId
});
}
};
CHAT_DB
.
createContentView
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"createContentView"
,
{}));
}
CHAT_DB
.
createContentView
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"createContentView"
,
{}));
}
};
CHAT_DB
.
getToMoveGroupId
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getToMoveGroupId"
,
{});
}
CHAT_DB
.
getToMoveGroupId
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
callNativeApp
(
"getToMoveGroupId"
,
{});
}
};
CHAT_DB
.
getJoinCollaborationType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getJoinCollaborationType"
,
{}),
10
);
}
CHAT_DB
.
getJoinCollaborationType
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getJoinCollaborationType"
,
{}),
10
);
}
};
CHAT_DB
.
getHostRequestFlg
=
function
()
{
// Androidは実装不要
if
(
CHAT_UTIL
.
isIOS
())
{
return
parseInt
(
callNativeApp
(
"getHostRequestFlg"
,
{}),
10
);
}
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
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
goHome
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
goHome
();
}
jQuery
(
"#homeButton"
).
on
(
"click"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
goHome
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
goHome
();
}
});
jQuery
(
'#reloadButton'
).
on
(
'click'
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要。
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
reload
();
}
});
\ No newline at end of file
jQuery
(
"#reloadButton"
).
on
(
"click"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要。
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
reload
();
}
});
public_new/js/chat-room.js
View file @
1a39aefa
var
lastscrollvalue
;
window
.
onscroll
=
function
()
{
beforeScroll
=
window
.
scrollY
;
}
window
.
onscroll
=
function
()
{
beforeScroll
=
window
.
scrollY
;
}
;
$
(
'#roomNameChangeBtn'
).
click
(
function
()
{
var
changeRoomName
=
$
(
'#roomNameInput'
).
val
();
var
trimmedRoomName
=
$
(
'#roomNameInput'
).
val
().
trim
();
if
(
trimmedRoomName
.
length
==
0
)
{
alert
(
getLocalizedString
(
"error_empty_room_name"
));
return
;
}
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
changeRoomName
.
postMessage
(
changeRoomName
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
changeRoomName
(
changeRoomName
);
}
})
$
(
"#roomNameChangeBtn"
).
click
(
function
()
{
var
changeRoomName
=
$
(
"#roomNameInput"
).
val
();
var
trimmedRoomName
=
$
(
"#roomNameInput"
).
val
().
trim
();
if
(
trimmedRoomName
.
length
==
0
)
{
alert
(
getLocalizedString
(
"error_empty_room_name"
));
return
;
}
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
changeRoomName
.
postMessage
(
changeRoomName
);
}
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
)
{
const
REFERENCE
=
moment
();
const
TODAY
=
REFERENCE
.
clone
().
startOf
(
'day'
);
let
createdAt
=
moment
(
date
);
if
(
date
.
length
==
14
)
{
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'
))
{
createdAt
=
createdAtTime
;
}
else
{
createdAt
=
createdAtDay
;
}
let
rntDate
=
new
Object
();
rntDate
.
createdAtDay
=
createdAtDay
;
rntDate
.
createdAtTime
=
createdAtTime
;
rntDate
.
createdAt
=
createdAt
;
return
rntDate
;
}
CHAT_UTIL
.
formatDate
=
function
(
date
)
{
const
REFERENCE
=
moment
();
const
TODAY
=
REFERENCE
.
clone
().
startOf
(
"day"
);
let
createdAt
=
moment
(
date
);
if
(
date
.
length
==
14
)
{
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"
))
{
createdAt
=
createdAtTime
;
}
else
{
createdAt
=
createdAtDay
;
}
let
rntDate
=
new
Object
();
rntDate
.
createdAtDay
=
createdAtDay
;
rntDate
.
createdAtTime
=
createdAtTime
;
rntDate
.
createdAt
=
createdAt
;
return
rntDate
;
}
;
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
;
}
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
()
{
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
);
});
return
uuid
;
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
);
}
);
return
uuid
;
};
CHAT_UTIL
.
systemDay
=
function
(
date
)
{
let
createdAt
=
moment
(
date
);
createdAt
=
moment
(
date
,
'YYYYMMDDhhmmss'
);
const
createdAtDow
=
createdAt
.
format
(
'YYYY-MM-DD'
);
CHAT_UTIL
.
systemDay
=
function
(
date
)
{
let
createdAt
=
moment
(
date
);
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
.
dow
=
moment
(
createdAtDow
).
day
();
let
systemDay
=
new
Object
();
systemDay
.
year
=
createdAt
.
format
(
"YYYY"
);
systemDay
.
month
=
createdAt
.
format
(
"MM"
);
systemDay
.
day
=
createdAt
.
format
(
"DD"
);
systemDay
.
dow
=
moment
(
createdAtDow
).
day
();
return
systemDay
;
}
return
systemDay
;
}
;
CHAT_UTIL
.
findDow
=
function
(
data
)
{
let
dow
=
""
;
if
(
data
==
0
)
{
dow
=
getLocalizedString
(
'sunday'
);
}
else
if
(
data
==
1
)
{
dow
=
getLocalizedString
(
'monday'
);
}
else
if
(
data
==
2
)
{
dow
=
getLocalizedString
(
'thusday'
);
}
else
if
(
data
==
3
)
{
dow
=
getLocalizedString
(
'wednesday'
);
}
else
if
(
data
==
4
)
{
dow
=
getLocalizedString
(
'thursday'
);
}
else
if
(
data
==
5
)
{
dow
=
getLocalizedString
(
'friday'
);
}
else
if
(
data
==
6
)
{
dow
=
getLocalizedString
(
'sunday'
);
}
return
dow
;
}
CHAT_UTIL
.
findDow
=
function
(
data
)
{
let
dow
=
""
;
if
(
data
==
0
)
{
dow
=
getLocalizedString
(
"sunday"
);
}
else
if
(
data
==
1
)
{
dow
=
getLocalizedString
(
"monday"
);
}
else
if
(
data
==
2
)
{
dow
=
getLocalizedString
(
"thusday"
);
}
else
if
(
data
==
3
)
{
dow
=
getLocalizedString
(
"wednesday"
);
}
else
if
(
data
==
4
)
{
dow
=
getLocalizedString
(
"thursday"
);
}
else
if
(
data
==
5
)
{
dow
=
getLocalizedString
(
"friday"
);
}
else
if
(
data
==
6
)
{
dow
=
getLocalizedString
(
"sunday"
);
}
return
dow
;
}
;
function
msToTime
(
s
)
{
var
ms
=
s
%
1000
;
...
...
@@ -98,55 +101,57 @@ 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'
);
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
);
$
(
item
).
html
(
msToTime
(
now
-
insertDate
));
});
var
now
=
new
Date
();
$
(
".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
);
$
(
item
).
html
(
msToTime
(
now
-
insertDate
));
});
}
CHAT_UTIL
.
getCollaborationType
=
function
(
key
)
{
switch
(
key
)
{
case
collaborationTypeKey
.
AUDIO
:
return
COLLABORATION_TYPE
.
AUDIO
;
case
collaborationTypeKey
.
CAMERA
:
return
COLLABORATION_TYPE
.
CAMERA
;
case
collaborationTypeKey
.
VIDEO
:
return
COLLABORATION_TYPE
.
VIDEO
;
case
collaborationTypeKey
.
DOCUMENT
:
return
COLLABORATION_TYPE
.
DOCUMENT
;
default
:
return
0
;
}
}
CHAT_UTIL
.
getCollaborationType
=
function
(
key
)
{
switch
(
key
)
{
case
collaborationTypeKey
.
AUDIO
:
return
COLLABORATION_TYPE
.
AUDIO
;
case
collaborationTypeKey
.
CAMERA
:
return
COLLABORATION_TYPE
.
CAMERA
;
case
collaborationTypeKey
.
VIDEO
:
return
COLLABORATION_TYPE
.
VIDEO
;
case
collaborationTypeKey
.
DOCUMENT
:
return
COLLABORATION_TYPE
.
DOCUMENT
;
default
:
return
0
;
}
}
;
CHAT_UTIL
.
getCoviewTypeFromCollaborationType
=
function
(
joinCollaborationType
)
{
switch
(
joinCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
console
.
log
(
collaborationTypeKey
.
AUDIO
);
return
collaborationTypeKey
.
AUDIO
;
case
COLLABORATION_TYPE
.
CAMERA
:
console
.
log
(
collaborationTypeKey
.
CAMERA
);
return
collaborationTypeKey
.
CAMERA
;
case
COLLABORATION_TYPE
.
VIDEO
:
return
collaborationTypeKey
.
VIDEO
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
return
collaborationTypeKey
.
DOCUMENT
;
case
COLLABORATION_TYPE
.
BOARD
:
return
collaborationTypeKey
.
BOARD
;
default
:
return
0
;
}
}
\ No newline at end of file
CHAT_UTIL
.
getCoviewTypeFromCollaborationType
=
function
(
joinCollaborationType
)
{
switch
(
joinCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
console
.
log
(
collaborationTypeKey
.
AUDIO
);
return
collaborationTypeKey
.
AUDIO
;
case
COLLABORATION_TYPE
.
CAMERA
:
console
.
log
(
collaborationTypeKey
.
CAMERA
);
return
collaborationTypeKey
.
CAMERA
;
case
COLLABORATION_TYPE
.
VIDEO
:
return
collaborationTypeKey
.
VIDEO
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
return
collaborationTypeKey
.
DOCUMENT
;
case
COLLABORATION_TYPE
.
BOARD
:
return
collaborationTypeKey
.
BOARD
;
default
:
return
0
;
}
};
public_new/js/chat-websocket.js
View file @
1a39aefa
...
...
@@ -3,66 +3,63 @@ var socket;
// 名前空間
var
CHAT_SOCKET
=
{};
CHAT_SOCKET
.
socketCheck
=
function
()
{
if
(
socket
==
null
||
socket
.
disconnected
)
{
window
.
location
.
reload
();
}
}
if
(
socket
==
null
||
socket
.
disconnected
)
{
window
.
location
.
reload
();
}
}
;
CHAT_SOCKET
.
connectSocket
=
function
()
{
if
(
IS_ONLINE
==
'true'
)
{
socket
=
io
(
CHAT_SERVER_URL
);
setSocketAction
();
}
else
{
//オフラインの場合、DBからルーム一覧を表示。
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOSの場合
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
}
if
(
IS_ONLINE
==
"true"
)
{
socket
=
io
(
CHAT_SERVER_URL
);
setSocketAction
();
}
else
{
//オフラインの場合、DBからルーム一覧を表示。
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOSの場合
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
}
}
};
/* ---------------------------------------------------
* Socket Connect/Disconnectc
* --------------------------------------------------- */
function
setSocketAction
()
{
socket
.
on
(
'connect'
,
function
()
{
// socketが接続されたらチャット画面で画面を更新する
$
(
'.overlay'
).
removeClass
(
'active undismissable'
);
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
getLoginParameter
();
}
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
'disconnect'
,
function
()
{
//socketが切断されたら黒画面で画面を更新する
$
(
'.overlay'
).
addClass
(
'active undismissable'
);
//alert('Disconnected from the server');
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
'connect_error'
,
function
()
{
CHAT_UI
.
dismissLoadingIndicator
();
});
/* ----------------------------------------------------------------------
*
* Chat Room List Tab
*
* ---------------------------------------------------------------------- */
// Update Room List
//TODO APIの連動が終わったら削除予定
/*socket.on('refreshRoomList', function(rooms, activeRoomId = null){
function
setSocketAction
()
{
socket
.
on
(
"connect"
,
function
()
{
// socketが接続されたらチャット画面で画面を更新する
$
(
".overlay"
).
removeClass
(
"active undismissable"
);
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
getLoginParameter
();
}
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
"disconnect"
,
function
()
{
//socketが切断されたら黒画面で画面を更新する
$
(
".overlay"
).
addClass
(
"active undismissable"
);
//alert('Disconnected from the server');
CHAT_UI
.
dismissLoadingIndicator
();
});
socket
.
on
(
"connect_error"
,
function
()
{
CHAT_UI
.
dismissLoadingIndicator
();
});
/* ----------------------------------------------------------------------
*
* Chat Room List Tab
*
* ---------------------------------------------------------------------- */
// Update Room List
//TODO APIの連動が終わったら削除予定
/*socket.on('refreshRoomList', function(rooms, activeRoomId = null){
CHAT.globalIsInvite = false;
...
...
@@ -165,187 +162,221 @@ function setSocketAction () {
CHAT_UI.dismissLoadingIndicator();
});*/
// New Message
// #36170
socket
.
on
(
'newMessage'
,
function
(
message
,
roomId
,
roomName
)
{
console
.
log
(
message
);
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
});
var
systemMessageTemplate
;
$
.
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
)
{
openCollaborationMessageTemplate
=
text
;
});
let
template
=
userMessageTemplate
;
if
(
message
.
id
===
socket
.
id
)
{
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
template
=
myMessageTemplate
;
// New Message
// #36170
socket
.
on
(
"newMessage"
,
function
(
message
,
roomId
,
roomName
)
{
console
.
log
(
message
);
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
}
);
var
systemMessageTemplate
;
$
.
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
)
{
openCollaborationMessageTemplate
=
text
;
}
);
let
template
=
userMessageTemplate
;
if
(
message
.
id
===
socket
.
id
)
{
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
template
=
myMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
createdAt
);
message
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
message
.
profileImagePath
);
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
);
}
catch
(
e
)
{
message
.
text
=
message
.
text
;
}
let
type
;
let
collaborationType
;
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
)
{
collaborationType
=
text
[
2
];
var
meetingId
=
0
;
if
(
collaborationType
==
CHAT_UTIL
.
getCollaborationType
(
collaborationTypeKey
.
DOCUMENT
)
)
{
meetingId
=
text
[
3
];
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
createdAt
);
message
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
message
.
profileImagePath
)
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
)
}
catch
(
e
)
{
message
.
text
=
message
.
text
var
userInCollaboration
;
if
(
CHAT_UTIL
.
isIOS
())
{
userInCollaboration
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
)
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
userInCollaboration
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
)
);
}
let
type
;
let
collaborationType
;
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
)
{
collaborationType
=
text
[
2
];
var
meetingId
=
0
;
if
(
collaborationType
==
CHAT_UTIL
.
getCollaborationType
(
collaborationTypeKey
.
DOCUMENT
))
{
meetingId
=
text
[
3
];
}
var
userInCollaboration
;
if
(
CHAT_UTIL
.
isIOS
())
{
userInCollaboration
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
userInCollaboration
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
));
}
userInCollaboration
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
})
template
=
openCollaborationMessageTemplate
;
let
html
=
Mustache
.
render
(
template
,
{
roomName
:
roomName
,
userCount
:
1
,
userList
:
userInCollaboration
,
insertDate
:
message
.
insertDate
,
collaborationType
:
collaborationType
,
isToday
:
true
,
meetingId
:
meetingId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isOtherYear
:
false
});
$
(
'#messages'
).
append
(
html
);
}
else
{
var
replacePath
=
message
.
text
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
message
.
text
=
replacePath
;
var
messageSender
;
if
(
CHAT_UTIL
.
isIOS
())
{
messageSender
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
messageSender
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
));
}
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
text
,
from
:
messageSender
[
0
].
shopMemberName
,
profileImage
:
message
.
profileImagePath
,
shopMemberId
:
message
.
userId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isToday
:
true
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
'attachedImages'
)
||
message
.
text
.
includes
(
'attachedVideos'
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
$
(
'#messages'
).
append
(
html
);
}
userInCollaboration
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
template
=
openCollaborationMessageTemplate
;
let
html
=
Mustache
.
render
(
template
,
{
roomName
:
roomName
,
userCount
:
1
,
userList
:
userInCollaboration
,
insertDate
:
message
.
insertDate
,
collaborationType
:
collaborationType
,
isToday
:
true
,
meetingId
:
meetingId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isOtherYear
:
false
,
});
$
(
"#messages"
).
append
(
html
);
}
else
{
var
replacePath
=
message
.
text
;
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
text
=
replacePath
;
var
messageSender
;
if
(
CHAT_UTIL
.
isIOS
())
{
messageSender
=
JSON
.
parse
(
CHAT_DB
.
getUserInfoList
(
message
.
userId
));
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
messageSender
=
JSON
.
parse
(
android
.
getUserInfoList
(
message
.
userId
));
}
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
text
,
from
:
messageSender
[
0
].
shopMemberName
,
profileImage
:
message
.
profileImagePath
,
shopMemberId
:
message
.
userId
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
,
isToday
:
true
,
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
"attachedImages"
)
||
message
.
text
.
includes
(
"attachedVideos"
)
?
CHAT_UTIL
.
htmlDecode
(
html
)
:
html
;
$
(
"#messages"
).
append
(
html
);
}
}
// 画像、動画の描画を待ってからスクロール
setTimeout
(
function
()
{
CHAT_UI
.
scrollToBottom
();
},
300
);
});
// Notification
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');
// });
// Update User List In Room
// サイドバーのユーザーリストアップデート。
/* socket.on('updateUserList', function(users, onlineUsers) {
// 画像、動画の描画を待ってからスクロール
setTimeout
(
function
()
{
CHAT_UI
.
scrollToBottom
();
},
300
);
});
// Notification
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');
// });
// Update User List In Room
// サイドバーのユーザーリストアップデート。
/* socket.on('updateUserList', function(users, onlineUsers) {
console.log(users);
console.log(onlineUsers);
...
...
@@ -388,229 +419,252 @@ function setSocketAction () {
$('#users').html(ul);
});*/
// Update Group List(Invite)
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>'
);
}
// グループ名と人数を表記する。
groups
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
template
,
{
name
:
group
.
groupName
,
info
:
group
.
memberCnt
+
getLocalizedString
(
"people"
)
});
// グループをクリックすると、該当グループのユーザーリストを読み込むようにイベントを与える
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
'getUserListInGroup'
,
group
.
groupId
,
isInvite
);
$
(
'#groupName'
).
text
(
group
.
groupName
);
});
$
(
'#group_list'
).
append
(
obj
);
});
// Update Group List(Invite)
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>"
);
}
// グループ名と人数を表記する。
groups
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
template
,
{
name
:
group
.
groupName
,
info
:
group
.
memberCnt
+
getLocalizedString
(
"people"
),
});
// グループをクリックすると、該当グループのユーザーリストを読み込むようにイベントを与える
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
"getUserListInGroup"
,
group
.
groupId
,
isInvite
);
$
(
"#groupName"
).
text
(
group
.
groupName
);
});
$
(
"#group_list"
).
append
(
obj
);
});
// Rotate
if
(
CHAT_UI
.
isLandscapeMode
())
{
$
(
".group_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
}
// Rotate
if
(
CHAT_UI
.
isLandscapeMode
())
{
$
(
".group_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
}
// Set Title
let
memberSelectTitle
=
getLocalizedString
(
"groupSearch"
);
// Set Title
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
()
{
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
}
else
{
$
(
".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
);
}
else
{
$
(
"#userSelectionLength"
).
text
(
""
);
}
$
(
"#backButton"
)
.
off
()
.
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
if
(
isInvite
)
{
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
$
(
'#newRoomName, .roomListIcon, .chatRoomIcon'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
$
(
"#pills-chat-tab"
).
tab
(
"show"
);
}
else
{
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
$
(
'.roomListIcon, .chatRoomIcon, #newRoomName'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
if
(
IS_ONLINE
==
"true"
)
{
android
.
updateRoomList
();
CHAT_UI
.
refreshRoomList
(
chatRoomType
.
DM
);
CHAT_UI
.
dismissLoadingIndicator
();
}
}
if
(
CHAT
.
globalSelectedUserList
.
length
>
0
)
{
$
(
'#userSelectionLength'
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
});
});
// Update User List(Invite)
// #36170
socket
.
on
(
"refreshUserListInGroup"
,
function
(
users
,
groupId
,
isInvite
)
{
$
(
"#user_list"
).
html
(
""
);
const
template
=
$
(
"#user-template"
).
html
();
// Set Title
let
memberSelectTitle
=
getLocalizedString
(
"userSearch"
);
$
(
".titleRoomName"
).
text
(
memberSelectTitle
);
users
.
forEach
(
function
(
user
)
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
user
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
user
.
profileImagePath
);
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
,
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
"click"
,
function
()
{
if
(
$
(
this
).
find
(
".userCheckBox.active"
).
length
>
0
)
{
// remove
CHAT
.
globalSelectedUserList
=
CHAT
.
globalSelectedUserList
.
filter
(
function
(
element
)
{
return
user
.
loginId
!=
element
.
loginId
;
}
);
}
else
{
$
(
'#userSelectionLength'
).
text
(
''
);
// add
CHAT
.
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
,
});
}
$
(
this
).
find
(
".userCheckBox"
).
toggleClass
(
"active"
);
$
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
if
(
isInvite
)
{
$
(
'#pills-chat-tab'
).
tab
(
'show'
);
}
else
{
if
(
IS_ONLINE
==
'true'
)
{
android
.
updateRoomList
();
CHAT_UI
.
refreshRoomList
(
chatRoomType
.
DM
);
CHAT_UI
.
dismissLoadingIndicator
();
}
}
});
});
// Update User List(Invite)
// #36170
socket
.
on
(
'refreshUserListInGroup'
,
function
(
users
,
groupId
,
isInvite
)
{
$
(
'#user_list'
).
html
(
''
);
const
template
=
$
(
'#user-template'
).
html
();
// Set Title
let
memberSelectTitle
=
getLocalizedString
(
"userSearch"
)
$
(
'.titleRoomName'
).
text
(
memberSelectTitle
);
users
.
forEach
(
function
(
user
)
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
user
.
profileImagePath
=
CHAT
.
getProfileImgUrl
(
user
.
profileImagePath
)
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
$
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
()
{
if
(
$
(
this
).
find
(
'.userCheckBox.active'
).
length
>
0
)
{
// remove
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
});
}
$
(
this
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
if
(
CHAT
.
globalSelectedUserList
.
length
>
0
)
{
$
(
'#userSelectionLength'
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
}
else
{
$
(
'#userSelectionLength'
).
text
(
''
);
}
});
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
})
if
(
findObj
)
{
$
(
obj
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
}
$
(
'#user_list'
).
append
(
obj
);
})
$
(
'.userCheckBox'
).
show
();
// Rotate
if
(
CHAT_UI
.
isLandscapeMode
())
{
$
(
".user_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
if
(
CHAT
.
globalSelectedUserList
.
length
>
0
)
{
$
(
"#userSelectionLength"
).
text
(
CHAT
.
globalSelectedUserList
.
length
);
}
else
{
$
(
"#userSelectionLength"
).
text
(
""
);
}
});
$
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
'getGroupList'
,
isInvite
)
});
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
});
$
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
CHAT_UI
.
setConfirmButtonEvent
(
isInvite
);
});
if
(
findObj
)
{
$
(
obj
).
find
(
".userCheckBox"
).
toggleClass
(
"active"
);
}
$
(
'#backButton'
).
show
();
$
(
'.roomListIcon, .chatRoomIcon'
).
hide
();
$
(
'#userSelectionConfirmBtn'
).
show
();
$
(
'.userCheckBox'
).
show
();
$
(
'#pills-user-tab'
).
tab
(
'show'
);
$
(
"#user_list"
).
append
(
obj
);
});
$
(
".userCheckBox"
).
show
();
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
socket
.
on
(
'showServerError'
,
function
(
message
)
{
// #36174
// #36215
if
(
message
.
includes
(
"SC_FORBIDDEN"
))
{
alert
(
'SC_FORBIDDEN'
);
return
;
}
// Rotate
if
(
CHAT_UI
.
isLandscapeMode
())
{
$
(
".user_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
}
if
(
message
==
'server error Ocurred'
)
{
message
=
getLocalizedString
(
"serverErrorOccured"
);
}
else
if
(
message
==
'Room not found'
)
{
message
=
getLocalizedString
(
"errorRoomNotFound"
);
}
$
(
"#customAlertTitle"
).
text
(
message
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
'#customAlert'
).
appendTo
(
"body"
).
modal
({
backdrop
:
'static'
,
keyboard
:
false
})
.
on
(
'click'
,
'#customAlertOk'
,
function
(
e
)
{
});
CHAT_UI
.
dismissLoadingIndicator
();
$
(
"#backButton"
)
.
off
()
.
on
(
"click"
,
function
()
{
// loadingIndicatorを表示
CHAT_UI
.
showLoadingIndicator
();
socket
.
emit
(
"getGroupList"
,
isInvite
);
});
if
(
message
==
"Room not found"
)
{
CHAT
.
saveRoomInfo
();
}
});
$
(
"#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"
);
});
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
socket
.
on
(
"showServerError"
,
function
(
message
)
{
// #36174
// #36215
if
(
message
.
includes
(
"SC_FORBIDDEN"
))
{
alert
(
"SC_FORBIDDEN"
);
return
;
}
// server's request : user info (retry join)
socket
.
on
(
"retryJoinProcess"
,
()
=>
{
var
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
//if ((ua.indexOf('iphone') > 0 || ua.indexOf('ipad') > 0) && ua.indexOf("safari") == -1) {
if
(
CHAT_UTIL
.
isIOS
())
{
// iosでの場合
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({});
// } else if (ua.indexOf('android') > 0 && ua.indexOf('linux') == -1){
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
// androidでの場合
android
.
getLoginParameter
();
if
(
message
==
"server error Ocurred"
)
{
message
=
getLocalizedString
(
"serverErrorOccured"
);
}
else
if
(
message
==
"Room not found"
)
{
message
=
getLocalizedString
(
"errorRoomNotFound"
);
}
$
(
"#customAlertTitle"
).
text
(
message
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
"#customAlert"
)
.
appendTo
(
"body"
)
.
modal
({
backdrop
:
"static"
,
keyboard
:
false
,
})
.
on
(
"click"
,
"#customAlertOk"
,
function
(
e
)
{});
CHAT_UI
.
dismissLoadingIndicator
();
if
(
message
==
"Room not found"
)
{
CHAT
.
saveRoomInfo
();
}
});
// server's request : user info (retry join)
socket
.
on
(
"retryJoinProcess"
,
()
=>
{
var
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
//if ((ua.indexOf('iphone') > 0 || ua.indexOf('ipad') > 0) && ua.indexOf("safari") == -1) {
if
(
CHAT_UTIL
.
isIOS
())
{
// iosでの場合
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({});
// } else if (ua.indexOf('android') > 0 && ua.indexOf('linux') == -1){
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
// androidでの場合
android
.
getLoginParameter
();
}
else
{
CHAT_UI
.
htmlElementTextInitialize
(
"ko"
);
// webでのsocket connect
socket
.
emit
(
"join"
,
params
,
function
(
err
)
{
if
(
err
)
{
// #36174
$
(
"#customAlertTitle"
).
text
(
err
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
"#customAlert"
)
.
appendTo
(
"body"
)
.
modal
({
backdrop
:
"static"
,
keyboard
:
false
,
})
.
on
(
"click"
,
"#customAlertOk"
,
function
(
e
)
{});
}
else
{
CHAT_UI
.
htmlElementTextInitialize
(
"ko"
)
// webでのsocket connect
socket
.
emit
(
'join'
,
params
,
function
(
err
)
{
if
(
err
)
{
// #36174
$
(
"#customAlertTitle"
).
text
(
err
);
$
(
"#customAlertOk"
).
text
(
getLocalizedString
(
"yesTitle"
));
$
(
'#customAlert'
).
appendTo
(
"body"
).
modal
({
backdrop
:
'static'
,
keyboard
:
false
})
.
on
(
'click'
,
'#customAlertOk'
,
function
(
e
)
{
});
}
else
{
if
(
params
.
roomName
!=
undefined
)
{
$
(
'.titleRoomName'
).
text
(
params
.
roomName
).
data
(
'roomName'
,
params
.
roomName
);
}
else
{
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
)
$
(
'.titleRoomName'
).
text
(
roomListTitle
)
}
}
// loadingIndicatorを表示しない
CHAT_UI
.
dismissLoadingIndicator
();
});
if
(
params
.
roomName
!=
undefined
)
{
$
(
".titleRoomName"
)
.
text
(
params
.
roomName
)
.
data
(
"roomName"
,
params
.
roomName
);
}
else
{
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
);
$
(
".titleRoomName"
).
text
(
roomListTitle
);
}
}
})
}
\ No newline at end of file
// loadingIndicatorを表示しない
CHAT_UI
.
dismissLoadingIndicator
();
});
}
});
}
public_new/js/chat.js
View file @
1a39aefa
...
...
@@ -15,602 +15,772 @@ var beforeHeight = window.innerHeight;
var
beforeWidth
=
window
.
innerWidth
;
var
beforeScroll
;
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
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
if
(
roomId
==
undefined
&&
roomName
==
undefined
)
{
android
.
saveVisitRoomInfo
(
''
,
''
);
}
else
{
android
.
saveVisitRoomInfo
(
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
,
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
if
(
roomId
==
undefined
&&
roomName
==
undefined
)
{
android
.
saveVisitRoomInfo
(
""
,
""
);
}
else
{
android
.
saveVisitRoomInfo
(
roomId
,
roomName
);
}
}
}
};
// #36170 画像パスが存在しない場合はデフォルトの画像を返す
// 存在する場合はプロフィール画像取得用APIのURLを生成して返す
CHAT
.
getProfileImgUrl
=
function
(
path
)
{
if
(
path
==
undefined
||
path
==
""
)
{
return
ASSET_PATH
+
'img/noImage.png'
;
CHAT
.
getProfileImgUrl
=
function
(
path
)
{
if
(
path
==
undefined
||
path
==
""
)
{
return
ASSET_PATH
+
"img/noImage.png"
;
}
else
{
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"
);
}
else
{
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'
;
}
else
{
return
path
;
}
return
path
;
}
}
}
};
// Video のサムネイルファイル生成する
CHAT
.
createVideoThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
var
fileReader
=
new
FileReader
();
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
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
video
.
pause
();
}
};
video
.
addEventListener
(
'loadeddata'
,
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
}
});
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
);
fetch
(
canvas
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
// 回転された画像をFormDataに保存
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
});
callback
(
newFile
,
true
);
// ajax End
}).
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
)
}
});
return
true
;
};
video
.
addEventListener
(
'timeupdate'
,
timeupdate
);
video
.
preload
=
'metadata'
;
video
.
src
=
url
;
// Load video in Safari / IE11
video
.
muted
=
true
;
video
.
playsInline
=
true
;
CHAT
.
createVideoThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
var
fileReader
=
new
FileReader
();
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
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
"timeupdate"
,
timeupdate
);
video
.
pause
();
}
};
fileReader
.
readAsArrayBuffer
(
sourceImage
);
}
video
.
addEventListener
(
"loadeddata"
,
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
"timeupdate"
,
timeupdate
);
}
});
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
);
fetch
(
canvas
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
// 回転された画像をFormDataに保存
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
,
});
callback
(
newFile
,
true
);
// ajax End
})
.
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
);
}
});
return
true
;
};
video
.
addEventListener
(
"timeupdate"
,
timeupdate
);
video
.
preload
=
"metadata"
;
video
.
src
=
url
;
// Load video in Safari / IE11
video
.
muted
=
true
;
video
.
playsInline
=
true
;
video
.
pause
();
};
fileReader
.
readAsArrayBuffer
(
sourceImage
);
};
// 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"
,
type
:
"post"
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
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
// uploadFileの判断
var
extension
=
imageName
.
substr
(
imageName
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
// 画像の処理
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
;
imageName
=
res
.
thumbImageFileName
;
}
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
});
lightbox
.
append
(
image
);
lightbox
.
append
(
downloadIcon
);
let
text
=
lightbox
.
prop
(
'outerHTML'
)
let
encodedText
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
text
;
}
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
});
videoTag
.
append
(
source
);
totalDiv
.
append
(
videoTag
);
totalDiv
.
append
(
downloadIcon
);
let
text
=
totalDiv
.
prop
(
'outerHTML'
);
let
encodedText
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
text
;
}
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
VIDEO
},
1
);
}
$
(
'.overlay'
).
removeClass
(
'active undismissable'
);
$
(
'.loader'
).
removeClass
(
'active'
);
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"
,
type
:
"post"
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
error
:
function
()
{
alert
(
"読み込み失敗"
);
CHAT_UI
.
dismissLoadingIndicator
();
},
})
}
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
)
{
const
fileReader
=
new
FileReader
();
const
img
=
new
Image
();
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
.
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
();
// 画像の処理
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
;
imageName
=
res
.
thumbImageFileName
;
}
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
,
});
if
(
img
.
width
>
img
.
height
)
{
rate
=
500
/
img
.
width
}
else
{
rate
=
500
/
img
.
height
lightbox
.
append
(
image
);
lightbox
.
append
(
downloadIcon
);
let
text
=
lightbox
.
prop
(
"outerHTML"
);
let
encodedText
;
try
{
encodedText
=
encodeURIComponent
(
text
);
}
catch
(
e
)
{
encodedText
=
text
;
}
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
);
// ctx.drawImage(img, 0, 0, width, height);
fetch
(
elem
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
});
callback
(
newFile
,
true
)
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
;
}
}).
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
)
}
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
,
});
}
fileReader
.
readAsDataURL
(
sourceImage
);
}
// 該当チャットルームに参加するためログイン情報をサーバに渡す
getLoginParameter
=
function
(
sid
,
loginId
,
shopName
,
roomId
=
undefined
,
roomName
=
undefined
,
languageCode
,
shopMemberId
)
{
var
loginParam
=
new
Object
()
loginParam
.
sid
=
sid
;
loginParam
.
loginId
=
loginId
;
loginParam
.
shopName
=
shopName
;
loginParam
.
roomId
=
roomId
;
loginParam
.
roomName
=
roomName
;
loginParam
.
shopMemberId
=
shopMemberId
;
CHAT
.
globalLoginParameter
=
loginParam
;
if
(
!
languageCode
)
{
languageCode
=
"en"
}
// fermi coview share
globalUserInfo
.
sid
=
sid
;
globalUserInfo
.
loginId
=
shopName
+
'_'
+
loginId
;
globalUserInfo
.
shopName
=
shopName
;
globalUserInfo
.
roomId
=
roomId
;
globalUserInfo
.
roomName
=
roomName
;
globalUserInfo
.
languageCode
=
languageCode
;
videoTag
.
append
(
source
);
totalDiv
.
append
(
videoTag
);
totalDiv
.
append
(
downloadIcon
);
CHAT_UI
.
htmlElementTextInitialize
(
languageCode
);
CHAT_UI
.
dismissLoadingIndicator
();
}
let
text
=
totalDiv
.
prop
(
"outerHTML"
);
let
encodedText
;
try
{
encodedText
=
encodeURIComponent
(
text
);
}
catch
(
e
)
{
encodedText
=
text
;
}
CHAT
.
leaveRoom
=
function
()
{
socket
.
emit
(
'leaveRoom'
,
function
()
{
socket
.
emit
(
"createMessage"
,
{
text
:
encodedText
+
messageSeperator
+
messageType
.
VIDEO
,
},
1
);
}
$
(
".overlay"
).
removeClass
(
"active undismissable"
);
$
(
".loader"
).
removeClass
(
"active"
);
CHAT_UI
.
dismissLoadingIndicator
();
});
}
}
;
$
(
function
()
{
// ルーム名変更イベント
$
(
'.change_room_name_btn button'
).
click
(
function
(){
$
(
'form'
).
submit
();
});
CHAT
.
createGetDataUrl
=
function
(
fileName
,
roomId
)
{
var
filePath
=
CMS_SERVER_URL
+
"/chatapi/file/getImage?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
+
fileName
+
"&roomId="
+
roomId
;
return
filePath
;
};
// 検索アイコン押下イベント
$
(
'.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'
);
$
(
'.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
();
// ユーザーリスト表示
$
(
'#filter'
).
addClass
(
'none'
);
$
(
'#user_list'
).
removeClass
(
'none'
);
// Thumbnailのファイルを生成する。
CHAT
.
createThumbnailAndUpload
=
function
(
sourceImage
,
callback
)
{
const
fileReader
=
new
FileReader
();
const
img
=
new
Image
();
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
;
}
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
'.chat_list'
).
addClass
(
'none'
);
CHAT_UI
.
scrollToBottom
();
});
if
(
img
.
width
>
img
.
height
)
{
rate
=
500
/
img
.
width
;
}
else
{
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
);
// ctx.drawImage(img, 0, 0, width, height);
fetch
(
elem
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
)
{
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
)
{
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
,
});
$
(
'.chat_room_src_form input[type="search"]'
).
click
(
function
()
{
if
(
$
(
'#searchMessage'
).
hasClass
(
'onfocus'
))
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
'#searchMessage'
).
blur
();
}
else
{
$
(
'#searchMessage'
).
addClass
(
'onfocus'
);
$
(
'#searchMessage'
).
focus
();
callback
(
newFile
,
true
);
})
.
catch
((
error
)
=>
{
// fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
);
}
})
});
};
$
(
'#searchMessage'
).
blur
(
function
()
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
})
fileReader
.
readAsDataURL
(
sourceImage
);
};
// フィルタ選択イベント
$
(
document
).
on
(
'click'
,
'#filter .img_wrap'
,
function
(
event
)
{
// チェックアイコン追加
$
(
this
).
toggleClass
(
"filter"
);
});
// 該当チャットルームに参加するためログイン情報をサーバに渡す
getLoginParameter
=
function
(
sid
,
loginId
,
shopName
,
roomId
=
undefined
,
roomName
=
undefined
,
languageCode
,
shopMemberId
)
{
var
loginParam
=
new
Object
();
loginParam
.
sid
=
sid
;
loginParam
.
loginId
=
loginId
;
loginParam
.
shopName
=
shopName
;
loginParam
.
roomId
=
roomId
;
loginParam
.
roomName
=
roomName
;
loginParam
.
shopMemberId
=
shopMemberId
;
CHAT
.
globalLoginParameter
=
loginParam
;
if
(
!
languageCode
)
{
languageCode
=
"en"
;
}
// fermi coview share
globalUserInfo
.
sid
=
sid
;
globalUserInfo
.
loginId
=
shopName
+
"_"
+
loginId
;
globalUserInfo
.
shopName
=
shopName
;
globalUserInfo
.
roomId
=
roomId
;
globalUserInfo
.
roomName
=
roomName
;
globalUserInfo
.
languageCode
=
languageCode
;
CHAT_UI
.
htmlElementTextInitialize
(
languageCode
);
CHAT_UI
.
dismissLoadingIndicator
();
};
$
(
'#chat .search_form input[type="search"]'
).
click
(
function
(){
let
roomListTitle
=
getLocalizedString
(
"room_search_placeholder"
);
$
(
'#chatTitle'
).
text
(
roomListTitle
);
});
CHAT
.
leaveRoom
=
function
()
{
socket
.
emit
(
"leaveRoom"
,
function
()
{});
};
$
(
'#chat .search_form .cancel'
).
click
(
function
(){
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
);
$
(
'#chatTitle'
).
text
(
roomListTitle
);
});
$
(
function
()
{
// ルーム名変更イベント
$
(
".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"
);
// フィルタ表示
$
(
"#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
();
// ユーザーリスト表示
$
(
"#filter"
).
addClass
(
"none"
);
$
(
"#user_list"
).
removeClass
(
"none"
);
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
$
(
"#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
();
}
else
{
$
(
"#searchMessage"
).
addClass
(
"onfocus"
);
$
(
"#searchMessage"
).
focus
();
}
});
$
(
'#chat_add_user .search_form .cancel'
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"inviteUsersSubtitle"
);
$
(
'#addUserTitle'
).
text
(
roomListTitle
);
});
$
(
"#searchMessage"
).
blur
(
function
()
{
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
});
$
(
'#chatMakeRoom .search_form .cancel'
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"createRoomTitle"
);
$
(
'#makeRoomTitle'
).
text
(
roomListTitle
);
});
// フィルタ選択イベント
$
(
document
).
on
(
"click"
,
"#filter .img_wrap"
,
function
(
event
)
{
// チェックアイコン追加
$
(
this
).
toggleClass
(
"filter"
);
});
// チャットメンバー検索
$
(
'#chat .search_form input[type="search"]'
).
keyup
(
function
(
e
){
$
(
'#chat .search_form input[type="search"]'
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"room_search_placeholder"
);
$
(
"#chatTitle"
).
text
(
roomListTitle
);
});
$
(
"#chat .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"roomListTitle"
);
$
(
"#chatTitle"
).
text
(
roomListTitle
);
});
$
(
"#chat_add_user .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"inviteUsersSubtitle"
);
$
(
"#addUserTitle"
).
text
(
roomListTitle
);
});
$
(
"#chatMakeRoom .search_form .cancel"
).
click
(
function
()
{
let
roomListTitle
=
getLocalizedString
(
"createRoomTitle"
);
$
(
"#makeRoomTitle"
).
text
(
roomListTitle
);
});
// チャットメンバー検索
$
(
'#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
!=
""
)
{
$
(
'#chat .search_form input[type="search"]'
).
blur
();
return
;
}
}
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
;
}
});
// iOSキーボード変換検知用
$
(
'#chat .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
rooms
;
var
keyword
=
$
(
'#chat .search_form input[type="search"]'
).
val
();
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
if
(
keyword
.
length
!=
0
&&
keyword
!=
''
)
{
$
(
'#chat .search_form input[type="search"]'
).
blur
();
return
;
}
}
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
;
}
});
// iOSキーボード変換検知用
$
(
'#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
afterHeight
=
window
.
innerHeight
;
var
afterWidth
=
window
.
innerWidth
;
var
moreScroll
=
beforeHeight
-
afterHeight
;
if
(
beforeHeight
>
afterHeight
&&
(
beforeHeight
-
afterHeight
)
>
50
)
{
if
(
beforeWidth
==
afterWidth
)
{
//キーボード表示時
$
(
'.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
());
}
}
else
if
(
beforeHeight
<
afterHeight
)
{
$
(
'.room_container'
).
css
(
'margin-bottom'
,
footerHeight
);
if
(
beforeWidth
==
afterWidth
)
{
//キーボード非表示
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
+
$
(
'.footer_content_b'
).
height
());
}
else
{
//画面回転時
window
.
scrollTo
(
0
,
beforeScroll
+
(
moreScroll
*
2
)
+
$
(
'.footer_content_b'
).
height
());
}
}
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
});
$
(
'#messageInput'
).
focusin
(
function
(
e
)
{
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
beforeScroll
=
window
.
scrollY
;
})
}
}
);
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
(
beforeWidth
==
afterWidth
)
{
//キーボード表示時
$
(
".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
()
);
}
}
else
if
(
beforeHeight
<
afterHeight
)
{
$
(
".room_container"
).
css
(
"margin-bottom"
,
footerHeight
);
if
(
beforeWidth
==
afterWidth
)
{
//キーボード非表示
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
+
$
(
".footer_content_b"
).
height
()
);
}
else
{
//画面回転時
window
.
scrollTo
(
0
,
beforeScroll
+
moreScroll
*
2
+
$
(
".footer_content_b"
).
height
()
);
}
}
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
});
$
(
"#messageInput"
).
focusin
(
function
(
e
)
{
beforeHeight
=
window
.
innerHeight
;
beforeWidth
=
window
.
innerWidth
;
beforeScroll
=
window
.
scrollY
;
});
// チャットルーム
// メッセージ検索イベント
$
(
'.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
)
{
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
// チャットルーム
// メッセージ検索イベント
$
(
'.chat_room_src_form input[type="search"]'
).
keyup
(
function
(
e
){
CHAT
.
searchMessage
(
keyword
,
workVal
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
"#searchMessage"
).
removeClass
(
"onfocus"
);
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'.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
();
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
if
(
keyword
!=
''
&&
keyword
.
length
!=
0
)
{
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
return
;
}
CHAT
.
searchMessage
(
keyword
,
workVal
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#searchMessage'
).
removeClass
(
'onfocus'
);
$
(
'.chat_room_src_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'.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
)
{
let
workVal
=
""
;
var
keyword
=
$
(
'.chat_room_src_form input[type="search"]'
).
val
();
$
(
'.overlay_src_msg'
).
empty
();
var
checkedUserList
=
[];
$
(
'.img_wrap.filter'
).
each
(
function
(
user
)
{
var
selectedUser
=
$
(
'.img_wrap.filter'
)[
user
];
checkedUserList
.
push
(
$
(
selectedUser
).
data
(
'user-id'
));
})
if
(
keyword
.
length
==
1
)
{
return
;
}
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
','
));
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
});
}
}
);
let
jQueryMessages
=
$
(
'.overlay_src_msg'
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
}
if
(
message
.
messageType
==
messageType
.
SYSTEM
)
{
template
=
systemMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
insertDate
);
// ユーザの様式を読み込む
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
)
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
)
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
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
);
$
(
document
).
on
(
"click"
,
".filter_img"
,
function
(
event
)
{
let
workVal
=
""
;
var
keyword
=
$
(
'.chat_room_src_form input[type="search"]'
).
val
();
$
(
".overlay_src_msg"
).
empty
();
var
checkedUserList
=
[];
$
(
".img_wrap.filter"
).
each
(
function
(
user
)
{
var
selectedUser
=
$
(
".img_wrap.filter"
)[
user
];
checkedUserList
.
push
(
$
(
selectedUser
).
data
(
"user-id"
));
});
if
(
keyword
.
length
==
1
)
{
return
;
}
var
messages
=
CHAT_DB
.
searchMessages
(
keyword
,
checkedUserList
.
join
(
","
));
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
}
);
let
jQueryMessages
=
$
(
".overlay_src_msg"
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
}
if
(
message
.
messageType
==
messageType
.
SYSTEM
)
{
template
=
systemMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
insertDate
);
// ユーザの様式を読み込む
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
);
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
);
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
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
);
});
});
// チャットルーム検索
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
);
var
template
;
$
.
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'
if
(
room
.
message
)
{
room
.
message
=
room
.
message
.
toString
()
}
else
{
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
)
displayMsg
=
room
.
message
;
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
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
attendUserName
.
push
(
user
.
shopMemberName
);
});
var
thumbnailCount
=
room
.
attendUsers
.
length
>
4
?
4
:
room
.
attendUsers
.
length
;
if
(
room
.
chatRoomName
==
""
)
{
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
,
userCnt
:
room
.
attendUsers
.
length
+
1
,
attendUsers
:
room
.
attendUsers
});
// Click event
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
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
);
var
template
;
$
.
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"
;
if
(
room
.
message
)
{
room
.
message
=
room
.
message
.
toString
();
}
else
{
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
)
displayMsg
=
room
.
message
;
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
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
attendUserName
.
push
(
user
.
shopMemberName
);
});
if
(
rooms
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
})
;
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
var
thumbnailCount
=
room
.
attendUsers
.
length
>
4
?
4
:
room
.
attendUsers
.
length
;
if
(
room
.
chatRoomName
==
""
)
{
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
,
userCnt
:
room
.
attendUsers
.
length
+
1
,
attendUsers
:
room
.
attendUsers
,
});
// Click event
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
);
}
};
// メッセージ検索
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
(
','
));
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
});
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
(
","
));
var
userMessageTemplate
;
$
.
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
)
{
myMessageTemplate
=
text
;
}
);
let
jQueryMessages
=
$
(
'.overlay_src_msg'
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
}
if
(
message
.
messageType
==
messageType
.
SYSTEM
)
{
template
=
systemMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
insertDate
);
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
)
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
)
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
'?fileName='
,
'?sid='
+
CHAT
.
globalLoginParameter
.
sid
+
'&fileName='
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
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
(
messages
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
jQueryMessages
.
append
(
noResultMsg
);
let
jQueryMessages
=
$
(
".overlay_src_msg"
);
messages
.
forEach
(
function
(
message
)
{
let
template
=
userMessageTemplate
;
if
(
message
.
shopMemberId
==
CHAT
.
globalLoginParameter
.
shopMemberId
)
{
template
=
myMessageTemplate
;
}
if
(
message
.
messageType
==
messageType
.
SYSTEM
)
{
template
=
systemMessageTemplate
;
}
let
messageTime
=
CHAT_UTIL
.
formatDate
(
message
.
insertDate
);
if
(
message
.
profileUrl
)
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
message
.
profileUrl
);
}
else
{
message
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
""
);
}
message
.
message
=
message
.
message
.
toString
();
var
replacePath
=
message
.
message
;
replacePath
=
replacePath
.
replaceAll
(
"?fileName="
,
"?sid="
+
CHAT
.
globalLoginParameter
.
sid
+
"&fileName="
);
message
.
message
=
replacePath
;
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
shopMemberId
:
message
.
shopMemberId
,
profileImage
:
message
.
profileUrl
,
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
(
messages
.
length
==
0
)
{
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
()
{
// メンバー検索
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
click
(
function
(
e
)
{
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
'#makeRoomTitle'
).
text
(
contactListTitle
);
});
$
(
'#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
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
blur
();
return
false
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
return
false
;
}
$
(
function
()
{
// メンバー検索
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
click
(
function
(
e
)
{
let
contactListTitle
=
getLocalizedString
(
"userSearch"
);
$
(
"#makeRoomTitle"
).
text
(
contactListTitle
);
});
$
(
'#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
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
blur
();
return
false
;
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
false
;
}
CHAT_MAKE_ROOM
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
val
();
CHAT_MAKE_ROOM
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#chatMakeRoom .search_form input[type="search"]'
).
on
(
'compositionend'
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
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
)
{
groupTemplate
=
text
;
});
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
var
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
}
);
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
});
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
);
})
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
if
(
findObj
)
{
user
.
checked
=
'checked'
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.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
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
})
if
(
findObj
)
{
user
.
checked
=
'checked'
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.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
);
}
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_make_room_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
let
findObj
=
CHAT
.
globalSelectedUserList
.
find
(
function
(
shopMemberId
)
{
return
shopMemberId
==
user
.
shopMemberId
;
});
if
(
findObj
)
{
user
.
checked
=
"checked"
;
}
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
);
}
}
}
};
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,64 +9,68 @@ 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'
,
url
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
success
:
function
(
res
)
{
recordFinished
();
callback
();
console
.
log
(
res
)
}
,
error
:
function
(
err
)
{
recordFinished
();
callback
();
console
.
log
(
err
);
}
type
:
"post"
,
url
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
success
:
function
(
res
)
{
recordFinished
();
callback
();
console
.
log
(
res
);
},
error
:
function
(
err
)
{
recordFinished
();
callback
();
console
.
log
(
err
);
},
});
},
1000
);
}
function
screenLock
(){
function
screenLock
()
{
// ロック用のdivを生成
var
element
=
document
.
createElement
(
'div'
);
element
.
id
=
"screenLock"
;
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'
;
var
objBody
=
document
.
getElementsByTagName
(
"body"
).
item
(
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
{
...
...
@@ -119,7 +121,7 @@ $(function () {
$
(
".footer_menu_btn"
).
click
(
function
()
{
var
h_active
=
$
(
"#collabo_footer"
).
height
();
var
h_hide
=
h_active
-
$
(
"#collabo_footer_menu"
).
height
();
// 非アクティブ時
if
(
$
(
this
).
hasClass
(
"hide"
))
{
$
(
this
).
removeClass
(
"hide"
);
...
...
@@ -156,89 +158,95 @@ $(function () {
// ユーザー招待メンバー検索
$
(
".add_user_btn"
).
click
(
function
()
{
CHAT_UI
.
showLoadingIndicator
();
CHAT
.
globalSelectedUserList
=
[];
CHAT_UI
.
refreshMyGroupForAddUserInCollaboration
();
$
(
'#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
(
","
));
}
CHAT_UI
.
confirmInviteUserListInCollaboration
();
CHAT_UI
.
showLoadingIndicator
();
CHAT
.
globalSelectedUserList
=
[];
CHAT_UI
.
refreshMyGroupForAddUserInCollaboration
();
$
(
"#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
(
","
)
);
}
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
()
{
$
(
"#open_file_upload"
).
trigger
(
"click"
);
})
$
(
'#eraserBtn'
).
click
(
function
()
{
$
(
'#coviewEraserCtrBtn'
).
click
();
})
$
(
'#micBtn'
).
click
(
function
()
{
$
(
'#coviewMicCtrBtn'
).
click
();
if
(
$
(
'#micBtn'
).
hasClass
(
'bg_red'
))
{
micOn
();
})
;
$
(
"#photo_open_place_holder"
).
click
(
function
()
{
$
(
"#open_file_upload"
).
trigger
(
"click"
);
})
;
$
(
"#eraserBtn"
).
click
(
function
()
{
$
(
"#coviewEraserCtrBtn"
).
click
();
})
;
$
(
"#micBtn"
).
click
(
function
()
{
$
(
"#coviewMicCtrBtn"
).
click
();
if
(
$
(
"#micBtn"
).
hasClass
(
"bg_red"
))
{
micOn
();
}
else
{
micOff
();
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
...
...
@@ -2,99 +2,114 @@
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
)
{
$
(
'#contact .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
$
(
".overlay_src_msg"
).
empty
();
return
;
}
CONTACT
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#contact .search_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#contact .search_form input[type="search"]'
).
on
(
"compositionend"
,
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
var
keyword
=
$
(
'#contact .search_form input[type="search"]'
).
val
();
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
if
(
keyword
!=
''
&&
keyword
.
length
!=
0
)
{
$
(
'#contact .search_form input[type="search"]'
).
blur
();
return
;
}
}
else
if
(
keyword
==
''
||
keyword
.
length
<
2
)
{
$
(
'.overlay_src_msg'
).
empty
();
return
;
}
CONTACT
.
searchUser
(
keyword
);
if
(
e
.
key
==
"Enter"
||
e
.
KeyCode
==
13
)
{
$
(
'#contact .search_form input[type="search"]'
).
blur
();
return
;
}
});
// iOSキーボード変換検知用
$
(
'#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
)
{
var
groupList
;
$
(
'.overlay_src_msg'
).
empty
();
var
isAllGroup
=
$
(
'#tabAllGroup'
).
is
(
':checked'
);
CONTACT
.
searchUser
=
function
(
keyword
)
{
var
groupList
;
$
(
".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
)
{
groupTemplate
=
text
;
});
//全グループ検索画面
if
(
isAllGroup
)
{
//グループデータ検索
groupList
=
CHAT_DB
.
getGroupByName
(
keyword
);
var
groupTemplate
;
$
.
get
(
{
url
:
"./template/template_group_list.html"
,
async
:
false
},
function
(
text
)
{
groupTemplate
=
text
;
}
);
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
isFavorite
:
group
.
isFavorite
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
})
groupList
.
forEach
(
function
(
group
)
{
let
html
=
Mustache
.
render
(
groupTemplate
,
{
name
:
group
.
groupName
,
id
:
group
.
groupId
,
isFavorite
:
group
.
isFavorite
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
});
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.overlay_src_msg'
).
append
(
obj
);
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMsg
=
$
(
'<div/>'
,{
width
:
'auto'
,
style
:
'text-align: center'
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
))
$
(
'.overlay_src_msg'
).
append
(
noResultMsg
);
}
//ユーザデータ検索
var
userList
=
CHAT_DB
.
getAllGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
if
(
userList
.
length
==
0
&&
groupList
.
length
==
0
)
{
const
noResultMsg
=
$
(
"<div/>"
,
{
width
:
"auto"
,
style
:
"text-align: center"
,
});
noResultMsg
.
append
(
getLocalizedString
(
"noResult"
));
$
(
".overlay_src_msg"
).
append
(
noResultMsg
);
}
//連絡先画面
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
({
url
:
"./template/template_user_list.html"
,
async
:
false
}
,
function
(
text
)
{
userTemplate
=
text
;
});
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
'.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
);
}
}
else
{
var
userList
=
CHAT_DB
.
getMyGroupShopMemberByName
(
keyword
);
var
userTemplate
;
$
.
get
(
{
url
:
"./template/template_user_list.html"
,
async
:
false
},
function
(
text
)
{
userTemplate
=
text
;
}
);
userList
.
forEach
(
function
(
user
)
{
user
.
profileUrl
=
CHAT
.
getProfileImgUrl
(
user
.
profileUrl
);
});
let
html
=
Mustache
.
render
(
userTemplate
,
{
userList
:
userList
,
});
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".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
);
}
}
};
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
);
}
}
});
...
...
@@ -262,9 +312,9 @@ $(function () {
Coview_exitCollaboration
(
isDocument
);
$
(
"#loadingIndicator"
).
removeClass
(
"full_active"
);
});
var
meetingId
;
coview_api
.
addEventListener
(
"message"
,
async
function
(
event
,
json
)
{
console
.
log
(
"+++ addEventListener"
,
json
);
console
.
log
(
"processMessage api = "
,
json
.
api
);
...
...
@@ -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
:
...
...
@@ -418,107 +473,121 @@ function changeCollaboration(changeCollaborationType) {
var
newMeetingId
=
0
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
exitMeetingRoom
();
android
.
exitMeetingRoom
();
}
}
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,57 +808,71 @@ 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
.
width
=
w
=
680
;
canvas
.
height
=
h
=
515
;
}
else
{
canvas
.
width
=
w
=
386
;
canvas
.
width
=
w
=
386
;
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
.
backgroundSize
=
"contain"
;
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
));
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundSize
=
"contain"
;
$
(
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