1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Ability to use CDN for core-defined libraries. Ability to select CDN provider.

This commit is contained in:
Lóna Lore
2017-01-08 12:02:10 +01:00
parent 3dee2dc977
commit efeeeb94a4
330 changed files with 63064 additions and 29 deletions

View File

@@ -0,0 +1,32 @@
{
"name": "jquery-once",
"homepage": "http://github.com/robloach/jquery-once",
"description": "Act on jQuery elements only once.",
"license": "GPL-2.0",
"main": "jquery.once.js",
"ignore": [
"*.json",
"test",
"example",
".travis.yml",
".gitignore",
"Gruntfile.js"
],
"keywords": [
"jquery",
"jquery-plugin"
],
"dependencies": {
"jquery": "*"
},
"version": "2.1.2",
"_release": "2.1.2",
"_resolution": {
"type": "version",
"tag": "2.1.2",
"commit": "fa5b6103eed06f3ccbe3540459c0060bb5f443f3"
},
"_source": "https://github.com/RobLoach/jquery-once.git",
"_target": "2.x",
"_originalSource": "jquery-once"
}

View File

@@ -0,0 +1,11 @@
# EditorConfig
# http://editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

View File

@@ -0,0 +1,109 @@
## Functions
<dl>
<dt><a href="#once">once([id])</a></dt>
<dd><p>Filter elements that have yet to be processed by the given data ID.</p>
</dd>
<dt><a href="#removeOnce">removeOnce([id])</a></dt>
<dd><p>Removes the once data from elements, based on the given ID.</p>
</dd>
<dt><a href="#findOnce">findOnce([id])</a></dt>
<dd><p>Filters elements that have already been processed once.</p>
</dd>
</dl>
<a name="once"></a>
## once([id]) ⇒
Filter elements that have yet to be processed by the given data ID.
**Kind**: global function
**Returns**: jQuery collection of elements that have now run once by
the given ID.
**this**: <code>jQuery</code>
**Access:** public
**See**
- removeOnce
- findOnce
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [id] | <code>string</code> | <code>&quot;once&quot;</code> | The data ID used to determine whether the given elements have already been processed or not. Defaults to `'once'`. |
**Example**
``` javascript
// The following will change the color of each paragraph to red, just once
// for the 'changecolor' key.
$('p').once('changecolor').css('color', 'red');
// .once() will return a set of elements that yet to have the once ID
// associated with them. You can return to the original collection set by
// using .end().
$('p')
.once('changecolorblue')
.css('color', 'blue')
.end()
.css('color', 'red');
// To execute a function on the once set, you can use jQuery's each().
$('div.calendar').once().each(function () {
// Since there is no once ID provided here, the key will be 'once'.
});
```
<a name="removeOnce"></a>
## removeOnce([id]) ⇒
Removes the once data from elements, based on the given ID.
**Kind**: global function
**Returns**: jQuery collection of elements that were acted upon to remove their
once data.
**this**: <code>jQuery</code>
**Access:** public
**See**: once
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [id] | <code>string</code> | <code>&quot;once&quot;</code> | A string representing the name of the data ID which should be used when filtering the elements. This only filters elements that have already been processed by the once function. The ID should be the same ID that was originally passed to the once() function. Defaults to `'once'`. |
**Example**
``` javascript
// Remove once data with the 'changecolor' ID. The result set is the
// elements that had their once data removed.
$('p').removeOnce('changecolor').css('color', '');
// Any jQuery function can be performed on the result set.
$('div.calendar').removeOnce().each(function () {
// Remove the calendar behavior.
});
```
<a name="findOnce"></a>
## findOnce([id]) ⇒
Filters elements that have already been processed once.
**Kind**: global function
**Returns**: jQuery collection of elements that have been run once.
**this**: <code>jQuery</code>
**Access:** public
**See**: once
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [id] | <code>string</code> | <code>&quot;once&quot;</code> | A string representing the name of the data id which should be used when filtering the elements. This only filters elements that have already been processed by the once function. The id should be the same id that was originally passed to the once() function. Defaults to 'once'. |
**Example**
``` javascript
// Find all elements that have been changecolor'ed once.
$('p').findOnce('changecolor').each(function () {
// This function is called for all elements that has already once'd.
});
// Find all elements that have been acted on with the default 'once' key.
$('p').findOnce().each(function () {
// This function is called for all elements that have been acted on with
// a 'once' action.
});
```

View File

@@ -0,0 +1,92 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.1.2] - June 11th, 2016
### Changed
- Updated development dependencies
- Updated documentation
- Switched from [`semistandard`](http://npm.im/semistandard) to [`xo`](http://npm.im/xo) for coding standards
- Tested in [jQuery 3.0](https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/)
## [2.1.1] - August 31st, 2015
### Fixed
- Corrected version information in the source
## [2.1.0] - August 31st, 2015
### Changed
- Switched to [Keep a CHANGELOG](http://keepachangelog.com) in CHANGELOG.md
- Moved to [JavaScript Semi-Standard Coding Style](http://npm.im/semistandard)
- Updated development dependencies
## [2.0.2] - June 5th, 2015
### Added
- Added code coverage
- Added [jsDelivr CDN](http://www.jsdelivr.com/#!jquery-once) automated support
- Added [cdnjs](https://github.com/cdnjs/cdnjs) automated support
## [2.0.1] - May 5th, 2015
### Changed
- Updated development dependencies
- Updated documentation
## [2.0.0] - January 20th, 2015
### Fixed
- Fixed type checking of the `id` parameter of `.once()` as optional
- From [@theodoreb](http://github.com/theodoreb)
- Fixed inline code documentation
- From [@yched](http://github.com/yched)
### Added
- Added performance improvement through [`.data()`](http://api.jquery.com/data/)
use rather than class attributes
- Added `findOnce()` function to allow filtering once'd elements
- Added automated testing through [Mocha](http://mochajs.org)
- Added [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown) to
automatically build API documentation
### Changed
- Switched to [ESLint](http://eslint.org) for code linting
- Removed unneeded cache variable
- Removed function callback in order to promote jQuery chaining standards
## [1.2.6] - August 31, 2013
### Changed
- Fixed Bower
- Updated documentation
## [1.2.4] - June 13, 2013
### Added
- Added jquery.once.min.js to the file meta data
- Added removeOnce() test
### Changed
- Don't limit jQuery.once usage to jQuery 1.8.
- Updated documentation
## [1.2.3] - June 13, 2013
### Added
- Added tests
- Fixed documentation
## [1.2.1] - May 18, 2013
### Added
- Added UMD support
- Added Bower support
## [1.2.0] - April 5, 2013
### Added
- Added jQuery Once
[unreleased]: https://github.com/RobLoach/jquery-once/compare/2.1.2...HEAD
[2.1.2]: https://github.com/RobLoach/jquery-once/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/RobLoach/jquery-once/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/RobLoach/jquery-once/compare/2.0.2...2.1.0
[2.0.2]: https://github.com/RobLoach/jquery-once/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/RobLoach/jquery-once/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/RobLoach/jquery-once/compare/1.2.6...2.0.0
[1.2.6]: https://github.com/RobLoach/jquery-once/compare/1.2.4...1.2.6
[1.2.4]: https://github.com/RobLoach/jquery-once/compare/1.2.3...1.2.4
[1.2.3]: https://github.com/RobLoach/jquery-once/compare/1.2.1...1.2.3
[1.2.1]: https://github.com/RobLoach/jquery-once/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/RobLoach/jquery-once/compare/7db530a0bd48f249c5f0df4fab02e93444623889...1.2.0

View File

@@ -0,0 +1,27 @@
# License
Copyright &copy; 2016 [Rob Loach](http://github.com/RobLoach)
## GPL-2.0
> [GPL-2.0](http://opensource.org/licenses/gpl-2.0.php)
## The MIT License
> 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.

View File

@@ -0,0 +1,104 @@
# jQuery Once [![NPM version](https://img.shields.io/npm/v/jquery-once.svg)](https://npmjs.org/package/jquery-once "View this project on NPM")
[![Build Status](https://img.shields.io/travis/RobLoach/jquery-once/master.svg)](http://travis-ci.org/RobLoach/jquery-once "Check this project's build status on TravisCI")
[![NPM downloads](https://img.shields.io/npm/dm/jquery-once.svg)](https://npmjs.org/package/jquery-once "View this project on NPM")
[![Dependency Status](https://img.shields.io/david/RobLoach/jquery-once.svg)](https://david-dm.org/RobLoach/jquery-once)
[![Coverage Status](https://coveralls.io/repos/RobLoach/jquery-once/badge.svg)](https://coveralls.io/r/RobLoach/jquery-once)
> Act on [jQuery](http://jquery.com) elements only once.
Filters out all elements that had the same filter applied on them before. It
can be used to ensure that a function is only applied once to an element.
## Install
Method | Installation
------ | ------------
[npm](http://npmjs.com/package/jquery-once) | `npm install jquery-once --save`
[Composer](https://packagist.org/packages/robloach/jquery-once) | `composer require robloach/jquery-once`
[Bower](http://bower.io/search/?q=jquery-once) | `bower install jquery-once`
[Component](https://github.com/componentjs/component) | `component install RobLoach/jquery-once`
[jsDelivr](http://www.jsdelivr.com/#!jquery.once) | `//cdn.jsdelivr.net/jquery.once/2.1.1/jquery.once.min.js`
[cdnjs](https://cdnjs.com/libraries/jquery-once) | `//cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.js`
## Usage
[See the API documentation for more information on how to use jQuery Once.](https://github.com/RobLoach/jquery-once/blob/master/API.md#readme)
``` javascript
// The following will change the color of each paragraph to red, just once
// for the "changecolor" key.
$('p').once('changecolor').css('color', 'red');
// .once() will return a set of elements that yet to have the once ID
// associated with them. You can return to the original collection set by
// using .end().
$('p')
.once("changecolorblue")
.css("color", "blue")
.end()
.css("color", "red");
// To execute a function on the once set, you can use jQuery's each().
$('div.calendar').once().each(function() {
// Since there is no once ID provided here, the key will be "once".
});
```
## Development
1. Ensure you are using [node](http://nodejs.org) >= 4:
```
node --version
```
2. Install dependencies through [npm](http://npmjs.org):
```
npm install
```
3. Check coding style standard, and automated testing:
```
npm test
```
4. Build `jquery.once.min.js` with:
```
npm run build
```
5. Update API documentation:
```
npm run docs
```
6. Tag and publish the new versions to [npm](http://npmjs.com) with [Semantic
Versioning](http://semver.org/):
```
git add -A
git commit -m "2.1.2"
git tag 2.1.2
git push origin 2.1.2
npm publish
```
### Docker
It is possible to run tests through [Docker Compose](https://docs.docker.com/compose/):
```
docker-compose up
```
## Change Log
[Discover the change history by heading on over to the `CHANGELOG.md` file.](CHANGELOG.md)
## License
Dual licensed under:
- [GPL-2.0](http://opensource.org/licenses/gpl-2.0.php)
- the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT license](http://opensource.org/licenses/MIT)
Copyright &copy; [Rob Loach](http://github.com/RobLoach)

View File

@@ -0,0 +1,22 @@
{
"name": "jquery-once",
"homepage": "http://github.com/robloach/jquery-once",
"description": "Act on jQuery elements only once.",
"license": "GPL-2.0",
"main": "jquery.once.js",
"ignore": [
"*.json",
"test",
"example",
".travis.yml",
".gitignore",
"Gruntfile.js"
],
"keywords": [
"jquery",
"jquery-plugin"
],
"dependencies": {
"jquery": "*"
}
}

View File

@@ -0,0 +1,24 @@
# Docker Compose - jQuery Once Tester
# https://docs.docker.com/compose/
#
# Runs the jQuery Once test suite through Docker Compose.
#
# 1. Install Docker Compose
#
# https://docs.docker.com/compose/)
#
# 2. Run the following to test jQuery Once:
#
# docker-compose up
#
node:
# Build off of the Node:6 container:
# https://hub.docker.com/r/_/node/
image: node:6-slim
# Run the tests through npm
command: npm test
# Mount the current working to /app
volumes:
- .:/app
# Start the application in the /app folder
working_dir: /app

View File

@@ -0,0 +1,176 @@
/*!
* jQuery Once v2.1.2 - http://github.com/robloach/jquery-once
* @license MIT, GPL-2.0
* http://opensource.org/licenses/MIT
* http://opensource.org/licenses/GPL-2.0
*/
/**
* Universal Module Definition
*
* jQuery Once has a dependency on jQuery, so we wrap the code with a UMD
* pattern in order to allow loading jQuery and jQuery Once through a module
* definition like CommonJS, AMD, or through a global object.
*
* @see {@link http://github.com/umdjs/umd}
*/
(function (factory) {
'use strict';
if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else if (typeof define === 'function' && define.amd) {
// AMD
/* globals define */
define(['jquery'], factory);
} else {
// Global object
/* globals jQuery */
factory(jQuery);
}
})(function ($) {
'use strict';
/**
* Ensures that the given ID is valid, returning 'once' if one is not given.
*
* @param {string} [id=once]
* A string representing the ID to check. Defaults to `'once'`.
*
* @returns The valid ID name.
*
* @throws Error when an ID is provided, but not a string.
* @private
*/
var checkId = function (id) {
id = id || 'once';
if (typeof id !== 'string') {
throw new Error('The jQuery Once id parameter must be a string');
}
return id;
};
/**
* Filter elements that have yet to be processed by the given data ID.
*
* @param {string} [id=once]
* The data ID used to determine whether the given elements have already
* been processed or not. Defaults to `'once'`.
*
* @returns jQuery collection of elements that have now run once by
* the given ID.
*
* @example
* ``` javascript
* // The following will change the color of each paragraph to red, just once
* // for the 'changecolor' key.
* $('p').once('changecolor').css('color', 'red');
*
* // .once() will return a set of elements that yet to have the once ID
* // associated with them. You can return to the original collection set by
* // using .end().
* $('p')
* .once('changecolorblue')
* .css('color', 'blue')
* .end()
* .css('color', 'red');
*
* // To execute a function on the once set, you can use jQuery's each().
* $('div.calendar').once().each(function () {
* // Since there is no once ID provided here, the key will be 'once'.
* });
* ```
*
* @see removeOnce
* @see findOnce
* @this jQuery
*
* @global
* @public
*/
$.fn.once = function (id) {
// Build the jQuery Once data name from the provided ID.
var name = 'jquery-once-' + checkId(id);
// Find elements that don't have the jQuery Once data applied to them yet.
return this.filter(function () {
return $(this).data(name) !== true;
}).data(name, true);
};
/**
* Removes the once data from elements, based on the given ID.
*
* @param {string} [id=once]
* A string representing the name of the data ID which should be used when
* filtering the elements. This only filters elements that have already been
* processed by the once function. The ID should be the same ID that was
* originally passed to the once() function. Defaults to `'once'`.
*
* @returns jQuery collection of elements that were acted upon to remove their
* once data.
*
* @example
* ``` javascript
* // Remove once data with the 'changecolor' ID. The result set is the
* // elements that had their once data removed.
* $('p').removeOnce('changecolor').css('color', '');
*
* // Any jQuery function can be performed on the result set.
* $('div.calendar').removeOnce().each(function () {
* // Remove the calendar behavior.
* });
* ```
*
* @see once
* @this jQuery
*
* @global
* @public
*/
$.fn.removeOnce = function (id) {
// Filter through the elements to find the once'd elements.
return this.findOnce(id).removeData('jquery-once-' + checkId(id));
};
/**
* Filters elements that have already been processed once.
*
* @param {string} [id=once]
* A string representing the name of the data id which should be used when
* filtering the elements. This only filters elements that have already
* been processed by the once function. The id should be the same id that
* was originally passed to the once() function. Defaults to 'once'.
*
* @returns jQuery collection of elements that have been run once.
*
* @example
* ``` javascript
* // Find all elements that have been changecolor'ed once.
* $('p').findOnce('changecolor').each(function () {
* // This function is called for all elements that has already once'd.
* });
*
* // Find all elements that have been acted on with the default 'once' key.
* $('p').findOnce().each(function () {
* // This function is called for all elements that have been acted on with
* // a 'once' action.
* });
* ```
*
* @see once
* @this jQuery
*
* @global
* @public
*/
$.fn.findOnce = function (id) {
// Filter the elements by which do have the data.
var name = 'jquery-once-' + checkId(id);
return this.filter(function () {
return $(this).data(name) === true;
});
};
});

View File

@@ -0,0 +1,8 @@
/*!
* jQuery Once v2.1.2 - http://github.com/robloach/jquery-once
* @license MIT, GPL-2.0
* http://opensource.org/licenses/MIT
* http://opensource.org/licenses/GPL-2.0
*/
(function(e){"use strict";if(typeof exports==="object"){e(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){"use strict";var n=function(e){e=e||"once";if(typeof e!=="string"){throw new Error("The jQuery Once id parameter must be a string")}return e};e.fn.once=function(t){var r="jquery-once-"+n(t);return this.filter(function(){return e(this).data(r)!==true}).data(r,true)};e.fn.removeOnce=function(e){return this.findOnce(e).removeData("jquery-once-"+n(e))};e.fn.findOnce=function(t){var r="jquery-once-"+n(t);return this.filter(function(){return e(this).data(r)===true})}});
//# sourceMappingURL=jquery.once.min.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["jquery.once.js"],"names":["factory","exports","require","define","amd","jQuery","$","checkId","id","Error","fn","once","name","this","filter","data","removeOnce","findOnce","removeData"],"mappings":";;;;;;CAgBA,SAAWA,GACT,YAEA,UAAWC,WAAY,SAAU,CAE/BD,EAAQE,QAAQ,eACX,UAAWC,UAAW,YAAcA,OAAOC,IAAK,CAGrDD,QAAQ,UAAWH,OACd,CAGLA,EAAQK,WAET,SAAUC,GACX,YAaA,IAAIC,GAAU,SAAUC,GACtBA,EAAKA,GAAM,MACX,UAAWA,KAAO,SAAU,CAC1B,KAAM,IAAIC,OAAM,iDAElB,MAAOD,GAyCTF,GAAEI,GAAGC,KAAO,SAAUH,GAEpB,GAAII,GAAO,eAAiBL,EAAQC,EAGpC,OAAOK,MAAKC,OAAO,WACjB,MAAOR,GAAEO,MAAME,KAAKH,KAAU,OAC7BG,KAAKH,EAAM,MAiChBN,GAAEI,GAAGM,WAAa,SAAUR,GAE1B,MAAOK,MAAKI,SAAST,GAAIU,WAAW,eAAiBX,EAAQC,IAkC/DF,GAAEI,GAAGO,SAAW,SAAUT,GAExB,GAAII,GAAO,eAAiBL,EAAQC,EAEpC,OAAOK,MAAKC,OAAO,WACjB,MAAOR,GAAEO,MAAME,KAAKH,KAAU","file":"jquery.once.min.js"}