Commit dc5fd359 by Kim Peace

Tree Shaking for JS

parent 954849fb
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- view --> <!-- view -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- view --> <!-- view -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
...@@ -171,6 +171,7 @@ ...@@ -171,6 +171,7 @@
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
<script src="./js/utils/chat-media-handler.js"></script>
<script src="./js/chat-room.js"></script> <script src="./js/chat-room.js"></script>
<script src="./js/common/loading.js"></script> <script src="./js/common/loading.js"></script>
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- Socket --> <!-- Socket -->
<script src="./js/sockets/chat-websocket.js"></script> <script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script> <script src="./js/sockets/chat-websocket-message.js"></script>
......
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
<script src="./js/common/native-bridge-delegate.js"></script> <script src="./js/common/native-bridge-delegate.js"></script>
<script src="./js/common/native-bridge-datasource.js"></script> <script src="./js/common/native-bridge-datasource.js"></script>
<script src="./js/common/common.js"></script> <script src="./js/common/common.js"></script>
<script src="./js/chat-util.js"></script> <script src="./js/utils/chat-util.js"></script>
<!-- View --> <!-- View -->
<script src="./js/chat.js"></script> <script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script> <script src="./js/chat-ui.js"></script>
......
...@@ -17,79 +17,6 @@ $("#messageInput").on("keypress", function (event) { ...@@ -17,79 +17,6 @@ $("#messageInput").on("keypress", function (event) {
} }
}); });
// 写真アップロード
$("#imageInputButton").on("click", function () {
$("#imageInputTag").click();
});
// 動画アップロード
$("#videoUploadButton").on("click", function () {
$("#videoInputTag").click();
});
$("#imageInputTag").on("change", function () {
$("#image-form").submit();
// reset the value of form
$("#imageInputTag").val("");
});
$("#videoInputTag").on("change", function () {
$("#video-form").submit();
// reset the value of form
$("#videoInputTag").val("");
});
$("#image-form").on("submit", function (e) {
e.preventDefault();
const imageInputTag = $("#imageInputTag");
const file = imageInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
console.log($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成
CHAT.createThumbnailAndUpload(
file,
function (resizeFile, thumbnailCreated) {
if (resizeFile && thumbnailCreated) {
//ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
fd.append("thumb", resizeFile);
}
// イメージをアップロード
CHAT.uploadImage(fd);
}
);
}
});
$("#video-form").on("submit", function (e) {
e.preventDefault();
const videoInputTag = $("#videoInputTag");
const file = videoInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
if (!file.type.includes("image")) {
// video 保存
// CHAT.createVideoThumbnailAndUpload(file, function(resizeFile, thumbnailCreated) {
// if(resizeFile && thumbnailCreated) {
// //ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
// fd.append('thumb', resizeFile)
// }
// CHAT.uploadImage(fd);
// })
CHAT.uploadImage(fd);
return;
}
}
});
$("#tabDM").on("click", function (e) { $("#tabDM").on("click", function (e) {
CHAT_UI.refreshRoomList(ChatRoomType.DM); CHAT_UI.refreshRoomList(ChatRoomType.DM);
}); });
......
...@@ -78,22 +78,6 @@ CHAT_UI.scrollToBottom = function () { ...@@ -78,22 +78,6 @@ CHAT_UI.scrollToBottom = function () {
); );
}; };
CHAT_UI.scrollToLastMarkedUnseen = function (value) {
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);
}
};
//loadingIndicatorを表示 //loadingIndicatorを表示
CHAT_UI.showLoadingIndicator = function () { CHAT_UI.showLoadingIndicator = function () {
var h = $(window).height(); var h = $(window).height();
......
var chatMediaHandler = {};
/**
* Image Upload
**/
// 写真アップロード
$("#imageInputButton").on("click", function () {
$("#imageInputTag").click();
});
$("#imageInputTag").on("change", function () {
$("#image-form").submit();
// reset the value of form
$("#imageInputTag").val("");
});
$("#image-form").on("submit", function (e) {
e.preventDefault();
const imageInputTag = $("#imageInputTag");
const file = imageInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
console.log($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成
CHAT.createThumbnailAndUpload(
file,
function (resizeFile, thumbnailCreated) {
if (resizeFile && thumbnailCreated) {
//ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
fd.append("thumb", resizeFile);
}
// イメージをアップロード
CHAT.uploadImage(fd);
}
);
}
});
/**
* Video Upload
**/
// 動画アップロード
$("#videoUploadButton").on("click", function () {
$("#videoInputTag").click();
});
$("#videoInputTag").on("change", function () {
$("#video-form").submit();
// reset the value of form
$("#videoInputTag").val("");
});
$("#video-form").on("submit", function (e) {
e.preventDefault();
const videoInputTag = $("#videoInputTag");
const file = videoInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
if (!file.type.includes("image")) {
// video 保存
// CHAT.createVideoThumbnailAndUpload(file, function(resizeFile, thumbnailCreated) {
// if(resizeFile && thumbnailCreated) {
// //ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
// fd.append('thumb', resizeFile)
// }
// CHAT.uploadImage(fd);
// })
CHAT.uploadImage(fd);
return;
}
}
});
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