diff --git a/file/js/be.bastelstu.WCF.Chat.coffee b/file/js/be.bastelstu.WCF.Chat.coffee index 894da3b..e4b802e 100644 --- a/file/js/be.bastelstu.WCF.Chat.coffee +++ b/file/js/be.bastelstu.WCF.Chat.coffee @@ -172,29 +172,32 @@ window.console ?= 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 $(@).data 'status' - main = $('#main')[0] - if typeof main.requestFullscreen isnt 'undefined' - main.requestFullscreen() - else if typeof main.mozRequestFullScreen isnt 'undefined' - main.mozRequestFullScreen() - else if typeof main.webkitRequestFullScreen isnt 'undefined' - main.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT) - else - if typeof document.exitFullscreen isnt 'undefined' - document.exitFullscreen() - else if typeof document.mozCancelFullScreen isnt 'undefined' - document.mozCancelFullScreen() - 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(); + if document.fullscreen or document.mozFullScreen or document.webkitIsFullScreen + # Enable fullscreen-mode on #main + $('#timsChatFullscreen').click (event) -> + if $(@).data 'status' + main = $('#main')[0] + if typeof main.requestFullscreen isnt 'undefined' + main.requestFullscreen() + else if typeof main.mozRequestFullScreen isnt 'undefined' + main.mozRequestFullScreen() + else if typeof main.webkitRequestFullScreen isnt 'undefined' + main.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT) + else + if typeof document.exitFullscreen isnt 'undefined' + document.exitFullscreen() + else if typeof document.mozCancelFullScreen isnt 'undefined' + document.mozCancelFullScreen() + 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() + else + $('#timsChatFullscreen').remove() # Immediatly scroll down when activating autoscroll $('#timsChatAutoscroll').click (event) ->