PageSourceSearch

https://torqit.com.au/wp-content/plugins/woo-3d-viewer/includes/ext/threex/THREEx.FullScreen.js?ver=1.8.7

js torqit.com.au collected 2026-09-24 13:09:51 UTC 2,197 bytes, 77 lines download raw bytes

1// This THREEx helper makes it easy to handle the fullscreen API
2// * it hides the prefix for each browser
3// * it hides the little discrepencies of the various vendor API
4// * at the time of this writing (nov 2011) it is available in 
5//   [firefox nightly](http://blog.pearce.org.nz/2011/11/firefoxs-html-full-screen-api-enabled.html),
6//   [webkit nightly](http://peter.sh/2011/01/javascript-full-screen-api-navigation-timing-and-repeating-css-gradients/) and
7//   [chrome stable](http://updates.html5rocks.com/2011/10/Let-Your-Content-Do-the-Talking-Fullscreen-API).
8
9// 
10// # Code
11
12//
13
14/** @namespace */
15var THREEx		= THREEx 		|| {};
16THREEx.FullScreen	= THREEx.FullScreen	|| {};
17
18/**
19 * test if it is possible to have fullscreen
20 * 
21 * @returns {Boolean} true if fullscreen API is available, false otherwise
22*/
23THREEx.FullScreen.available	= function()
24{
25	return this._hasWebkitFullScreen || this._hasMozFullScreen;
26}
27
28/**
29 * test if fullscreen is currently activated
30 * 
31 * @returns {Boolean} true if fullscreen is currently activated, false otherwise
32*/
33THREEx.FullScreen.activated	= function()
34{
35	if( this._hasWebkitFullScreen ){
36		return document.webkitIsFullScreen;
37	}else if( this._hasMozFullScreen ){
38		return document.mozFullScreen;
39	}else{
40		console.assert(false);
41	}
42}
43
44/**
45 * Request fullscreen on a given element
46 * @param {DomElement} element to make fullscreen. optional. default to document.body
47*/
48THREEx.FullScreen.request	= function(element)
49{
50	element	= element	|| document.body;
51	if( this._hasWebkitFullScreen ){
52		element.webkitRequestFullScreen();
53	}else if( this._hasMozFullScreen ){
54		element.mozRequestFullScreen();
55	}else{
56		console.assert(false);
57	}
58}
59
60/**
61 * Cancel fullscreen
62*/
63THREEx.FullScreen.cancel	= function()
64{
65	if( this._hasWebkitFullScreen ){
66		document.webkitCancelFullScreen();
67	}else if( this._hasMozFullScreen ){
68		document.mozCancelFullScreen();
69	}else{
70		console.assert(false);
71	}
72}
73
74// internal functions to know which fullscreen API implementation is available
75THREEx.FullScreen._hasWebkitFullScreen	= 'webkitCancelFullScreen' in document	? true : false;	
76THREEx.FullScreen._hasMozFullScreen	= 'mozCancelFullScreen' in document	? true : false;	
77

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.