1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Codeformat and fullscreen-event

This commit is contained in:
Tim Düsterhus 2012-06-16 21:03:29 +02:00
parent f5a5d21f6d
commit a95896ae28

View File

@ -165,16 +165,16 @@ window.console ?=
icon = element.find 'img'
if element.data('status') is 1
element.data 'status', 0
icon.attr 'src', icon.attr('src').replace /enabled(\d?).([a-z]{3})$/, 'disabled$1.$2'
icon.attr 'src', icon.attr('src').replace /enabled(Inverse)?.([a-z]{3})$/, 'disabled$1.$2'
element.attr 'title', element.data 'enableMessage'
else
element.data 'status', 1
icon.attr 'src', icon.attr('src').replace /disabled(\d?).([a-z]{3})$/, 'enabled$1.$2'
icon.attr 'src', icon.attr('src').replace /disabled(Inverse)?.([a-z]{3})$/, 'enabled$1.$2'
element.attr 'title', element.data 'disableMessage'
# Enable fullscreen-mode on #main
$('#timsChatFullscreen').click (event) ->
if $(this).data 'status'
if $(@).data 'status'
main = $('#main')[0]
if typeof main.requestFullscreen isnt 'undefined'
main.requestFullscreen()
@ -190,17 +190,23 @@ window.console ?=
else if typeof document.webkitCancelFullScreen isnt 'undefined'
document.webkitCancelFullScreen()
# Bind Fullscreen-change event
$(document).on 'fullscreenchange mozfullscreenchange webkitfullscreenchange', (event) ->
if $('#timsChatFullscreen').data 'status'
unless document.fullscreen or document.mozFullScreen or document.webkitIsFullScreen
$('#timsChatFullscreen').click();
# Immediatly scroll down when activating autoscroll
$('#timsChatAutoscroll').click (event) ->
$(this).removeClass 'active'
if $(this).data 'status'
$(@).removeClass 'active'
if $(@).data 'status'
$('.timsChatMessageContainer').scrollTop $('.timsChatMessageContainer ul').height()
@oldScrollTop = $('.timsChatMessageContainer').scrollTop()
# Desktop Notifications
unless typeof window.webkitNotifications is 'undefined'
$('#timsChatNotify').click (event) ->
window.webkitNotifications.requestPermission() if $(this).data 'status'
window.webkitNotifications.requestPermission() if $(@).data 'status'
###
# Changes the chat-room.