Commit 0b614d87 by Lee Munkyeong

Merge branch 'features/1.2.360_develop_ABCOMM-265-offline対応' into 'features/abcomm_sp2'

Features/1.2.360 develop abcomm 265 offline対応

See merge request !87
parents b9bcf707 381469fa
......@@ -31,6 +31,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
......@@ -525,6 +526,21 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* チャットルーム一覧情報を取得する。
*
* @param sid
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public RoomListJSON getRoomList(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new AcmsParameters(sid,AcmsApis.Cmds.getRoomList));
RoomListJSON json = new RoomListJSON(response.httpResponseBody);
return json;
}
/**
* 作業報告データ送信
* @param sid
* @param operationId
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.DateTimeUtil;
public class RoomListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String ChatRoomInfoList = "chatRoomInfoList";
private static final String InsertDate = "insertDate";
private static final String Time = "time";
private static final String RoomId = "roomId";
private static final String RoomName = "roomName";
private static final String RoomType = "roomType";
private static final String LastMessageInfo = "lastMessageInfo";
private static final String Message = "message";
private static final String MessageId = "messageId";
private static final String ShopMemberId = "shopMemberId";
private static final String MessageType = "messageType";
private static final String UnreadCount = "unreadCount";
private static final String AttendUsers = "attendUsers";
public ArrayList<ChatRoomDto> roomList;
public RoomListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(Body)) { return; }
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList);
if (roomListJsonArray == null) { return; }
roomList = new ArrayList<ChatRoomDto>();
for (int listCount = 0; listCount < roomListJsonArray.length(); listCount++) {
if (roomListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto();
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
if (lastMessageInfoJSON.has(InsertDate)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time));
}
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
roomList.add(chatRoomDto);
}
}
}
......@@ -14,7 +14,7 @@ public class AcmsParameters extends HttpParameterObject {
* @since 1.0.0
*/
private String sid;
private String cmd;
/**
* {@link AcmsParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
......@@ -25,6 +25,17 @@ public class AcmsParameters extends HttpParameterObject {
}
/**
* {@link AcmsParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public AcmsParameters(String sid, String cmd) {
this.sid = sid;
this.cmd = cmd;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
......@@ -32,4 +43,13 @@ public class AcmsParameters extends HttpParameterObject {
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
}
......@@ -170,6 +170,11 @@ public class AcmsApis {
// チャット
public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/";
public static final String ApiGetChatPushData = "push";
public static final String ApigetChatRooms = "room";
public static final class Cmds {
public static final String getRoomList = "5";
}
// download
/**
......@@ -217,7 +222,7 @@ public class AcmsApis {
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)
|| methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) {
apiValue = Constant.ApiValue.checkapi;
} else if (methodName.equals(ApiGetChatPushData)) { // pushActionはchatapiを指定
} else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi;
}
......
......@@ -16,13 +16,22 @@ import jp.agentec.abook.abv.bl.data.tables.MMemberInfo;
import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster;
import jp.agentec.abook.abv.bl.data.tables.MPasswordLockInfo;
import jp.agentec.abook.abv.bl.data.tables.MServiceOption;
import jp.agentec.abook.abv.bl.data.tables.MShopMember;
import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.RChatRoomShopMember;
import jp.agentec.abook.abv.bl.data.tables.RCollaborationMember;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationGroupMasterOperation;
import jp.agentec.abook.abv.bl.data.tables.RShopMemberGroup;
import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TArchive;
import jp.agentec.abook.abv.bl.data.tables.TChatMessage;
import jp.agentec.abook.abv.bl.data.tables.TChatRoom;
import jp.agentec.abook.abv.bl.data.tables.TCollaboration;
import jp.agentec.abook.abv.bl.data.tables.TCollaborationDetail;
import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
import jp.agentec.abook.abv.bl.data.tables.TContentDownloadQueue;
......@@ -100,6 +109,18 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MOperationGroupMaster());
iTableScripts.add(new ROperationGroupMasterOperation());
iTableScripts.add(new TTaskReportApproval());
//ABCOMM関連テーブル
iTableScripts.add(new MShopMember());
iTableScripts.add(new TChatRoom());
iTableScripts.add(new TChatMessage());
iTableScripts.add(new TCollaboration());
iTableScripts.add(new TCollaborationDetail());
iTableScripts.add(new TArchive());
iTableScripts.add(new RShopMemberGroup());
iTableScripts.add(new RChatRoomShopMember());
iTableScripts.add(new RCollaborationMember());
return iTableScripts;
}
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto;
public class ArchiveDao extends AbstractDao {
/**
* {@link ArchiveDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ArchiveDao() {
}
@Override
protected ArchiveDto convert(Cursor cursor) {
ArchiveDto dto = new ArchiveDto();
int column = cursor.getColumnIndex("archive_id");
if (column != -1) {
dto.archiveId = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_name");
if (column != -1) {
dto.archiveName = cursor.getString(column);
}
column = cursor.getColumnIndex("archive_type");
if (column != -1) {
dto.archiveType = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_url");
if (column != -1) {
dto.archiveUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_save_path");
if (column != -1) {
dto.archiveSavePath = cursor.getString(column);
}
return dto;
}
public List<ArchiveDto> getArchive(int archiveId) {
List<ArchiveDto> list = rawQueryGetDtoList("select * from t_archive where archive_id = ?", new String[]{""+ archiveId}, ArchiveDto.class);
return list;
}
public void insertArchive(ArchiveDto dto) {
insert("insert into t_archive (archive_id, archive_name, archive_type, archive_url, collaboration_id, shop_member_id, archive_save_path) values (?,?)", dto.getInsertValues());
}
public boolean updateArchive(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_url=?, collaboration_id=?, shop_member_id=?, archive_save_path=? where archive_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteArchive() {
try {
beginTransaction();
delete("t_archive", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteArchive failed.", e);
throw new RuntimeException(e);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
public class ChatMessageDao extends AbstractDao {
/**
* {@link ChatMessageDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ChatMessageDao() {
}
@Override
protected ChatMessageDto convert(Cursor cursor) {
ChatMessageDto dto = new ChatMessageDto();
int column = cursor.getColumnIndex("chat_message_id");
if (column != -1) {
dto.chatMessageId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_room_id");
if (column != -1) {
dto.chatRoomId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("message");
if (column != -1) {
dto.message = cursor.getString(column);
}
column = cursor.getColumnIndex("message_type");
if (column != -1) {
dto.messageType = cursor.getInt(column);
}
column = cursor.getColumnIndex("image_name");
if (column != -1) {
dto.imageName = cursor.getString(column);
}
column = cursor.getColumnIndex("download_file_name");
if (column != -1) {
dto.downloadFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("save_path");
if (column != -1) {
dto.savePath = cursor.getString(column);
}
column = cursor.getColumnIndex("insert_date");
if (column != -1) {
dto.savePath = cursor.getString(column);
}
return dto;
}
public List<ChatMessageDto> getChatMessage(int chatRoomId) {
List<ChatMessageDto> list = rawQueryGetDtoList("select * from t_chat_message where chat_room_id = ?", new String[]{""+ chatRoomId}, ChatMessageDto.class);
return list;
}
public void insertChatMessage(ChatMessageDto dto) {
insert("insert into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
try {
beginTransaction();
for (ChatMessageDto chatMessageDto : chatMessageDtoList) {
insertChatMessage(chatMessageDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatRoomList failed.", e);
throw new RuntimeException(e);
}
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=? where chat_message_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteChatMessage() {
try {
beginTransaction();
delete("t_chat_message", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatMessage failed.", e);
throw new RuntimeException(e);
} finally {
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class ChatRoomDao extends AbstractDao {
/**
* {@link ChatRoomDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ChatRoomDao() {
}
@Override
protected ChatRoomDto convert(Cursor cursor) {
ChatRoomDto dto = new ChatRoomDto();
int column = cursor.getColumnIndex("chat_room_id");
if (column != -1) {
dto.chatRoomId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_room_name");
if (column != -1) {
dto.chatRoomName = cursor.getString(column);
}
column = cursor.getColumnIndex("type");
if (column != -1) {
dto.type = cursor.getInt(column);
}
column = cursor.getColumnIndex("unread_count");
if (column != -1) {
dto.unreadCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("user_count");
if (column != -1) {
dto.userCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
column = cursor.getColumnIndex("message");
if (column != -1) {
dto.message = cursor.getString(column);
}
column = cursor.getColumnIndex("message_type");
if (column != -1) {
dto.messageType = cursor.getInt(column);
}
column = cursor.getColumnIndex("insert_date");
if (column != -1) {
dto.insertDate = cursor.getString(column);
}
return dto;
}
public List<ChatRoomDto> getAllChatRoom() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cr.chat_room_id ");
sql.append(" ,cr.chat_room_name ");
sql.append(" ,cr.type ");
sql.append(" ,coalesce (cr.favorite_register_date,'') favorite_register_date");
sql.append(" ,coalesce (cr.unread_count,0) unread_count");
sql.append(" ,coalesce (cm.message,'') message");
sql.append(" ,coalesce (cm.message_type,0) message_type");
sql.append(" ,coalesce (cm.insert_date,'') insert_date");
sql.append(" ,coalesce (cr.user_count,0) user_count ");
sql.append(" FROM ");
sql.append(" t_chat_room AS cr ");
sql.append(" LEFT JOIN ");
sql.append(" ( SELECT max(insert_date) insert_date, message, message_type, chat_room_id FROM t_chat_message GROUP BY chat_room_id ) AS cm ");
sql.append(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), null, ChatRoomDto.class);
return list;
}
public ChatRoomDto getFavoriteChatRoom() {
return rawQueryGetDto("select * from t_chat_room where favorite_register_date is NOT NULL", null, ChatRoomDto.class);
}
public ChatRoomDto getNotFavoriteChatRoom() {
return rawQueryGetDto("select * from t_chat_room where favorite_register_date is NULL", null, ChatRoomDto.class);
}
public void insertChatRoom(ChatRoomDto dto) {
insert("insert into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) {
try {
beginTransaction();
for (ChatRoomDto chatRoomDto : chatRoomDtoList) {
insertChatRoom(chatRoomDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatRoomList failed.", e);
throw new RuntimeException(e);
}
}
public boolean updateChatRoom(ChatRoomDto dto) {
long count = update("update t_chat_room set chat_room_name=?, type=?, unread_count=?, user_count=?, favorite_register_date=? where chat_room_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteChatRoom() {
try {
beginTransaction();
delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null);
delete("t_chat_message", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatRoom failed.", e);
throw new RuntimeException(e);
} finally {
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto;
public class CollaborationDao extends AbstractDao {
/**
* {@link CollaborationDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ CollaborationDao() {
}
@Override
protected CollaborationDto convert(Cursor cursor) {
CollaborationDto dto = new CollaborationDto();
int column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_message_id");
if (column != -1) {
dto.chatMessageId = cursor.getInt(column);
}
return dto;
}
public List<CollaborationDto> getCollaboration(int collaborationId) {
List<CollaborationDto> list = rawQueryGetDtoList("select * from t_collaboration where collaboration_id = ?", new String[]{""+ collaborationId}, CollaborationDto.class);
return list;
}
public void insertCollaboration(CollaborationDto dto) {
insert("insert into t_collaboration (collaboration_id, chat_message_id) values (?,?)", dto.getInsertValues());
}
public void deleteCollaboration() {
try {
beginTransaction();
delete("t_collaboration", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteCollaboration failed.", e);
throw new RuntimeException(e);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.CollaborationDetailDto;
public class CollaborationDetailDao extends AbstractDao {
/**
* {@link CollaborationDetailDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ CollaborationDetailDao() {
}
@Override
protected CollaborationDetailDto convert(Cursor cursor) {
CollaborationDetailDto dto = new CollaborationDetailDto();
int column = cursor.getColumnIndex("collaboration_detial_id");
if (column != -1) {
dto.collaborationDetialId = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_type");
if (column != -1) {
dto.collaborationType = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_duration");
if (column != -1) {
dto.collaborationDuration = cursor.getString(column);
}
return dto;
}
public List<CollaborationDetailDto> getCollaborationDetail(int collaborationDetialId) {
List<CollaborationDetailDto> list = rawQueryGetDtoList("select * from t_collaboration_detail where collaboration_detial_id = ?", new String[]{""+ collaborationDetialId}, CollaborationDetailDto.class);
return list;
}
public void insertCollaborationDetail(CollaborationDetailDto dto) {
insert("insert into t_collaboration_detail (collaboration_detial_id, collaboration_id, collaboration_type, collaboration_duration) values (?,?,?,?)", dto.getInsertValues());
}
public void deleteCollaborationDetail() {
try {
beginTransaction();
delete("t_collaboration_detail", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteCollaborationDetail failed.", e);
throw new RuntimeException(e);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ShopMemberDao extends AbstractDao {
/**
* {@link ShopMemberDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ShopMemberDao() {
}
@Override
protected ShopMemberDto convert(Cursor cursor) {
ShopMemberDto dto = new ShopMemberDto();
int column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_name");
if (column != -1) {
dto.shopMemberName = cursor.getString(column);
}
column = cursor.getColumnIndex("profile_url");
if (column != -1) {
dto.profileUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
return dto;
}
public List<ShopMemberDto> getAllShopMember() {
List<ShopMemberDto> list = rawQueryGetDtoList("select * from m_shop_member", null, ShopMemberDto.class);
return list;
}
public ShopMemberDto getShopMember(int shopMemberId) {
return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
}
public void insertShopMember(ShopMemberDto dto) {
insert("insert into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date) values (?,?,?,?)", dto.getInsertValues());
}
public boolean updateShopMember(MemberInfoDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=?, favorite_register_date=? where shop_member_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteShopMember() {
try {
beginTransaction();
delete("m_shop_member", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class MShopMember extends SQLiteTableScript {
public MShopMember() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table m_shop_member ( ");
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , shop_member_name VARCHAR(64) ");
sql.append(" , profile_url VARCHAR(64) ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RChatRoomShopMember extends SQLiteTableScript {
public RChatRoomShopMember() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_chat_room_shop_member ( ");
sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (chat_room_id, shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RCollaborationMember extends SQLiteTableScript {
public RCollaborationMember() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_collaboration_member ( ");
sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id, shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RShopMemberGroup extends SQLiteTableScript {
public RShopMemberGroup() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_shop_member_group ( ");
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (shop_member_id, group_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TArchive extends SQLiteTableScript {
public TArchive() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_archive ( ");
sql.append(" archive_id INTEGER NOT NULL ");
sql.append(" , archive_name VARCHAR2(64) ");
sql.append(" , archive_type INTEGER NOT NULL ");
sql.append(" , archive_url VARCHAR2 ");
sql.append(" , collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , archive_save_path VARCHAR2 ");
sql.append(" , PRIMARY KEY (archive_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TChatMessage extends SQLiteTableScript {
public TChatMessage() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_chat_message ( ");
sql.append(" chat_message_id INTEGER NOT NULL ");
sql.append(" , chat_room_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , message VARCHAR2 ");
sql.append(" , message_type INTEGER ");
sql.append(" , image_name VARCHAR2 ");
sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 ");
sql.append(" , insert_date VARCHAR2(64)");
sql.append(" , PRIMARY KEY (chat_message_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TChatRoom extends SQLiteTableScript {
public TChatRoom() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_chat_room ( ");
sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , chat_room_name VARCHAR2(64) ");
sql.append(" , type INTEGER NOT NULL ");
sql.append(" , unread_count INTEGER ");
sql.append(" , user_count INTEGER ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (chat_room_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TCollaboration extends SQLiteTableScript {
public TCollaboration() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_collaboration ( ");
sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , chat_message_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TCollaborationDetail extends SQLiteTableScript {
public TCollaborationDetail() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_collaboration_detail ( ");
sql.append(" collaboration_detial_id INTEGER NOT NULL ");
sql.append(" , collaboration_id INTEGER NOT NULL ");
sql.append(" , collaboration_type INTEGER ");
sql.append(" , collaboration_duration VARCHAR2(64) ");
sql.append(" , chat_room_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_detial_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.dto;
public class ArchiveDto extends AbstractDto {
public Integer archiveId;
public String archiveName;
public Integer archiveType;
public String archiveUrl;
public Integer collaborationId;
public Integer shopMemberId;
public String archiveSavePath;
@Override
public Object[] getInsertValues() {
return new Object[]{archiveId, archiveName, archiveType, archiveUrl, collaborationId, shopMemberId, archiveSavePath};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{archiveName, archiveType, archiveUrl, collaborationId, shopMemberId,archiveSavePath, archiveId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ archiveId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ChatMessageDto extends AbstractDto {
public Integer chatMessageId;
public Integer chatRoomId;
public Integer shopMemberId;
public String message;
public Integer messageType;
public String imageName;
public String downloadFileName;
public String savePath;
public String insertDate;
@Override
public Object[] getInsertValues() {
return new Object[] { chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + chatMessageId };
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
import java.util.List;
public class ChatRoomDto extends AbstractDto {
public Integer chatRoomId;
public String chatRoomName;
public Integer type;
public String favoriteRegisterDate = "";
public Integer unreadCount;
public Integer userCount;
public String message;
public Integer messageType;
public String insertDate;
public ChatMessageDto lastMessageInfo;
@Override
public Object[] getInsertValues() {
return new Object[] { chatRoomId, chatRoomName, type, unreadCount, userCount, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { favoriteRegisterDate, chatRoomName, type, unreadCount, userCount, chatRoomId };
}
@Override
public String[] getKeyValues() {
return new String[] { "" + chatRoomId };
}
}
package jp.agentec.abook.abv.bl.dto;
public class CollaborationDetailDto extends AbstractDto {
public Integer collaborationDetialId;
public Integer collaborationId;
public Integer collaborationType;
public String collaborationDuration;
@Override
public Object[] getInsertValues() {
return new Object[] { collaborationDetialId, collaborationId, collaborationType, collaborationDuration };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { collaborationDuration, collaborationId, collaborationType, collaborationDetialId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + collaborationDetialId };
}
}
package jp.agentec.abook.abv.bl.dto;
public class CollaborationDto extends AbstractDto {
public Integer collaborationId;
public Integer chatMessageId;
@Override
public Object[] getInsertValues() {
return new Object[]{collaborationId, chatMessageId};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{chatMessageId, collaborationId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ collaborationId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ShopMemberDto extends AbstractDto {
public Integer shopMemberId;
public String shopMemberName;
public String profileUrl;
public String favoriteRegisterDate;
@Override
public Object[] getInsertValues() {
return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { shopMemberName, profileUrl, favoriteRegisterDate, shopMemberId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + shopMemberId };
}
}
package jp.agentec.abook.abv.bl.logic;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import jdk.nashorn.internal.parser.JSONParser;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentCheckParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ChatMessageDao;
import jp.agentec.abook.abv.bl.data.dao.ChatRoomDao;
import jp.agentec.abook.abv.bl.data.dao.ContentCategoryDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.ContentGroupDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao;
import jp.agentec.abook.abv.bl.data.dao.ContentPageDao;
import jp.agentec.abook.abv.bl.data.dao.ContentResourceDao;
import jp.agentec.abook.abv.bl.data.dao.ContentTagDao;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.abook.abv.bl.dto.ContentTagDto;
import jp.agentec.abook.abv.bl.dto.comparator.ContentPageDtoComparator;
import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil;
/**
* @author Lee-mk
*/
public class CommunicationLogic extends AbstractLogic {
private static final String TAG = "CommunicationLogic";
private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class);
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class);
/**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。
* context Androidとの互換性の為のプロパティです。Androidの android.content.Context のインスタンスを指定します。<br>
* UIがAndroidでない場合、何かのオブジェクトを指定しても、nullと見なします。
* @see AbstractLogic
* @since 1.2.3.6
*/
/*package*/ CommunicationLogic() {
}
public String getChatRoomList() {
List<ChatRoomDto> chatRoomList = chatRoomDao.getAllChatRoom();
JSONArray resultJsonArray = new JSONArray();
for (ChatRoomDto chatRoomDto : chatRoomList) {
Map<String, Object> chatRoomMap = new HashMap<String, Object>();
chatRoomMap.put("chatRoomId", chatRoomDto.chatRoomId);
chatRoomMap.put("chatRoomName", chatRoomDto.chatRoomName);
chatRoomMap.put("type", chatRoomDto.type);
chatRoomMap.put("favoriteRegisterDate", chatRoomDto.favoriteRegisterDate);
chatRoomMap.put("unreadCount", chatRoomDto.unreadCount);
chatRoomMap.put("message", chatRoomDto.message);
chatRoomMap.put("messageType", chatRoomDto.messageType);
chatRoomMap.put("insertDate", chatRoomDto.insertDate);
chatRoomMap.put("userCount", chatRoomDto.userCount);
JSONObject jsonObject = new JSONObject(chatRoomMap);
resultJsonArray.put(jsonObject);
}
String roomListToStr = resultJsonArray.toString();
return roomListToStr;
}
public void insertChatRoomList(List<ChatRoomDto> roomList) {
List<ChatMessageDto> insertMessageList = new ArrayList<ChatMessageDto>();
for (ChatRoomDto chatRoomDto : roomList) {
if (chatRoomDto.lastMessageInfo != null) {
insertMessageList.add(chatRoomDto.lastMessageInfo);
}
}
chatRoomDao.insertChatRoom(roomList);
chatMessageDao.insertChatMessage(insertMessageList);
}
public void deleteChatRoomList() {
chatRoomDao.deleteChatRoom();
}
}
......@@ -584,4 +584,13 @@ public class DateTimeUtil {
return calendar1.before(calendar2);
}
public static String millToDateString(long mills) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date timeInDate = new Date(mills);
String timeInFormat = dateFormat.format(timeInDate);
return timeInFormat;
}
}
......@@ -62,20 +62,32 @@ img {
.top_spac{ margin: 20px 0 0;}
.recent_heading {float: left; width:40%;}
.recent_heading {float: left; width:90%;}
.srch_bar {
display: inline-block;
text-align: right;
width: 60%;
text-align: center;
width: 100%;
/*padding:*/
}
.heading_srch { padding:10px 20px 10px 20px; overflow:hidden; border-bottom:1px solid #c4c4c4;}
.heading_srch { padding:5px 10px 5px 10px; overflow:hidden; border-bottom:1px solid #c4c4c4;}
.recent_heading h4 {
color: #095395;
font-size: 21px;
margin: auto;
}
.data_srch h3, .recent_heading h3 {
color: #095395;
font-size: 20px;
margin: auto;
margin-left: 10px;
}
.inbox_people .data_srch {
padding: 5px 10px 5px 10px;
}
.chat_list, .group_list, .user_list, .select_user_list {
border-bottom: 1px solid #c4c4c4;
margin: 0;
......@@ -92,11 +104,25 @@ img {
margin-left: 0;
}
.room-list-title {
display: inline-flex;
max-width: 100%;
}
.room-name-font {
font-size: 1rem !important;
margin-right: 5px;
}
.room-member-count {
line-height: 1.5;
}
.chat_img, .group_img, .user_img {
float: left;
width: 11%;
}
.srch_bar input { border:1px solid #cdcdcd; border-width:0 0 1px 0; width:80%; padding:2px 0 4px 6px; background:none; }
.srch_bar input { border:1px solid #cdcdcd; border-width:0 0 1px 0; width:90%; padding:4px 0 4px 6px; background:none; }
.srch_bar .input-group-addon button {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
border: medium none;
......@@ -172,9 +198,18 @@ img {
}
.received_withd_msg { width: 57%;}
.mesgs {
margin-top: 40px;
padding: 0px 15px 48px 15px;
}
.search-bar-fixed {
position: fixed;
}
.search-group {
margin-bottom: 38px;
}
.landscape_mesgs {
padding: 0px 10% 48px 10%;
}
......@@ -215,7 +250,10 @@ img {
}
.messaging { padding: 0 0 50px 0;}
.msg_history {
height: calc(100vh - 88px);
/* チャット画面スクロール範囲
* 画面の高さ - (画面上部タイトルの高さ(58px) + ルーム名検索欄の高さ(38px) + メッセージ入力欄の高さ(48px)) */
height: calc(100vh - 144px);
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
......@@ -351,7 +389,7 @@ a.article:hover {
position:fixed;
width:60px;
height:60px;
bottom:18px;
bottom:20px;
right:18px;
background-color:#095395;
color:#FFF;
......@@ -496,7 +534,6 @@ a.article:hover {
#newRoomName{
display: none;
width: auto;
}
.bg-primary, .btn-primary{
......@@ -584,6 +621,19 @@ a.article:hover {
z-index:10050;
}
#errorMsg{
margin-top: 60px;
text-align: center;
}
.bg-footer {
background-color: #F2F2F2;
}
.talign-center{
text-align: center;
}
/* --------------------------------------------------- */
/* ERROR PAGE STYLE */
/* --------------------------------------------------- */
......
<!doctype html>
<html lang="en" style="background: #DBDBDB;">
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
......@@ -9,33 +9,415 @@
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/lightbox.min.css">
<link rel="stylesheet" href="./css/chat.css">
<link rel="stylesheet" href="./css/font-awesome.css">
<script>
const PLATFORM = 'android';
const IS_MOBILE = true;
</script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
}
let CHAT_SERVER_URL = '';
let CMS_SERVER_URL = '';
let ASSET_PATH = './';
let PLATFORM = '';
let IS_MOBILE = true;
let IS_ONLINE = false;
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl;
CMS_SERVER_URL = cmsServerUrl;
PLATFORM = platform;
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
};
android.getGlobalParameter();
</script>
</head>
<body>
<nav class="navbar navbar-expand navbar-dark bg-primary fixed-top flex-md-nowrap p-2 shadow">
<ul class="navbar-nav col-3" id="navbarLeft">
<button class="btn btn-primary" type="button" id="backButton">
<i class="fa fa-arrow-left"></i>
</button>
<button class="btn btn-primary" type="button" id="homeButton">
<i class="fa fa-home" style="font-size: 1.6rem;"></i>
</button>
</ul>
<a class="navbar-brand col-6 mr-0 text-truncate titleRoomName text-center" href="#">Error</a>
<a class="navbar-brand col-6 mr-0 text-truncate titleRoomName text-center" href="#">Chat</a>
<ul class="navbar-nav col-3" id="navbarRight">
<!-- Chat Room Icons -->
<li class="nav-item">
<button type="button" id="sidebarCollapse" class="btn btn-primary chatRoomIcon">
<i class="fas fa-bars"></i>
</button>
</li>
<li class="nav-item">
<button type="button" id="userSelectionDeleteBtn" class="btn btn-primary">
<i class="fa fa-trash"></i>
</button>
</li>
<li class="nav-item">
<button type="button" id="userSelectionConfirmBtn" class="btn btn-primary chatRoomIcon">
<span id="userSelectionLength" class="badge badge-light"></span>
<i class="fas fa-check"></i>
</button>
<!-- Alert Dialog -->
<div id="confirm" class="modal fade">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body" id="userSelectionTitle">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn" id="yesTitle">OK</button>
</div>
</div>
</div>
</div>
</li>
</ul>
</nav>
<!-- Sidebar -->
<nav id="sidebar">
<div id="dismiss">
<i class="fas fa-arrow-right"></i>
</div>
<div class="sidebar-header">
<h4 id="participants">Participants</h4>
</div>
<div id="users">
</div>
<footer class="sidebar-footer text-right">
<a class="btn text-light" role="button" id="exitRoom">
Exit <i class="fas fa-door-open"></i>
</a>
<!-- Confirm Dialog -->
<div id="exitRoomConfirm" class="modal fade">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body" id="exitRoomTitle">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="exitRoomOk">Ok</button>
<button type="button" data-dismiss="modal" class="btn" id="noExit">Cancel</button>
</div>
</div>
</div>
</div>
</footer>
</nav>
<div class="error-aria">
<img id="errorImg" src="./icon/error_top_icon.svg">
<div id="errorTitle">
<a>ネットワークエラー</a>
<!-- Dark Overlay element -->
<div class="overlay active"></div>
<!-- loadingIndicator -->
<div id="loadingIndicator">
<div class="spinner-border text-primary loader" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<!-- Error Alert Dialog -->
<div id="customAlert" class="modal fade">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body" id="customAlertTitle">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="customAlertOk">Ok</button>
</div>
</div>
</div>
</div>
<!-- Confirm Dialog -->
<div id="customConfirm" class="modal fade">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body" id="customConfirmTitle">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="customConfirmOk">Ok</button>
<button type="button" data-dismiss="modal" class="btn" id="customAlertCancel">Cancel</button>
</div>
</div>
</div>
</div>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-chatlist" role="tabpanel" aria-labelledby="pills-chatlist-tab">
<div class="search-group">
<div class="input-group search-bar-fixed">
<input style="font-family:Arial, FontAwesome !important;" id="room-search" type="text" class="write_msg form-control" name="message" placeholder="&#xF002;" autocomplete="off">
</div>
</div>
<div class="inbox_people">
<div id="room_list" class="inbox_chat row">
</div>
<a id="createChatRoom" href="#" class="floating_plus_btn">
<i class="fa fa-plus my-float"></i>
</a>
</div>
</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
...
</div>
<div class="tab-pane fade" id="pills-communication" role="tabpanel" aria-labelledby="pills-communication-tab">
...
</div>
<div class="tab-pane fade" id="pills-setting" role="tabpanel" aria-labelledby="pills-setting-tab">
...
</div>
<!-- invisible tabs -->
<div class="tab-pane fade" id="pills-chat" role="tabpanel" aria-labelledby="pills-chat-tab">
<div class="input-group search-bar-fixed">
<input style="font-family:Arial, FontAwesome" id="message-search" type="text" class="write_msg form-control" placeholder="&#xF002;" name="message" autocomplete="off">
<div class="input-group-append">
<button type="button" class="btn input-group-text dropdown-toggle-split" id="pre-search" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-arrow-up"></i>
</button>
</div>
</div>
<div class="mesgs">
<div class="msg_history" id="messages">
</div>
<div class="type_msg fixed-bottom">
<div class="row">
<div class="msg_notification" id="messageNotification">
</div>
</div>
<div class="input_msg_write">
<div class="input-group">
<div class="input-group-prepend">
<button class="btn input-group-text dropdown-toggle" data-toggle="dropdown" type="button"><i class="fa fa-camera"></i></button>
<!-- Video Upload -->
<div class="dropdown-menu">
<a class="dropdown-item" id="fileUploadButton" href="#">Photo
<a href="#">
<form id="image-form">
<input class="d-none" type="file" name="image" id="imageInputTag" accept="image/x-png,image/jpeg">
</form>
</a>
</a>
<a class="dropdown-item" id="fileUploadButton2" href="#">Video
<a href="#">
<form id="image-form2">
<input class="d-none" type="file" name="image" id="imageInputTag2" accept="video/mp4">
</form>
</a>
</a>
</div>
</div>
<input id="message-form" type="text" class="write_msg form-control" name="message" placeholder="Type a message" autocomplete="off">
<div class="input-group-append">
<button id="message-send-btn" class="btn input-group-text" type="button"><i class="fa fa-paper-plane" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
</div>
<div id="errorMsg">
ネットワークに接続できませんでした。電波が良いところでもう一度接続してください。
</div>
<button class="bg-primary reload-button" id="reloadButton">更新</button>
<img id="errorEnd" src="./icon/error_footer_img.svg">
<div class="tab-pane fade" id="pills-group" role="tabpanel" aria-labelledby="pills-group-tab">
<div class="inbox_people">
<div class="heading_srch">
<div class="srch_bar">
<div class="stylish-input-group">
<input id="groupListKeyword" type="text" class="search-bar" placeholder="Search">
<span class="input-group-addon">
<button type="button"> <i class="fa fa-search" aria-hidden="true"></i> </button>
</span>
</div>
</div>
</div>
<div id="group_list" class="inbox_user row">
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-user" role="tabpanel" aria-labelledby="pills-user-tab">
<div class="inbox_people">
<div class="heading_srch">
<div class="recent_heading">
<h4 id="groupName"></h4>
</div>
</div>
<div class="heading_srch">
<div class="srch_bar">
<div class="stylish-input-group">
<input id="userListKeyword" type="text" class="search-bar" placeholder="Search">
<span class="input-group-addon">
<button type="button"> <i class="fa fa-search" aria-hidden="true"></i> </button>
</span>
</div>
</div>
</div>
<div id="user_list" class="inbox_user row">
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-confirm" role="tabpanel" aria-labelledby="pills-confirm-tab">
<div class="inbox_people">
<div class="heading_srch">
<div class="recent_heading">
<h3 id="inviteStatus"></h3>
<div class="srch_bar">
<div class="stylish-input-group">
<input id="newRoomName" type="text" class="search-bar" placeholder="Room name" aria-label="Search">
</div>
</div>
</div>
</div>
<div class="data_srch">
<h3 id="invitedUsers"></h3>
<div id="select_user_list" class="inbox_user row">
</div>
</div>
</div>
</div>
</div>
<ul class="icon-bar fixed-bottom nav nav-pills mb-0" id="pills-tab" role="tablist">
<!-- Display None (d-none) chatList -->
<li class="nav-item d-flex justify-content-center">
<a class="nav-link active" id="pills-chatlist-tab" data-toggle="pill" href="#pills-chatlist" role="tab" aria-controls="pills-chatlist" aria-selected="true">
<i class="fa fa-comments fa-6" aria-hidden="true"></i>
</a>
</li>
<!-- Display None (d-none) chat -->
<li class="nav-item d-none justify-content-center">
<a class="nav-link" id="pills-chat-tab" data-toggle="pill" href="#pills-chat" role="tab" aria-controls="pills-chat" aria-selected="false">
<i class="fa fa-comments fa-6" aria-hidden="true"></i>
</a>
</li>
<!-- Display None (d-none) chatList -->
<li class="nav-item d-none justify-content-center">
<a class="nav-link" id="pills-group-tab" data-toggle="pill" href="#pills-group" role="tab" aria-controls="pills-group" aria-selected="false">
<i class="fa fa-comments fa-6" aria-hidden="true"></i>
</a>
</li>
<!-- Display None (d-none) chatList -->
<li class="nav-item d-none justify-content-center">
<a class="nav-link" id="pills-user-tab" data-toggle="pill" href="#pills-user" role="tab" aria-controls="pills-user" aria-selected="false">
<i class="fa fa-comments fa-6" aria-hidden="true"></i>
</a>
</li>
<!-- Display None (d-none) chatList -->
<li class="nav-item d-none justify-content-center">
<a class="nav-link" id="pills-confirm-tab" data-toggle="pill" href="#pills-confirm" role="tab" aria-controls="pills-confirm" aria-selected="false">
<i class="fa fa-comments fa-6" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item d-flex justify-content-center">
<a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">
<i class="fa fa-file-alt fa-6" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item d-flex justify-content-center">
<a class="nav-link" id="pills-communication-tab" data-toggle="pill" href="#pills-communication" role="tab" aria-controls="pills-communication" aria-selected="false">
<i class="fa fa-users fa-6" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item d-flex justify-content-center">
<a class="nav-link" id="pills-setting-tab" data-toggle="pill" href="#pills-setting" role="tab" aria-controls="pills-setting" aria-selected="false">
<i class="fa fa-cog fa-6" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
<script id="message-template" type="text/template">
<div class="incoming_msg">
<div class="incoming_msg_img">
<img src={{{profileImage}}} alt="">
</div>
<div class="received_msg">
<div class="received_withd_msg">
<p class="message_content">{{text}}</p>
<span class="time_date">{{from}} | {{createdAtTime}} | {{createdAtDay}}</span>
</div>
</div>
</div>
</script>
<script id="message-template-me" type="text/template">
<div class="outgoing_msg">
<div class="sent_msg">
<p class="message_content">{{text}}</p>
<span class="time_date">{{from}} | {{createdAtTime}} | {{createdAtDay}}</span>
</div>
</div>
</script>
<script id="room-template" type="text/template">
<div class="chat_list {{active}} col-12" data-roomName="{{roomName}}" data-room-id="{{roomId}}">
<div class="chat_people">
<div class="chat_img">
<img src={{{profileImage}}} alt="">
</div>
<div class="chat_ib">
<div class="row">
<div class="col-8">
<h5 class="">
<div class="room-list-title">
<span class="text-truncate room-name-font">{{roomName}}</span>
<span class="text-muted room-member-count">{{userCnt}}</span>
</div>
</h5>
</div>
<div class="col-4">
<span class="chat_date">{{time}}</span>
</div>
</div>
<p class="text-truncate float-left">{{lastMessage}}</p><span class="badge badge-pill badge-danger float-right unreadMsgCnt">{{unreadMsgCnt}}</span>
</div>
<div class="squareBox deleteBox" data-room-id="{{roomId}}" data-active-room="{{active}}">
<div class="squareBoxContent">
<div>
<span>
<i class="fa fa-trash"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</script>
<script id="group-template" type="text/template">
<div class="group_list col-12" data-name="{{name}}">
<div class="group_people">
<div class="group_img">
<img src="${chatUrl}images/group-image.png" alt="">
</div>
<div class="group_ib">
<h5>{{name}}</h5>
<p>{{info}}</p>
</div>
</div>
</div>
</script>
<script id="user-template" type="text/template">
<div class="user_list col-12" data-name="{{name}}">
<div class="user_people">
<div class="user_img">
<img src="{{profileImage}}" alt="">
</div>
<div class="user_ib">
<h5>{{name}}</h5>
<p>{{info}}</p>
</div>
<div class="squareBox userCheckBox" data-name="{{name}}" data-id="{{id}}">
<div class="squareBoxContent">
<div>
<span>
<i class="fas fa-check"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</script>
<script src="./socket.io/dist/socket.io.js"></script>
<script src="./js/libs/socket.io.js"></script>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/popper.min.js"></script>
<script src="./js/libs/moment.js"></script>
......@@ -50,7 +432,21 @@
<script src="./js/language_ko.js" charset="UTF-8"></script>
<script src="./js/language_ja.js" charset="UTF-8"></script>
<script src="./js/language_en.js" charset="UTF-8"></script>
<script src="./js/constant.js"></script>
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-error.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-websocket.js"></script>
</body>
<script>
jQuery('#homeButton').on('click', function() {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.goHome();
}
});
</script>
</html>
\ No newline at end of file
// 名前空間
var CHAT_DB = {};
//ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(input) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList());
}
};
\ No newline at end of file
// 名前空間
var CHAT_UI = {};
$(function(){
$(function() {
let navbarHeight = document.getElementsByClassName("navbar")[0].offsetHeight
let searchBarHeight = document.getElementsByClassName("search-bar-fixed")[0].offsetHeight
$(".tab-pane").css('padding', `${navbarHeight + 'px'} 0px 0px`)
$(".inbox_chat").css('max-height', `calc(100vh - ${navbarHeight + 'px'})`)
jQuery('.roomListIcon').hide();
jQuery('#userSelectionDeleteBtn').hide();
jQuery('#createChatRoom').hide();
/* チャットルーム一覧画面スクロール範囲
* 画面の高さ - (画面上部タイトルの高さ + ルーム名検索欄の高さ) */
$(".inbox_chat").css('max-height', `calc(100vh - ${(navbarHeight + searchBarHeight) + 'px'})`)
$('.roomListIcon').hide();
$('#userSelectionDeleteBtn').hide();
//$('#createChatRoom').hide();
});
// Rotate
$(window).on('resize', function(){
$(window).on('resize', function() {
if (CHAT_UTIL.isMobile()) {
return;
}
......@@ -40,7 +44,7 @@ $(window).on('resize', function(){
// New Room
// チャットルーム生成ボタン処理
jQuery('#createChatRoom').on('click', function(){
$('#createChatRoom').on('click', function() {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
......@@ -51,47 +55,48 @@ jQuery('#createChatRoom').on('click', function(){
// Room Delete
// チャットルーム削除ボタン処理
jQuery('#roomDeleteButton').on('click', function(e){
if (jQuery('.deleteBox').is(':visible')) {
$('#roomDeleteButton').on('click', function(e) {
if ($('.deleteBox').is(':visible')) {
// チャットルーム削除アイコンが表示されている時、ブラインド処理を行う
jQuery('.deleteBox').finish().show().fadeTo('slow',0,function(){
jQuery(this).hide();
$('.deleteBox').finish().show().fadeTo('slow', 0, function() {
$(this).hide();
});
// チャットリストについてクリックイベントを与える
jQuery('.chat_list').off('click');
jQuery('.chat_list:not(.active_chat)').on('click', function(e){
$('.chat_list').off('click');
$('.chat_list:not(.active_chat)').on('click', function(e) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let roomId = jQuery(this).data('roomId');
let roomName = jQuery(this).data('roomname');
socket.emit('joinRoom', roomId, roomName, function (){
jQuery('#messages').html('');
jQuery('.titleRoomName').text(roomName).data('roomName', roomName);
jQuery('#pills-chat-tab').tab('show');
let roomId = $(this).data('roomId');
let roomName = $(this).data('roomname');
socket.emit('joinRoom', roomId, roomName, function() {
$('#messages').html('');
$('.titleRoomName').text(roomName).data('roomName', roomName);
$('#pills-chat-tab').tab('show');
$("#message-search").attr("placeholder", $("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder"));
});
});
let roomListTitle = getLocalizedString("roomListTitle")
$('.titleRoomName').text(roomListTitle)
jQuery('.chat_list.active_chat').on('click', function(e){
jQuery('#pills-chat-tab').tab('show');
$('.chat_list.active_chat').on('click', function(e){
$('#pills-chat-tab').tab('show');
});
} else {
// チャットルーム削除アイコンが表示されていない場合、表示する
jQuery('.deleteBox').finish().hide().fadeTo('slow',1).show();
$('.deleteBox').finish().hide().fadeTo('slow',1).show();
// #36129に対応
let deleteRoomTitle = getLocalizedString("deleteRoomTitle")
$('.titleRoomName').text(deleteRoomTitle)
// 重複処理を防ぐためにチャットリストのクリックイベントを消す
jQuery('.chat_list').off('click');
$('.chat_list').off('click');
// チャットルームの削除アイコンにクリックイベントを与える
jQuery('.deleteBox').off('click');
jQuery('.deleteBox').on('click', function(e){
$('.deleteBox').off('click');
$('.deleteBox').on('click', function(e){
// #36174
let roomId = jQuery(this).data('roomId');
let activeRoom = jQuery(this).data('activeRoom');
let roomId = $(this).data('roomId');
let activeRoom = $(this).data('activeRoom');
$("#roomDeleteTitle").text(getLocalizedString("roomDeleteTitle"));
$("#roomDelete").text(getLocalizedString("roomDelete"));
$("#cancelTitle").text(getLocalizedString("cancelTitle"));
......@@ -106,7 +111,7 @@ jQuery('#roomDeleteButton').on('click', function(e){
CHAT_UI.showLoadingIndicator();
// 現在接続されているチャットルームを離れるとメッセージテップを初期化する
if (activeRoom) {
jQuery('#messages').html('');
$('#messages').html('');
CHAT.saveRoomInfo('', '');
}
// チャットルームから退場する
......@@ -120,61 +125,24 @@ jQuery('#roomDeleteButton').on('click', function(e){
}
});
// チャットルームのリストを未確認順で整列したデータを要請
jQuery('#orderByUnread').on('click', function(event){
// #36145
jQuery('#orderByTime').removeClass('dropdown-item-checked')
jQuery('#orderByUnread').removeClass('dropdown-item-checked').addClass('dropdown-item-checked')
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
event.preventDefault();
socket.emit('getRoomList', true);
});
// メッセージの送信時間順で整列したデータを要請
jQuery('#orderByTime').on('click', function(event){
// #36145
jQuery('#orderByTime').removeClass('dropdown-item-checked').addClass('dropdown-item-checked')
jQuery('#orderByUnread').removeClass('dropdown-item-checked')
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
event.preventDefault();
socket.emit('getRoomList');
});
// Room Keyword Search
// キーワード検索機能
jQuery('#roomKeywordSearch').on('shown.bs.dropdown', function (e){
jQuery('#roomKeyword').focus();
});
// #36145
jQuery('#roomKeyButton').on('click', function(event) {
// #36147に対応
// キーワード検索の値が変更し、検索を行う
if (jQuery('#roomKeyword').val().length > 0) {
$('#room-search').on('input', function(event) {
if ($('#room-search').val().length > 0) {
// 検索結果が有る場合、結果を表示する
socket.emit('roomSearch', encodeURIComponent(jQuery('#roomKeyword').val()));
socket.emit('roomSearch', encodeURIComponent($('#room-search').val()));
} else {
// 検索結果がない場合、チャットルームのリストを表示する
// #36147; #36145; orderByUnreadにチェックした場合、該当状態にsortされるように
if(jQuery('#orderByTime').hasClass('dropdown-item-checked')) {
socket.emit('getRoomList');
} else {
socket.emit('getRoomList', true);
}
}
});
//上にスクロールすると新しいメッセージを呼ぶ処理。
jQuery('#messages').scroll(function(){
if (jQuery(this).scrollTop() === 0) {
if (!jQuery('#chatLoader').is(':visible')) {
$('#messages').scroll(function(){
if ($(this).scrollTop() === 0) {
if (!$('#chatLoader').is(':visible')) {
// 現在、メッセージの個数以前をメッセージを読み込む
// ローディングアイコンを追加する
let loader = jQuery('<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>')
jQuery('#messages').prepend(loader)
socket.emit('getMessages', jQuery(this).children().length, function() {
let loader = $('<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>')
$('#messages').prepend(loader)
socket.emit('getMessages', $(this).children().length, function() {
// ローディングアイコンを削除する
loader.remove();
});
......@@ -183,59 +151,60 @@ jQuery('#messages').scroll(function(){
});
//メッセージ送信
jQuery('#message-form').on('keypress', function(event){
if (event.which == 13){
$('#message-form').on('keypress', function(event){
if (event.which == 13) {
// Enterキーの処理
jQuery('#message-send-btn').click();
$('#message-send-btn').click();
}
});
// 送信ボタンの処理
jQuery('#message-send-btn').on('click', function (e){
$('#message-send-btn').on('click', function (e){
e.preventDefault();
const messageTextBox = jQuery('#message-form');
const messageTextBox = $('#message-form');
const message = messageTextBox.val().length > 0 ? encodeURIComponent(messageTextBox.val() + " ") : "";
messageTextBox.val('');
if(message.length > 0) {
socket.emit('createMessage', {
text: message
}, 0);
if (message.length > 0) {
socket.emit(
'createMessage', { text: message }
, 0
);
}
jQuery('#message-form').focus();
$('#message-form').focus();
});
// 写真アップロード
jQuery('#fileUploadButton').on('click', function(){
jQuery('#imageInputTag').click();
$('#fileUploadButton').on('click', function(){
$('#imageInputTag').click();
});
// 動画アップロード
jQuery('#fileUploadButton2').on('click', function(){
jQuery('#imageInputTag2').click();
$('#fileUploadButton2').on('click', function(){
$('#imageInputTag2').click();
});
jQuery('#imageInputTag').on('change', function(){
jQuery('#image-form').submit();
$('#imageInputTag').on('change', function(){
$('#image-form').submit();
});
jQuery('#imageInputTag2').on('change', function(){
jQuery('#image-form2').submit();
$('#imageInputTag2').on('change', function(){
$('#image-form2').submit();
});
jQuery('#image-form').on('submit', function(e){
$('#image-form').on('submit', function(e){
e.preventDefault();
const imageInputTag = jQuery('#imageInputTag');
const imageInputTag = $('#imageInputTag');
const file = imageInputTag.prop('files')[0];
if (file) {
jQuery('.overlay').addClass('active undismissable');
jQuery('.loader').addClass('active');
$('.overlay').addClass('active undismissable');
$('.loader').addClass('active');
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成
CHAT.createThumbnailAndUpload(file, function(resizeFile, thumbnailCreated){
if(resizeFile && thumbnailCreated) {
if (resizeFile && thumbnailCreated) {
//ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
fd.append('thumb', resizeFile)
}
......@@ -247,13 +216,13 @@ jQuery('#image-form').on('submit', function(e){
}
});
jQuery('#image-form2').on('submit', function(e){
$('#image-form2').on('submit', function(e){
e.preventDefault();
const imageInputTag2 = jQuery('#imageInputTag2');
const imageInputTag2 = $('#imageInputTag2');
const file = imageInputTag2.prop('files')[0];
if (file) {
jQuery('.overlay').addClass('active undismissable');
jQuery('.loader').addClass('active');
$('.overlay').addClass('active undismissable');
$('.loader').addClass('active');
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
......@@ -276,8 +245,8 @@ jQuery('#image-form2').on('submit', function(e){
// Gallery Button
// ギャラリーボタンを押すと最後の写真をクリックさせる。 (ボタン非活性化中)
jQuery('#imageGalleryButton').on('click', function(){
jQuery('[data-lightbox=attachedImages]:last').click();
$('#imageGalleryButton').on('click', function(){
$('[data-lightbox=attachedImages]:last').click();
});
//lightbox Configuration
......@@ -288,49 +257,33 @@ lightbox.option({
'alwaysShowNavOnTouchDevices': true
});
// templateMessage
jQuery('#templateMessage .dropdown-item').on('click', function(event){
// ドロップダウンメッセージをクリックすると、当該メッセージを転送する。
jQuery('#message-form').val(jQuery(this).text());
jQuery('#message-send-btn').click();
});
// Chat Keyword Highlight
jQuery('#chatKeywordSearch').on('shown.bs.dropdown', function (e){
// チャットキーワードドロップダウンを押すと、カーソルをキーワードウィンドウに移す。
jQuery('#chatKeyword').focus();
});
jQuery('#chatKeyword').on('input', function(event){
$('#message-search').on('input', function(event) {
// チャットキーワードを入力するとページ内にある単語をハイライトする。(mark.js 使用)
if (jQuery(this).val()) {
jQuery('.message_content').unmark();
jQuery('.message_content').mark(jQuery(this).val());
if ($(this).val()) {
$('.message_content').unmark();
$('.message_content').mark($(this).val());
if (jQuery('[data-markjs=true]').length > 0) {
if ($('[data-markjs=true]').length > 0) {
// マーキングされている単語があった場合、最後の単語にスクロールを移動する。
CHAT_UI.scrollToLastMarkedUnseen(jQuery(this).val());
CHAT_UI.scrollToLastMarkedUnseen($(this).val());
} else {
// マーキングされている単語がない場合、下段にスクロールする。
CHAT_UI.scrollToBottom();
}
} else {
// チャットキーワードが空欄になるとマーキングを解除し、下段にスクロールする。
jQuery('.message_content').unmark();
$('.message_content').unmark();
CHAT_UI.scrollToBottom();
}
});
// 次のマーキングされた単語にスクロールを移動する。
jQuery('#chatKeyword').on('keypress', function(event){
if (event.which == 13) {
// Enterキーの処理
CHAT_UI.scrollToLastMarkedUnseen(jQuery(this).val());
}
//次のマーキングされた単語にスクロールを移動する。
$('#pre-search').on('click', function(event) {
CHAT_UI.scrollToLastMarkedUnseen(jQuery('#message-search').val());
});
// Exit Room
jQuery('#exitRoom').on('click', function(event){
$('#exitRoom').on('click', function(event){
// 36174
$("#exitRoomTitle").text(getLocalizedString("exitRoomTitle"));
$("#exitRoomOk").text(getLocalizedString("yesTitle"));
......@@ -345,31 +298,31 @@ jQuery('#exitRoom').on('click', function(event){
CHAT_UI.showLoadingIndicator();
// チャットルームから退場する
socket.emit('exitRoom');
jQuery('#dismiss').click();
$('#dismiss').click();
CHAT.saveRoomInfo('', '');
});
});
// Side Bar
jQuery('#sidebarCollapse').on('click', function (){
$('#sidebarCollapse').on('click', function (){
// open sidebar
jQuery('#sidebar').addClass('active');
$('#sidebar').addClass('active');
// fade in the overlay
jQuery('.overlay').addClass('active');
jQuery('.collapse.in').toggleClass('in');
jQuery('a[aria-expanded=true]').attr('aria-expanded', 'false');
$('.overlay').addClass('active');
$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
jQuery('#dismiss, .overlay').on('click', function (){
$('#dismiss, .overlay').on('click', function (){
// hide sidebar
jQuery('#sidebar').removeClass('active');
$('#sidebar').removeClass('active');
// hide overlay if dismissable
jQuery('.overlay:not(.undismissable)').removeClass('active');
$('.overlay:not(.undismissable)').removeClass('active');
});
//Invite User
//招待ボタンを押すとグループリストを持ってくる。(ボタンを動的に追加して微動作中)
jQuery('#addUser').on('click', function(event){
$('#addUser').on('click', function(event){
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let isInvite = true;
......@@ -378,32 +331,32 @@ jQuery('#addUser').on('click', function(event){
});
//グループ画面での検索
jQuery('#groupListKeyword').on('input', function(event) {
$('#groupListKeyword').on('input', function(event) {
// data-name値で当該キーワードが入っているグループのみを表示する。
if (jQuery(this).val()) {
jQuery('.group_list:not([data-name*="'+jQuery(this).val()+'" i])').hide();
jQuery('.group_list[data-name*="'+jQuery(this).val()+'" i]').show();
if ($(this).val()) {
$('.group_list:not([data-name*="'+$(this).val()+'" i])').hide();
$('.group_list[data-name*="'+$(this).val()+'" i]').show();
} else {
jQuery('.group_list').show();
$('.group_list').show();
}
});
jQuery('#userListKeyword').on('input', function(event) {
$('#userListKeyword').on('input', function(event) {
// data-name値で当該キーワードが入っているユーザーのみを表示する。
if (jQuery(this).val()) {
jQuery('.user_list:not([data-name*="'+jQuery(this).val()+'" i])').hide();
jQuery('.user_list[data-name*="'+jQuery(this).val()+'" i]').show();
if ($(this).val()) {
$('.user_list:not([data-name*="'+$(this).val()+'" i])').hide();
$('.user_list[data-name*="'+$(this).val()+'" i]').show();
} else {
jQuery('.user_list').show();
$('.user_list').show();
}
});
jQuery('#selectListKeyword').on('input', function(event) {
if (jQuery(this).val()) {
jQuery('.select_user_list:not([data-name*="'+jQuery(this).val()+'" i])').hide();
jQuery('.select_user_list[data-name*="'+jQuery(this).val()+'" i]').show();
$('#selectListKeyword').on('input', function(event) {
if ($(this).val()) {
$('.select_user_list:not([data-name*="'+$(this).val()+'" i])').hide();
$('.select_user_list[data-name*="'+$(this).val()+'" i]').show();
} else {
jQuery('.select_user_list').show();
$('.select_user_list').show();
}
});
......@@ -414,8 +367,8 @@ jQuery('#selectListKeyword').on('input', function(event) {
/* ---------------------------------------------------------------------- */
// Tab Open/Shown Event
jQuery('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
var target = jQuery(e.target).attr("href"); // e.target : activated tab
$('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
var target = $(e.target).attr("href"); // e.target : activated tab
switch(target) {
case '#pills-chat':
if (CHAT_UI.isLandscapeMode()) {
......@@ -424,14 +377,16 @@ jQuery('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
$(".mesgs").removeClass("landscape_mesgs");
}
CHAT.globalIsInvite = true;
jQuery('.chatRoomIcon, .titleRoomName, #backButton').show();
jQuery('.roomListIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
jQuery('.titleRoomName').text(jQuery('.titleRoomName').data('roomName'));
jQuery('#newRoomName').val('');
jQuery('#userSelectionLength').text('');
$('.chatRoomIcon, .titleRoomName, #backButton').show();
$('.roomListIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('#homeButton').hide();
$('.titleRoomName').text($('.titleRoomName').data('roomName'));
$('#newRoomName').val('');
$('#userSelectionLength').text('');
CHAT.globalSelectedUserList = [];
jQuery('#backButton').off().on('click', function() {
$('#backButton').off().on('click', function() {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('leaveRoom', function() {
......@@ -444,76 +399,76 @@ jQuery('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
CHAT_UI.dismissLoadingIndicator();
break;
case '#pills-chatlist':
jQuery('.titleRoomName, #backButton').show();
jQuery('.chatRoomIcon, #backButton, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('.titleRoomName, #backButton').show();
$('.chatRoomIcon, #backButton, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('#homeButton').show();
$('#room-search').val('');
// set Title
let roomListTitle = getLocalizedString("roomListTitle")
jQuery('.titleRoomName').text(roomListTitle);
jQuery('#newRoomName').val('');
jQuery('#userSelectionLength').text('');
$('.titleRoomName').text(roomListTitle);
$('#newRoomName').val('');
$('#userSelectionLength').text('');
CHAT.globalSelectedUserList = [];
// #36145
jQuery('#orderByTime').removeClass('dropdown-item-checked').addClass('dropdown-item-checked')
jQuery('#orderByUnread').removeClass('dropdown-item-checked')
break;
case '#pills-user':
jQuery("#backButton").show();
jQuery("#userSelectionDeleteBtn").hide();
$("#backButton").show();
$("#userSelectionDeleteBtn").hide();
$('#homeButton').hide();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
break;
case '#pills-group':
jQuery("#backButton").show();
jQuery("#userSelectionDeleteBtn").hide();
$("#backButton").show();
$("#userSelectionDeleteBtn").hide();
$('#homeButton').hide();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
break;
case '#pills-confirm':
jQuery("#backButton").show();
$("#backButton").show();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
jQuery('.titleRoomName').hide();
jQuery('#navbarLeft').addClass('col-9').removeClass('col-3');
$('#homeButton').hide();
$('.user_people').css("paddingLeft", "0px");
break;
case '#pills-communication': // コミュニケーションのタブ
case '#pills-setting': // 設定のタブ
case '#pills-profile': // ユーザプロファイルのタブ
jQuery('.titleRoomName').show();
jQuery('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
jQuery('#backButton').hide();
$('.titleRoomName').show();
$('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('#backButton').hide();
break;
default:
jQuery('.titleRoomName').show();
jQuery('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
jQuery('#backButton').hide();
$('.titleRoomName').show();
$('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('#backButton').hide();
break;
}
});
// Tab Close/Hidden Event
jQuery('a[data-toggle="pill"]').on('hide.bs.tab', function (e){
var target = jQuery(e.target).attr("href"); // e.target : activated tab
$('a[data-toggle="pill"]').on('hide.bs.tab', function(e) {
var target = $(e.target).attr("href"); // e.target : activated tab
switch(target) {
case '#pills-chat':
jQuery('#chatKeyword').val('');
$('#message-search').val('');
break;
case '#pills-chatlist':
jQuery('#roomKeyword').val('');
$('#room-search').val('');
break;
case '#pills-group':
jQuery('#groupListKeyword').val('');
$('#groupListKeyword').val('');
break;
case '#pills-user':
jQuery('#userListKeyword').val('');
$('#userListKeyword').val('');
break;
case '#pills-confirm':
jQuery('#select_user_list').html('');
jQuery('#selectUserListKeyword').val('');
jQuery('.titleRoomName').show();
jQuery('#navbarLeft').addClass('col-3').removeClass('col-9');
$('#select_user_list').html('');
$('#selectUserListKeyword').val('');
$('.titleRoomName').show();
$('.user_people').css("paddingLeft", "12%");
break;
case '#pills-communication':
case '#pills-setting':
......@@ -524,36 +479,36 @@ jQuery('a[data-toggle="pill"]').on('hide.bs.tab', function (e){
}
});
jQuery('#pills-chat-tab').on('shown.bs.tab', function (e){
$('#pills-chat-tab').on('shown.bs.tab', function (e){
CHAT_UI.scrollToBottom();
});
jQuery('#pills-user-tab').on('shown.bs.tab', function (e){
jQuery('#userSelectionConfirmBtn').show();
$('#pills-user-tab').on('shown.bs.tab', function (e){
$('#userSelectionConfirmBtn').show();
});
jQuery('#pills-confirm-tab').on('shown.bs.tab', function (e){
jQuery('#userSelectionConfirmBtn').show();
jQuery('#userSelectionLength').text('');
jQuery('#userSelectionDeleteBtn').hide();
$('#pills-confirm-tab').on('shown.bs.tab', function (e){
$('#userSelectionConfirmBtn').show();
$('#userSelectionLength').text('');
$('#userSelectionDeleteBtn').hide();
});
CHAT_UI.scrollToBottom = function() {
const messages = jQuery('#messages');
const messages = $('#messages');
const scrollHeight = messages.prop('scrollHeight');
messages.scrollTop(scrollHeight);
};
CHAT_UI.scrollToLastMarkedUnseen = function(value) {
let target = jQuery('[data-markjs=true]:not([data-seen=true])').last();
let messages = jQuery('#messages');
let target = $('[data-markjs=true]:not([data-seen=true])').last();
let messages = $('#messages');
if (target.length > 0) {
messages.scrollTop(target.prop('offsetTop') - target.prop('offsetHeight') - messages.prop('offsetHeight') + target.parent().parent().height());
target.attr('data-seen', true);
} else {
messages.scrollTop(0);
jQuery('.message_content').unmark();
jQuery('.message_content').mark(value);
$('.message_content').unmark();
$('.message_content').mark(value);
}
};
......@@ -577,30 +532,28 @@ CHAT_UI.isLandscapeMode = function() {
}
CHAT_UI.setConfirmButtonEvent = function(isInvite) {
jQuery('#userSelectionConfirmBtn').show();
let titleText = isInvite ? getLocalizedString("inviteUsersSubtitle") : getLocalizedString("createRoomSubtitle")
let invitedUserText = getLocalizedString("invitedUser")
if (!isInvite) {
jQuery('#newRoomName').show();
$('#newRoomName').show();
}
jQuery('#userSelectionConfirmBtn').off().on('click', function(event) {
$('#userSelectionConfirmBtn').off().on('click', function(event) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT_UI.showConfirmView(isInvite);
});
CHAT_UI.showConfirmView(isInvite);
jQuery('#inviteStatus').text(titleText);
jQuery('.roomListIcon, .titleRoomName').hide();
jQuery('.userCheckBox').show();
jQuery('#pills-confirm-tab').tab('show');
$('#inviteStatus').text(titleText);
$('#invitedUsers').text(invitedUserText);
$('#pills-confirm-tab').tab('show');
}
//ConfirmView initialize
CHAT_UI.showConfirmView = function(isInvite) {
const template = jQuery('#user-template').html();
jQuery('#select_user_list').html('');
const template = $('#user-template').html();
$('#select_user_list').html('');
CHAT.globalSelectedUserList.forEach(function(user){
let html = Mustache.render(template, {
......@@ -608,39 +561,38 @@ CHAT_UI.showConfirmView = function(isInvite) {
profileImage: user.profileImagePath,
name: user.loginId
});
let obj = jQuery(jQuery.parseHTML(html)).on('click',function(){
jQuery(this).find('.userCheckBox').toggleClass('active');
if (jQuery('#select_user_list .user_list').find(".userCheckBox.active").length > 0) {
jQuery("#userSelectionDeleteBtn").show();
} else {
jQuery("#userSelectionDeleteBtn").hide();
}
// TODO 次のコミットに参考事項
// チャットルーム開設画面で参加ユーザー削除用チェックロジックが残っているので
// 影響テスト後、削除予定。 kang-dh
let obj = $(jQuery.parseHTML(html)).on('click',function(){
$(this).find('.userCheckBox').toggleClass('active');
});
jQuery('#select_user_list').append(obj);
$('#select_user_list').append(obj);
});
let roomListTitle = getLocalizedString("createRoomTitle")
$('.titleRoomName').text(roomListTitle)
// Rotate
if(CHAT_UI.isLandscapeMode()){
jQuery(".user_list").addClass("col-6").removeClass("col-12");
$(".user_list").addClass("col-6").removeClass("col-12");
$(".squareBoxContent span").addClass("landscape_span");
}
jQuery('#backButton').off().on('click', function() {
$('#backButton').off().on('click', function() {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('getGroupList', isInvite)
});
jQuery("#userSelectionConfirmBtn").off().on('click', function(){
$("#userSelectionConfirmBtn").off().on('click', function(){
if (isInvite) {
let userIdList = jQuery.makeArray(jQuery('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
let userIdList = jQuery.makeArray($('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
return e.dataset.id;
});
// ユーザーの名前(login id)リスト。
let loginIdList = jQuery.makeArray(jQuery('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
let loginIdList = jQuery.makeArray($('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
return e.dataset.name;
});
......@@ -648,26 +600,39 @@ CHAT_UI.showConfirmView = function(isInvite) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('inviteUsers', userIdList, loginIdList, function() {
jQuery("#userSelectionDeleteBtn").hide();
jQuery('#pills-chat-tab').tab('show');
$("#userSelectionDeleteBtn").hide();
$('#pills-chat-tab').tab('show');
});
}
} else {
if (jQuery('#select_user_list .user_list').find('.userCheckBox').length > 0) {
if ($('#select_user_list .user_list').find('.userCheckBox').length > 0) {
// #36130に対応
const trimmedRoomName = jQuery('#newRoomName').val().trim()
const trimmedRoomName = $('#newRoomName').val().trim()
if (trimmedRoomName.length == 0) {
// 36174
$("#userSelectionTitle").text(getLocalizedString("inputRoomName"));
$("#yesTitle").text(getLocalizedString("yesTitle"));
$('#confirm').appendTo("body").modal({
backdrop: 'static',
keyboard: false
})
.on('click', '#yesTitle', function(e) {
//ルーム名を入力しなかったら、ルーム名textFieldにfocusを置く
jQuery('#newRoomName').focus();
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let userIdList = jQuery.makeArray($('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
return e.dataset.id;
});
let userNameList = jQuery.makeArray($('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
return e.dataset.name;
});
//TODO DB作業が終わったら自分のユーザ名を表示するかを判断し、修正予定。
// 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + ',' + userNameList.join(',');
// ルーム名のURIencodingを行う
const encodedRoomName = encodeURIComponent(newRoomName);
socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function () {
CHAT.saveRoomInfo(newRoomId, newRoomName);
$('#messages').html('');
$('.titleRoomName').text(newRoomName).data('roomName', newRoomName);
$("#userSelectionDeleteBtn").hide();
$('#pills-chat-tab').tab('show');
});
});
} else if(trimmedRoomName.includes(';') || trimmedRoomName.includes('/') || trimmedRoomName.includes('?') || trimmedRoomName.includes(':') || trimmedRoomName.includes("@")
......@@ -704,7 +669,7 @@ CHAT_UI.showConfirmView = function(isInvite) {
} else {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let userIdList = jQuery.makeArray(jQuery('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
let userIdList = jQuery.makeArray($('#select_user_list .user_list').find('.userCheckBox')).map(function (e) {
return e.dataset.id;
});
......@@ -713,10 +678,10 @@ CHAT_UI.showConfirmView = function(isInvite) {
socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, trimmedRoomName, function () {
CHAT.saveRoomInfo(newRoomId, trimmedRoomName);
jQuery('#messages').html('');
jQuery('.titleRoomName').text(trimmedRoomName).data('roomName', trimmedRoomName);
jQuery("#userSelectionDeleteBtn").hide();
jQuery('#pills-chat-tab').tab('show');
$('#messages').html('');
$('.titleRoomName').text(trimmedRoomName).data('roomName', trimmedRoomName);
$("#userSelectionDeleteBtn").hide();
$('#pills-chat-tab').tab('show');
});
});
}
......@@ -724,9 +689,9 @@ CHAT_UI.showConfirmView = function(isInvite) {
}
});
jQuery("#userSelectionDeleteBtn").hide();
$("#userSelectionDeleteBtn").hide();
jQuery("#userSelectionDeleteBtn").off().on('click', function() {
$("#userSelectionDeleteBtn").off().on('click', function() {
// #36174
$("#customConfirmTitle").text(getLocalizedString("memberDeleteTitle"));
$("#customConfirmOk").text(getLocalizedString("roomDelete"));
......@@ -745,14 +710,14 @@ CHAT_UI.showConfirmView = function(isInvite) {
CHAT_UI.deleteButtonAction = function(isInvite) {
//配列の整理
jQuery.makeArray(jQuery('#select_user_list .user_list').find(".userCheckBox.active")).map(function (e) {
jQuery.makeArray($('#select_user_list .user_list').find(".userCheckBox.active")).map(function (e) {
CHAT.globalSelectedUserList = CHAT.globalSelectedUserList.filter(function(element) {
return e.dataset.name != element.loginId;
});
});
CHAT_UI.showConfirmView(isInvite)
jQuery('#select_user_list .user_list').find('.userCheckBox').show();
$('#select_user_list .user_list').find('.userCheckBox').show();
}
CHAT_UI.htmlElementTextInitialize = function(languageCode) {
......@@ -760,6 +725,7 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) {
setLanguage(languageCode);
$(".titleRoomName").text(getLocalizedString("roomListTitle"));
$("#message-form").attr("placeholder", getLocalizedString("chat_placeholder"));
$("#message-search").attr("placeholder",$("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder"));
$("#exitRoom").text(getLocalizedString("exitRoom")).append("<i class='fas fa-door-open'></i>")
$("#participants").text(getLocalizedString("participants"))
......@@ -771,16 +737,10 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) {
$("#thankLabel").text(getLocalizedString("thankLabel"))
$("#startToWorkLabel").text(getLocalizedString("startToWorkLabel"))
$("#orderByTime").text(getLocalizedString("orderByTime"))
$("#orderByUnread").text(getLocalizedString("orderByUnread"))
$("#roomKeyword").attr("placeholder", getLocalizedString("roomKeywordPlaceHolder"))
$("#groupListKeyword").attr("placeholder", getLocalizedString("groupListKeyword"))
$("#groupPageSubtitle").text(getLocalizedString("groupPageSubtitle"))
$("#chatKeyword").attr("placeholder", getLocalizedString("roomKeywordPlaceHolder"))
$("#userListKeyword").attr("placeholder", getLocalizedString("userListKeyword"))
$("#groupListKeyword").attr("placeholder", getLocalizedString("groupSearch"))
$("#room-search").attr("placeholder",$("#room-search").attr("placeholder")+getLocalizedString("room_search_placeholder"));
$("#userListKeyword").attr("placeholder", getLocalizedString("userSearch"))
$("#newRoomName").attr("placeholder", getLocalizedString("newRoomName"))
}
......@@ -805,3 +765,84 @@ CHAT_UI.waitForLoadingImage = function(div, callback) {
});
}
CHAT_UI.refreshRoomList = function() {
var rooms = CHAT_DB.getRoomList();
CHAT.globalIsInvite = false;
activeRoomId = null;
// #36146に対応
let keywordSearchMode = false;
if ($('#room-search').val().length > 0) {
keywordSearchMode = true;
}
$('#room_list').html('');
let roomListTitle = getLocalizedString("roomListTitle");
$('.titleRoomName').text(roomListTitle);
if (rooms.length === 0) {
// 検索結果がない場合のメッセージを追加
if (!keywordSearchMode) {
let emptyListString = getLocalizedString("roomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
} else {
let emptyListString = getLocalizedString("searchRoomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
}
}
// チャットルームの様式を読み込む
const template = $('#room-template').html();
rooms.forEach(function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
room.message = room.message.toString()
} else {
room.message = getLocalizedString("noMessages")
}
var displayMsg;
//TODO 協業の場合処理追加必要
if (room.messageType == messageType.TEXT || room.messageType == messageType.TEXT) displayMsg = room.message;
if (room.messageType == messageType.IMAGE || room.messageType == messageType.SYSTEM) displayMsg = getLocalizedString("image");
let html = Mustache.render(template, {
roomName: room.chatRoomName,
roomId: room.chatRoomId,
profileImage: room.profileImagePath,
active: activeRoomId === room.chatRoomId ? 'active_chat' : null, // 現在、入っているルームだとhilight表示
lastMessage: displayMsg ,
time: room.insertDate ? CHAT_UTIL.formatDate(room.insertDate).createdAt : '',
unreadMsgCnt: room.unreadCount == 0 ? '' : room.unreadCount,
userCnt: room.userCount
});
// Click event
let obj = $(jQuery.parseHTML(html)).on('click', function() {
//TODO ルームに入る処理追加必要
});
// チャットルームリストに追加する
$('#room_list').append(obj);
});
if (rooms.length > 0) {
if (!keywordSearchMode) {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').show()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
} else {
if (!keywordSearchMode) {
$(".roomListIcon").hide()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
}
$('#createChatRoom').show();
if (CHAT_UI.isLandscapeMode()) {
$(".chat_list").removeClass("col-12").addClass("col-6");
}
$("#userSelectionDeleteBtn").hide();
// チャットルームリスト画面に遷移
$('#pills-chatlist-tab').tab('show');
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
};
......@@ -17,6 +17,12 @@ CHAT_UTIL.formatDate = function(date) {
const REFERENCE = moment();
const TODAY = REFERENCE.clone().startOf('day');
let createdAt = moment(date);
if (date.length == 14) {
createdAt = moment(date,'YYYYMMDDhhmmss');
} else {
createdAt = moment(date);
}
// #36171
const createdAtDay = createdAt.format('MMM Do');
const createdAtTime = createdAt.format('HH:mm');
......
var socket = io(CHAT_SERVER_URL);
var socket;
connectSocket(IS_ONLINE);
function connectSocket(isOnline) {
if (isOnline == 'true') {
socket = io(CHAT_SERVER_URL);
setSocketAction();
android.updateRoomList();
CHAT_UI.refreshRoomList();
CHAT_UI.dismissLoadingIndicator();
$('#createChatRoom').show();
} else {
//オフラインの場合、DBからルーム一覧を表示。
if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) {
$('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
android.getLoginParameter();
CHAT_UI.refreshRoomList();
CHAT_UI.dismissLoadingIndicator();
$('#createChatRoom').show();
}
}
}
/* ---------------------------------------------------
* Socket Connect/Disconnect
* Socket Connect/Disconnectc
* --------------------------------------------------- */
socket.on('connect', function (){
function setSocketAction () {
socket.on('connect', function() {
// socketが接続されたらチャット画面で画面を更新する
jQuery('.overlay').removeClass('active undismissable');
$('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
......@@ -15,65 +42,58 @@ socket.on('connect', function (){
} else if (CHAT_UTIL.isAndroid()) {
android.getLoginParameter();
}
});
CHAT_UI.dismissLoadingIndicator();
});
socket.on('disconnect', function (){
socket.on('disconnect', function (){
console.log('disconnect');
//socketが切断されたら黒画面で画面を更新する
jQuery('.overlay').addClass('active undismissable');
$('.overlay').addClass('active undismissable');
//alert('Disconnected from the server');
CHAT_UI.dismissLoadingIndicator();
});
});
socket.on('connect_error', function (){
// jQuery('.overlay').addClass('active undismissable');
// #36174
// $("#customAlertTitle").text(getLocalizedString("errorConnect"));
// $("#customAlertOk").text(getLocalizedString("yesTitle"));
//
// $('#customAlert').appendTo("body").modal({
// backdrop: 'static',
// keyboard: false
// })
// .on('click', '#customAlertOk', function(e) {
// });
socket.on('connect_error', function (){
console.log('connect_error');
CHAT_UI.dismissLoadingIndicator();
});
});
/* ----------------------------------------------------------------------
/* ----------------------------------------------------------------------
*
* Chat Room List Tab
*
* ---------------------------------------------------------------------- */
// Update Room List
socket.on('refreshRoomList', function(rooms, activeRoomId = null){
// Update Room List
//TODO APIの連動が終わったら削除予定
/*socket.on('refreshRoomList', function(rooms, activeRoomId = null){
CHAT.globalIsInvite = false;
// チャットルームリストを削除する
jQuery('#room_list').html('');
// #36146に対応
let roomListTitle = getLocalizedString("roomListTitle")
$('.titleRoomName').text(roomListTitle)
// #36146に対応
let keywordSearchMode = false;
if(jQuery('#roomKeyword').val().length > 0) {
if ($('#room-search').val().length > 0) {
keywordSearchMode = true;
}
$('#room_list').html('');
let roomListTitle = getLocalizedString("roomListTitle");
$('.titleRoomName').text(roomListTitle);
if (rooms.length === 0) {
// #36146に対応
// 検索結果がない場合のメッセージを追加
if (!keywordSearchMode) {
let emptyListString = getLocalizedString("roomListEmptyString")
jQuery('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
} else {
let emptyListString = getLocalizedString("searchRoomListEmptyString")
jQuery('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
}
}
// チャットルームの様式を読み込む
const template = jQuery('#room-template').html();
const template = $('#room-template').html();
rooms.forEach( function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
......@@ -96,24 +116,24 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
});
// Click event
let obj = jQuery(jQuery.parseHTML(html)).on('click',function(){
let obj = $(jQuery.parseHTML(html)).on('click',function(){
if (activeRoomId === room.roomId) {
// 既存チャットルームをタッチする場合、チャット画面に遷移
jQuery('#pills-chat-tab').tab('show');
$('#pills-chat-tab').tab('show');
} else {
// loadingIndicatorを表示しない
CHAT_UI.showLoadingIndicator();
// 新しいチャットルームをタッチする場合、チャットルームの接続処理を実行
socket.emit('joinRoom', room.roomId, room.roomName, function (){
CHAT.saveRoomInfo(room.roomId, room.roomName);
jQuery('#messages').html('');
$('#messages').html('');
// チャットルーム名を変更する
jQuery('.titleRoomName').text(room.roomName).data('roomName', room.roomName);
$('.titleRoomName').text(room.roomName).data('roomName', room.roomName);
});
}
});
// チャットルームリストに追加する
jQuery('#room_list').append(obj);
$('#room_list').append(obj);
});
// #36146に対応
......@@ -134,28 +154,28 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
}
}
jQuery('#createChatRoom').show()
$('#createChatRoom').show()
// Rotate
if(CHAT_UI.isLandscapeMode()) {
$(".chat_list").removeClass("col-12").addClass("col-6");
}
jQuery("#userSelectionDeleteBtn").hide();
$("#userSelectionDeleteBtn").hide();
// チャットルームリスト画面に遷移
jQuery('#pills-chatlist-tab').tab('show');
$('#pills-chatlist-tab').tab('show');
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});
});*/
// New Message
// #36170
socket.on('newMessage', function (message, roomId, roomName){
let template = jQuery('#message-template').html();
// New Message
// #36170
socket.on('newMessage', function (message, roomId, roomName) {
let template = $('#message-template').html();
if (message.id === socket.id) {
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
template = jQuery('#message-template-me').html();
template = $('#message-template-me').html();
}
let messageTime = CHAT_UTIL.formatDate(message.createdAt);
......@@ -175,40 +195,40 @@ socket.on('newMessage', function (message, roomId, roomName){
});
// イメージの場合、img tagを追加する
html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
jQuery('#messages').append(html);
$('#messages').append(html);
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
CHAT_UI.scrollToBottom();
}, 1500);
});
});
// Notification
socket.on('newNotification', function(keyword, event){
// Notification
socket.on('newNotification', function(keyword, event){
var notificationString = getLocalizedString(event, keyword)
jQuery('#messageNotification').finish().text(notificationString).delay(500).slideDown().delay(1500).slideUp();
});
$('#messageNotification').finish().text(notificationString).delay(500).slideDown().delay(1500).slideUp();
});
// 新しいメッセージを受信する場合の処理
// #36170
socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
let jQueryMessages = jQuery('#messages');
// 新しいメッセージを受信する場合の処理
// #36170
socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
let jQueryMessages = $('#messages');
// スクロールの変化を防ぐため以前画面の高さを保存する
let beforeHeight = jQueryMessages.prop('scrollHeight');
// メッセージ文字列の生成
let workVal = "";
messages.forEach(function(message) {
let template = jQuery('#message-template').html();
let template = $('#message-template').html();
if (message.shopMemberId == shopMemberId) {
template = jQuery('#message-template-me').html();
template = $('#message-template-me').html();
}
let messageTime = CHAT_UTIL.formatDate(message.time.time);
if(users != undefined) {
if (users != undefined) {
let user = users.find((user) => user.loginId == message.loginId)
// userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
if(user) {
if (user) {
message.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
} else {
message.profileImagePath = CHAT.getProfileImgUrl("")
......@@ -216,8 +236,12 @@ socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomNa
} else {
message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
}
// #36147
message.message = message.message.toString();
var replacePath = message.message;
replacePath = replacePath.replaceAll('/acms',CHAT_SERVER_URL+'/acms');
message.message = replacePath;
let html = Mustache.render(template, {
text: message.message,
from: message.loginId,
......@@ -241,40 +265,40 @@ socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomNa
CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
// タブレット等、画面サイズが大きい場合、スクロール出来なくならないよう追加で10件メッセージを取得
if ($(window).height() > jQueryMessages.height()) {
jQuery('#messages').scroll();
$('#messages').scroll();
}
}
// ユーザ削除ボタン表示しない
jQuery("#userSelectionDeleteBtn").hide();
$("#userSelectionDeleteBtn").hide();
CHAT_UI.dismissLoadingIndicator();// add some...
// チャットに遷移する
jQuery('#pills-chat-tab').tab('show');
});
$('#pills-chat-tab').tab('show');
});
// Update User List In Room
// サイドバーのユーザーリストアップデート。
socket.on('updateUserList', function(users, onlineUsers){
// Update User List In Room
// サイドバーのユーザーリストアップデート。
socket.on('updateUserList', function(users, onlineUsers){
if (users.length > 0) {
jQuery('#users').removeData();
jQuery('#users').data(users);
$('#users').removeData();
$('#users').data(users);
} else {
const data = jQuery('#users').data();
if(data && Object.keys(data).length > 0){
const data = $('#users').data();
if (data && Object.keys(data).length > 0){
users = Object.keys(data).map(function(key) {
return data[key];
});
}
}
const ul = jQuery('<ul/>', {class: 'list-unstyled components'});
const ul = $('<ul/>', {class: 'list-unstyled components'});
// ユーザーリストを入れる前にユーザー招待ボタンを入れてくれる。
let inviteString = getLocalizedString("inviteUsersButton")
ul.append(jQuery('<li/>').append(`<a>${inviteString} <i class='fa fa-user-plus'><i/></a>`).on('click', function(event){
jQuery('#dismiss').click();
ul.append($('<li/>').append(`<a>${inviteString} <i class='fa fa-user-plus'><i/></a>`).on('click', function(event){
$('#dismiss').click();
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let isInvite = true;
......@@ -283,92 +307,96 @@ socket.on('updateUserList', function(users, onlineUsers){
}));
// ユーザーリストを入れる
users.forEach(function (user){
let li = jQuery('<li/>');
let a = jQuery('<a/>').text(user);
users.forEach(function(user) {
let li = $('<li/>');
let a = $('<a/>').text(user);
if (onlineUsers.includes(user)) {
// 接続されているユーザにバッジを付ける。
a.append(jQuery('<span/>',{class:'badge badge-success'}).text('online'));
a.append($('<span/>',{class:'badge badge-success'}).text('online'));
}
li.append(a);
ul.append(li);
});
jQuery('#users').html(ul);
});
$('#users').html(ul);
});
// Update Group List(Invite)
socket.on('refreshGroupList', function(groups, isInvite){
jQuery('#group_list').html('');
const template = jQuery('#group-template').html();
// Update Group List(Invite)
socket.on('refreshGroupList', function(groups, isInvite){
$('#group_list').html('');
const template = $('#group-template').html();
if (groups.length === 0) {
jQuery('#group_list').append('<center class="text-secondary">'+ getLocalizedString(everyoneIsHere) +'</center>');
$('#group_list').append('<center class="text-secondary">'+ getLocalizedString(everyoneIsHere) +'</center>');
}
// グループ名と人数を表記する。
groups.forEach( function(group) {
groups.forEach(function(group) {
let html = Mustache.render(template, {
name: group.groupName,
info: group.memberCnt + getLocalizedString("people")
});
// グループをクリックすると、該当グループのユーザーリストを読み込むようにイベントを与える
let obj = jQuery(jQuery.parseHTML(html)).on('click',function(){
let obj = $(jQuery.parseHTML(html)).on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('getUserListInGroup', group.groupId, isInvite);
jQuery('#groupName').text(group.groupName);
$('#groupName').text(group.groupName);
});
jQuery('#group_list').append(obj);
$('#group_list').append(obj);
});
// Rotate
if(CHAT_UI.isLandscapeMode()) {
jQuery(".group_list").addClass("col-6").removeClass("col-12");
if (CHAT_UI.isLandscapeMode()) {
$(".group_list").addClass("col-6").removeClass("col-12");
}
// Set Title
let memberSelectTitle = getLocalizedString("inviteUsersTitle")
let memberSelectTitle = getLocalizedString("groupSearch")
jQuery('#pills-group-tab').tab('show');
$('#pills-group-tab').tab('show');
jQuery('#backButton').show();
$('#backButton').show();
if (isInvite) {
jQuery('.titleRoomName').text(memberSelectTitle);
jQuery('#newRoomName, .roomListIcon, .chatRoomIcon').hide();
jQuery('#userSelectionConfirmBtn').show();
jQuery("#userSelectionConfirmBtn").off().on('click', function(){
$('.titleRoomName').text(memberSelectTitle);
$('#newRoomName, .roomListIcon, .chatRoomIcon').hide();
$('#userSelectionConfirmBtn').show();
$("#userSelectionConfirmBtn").off().on('click', function(){
CHAT_UI.setConfirmButtonEvent(isInvite);
});
} else {
jQuery('.titleRoomName').text(memberSelectTitle);
jQuery('.roomListIcon, .chatRoomIcon, #newRoomName').hide();
jQuery('#userSelectionConfirmBtn').show();
jQuery("#userSelectionConfirmBtn").off().on('click', function(){
$('.titleRoomName').text(memberSelectTitle);
$('.roomListIcon, .chatRoomIcon, #newRoomName').hide();
$('#userSelectionConfirmBtn').show();
$("#userSelectionConfirmBtn").off().on('click', function(){
CHAT_UI.setConfirmButtonEvent(isInvite);
});
}
if (CHAT.globalSelectedUserList.length > 0) {
jQuery('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
$('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
} else {
jQuery('#userSelectionLength').text('');
$('#userSelectionLength').text('');
}
jQuery('#backButton').off().on('click', function() {
$('#backButton').off().on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
if (isInvite) {
jQuery('#pills-chat-tab').tab('show');
$('#pills-chat-tab').tab('show');
} else {
socket.emit('getRoomList');
}
});
});
});
// Update User List(Invite)
// #36170
socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
jQuery('#user_list').html('');
const template = jQuery('#user-template').html();
// 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を表示
......@@ -383,8 +411,8 @@ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let obj = jQuery(jQuery.parseHTML(html)).on('click',function(){
if (jQuery(this).find('.userCheckBox.active').length > 0) {
let obj = $(jQuery.parseHTML(html)).on('click',function(){
if ($(this).find('.userCheckBox.active').length > 0) {
// remove
CHAT.globalSelectedUserList = CHAT.globalSelectedUserList.filter(function(element) {
return user.loginId != element.loginId;
......@@ -393,12 +421,12 @@ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
// add
CHAT.globalSelectedUserList.push({loginId:user.loginId, shopMemberId : user.shopMemberId, profileImagePath: user.profileImagePath});
}
jQuery(this).find('.userCheckBox').toggleClass('active');
$(this).find('.userCheckBox').toggleClass('active');
if (CHAT.globalSelectedUserList.length > 0) {
jQuery('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
$('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
} else {
jQuery('#userSelectionLength').text('');
$('#userSelectionLength').text('');
}
});
......@@ -407,47 +435,47 @@ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
})
if (findObj) {
jQuery(obj).find('.userCheckBox').toggleClass('active');
$(obj).find('.userCheckBox').toggleClass('active');
}
jQuery('#user_list').append(obj);
$('#user_list').append(obj);
})
jQuery('.userCheckBox').show();
$('.userCheckBox').show();
// Rotate
if(CHAT_UI.isLandscapeMode()) {
jQuery(".user_list").addClass("col-6").removeClass("col-12");
if (CHAT_UI.isLandscapeMode()) {
$(".user_list").addClass("col-6").removeClass("col-12");
$(".squareBoxContent span").addClass("landscape_span");
}
jQuery('#backButton').off().on('click', function() {
$('#backButton').off().on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('getGroupList', isInvite)
});
jQuery("#userSelectionConfirmBtn").off().on('click', function(){
$("#userSelectionConfirmBtn").off().on('click', function(){
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT_UI.setConfirmButtonEvent(isInvite);
});
jQuery('#backButton').show();
jQuery('.roomListIcon, .chatRoomIcon').hide();
jQuery('#userSelectionConfirmBtn').show();
jQuery('.userCheckBox').show();
jQuery('#pills-user-tab').tab('show');
});
$('#backButton').show();
$('.roomListIcon, .chatRoomIcon').hide();
$('#userSelectionConfirmBtn').show();
$('.userCheckBox').show();
$('#pills-user-tab').tab('show');
});
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
socket.on('showServerError', function (message){
socket.on('showServerError', function (message){
// #36174
// #36215
if(message.includes("SC_FORBIDDEN"))
if (message.includes("SC_FORBIDDEN"))
{
alert('SC_FORBIDDEN');
return;
......@@ -469,26 +497,26 @@ socket.on('showServerError', function (message){
});
CHAT_UI.dismissLoadingIndicator();
if(message == "Room not found"){
if (message == "Room not found"){
CHAT.saveRoomInfo();
}
});
});
// server's request : user info (retry join)
socket.on("retryJoinProcess", () => {
// 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 ((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 (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) {
socket.emit('join', params, function(err) {
if (err) {
// #36174
$("#customAlertTitle").text(err);
......@@ -501,8 +529,8 @@ socket.on("retryJoinProcess", () => {
.on('click', '#customAlertOk', function(e) {
});
} else {
if(params.roomName != undefined) {
jQuery('.titleRoomName').text(params.roomName).data('roomName', params.roomName);
if (params.roomName != undefined) {
$('.titleRoomName').text(params.roomName).data('roomName', params.roomName);
} else {
let roomListTitle = getLocalizedString("roomListTitle")
$('.titleRoomName').text(roomListTitle)
......@@ -512,4 +540,5 @@ socket.on("retryJoinProcess", () => {
CHAT_UI.dismissLoadingIndicator();
});
}
})
\ No newline at end of file
})
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ CHAT.saveRoomInfo = function(roomId, roomName) {
// #36170 画像パスが存在しない場合はデフォルトの画像を返す
// 存在する場合はプロフィール画像取得用APIのURLを生成して返す
CHAT.getProfileImgUrl = function(path) {
if(path == undefined || path == "") {
if (path == undefined || path == "") {
return ASSET_PATH + 'images/user-profile.png';
} else {
var userInfo = path.split("/").reverse();
......@@ -59,16 +59,16 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
fetch(canvas.toDataURL("image/jpeg"))
.then(function(res){
.then(function(res) {
return res.arrayBuffer();
})
.then(function(buf){
.then(function(buf) {
// 回転された画像をFormDataに保存
const newFile = new File([buf], sourceImage.name, {type:"image/jpeg"});
callback(newFile, true);
// ajax End
}).catch((error) => { // fetch Error catch Block
if(error) {
if (error) {
console.log(error)
}
});
......@@ -95,7 +95,7 @@ CHAT.uploadImage = function(formData) {
data: formData,
contentType: false,
processData: false
}).done(function( res ){
}).done(function(res) {
// 8
var imgPath = CMS_SERVER_URL + '/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
var imageName = res.fileName
......@@ -105,16 +105,16 @@ CHAT.uploadImage = function(formData) {
// 画像の処理
if (res.fileType == "jpeg" || res.fileType == "jpg" || res.fileType == "png") {
if(res.thumbnailPath && res.thumbnailPath.length > 0) {
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath = CMS_SERVER_URL + '/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
imageName = res.thumbImageFileName;
}
let downloadPath = CMS_SERVER_URL + '/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const lightbox = jQuery('<a/>',{href:imgPath, 'data-lightbox':'attachedImages','data-title':imageName});
const image = jQuery('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = jQuery('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
const lightbox = $('<a/>',{href:imgPath, 'data-lightbox':'attachedImages','data-title':imageName});
const image = $('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
lightbox.append(image);
lightbox.append(downloadIcon);
......@@ -136,9 +136,9 @@ CHAT.uploadImage = function(formData) {
}
let downloadPath = CMS_SERVER_URL + '/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
const aTag = jQuery('<a/>', {id:"attachedImages"})
const image = jQuery('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = jQuery('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
const aTag = $('<a/>', {id:"attachedImages"})
const image = $('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
aTag.append(image);
aTag.append(downloadIcon);
......@@ -156,8 +156,8 @@ CHAT.uploadImage = function(formData) {
}, 1);
}
jQuery('.overlay').removeClass('active undismissable');
jQuery('.loader').removeClass('active');
$('.overlay').removeClass('active undismissable');
$('.loader').removeClass('active');
CHAT_UI.dismissLoadingIndicator();
})
}
......@@ -166,7 +166,7 @@ CHAT.uploadImage = function(formData) {
CHAT.createThumbnailAndUpload = function(sourceImage, callback) {
const fileReader = new FileReader();
const img = new Image();
fileReader.onloadend = function(){
fileReader.onloadend = function() {
img.src = fileReader.result
}
......@@ -175,13 +175,13 @@ CHAT.createThumbnailAndUpload = function(sourceImage, callback) {
var rate
var width = img.width
var height = img.height
if((img.width <= 500) && (img.height <= 500))
if ((img.width <= 500) && (img.height <= 500))
{
callback(undefined, false)
return
}
if(img.width > img.height)
if (img.width > img.height)
{
rate = 500/img.width
} else {
......@@ -196,16 +196,16 @@ CHAT.createThumbnailAndUpload = function(sourceImage, callback) {
// ctx.drawImage(img, 0, 0, width, height);
fetch(elem.toDataURL("image/jpeg"))
.then(function(res){
.then(function(res) {
return res.arrayBuffer();
})
.then(function(buf){
.then(function(buf) {
const newFile = new File([buf], sourceImage.name, {type:"image/jpeg"});
callback(newFile, true)
}).catch((error) => { // fetch Error catch Block
if(error) {
if (error) {
console.log(error)
}
});
......@@ -225,12 +225,13 @@ getLoginParameter = function(sid, loginId, shopName, roomId = undefined, roomNam
CHAT.globalLoginParameter = loginParam;
if(!languageCode) {
if (!languageCode) {
languageCode = "en"
}
CHAT_UI.htmlElementTextInitialize(languageCode)
socket.emit('join', loginParam, function (err) {
if (IS_ONLINE == 'true') {
socket.emit('join', loginParam, function(err) {
if (err) {
// #36174
$("#customAlertTitle").text(err);
......@@ -246,16 +247,21 @@ getLoginParameter = function(sid, loginId, shopName, roomId = undefined, roomNam
} else {
console.log('No error');
if (loginParam.roomName != undefined && loginParam.roomName != "null") {
jQuery('.titleRoomName').text(loginParam.roomName).data('roomName', loginParam.roomName);
$('.titleRoomName').text(loginParam.roomName).data('roomName', loginParam.roomName);
} else {
// 設定されていたroomNameがない場合
let roomListTitle = getLocalizedString("roomListTitle")
jQuery('.titleRoomName').text(roomListTitle).data('roomName', roomListTitle);
$('.titleRoomName').text(roomListTitle).data('roomName', roomListTitle);
}
}
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});
} else {
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
}
}
CHAT.leaveRoom = function() {
......
/**
* Constant定義ファイル
*/
const readyState = {
UNINITIALIZED : 0 ,
LOADING : 1 ,
......@@ -9,3 +8,11 @@ const readyState = {
INTERACTIVE : 3 ,
COMPLETED : 4
}
const messageType = {
TEXT : 0 ,
IMAGE : 1 ,
VIDEO : 2 ,
SYSTEM : 3 ,
COMMUNICATION : 4
}
$.lang.en = {
"chat_placeholder":"Type message",
"chat_search_placeholder":" Search Message",
"room_search_placeholder":" Search Room",
"participants":"Member List",
"exitRoom":"Exit ",
"roomListTitle":"Room List",
"deleteRoomTitle":"Delete Room",
"inviteUsersButton":"invite",
"inviteUsersTitle":"Invite Member",
"createRoomSubtitle":"Create Room",
"createRoomTitle":"Create Room",
"createRoomSubtitle":"Room Name",
"inviteUsersSubtitle":"Invite User",
"roomListEmptyString":"There is no room available.",
"invitedUser":"Invited Users",
"left":"%@ has left",
"join":"%@ has joined",
"added":"%@ has been invited",
......@@ -22,12 +26,14 @@ $.lang.en = {
"thankLabel":"Thank you",
"startToWorkLabel":"Start to work",
"groupListKeyword":"Search",
"userSearch":"User Search",
"groupSearch":"Group Search",
"groupPageSubtitle":"Groups",
"noMessages":"No Messages",
"image":"Image",
"chatKeyword":"Search",
"userListKeyword":"Search",
"newRoomName":"Enter Roomname",
"newRoomName":"Please input Room Name",
"everyoneIsHere":"Everyone is in the chat.",
"people":"people",
"searchResult":"Results",
......
$.lang.ja = {
"chat_placeholder":"メッセージを入力",
"chat_search_placeholder":" メッセージ検索",
"room_search_placeholder":" ルーム検索",
"participants":"メンバーリスト",
"exitRoom":"退出 ",
"roomListTitle":"ルーム一覧",
"deleteRoomTitle":"ルーム削除",
"inviteUsersButton":"招待",
"inviteUsersTitle":"メンバー追加",
"createRoomSubtitle":"ルーム生成",
"createRoomTitle":"ルーム開設",
"createRoomSubtitle":"ルーム名",
"inviteUsersSubtitle":"ユーザ招待",
"roomListEmptyString":"入場できるルームがありません。",
"left":"%@ 様が退場しました。",
......@@ -21,13 +24,16 @@ $.lang.ja = {
"completeLabel":"完了しました。",
"thankLabel":"ありがとうございます。",
"startToWorkLabel":"作業開始します。",
"userSearch":"ユーザー検索",
"groupSearch":"グループ検索",
"groupListKeyword":"検索",
"groupPageSubtitle":"グループ",
"noMessages":"メッセージがありません。",
"image":"画像",
"chatKeyword":"検索",
"userListKeyword":"検索",
"newRoomName":"ルーム名を入力",
"invitedUser":"参加者",
"newRoomName":"ルーム名を入力してください",
"everyoneIsHere":"招待可能なメンバーがいません。",
"people":"人",
"searchResult":"件のトーク",
......
$.lang.ko = {
"chat_placeholder":"메시지를 입력하세요.",
"chat_search_placeholder":" 메세지검색",
"room_search_placeholder":" 채팅방 검색",
"participants":"멤버 리스트",
"exitRoom":"나가기 ",
"roomListTitle":"채팅 리스트",
"deleteRoomTitle":"채팅방 삭제",
"inviteUsersButton":"유저 초대",
"inviteUsersTitle":"대화상대 추가",
"createRoomSubtitle":"방 생성",
"createRoomTitle":"방 개설",
"createRoomSubtitle":"방 이름",
"inviteUsersSubtitle":"유저 초대",
"roomListEmptyString":"입장 가능한 방이 없습니다.",
"invitedUser":"참가자",
"left":"%@ 님이 방을 떠났습니다.",
"join":"%@ 님이 참가했습니다.",
"added":"%@ 님을 초대했습니다.",
......@@ -22,12 +26,14 @@ $.lang.ko = {
"thankLabel":"감사합니다.",
"startToWorkLabel":"작업을 시작합니다.",
"groupListKeyword":"검색",
"userSearch":"유저 검색",
"groupSearch":"그룹 검색",
"groupPageSubtitle":"그룹",
"noMessages":"메시지가 없습니다.",
"image":"이미지",
"chatKeyword":"검색",
"userListKeyword":"검색",
"newRoomName":"방제목 입력",
"newRoomName":"방 이름을 입력해주세요.",
"everyoneIsHere":"초대가능한 유저가 없습니다.",
"people":"명",
"searchResult":"건의 결과",
......
<!doctype html>
<html lang="en" style="background: #DBDBDB;">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
<title>Prototype</title>
<link href="./fontawesome/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/lightbox.min.css">
<link rel="stylesheet" href="./css/chat.css">
<script>
const PLATFORM = 'android';
const IS_MOBILE = true;
</script>
</script>
</head>
<body>
<nav class="navbar navbar-expand navbar-dark bg-primary fixed-top flex-md-nowrap p-2 shadow">
<ul class="navbar-nav col-3" id="navbarLeft">
<button class="btn btn-primary" type="button" id="homeButton">
<i class="fa fa-home" style="font-size: 1.6rem;"></i>
</button>
</ul>
<a class="navbar-brand col-6 mr-0 text-truncate titleRoomName text-center" href="#">Error</a>
</nav>
<div class="error-aria">
<img id="errorImg" src="./icon/error_top_icon.svg">
<div id="errorTitle">
<a>ネットワークエラー</a>
</div>
<div id="errorMsg">
ネットワークに接続できませんでした。電波が良いところでもう一度接続してください。
</div>
<button class="bg-primary reload-button" id="reloadButton">更新</button>
<img id="errorEnd" src="./icon/error_footer_img.svg">
</div>
</div>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/popper.min.js"></script>
<script src="./js/libs/moment.js"></script>
<script src="./js/libs/locale/ko.js" charset="UTF-8"></script>
<script src="./js/libs/locale/ja.js" charset="UTF-8"></script>
<script src="./js/libs/mustache.min.js"></script>
<script src="./js/libs/deparam.js"></script>
<script src="./js/libs/bootstrap.min.js"></script>
<script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/libs/lightbox.js"></script>
<script src="./js/language.js"></script>
<script src="./js/language_ko.js" charset="UTF-8"></script>
<script src="./js/language_ja.js" charset="UTF-8"></script>
<script src="./js/language_en.js" charset="UTF-8"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-error.js"></script>
</body>
</html>
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2014 Guillermo Rauch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
# socket.io-client
[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client)
[![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client)
[![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies)
[![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client)
![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat)
[![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket)
## How to use
A standalone build of `socket.io-client` is exposed automatically by the
socket.io server as `/socket.io/socket.io.js`. Alternatively you can
serve the file `socket.io.js` found in the `dist` folder.
```html
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io('http://localhost');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
</script>
```
```js
// with ES6 import
import io from 'socket.io-client';
const socket = io('http://localhost');
```
A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`.
Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)).
### Node.JS (server-side usage)
Add `socket.io-client` to your `package.json` and then:
```js
var socket = require('socket.io-client')('http://localhost');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
```
## API
See [API](/docs/API.md)
## License
[MIT](/LICENSE)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*!
* Socket.IO v2.1.1
* (c) 2014-2018 Guillermo Rauch
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t,e){"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{};var n,r=i(t),s=r.source,p=r.id,h=r.path,f=u[p]&&h in u[p].nsps,l=e.forceNew||e["force new connection"]||!1===e.multiplex||f;return l?(c("ignoring socket cache for %s",s),n=a(s,e)):(u[p]||(c("new io instance for %s",s),u[p]=a(s,e)),n=u[p]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(1),s=n(7),a=n(12),c=n(3)("socket.io-client");t.exports=e=r;var u=e.managers={};e.protocol=s.protocol,e.connect=r,e.Manager=n(12),e.Socket=n(37)},function(t,e,n){(function(e){"use strict";function r(t,n){var r=t;n=n||e.location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(i("protocol-less url %s",t),t="undefined"!=typeof n?n.protocol+"//"+t:"https://"+t),i("parse %s",t),r=o(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var s=r.host.indexOf(":")!==-1,a=s?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}var o=n(2),i=n(3)("socket.io-client:url");t.exports=r}).call(e,function(){return this}())},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=n.exec(t||""),a={},c=14;c--;)a[r[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,n){(function(r){function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(n){}}function c(){var t;try{t=e.storage.debug}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return window.localStorage}catch(t){}}e=t.exports=n(5),e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},e.enable(c())}).call(e,n(4))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(p===setTimeout)return setTimeout(t,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){y&&l&&(y=!1,l.length?d=l.concat(d):m=-1,d.length&&a())}function a(){if(!y){var t=o(s);y=!0;for(var e=d.length;e;){for(l=d,d=[];++m<e;)l&&l[m].run();m=-1,e=d.length}l=null,y=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}var p,h,f=t.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:n}catch(t){p=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(t){h=r}}();var l,d=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new c(t,e)),1!==d.length||y||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){function r(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,r=+new Date,i=r-(o||r);t.diff=i,t.prev=o,t.curr=r,o=r;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;c++;var o=e.formatters[r];if("function"==typeof o){var i=s[c];n=o.call(t,i),s.splice(c,1),c--}return n}),e.formatArgs.call(t,s);var u=n.log||e.log||console.log.bind(console);u.apply(t,s)}}var o;return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=r(t),n.destroy=i,"function"==typeof e.init&&e.init(n),e.instances.push(n),n}function i(){var t=e.instances.indexOf(this);return t!==-1&&(e.instances.splice(t,1),!0)}function s(t){e.save(t),e.names=[],e.skips=[];var n,r=("string"==typeof t?t:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&(t=r[n].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(n=0;n<e.instances.length;n++){var i=e.instances[n];i.enabled=e.enabled(i.namespace)}}function a(){e.enable("")}function c(t){if("*"===t[t.length-1])return!0;var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1}function u(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o["default"]=o,e.coerce=u,e.disable=a,e.enable=s,e.enabled=c,e.humanize=n(6),e.instances=[],e.names=[],e.skips=[],e.formatters={}},function(t,e){function n(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){return t>=u?Math.round(t/u)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=s?Math.round(t/s)+"s":t+"ms"}function o(t){return i(t,u,"day")||i(t,c,"hour")||i(t,a,"minute")||i(t,s,"second")||t+" ms"}function i(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var s=1e3,a=60*s,c=60*a,u=24*c,p=365.25*u;t.exports=function(t,e){e=e||{};var i=typeof t;if("string"===i&&t.length>0)return n(t);if("number"===i&&isNaN(t)===!1)return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(){}function o(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var r=i(t.data);if(r===!1)return g;n+=r}return f("encoded %j as %s",t,n),n}function i(t){try{return JSON.stringify(t)}catch(e){return!1}}function s(t,e){function n(t){var n=d.deconstructPacket(t),r=o(n.packet),i=n.buffers;i.unshift(r),e(i)}d.removeBlobs(t,n)}function a(){this.reconstructor=null}function c(t){var n=0,r={type:Number(t.charAt(0))};if(null==e.types[r.type])return h("unknown packet type "+r.type);if(e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type){for(var o="";"-"!==t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!==t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"===t.charAt(n+1))for(r.nsp="";++n;){var i=t.charAt(n);if(","===i)break;if(r.nsp+=i,n===t.length)break}else r.nsp="/";var s=t.charAt(n+1);if(""!==s&&Number(s)==s){for(r.id="";++n;){var i=t.charAt(n);if(null==i||Number(i)!=i){--n;break}if(r.id+=t.charAt(n),n===t.length)break}r.id=Number(r.id)}if(t.charAt(++n)){var a=u(t.substr(n)),c=a!==!1&&(r.type===e.ERROR||y(a));if(!c)return h("invalid payload");r.data=a}return f("decoded %s as %j",t,r),r}function u(t){try{return JSON.parse(t)}catch(e){return!1}}function p(t){this.reconPack=t,this.buffers=[]}function h(t){return{type:e.ERROR,data:"parser error: "+t}}var f=n(3)("socket.io-parser"),l=n(8),d=n(9),y=n(10),m=n(11);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=r,e.Decoder=a;var g=e.ERROR+'"encode error"';r.prototype.encode=function(t,n){if(f("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,n);else{var r=o(t);n([r])}},l(a.prototype),a.prototype.add=function(t){var n;if("string"==typeof t)n=c(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!m(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,this.emit("decoded",n))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=d.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){(function(t){function r(t,e){if(!t)return t;if(s(t)){var n={_placeholder:!0,num:e.length};return e.push(t),n}if(i(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=r(t[a],e);return o}if("object"==typeof t&&!(t instanceof Date)){var o={};for(var c in t)o[c]=r(t[c],e);return o}return t}function o(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(i(t))for(var n=0;n<t.length;n++)t[n]=o(t[n],e);else if("object"==typeof t)for(var r in t)t[r]=o(t[r],e);return t}var i=n(10),s=n(11),a=Object.prototype.toString,c="function"==typeof t.Blob||"[object BlobConstructor]"===a.call(t.Blob),u="function"==typeof t.File||"[object FileConstructor]"===a.call(t.File);e.deconstructPacket=function(t){var e=[],n=t.data,o=t;return o.data=r(n,e),o.attachments=e.length,{packet:o,buffers:e}},e.reconstructPacket=function(t,e){return t.data=o(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){function n(t,a,p){if(!t)return t;if(c&&t instanceof Blob||u&&t instanceof File){r++;var h=new FileReader;h.onload=function(){p?p[a]=this.result:o=this.result,--r||e(o)},h.readAsArrayBuffer(t)}else if(i(t))for(var f=0;f<t.length;f++)n(t[f],f,t);else if("object"==typeof t&&!s(t))for(var l in t)n(t[l],l,t)}var r=0,o=t;n(o),r||e(o)}}).call(e,function(){return this}())},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){(function(e){function n(t){return r&&e.Buffer.isBuffer(t)||o&&(t instanceof e.ArrayBuffer||i(t))}t.exports=n;var r="function"==typeof e.Buffer&&"function"==typeof e.Buffer.isBuffer,o="function"==typeof e.ArrayBuffer,i=function(){return o&&"function"==typeof e.ArrayBuffer.isView?e.ArrayBuffer.isView:function(t){return t.buffer instanceof e.ArrayBuffer}}()}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);t&&"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new l({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||c;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(13),s=n(37),a=n(8),c=n(7),u=n(39),p=n(40),h=n(3)("socket.io-client:manager"),f=n(36),l=n(41),d=Object.prototype.hasOwnProperty;t.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)d.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},r.prototype.updateSocketIds=function(){for(var t in this.nsps)d.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},r.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},a(r.prototype),r.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},r.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},r.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},r.prototype.open=r.prototype.connect=function(t,e){if(h("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;h("opening %s",this.uri),this.engine=i(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=u(n,"open",function(){r.onopen(),t&&t()}),s=u(n,"error",function(e){if(h("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else r.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout;h("connect attempt will timeout after %d",a);var c=setTimeout(function(){h("connect attempt timed out after %d",a),o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},r.prototype.onopen=function(){h("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(u(t,"data",p(this,"ondata"))),this.subs.push(u(t,"ping",p(this,"onping"))),this.subs.push(u(t,"pong",p(this,"onpong"))),this.subs.push(u(t,"error",p(this,"onerror"))),this.subs.push(u(t,"close",p(this,"onclose"))),this.subs.push(u(this.decoder,"decoded",p(this,"ondecoded")))},r.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},r.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},r.prototype.ondata=function(t){this.decoder.add(t)},r.prototype.ondecoded=function(t){this.emit("packet",t)},r.prototype.onerror=function(t){h("error",t),this.emitAll("error",t)},r.prototype.socket=function(t,e){function n(){~f(o.connecting,r)||o.connecting.push(r)}var r=this.nsps[t];if(!r){r=new s(this,t,e),this.nsps[t]=r;var o=this;r.on("connecting",n),r.on("connect",function(){r.id=o.generateId(t)}),this.autoConnect&&n()}return r},r.prototype.destroy=function(t){var e=f(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},r.prototype.packet=function(t){h("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},r.prototype.cleanup=function(){h("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var n=this.subs.shift();n.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){h("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(t){h("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)h("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();h("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(h("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(h("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(h("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},r.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){t.exports=n(14),t.exports.parser=n(21)},function(t,e,n){(function(e){function r(t,n){if(!(this instanceof r))return new r(t,n);n=n||{},t&&"object"==typeof t&&(n=t,t=null),t?(t=p(t),n.hostname=t.host,n.secure="https"===t.protocol||"wss"===t.protocol,n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=p(n.host).host),this.secure=null!=n.secure?n.secure:e.location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.agent=n.agent||!1,this.hostname=n.hostname||(e.location?location.hostname:"localhost"),this.port=n.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=n.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==n.upgrade,this.path=(n.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!n.forceJSONP,this.jsonp=!1!==n.jsonp,this.forceBase64=!!n.forceBase64,this.enablesXDR=!!n.enablesXDR,this.timestampParam=n.timestampParam||"t",this.timestampRequests=n.timestampRequests,this.transports=n.transports||["polling","websocket"],this.transportOptions=n.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=n.policyPort||843,this.rememberUpgrade=n.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=n.onlyBinaryUpgrades,this.perMessageDeflate=!1!==n.perMessageDeflate&&(n.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=n.pfx||null,this.key=n.key||null,this.passphrase=n.passphrase||null,this.cert=n.cert||null,this.ca=n.ca||null,this.ciphers=n.ciphers||null,this.rejectUnauthorized=void 0===n.rejectUnauthorized||n.rejectUnauthorized,this.forceNode=!!n.forceNode;var o="object"==typeof e&&e;o.global===o&&(n.extraHeaders&&Object.keys(n.extraHeaders).length>0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var i=n(15),s=n(8),a=n(3)("engine.io-client:socket"),c=n(36),u=n(21),p=n(2),h=n(30);t.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=u.protocol,r.Socket=r,r.Transport=n(20),r.transports=n(15),r.parser=n(21),r.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);e.EIO=u.protocol,e.transport=t;var n=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var r=new i[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0});return r},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},r.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;h=h||e}h||(a('probe transport "%s" opened',t),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(e){if(!h)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",p),!p)return;r.priorWebsocketSuccess="websocket"===p.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){h||"closed"!==f.readyState&&(a("changing transport and sending upgrade packet"),u(),f.setTransport(p),p.send([{type:"upgrade"}]),f.emit("upgrade",p),p=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=p.name,f.emit("upgradeError",n)}}))}function n(){h||(h=!0,u(),p.close(),p=null)}function o(e){var r=new Error("probe error: "+e);r.transport=p.name,n(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",r)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){p&&t.name!==p.name&&(a('"%s" works - aborting "%s"',t.name,p.name),n())}function u(){p.removeListener("open",e),p.removeListener("error",o),p.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var p=this.createTransport(t,{probe:1}),h=!1,f=this;r.priorWebsocketSuccess=!1,p.once("open",e),p.once("error",o),p.once("close",i),this.once("close",s),this.once("upgrading",c),p.open()},r.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",r.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},r.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},r.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},r.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},r.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},r.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},r.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},r.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(a("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},r.prototype.write=r.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},r.prototype.sendPacket=function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){n=n||{},n.compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},r.prototype.close=function(){function t(){r.onClose("forced close"),a("socket closing - telling transport to close"),r.transport.close()}function e(){r.removeListener("upgrade",e),r.removeListener("upgradeError",e),t()}function n(){r.once("upgrade",e),r.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var r=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}return this},r.prototype.onError=function(t){a("socket error %j",t),r.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},r.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){a('socket close with reason: "%s"',t);var n=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),n.writeBuffer=[],n.prevBufferLen=0}},r.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~c(this.transports,t[n])&&e.push(t[n]);return e}}).call(e,function(){return this}())},function(t,e,n){(function(t){function r(e){var n,r=!1,a=!1,c=!1!==e.jsonp;if(t.location){var u="https:"===location.protocol,p=location.port;
p||(p=u?443:80),r=e.hostname!==location.hostname||p!==e.port,a=e.secure!==u}if(e.xdomain=r,e.xscheme=a,n=new o(e),"open"in n&&!e.forceJSONP)return new i(e);if(!c)throw new Error("JSONP disabled");return new s(e)}var o=n(16),i=n(18),s=n(33),a=n(34);e.polling=r,e.websocket=a}).call(e,function(){return this}())},function(t,e,n){(function(e){var r=n(17);t.exports=function(t){var n=t.xdomain,o=t.xscheme,i=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||r))return new XMLHttpRequest}catch(s){}try{if("undefined"!=typeof XDomainRequest&&!o&&i)return new XDomainRequest}catch(s){}if(!n)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(s){}}}).call(e,function(){return this}())},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){t.exports=!1}},function(t,e,n){(function(e){function r(){}function o(t){if(c.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,e.location){var n="https:"===location.protocol,r=location.port;r||(r=n?443:80),this.xd=t.hostname!==e.location.hostname||r!==t.port,this.xs=t.secure!==n}}function i(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function s(){for(var t in i.requests)i.requests.hasOwnProperty(t)&&i.requests[t].abort()}var a=n(16),c=n(19),u=n(8),p=n(31),h=n(3)("engine.io-client:polling-xhr");t.exports=o,t.exports.Request=i,p(o,c),o.prototype.supportsBinary=!0,o.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new i(t)},o.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:n}),o=this;r.on("success",e),r.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=r},o.prototype.doPoll=function(){h("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},u(i.prototype),i.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var n=this.xhr=new a(t),r=this;try{h("xhr open %s: %s",this.method,this.uri),n.open(this.method,this.uri,this.async);try{if(this.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(var o in this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&n.setRequestHeader(o,this.extraHeaders[o])}}catch(s){}if("POST"===this.method)try{this.isBinary?n.setRequestHeader("Content-type","application/octet-stream"):n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{n.setRequestHeader("Accept","*/*")}catch(s){}"withCredentials"in n&&(n.withCredentials=!0),this.requestTimeout&&(n.timeout=this.requestTimeout),this.hasXDR()?(n.onload=function(){r.onLoad()},n.onerror=function(){r.onError(n.responseText)}):n.onreadystatechange=function(){if(2===n.readyState)try{var t=n.getResponseHeader("Content-Type");r.supportsBinary&&"application/octet-stream"===t&&(n.responseType="arraybuffer")}catch(e){}4===n.readyState&&(200===n.status||1223===n.status?r.onLoad():setTimeout(function(){r.onError(n.status)},0))},h("xhr data %s",this.data),n.send(this.data)}catch(s){return void setTimeout(function(){r.onError(s)},0)}e.document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},i.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},i.prototype.cleanup=function(t){if("undefined"!=typeof this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=r:this.xhr.onreadystatechange=r,t)try{this.xhr.abort()}catch(n){}e.document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(n){}t="application/octet-stream"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(n){this.onError(n)}null!=t&&this.onData(t)},i.prototype.hasXDR=function(){return"undefined"!=typeof e.XDomainRequest&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},i.requestsCount=0,i.requests={},e.document&&(e.attachEvent?e.attachEvent("onunload",s):e.addEventListener&&e.addEventListener("beforeunload",s,!1))}).call(e,function(){return this}())},function(t,e,n){function r(t){var e=t&&t.forceBase64;p&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=n(20),i=n(30),s=n(21),a=n(31),c=n(32),u=n(3)("engine.io-client:polling");t.exports=r;var p=function(){var t=n(16),e=new t({xdomain:!1});return null!=e.responseType}();a(r,o),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(t){function e(){u("paused"),n.readyState="paused",t()}var n=this;if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(u("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){u("pre-pause polling complete"),--r||e()})),this.writable||(u("we are currently writing - waiting to pause"),r++,this.once("drain",function(){u("pre-pause writing complete"),--r||e()}))}else e()},r.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(t){var e=this;u("polling got data %s",t);var n=function(t,n,r){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)};s.decodePayload(t,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function t(){u("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},r.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){function r(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var o=n(21),i=n(8);t.exports=r,i(r.prototype),r.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},r.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},r.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},r.prototype.onPacket=function(t){this.emit("packet",t)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,n){(function(t){function r(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}function o(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=v[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return r(s.buffer)}function i(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){t.data=o.result,e.encodePacket(t,n,!0,r)},o.readAsArrayBuffer(t.data)}function s(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(g)return i(t,n,r);var o=new Uint8Array(1);o[0]=v[t.type];var s=new k([o.buffer,t.data]);return r(s)}function a(t){try{t=d.decode(t,{strict:!1})}catch(e){return!1}return t}function c(t,e,n){for(var r=new Array(t.length),o=l(t.length,n),i=function(t,n,o){e(n,function(e,n){r[t]=n,o(e,r)})},s=0;s<t.length;s++)i(s,t[s],o)}var u,p=n(22),h=n(23),f=n(24),l=n(25),d=n(26);t&&t.ArrayBuffer&&(u=n(28));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),m="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),g=y||m;e.protocol=3;var v=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=p(v),w={type:"error",data:"parser error"},k=n(29);e.encodePacket=function(e,n,i,a){"function"==typeof n&&(a=n,n=!1),"function"==typeof i&&(a=i,i=null);var c=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&c instanceof ArrayBuffer)return o(e,n,a);if(k&&c instanceof t.Blob)return s(e,n,a);if(c&&c.base64)return r(e,a);var u=v[e.type];return void 0!==e.data&&(u+=i?d.encode(String(e.data),{strict:!1}):String(e.data)),a(""+u)},e.encodeBase64Packet=function(n,r){var o="b"+e.packets[n.type];if(k&&n.data instanceof t.Blob){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];r(o+t)},i.readAsDataURL(n.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(n.data))}catch(a){for(var c=new Uint8Array(n.data),u=new Array(c.length),p=0;p<c.length;p++)u[p]=c[p];s=String.fromCharCode.apply(null,u)}return o+=t.btoa(s),r(o)},e.decodePacket=function(t,n,r){if(void 0===t)return w;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&(t=a(t),t===!1))return w;var o=t.charAt(0);return Number(o)==o&&b[o]?t.length>1?{type:b[o],data:t.substring(1)}:{type:b[o]}:w}var i=new Uint8Array(t),o=i[0],s=f(t,1);return k&&"blob"===n&&(s=new k([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var n=b[t.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:t.substr(1)}};var r=u.decode(t.substr(1));return"blob"===e&&k&&(r=new k([r])),{type:n,data:r}},e.encodePayload=function(t,n,r){function o(t){return t.length+":"+t}function i(t,r){e.encodePacket(t,!!s&&n,!1,function(t){r(null,o(t))})}"function"==typeof n&&(r=n,n=null);var s=h(t);return n&&s?k&&!g?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r):t.length?void c(t,i,function(t,e){return r(e.join(""))}):r("0:")},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);"function"==typeof n&&(r=n,n=null);var o;if(""===t)return r(w,0,1);for(var i,s,a="",c=0,u=t.length;c<u;c++){var p=t.charAt(c);if(":"===p){if(""===a||a!=(i=Number(a)))return r(w,0,1);if(s=t.substr(c+1,i),a!=s.length)return r(w,0,1);if(s.length){if(o=e.decodePacket(s,n,!1),w.type===o.type&&w.data===o.data)return r(w,0,1);var h=r(o,c+i,u);if(!1===h)return}c+=i,a=""}else a+=p}return""!==a?r(w,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){function r(t,n){e.encodePacket(t,!0,!0,function(t){return n(null,t)})}return t.length?void c(t,r,function(t,e){var r=e.reduce(function(t,e){var n;return n="string"==typeof e?e.length:e.byteLength,t+n.toString().length+n+2},0),o=new Uint8Array(r),i=0;return e.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),s=0;s<t.length;s++)r[s]=t.charCodeAt(s);n=r.buffer}e?o[i++]=0:o[i++]=1;for(var a=n.byteLength.toString(),s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(var r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]}),n(o.buffer)}):n(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,n){function r(t,n){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,e[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,s=i.toString(),a=new Uint8Array(s.length+1),o=0;o<s.length;o++)a[o]=parseInt(s[o]);if(a[s.length]=255,k){var c=new k([e.buffer,a.buffer,t]);n(null,c)}})}c(t,r,function(t,e){return n(new k(e))})},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var o=t,i=[];o.byteLength>0;){for(var s=new Uint8Array(o),a=0===s[0],c="",u=1;255!==s[u];u++){if(c.length>310)return r(w,0,1);c+=s[u]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(h){var l=new Uint8Array(p);p="";for(var u=0;u<l.length;u++)p+=String.fromCharCode(l[u])}i.push(p),o=f(o,c)}var d=i.length;i.forEach(function(t,o){r(e.decodePacket(t,n,!0),o,d)})}}).call(e,function(){return this}())},function(t,e){t.exports=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e}},function(t,e,n){(function(e){function r(t){if(!t||"object"!=typeof t)return!1;if(o(t)){for(var n=0,i=t.length;n<i;n++)if(r(t[n]))return!0;return!1}if("function"==typeof e.Buffer&&e.Buffer.isBuffer&&e.Buffer.isBuffer(t)||"function"==typeof e.ArrayBuffer&&t instanceof ArrayBuffer||s&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return r(t.toJSON(),!0);for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&r(t[c]))return!0;return!1}var o=n(10),i=Object.prototype.toString,s="function"==typeof e.Blob||"[object BlobConstructor]"===i.call(e.Blob),a="function"==typeof e.File||"[object FileConstructor]"===i.call(e.File);t.exports=r}).call(e,function(){return this}())},function(t,e){t.exports=function(t,e,n){var r=t.byteLength;if(e=e||0,n=n||r,t.slice)return t.slice(e,n);if(e<0&&(e+=r),n<0&&(n+=r),n>r&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s<n;s++,a++)i[a]=o[s];return i.buffer}},function(t,e){function n(t,e,n){function o(t,r){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(i=!0,e(t),e=n):0!==o.count||i||e(null,r)}var i=!1;return n=n||r,o.count=t,0===t?e():o}function r(){}t.exports=n},function(t,e,n){var r;(function(t,o){!function(i){function s(t){for(var e,n,r=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function a(t){for(var e,n=t.length,r=-1,o="";++r<n;)e=t[r],e>65535&&(e-=65536,o+=w(e>>>10&1023|55296),e=56320|1023&e),o+=w(e);return o}function c(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function u(t,e){return w(t>>e&63|128)}function p(t,e){if(0==(4294967168&t))return w(t);var n="";return 0==(4294965248&t)?n=w(t>>6&31|192):0==(4294901760&t)?(c(t,e)||(t=65533),n=w(t>>12&15|224),n+=u(t,6)):0==(4292870144&t)&&(n=w(t>>18&7|240),n+=u(t,12),n+=u(t,6)),n+=w(63&t|128)}function h(t,e){e=e||{};for(var n,r=!1!==e.strict,o=s(t),i=o.length,a=-1,c="";++a<i;)n=o[a],c+=p(n,r);return c}function f(){if(b>=v)throw Error("Invalid byte index");var t=255&g[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(t){var e,n,r,o,i;if(b>v)throw Error("Invalid byte index");if(b==v)return!1;if(e=255&g[b],b++,0==(128&e))return e;if(192==(224&e)){if(n=f(),i=(31&e)<<6|n,i>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if(n=f(),r=f(),i=(15&e)<<12|n<<6|r,i>=2048)return c(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=f(),r=f(),o=f(),i=(7&e)<<18|n<<12|r<<6|o,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}function d(t,e){e=e||{};var n=!1!==e.strict;g=s(t),v=g.length,b=0;for(var r,o=[];(r=l(n))!==!1;)o.push(r);return a(o)}var y="object"==typeof e&&e,m=("object"==typeof t&&t&&t.exports==y&&t,"object"==typeof o&&o);m.global!==m&&m.window!==m||(i=m);var g,v,b,w=String.fromCharCode,k={version:"2.1.2",encode:h,decode:d};r=function(){return k}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(this)}).call(e,n(27)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;e.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,r,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e<c;e+=4)r=n[t.charCodeAt(e)],o=n[t.charCodeAt(e+1)],i=n[t.charCodeAt(e+2)],s=n[t.charCodeAt(e+3)],h[u++]=r<<2|o>>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}}()},function(t,e){(function(e){function n(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.buffer instanceof ArrayBuffer){var r=n.buffer;if(n.byteLength!==r.byteLength){var o=new Uint8Array(n.byteLength);o.set(new Uint8Array(r,n.byteOffset,n.byteLength)),r=o.buffer}t[e]=r}}}function r(t,e){e=e||{};var r=new i;n(t);for(var o=0;o<t.length;o++)r.append(t[o]);return e.type?r.getBlob(e.type):r.getBlob()}function o(t,e){return n(t),new Blob(t,e||{})}var i=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,s=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(e){return!1}}(),a=s&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(e){return!1}}(),c=i&&i.prototype.append&&i.prototype.getBlob;t.exports=function(){return s?a?e.Blob:o:c?r:void 0}()}).call(e,function(){return this}())},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e){t.exports=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e){"use strict";function n(t){var e="";do e=s[t%a]+e,t=Math.floor(t/a);while(t>0);return e}function r(t){var e=0;for(p=0;p<t.length;p++)e=e*a+c[t.charAt(p)];return e}function o(){var t=n(+new Date);return t!==i?(u=0,i=t):t+"."+n(u++)}for(var i,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},u=0,p=0;p<a;p++)c[s[p]]=p;o.encode=n,o.decode=r,t.exports=o},function(t,e,n){(function(e){function r(){}function o(t){i.call(this,t),this.query=this.query||{},a||(e.___eio||(e.___eio=[]),a=e.___eio),this.index=a.length;var n=this;a.push(function(t){n.onData(t)}),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",function(){n.script&&(n.script.onerror=r)},!1)}var i=n(19),s=n(31);t.exports=o;var a,c=/\n/g,u=/\\n/g;s(o,i),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},o.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},o.prototype.doWrite=function(t,e){function n(){r(),e()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(e)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),p=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=p,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),r(),t=t.replace(u,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&n()}:this.iframe.onload=n}}).call(e,function(){return this}())},function(t,e,n){(function(e){function r(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=h&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(l=o),i.call(this,t)}var o,i=n(20),s=n(21),a=n(30),c=n(31),u=n(32),p=n(3)("engine.io-client:websocket"),h=e.WebSocket||e.MozWebSocket;if("undefined"==typeof window)try{o=n(35)}catch(f){}var l=h;l||"undefined"!=typeof window||(l=o),t.exports=r,c(r,i),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new l(t,e):new l(t):new l(t,e,n)}catch(r){return this.emit("error",r)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},r.prototype.write=function(t){function n(){r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0)}var r=this;this.writable=!1;for(var o=t.length,i=0,a=o;i<a;i++)!function(t){s.encodePacket(t,r.supportsBinary,function(i){if(!r.usingBrowserWebSocket){var s={};if(t.options&&(s.compress=t.options.compress),r.perMessageDeflate){var a="string"==typeof i?e.Buffer.byteLength(i):i.length;a<r.perMessageDeflate.threshold&&(s.compress=!1)}}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,s)}catch(c){p("websocket closed before onclose event")}--o||n()})}(t[i])},r.prototype.onClose=function(){i.prototype.onClose.call(this)},r.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},r.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=u()),this.supportsBinary||(t.b64=1),t=a.encode(t),t.length&&(t="?"+t);var r=this.hostname.indexOf(":")!==-1;return e+"://"+(r?"["+this.hostname+"]":this.hostname)+n+this.path+t},r.prototype.check=function(){return!(!l||"__initialize"in l&&this.name===r.prototype.name)}}).call(e,function(){return this}())},function(t,e){},function(t,e){var n=[].indexOf;t.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},function(t,e,n){"use strict";function r(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(7),s=n(8),a=n(38),c=n(39),u=n(40),p=n(3)("socket.io-client:socket"),h=n(30),f=n(23);t.exports=e=r;var l={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},d=s.prototype.emit;s(r.prototype),r.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[c(t,"open",u(this,"onopen")),c(t,"packet",u(this,"onpacket")),c(t,"close",u(this,"onclose"))]}},r.prototype.open=r.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},r.prototype.send=function(){var t=a(arguments);return t.unshift("message"),this.emit.apply(this,t),this},r.prototype.emit=function(t){if(l.hasOwnProperty(t))return d.apply(this,arguments),this;var e=a(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:f(e))?i.BINARY_EVENT:i.EVENT,data:e};return n.options={},n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},r.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},r.prototype.onopen=function(){if(p("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"===o(this.query)?h.encode(this.query):this.query;p("sending connect packet with query %s",t),this.packet({type:i.CONNECT,query:t})}else this.packet({type:i.CONNECT})},r.prototype.onclose=function(t){p("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},r.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===i.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case i.CONNECT:this.onconnect();break;case i.EVENT:this.onevent(t);break;case i.BINARY_EVENT:this.onevent(t);break;case i.ACK:this.onack(t);break;case i.BINARY_ACK:this.onack(t);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",t.data)}},r.prototype.onevent=function(t){var e=t.data||[];p("emitting event %j",e),null!=t.id&&(p("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?d.apply(this,e):this.receiveBuffer.push(e)},r.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=a(arguments);p("sending ack %j",r),e.packet({type:f(r)?i.BINARY_ACK:i.ACK,id:t,data:r})}}},r.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(p("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):p("bad ack %s",t.id)},r.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},r.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)d.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},r.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},r.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},r.prototype.close=r.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:i.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},r.prototype.compress=function(t){return this.flags.compress=t,this},r.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){function n(t,e){var n=[];e=e||0;for(var r=e||0;r<t.length;r++)n[r-e]=t[r];return n}t.exports=n},function(t,e){"use strict";function n(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}t.exports=n},function(t,e){var n=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},function(t,e){function n(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])});
//# sourceMappingURL=socket.io.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*!
* Socket.IO v2.1.1
* (c) 2014-2018 Guillermo Rauch
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{};var r,n=i(t),s=n.source,h=n.id,p=n.path,u=c[h]&&p in c[h].nsps,f=e.forceNew||e["force new connection"]||!1===e.multiplex||u;return f?r=a(s,e):(c[h]||(c[h]=a(s,e)),r=c[h]),n.query&&!e.query&&(e.query=n.query),r.socket(n.path,e)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1),s=r(4),a=r(9);r(3)("socket.io-client");t.exports=e=n;var c=e.managers={};e.protocol=s.protocol,e.connect=n,e.Manager=r(9),e.Socket=r(34)},function(t,e,r){(function(e){"use strict";function n(t,r){var n=t;r=r||e.location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t="undefined"!=typeof r?r.protocol+"//"+t:"https://"+t),n=o(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=n.host.indexOf(":")!==-1,s=i?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(r&&r.port===n.port?"":":"+n.port),n}var o=r(2);r(3)("socket.io-client:url");t.exports=n}).call(e,function(){return this}())},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=r.exec(t||""),a={},c=14;c--;)a[n[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e){"use strict";t.exports=function(){return function(){}}},function(t,e,r){function n(){}function o(t){var r=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(r+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(r+=t.nsp+","),null!=t.id&&(r+=t.id),null!=t.data){var n=i(t.data);if(n===!1)return m;r+=n}return r}function i(t){try{return JSON.stringify(t)}catch(t){return!1}}function s(t,e){function r(t){var r=l.deconstructPacket(t),n=o(r.packet),i=r.buffers;i.unshift(n),e(i)}l.removeBlobs(t,r)}function a(){this.reconstructor=null}function c(t){var r=0,n={type:Number(t.charAt(0))};if(null==e.types[n.type])return u("unknown packet type "+n.type);if(e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type){for(var o="";"-"!==t.charAt(++r)&&(o+=t.charAt(r),r!=t.length););if(o!=Number(o)||"-"!==t.charAt(r))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===t.charAt(r+1))for(n.nsp="";++r;){var i=t.charAt(r);if(","===i)break;if(n.nsp+=i,r===t.length)break}else n.nsp="/";var s=t.charAt(r+1);if(""!==s&&Number(s)==s){for(n.id="";++r;){var i=t.charAt(r);if(null==i||Number(i)!=i){--r;break}if(n.id+=t.charAt(r),r===t.length)break}n.id=Number(n.id)}if(t.charAt(++r)){var a=h(t.substr(r)),c=a!==!1&&(n.type===e.ERROR||d(a));if(!c)return u("invalid payload");n.data=a}return n}function h(t){try{return JSON.parse(t)}catch(t){return!1}}function p(t){this.reconPack=t,this.buffers=[]}function u(t){return{type:e.ERROR,data:"parser error: "+t}}var f=(r(3)("socket.io-parser"),r(5)),l=r(6),d=r(7),y=r(8);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=a;var m=e.ERROR+'"encode error"';n.prototype.encode=function(t,r){if(e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,r);else{var n=o(t);r([n])}},f(a.prototype),a.prototype.add=function(t){var r;if("string"==typeof t)r=c(t),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new p(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!y(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,this.emit("decoded",r))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=l.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){(function(t){function n(t,e){if(!t)return t;if(s(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}if(i(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=n(t[a],e);return o}if("object"==typeof t&&!(t instanceof Date)){var o={};for(var c in t)o[c]=n(t[c],e);return o}return t}function o(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(i(t))for(var r=0;r<t.length;r++)t[r]=o(t[r],e);else if("object"==typeof t)for(var n in t)t[n]=o(t[n],e);return t}var i=r(7),s=r(8),a=Object.prototype.toString,c="function"==typeof t.Blob||"[object BlobConstructor]"===a.call(t.Blob),h="function"==typeof t.File||"[object FileConstructor]"===a.call(t.File);e.deconstructPacket=function(t){var e=[],r=t.data,o=t;return o.data=n(r,e),o.attachments=e.length,{packet:o,buffers:e}},e.reconstructPacket=function(t,e){return t.data=o(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){function r(t,a,p){if(!t)return t;if(c&&t instanceof Blob||h&&t instanceof File){n++;var u=new FileReader;u.onload=function(){p?p[a]=this.result:o=this.result,--n||e(o)},u.readAsArrayBuffer(t)}else if(i(t))for(var f=0;f<t.length;f++)r(t[f],f,t);else if("object"==typeof t&&!s(t))for(var l in t)r(t[l],l,t)}var n=0,o=t;r(o),n||e(o)}}).call(e,function(){return this}())},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){(function(e){function r(t){return n&&e.Buffer.isBuffer(t)||o&&(t instanceof e.ArrayBuffer||i(t))}t.exports=r;var n="function"==typeof e.Buffer&&"function"==typeof e.Buffer.isBuffer,o="function"==typeof e.ArrayBuffer,i=function(){return o&&"function"==typeof e.ArrayBuffer.isView?e.ArrayBuffer.isView:function(t){return t.buffer instanceof e.ArrayBuffer}}()}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);t&&"object"===("undefined"==typeof t?"undefined":o(t))&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||c;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(10),s=r(34),a=r(5),c=r(4),h=r(36),p=r(37),u=(r(3)("socket.io-client:manager"),r(33)),f=r(38),l=Object.prototype.hasOwnProperty;t.exports=n,n.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)l.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},n.prototype.updateSocketIds=function(){for(var t in this.nsps)l.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},n.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},a(n.prototype),n.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},n.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},n.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},n.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},n.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},n.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},n.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},n.prototype.open=n.prototype.connect=function(t,e){if(~this.readyState.indexOf("open"))return this;this.engine=i(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=h(r,"open",function(){n.onopen(),t&&t()}),s=h(r,"error",function(e){if(n.cleanup(),n.readyState="closed",n.emitAll("connect_error",e),t){var r=new Error("Connection error");r.data=e,t(r)}else n.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout,c=setTimeout(function(){o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(o),this.subs.push(s),this},n.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(h(t,"data",p(this,"ondata"))),this.subs.push(h(t,"ping",p(this,"onping"))),this.subs.push(h(t,"pong",p(this,"onpong"))),this.subs.push(h(t,"error",p(this,"onerror"))),this.subs.push(h(t,"close",p(this,"onclose"))),this.subs.push(h(this.decoder,"decoded",p(this,"ondecoded")))},n.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},n.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},n.prototype.ondata=function(t){this.decoder.add(t)},n.prototype.ondecoded=function(t){this.emit("packet",t)},n.prototype.onerror=function(t){this.emitAll("error",t)},n.prototype.socket=function(t,e){function r(){~u(o.connecting,n)||o.connecting.push(n)}var n=this.nsps[t];if(!n){n=new s(this,t,e),this.nsps[t]=n;var o=this;n.on("connecting",r),n.on("connect",function(){n.id=o.generateId(t)}),this.autoConnect&&r()}return n},n.prototype.destroy=function(t){var e=u(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},n.prototype.packet=function(t){var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))},n.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(t){this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):t.onreconnect()}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,r){t.exports=r(11),t.exports.parser=r(18)},function(t,e,r){(function(e){function n(t,r){if(!(this instanceof n))return new n(t,r);r=r||{},t&&"object"==typeof t&&(r=t,t=null),t?(t=h(t),r.hostname=t.host,r.secure="https"===t.protocol||"wss"===t.protocol,r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=h(r.host).host),this.secure=null!=r.secure?r.secure:e.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(e.location?location.hostname:"localhost"),this.port=r.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=p.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var o="object"==typeof e&&e;o.global===o&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var i=r(12),s=r(5),a=(r(3)("engine.io-client:socket"),r(33)),c=r(18),h=r(2),p=r(27);t.exports=n,n.priorWebsocketSuccess=!1,s(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=r(17),n.transports=r(12),n.parser=r(18),n.prototype.createTransport=function(t){var e=o(this.query);e.EIO=c.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new i[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0});return n},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(){if(u.onlyBinaryUpgrades){var t=!this.supportsBinary&&u.transport.supportsBinary;p=p||t}p||(h.send([{type:"ping",data:"probe"}]),h.once("packet",function(t){if(!p)if("pong"===t.type&&"probe"===t.data){if(u.upgrading=!0,u.emit("upgrading",h),!h)return;n.priorWebsocketSuccess="websocket"===h.name,u.transport.pause(function(){p||"closed"!==u.readyState&&(c(),u.setTransport(h),h.send([{type:"upgrade"}]),u.emit("upgrade",h),h=null,u.upgrading=!1,u.flush())})}else{var e=new Error("probe error");e.transport=h.name,u.emit("upgradeError",e)}}))}function r(){p||(p=!0,c(),h.close(),h=null)}function o(t){var e=new Error("probe error: "+t);e.transport=h.name,r(),u.emit("upgradeError",e)}function i(){o("transport closed")}function s(){o("socket closed")}function a(t){h&&t.name!==h.name&&r()}function c(){h.removeListener("open",e),h.removeListener("error",o),h.removeListener("close",i),u.removeListener("close",s),u.removeListener("upgrading",a)}var h=this.createTransport(t,{probe:1}),p=!1,u=this;n.priorWebsocketSuccess=!1,h.once("open",e),h.once("error",o),h.once("close",i),this.once("close",s),this.once("upgrading",a),h.open()},n.prototype.onOpen=function(){if(this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},n.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){r=r||{},r.compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}},n.prototype.close=function(){function t(){n.onClose("forced close"),n.transport.close()}function e(){n.removeListener("upgrade",e),n.removeListener("upgradeError",e),t()}function r(){n.once("upgrade",e),n.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var n=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():t()}):this.upgrading?r():t()}return this},n.prototype.onError=function(t){n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}},n.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~a(this.transports,t[r])&&e.push(t[r]);return e}}).call(e,function(){return this}())},function(t,e,r){(function(t){function n(e){var r,n=!1,a=!1,c=!1!==e.jsonp;if(t.location){var h="https:"===location.protocol,p=location.port;p||(p=h?443:80),n=e.hostname!==location.hostname||p!==e.port,a=e.secure!==h}if(e.xdomain=n,e.xscheme=a,r=new o(e),"open"in r&&!e.forceJSONP)return new i(e);if(!c)throw new Error("JSONP disabled");return new s(e)}var o=r(13),i=r(15),s=r(30),a=r(31);e.polling=n,e.websocket=a}).call(e,function(){return this}())},function(t,e,r){(function(e){var n=r(14);t.exports=function(t){var r=t.xdomain,o=t.xscheme,i=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!r||n))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!o&&i)return new XDomainRequest}catch(t){}if(!r)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}).call(e,function(){return this}())},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,r){(function(e){function n(){}function o(t){if(c.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,e.location){var r="https:"===location.protocol,n=location.port;n||(n=r?443:80),this.xd=t.hostname!==e.location.hostname||n!==t.port,this.xs=t.secure!==r}}function i(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function s(){for(var t in i.requests)i.requests.hasOwnProperty(t)&&i.requests[t].abort()}var a=r(13),c=r(16),h=r(5),p=r(28);r(3)("engine.io-client:polling-xhr");t.exports=o,t.exports.Request=i,p(o,c),o.prototype.supportsBinary=!0,o.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new i(t)},o.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=n},o.prototype.doPoll=function(){var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},h(i.prototype),i.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new a(t),n=this;try{r.open(this.method,this.uri,this.async);try{if(this.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(var o in this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.extraHeaders[o])}}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");n.supportsBinary&&"application/octet-stream"===t&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout(function(){n.onError(r.status)},0))},r.send(this.data)}catch(t){return void setTimeout(function(){n.onError(t)},0)}e.document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},i.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},i.prototype.cleanup=function(t){if("undefined"!=typeof this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,t)try{this.xhr.abort()}catch(t){}e.document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},i.prototype.hasXDR=function(){return"undefined"!=typeof e.XDomainRequest&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},i.requestsCount=0,i.requests={},e.document&&(e.attachEvent?e.attachEvent("onunload",s):e.addEventListener&&e.addEventListener("beforeunload",s,!1))}).call(e,function(){return this}())},function(t,e,r){function n(t){var e=t&&t.forceBase64;h&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=r(17),i=r(27),s=r(18),a=r(28),c=r(29);r(3)("engine.io-client:polling");t.exports=n;var h=function(){var t=r(13),e=new t({xdomain:!1});return null!=e.responseType}();a(n,o),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||e()})),this.writable||(n++,this.once("drain",function(){--n||e()}))}else e()},n.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this,r=function(t,r,n){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)};s.decodePayload(t,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState&&this.poll())},n.prototype.doClose=function(){function t(){e.write([{type:"close"}])}var e=this;"open"===this.readyState?t():this.once("open",t)},n.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,r)})},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t}},function(t,e,r){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var o=r(18),i=r(5);t.exports=n,i(n.prototype),n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){(function(t){function n(t,r){var n="b"+e.packets[t.type]+t.data.data;return r(n)}function o(t,r,n){if(!r)return e.encodeBase64Packet(t,n);
var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=v[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return n(s.buffer)}function i(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=new FileReader;return o.onload=function(){t.data=o.result,e.encodePacket(t,r,!0,n)},o.readAsArrayBuffer(t.data)}function s(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(g)return i(t,r,n);var o=new Uint8Array(1);o[0]=v[t.type];var s=new w([o.buffer,t.data]);return n(s)}function a(t){try{t=d.decode(t,{strict:!1})}catch(t){return!1}return t}function c(t,e,r){for(var n=new Array(t.length),o=l(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},s=0;s<t.length;s++)i(s,t[s],o)}var h,p=r(19),u=r(20),f=r(21),l=r(22),d=r(23);t&&t.ArrayBuffer&&(h=r(25));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),m="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),g=y||m;e.protocol=3;var v=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=p(v),k={type:"error",data:"parser error"},w=r(26);e.encodePacket=function(e,r,i,a){"function"==typeof r&&(a=r,r=!1),"function"==typeof i&&(a=i,i=null);var c=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&c instanceof ArrayBuffer)return o(e,r,a);if(w&&c instanceof t.Blob)return s(e,r,a);if(c&&c.base64)return n(e,a);var h=v[e.type];return void 0!==e.data&&(h+=i?d.encode(String(e.data),{strict:!1}):String(e.data)),a(""+h)},e.encodeBase64Packet=function(r,n){var o="b"+e.packets[r.type];if(w&&r.data instanceof t.Blob){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];n(o+t)},i.readAsDataURL(r.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(r.data))}catch(t){for(var a=new Uint8Array(r.data),c=new Array(a.length),h=0;h<a.length;h++)c[h]=a[h];s=String.fromCharCode.apply(null,c)}return o+=t.btoa(s),n(o)},e.decodePacket=function(t,r,n){if(void 0===t)return k;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n&&(t=a(t),t===!1))return k;var o=t.charAt(0);return Number(o)==o&&b[o]?t.length>1?{type:b[o],data:t.substring(1)}:{type:b[o]}:k}var i=new Uint8Array(t),o=i[0],s=f(t,1);return w&&"blob"===r&&(s=new w([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var r=b[t.charAt(0)];if(!h)return{type:r,data:{base64:!0,data:t.substr(1)}};var n=h.decode(t.substr(1));return"blob"===e&&w&&(n=new w([n])),{type:r,data:n}},e.encodePayload=function(t,r,n){function o(t){return t.length+":"+t}function i(t,n){e.encodePacket(t,!!s&&r,!1,function(t){n(null,o(t))})}"function"==typeof r&&(n=r,r=null);var s=u(t);return r&&s?w&&!g?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void c(t,i,function(t,e){return n(e.join(""))}):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);"function"==typeof r&&(n=r,r=null);var o;if(""===t)return n(k,0,1);for(var i,s,a="",c=0,h=t.length;c<h;c++){var p=t.charAt(c);if(":"===p){if(""===a||a!=(i=Number(a)))return n(k,0,1);if(s=t.substr(c+1,i),a!=s.length)return n(k,0,1);if(s.length){if(o=e.decodePacket(s,r,!1),k.type===o.type&&k.data===o.data)return n(k,0,1);var u=n(o,c+i,h);if(!1===u)return}c+=i,a=""}else a+=p}return""!==a?n(k,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})}return t.length?void c(t,n,function(t,e){var n=e.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),o=new Uint8Array(n),i=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),s=0;s<t.length;s++)n[s]=t.charCodeAt(s);r=n.buffer}e?o[i++]=0:o[i++]=1;for(var a=r.byteLength.toString(),s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(var n=new Uint8Array(r),s=0;s<n.length;s++)o[i++]=n[s]}),r(o.buffer)}):r(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,s=i.toString(),a=new Uint8Array(s.length+1),o=0;o<s.length;o++)a[o]=parseInt(s[o]);if(a[s.length]=255,w){var c=new w([e.buffer,a.buffer,t]);r(null,c)}})}c(t,n,function(t,e){return r(new w(e))})},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var o=t,i=[];o.byteLength>0;){for(var s=new Uint8Array(o),a=0===s[0],c="",h=1;255!==s[h];h++){if(c.length>310)return n(k,0,1);c+=s[h]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(t){var u=new Uint8Array(p);p="";for(var h=0;h<u.length;h++)p+=String.fromCharCode(u[h])}i.push(p),o=f(o,c)}var l=i.length;i.forEach(function(t,o){n(e.decodePacket(t,r,!0),o,l)})}}).call(e,function(){return this}())},function(t,e){t.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}},function(t,e,r){(function(e){function n(t){if(!t||"object"!=typeof t)return!1;if(o(t)){for(var r=0,i=t.length;r<i;r++)if(n(t[r]))return!0;return!1}if("function"==typeof e.Buffer&&e.Buffer.isBuffer&&e.Buffer.isBuffer(t)||"function"==typeof e.ArrayBuffer&&t instanceof ArrayBuffer||s&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return n(t.toJSON(),!0);for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&n(t[c]))return!0;return!1}var o=r(7),i=Object.prototype.toString,s="function"==typeof e.Blob||"[object BlobConstructor]"===i.call(e.Blob),a="function"==typeof e.File||"[object FileConstructor]"===i.call(e.File);t.exports=n}).call(e,function(){return this}())},function(t,e){t.exports=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s<r;s++,a++)i[a]=o[s];return i.buffer}},function(t,e){function r(t,e,r){function o(t,n){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(i=!0,e(t),e=r):0!==o.count||i||e(null,n)}var i=!1;return r=r||n,o.count=t,0===t?e():o}function n(){}t.exports=r},function(t,e,r){var n;(function(t,o){!function(i){function s(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function a(t){for(var e,r=t.length,n=-1,o="";++n<r;)e=t[n],e>65535&&(e-=65536,o+=k(e>>>10&1023|55296),e=56320|1023&e),o+=k(e);return o}function c(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function h(t,e){return k(t>>e&63|128)}function p(t,e){if(0==(4294967168&t))return k(t);var r="";return 0==(4294965248&t)?r=k(t>>6&31|192):0==(4294901760&t)?(c(t,e)||(t=65533),r=k(t>>12&15|224),r+=h(t,6)):0==(4292870144&t)&&(r=k(t>>18&7|240),r+=h(t,12),r+=h(t,6)),r+=k(63&t|128)}function u(t,e){e=e||{};for(var r,n=!1!==e.strict,o=s(t),i=o.length,a=-1,c="";++a<i;)r=o[a],c+=p(r,n);return c}function f(){if(b>=v)throw Error("Invalid byte index");var t=255&g[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(t){var e,r,n,o,i;if(b>v)throw Error("Invalid byte index");if(b==v)return!1;if(e=255&g[b],b++,0==(128&e))return e;if(192==(224&e)){if(r=f(),i=(31&e)<<6|r,i>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if(r=f(),n=f(),i=(15&e)<<12|r<<6|n,i>=2048)return c(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(r=f(),n=f(),o=f(),i=(7&e)<<18|r<<12|n<<6|o,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}function d(t,e){e=e||{};var r=!1!==e.strict;g=s(t),v=g.length,b=0;for(var n,o=[];(n=l(r))!==!1;)o.push(n);return a(o)}var y="object"==typeof e&&e,m=("object"==typeof t&&t&&t.exports==y&&t,"object"==typeof o&&o);m.global!==m&&m.window!==m||(i=m);var g,v,b,k=String.fromCharCode,w={version:"2.1.2",encode:u,decode:d};n=function(){return w}.call(e,r,e,t),!(void 0!==n&&(t.exports=n))}(this)}).call(e,r(24)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;e.encode=function(e){var r,n=new Uint8Array(e),o=n.length,i="";for(r=0;r<o;r+=3)i+=t[n[r]>>2],i+=t[(3&n[r])<<4|n[r+1]>>4],i+=t[(15&n[r+1])<<2|n[r+2]>>6],i+=t[63&n[r+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,n,o,i,s,a=.75*t.length,c=t.length,h=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),u=new Uint8Array(p);for(e=0;e<c;e+=4)n=r[t.charCodeAt(e)],o=r[t.charCodeAt(e+1)],i=r[t.charCodeAt(e+2)],s=r[t.charCodeAt(e+3)],u[h++]=n<<2|o>>4,u[h++]=(15&o)<<4|i>>2,u[h++]=(3&i)<<6|63&s;return p}}()},function(t,e){(function(e){function r(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var o=new Uint8Array(r.byteLength);o.set(new Uint8Array(n,r.byteOffset,r.byteLength)),n=o.buffer}t[e]=n}}}function n(t,e){e=e||{};var n=new i;r(t);for(var o=0;o<t.length;o++)n.append(t[o]);return e.type?n.getBlob(e.type):n.getBlob()}function o(t,e){return r(t),new Blob(t,e||{})}var i=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,s=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(t){return!1}}(),a=s&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(t){return!1}}(),c=i&&i.prototype.append&&i.prototype.getBlob;t.exports=function(){return s?a?e.Blob:o:c?n:void 0}()}).call(e,function(){return this}())},function(t,e){e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e){t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){"use strict";function r(t){var e="";do e=s[t%a]+e,t=Math.floor(t/a);while(t>0);return e}function n(t){var e=0;for(p=0;p<t.length;p++)e=e*a+c[t.charAt(p)];return e}function o(){var t=r(+new Date);return t!==i?(h=0,i=t):t+"."+r(h++)}for(var i,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},h=0,p=0;p<a;p++)c[s[p]]=p;o.encode=r,o.decode=n,t.exports=o},function(t,e,r){(function(e){function n(){}function o(t){i.call(this,t),this.query=this.query||{},a||(e.___eio||(e.___eio=[]),a=e.___eio),this.index=a.length;var r=this;a.push(function(t){r.onData(t)}),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",function(){r.script&&(r.script.onerror=n)},!1)}var i=r(16),s=r(28);t.exports=o;var a,c=/\n/g,h=/\\n/g;s(o,i),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},o.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},o.prototype.doWrite=function(t,e){function r(){n(),e()}function n(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),p=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=p,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),n(),t=t.replace(h,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&r()}:this.iframe.onload=r}}).call(e,function(){return this}())},function(t,e,r){(function(e){function n(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=p&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(u=o),i.call(this,t)}var o,i=r(17),s=r(18),a=r(27),c=r(28),h=r(29),p=(r(3)("engine.io-client:websocket"),e.WebSocket||e.MozWebSocket);if("undefined"==typeof window)try{o=r(32)}catch(t){}var u=p;u||"undefined"!=typeof window||(u=o),t.exports=n,c(n,i),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new u(t,e):new u(t):new u(t,e,r)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},n.prototype.write=function(t){function r(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}var n=this;this.writable=!1;for(var o=t.length,i=0,a=o;i<a;i++)!function(t){s.encodePacket(t,n.supportsBinary,function(i){if(!n.usingBrowserWebSocket){var s={};if(t.options&&(s.compress=t.options.compress),n.perMessageDeflate){var a="string"==typeof i?e.Buffer.byteLength(i):i.length;a<n.perMessageDeflate.threshold&&(s.compress=!1)}}try{n.usingBrowserWebSocket?n.ws.send(i):n.ws.send(i,s)}catch(t){}--o||r()})}(t[i])},n.prototype.onClose=function(){i.prototype.onClose.call(this)},n.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=h()),this.supportsBinary||(t.b64=1),t=a.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t},n.prototype.check=function(){return!(!u||"__initialize"in u&&this.name===n.prototype.name)}}).call(e,function(){return this}())},function(t,e){},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e,r){"use strict";function n(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(4),s=r(5),a=r(35),c=r(36),h=r(37),p=(r(3)("socket.io-client:socket"),r(27)),u=r(20);t.exports=e=n;var f={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},l=s.prototype.emit;s(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[c(t,"open",h(this,"onopen")),c(t,"packet",h(this,"onpacket")),c(t,"close",h(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},n.prototype.send=function(){var t=a(arguments);return t.unshift("message"),this.emit.apply(this,t),this},n.prototype.emit=function(t){if(f.hasOwnProperty(t))return l.apply(this,arguments),this;var e=a(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:u(e))?i.BINARY_EVENT:i.EVENT,data:e};return r.options={},r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(this.acks[this.ids]=e.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},n.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},n.prototype.onopen=function(){if("/"!==this.nsp)if(this.query){var t="object"===o(this.query)?p.encode(this.query):this.query;this.packet({type:i.CONNECT,query:t})}else this.packet({type:i.CONNECT})},n.prototype.onclose=function(t){this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},n.prototype.onpacket=function(t){var e=t.nsp===this.nsp,r=t.type===i.ERROR&&"/"===t.nsp;if(e||r)switch(t.type){case i.CONNECT:this.onconnect();break;case i.EVENT:this.onevent(t);break;case i.BINARY_EVENT:this.onevent(t);break;case i.ACK:this.onack(t);break;case i.BINARY_ACK:this.onack(t);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",t.data)}},n.prototype.onevent=function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?l.apply(this,e):this.receiveBuffer.push(e)},n.prototype.ack=function(t){var e=this,r=!1;return function(){if(!r){r=!0;var n=a(arguments);e.packet({type:u(n)?i.BINARY_ACK:i.ACK,id:t,data:n})}}},n.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)l.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&this.packet({type:i.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},n.prototype.compress=function(t){return this.flags.compress=t,this},n.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){function r(t,e){var r=[];e=e||0;for(var n=e||0;n<t.length;n++)r[n-e]=t[n];return r}t.exports=r},function(t,e){"use strict";function r(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}t.exports=r},function(t,e){var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},function(t,e){function r(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=r,r.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(t){this.ms=t},r.prototype.setMax=function(t){this.max=t},r.prototype.setJitter=function(t){this.jitter=t}}])});
//# sourceMappingURL=socket.io.slim.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Module dependencies.
*/
var url = require('./url');
var parser = require('socket.io-parser');
var Manager = require('./manager');
var debug = require('debug')('socket.io-client');
/**
* Module exports.
*/
module.exports = exports = lookup;
/**
* Managers cache.
*/
var cache = exports.managers = {};
/**
* Looks up an existing `Manager` for multiplexing.
* If the user summons:
*
* `io('http://localhost/a');`
* `io('http://localhost/b');`
*
* We reuse the existing instance based on same scheme/port/host,
* and we initialize sockets for each namespace.
*
* @api public
*/
function lookup (uri, opts) {
if (typeof uri === 'object') {
opts = uri;
uri = undefined;
}
opts = opts || {};
var parsed = url(uri);
var source = parsed.source;
var id = parsed.id;
var path = parsed.path;
var sameNamespace = cache[id] && path in cache[id].nsps;
var newConnection = opts.forceNew || opts['force new connection'] ||
false === opts.multiplex || sameNamespace;
var io;
if (newConnection) {
debug('ignoring socket cache for %s', source);
io = Manager(source, opts);
} else {
if (!cache[id]) {
debug('new io instance for %s', source);
cache[id] = Manager(source, opts);
}
io = cache[id];
}
if (parsed.query && !opts.query) {
opts.query = parsed.query;
}
return io.socket(parsed.path, opts);
}
/**
* Protocol version.
*
* @api public
*/
exports.protocol = parser.protocol;
/**
* `connect`.
*
* @param {String} uri
* @api public
*/
exports.connect = lookup;
/**
* Expose constructors for standalone build.
*
* @api public
*/
exports.Manager = require('./manager');
exports.Socket = require('./socket');
/**
* Module dependencies.
*/
var eio = require('engine.io-client');
var Socket = require('./socket');
var Emitter = require('component-emitter');
var parser = require('socket.io-parser');
var on = require('./on');
var bind = require('component-bind');
var debug = require('debug')('socket.io-client:manager');
var indexOf = require('indexof');
var Backoff = require('backo2');
/**
* IE6+ hasOwnProperty
*/
var has = Object.prototype.hasOwnProperty;
/**
* Module exports
*/
module.exports = Manager;
/**
* `Manager` constructor.
*
* @param {String} engine instance or engine uri/opts
* @param {Object} options
* @api public
*/
function Manager (uri, opts) {
if (!(this instanceof Manager)) return new Manager(uri, opts);
if (uri && ('object' === typeof uri)) {
opts = uri;
uri = undefined;
}
opts = opts || {};
opts.path = opts.path || '/socket.io';
this.nsps = {};
this.subs = [];
this.opts = opts;
this.reconnection(opts.reconnection !== false);
this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
this.reconnectionDelay(opts.reconnectionDelay || 1000);
this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
this.randomizationFactor(opts.randomizationFactor || 0.5);
this.backoff = new Backoff({
min: this.reconnectionDelay(),
max: this.reconnectionDelayMax(),
jitter: this.randomizationFactor()
});
this.timeout(null == opts.timeout ? 20000 : opts.timeout);
this.readyState = 'closed';
this.uri = uri;
this.connecting = [];
this.lastPing = null;
this.encoding = false;
this.packetBuffer = [];
var _parser = opts.parser || parser;
this.encoder = new _parser.Encoder();
this.decoder = new _parser.Decoder();
this.autoConnect = opts.autoConnect !== false;
if (this.autoConnect) this.open();
}
/**
* Propagate given event to sockets and emit on `this`
*
* @api private
*/
Manager.prototype.emitAll = function() {
this.emit.apply(this, arguments);
for (var nsp in this.nsps) {
if (has.call(this.nsps, nsp)) {
this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
}
}
};
/**
* Update `socket.id` of all sockets
*
* @api private
*/
Manager.prototype.updateSocketIds = function() {
for (var nsp in this.nsps) {
if (has.call(this.nsps, nsp)) {
this.nsps[nsp].id = this.generateId(nsp);
}
}
};
/**
* generate `socket.id` for the given `nsp`
*
* @param {String} nsp
* @return {String}
* @api private
*/
Manager.prototype.generateId = function(nsp) {
return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;
};
/**
* Mix in `Emitter`.
*/
Emitter(Manager.prototype);
/**
* Sets the `reconnection` config.
*
* @param {Boolean} true/false if it should automatically reconnect
* @return {Manager} self or value
* @api public
*/
Manager.prototype.reconnection = function(v) {
if (!arguments.length) return this._reconnection;
this._reconnection = !!v;
return this;
};
/**
* Sets the reconnection attempts config.
*
* @param {Number} max reconnection attempts before giving up
* @return {Manager} self or value
* @api public
*/
Manager.prototype.reconnectionAttempts = function(v) {
if (!arguments.length) return this._reconnectionAttempts;
this._reconnectionAttempts = v;
return this;
};
/**
* Sets the delay between reconnections.
*
* @param {Number} delay
* @return {Manager} self or value
* @api public
*/
Manager.prototype.reconnectionDelay = function(v) {
if (!arguments.length) return this._reconnectionDelay;
this._reconnectionDelay = v;
this.backoff && this.backoff.setMin(v);
return this;
};
Manager.prototype.randomizationFactor = function(v) {
if (!arguments.length) return this._randomizationFactor;
this._randomizationFactor = v;
this.backoff && this.backoff.setJitter(v);
return this;
};
/**
* Sets the maximum delay between reconnections.
*
* @param {Number} delay
* @return {Manager} self or value
* @api public
*/
Manager.prototype.reconnectionDelayMax = function(v) {
if (!arguments.length) return this._reconnectionDelayMax;
this._reconnectionDelayMax = v;
this.backoff && this.backoff.setMax(v);
return this;
};
/**
* Sets the connection timeout. `false` to disable
*
* @return {Manager} self or value
* @api public
*/
Manager.prototype.timeout = function(v) {
if (!arguments.length) return this._timeout;
this._timeout = v;
return this;
};
/**
* Starts trying to reconnect if reconnection is enabled and we have not
* started reconnecting yet
*
* @api private
*/
Manager.prototype.maybeReconnectOnOpen = function() {
// Only try to reconnect if it's the first time we're connecting
if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
// keeps reconnection from firing twice for the same reconnection loop
this.reconnect();
}
};
/**
* Sets the current transport `socket`.
*
* @param {Function} optional, callback
* @return {Manager} self
* @api public
*/
Manager.prototype.open =
Manager.prototype.connect = function(fn, opts) {
debug('readyState %s', this.readyState);
if (~this.readyState.indexOf('open')) return this;
debug('opening %s', this.uri);
this.engine = eio(this.uri, this.opts);
var socket = this.engine;
var self = this;
this.readyState = 'opening';
this.skipReconnect = false;
// emit `open`
var openSub = on(socket, 'open', function() {
self.onopen();
fn && fn();
});
// emit `connect_error`
var errorSub = on(socket, 'error', function(data) {
debug('connect_error');
self.cleanup();
self.readyState = 'closed';
self.emitAll('connect_error', data);
if (fn) {
var err = new Error('Connection error');
err.data = data;
fn(err);
} else {
// Only do this if there is no fn to handle the error
self.maybeReconnectOnOpen();
}
});
// emit `connect_timeout`
if (false !== this._timeout) {
var timeout = this._timeout;
debug('connect attempt will timeout after %d', timeout);
// set timer
var timer = setTimeout(function() {
debug('connect attempt timed out after %d', timeout);
openSub.destroy();
socket.close();
socket.emit('error', 'timeout');
self.emitAll('connect_timeout', timeout);
}, timeout);
this.subs.push({
destroy: function() {
clearTimeout(timer);
}
});
}
this.subs.push(openSub);
this.subs.push(errorSub);
return this;
};
/**
* Called upon transport open.
*
* @api private
*/
Manager.prototype.onopen = function() {
debug('open');
// clear old subs
this.cleanup();
// mark as open
this.readyState = 'open';
this.emit('open');
// add new subs
var socket = this.engine;
this.subs.push(on(socket, 'data', bind(this, 'ondata')));
this.subs.push(on(socket, 'ping', bind(this, 'onping')));
this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
this.subs.push(on(socket, 'error', bind(this, 'onerror')));
this.subs.push(on(socket, 'close', bind(this, 'onclose')));
this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
};
/**
* Called upon a ping.
*
* @api private
*/
Manager.prototype.onping = function() {
this.lastPing = new Date();
this.emitAll('ping');
};
/**
* Called upon a packet.
*
* @api private
*/
Manager.prototype.onpong = function() {
this.emitAll('pong', new Date() - this.lastPing);
};
/**
* Called with data.
*
* @api private
*/
Manager.prototype.ondata = function(data) {
this.decoder.add(data);
};
/**
* Called when parser fully decodes a packet.
*
* @api private
*/
Manager.prototype.ondecoded = function(packet) {
this.emit('packet', packet);
};
/**
* Called upon socket error.
*
* @api private
*/
Manager.prototype.onerror = function(err) {
debug('error', err);
this.emitAll('error', err);
};
/**
* Creates a new socket for the given `nsp`.
*
* @return {Socket}
* @api public
*/
Manager.prototype.socket = function(nsp, opts) {
var socket = this.nsps[nsp];
if (!socket) {
socket = new Socket(this, nsp, opts);
this.nsps[nsp] = socket;
var self = this;
socket.on('connecting', onConnecting);
socket.on('connect', function() {
socket.id = self.generateId(nsp);
});
if (this.autoConnect) {
// manually call here since connecting event is fired before listening
onConnecting();
}
}
function onConnecting () {
if (!~indexOf(self.connecting, socket)) {
self.connecting.push(socket);
}
}
return socket;
};
/**
* Called upon a socket close.
*
* @param {Socket} socket
*/
Manager.prototype.destroy = function(socket) {
var index = indexOf(this.connecting, socket);
if (~index) this.connecting.splice(index, 1);
if (this.connecting.length) return;
this.close();
};
/**
* Writes a packet.
*
* @param {Object} packet
* @api private
*/
Manager.prototype.packet = function(packet) {
debug('writing packet %j', packet);
var self = this;
if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
if (!self.encoding) {
// encode, then write to engine with result
self.encoding = true;
this.encoder.encode(packet, function(encodedPackets) {
for (var i = 0; i < encodedPackets.length; i++) {
self.engine.write(encodedPackets[i], packet.options);
}
self.encoding = false;
self.processPacketQueue();
});
} else { // add packet to the queue
self.packetBuffer.push(packet);
}
};
/**
* If packet buffer is non-empty, begins encoding the
* next packet in line.
*
* @api private
*/
Manager.prototype.processPacketQueue = function() {
if (this.packetBuffer.length > 0 && !this.encoding) {
var pack = this.packetBuffer.shift();
this.packet(pack);
}
};
/**
* Clean up transport subscriptions and packet buffer.
*
* @api private
*/
Manager.prototype.cleanup = function() {
debug('cleanup');
var subsLength = this.subs.length;
for (var i = 0; i < subsLength; i++) {
var sub = this.subs.shift();
sub.destroy();
}
this.packetBuffer = [];
this.encoding = false;
this.lastPing = null;
this.decoder.destroy();
};
/**
* Close the current socket.
*
* @api private
*/
Manager.prototype.close =
Manager.prototype.disconnect = function() {
debug('disconnect');
this.skipReconnect = true;
this.reconnecting = false;
if ('opening' === this.readyState) {
// `onclose` will not fire because
// an open event never happened
this.cleanup();
}
this.backoff.reset();
this.readyState = 'closed';
if (this.engine) this.engine.close();
};
/**
* Called upon engine close.
*
* @api private
*/
Manager.prototype.onclose = function(reason) {
debug('onclose');
this.cleanup();
this.backoff.reset();
this.readyState = 'closed';
this.emit('close', reason);
if (this._reconnection && !this.skipReconnect) {
this.reconnect();
}
};
/**
* Attempt a reconnection.
*
* @api private
*/
Manager.prototype.reconnect = function() {
if (this.reconnecting || this.skipReconnect) return this;
var self = this;
if (this.backoff.attempts >= this._reconnectionAttempts) {
debug('reconnect failed');
this.backoff.reset();
this.emitAll('reconnect_failed');
this.reconnecting = false;
} else {
var delay = this.backoff.duration();
debug('will wait %dms before reconnect attempt', delay);
this.reconnecting = true;
var timer = setTimeout(function() {
if (self.skipReconnect) return;
debug('attempting reconnect');
self.emitAll('reconnect_attempt', self.backoff.attempts);
self.emitAll('reconnecting', self.backoff.attempts);
// check again for the case socket closed in above events
if (self.skipReconnect) return;
self.open(function(err) {
if (err) {
debug('reconnect attempt error');
self.reconnecting = false;
self.reconnect();
self.emitAll('reconnect_error', err.data);
} else {
debug('reconnect success');
self.onreconnect();
}
});
}, delay);
this.subs.push({
destroy: function() {
clearTimeout(timer);
}
});
}
};
/**
* Called upon successful reconnect.
*
* @api private
*/
Manager.prototype.onreconnect = function() {
var attempt = this.backoff.attempts;
this.reconnecting = false;
this.backoff.reset();
this.updateSocketIds();
this.emitAll('reconnect', attempt);
};
/**
* Module exports.
*/
module.exports = on;
/**
* Helper for subscriptions.
*
* @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
* @param {String} event name
* @param {Function} callback
* @api public
*/
function on(obj, ev, fn) {
obj.on(ev, fn);
return {
destroy: function() {
obj.removeListener(ev, fn);
}
};
}
/**
* Module dependencies.
*/
var parser = require('socket.io-parser');
var Emitter = require('component-emitter');
var toArray = require('to-array');
var on = require('./on');
var bind = require('component-bind');
var debug = require('debug')('socket.io-client:socket');
var parseqs = require('parseqs');
var hasBin = require('has-binary2');
/**
* Module exports.
*/
module.exports = exports = Socket;
/**
* Internal events (blacklisted).
* These events can't be emitted by the user.
*
* @api private
*/
var events = {
connect: 1,
connect_error: 1,
connect_timeout: 1,
connecting: 1,
disconnect: 1,
error: 1,
reconnect: 1,
reconnect_attempt: 1,
reconnect_failed: 1,
reconnect_error: 1,
reconnecting: 1,
ping: 1,
pong: 1
};
/**
* Shortcut to `Emitter#emit`.
*/
var emit = Emitter.prototype.emit;
/**
* `Socket` constructor.
*
* @api public
*/
function Socket(io, nsp, opts) {
this.io = io;
this.nsp = nsp;
this.json = this; // compat
this.ids = 0;
this.acks = {};
this.receiveBuffer = [];
this.sendBuffer = [];
this.connected = false;
this.disconnected = true;
this.flags = {};
if (opts && opts.query) {
this.query = opts.query;
}
if (this.io.autoConnect) this.open();
}
/**
* Mix in `Emitter`.
*/
Emitter(Socket.prototype);
/**
* Subscribe to open, close and packet events
*
* @api private
*/
Socket.prototype.subEvents = function() {
if (this.subs) return;
var io = this.io;
this.subs = [
on(io, 'open', bind(this, 'onopen')),
on(io, 'packet', bind(this, 'onpacket')),
on(io, 'close', bind(this, 'onclose'))
];
};
/**
* "Opens" the socket.
*
* @api public
*/
Socket.prototype.open =
Socket.prototype.connect = function() {
if (this.connected) return this;
this.subEvents();
this.io.open(); // ensure open
if ('open' === this.io.readyState) this.onopen();
this.emit('connecting');
return this;
};
/**
* Sends a `message` event.
*
* @return {Socket} self
* @api public
*/
Socket.prototype.send = function() {
var args = toArray(arguments);
args.unshift('message');
this.emit.apply(this, args);
return this;
};
/**
* Override `emit`.
* If the event is in `events`, it's emitted normally.
*
* @param {String} event name
* @return {Socket} self
* @api public
*/
Socket.prototype.emit = function(ev) {
if (events.hasOwnProperty(ev)) {
emit.apply(this, arguments);
return this;
}
var args = toArray(arguments);
var packet = {
type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,
data: args
};
packet.options = {};
packet.options.compress = !this.flags || false !== this.flags.compress;
// event ack callback
if ('function' === typeof args[args.length - 1]) {
debug('emitting packet with ack id %d', this.ids);
this.acks[this.ids] = args.pop();
packet.id = this.ids++;
}
if (this.connected) {
this.packet(packet);
} else {
this.sendBuffer.push(packet);
}
this.flags = {};
return this;
};
/**
* Sends a packet.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.packet = function(packet) {
packet.nsp = this.nsp;
this.io.packet(packet);
};
/**
* Called upon engine `open`.
*
* @api private
*/
Socket.prototype.onopen = function() {
debug('transport is open - connecting');
// write connect packet if necessary
if ('/' !== this.nsp) {
if (this.query) {
var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
debug('sending connect packet with query %s', query);
this.packet({type: parser.CONNECT, query: query});
} else {
this.packet({type: parser.CONNECT});
}
}
};
/**
* Called upon engine `close`.
*
* @param {String} reason
* @api private
*/
Socket.prototype.onclose = function(reason) {
debug('close (%s)', reason);
this.connected = false;
this.disconnected = true;
delete this.id;
this.emit('disconnect', reason);
};
/**
* Called with socket packet.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onpacket = function(packet) {
var sameNamespace = packet.nsp === this.nsp;
var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';
if (!sameNamespace && !rootNamespaceError) return;
switch (packet.type) {
case parser.CONNECT:
this.onconnect();
break;
case parser.EVENT:
this.onevent(packet);
break;
case parser.BINARY_EVENT:
this.onevent(packet);
break;
case parser.ACK:
this.onack(packet);
break;
case parser.BINARY_ACK:
this.onack(packet);
break;
case parser.DISCONNECT:
this.ondisconnect();
break;
case parser.ERROR:
this.emit('error', packet.data);
break;
}
};
/**
* Called upon a server event.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onevent = function(packet) {
var args = packet.data || [];
debug('emitting event %j', args);
if (null != packet.id) {
debug('attaching ack callback to event');
args.push(this.ack(packet.id));
}
if (this.connected) {
emit.apply(this, args);
} else {
this.receiveBuffer.push(args);
}
};
/**
* Produces an ack callback to emit with an event.
*
* @api private
*/
Socket.prototype.ack = function(id) {
var self = this;
var sent = false;
return function () {
// prevent double callbacks
if (sent) return;
sent = true;
var args = toArray(arguments);
debug('sending ack %j', args);
self.packet({
type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,
id: id,
data: args
});
};
};
/**
* Called upon a server acknowlegement.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onack = function(packet) {
var ack = this.acks[packet.id];
if ('function' === typeof ack) {
debug('calling ack %s with %j', packet.id, packet.data);
ack.apply(this, packet.data);
delete this.acks[packet.id];
} else {
debug('bad ack %s', packet.id);
}
};
/**
* Called upon server connect.
*
* @api private
*/
Socket.prototype.onconnect = function() {
this.connected = true;
this.disconnected = false;
this.emit('connect');
this.emitBuffered();
};
/**
* Emit buffered events (received and emitted).
*
* @api private
*/
Socket.prototype.emitBuffered = function() {
var i;
for (i = 0; i < this.receiveBuffer.length; i++) {
emit.apply(this, this.receiveBuffer[i]);
}
this.receiveBuffer = [];
for (i = 0; i < this.sendBuffer.length; i++) {
this.packet(this.sendBuffer[i]);
}
this.sendBuffer = [];
};
/**
* Called upon server disconnect.
*
* @api private
*/
Socket.prototype.ondisconnect = function() {
debug('server disconnect (%s)', this.nsp);
this.destroy();
this.onclose('io server disconnect');
};
/**
* Called upon forced client/server side disconnections,
* this method ensures the manager stops tracking us and
* that reconnections don't get triggered for this.
*
* @api private.
*/
Socket.prototype.destroy = function() {
if (this.subs) {
// clean subscriptions to avoid reconnections
for (var i = 0; i < this.subs.length; i++) {
this.subs[i].destroy();
}
this.subs = null;
}
this.io.destroy(this);
};
/**
* Disconnects the socket manually.
*
* @return {Socket} self
* @api public
*/
Socket.prototype.close =
Socket.prototype.disconnect = function() {
if (this.connected) {
debug('performing disconnect (%s)', this.nsp);
this.packet({ type: parser.DISCONNECT });
}
// remove socket from pool
this.destroy();
if (this.connected) {
// fire events
this.onclose('io client disconnect');
}
return this;
};
/**
* Sets the compress flag.
*
* @param {Boolean} if `true`, compresses the sending data
* @return {Socket} self
* @api public
*/
Socket.prototype.compress = function(compress) {
this.flags.compress = compress;
return this;
};
/**
* Sets the binary flag
*
* @param {Boolean} whether the emitted data contains binary
* @return {Socket} self
* @api public
*/
Socket.prototype.binary = function(binary) {
this.flags.binary = binary;
return this;
};
/**
* Module dependencies.
*/
var parseuri = require('parseuri');
var debug = require('debug')('socket.io-client:url');
/**
* Module exports.
*/
module.exports = url;
/**
* URL parser.
*
* @param {String} url
* @param {Object} An object meant to mimic window.location.
* Defaults to window.location.
* @api public
*/
function url (uri, loc) {
var obj = uri;
// default to window.location
loc = loc || global.location;
if (null == uri) uri = loc.protocol + '//' + loc.host;
// relative path support
if ('string' === typeof uri) {
if ('/' === uri.charAt(0)) {
if ('/' === uri.charAt(1)) {
uri = loc.protocol + uri;
} else {
uri = loc.host + uri;
}
}
if (!/^(https?|wss?):\/\//.test(uri)) {
debug('protocol-less url %s', uri);
if ('undefined' !== typeof loc) {
uri = loc.protocol + '//' + uri;
} else {
uri = 'https://' + uri;
}
}
// parse
debug('parse %s', uri);
obj = parseuri(uri);
}
// make sure we treat `localhost:80` and `localhost` equally
if (!obj.port) {
if (/^(http|ws)$/.test(obj.protocol)) {
obj.port = '80';
} else if (/^(http|ws)s$/.test(obj.protocol)) {
obj.port = '443';
}
}
obj.path = obj.path || '/';
var ipv6 = obj.host.indexOf(':') !== -1;
var host = ipv6 ? '[' + obj.host + ']' : obj.host;
// define unique id
obj.id = obj.protocol + '://' + host + ':' + obj.port;
// define href
obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
return obj;
}
{
"_args": [
[
"socket.io-client@2.1.1",
"/Users/AIS-NB-048/Downloads/node-chat-app-master"
]
],
"_from": "socket.io-client@2.1.1",
"_id": "socket.io-client@2.1.1",
"_inBundle": false,
"_integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==",
"_location": "/socket.io-client",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "socket.io-client@2.1.1",
"name": "socket.io-client",
"escapedName": "socket.io-client",
"rawSpec": "2.1.1",
"saveSpec": null,
"fetchSpec": "2.1.1"
},
"_requiredBy": [
"/socket.io"
],
"_resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.1.tgz",
"_spec": "2.1.1",
"_where": "/Users/AIS-NB-048/Downloads/node-chat-app-master",
"bugs": {
"url": "https://github.com/Automattic/socket.io-client/issues"
},
"contributors": [
{
"name": "Guillermo Rauch",
"email": "rauchg@gmail.com"
},
{
"name": "Arnout Kazemier",
"email": "info@3rd-eden.com"
},
{
"name": "Vladimir Dronnikov",
"email": "dronnikov@gmail.com"
},
{
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com"
}
],
"dependencies": {
"backo2": "1.0.2",
"base64-arraybuffer": "0.1.5",
"component-bind": "1.0.0",
"component-emitter": "1.2.1",
"debug": "~3.1.0",
"engine.io-client": "~3.2.0",
"has-binary2": "~1.0.2",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"object-component": "0.0.3",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"socket.io-parser": "~3.2.0",
"to-array": "0.1.4"
},
"description": "[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client) [![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client) [![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies) [![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client) ![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat) [![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)",
"devDependencies": {
"babel-core": "^6.24.1",
"babel-eslint": "4.1.7",
"babel-loader": "7.0.0",
"babel-preset-es2015": "6.24.1",
"concat-stream": "^1.6.0",
"derequire": "^2.0.6",
"eslint-config-standard": "4.4.0",
"eslint-plugin-standard": "1.3.1",
"expect.js": "0.3.1",
"gulp": "^3.9.1",
"gulp-eslint": "1.1.1",
"gulp-file": "^0.3.0",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^4.3.1",
"gulp-task-listing": "1.0.1",
"imports-loader": "^0.7.1",
"istanbul": "^0.4.5",
"mocha": "^3.3.0",
"socket.io": "2.1.1",
"socket.io-browsers": "^1.0.0",
"strip-loader": "0.1.2",
"text-blob-builder": "0.0.1",
"webpack-merge": "4.1.2",
"webpack-stream": "3.2.0",
"zuul": "^3.11.1 ",
"zuul-builder-webpack": "^1.2.0",
"zuul-ngrok": "4.0.0"
},
"files": [
"lib/",
"dist/"
],
"homepage": "https://github.com/Automattic/socket.io-client#readme",
"keywords": [
"realtime",
"framework",
"websocket",
"tcp",
"events",
"client"
],
"license": "MIT",
"main": "./lib/index",
"name": "socket.io-client",
"repository": {
"type": "git",
"url": "git+https://github.com/Automattic/socket.io-client.git"
},
"scripts": {
"test": "gulp test"
},
"version": "2.1.1"
}
......@@ -89,7 +89,7 @@ android {
armv7 {
versionCode defaultConfig.versionCode
ndk {
abiFilters "armeabi-v7a", ""
abiFilters "armeabi-v7a", "x86", ""
}
}
......@@ -124,7 +124,7 @@ android {
armv7 {
versionCode defaultConfig.versionCode
ndk {
abiFilters "armeabi-v7a", ""
abiFilters "armeabi-v7a", "x86", ""
}
}
armv8 {
......
......@@ -28,16 +28,32 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.json.JSONArray;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.ContentReadingLogDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -49,6 +65,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.adf.net.http.HttpResponse;
import static org.chromium.net.NetError.ERR_FAILED;
......@@ -63,6 +80,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private final String TAG = "ChatWebviewActivity";
private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/index.html";
//private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/networkError.html";
private final String CHAT_PAGE_URL = "file:///android_asset/chat/public/index.html";
//AISDevelop
private JsInf jsInf = new JsInf();
......@@ -70,6 +89,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private ValueCallback<Uri[]> mUploadMessage;
private String sid, roomName, loginId, shopName;
private boolean isOnline;
private Long roomId;
public AlertDialog myAlertDialog;
......@@ -79,6 +99,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private BroadcastReceiver receiver;
private CommunicationLogic communicationLogic = AbstractLogic.getLogic(CommunicationLogic.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -93,13 +115,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
roomName = intent.getStringExtra("roomName");
loginId = intent.getStringExtra("loginId");
shopName = intent.getStringExtra("shopName");
isOnline = false;
//ネットワークがない場合専用のページを表示。
chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER;
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
try {
if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) {
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
isOnline = true;
chatWebviewUrl = CHAT_PAGE_URL;
}
} catch (Exception e) {
Logger.d("SID_CHECK_ERROR");
......@@ -136,6 +160,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, "");
mChatWebView.addJavascriptInterface(jsInf, "android");
String fixedParam = "&platform=android&isMobile=true&chatServerUrl=" + ABVEnvironment.getInstance().websocketServerHttpUrl;
//ページをロード
if(roomId != 0 && roomName != null) { // by push message
......@@ -510,6 +535,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
public void getQueryParam() {
String chatServerUrl = ABVEnvironment.getInstance().websocketServerHttpUrl;
chatServerUrl= chatServerUrl.substring(0, chatServerUrl.length() - 3);
String cmsServerUrl = ABVEnvironment.getInstance().acmsAddress+ ABVDataCache.getInstance().getUrlPath();
mChatWebView.loadUrl(String.format("javascript:getGlobalParam('%s', '%s', '%s', '%s', '%s');", chatServerUrl, cmsServerUrl, "android", true, isOnline));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
......@@ -593,6 +626,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public void getGlobalParameter() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
getQueryParam();
}
});
}
@JavascriptInterface
public void goHome() {
mChatWebView.post(new Runnable() {
@Override
......@@ -640,6 +683,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
}
@JavascriptInterface
public String getRoomList() {
Map<String, Object> chatRoomList;
String chatRoomListStr = communicationLogic.getChatRoomList();
return chatRoomListStr;
}
@JavascriptInterface
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList);
}
}
/**
......
......@@ -38,6 +38,8 @@ app_versioncode=1
# abvEnvironments.xml
#cms server
#acms_address=http://10.0.2.2:8081/acms
#download_server_address=http://10.0.2.2:8081/acms
acms_address=https://chatdev2.abook.bz/acms
download_server_address=https://chatdev2.abook.bz/acms
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment