 
 # Fire the ready function on load and refresh.
 $(document).ready(ready_dvd)
-$(document).on('page:load', ready_dvd)+$(document).on('page:load', ready_dvd)

@toggleFullScreen = (player) ->
  if not document.fullscreenElement && not document.mozFullScreenElement && not document.webkitFullscreenElement &&
  not document.msFullscreenElement
   
    if (player.requestFullscreen)
      player.requestFullscreen()
    else if (player.msRequestFullscreen)

    # Disable spacebar paging.
    #
    if $('video').length != 0
      $('video').on 'focus', (e) ->
        $(window).on 'keydown', (e) ->
          return !(e.keyCode == 32);

    # Re-enable space bar.
    $('video').on 'blur', (e) ->
      $(window).off 'keydown'

    # Save playback_time when paused.
    $('.player').on 'pause', (e) ->
