1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Simulating fullscreen mode

It works now in every modern browser and does not throw a warning.
This commit is contained in:
Tim Düsterhus 2012-06-28 18:26:55 +02:00
parent ec8843fa1e
commit 32d16f4213
2 changed files with 23 additions and 47 deletions

View File

@ -174,32 +174,12 @@ window.console ?=
icon.attr 'src', icon.attr('src').replace /disabled(Inverse)?.([a-z]{3})$/, 'enabled$1.$2'
element.attr 'title', element.data 'disableMessage'
main = $('#main')[0]
if typeof main.requestFullscreen isnt 'undefined' or typeof main.mozRequestFullScreen isnt 'undefined' or typeof main.webkitRequestFullScreen isnt 'undefined'
# Enable fullscreen-mode on #main
$('#timsChatFullscreen').click (event) ->
if $(@).data 'status'
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').parent().remove()
# Enable fullscreen-mode
$('#timsChatFullscreen').click (event) ->
if $(@).data 'status'
$('html').addClass('fullscreen');
else
$('html').removeClass('fullscreen');
# Immediatly scroll down when activating autoscroll
$('#timsChatAutoscroll').click (event) ->

View File

@ -279,30 +279,26 @@ .sidebarContent {
}
}
#tplChat {
#main:-moz-full-screen {
height: 100%;
margin: 0;
padding: 0;
html.fullscreen {
height: 100%;
overflow: hidden;
> div, .sidebar, #sidebarContainer {
height: 100%;
}
#pageHeader, #pageFooter {
display: none;
}
#main:-webkit-full-screen {
#tplChat {
height: 100%;
margin: 0;
padding: 0;
> div, .sidebar, #sidebarContainer {
height: 100%;
}
}
#main:fullscreen {
height: 100%;
margin: 0;
padding: 0;
> div, .sidebar, #sidebarContainer {
overflow: hidden;
#main {
height: 100%;
margin: 0;
padding: 0;
> div, .sidebar, #sidebarContainer {
height: 100%;
}
}
}
}