vendor: 3,730 bytes, lines 1-118
1/*! lg-fullscreen - v1.0.1 - 2016-09-30 2* http://sachinchoolur.github.io/lightGallery 3* Copyright (c) 2016 Sachin N; Licensed GPLv3 */ 4 5(function (root, factory) { 6 if (typeof define === 'function' && define.amd) { 7 // AMD. Register as an anonymous module unless amdModuleId is set 8 define(['jquery'], function (a0) { 9 return (factory(a0)); 10 }); 11 } else if (typeof exports === 'object') { 12 // Node. Does not work with strict CommonJS, but 13 // only CommonJS-like environments that support module.exports, 14 // like Node. 15 module.exports = factory(require('jquery')); 16 } else { 17 factory(jQuery); 18 } 19}(this, function ($) { 20 21(function() { 22 23 'use strict'; 24 25 var defaults = { 26 fullScreen: true 27 }; 28 29 var Fullscreen = function(element) { 30 31 // get lightGallery core plugin data 32 this.core = $(element).data('lightGallery'); 33 34 this.$el = $(element); 35 36 // extend module defalut settings with lightGallery core settings 37 this.core.s = $.extend({}, defaults, this.core.s); 38 39 this.init(); 40 41 return this; 42 }; 43 44 Fullscreen.prototype.init = function() { 45 var fullScreen = ''; 46 if (this.core.s.fullScreen) { 47 48 // check for fullscreen browser support 49 if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && 50 !document.mozFullScreenEnabled && !document.msFullscreenEnabled) { 51 return; 52 } else { 53 fullScreen = '<span class="lg-fullscreen lg-icon"></span>'; 54 this.core.$outer.find('.lg-toolbar').append(fullScreen); 55 this.fullScreen(); 56 } 57 } 58 }; 59 60 Fullscreen.prototype.requestFullscreen = function() { 61 var el = document.documentElement; 62 if (el.requestFullscreen) { 63 el.requestFullscreen(); 64 } else if (el.msRequestFullscreen) { 65 el.msRequestFullscreen(); 66 } else if (el.mozRequestFullScreen) { 67 el.mozRequestFullScreen(); 68 } else if (el.webkitRequestFullscreen) { 69 el.webkitRequestFullscreen(); 70 } 71 }; 72 73 Fullscreen.prototype.exitFullscreen = function() { 74 if(document.fullscreen) { 75 if (document.exitFullscreen) { 76 document.exitFullscreen(); 77 } else if (document.msExitFullscreen) { 78 document.msExitFullscreen(); 79 } else if (document.mozCancelFullScreen) { 80 document.mozCancelFullScreen(); 81 } else if (document.webkitExitFullscreen) { 82 document.webkitExitFullscreen(); 83 } 84 } 85 }; 86 87 // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode 88 Fullscreen.prototype.fullScreen = function() { 89 var _this = this; 90 91 $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() { 92 _this.core.$outer.toggleClass('lg-fullscreen-on'); 93 }); 94 95 this.core.$outer.find('.lg-fullscreen').on('click.lg', function() { 96 if (!document.fullscreenElement && 97 !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { 98 _this.requestFullscreen(); 99 } else { 100 _this.exitFullscreen(); 101 } 102 }); 103 104 }; 105 106 Fullscreen.prototype.destroy = function() { 107 108 // exit from fullscreen if activated 109 this.exitFullscreen(); 110 111 $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg'); 112 }; 113 114 $.fn.lightGallery.modules.fullscreen = Fullscreen; 115 116})(); 117 118}));
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.