src_minplayer.display.js.html in HTML5 Media 7
1 /** The minplayer namespace. */
2 minplayer = minplayer || {};
3
4 /**
5 * @constructor
6 * @extends minplayer.plugin
7 * @class Base class used to provide the display and options for any component
8 * deriving from this class. Components who derive are expected to provide
9 * the elements that they define by implementing the getElements method.
10 *
11 * @param {string} name The name of this plugin.
12 * @param {object} context The jQuery context this component resides.
13 * @param {object} options The options for this component.
14 * @param {object} queue The event queue to pass events around.
15 */
16 minplayer.display = function(name, context, options, queue) {
17
18 // Derive from plugin
19 minplayer.plugin.call(this, name, context, options, queue);
20 };
21
22 /** Derive from minplayer.plugin. */
23 minplayer.display.prototype = new minplayer.plugin();
24
25 /** Reset the constructor. */
26 minplayer.display.prototype.constructor = minplayer.display;
27
28 /**
29 * Returns the display for this component.
30 *
31 * @return {object} The jQuery context for this display.
32 */
33 minplayer.display.prototype.getDisplay = function() {
34 return this.context;
35 };
36
37 /**
38 * @see minplayer.plugin.construct
39 */
40 minplayer.display.prototype.construct = function() {
41
42 // Set the display.
43 this.display = this.getDisplay(this.context, this.options);
44
45 // Call the plugin constructor.
46 minplayer.plugin.prototype.construct.call(this);
47
48 // Set the plugin name within the options.
49 this.options.pluginName = 'display';
50
51 // Get the display elements.
52 this.elements = this.getElements();
53
54 // Only do this if they allow resize for this display.
55 if (this.onResize) {
56
57 // Set the resize timeout and this pointer.
58 var resizeTimeout = 0;
59
60 // Add a handler to trigger a resize event.
61 jQuery(window).resize((function(display) {
62 return function() {
63 clearTimeout(resizeTimeout);
64 resizeTimeout = setTimeout(function() {
65 display.onResize();
66 }, 200);
67 };
68 })(this));
69 }
70 };
71
72 /**
73 * Called when the window resizes.
74 */
75 minplayer.display.prototype.onResize = false;
76
77 /**
78 * Wrapper around hide that will always not show.
79 *
80 * @param {object} element The element you wish to hide.
81 */
82 minplayer.display.prototype.hide = function(element) {
83 element = element || this.display;
84 if (element) {
85 element.forceHide = true;
86 element.unbind().hide();
87 }
88 };
89
90 /**
91 * Gets the full screen element.
92 *
93 * @return {object} The display to be used for full screen support.
94 */
95 minplayer.display.prototype.fullScreenElement = function() {
96 return this.display;
97 };
98
99 /**
100 * Fix for the click function in jQuery to be cross platform.
101 *
102 * @param {object} element The element that will be clicked.
103 * @param {function} fn Called when the element is clicked.
104 * @return {object} The element that is to be clicked.
105 */
106 minplayer.click = function(element, fn) {
107 var flag = false;
108 element = jQuery(element);
109 element.bind('touchstart click', function(event) {
110 if (!flag) {
111 flag = true;
112 setTimeout(function() {
113 flag = false;
114 }, 100);
115 fn.call(this, event);
116 }
117 });
118 return element;
119 };
120
121 /**
122 * Determines if the player is in focus or not.
123 *
124 * @param {boolean} focus If the player is in focus.
125 */
126 minplayer.display.prototype.onFocus = function(focus) {
127 this.hasFocus = this.focus = focus;
128 };
129
130 /** Keep track of all the show hide elements. */
131 minplayer.showHideElements = [];
132
133 /**
134 * Show all the show hide elements.
135 */
136 minplayer.showAll = function() {
137 var i = minplayer.showHideElements.length;
138 var obj = null;
139 while (i--) {
140 obj = minplayer.showHideElements[i];
141 minplayer.showThenHide(obj.element, obj.timeout, obj.callback);
142 }
143 };
144
145 /**
146 * Stops the whole show then hide from happening.
147 *
148 * @param {object} element The element you want the showThenHide to stop.
149 */
150 minplayer.stopShowThenHide = function(element) {
151 element = jQuery(element);
152 if (element.showTimer) {
153 clearTimeout(element.showTimer);
154 }
155 element.stopShowThenHide = true;
156 element.shown = true;
157 element.show();
158 };
159
160 /**
161 * Called if you would like for your display item to show then hide.
162 *
163 * @param {object} element The element you would like to hide or show.
164 * @param {number} timeout The timeout to hide and show.
165 * @param {function} callback Called when something happens.
166 */
167 minplayer.showThenHide = function(element, timeout, callback) {
168
169 // If no element exists, then just return.
170 if (!element) {
171 return;
172 }
173
174 // Ensure we have a timeout.
175 timeout = timeout || 5000;
176
177 // If this has not yet been configured.
178 if (!element.showTimer) {
179 element.shown = true;
180 element.stopShowThenHide = false;
181
182 // Add this to our showHideElements.
183 minplayer.showHideElements.push({
184 element: element,
185 timeout: timeout,
186 callback: callback
187 });
188
189 // Bind to a click event.
190 minplayer.click(document, function() {
191 if (!element.stopShowThenHide) {
192 minplayer.showThenHide(element, timeout, callback);
193 }
194 });
195
196 // Bind to the mousemove event.
197 jQuery(document).bind('mousemove', function() {
198 if (!element.stopShowThenHide) {
199 minplayer.showThenHide(element, timeout, callback);
200 }
201 });
202 }
203
204 // Clear the timeout, and then setup the show then hide functionality.
205 clearTimeout(element.showTimer);
206
207 // Show the display.
208 if (!element.shown && !element.forceHide) {
209 element.shown = true;
210 element.show();
211 if (callback) {
212 callback(true);
213 }
214 }
215
216 // Set a timer to hide it after the timeout.
217 element.showTimer = setTimeout(function() {
218 element.hide('slow', function() {
219 element.shown = false;
220 if (callback) {
221 callback(false);
222 }
223 });
224 }, timeout);
225 };
226
227 /**
228 * Make this display element go fullscreen.
229 *
230 * @param {boolean} full Tell the player to go into fullscreen or not.
231 */
232 minplayer.display.prototype.fullscreen = function(full) {
233 var isFull = this.isFullScreen();
234 var element = this.fullScreenElement();
235 if (isFull && !full) {
236 element.removeClass('fullscreen');
237 if (screenfull) {
238 screenfull.exit();
239 }
240 this.trigger('fullscreen', false);
241 }
242 else if (!isFull && full) {
243 element.addClass('fullscreen');
244 if (screenfull) {
245 screenfull.request(element[0]);
246 screenfull.onchange = (function(display) {
247 return function(e) {
248 if (!screenfull.isFullscreen) {
249 display.fullscreen(false);
250 }
251 };
252 })(this);
253 }
254 this.trigger('fullscreen', true);
255 }
256 };
257
258 /**
259 * Toggle fullscreen.
260 */
261 minplayer.display.prototype.toggleFullScreen = function() {
262 this.fullscreen(!this.isFullScreen());
263 };
264
265 /**
266 * Checks to see if we are in fullscreen mode.
267 *
268 * @return {boolean} TRUE - fullscreen, FALSE - otherwise.
269 */
270 minplayer.display.prototype.isFullScreen = function() {
271 return this.fullScreenElement().hasClass('fullscreen');
272 };
273
274 /**
275 * Returns a scaled rectangle provided a ratio and the container rect.
276 *
277 * @param {number} ratio The width/height ratio of what is being scaled.
278 * @param {object} rect The bounding rectangle for scaling.
279 * @return {object} The Rectangle object of the scaled rectangle.
280 */
281 minplayer.display.prototype.getScaledRect = function(ratio, rect) {
282 var scaledRect = {};
283 scaledRect.x = rect.x ? rect.x : 0;
284 scaledRect.y = rect.y ? rect.y : 0;
285 scaledRect.width = rect.width ? rect.width : 0;
286 scaledRect.height = rect.height ? rect.height : 0;
287 if (ratio) {
288 if ((rect.width / rect.height) > ratio) {
289 scaledRect.height = rect.height;
290 scaledRect.width = Math.floor(rect.height * ratio);
291 }
292 else {
293 scaledRect.height = Math.floor(rect.width / ratio);
294 scaledRect.width = rect.width;
295 }
296 scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2);
297 scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2);
298 }
299 return scaledRect;
300 };
301
302 /**
303 * Returns all the jQuery elements that this component uses.
304 *
305 * @return {object} An object which defines all the jQuery elements that
306 * this component uses.
307 */
308 minplayer.display.prototype.getElements = function() {
309 return {};
310 };
311
312 /**
313 * From https://github.com/sindresorhus/screenfull.js
314 */
315 /*global Element:true*/
316 (function(window, document) {
317 'use strict';
318 var methods = (function() {
319 var methodMap = [
320 [
321 'requestFullscreen',
322 'exitFullscreen',
323 'fullscreenchange',
324 'fullscreen',
325 'fullscreenElement'
326 ],
327 [
328 'webkitRequestFullScreen',
329 'webkitCancelFullScreen',
330 'webkitfullscreenchange',
331 'webkitIsFullScreen',
332 'webkitCurrentFullScreenElement'
333 ],
334 [
335 'mozRequestFullScreen',
336 'mozCancelFullScreen',
337 'mozfullscreenchange',
338 'mozFullScreen',
339 'mozFullScreenElement'
340 ]
341 ];
342 for (var i = 0, l = methodMap.length; i < l; i++) {
343 if (methodMap.hasOwnProperty(i)) {
344 var val = methodMap[i];
345 if (val[1] in document) {
346 return val;
347 }
348 }
349 }
350 })();
351
352 if (!methods) {
353 return window.screenfull = false;
354 }
355
356 var keyboardAllowed = 'ALLOW_KEYBOARD_INPUT' in Element;
357
358 var screenfull = {
359 init: function() {
360 document.addEventListener(methods[2], function(e) {
361 screenfull.isFullscreen = document[methods[3]];
362 screenfull.element = document[methods[4]];
363 screenfull.onchange(e);
364 });
365 return this;
366 },
367 isFullscreen: document[methods[3]],
368 element: document[methods[4]],
369 request: function(elem) {
370 elem = elem || document.documentElement;
371 elem[methods[0]](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
372 // Work around Safari 5.1 bug: reports support for keyboard in fullscreen
373 // even though it doesn't.
374 if (!document.isFullscreen) {
375 elem[methods[0]]();
376 }
377 },
378 exit: function() {
379 document[methods[1]]();
380 },
381 toggle: function(elem) {
382 if (this.isFullscreen) {
383 this.exit();
384 } else {
385 this.request(elem);
386 }
387 },
388 onchange: function() {}
389 };
390
391 window.screenfull = screenfull.init();
392 })(window, document);
393
File
player/doc/symbols/src/src_minplayer.display.js.html
View source
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
.KEYW {color: #933;}
.COMM {color: #bbb; font-style: italic;}
.NUMB {color: #393;}
.STRN {color: #393;}
.REGX {color: #339;}
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/** The minplayer namespace. */</span><span class="WHIT">
<span class='line'> 2</span> </span><span class="NAME">minplayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 3</span>
<span class='line'> 4</span> </span><span class="COMM">/**
<span class='line'> 5</span> * @constructor
<span class='line'> 6</span> * @extends minplayer.plugin
<span class='line'> 7</span> * @class Base class used to provide the display and options for any component
<span class='line'> 8</span> * deriving from this class. Components who derive are expected to provide
<span class='line'> 9</span> * the elements that they define by implementing the getElements method.
<span class='line'> 10</span> *
<span class='line'> 11</span> * @param {string} name The name of this plugin.
<span class='line'> 12</span> * @param {object} context The jQuery context this component resides.
<span class='line'> 13</span> * @param {object} options The options for this component.
<span class='line'> 14</span> * @param {object} queue The event queue to pass events around.
<span class='line'> 15</span> */</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="NAME">minplayer.display</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 17</span>
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="COMM">// Derive from plugin</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.plugin.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 21</span>
<span class='line'> 22</span> </span><span class="COMM">/** Derive from minplayer.plugin. */</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="NAME">minplayer.display.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">minplayer.plugin</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 24</span>
<span class='line'> 25</span> </span><span class="COMM">/** Reset the constructor. */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="NAME">minplayer.display.prototype.constructor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.display</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 27</span>
<span class='line'> 28</span> </span><span class="COMM">/**
<span class='line'> 29</span> * Returns the display for this component.
<span class='line'> 30</span> *
<span class='line'> 31</span> * @return {object} The jQuery context for this display.
<span class='line'> 32</span> */</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="NAME">minplayer.display.prototype.getDisplay</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.context</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span>
<span class='line'> 37</span> </span><span class="COMM">/**
<span class='line'> 38</span> * @see minplayer.plugin.construct
<span class='line'> 39</span> */</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="NAME">minplayer.display.prototype.construct</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 41</span>
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="COMM">// Set the display.</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">this.display</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getDisplay</span><span class="PUNC">(</span><span class="NAME">this.context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span>
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="COMM">// Call the plugin constructor.</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.plugin.prototype.construct.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 47</span>
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">// Set the plugin name within the options.</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="NAME">this.options.pluginName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'display'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 50</span>
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="COMM">// Get the display elements.</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="NAME">this.elements</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getElements</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span>
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="COMM">// Only do this if they allow resize for this display.</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.onResize</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 56</span>
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="COMM">// Set the resize timeout and this pointer.</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resizeTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span>
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="COMM">// Add a handler to trigger a resize event.</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">resize</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">display</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">resizeTimeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">resizeTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">display.onResize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span>
<span class='line'> 72</span> </span><span class="COMM">/**
<span class='line'> 73</span> * Called when the window resizes.
<span class='line'> 74</span> */</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="NAME">minplayer.display.prototype.onResize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span>
<span class='line'> 77</span> </span><span class="COMM">/**
<span class='line'> 78</span> * Wrapper around hide that will always not show.
<span class='line'> 79</span> *
<span class='line'> 80</span> * @param {object} element The element you wish to hide.
<span class='line'> 81</span> */</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="NAME">minplayer.display.prototype.hide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.display</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="NAME">element.forceHide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="NAME">element.unbind</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 89</span>
<span class='line'> 90</span> </span><span class="COMM">/**
<span class='line'> 91</span> * Gets the full screen element.
<span class='line'> 92</span> *
<span class='line'> 93</span> * @return {object} The display to be used for full screen support.
<span class='line'> 94</span> */</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="NAME">minplayer.display.prototype.fullScreenElement</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.display</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 98</span>
<span class='line'> 99</span> </span><span class="COMM">/**
<span class='line'>100</span> * Fix for the click function in jQuery to be cross platform.
<span class='line'>101</span> *
<span class='line'>102</span> * @param {object} element The element that will be clicked.
<span class='line'>103</span> * @param {function} fn Called when the element is clicked.
<span class='line'>104</span> * @return {object} The element that is to be clicked.
<span class='line'>105</span> */</span><span class="WHIT">
<span class='line'>106</span> </span><span class="NAME">minplayer.click</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">element.bind</span><span class="PUNC">(</span><span class="STRN">'touchstart click'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">flag</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT"> </span><span class="NAME">fn.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span>
<span class='line'>121</span> </span><span class="COMM">/**
<span class='line'>122</span> * Determines if the player is in focus or not.
<span class='line'>123</span> *
<span class='line'>124</span> * @param {boolean} focus If the player is in focus.
<span class='line'>125</span> */</span><span class="WHIT">
<span class='line'>126</span> </span><span class="NAME">minplayer.display.prototype.onFocus</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">focus</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT"> </span><span class="NAME">this.hasFocus</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.focus</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">focus</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>128</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span>
<span class='line'>130</span> </span><span class="COMM">/** Keep track of all the show hide elements. */</span><span class="WHIT">
<span class='line'>131</span> </span><span class="NAME">minplayer.showHideElements</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>132</span>
<span class='line'>133</span> </span><span class="COMM">/**
<span class='line'>134</span> * Show all the show hide elements.
<span class='line'>135</span> */</span><span class="WHIT">
<span class='line'>136</span> </span><span class="NAME">minplayer.showAll</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.showHideElements.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">minplayer.showHideElements</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.showThenHide</span><span class="PUNC">(</span><span class="NAME">obj.element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">obj.timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">obj.callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>143</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span>
<span class='line'>145</span> </span><span class="COMM">/**
<span class='line'>146</span> * Stops the whole show then hide from happening.
<span class='line'>147</span> *
<span class='line'>148</span> * @param {object} element The element you want the showThenHide to stop.
<span class='line'>149</span> */</span><span class="WHIT">
<span class='line'>150</span> </span><span class="NAME">minplayer.stopShowThenHide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.showTimer</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">element.showTimer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="NAME">element.stopShowThenHide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="NAME">element.shown</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="NAME">element.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span>
<span class='line'>160</span> </span><span class="COMM">/**
<span class='line'>161</span> * Called if you would like for your display item to show then hide.
<span class='line'>162</span> *
<span class='line'>163</span> * @param {object} element The element you would like to hide or show.
<span class='line'>164</span> * @param {number} timeout The timeout to hide and show.
<span class='line'>165</span> * @param {function} callback Called when something happens.
<span class='line'>166</span> */</span><span class="WHIT">
<span class='line'>167</span> </span><span class="NAME">minplayer.showThenHide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>168</span>
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="COMM">// If no element exists, then just return.</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">element</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>173</span>
<span class='line'>174</span> </span><span class="WHIT"> </span><span class="COMM">// Ensure we have a timeout.</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">5000</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>176</span>
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="COMM">// If this has not yet been configured.</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">element.showTimer</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">element.shown</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">element.stopShowThenHide</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span>
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="COMM">// Add this to our showHideElements.</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.showHideElements.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span>
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="COMM">// Bind to a click event.</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.click</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">element.stopShowThenHide</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.showThenHide</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>195</span>
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="COMM">// Bind to the mousemove event.</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">'mousemove'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">element.stopShowThenHide</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="NAME">minplayer.showThenHide</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>203</span>
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="COMM">// Clear the timeout, and then setup the show then hide functionality.</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">element.showTimer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</span>
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="COMM">// Show the display.</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">element.shown</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">element.forceHide</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">element.shown</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">element.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>215</span>
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="COMM">// Set a timer to hide it after the timeout.</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">element.showTimer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="NAME">element.hide</span><span class="PUNC">(</span><span class="STRN">'slow'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="NAME">element.shown</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>226</span>
<span class='line'>227</span> </span><span class="COMM">/**
<span class='line'>228</span> * Make this display element go fullscreen.
<span class='line'>229</span> *
<span class='line'>230</span> * @param {boolean} full Tell the player to go into fullscreen or not.
<span class='line'>231</span> */</span><span class="WHIT">
<span class='line'>232</span> </span><span class="NAME">minplayer.display.prototype.fullscreen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">full</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isFull</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.isFullScreen</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.fullScreenElement</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isFull</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">full</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="NAME">element.removeClass</span><span class="PUNC">(</span><span class="STRN">'fullscreen'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">screenfull</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.exit</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="NAME">this.trigger</span><span class="PUNC">(</span><span class="STRN">'fullscreen'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">isFull</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">full</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="NAME">element.addClass</span><span class="PUNC">(</span><span class="STRN">'fullscreen'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">screenfull</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.request</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.onchange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">display</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">screenfull.isFullscreen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="NAME">display.fullscreen</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="NAME">this.trigger</span><span class="PUNC">(</span><span class="STRN">'fullscreen'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>256</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>257</span>
<span class='line'>258</span> </span><span class="COMM">/**
<span class='line'>259</span> * Toggle fullscreen.
<span class='line'>260</span> */</span><span class="WHIT">
<span class='line'>261</span> </span><span class="NAME">minplayer.display.prototype.toggleFullScreen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="NAME">this.fullscreen</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.isFullScreen</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>263</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span>
<span class='line'>265</span> </span><span class="COMM">/**
<span class='line'>266</span> * Checks to see if we are in fullscreen mode.
<span class='line'>267</span> *
<span class='line'>268</span> * @return {boolean} TRUE - fullscreen, FALSE - otherwise.
<span class='line'>269</span> */</span><span class="WHIT">
<span class='line'>270</span> </span><span class="NAME">minplayer.display.prototype.isFullScreen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.fullScreenElement</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'fullscreen'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>272</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span>
<span class='line'>274</span> </span><span class="COMM">/**
<span class='line'>275</span> * Returns a scaled rectangle provided a ratio and the container rect.
<span class='line'>276</span> *
<span class='line'>277</span> * @param {number} ratio The width/height ratio of what is being scaled.
<span class='line'>278</span> * @param {object} rect The bounding rectangle for scaling.
<span class='line'>279</span> * @return {object} The Rectangle object of the scaled rectangle.
<span class='line'>280</span> */</span><span class="WHIT">
<span class='line'>281</span> </span><span class="NAME">minplayer.display.prototype.getScaledRect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">ratio</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rect</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>282</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">scaledRect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>283</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.x</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">rect.x</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>284</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.y</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">rect.y</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.width</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">rect.width</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.height</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.height</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">rect.height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ratio</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">rect.width</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">rect.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">ratio</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.height</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.height</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">rect.height</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">ratio</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.height</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">rect.width</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">ratio</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rect.width</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">rect.width</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">scaledRect.width</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT"> </span><span class="NAME">scaledRect.y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">rect.height</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">scaledRect.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">scaledRect</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>300</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>301</span>
<span class='line'>302</span> </span><span class="COMM">/**
<span class='line'>303</span> * Returns all the jQuery elements that this component uses.
<span class='line'>304</span> *
<span class='line'>305</span> * @return {object} An object which defines all the jQuery elements that
<span class='line'>306</span> * this component uses.
<span class='line'>307</span> */</span><span class="WHIT">
<span class='line'>308</span> </span><span class="NAME">minplayer.display.prototype.getElements</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span>
<span class='line'>312</span> </span><span class="COMM">/**
<span class='line'>313</span> * From https://github.com/sindresorhus/screenfull.js
<span class='line'>314</span> */</span><span class="WHIT">
<span class='line'>315</span> </span><span class="COMM">/*global Element:true*/</span><span class="WHIT">
<span class='line'>316</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="STRN">'use strict'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">methods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">methodMap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="STRN">'requestFullscreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="STRN">'exitFullscreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="STRN">'fullscreenchange'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="STRN">'fullscreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="STRN">'fullscreenElement'</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="STRN">'webkitRequestFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="STRN">'webkitCancelFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="STRN">'webkitfullscreenchange'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="STRN">'webkitIsFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="STRN">'webkitCurrentFullScreenElement'</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT"> </span><span class="STRN">'mozRequestFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="STRN">'mozCancelFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="STRN">'mozfullscreenchange'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT"> </span><span class="STRN">'mozFullScreen'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="STRN">'mozFullScreenElement'</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">methodMap.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">methodMap.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">methodMap</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>349</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>351</span>
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">methods</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">window.screenfull</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>355</span>
<span class='line'>356</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keyboardAllowed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'ALLOW_KEYBOARD_INPUT'</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">Element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span>
<span class='line'>358</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">screenfull</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="NAME">init</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>360</span> </span><span class="WHIT"> </span><span class="NAME">document.addEventListener</span><span class="PUNC">(</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>361</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.isFullscreen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>362</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">4</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT"> </span><span class="NAME">screenfull.onchange</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT"> </span><span class="NAME">isFullscreen</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">4</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">elem</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>370</span> </span><span class="WHIT"> </span><span class="NAME">elem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">elem</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">document.documentElement</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT"> </span><span class="NAME">elem</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">keyboardAllowed</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Element.ALLOW_KEYBOARD_INPUT</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>372</span> </span><span class="WHIT"> </span><span class="COMM">// Work around Safari 5.1 bug: reports support for keyboard in fullscreen</span><span class="WHIT">
<span class='line'>373</span> </span><span class="WHIT"> </span><span class="COMM">// even though it doesn't.</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">document.isFullscreen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT"> </span><span class="NAME">elem</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT"> </span><span class="NAME">exit</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT"> </span><span class="NAME">toggle</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">elem</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.isFullscreen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>383</span> </span><span class="WHIT"> </span><span class="NAME">this.exit</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>385</span> </span><span class="WHIT"> </span><span class="NAME">this.request</span><span class="PUNC">(</span><span class="NAME">elem</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT"> </span><span class="NAME">onchange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>390</span>
<span class='line'>391</span> </span><span class="WHIT"> </span><span class="NAME">window.screenfull</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">screenfull.init</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>393</span> </span></pre></body></html>