scratch – Blame information for rev 115

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 /*
2 * blueimp Gallery Fullscreen JS
3 * https://github.com/blueimp/Gallery
4 *
5 * Copyright 2013, Sebastian Tschan
6 * https://blueimp.net
7 *
8 * Licensed under the MIT license:
9 * https://opensource.org/licenses/MIT
10 */
11  
12 /* global define, window, document */
13  
14 ;(function (factory) {
15 'use strict'
16 if (typeof define === 'function' && define.amd) {
17 // Register as an anonymous AMD module:
18 define([
19 './blueimp-helper',
20 './blueimp-gallery'
21 ], factory)
22 } else {
23 // Browser globals:
24 factory(
25 window.blueimp.helper || window.jQuery,
26 window.blueimp.Gallery
27 )
28 }
29 }(function ($, Gallery) {
30 'use strict'
31  
32 $.extend(Gallery.prototype.options, {
33 // Defines if the gallery should open in fullscreen mode:
34 fullScreen: false
35 })
36  
37 var initialize = Gallery.prototype.initialize
38 var close = Gallery.prototype.close
39  
40 $.extend(Gallery.prototype, {
41 getFullScreenElement: function () {
42 return document.fullscreenElement ||
43 document.webkitFullscreenElement ||
44 document.mozFullScreenElement ||
45 document.msFullscreenElement
46 },
47  
48 requestFullScreen: function (element) {
49 if (element.requestFullscreen) {
50 element.requestFullscreen()
51 } else if (element.webkitRequestFullscreen) {
52 element.webkitRequestFullscreen()
53 } else if (element.mozRequestFullScreen) {
54 element.mozRequestFullScreen()
55 } else if (element.msRequestFullscreen) {
56 element.msRequestFullscreen()
57 }
58 },
59  
60 exitFullScreen: function () {
61 if (document.exitFullscreen) {
62 document.exitFullscreen()
63 } else if (document.webkitCancelFullScreen) {
64 document.webkitCancelFullScreen()
65 } else if (document.mozCancelFullScreen) {
66 document.mozCancelFullScreen()
67 } else if (document.msExitFullscreen) {
68 document.msExitFullscreen()
69 }
70 },
71  
72 initialize: function () {
73 initialize.call(this)
74 if (this.options.fullScreen && !this.getFullScreenElement()) {
75 this.requestFullScreen(this.container[0])
76 }
77 },
78  
79 close: function () {
80 if (this.getFullScreenElement() === this.container[0]) {
81 this.exitFullScreen()
82 }
83 close.call(this)
84 }
85  
86 })
87  
88 return Gallery
89 }))