PageSourceSearch

https://eolivia.com/wp-content/plugins/wd-facebook-feed/js/jquery.fullscreen-0.4.1.js?ver=0.4.1

js eolivia.com collected 2026-09-24 22:18:28 UTC 7,583 bytes, 269 lines download raw bytes

1/*
2 * jQuery.fullscreen library v0.4.0
3 * Copyright (c) 2013 Vladimir Zhuravlev
4 *
5 * @license https://github.com/private-face/jquery.fullscreen/blob/master/LICENSE
6 *
7 * Date: Wed Dec 11 22:45:17 ICT 2013
8 **/
9;(function($) {
10
11function defined(a) {
12	return typeof a !== 'undefined';
13}
14
15function extend(child, parent, prototype) {
16    var F = function() {};
17    F.prototype = parent.prototype;
18    child.prototype = new F();
19    child.prototype.constructor = child;
20	parent.prototype.constructor = parent;
21    child._super = parent.prototype;
22    if (prototype) {
23        $.extend(child.prototype, prototype);
24    }
25}
26
27var SUBST = [
28    ['', ''],               // spec
29    ['exit', 'cancel'],     // firefox & old webkits expect cancelFullScreen instead of exitFullscreen
30    ['screen', 'Screen']    // firefox expects FullScreen instead of Fullscreen
31];
32
33var VENDOR_PREFIXES = ['', 'o', 'ms', 'moz', 'webkit', 'webkitCurrent'];
34
35function native(obj, name) {
36    var prefixed;
37
38    if (typeof obj === 'string') {
39        name = obj;
40        obj = document;
41    }
42
43    for (var i = 0; i < SUBST.length; ++i) {
44        name = name.replace(SUBST[i][0], SUBST[i][1]);
45        for (var j = 0; j < VENDOR_PREFIXES.length; ++j) {
46            prefixed = VENDOR_PREFIXES[j];
47            prefixed += j === 0 ? name : name.charAt(0).toUpperCase() + name.substr(1);
48            if (defined(obj[prefixed])) {
49                return obj[prefixed];
50            }
51        }
52    }
53
54    return void 0;
55}var ua = navigator.userAgent;
56var fsEnabled = native('fullscreenEnabled');
57var IS_ANDROID_CHROME = ua.indexOf('Android') !== -1 && ua.indexOf('Chrome') !== -1; 
58var IS_NATIVELY_SUPPORTED = 
59		!IS_ANDROID_CHROME &&
60		 defined(native('fullscreenElement')) && 
61		(!defined(fsEnabled) || fsEnabled === true);
62
63var version = $.fn.jquery.split('.');
64var JQ_LT_17 = (parseInt(version[0]) < 2 && parseInt(version[1]) < 7);
65
66var FullScreenAbstract = function() {
67	this.__options = null;
68	this._fullScreenElement = null;
69	this.__savedStyles = {};
70};
71
72FullScreenAbstract.prototype = {
73	_DEFAULT_OPTIONS: {
74		styles: {
75			'boxSizing': 'border-box',
76			'MozBoxSizing': 'border-box',
77			'WebkitBoxSizing': 'border-box'
78		},
79		toggleClass: null
80	},
81	__documentOverflow: '',
82	__htmlOverflow: '',
83	_preventDocumentScroll: function() {
84		this.__documentOverflow = $('body')[0].style.overflow;
85		this.__htmlOverflow = $('html')[0].style.overflow;
86		// $('body, html').css('overflow', 'hidden');
87	},
88	_allowDocumentScroll: function() {
89		// $('body')[0].style.overflow = this.__documentOverflow;
90		// $('html')[0].style.overflow = this.__htmlOverflow;
91	},
92	_fullScreenChange: function() {
93		if (!this.isFullScreen()) {
94			this._allowDocumentScroll();
95			this._revertStyles();
96			this._triggerEvents();
97			this._fullScreenElement = null;
98		} else {
99			this._preventDocumentScroll();
100			this._triggerEvents();
101		}
102	},
103	_fullScreenError: function(e) {
104		this._revertStyles();
105		this._fullScreenElement = null;
106		if (e) {
107			$(document).trigger('fscreenerror', [e]);
108		}
109	},
110	_triggerEvents: function() {
111		$(this._fullScreenElement).trigger(this.isFullScreen() ? 'fscreenopen' : 'fscreenclose');
112		$(document).trigger('fscreenchange', [this.isFullScreen(), this._fullScreenElement]);
113	},
114	_saveAndApplyStyles: function() {
115		var $elem = $(this._fullScreenElement);
116		this.__savedStyles = {};
117		for (var property in this.__options.styles) {
118			// save
119			this.__savedStyles[property] = this._fullScreenElement.style[property];
120			// apply
121			this._fullScreenElement.style[property] = this.__options.styles[property];
122		}
123		if (this.__options.toggleClass) {
124			$elem.addClass(this.__options.toggleClass);
125		}
126	},
127	_revertStyles: function() {
128		var $elem = $(this._fullScreenElement);
129		for (var property in this.__options.styles) {
130			this._fullScreenElement.style[property] = this.__savedStyles[property];
131		}
132		if (this.__options.toggleClass) {
133			$elem.removeClass(this.__options.toggleClass);
134		}
135	},
136	open: function(elem, options) {
137		// do nothing if request is for already fullscreened element
138		if (elem === this._fullScreenElement) {
139			return;
140		}
141		// exit active fullscreen before opening another one
142		if (this.isFullScreen()) {
143			this.exit();
144		}
145		// save fullscreened element
146		this._fullScreenElement = elem;
147		// apply options, if any
148		this.__options = $.extend(true, {}, this._DEFAULT_OPTIONS, options);
149		// save current element styles and apply new
150		this._saveAndApplyStyles();
151	},
152	exit: null,
153	isFullScreen: null,
154	isNativelySupported: function() {
155		return IS_NATIVELY_SUPPORTED;
156	}
157};
158var FullScreenNative = function() {
159	FullScreenNative._super.constructor.apply(this, arguments);
160	this.exit = $.proxy(native('exitFullscreen'), document);
161	this._DEFAULT_OPTIONS = $.extend(true, {}, this._DEFAULT_OPTIONS, {
162		'styles': {
163			'width': '100%',
164			'height': '100%'
165		}
166	});
167	$(document)
168		.bind(this._prefixedString('fullscreenchange') + ' MSFullscreenChange', $.proxy(this._fullScreenChange, this))
169		.bind(this._prefixedString('fullscreenerror') + ' MSFullscreenError', $.proxy(this._fullScreenError, this));
170};
171
172extend(FullScreenNative, FullScreenAbstract, {
173	VENDOR_PREFIXES: ['', 'o', 'moz', 'webkit'],
174	_prefixedString: function(str) {
175		return $.map(this.VENDOR_PREFIXES, function(s) {
176			return s + str;
177		}).join(' ');
178	},
179	open: function(elem, options) {
180		FullScreenNative._super.open.apply(this, arguments);
181		var requestFS = native(elem, 'requestFullscreen');
182		requestFS.call(elem);
183	},
184	exit: $.noop,
185	isFullScreen: function() {
186		return native('fullscreenElement') !== null;
187	},
188	element: function() {
189		return native('fullscreenElement');
190	}
191});
192var FullScreenFallback = function() {
193	FullScreenFallback._super.constructor.apply(this, arguments);
194	this._DEFAULT_OPTIONS = $.extend({}, this._DEFAULT_OPTIONS, {
195		'styles': {
196			'position': 'fixed',
197			'zIndex': '2147483647',
198			'left': 0,
199			'top': 0,
200			'bottom': 0,
201			'right': 0
202		}
203	});
204	this.__delegateKeydownHandler();
205};
206
207extend(FullScreenFallback, FullScreenAbstract, {
208	__isFullScreen: false,
209	__delegateKeydownHandler: function() {
210		var $doc = $(document);
211		$doc.delegate('*', 'keydown.fullscreen', $.proxy(this.__keydownHandler, this));
212		var data = JQ_LT_17 ? $doc.data('events') : $._data(document).events;
213		var events = data['keydown'];
214		if (!JQ_LT_17) {
215			events.splice(0, 0, events.splice(events.delegateCount - 1, 1)[0]);
216		} else {
217			data.live.unshift(data.live.pop());
218		}
219	},
220	__keydownHandler: function(e) {
221		if (this.isFullScreen() && e.which === 27) {
222			this.exit();
223			return false;
224		}
225		return true;
226	},
227	_revertStyles: function() {
228		FullScreenFallback._super._revertStyles.apply(this, arguments);
229		// force redraw (fixes bug in IE7 with content dissapearing)
230		this._fullScreenElement.offsetHeight;
231	},
232	open: function(elem) {
233		FullScreenFallback._super.open.apply(this, arguments);
234		this.__isFullScreen = true;
235		this._fullScreenChange();
236	},
237	exit: function() {
238		this.__isFullScreen = false;
239		this._fullScreenChange();
240	},
241	isFullScreen: function() {
242		return this.__isFullScreen;
243	},
244	element: function() {
245		return this.__isFullScreen ? this._fullScreenElement : null;
246	}
247});$.fullscreen = IS_NATIVELY_SUPPORTED 
248				? new FullScreenNative() 
249				: new FullScreenFallback();
250
251$.fn.fullscreen = function(options) {
252	var elem = this[0];
253
254	options = $.extend({
255		toggleClass: null,
256		// overflow: 'hidden'
257	}, options);
258	options.styles = {
259		// overflow: options.overflow
260	};
261	// delete options.overflow;
262
263	if (elem) {
264		$.fullscreen.open(elem, options);
265	}
266
267	return this;
268};
269})(jQuery);

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.