Skip to content
This repository has been archived by the owner on Jun 5, 2022. It is now read-only.

Commit

Permalink
Chat balloons work again, so does the on/off switch
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfrerichs committed Jul 31, 2018
1 parent 065f270 commit fd3badd
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion application/controllers/Sse.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function stream($sse_func = "")

// CHATS get sent when new chat's arrive by watching the chat_key for changes. These are also sent
// regardless of which page a user is on.
if ((1==1 || $this->session->userdata('chat_balloon')) && $last_keys->chat_key != $keys->chat_key)
if ($this->session->userdata('chat_balloon') && $last_keys->chat_key != $keys->chat_key)
{
// If the chat_key is new, output chats that occured since the last one.
// Need a way to know to send chats if chat_balloon is disabled...ran into complications because two windows could be open.
Expand Down
4 changes: 2 additions & 2 deletions application/views/template/body_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@

<!-- Leave these at the end since they may require the above -->
<script src="<?=site_url('js/fflproject.js?1.02')?>"></script>
<script src="<?=site_url('js/fflproject-sse.js?1.03')?>"></script>
<script src="<?=site_url('js/fflproject-chat.js?1.07')?>"></script>
<script src="<?=site_url('js/fflproject-sse.js?1.06')?>"></script>
<script src="<?=site_url('js/fflproject-chat.js?1.09')?>"></script>
2 changes: 1 addition & 1 deletion application/views/template/head_css.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<link href="<?=site_url('/css/jBox.Notice.css')?>" rel="stylesheet">

<!-- My custom CSS -->
<link href="<?=site_url('/css/fflproject-chat.css?5')?>" rel="stylesheet">
<link href="<?=site_url('/css/fflproject-chat.css?7')?>" rel="stylesheet">
<link href="<?=site_url('/css/fflproject.css?1')?>" rel="stylesheet">
2 changes: 1 addition & 1 deletion application/views/template/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Chat
</span>
</button> -->
<div class="navbar-burger burger" data-target="navMenuTransparentExample">
<div id="fflp-navbar-burger" class="navbar-burger burger" data-target="navMenuTransparentExample">
<span></span>
<span></span>
<span></span>
Expand Down
9 changes: 8 additions & 1 deletion css/fflproject-chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@
.jBox-chat .jBox-content{padding-top:0px !important; padding-left:5px !important; padding-right:5px !important;}
.jBox-chat .jBox-title{text-align: center; font-size:1.2em; background-color: #276cda; color:#EEE; text-shadow: 0 0 0 ; padding:0;}


.chat-popup-title {text-decoration:underline;}
.chat-popup-body {font-size: .8em;}

.Tooltip-chat{}
/*.Tooltip-chat .jBox-content{background-color:#2199e8; color:#EEE;}
.Tooltip-chat .jBox-pointer:after{background-color:#2199e8;}*/

.Tooltip-chat .jBox-content{border: 2px solid #2199e8;}
.Tooltip-chat .jBox-pointer:after{border: 2px solid #2199e8;}
.Tooltip-chat .jBox-pointer:after{border: 2px solid #2199e8;}

.Tooltip-chat .jBox-content{background-color:#276cda;}

4 changes: 2 additions & 2 deletions js/fflproject-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ function chatScrollBottom(set)

function chatOpen()
{
return $('#chat-modal').data('open');
// return $('#chat-modal').is(':visible');
// return $('#chat-modal').data('open');
return $('#chat-modal').is(':visible');
}

function markChatsRead()
Expand Down
29 changes: 20 additions & 9 deletions js/fflproject-sse.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,29 @@ function sse_chat_events(chat)
$.each(chat,function(i, msg){
// This is for the popup ballons.
// Don't show these for mobile view.
if (chatOpen() != true && $("#chat-button").is(":visible") && msg.is_me == 0)
if (chatOpen() != true && !$("#fflp-navbar-burger").is(":visible") && msg.is_me == 0)
{
var text = "<b>"+msg.chat_name+"</b><br><i>"+msg.message_text+"</i>";
var chat_jbox = new jBox('Tooltip', {
// Leaving this, prepend if I decide to use a title
var popup_title = "<div class='chat-popup-title has-text-centered'>League Chat</div>";
var text = "<div class='chat-popup-body'><b class='chat-popup-name'>"+msg.chat_name+"</b>"
+"<br><i class='chat-popup-message'>"+msg.message_text+"</i></div>";
var closeTime = 10000;
if (msg.message_text.length > 200){closeTime = 20000;}

new jBox('Notice', {
content: text,
target: $("#chat-button"),
width: 200,
addClass: 'Tooltip-chat',
stack: false
attributes: {
x: 'right',
y: 'bottom'
},
color:'blue',
stack: true,
minWidth: 200,
maxWidth: 300,
minHeight: 75,
autoClose: closeTime,
animation: {open: 'pulse', close: 'pulse'}
});
chat_jbox.open();
setTimeout(function(){chat_jbox.close();},4000);
}
// If chatbox exists, append the chats
if (typeof(cb) != undefined)
Expand Down

0 comments on commit fd3badd

Please sign in to comment.