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