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' $('#timsChatFullscreen').click (event) ->
# Enable fullscreen-mode on #main if $(@).data 'status'
$('#timsChatFullscreen').click (event) -> $('html').addClass('fullscreen');
if $(@).data 'status' else
if typeof main.requestFullscreen isnt 'undefined' $('html').removeClass('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
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()
# Immediatly scroll down when activating autoscroll # Immediatly scroll down when activating autoscroll
$('#timsChatAutoscroll').click (event) -> $('#timsChatAutoscroll').click (event) ->

View File

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