Fullscreen.ts 644 B

123456789101112131415
  1. /// <reference path="../Elements.ts" />
  2. function toggleFullScreen() {
  3. var doc = <any> window.document;
  4. var docEl = <any> doc.documentElement;
  5. var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;
  6. var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;
  7. if(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement) {
  8. requestFullScreen.call(docEl);
  9. }
  10. else {
  11. cancelFullScreen.call(doc);
  12. }
  13. }