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

View File

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