webvr js meetup initial commit

This commit is contained in:
Senad Uka
2017-03-11 15:22:17 +01:00
commit 3f640b55db
761 changed files with 264174 additions and 0 deletions

145
node_modules/screenfull/dist/screenfull.js generated vendored Normal file
View File

@@ -0,0 +1,145 @@
/*!
* screenfull
* v3.0.0 - 2015-11-24
* (c) Sindre Sorhus; MIT License
*/
(function () {
'use strict';
var isCommonjs = typeof module !== 'undefined' && module.exports;
var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element;
var fn = (function () {
var val;
var valLength;
var fnMap = [
[
'requestFullscreen',
'exitFullscreen',
'fullscreenElement',
'fullscreenEnabled',
'fullscreenchange',
'fullscreenerror'
],
// new WebKit
[
'webkitRequestFullscreen',
'webkitExitFullscreen',
'webkitFullscreenElement',
'webkitFullscreenEnabled',
'webkitfullscreenchange',
'webkitfullscreenerror'
],
// old WebKit (Safari 5.1)
[
'webkitRequestFullScreen',
'webkitCancelFullScreen',
'webkitCurrentFullScreenElement',
'webkitCancelFullScreen',
'webkitfullscreenchange',
'webkitfullscreenerror'
],
[
'mozRequestFullScreen',
'mozCancelFullScreen',
'mozFullScreenElement',
'mozFullScreenEnabled',
'mozfullscreenchange',
'mozfullscreenerror'
],
[
'msRequestFullscreen',
'msExitFullscreen',
'msFullscreenElement',
'msFullscreenEnabled',
'MSFullscreenChange',
'MSFullscreenError'
]
];
var i = 0;
var l = fnMap.length;
var ret = {};
for (; i < l; i++) {
val = fnMap[i];
if (val && val[1] in document) {
for (i = 0, valLength = val.length; i < valLength; i++) {
ret[fnMap[0][i]] = val[i];
}
return ret;
}
}
return false;
})();
var screenfull = {
request: function (elem) {
var request = fn.requestFullscreen;
elem = elem || document.documentElement;
// Work around Safari 5.1 bug: reports support for
// keyboard in fullscreen even though it doesn't.
// Browser sniffing, since the alternative with
// setTimeout is even worse.
if (/5\.1[\.\d]* Safari/.test(navigator.userAgent)) {
elem[request]();
} else {
elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
}
},
exit: function () {
document[fn.exitFullscreen]();
},
toggle: function (elem) {
if (this.isFullscreen) {
this.exit();
} else {
this.request(elem);
}
},
raw: fn
};
if (!fn) {
if (isCommonjs) {
module.exports = false;
} else {
window.screenfull = false;
}
return;
}
Object.defineProperties(screenfull, {
isFullscreen: {
get: function () {
return Boolean(document[fn.fullscreenElement]);
}
},
element: {
enumerable: true,
get: function () {
return document[fn.fullscreenElement];
}
},
enabled: {
enumerable: true,
get: function () {
// Coerce to boolean in case of old WebKit
return Boolean(document[fn.fullscreenEnabled]);
}
}
});
if (isCommonjs) {
module.exports = screenfull;
} else {
window.screenfull = screenfull;
}
})();

21
node_modules/screenfull/license generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

108
node_modules/screenfull/package.json generated vendored Normal file
View File

@@ -0,0 +1,108 @@
{
"_args": [
[
{
"raw": "screenfull@^3.0.2",
"scope": null,
"escapedName": "screenfull",
"name": "screenfull",
"rawSpec": "^3.0.2",
"spec": ">=3.0.2 <4.0.0",
"type": "range"
},
"/Users/smus/Projects/webvr-boilerplate/node_modules/webvr-ui"
]
],
"_from": "screenfull@>=3.0.2 <4.0.0",
"_id": "screenfull@3.0.2",
"_inCache": true,
"_installable": true,
"_location": "/screenfull",
"_nodeVersion": "4.4.5",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/screenfull-3.0.2.tgz_1471045464332_0.06257056491449475"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.15.5",
"_phantomChildren": {},
"_requested": {
"raw": "screenfull@^3.0.2",
"scope": null,
"escapedName": "screenfull",
"name": "screenfull",
"rawSpec": "^3.0.2",
"spec": ">=3.0.2 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/webvr-ui"
],
"_resolved": "https://registry.npmjs.org/screenfull/-/screenfull-3.0.2.tgz",
"_shasum": "9fbcce07bad4c680a8f90f2bfc9c41788af55d0c",
"_shrinkwrap": null,
"_spec": "screenfull@^3.0.2",
"_where": "/Users/smus/Projects/webvr-boilerplate/node_modules/webvr-ui",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/screenfull.js/issues"
},
"dependencies": {},
"description": "Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-concat": "^1.0.0",
"grunt-contrib-uglify": "^2.0.0",
"load-grunt-tasks": "^3.3.0",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "9fbcce07bad4c680a8f90f2bfc9c41788af55d0c",
"tarball": "https://registry.npmjs.org/screenfull/-/screenfull-3.0.2.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"dist/screenfull.js"
],
"gitHead": "dcdfb8c24688e041ba861529711089cf0e542169",
"homepage": "https://github.com/sindresorhus/screenfull.js#readme",
"keywords": [
"browser",
"fullscreen"
],
"license": "MIT",
"main": "dist/screenfull.js",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "screenfull",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/screenfull.js.git"
},
"scripts": {
"test": "xo"
},
"version": "3.0.2",
"xo": {
"envs": [
"node",
"browser"
]
}
}

244
node_modules/screenfull/readme.md generated vendored Normal file
View File

@@ -0,0 +1,244 @@
# screenfull.js
> Simple wrapper for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to.
---
<p align="center"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos.</p>
---
### [Demo](https://sindresorhus.com/screenfull.js)
### [Check out my other projects](https://github.com/sindresorhus?tab=repositories)
## Install
Only 0.7 kB gzipped.
Download the [production version][min] or the [development version][max].
[min]: https://github.com/sindresorhus/screenfull.js/raw/gh-pages/dist/screenfull.min.js
[max]: https://github.com/sindresorhus/screenfull.js/raw/gh-pages/dist/screenfull.js
```
$ npm install --save screenfull
```
Also available on [cdnjs](https://cdnjs.com/libraries/screenfull.js).
## Why?
### Screenfull
```js
if (screenfull.enabled) {
screenfull.request();
}
```
### Vanilla JavaScript
```js
document.fullscreenEnabled = document.fullscreenEnabled || document.mozFullScreenEnabled || document.documentElement.webkitRequestFullScreen;
function requestFullscreen(element) {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
if (document.fullscreenEnabled) {
requestFullscreen(document.documentElement);
}
// Actually it's more if you want it to work in Safari, but let's not go there...
```
## Support
[Supported browsers](http://caniuse.com/fullscreen)
Safari doesn't support use of the keyboard in fullscreen.
## Documentation
### Examples
#### Fullscreen the page
```js
document.getElementById('button').addEventListener('click', () => {
if (screenfull.enabled) {
screenfull.request();
} else {
// Ignore or do something else
}
});
```
#### Fullscreen an element
```js
const elem = document.getElementById('target');
document.getElementById('button').addEventListener('click', () => {
if (screenfull.enabled) {
screenfull.request(elem);
}
});
```
#### Fullscreen an element with jQuery
```js
const target = $('#target')[0]; // Get DOM element from jQuery collection
$('#button').on('click', () => {
if (screenfull.enabled) {
screenfull.request(target);
}
});
```
#### Toggle fullscreen on a image with jQuery
```js
$('img').on('click', event => {
if (screenfull.enabled) {
screenfull.toggle(event.target);
}
});
```
#### Detect fullscreen change
```js
if (screenfull.enabled) {
document.addEventListener(screenfull.raw.fullscreenchange, () => {
console.log('Am I fullscreen? ' + (screenfull.isFullscreen ? 'Yes' : 'No'));
});
}
```
#### Detect fullscreen error
```js
if (screenfull.enabled) {
document.addEventListener(screenfull.raw.fullscreenerror, event => {
console.error('Failed to enable fullscreen', event);
});
}
```
See the [demo](https://sindresorhus.com/screenfull.js) for more examples, and view the source.
#### Fullscreen an element with Angular.js
You can use the [Angular.js binding](https://github.com/hrajchert/angular-screenfull) to do something like:
```html
<div ngsf-fullscreen>
<p>This is a fullscreen element</p>
<button ngsf-toggle-fullscreen>Toggle fullscreen</button>
</div>
```
### Methods
#### .request()
Make an element fullscreen.
Accepts a DOM element. Default is `<html>`. If called with another element than the currently active, it will switch to that if it's a decendant.
If your page is inside an `<iframe>` you will need to add a `allowfullscreen` attribute (+ `webkitallowfullscreen` and `mozallowfullscreen`).
Keep in mind that the browser will only enter fullscreen when initiated by user events like click, touch, key.
#### .exit()
Brings you out of fullscreen.
#### .toggle()
Requests fullscreen if not active, otherwise exits.
### Properties
#### .isFullscreen
Returns a boolean whether fullscreen is active.
#### .element
Returns the element currently in fullscreen, otherwise `null`.
#### .enabled
Returns a boolean whether you are allowed to enter fullscreen. If your page is inside an `<iframe>` you will need to add a `allowfullscreen` attribute (+ `webkitallowfullscreen` and `mozallowfullscreen`).
#### .raw
Exposes the raw properties (prefixed if needed) used internally: `requestFullscreen`, `exitFullscreen`, `fullscreenElement`, `fullscreenEnabled`, `fullscreenchange`, `fullscreenerror`
```js
$(document).on(screenfull.raw.fullscreenchange, () => {
console.log('Fullscreen change');
});
```
## FAQ
### How can I navigate to a new page when fullscreen?
That's not supported by browsers for security reasons. There is, however, a dirty workaround. Create a seamless iframe that fills the screen and navigate to the page in that instead.
```js
$('#new-page-btn').click(() => {
const iframe = document.createElement('iframe')
iframe.setAttribute('id', 'external-iframe');
iframe.setAttribute('src', 'http://new-page-website.com');
iframe.setAttribute('frameborder', 'no');
iframe.style.position = 'absolute';
iframe.style.top = '0';
iframe.style.right = '0';
iframe.style.bottom = '0';
iframe.style.left = '0';
iframe.style.width = '100%';
iframe.style.height = '100%';
$(document.body).prepend(iframe);
document.body.style.overflow = 'hidden';
});
```
## Resources
- [Using the Fullscreen API in web browsers](http://hacks.mozilla.org/2012/01/using-the-fullscreen-api-in-web-browsers/)
- [MDN - Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode)
- [W3C Fullscreen spec](http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html)
- [Building an amazing fullscreen mobile experience](http://www.html5rocks.com/en/mobile/fullscreen/)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)