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

Remove fullscreen button, when fullscreen is not supported

This commit is contained in:
Tim Düsterhus 2012-06-17 17:37:58 +02:00
parent a95896ae28
commit fc378725e7

View File

@ -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) ->