Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- / -------------- This iframe can contain code under -------------
- %iframe{"src" => "http://haml.info",
- "allowfullscreen" => "true",
- "mozallowfullscreen" => "true",
- "webkitallowfullscreen" => "true",
- "scrolling" => "no",
- "frameborder" => "0",
- "border" => "0",
- "hspace" => "0",
- "vspace" => "0",
- "marginheight" => "0",
- "marginwidth" => "0",
- "width" => "200",
- "height" => "100"}
- / -------------- This code can require fullscreenmode(dont forget to use doctype and body element :P) --------------
- %hr
- %section#game{"ng-app"=>"Haven"}
- %header.root{"top-bar" => ''}
- %section.root{"ng-view" => '', "unrightclickable" => ''}
- %div{"message" => ''}
- %div{"overlay" => ''}
- %div{"game-hints" => ''}
- %button#blabla{onclick: 'toggleFullScreen()'}
- blabla
- :coffee
- # example 1: expand sertain element
- toggleFullScreen = ->
- if not document.mozFullScreen and not document.webkitFullScreen
- if videoElement.mozRequestFullScreen
- videoElement.mozRequestFullScreen()
- else
- videoElement.webkitRequestFullScreen Element.ALLOW_KEYBOARD_INPUT
- else
- if document.mozCancelFullScreen
- document.mozCancelFullScreen()
- else
- document.webkitCancelFullScreen()
- return
- videoElement = document.getElementById("game")
- document.addEventListener "keydown", ((e) ->
- toggleFullScreen() if e.keyCode is 13
- return
- ), false
- :coffee
- # example 2: expand whole document
- window.get_first_of_this = (obj, vals) ->
- call = call or false
- has_one = null
- for name in vals
- item = obj[name]
- if item?
- has_one =
- the_one: item
- name: name
- break;
- has_one
- window.toggleFullScreen = ->
- elementsList = [
- "fullscreenElement" # alternative standard method
- # current working methods
- "mozFullScreenElement"
- "webkitFullscreenElement"
- "msFullscreenElement"
- ]
- requestList = [
- "requestFullscreen"
- "msRequestFullscreen"
- "mozRequestFullScreen"
- "webkitRequestFullscreen"
- ]
- exitList = [
- "exitFullscreen"
- "msExitFullscreen"
- "mozCancelFullScreen"
- "webkitExitFullscreen"
- ]
- unless get_first_of_this(document, elementsList)
- _t = document.documentElement
- item = get_first_of_this(document.documentElement, requestList)
- args = if item.name is "webkitRequestFullscreen"
- [Element.ALLOW_KEYBOARD_INPUT]
- else
- []
- else if item = get_first_of_this(document, exitList)
- _t = document
- args = []
- item.the_one.apply _t, args if item
- return
Advertisement
Add Comment
Please, Sign In to add comment