OSDN Git Service

チャットボットウィジェット更新。
authornaoki hirata <naoki@magic3.org>
Tue, 11 Sep 2018 13:22:40 +0000 (22:22 +0900)
committernaoki hirata <naoki@magic3.org>
Tue, 11 Sep 2018 13:22:40 +0000 (22:22 +0900)
widgets/repl_chat/include/container/repl_chatWidgetContainer.php
widgets/repl_chat/include/template/index.tmpl.html

index 59d1caa..0866963 100644 (file)
@@ -27,7 +27,6 @@ class repl_chatWidgetContainer extends BaseWidgetContainer
        const SESSION_KEY_APP_USER_ID = 'app_user_id';                          // チャットユーザID保存用セッションキー
        const DEFAULT_BOT_AVATAR = 'bot.png';           // チャットボットアバター画像
        const DEFAULT_GUEST_AVATAR = 'guest.png';       // ゲストアバター画像
-       const AVATAR_IMAGE_SIGE = 50;                           // アバター画像サイズ
        
        /**
         * コンストラクタ
index d3594ce..fdb77c2 100644 (file)
@@ -48,14 +48,16 @@ $(function(){
        html += '</div>';
        html += '<div class="row border-chat">';
        html += '<div class="third-section text-bar">';
+       html += '<form action="#" method="post" id="chat_form">';
        html += '<input type="hidden" id="chat_token" value="{TOKEN}">';
        html += '<input type="text" id="chat_message" placeholder="メッセージをどうぞ">';
+       html += '</form>';
        html += '</div>';
        html += '<div class="text-right text-bar-icon"><a href="javascript:void(0);" id="chat_sendmessage"><i class="fa fa-arrow-right" aria-hidden="true"></i></a></div>';
        html += '</div>';
        html += '</div>';
        $("body").append(html);
-       
+
        // チャット初期処理
        function init()
        {
@@ -92,7 +94,10 @@ $(function(){
                init();
                $('#repl_chat').toggleClass("open-chat");
        });
-       $("#chat_sendmessage").click(function(){
+       
+       // メッセージ送信処理
+       //$("#chat_sendmessage").click(function(){
+       $('#chat_form').submit(function(){
                var message = $('#chat_message').val();
                if (message == '') return;
                
@@ -127,6 +132,7 @@ $(function(){
                }, function(request){           // 異常終了
                        alert('通信に失敗しました。');
                });
+               return false;                   // SUBMITは行わない
        });
        
 <patTemplate:tmpl name="show_panel_open" visibility="hidden">