/usr/share/javascript/jquery-fullscreen/jquery.fullscreen.js is in libjs-jquery-fullscreen 10-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /**
* @name jQuery FullScreen Plugin
* @author Martin Angelov, Morten Sjøgren
* @version 1.2
* @url http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/
* @license MIT License
*/
/*jshint browser: true, jquery: true */
(function($){
"use strict";
// These helper functions available only to our plugin scope.
function supportFullScreen(){
var doc = document.documentElement;
return ('requestFullscreen' in doc) ||
('mozRequestFullScreen' in doc && document.mozFullScreenEnabled) ||
('webkitRequestFullScreen' in doc);
}
function requestFullScreen(elem){
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
function fullScreenStatus(){
return document.fullscreen ||
document.mozFullScreen ||
document.webkitIsFullScreen ||
false;
}
function cancelFullScreen(){
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
function onFullScreenEvent(callback){
$(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange", function(){
// The full screen status is automatically
// passed to our callback as an argument.
callback(fullScreenStatus());
});
}
// Adding a new test to the jQuery support object
$.support.fullscreen = supportFullScreen();
// Creating the plugin
$.fn.fullScreen = function(props){
if(!$.support.fullscreen || this.length !== 1) {
// The plugin can be called only
// on one element at a time
return this;
}
if(fullScreenStatus()){
// if we are already in fullscreen, exit
cancelFullScreen();
return this;
}
// You can potentially pas two arguments a color
// for the background and a callback function
var options = $.extend({
'background' : '#111',
'callback' : $.noop( ),
'fullscreenClass' : 'fullScreen'
}, props),
elem = this,
// This temporary div is the element that is
// actually going to be enlarged in full screen
fs = $('<div>', {
'css' : {
'overflow-y' : 'auto',
'background' : options.background,
'width' : '100%',
'height' : '100%'
}
})
.insertBefore(elem)
.append(elem);
// You can use the .fullScreen class to
// apply styling to your element
elem.addClass( options.fullscreenClass );
// Inserting our element in the temporary
// div, after which we zoom it in fullscreen
requestFullScreen(fs.get(0));
fs.click(function(e){
if(e.target == this){
// If the black bar was clicked
cancelFullScreen();
}
});
elem.cancel = function(){
cancelFullScreen();
return elem;
};
onFullScreenEvent(function(fullScreen){
if(!fullScreen){
// We have exited full screen.
// Detach event listener
$(document).off( 'fullscreenchange mozfullscreenchange webkitfullscreenchange' );
// Remove the class and destroy
// the temporary div
elem.removeClass( options.fullscreenClass ).insertBefore(fs);
fs.remove();
}
// Calling the facultative user supplied callback
if(options.callback) {
options.callback(fullScreen);
}
});
return elem;
};
$.fn.cancelFullScreen = function( ) {
cancelFullScreen();
return this;
};
}(jQuery));
|