1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Update libs

This commit is contained in:
DanieL 2022-07-08 11:48:35 -03:00
parent 19600bd4c1
commit 46eddf2162
44 changed files with 6047 additions and 0 deletions

324
node_modules/jquery-lazy/plugins/README.md generated vendored Normal file
View file

@ -0,0 +1,324 @@
### jQuery Lazy - Loader Plugins
[![GitHub version](https://badge.fury.io/gh/dkern%2Fjquery.lazy.svg)](http://github.com/dkern/jquery.lazy)
[![NPM version](https://badge.fury.io/js/jquery-lazy.svg)](http://www.npmjs.org/package/jquery-lazy)
[![Bower version](https://badge.fury.io/bo/jquery-lazy.svg)](http://bower.io/search/?q=jquery-lazy)
[![Dependencies Status](https://david-dm.org/dkern/jquery.lazy/status.svg)](https://david-dm.org/dkern/jquery.lazy)
[![devDependencies Status](https://david-dm.org/dkern/jquery.lazy/dev-status.svg)](https://david-dm.org/dkern/jquery.lazy?type=dev)
---
### Table of Contents
* [Document Note](#document-note)
* [About Loader Plugins](#about-loader-plugins)
* [Create an own Loader Plugin](#create-an-own-loader-plugin)
* [AJAX Loader](#ajax-loader)
* [Audio / Video Loader](#audio--video-loader)
* [iFrame Loader](#iframe-loader)
* [NOOP Loader](#noop-loader)
* [Picture Loader](#picture-loader)
* [JS / Script Loader](#js--script-loader)
* [Vimeo Video Loader](#vimeo-video-loader)
* [YouTube Video Loader](#youtube-video-loader)
* [Bugs / Feature request](#bugs--feature-request)
* [License](#license)
* [Donation](#donation)
---
## Document Note
This is not the main readme file of this project.
Please go to the [project root](https://github.com/dkern/jquery.lazy) and take a look in the [README.md](https://github.com/dkern/jquery.lazy/blob/master/README.md) to learn more about the basics of Lazy.
## About Loader Plugins
The loader plugins for Lazy can be used whenever you want to extend the basic functionality by default or globally for many instances of Lazy.
Just add the plugins you want to use or a combined file, containing all plugins, to your page and all instances can use the plugins from now on.
```HTML
<!-- as single plugin files -->
<script type="text/javascript" src="jquery.lazy.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.ajax.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.av.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.iframe.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.noop.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.picture.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.script.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.vimeo.min.js"></script>
<script type="text/javascript" src="plugins/jquery.lazy.youtube.min.js"></script>
<!-- or combined in one file -->
<script type="text/javascript" src="jquery.lazy.min.js"></script>
<script type="text/javascript" src="jquery.lazy.plugins.min.js"></script>
```
## Create an own Loader Plugin
If you want to, you can easily create own loader plugins.
Just use jQuery or Zepto's public function `Lazy` to create and register them.
Best practice is to wrap everything by an [IIFE](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression).
```JS
(function($) {
$.Lazy("pluginName", function(element, response) {
// add your logic here
// 'this' is the current instance of Lazy
// so it's possible to access all public functions, like:
var imageBase = this.config("imageBase");
});
})(window.jQuery || window.Zepto);
```
This loader can now be called on every element with the attribute `data-loader` (_by default_), like:
```HTML
<div data-loader="pluginName"></div>
```
It's possible to register a plugin with more than one name / alias.
```JS
(function($) {
$.Lazy(["pluginName", "anotherPluginName"], function(element, response) {
// the plugin is now available by 'data-loader="pluginLoaderName"'
// and 'data-loader="anotherLoaderName"'
});
})(window.jQuery || window.Zepto);
```
The optional second parameter gives you the ability to register a plugin by default to an element type.
When you do this, there is no need to set the `data-loader` attribute on each element you want to use this loader on.
But keep in mind, if you register an plugin on often used elements, like `<div>`, Lazy will try to handle each of them!
If you want to do so anyway, use a most specific selector for jQuery or Zepto.
```JS
(function($) {
$.Lazy("av", ["audio", "video"], function(element, response) {
// this plugin will automatically handle '<audio>' and '<video>' elements,
// even when no 'data-loader' attribute was set on the elements
});
})(window.jQuery || window.Zepto);
```
For more examples, take a look at the [existing plugins](https://github.com/dkern/jquery.lazy/tree/master/plugins).
## AJAX Loader
**Names:** `ajax`, `get`, `post`, `put`
**Parameters:** `data-src`, `data-method`, `data-type`
**Default for:** -
The AJAX loader can receive data from a given url and paste the response to the inner html of the element.
This is useful, when you want do load a bigger amount of content.
Use `ajax` as the loader name by default.
But there are even some shorthand names for specific request types `GET`, `POST` and `PUT` too.
```HTML
<!-- simple GET request -->
<div data-loader="ajax" data-src="ajax.html"></div>
<!-- simple post request with configurable response type -->
<div data-loader="ajax" data-src="ajax.html" data-method="post" data-type="html"></div>
<!-- GET request -->
<div data-loader="get" data-src="ajax.html"></div>
<!-- POST request-->
<div data-loader="post" data-src="ajax.html"></div>
<!-- PUT request-->
<div data-loader="put" data-src="ajax.html"></div>
```
On `POST` and `PUT` requests, the callback `ajaxCreateData` will be executed before every AJAX call.
If used, the callback function should return the value for the `data` parameter of jQuery's AJAX function.
```HTML
<div data-loader="post" data-src="ajax.html" data-value="post-data"></div>
```
```JS
$('div').Lazy({
ajaxCreateData: function(element) {
return {name: element.data('value')};
}
});
```
## Audio / Video Loader
**Names:** `av`, `audio`, `video`
**Parameters:** `data-src`, `data-poster`
**Default for:** `<audio>`, `<video>`
Loads `<audio>` and `<video>` elements and attach the sources and tracks in the right order.
There are two ways you can prepare your audio and/or video tags.
First way is to add all sources by `data-src` attribute, separated by comma and type by pipe on the element.
```HTML
<audio data-src="file.ogg|audio/ogg,file.mp3|audio/mp3,file.wav|audio/wav"></audio>
<video data-src="file.ogv|video/ogv,file.mp4|video/mp4,file.webm|video/webm" data-poster="poster.jpg"></video>
```
The other way is to add the sources and tracks like default, as child elements.
```HTML
<audio>
<data-src src="file.ogg" type="audio/ogg"></data-src>
<data-src src="file.mp3" type="audio/mp3"></data-src>
<data-src src="file.wav" type="audio/wav"></data-src>
</audio>
<video data-poster="poster.jpg">
<data-src src="file.ogv" type="video/ogv"></data-src>
<data-src src="file.mp4" type="video/mp4"></data-src>
<data-src src="file.webm" type="video/webm"></data-src>
<data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
<data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
<data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
</video>
```
## iFrame Loader
**Names:** `frame`, `iframe`
**Parameters:** `data-src`, `data-error-detect`
**Default for:** `<iframe>`
Loads `<iframe>` contents.
The default will return a successfull load, even if the iframe url is not reachable (_like on 404 or wrong url_), because there is no way to check the loaded content in javascript.
It might be the fastest and safest way to do that.
If you know the requested path is reachable every time or don't care about error checks, you should use this way!
```HTML
<iframe data-src="iframe.html"></iframe>
```
The second way is more professional and support error checks.
It will load the content by AJAX and checks the response.
Afterwards pass the HTML content to iframe inner and set the correct url.
This is a very secure check, but could be a bit more tricky on some use cases.
You should only use this on the same domain origin.
To enable this feature, set the attribute `data-error-detect` to `true` or `1` on the iframe element.
```HTML
<iframe data-loader="iframe" data-src="iframe.html" data-error-detect="true"></iframe>
```
## NOOP Loader
**Names:** `noop`, `noop-success`, `noop-error`
**Parameters:** -
**Default for:** -
The NOOP (_or no-operations_) loader will, like the name said, do nothing.
There will even be no callbacks triggered, like `beforeLoad` or `onError`, when using a NOOP` loader.
It could be useful for developers or to simple, secure and fast disable some other loaders.
It can be used with all elements.
```HTML
<div data-loader="noop"></div>
```
There are two other NOOP loaders, helping to debug your code.
The `noop-success` and `noop-error` loaders will return the current state to Lazy and trigger the right callbacks.
```HTML
<!-- triggers the 'afterLoad' and 'onFinishedAll' callback -->
<div data-loader="noop-success"></div>
<!-- triggers the 'onError' and 'onFinishedAll' callback -->
<div data-loader="noop-error"></div>
```
## Picture Loader
**Names:** `pic`, `picture`
**Parameters:** `data-src`, `data-srcset`, `data-media`, `data-sizes`
**Default for:** `<picture>`
Loads `<picture>` elements and attach the sources.
There are two ways you can prepare your picture tags.
First way is to create all child elements from a single line:
```HTML
<picture data-src="default.jpg" data-srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" data-media="(min-width: 600px)" data-type="image/jpeg" />
```
The other way is to add the sources like default, as child elements.
```HTML
<picture>
<data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
<data-img src="default.jpg"></data-img>
</picture>
<picture data-src="default.jpg">
<data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
</picture>
```
## JS / Script Loader
**Names:** `js`, `javascript`, `script`
**Parameters:** `data-src`
**Default for:** `<script>`
Loads javascript files on `<script>` element.
Change the element like the example below, and the files will be loaded automatically after page load.
```HTML
<script data-src="script.js" type="text/javascript"></script>
```
**Note:**
The viewport detection is not correct in some browsers.
So it could happen, that all script files get loaded right after page load, and not when the user scrolls to them.
## Vimeo Video Loader
**Names:** `vimeo`
**Parameters:** `data-src`
**Default for:** -
Loads vimeo videos in an `<iframe>`.
This is the suggested way by vimeo itself.
You can prepare the `<iframe>` element as you would do without Lazy.
Only add the vimeo video id to the attribute `data-src` and add the loader name.
That's all.
```HTML
<iframe data-loader="vimeo" data-src="176894130" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
```
**Please keep in mind:**
Because this is an iframe and there is no feedback javascript could check on, this loader can only return success to Lazy.
There is no way to check if the video was loaded correctly or your provided video id is existing.
## YouTube Video Loader
**Names:** `yt`, `youtube`
**Parameters:** `data-src`, `data-nocookie`
**Default for:** -
Loads youtube videos in an `<iframe>`.
This is the suggested way by youtube itself.
You can prepare the `<iframe>` element as you would do without Lazy.
Only add the youtube video id to the attribute `data-src` and add the loader name.
That's all.
```HTML
<iframe data-loader="youtube" data-src="1AYGnw6MwFM" width="560" height="315" frameborder="0"></iframe>
```
If you want to, you can control the cookie behavior of the embedded video with `data-nocookie="1"`.
This would change the url to `youtube-nocookie.com` instead of `youtube.com`.
```HTML
<iframe data-loader="youtube" data-src="1AYGnw6MwFM" data-nocookie="1" width="560" height="315" frameborder="0"></iframe>
```
**Please keep in mind:**
Because this is an iframe and there is no feedback javascript could check on, this loader can only return success to Lazy.
There is no way to check if the video was loaded correctly or your provided video id is existing.
## Bugs / Feature request
Please [report](http://github.com/dkern/jquery.lazy/issues) bugs and feel free to [ask](http://github.com/dkern/jquery.lazy/issues) for new features and loaders directly on GitHub.
## License
Lazy plugins are dual-licensed under [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL-2.0](http://www.gnu.org/licenses/gpl-2.0.html) license.
## Donation
_You like to support me?_
_You appreciate my work?_
_You use it in commercial projects?_
Feel free to make a little [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FFL6VQJCUZMXC)! :wink:

88
node_modules/jquery-lazy/plugins/jquery.lazy.ajax.js generated vendored Normal file
View file

@ -0,0 +1,88 @@
/*!
* jQuery & Zepto Lazy - AJAX Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load data by ajax request and pass them to elements inner html, like:
// <div data-loader="ajax" data-src="url.html" data-method="post" data-type="html"></div>
$.lazy('ajax', function(element, response) {
ajaxRequest(this, element, response, element.attr('data-method'));
});
// load data by ajax get request and pass them to elements inner html, like:
// <div data-loader="get" data-src="url.html" data-type="html"></div>
$.lazy('get', function(element, response) {
ajaxRequest(this, element, response, 'GET');
});
// load data by ajax post request and pass them to elements inner html, like:
// <div data-loader="post" data-src="url.html" data-type="html"></div>
$.lazy('post', function(element, response) {
ajaxRequest(this, element, response, 'POST');
});
// load data by ajax put request and pass them to elements inner html, like:
// <div data-loader="put" data-src="url.html" data-type="html"></div>
$.lazy('put', function(element, response) {
ajaxRequest(this, element, response, 'PUT');
});
/**
* execute ajax request and handle response
* @param {object} instance
* @param {jQuery|object} element
* @param {function} response
* @param {string} [method]
*/
function ajaxRequest(instance, element, response, method) {
method = method ? method.toUpperCase() : 'GET';
var data;
if ((method === 'POST' || method === 'PUT') && instance.config('ajaxCreateData')) {
data = instance.config('ajaxCreateData').apply(instance, [element]);
}
$.ajax({
url: element.attr('data-src'),
type: method === 'POST' || method === 'PUT' ? method : 'GET',
data: data,
dataType: element.attr('data-type') || 'html',
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content);
// use response function for Zepto
response(true);
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr('data-src data-method data-type');
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - AJAX Plugin v1.4 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){function a(a,e,n,o){o=o?o.toUpperCase():"GET";var i;"POST"!==o&&"PUT"!==o||!a.config("ajaxCreateData")||(i=a.config("ajaxCreateData").apply(a,[e])),t.ajax({url:e.attr("data-src"),type:"POST"===o||"PUT"===o?o:"GET",data:i,dataType:e.attr("data-type")||"html",success:function(t){e.html(t),n(!0),a.config("removeAttribute")&&e.removeAttr("data-src data-method data-type")},error:function(){n(!1)}})}t.lazy("ajax",function(t,e){a(this,t,e,t.attr("data-method"))}),t.lazy("get",function(t,e){a(this,t,e,"GET")}),t.lazy("post",function(t,e){a(this,t,e,"POST")}),t.lazy("put",function(t,e){a(this,t,e,"PUT")})}(window.jQuery||window.Zepto);

120
node_modules/jquery-lazy/plugins/jquery.lazy.av.js generated vendored Normal file
View file

@ -0,0 +1,120 @@
/*!
* jQuery & Zepto Lazy - AV Plugin - v1.4
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads audio and video tags including tracks by two ways, like:
// <audio>
// <data-src src="audio.ogg" type="video/ogg"></data-src>
// <data-src src="audio.mp3" type="video/mp3"></data-src>
// </audio>
// <video data-poster="poster.jpg">
// <data-src src="video.ogv" type="video/ogv"></data-src>
// <data-src src="video.webm" type="video/webm"></data-src>
// <data-src src="video.mp4" type="video/mp4"></data-src>
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
//
// or:
// <audio data-src="audio.ogg|video/ogg,video.mp3|video/mp3"></video>
// <video data-poster="poster.jpg" data-src="video.ogv|video/ogv,video.webm|video/webm,video.mp4|video/mp4">
// <data-track kind="captions" src="captions.vtt" srclang="en"></data-track>
// <data-track kind="descriptions" src="descriptions.vtt" srclang="en"></data-track>
// <data-track kind="subtitles" src="subtitles.vtt" srclang="de"></data-track>
// </video>
$.lazy(['av', 'audio', 'video'], ['audio', 'video'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'audio' || elementTagName === 'video') {
var srcAttr = 'data-src',
sources = element.find(srcAttr),
tracks = element.find('data-track'),
sourcesInError = 0,
// create on error callback for sources
onError = function() {
if (++sourcesInError === sources.length) {
response(false);
}
},
// create callback to handle a source or track entry
handleSource = function() {
var source = $(this),
type = source[0].tagName.toLowerCase(),
attributes = source.prop('attributes'),
target = $(type === srcAttr ? '<source>' : '<track>');
if (type === srcAttr) {
target.one('error', onError);
}
$.each(attributes, function(index, attribute) {
target.attr(attribute.name, attribute.value);
});
source.replaceWith(target);
};
// create event for successfull load
element.one('loadedmetadata', function() {
response(true);
})
// remove default callbacks to ignore loading poster image
.off('load error')
// load poster image
.attr('poster', element.attr('data-poster'));
// load by child tags
if (sources.length) {
sources.each(handleSource);
}
// load by attribute
else if (element.attr(srcAttr)) {
// split for every entry by comma
$.each(element.attr(srcAttr).split(','), function(index, value) {
// split again for file and file type
var parts = value.split('|');
// create a source entry
element.append($('<source>')
.one('error', onError)
.attr({src: parts[0].trim(), type: parts[1].trim()}));
});
// remove now obsolete attribute
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
// load optional tracks
if (tracks.length) {
tracks.each(handleSource);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - AV Plugin v1.4 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["av","audio","video"],["audio","video"],function(a,e){var r=a[0].tagName.toLowerCase();if("audio"===r||"video"===r){var o=a.find("data-src"),i=a.find("data-track"),n=0,c=function(){++n===o.length&&e(!1)},d=function(){var a=t(this),e=a[0].tagName.toLowerCase(),r=a.prop("attributes"),o=t("data-src"===e?"<source>":"<track>");"data-src"===e&&o.one("error",c),t.each(r,function(t,a){o.attr(a.name,a.value)}),a.replaceWith(o)};a.one("loadedmetadata",function(){e(!0)}).off("load error").attr("poster",a.attr("data-poster")),o.length?o.each(d):a.attr("data-src")?(t.each(a.attr("data-src").split(","),function(e,r){var o=r.split("|");a.append(t("<source>").one("error",c).attr({src:o[0].trim(),type:o[1].trim()}))}),this.config("removeAttribute")&&a.removeAttr("data-src")):e(!1),i.length&&i.each(d)}else e(!1)})}(window.jQuery||window.Zepto);

83
node_modules/jquery-lazy/plugins/jquery.lazy.iframe.js generated vendored Normal file
View file

@ -0,0 +1,83 @@
/*!
* jQuery & Zepto Lazy - iFrame Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load iframe content, like:
// <iframe data-src="iframe.html"></iframe>
//
// enable content error check with:
// <iframe data-src="iframe.html" data-error-detect="true"></iframe>
$.lazy(['frame', 'iframe'], 'iframe', function(element, response) {
var instance = this;
if (element[0].tagName.toLowerCase() === 'iframe') {
var srcAttr = 'data-src',
errorDetectAttr = 'data-error-detect',
errorDetect = element.attr(errorDetectAttr);
// default way, just replace the 'src' attribute
if (errorDetect !== 'true' && errorDetect !== '1') {
// set iframe source
element.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
}
// extended way, even check if the document is available
else {
$.ajax({
url: element.attr(srcAttr),
dataType: 'html',
crossDomain: true,
xhrFields: {withCredentials: true},
/**
* success callback
* @access private
* @param {*} content
* @return {void}
*/
success: function(content) {
// set responded data to element's inner html
element.html(content)
// change iframe src
.attr('src', element.attr(srcAttr));
// remove attributes
if (instance.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + errorDetectAttr);
}
},
/**
* error callback
* @access private
* @return {void}
*/
error: function() {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
}
}
else {
// pass error state to lazy
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - iFrame Plugin v1.5 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["frame","iframe"],"iframe",function(r,a){var e=this;if("iframe"===r[0].tagName.toLowerCase()){var o=r.attr("data-error-detect");"true"!==o&&"1"!==o?(r.attr("src",r.attr("data-src")),e.config("removeAttribute")&&r.removeAttr("data-src data-error-detect")):t.ajax({url:r.attr("data-src"),dataType:"html",crossDomain:!0,xhrFields:{withCredentials:!0},success:function(t){r.html(t).attr("src",r.attr("data-src")),e.config("removeAttribute")&&r.removeAttr("data-src data-error-detect")},error:function(){a(!1)}})}else a(!1)})}(window.jQuery||window.Zepto);

30
node_modules/jquery-lazy/plugins/jquery.lazy.noop.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
/*!
* jQuery & Zepto Lazy - NOOP Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// will do nothing, used to disable elements or for development
// use like:
// <div data-loader="noop"></div>
// does not do anything, just a 'no-operation' helper ;)
$.lazy('noop', function() {});
// does nothing, but response a successfull loading
$.lazy('noop-success', function(element, response) {
// use response function for Zepto
response(true);
});
// does nothing, but response a failed loading
$.lazy('noop-error', function(element, response) {
// use response function for Zepto
response(false);
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - NOOP Plugin v1.2 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(o){o.lazy("noop",function(){}),o.lazy("noop-success",function(o,n){n(!0)}),o.lazy("noop-error",function(o,n){n(!1)})}(window.jQuery||window.Zepto);

188
node_modules/jquery-lazy/plugins/jquery.lazy.picture.js generated vendored Normal file
View file

@ -0,0 +1,188 @@
/*!
* jQuery & Zepto Lazy - Picture Plugin - v1.3
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
var srcAttr = 'data-src',
srcsetAttr = 'data-srcset',
mediaAttr = 'data-media',
sizesAttr = 'data-sizes',
typeAttr = 'data-type';
// loads picture elements like:
// <picture>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// <data-img src="default.jpg" >
// </picture>
//
// or:
// <picture data-src="default.jpg">
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
// <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 400px)" type="image/jpeg"></data-src>
// </picture>
//
// or just with attributes in one line:
// <picture data-src="default.jpg" data-srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" data-media="(min-width: 600px)" data-sizes="" data-type="image/jpeg" />
$.lazy(['pic', 'picture'], ['picture'], function(element, response) {
var elementTagName = element[0].tagName.toLowerCase();
if (elementTagName === 'picture') {
var sources = element.find(srcAttr),
image = element.find('data-img'),
imageBase = this.config('imageBase') || '';
// handle as child elements
if (sources.length) {
sources.each(function() {
renameElementTag($(this), 'source', imageBase);
});
// create img tag from child
if (image.length === 1) {
image = renameElementTag(image, 'img', imageBase);
// bind event callbacks to new image tag
image.on('load', function() {
response(true);
}).on('error', function() {
response(false);
});
image.attr('src', image.attr(srcAttr));
if (this.config('removeAttribute')) {
image.removeAttr(srcAttr);
}
}
// create img tag from attribute
else if (element.attr(srcAttr)) {
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
// handle as attributes
else if( element.attr(srcsetAttr) ) {
// create source elements before img tag
$('<source>').attr({
media: element.attr(mediaAttr),
sizes: element.attr(sizesAttr),
type: element.attr(typeAttr),
srcset: getCorrectedSrcSet(element.attr(srcsetAttr), imageBase)
})
.appendTo(element);
// create image tag
createImageObject(element, imageBase + element.attr(srcAttr), response);
// remove attributes from parent picture element
if (this.config('removeAttribute')) {
element.removeAttr(srcAttr + ' ' + srcsetAttr + ' ' + mediaAttr + ' ' + sizesAttr + ' ' + typeAttr);
}
}
// pass error state
else {
// use response function for Zepto
response(false);
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
/**
* create a new child element and copy attributes
* @param {jQuery|object} element
* @param {string} toType
* @param {string} imageBase
* @return {jQuery|object}
*/
function renameElementTag(element, toType, imageBase) {
var attributes = element.prop('attributes'),
target = $('<' + toType + '>');
$.each(attributes, function(index, attribute) {
// build srcset with image base
if (attribute.name === 'srcset' || attribute.name === srcAttr) {
attribute.value = getCorrectedSrcSet(attribute.value, imageBase);
}
target.attr(attribute.name, attribute.value);
});
element.replaceWith(target);
return target;
}
/**
* create a new image element inside parent element
* @param {jQuery|object} parent
* @param {string} src
* @param {function} response
* @return void
*/
function createImageObject(parent, src, response) {
// create image tag
var imageObj = $('<img>')
// create image tag an bind callbacks for correct response
.one('load', function() {
response(true);
})
.one('error', function() {
response(false);
})
// set into picture element
.appendTo(parent)
// set src attribute at last to prevent early kick-in
.attr('src', src);
// call after load even on cached image
imageObj.complete && imageObj.load(); // jshint ignore : line
}
/**
* prepend image base to all srcset entries
* @param {string} srcset
* @param {string} imageBase
* @returns {string}
*/
function getCorrectedSrcSet(srcset, imageBase) {
if (imageBase) {
// trim, remove unnecessary spaces and split entries
var entries = srcset.split(',');
srcset = '';
for (var i = 0, l = entries.length; i < l; i++) {
srcset += imageBase + entries[i].trim() + (i !== l - 1 ? ',' : '');
}
}
return srcset;
}
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Picture Plugin v1.3 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){function e(e,a,n){var o=e.prop("attributes"),c=t("<"+a+">");return t.each(o,function(t,e){"srcset"!==e.name&&e.name!==i||(e.value=r(e.value,n)),c.attr(e.name,e.value)}),e.replaceWith(c),c}function a(e,a,r){var i=t("<img>").one("load",function(){r(!0)}).one("error",function(){r(!1)}).appendTo(e).attr("src",a);i.complete&&i.load()}function r(t,e){if(e){var a=t.split(",");t="";for(var r=0,i=a.length;r<i;r++)t+=e+a[r].trim()+(r!==i-1?",":"")}return t}var i="data-src";t.lazy(["pic","picture"],["picture"],function(n,o){if("picture"===n[0].tagName.toLowerCase()){var c=n.find(i),s=n.find("data-img"),u=this.config("imageBase")||"";c.length?(c.each(function(){e(t(this),"source",u)}),1===s.length?(s=e(s,"img",u),s.on("load",function(){o(!0)}).on("error",function(){o(!1)}),s.attr("src",s.attr(i)),this.config("removeAttribute")&&s.removeAttr(i)):n.attr(i)?(a(n,u+n.attr(i),o),this.config("removeAttribute")&&n.removeAttr(i)):o(!1)):n.attr("data-srcset")?(t("<source>").attr({media:n.attr("data-media"),sizes:n.attr("data-sizes"),type:n.attr("data-type"),srcset:r(n.attr("data-srcset"),u)}).appendTo(n),a(n,u+n.attr(i),o),this.config("removeAttribute")&&n.removeAttr(i+" data-srcset data-media data-sizes data-type")):o(!1)}else o(!1)})}(window.jQuery||window.Zepto);

28
node_modules/jquery-lazy/plugins/jquery.lazy.script.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
/*!
* jQuery & Zepto Lazy - Script Plugin - v1.2
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// loads javascript files for script tags, like:
// <script data-src="file.js" type="text/javascript"></script>
$.lazy(['js', 'javascript', 'script'], 'script', function(element, response) {
if (element[0].tagName.toLowerCase() === 'script') {
element.attr('src', element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Script Plugin v1.2 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["js","javascript","script"],"script",function(t,r){"script"===t[0].tagName.toLowerCase()?(t.attr("src",t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):r(!1)})}(window.jQuery||window.Zepto);

31
node_modules/jquery-lazy/plugins/jquery.lazy.vimeo.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
/*!
* jQuery & Zepto Lazy - Vimeo Plugin - v1.1
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load vimeo video iframe, like:
// <iframe data-loader="vimeo" data-src="176894130" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
$.lazy('vimeo', function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
element.attr('src', 'https://player.vimeo.com/video/' + element.attr('data-src'));
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
// use response function for Zepto
response(false);
}
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - Vimeo Plugin v1.1 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy("vimeo",function(t,e){"iframe"===t[0].tagName.toLowerCase()?(t.attr("src","https://player.vimeo.com/video/"+t.attr("data-src")),this.config("removeAttribute")&&t.removeAttr("data-src")):e(!1)})}(window.jQuery||window.Zepto);

View file

@ -0,0 +1,31 @@
/*!
* jQuery & Zepto Lazy - YouTube Plugin - v1.5
* http://jquery.eisbehr.de/lazy/
*
* Copyright 2012 - 2018, Daniel 'Eisbehr' Kern
*
* Dual licensed under the MIT and GPL-2.0 licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
*/
;(function($) {
// load youtube video iframe, like:
// <iframe data-loader="yt" data-src="1AYGnw6MwFM" data-nocookie="1" width="560" height="315" frameborder="0" allowfullscreen></iframe>
$.lazy(['yt', 'youtube'], function(element, response) {
if (element[0].tagName.toLowerCase() === 'iframe') {
// pass source to iframe
var noCookie = /1|true/.test(element.attr('data-nocookie'));
element.attr('src', 'https://www.youtube' + (noCookie ? '-nocookie' : '') + '.com/embed/' + element.attr('data-src') + '?rel=0&amp;showinfo=0');
// remove attribute
if (this.config('removeAttribute')) {
element.removeAttr('data-src');
}
}
else {
// pass error state
response(false);
}
});
})(window.jQuery || window.Zepto);

View file

@ -0,0 +1,2 @@
/*! jQuery & Zepto Lazy - YouTube Plugin v1.5 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */
!function(t){t.lazy(["yt","youtube"],function(t,e){if("iframe"===t[0].tagName.toLowerCase()){var o=/1|true/.test(t.attr("data-nocookie"));t.attr("src","https://www.youtube"+(o?"-nocookie":"")+".com/embed/"+t.attr("data-src")+"?rel=0&amp;showinfo=0"),this.config("removeAttribute")&&t.removeAttr("data-src")}else e(!1)})}(window.jQuery||window.Zepto);