1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-09 00:20:08 +00:00

Add duplicate tab detection

This commit is contained in:
Tim Düsterhus 2013-05-24 15:30:18 +02:00
parent 2d73af2b8c
commit c1f8eb15f1
3 changed files with 20 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat * @package be.bastelstu.chat
*/ */
// include config // include config
require_once(__DIR__.'/config.inc.php'); require_once(__DIR__.'/config.inc.php');

View File

@ -5,5 +5,6 @@
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat * @package be.bastelstu.chat
*/ */
require_once(__DIR__.'/global.php'); require_once(__DIR__.'/global.php');
wcf\system\request\RequestHandler::getInstance()->handle('chat'); \wcf\system\request\RequestHandler::getInstance()->handle('chat');

View File

@ -31,6 +31,7 @@ exposed by a function if necessary.
isActive = true isActive = true
newMessageCount = 0 newMessageCount = 0
chatSession = Date.now()
remainingFailures = 3 remainingFailures = 3
@ -274,6 +275,21 @@ Scroll down when autoscroll is being activated.
if $('#timsChatAutoscroll').data('status') is 0 if $('#timsChatAutoscroll').data('status') is 0
$('#timsChatAutoscroll').click() $('#timsChatAutoscroll').click()
Enable duplicate tab detection.
window.localStorage.setItem 'be.bastelstu.chat.session', chatSession
$(window).on 'storage', (event) ->
if event.originalEvent.key is 'be.bastelstu.chat.session'
if event.originalEvent.newValue isnt chatSession
loading = true
pe.refreshRoomList.stop()
pe.getMessages.stop()
$("""<div id="timsChatLoadingErrorDialog">#{WCF.Language.get('chat.general.error.duplicateTab')}</div>""").appendTo('body') unless $.wcfIsset('timsChatLoadingErrorDialog')
$('#timsChatLoadingErrorDialog').wcfDialog
closable: false
title: WCF.Language.get('wcf.global.error.title')
Ask for permissions to use Desktop notifications when notifications are activated. Ask for permissions to use Desktop notifications when notifications are activated.
if window.Notification? if window.Notification?