mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-23 16:52:26 +02:00
Added grunt-contrib-requirejs
This commit is contained in:
parent
ffe50c8674
commit
b5eee075ee
20
Gruntfile.js
20
Gruntfile.js
|
@ -117,6 +117,23 @@ module.exports = function (grunt) {
|
|||
{ src: ['**'], cwd: '<%= source_folder %>TF_Themes/', dest: '<%= dist_folder %>TF_Themes/', expand: true }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
requirejs: {
|
||||
compile: {
|
||||
options: {
|
||||
baseUrl: 'src/',
|
||||
'paths': {
|
||||
'tf': '.'
|
||||
},
|
||||
include: ['../libs/almond/almond','core'],
|
||||
out: 'dist/tf.js',
|
||||
wrap: {
|
||||
startFile: "parts/start.frag",
|
||||
endFile: "parts/end.frag"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -127,9 +144,10 @@ module.exports = function (grunt) {
|
|||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
||||
|
||||
// This is the default task being executed if Grunt
|
||||
// is called without any further parameter.
|
||||
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'copy']);
|
||||
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'copy', 'requirejs']);
|
||||
grunt.registerTask('dev', ['jshint', 'concat', 'cssmin', 'copy']);
|
||||
};
|
6758
dist/core.js
vendored
6758
dist/core.js
vendored
File diff suppressed because one or more lines are too long
2
dist/filtergrid.css
vendored
2
dist/filtergrid.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/*------------------------------------------------------------------------
|
||||
- TableFilter stylesheet by Max Guglielmi
|
||||
- (build date: Mon Oct 27 2014 17:57:13)
|
||||
- (build date: Sat Nov 01 2014 22:27:27)
|
||||
- Edit below for your projects' needs
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
|
|
2
dist/modules/loader.js
vendored
2
dist/modules/loader.js
vendored
|
@ -32,7 +32,7 @@ console.log(arguments);
|
|||
var containerDiv = dom.create('div',['id', tf.prfxLoader+tf.id]);
|
||||
containerDiv.className = tf.loaderCssClass;
|
||||
|
||||
var targetEl = (!tf.loaderTgtId) ?
|
||||
var targetEl = !tf.loaderTgtId ?
|
||||
(tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) :
|
||||
TF.id(tf.loaderTgtId);
|
||||
if(!tf.loaderTgtId){
|
||||
|
|
20
libs/almond/.bower.json
Normal file
20
libs/almond/.bower.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "almond",
|
||||
"version": "0.3.0",
|
||||
"main": "almond.js",
|
||||
"ignore": [
|
||||
"tests",
|
||||
"shrinktest.sh"
|
||||
],
|
||||
"homepage": "https://github.com/jrburke/almond",
|
||||
"_release": "0.3.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.3.0",
|
||||
"commit": "5bc2e5f62569e9026159b6e6e37949e047035ca7"
|
||||
},
|
||||
"_source": "git://github.com/jrburke/almond.git",
|
||||
"_target": "~0.3.0",
|
||||
"_originalSource": "almond",
|
||||
"_direct": true
|
||||
}
|
1
libs/almond/.gitignore
vendored
Normal file
1
libs/almond/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
2
libs/almond/.npmignore
Normal file
2
libs/almond/.npmignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
tests
|
||||
*.sh
|
12
libs/almond/.travis.yml
Normal file
12
libs/almond/.travis.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
language: node_js
|
||||
node_js: 0.8
|
||||
|
||||
before_script:
|
||||
- node tests/server.js &
|
||||
- sleep 1
|
||||
|
||||
script: phantomjs tests/runner.js
|
||||
|
||||
after_script:
|
||||
- kill -9 `cat tests/pid.txt`
|
||||
- rm tests/pid.txt
|
58
libs/almond/LICENSE
Normal file
58
libs/almond/LICENSE
Normal file
|
@ -0,0 +1,58 @@
|
|||
almond is released under two licenses: new BSD, and MIT. You may pick the
|
||||
license that best suits your development needs. The text of both licenses are
|
||||
provided below.
|
||||
|
||||
|
||||
The "New" BSD License:
|
||||
----------------------
|
||||
|
||||
Copyright (c) 2010-2011, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
Copyright (c) 2010-2011, The Dojo Foundation
|
||||
|
||||
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.
|
228
libs/almond/README.md
Normal file
228
libs/almond/README.md
Normal file
|
@ -0,0 +1,228 @@
|
|||
#almond
|
||||
|
||||
A replacement [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) loader for
|
||||
[RequireJS](http://requirejs.org). It provides a minimal AMD API footprint that includes [loader plugin](http://requirejs.org/docs/plugins.html) support. Only useful for built/bundled AMD modules, does not do dynamic loading.
|
||||
|
||||
## Why
|
||||
|
||||
Some developers like to use the AMD API to code modular JavaScript, but after doing an optimized build,
|
||||
they do not want to include a full AMD loader like RequireJS, since they do not need all that functionality.
|
||||
Some use cases, like mobile, are very sensitive to file sizes.
|
||||
|
||||
By including almond in the built file, there is no need for RequireJS.
|
||||
almond is around **1 kilobyte** when minified with Closure Compiler and gzipped.
|
||||
|
||||
Since it can support certain types of loader plugin-optimized resources, it is a great
|
||||
fit for a library that wants to use [text templates](http://requirejs.org/docs/api.html#text)
|
||||
or [CoffeeScript](https://github.com/jrburke/require-cs) as part of
|
||||
their project, but get a tiny download in one file after using the
|
||||
[RequireJS Optimizer](http://requirejs.org/docs/optimization.html).
|
||||
|
||||
If you are building a library, the wrap=true support in the RequireJS optimizer
|
||||
will wrap the optimized file in a closure, so the define/require AMD API does not
|
||||
escape the file. Users of your optimized file will only see the global API you decide
|
||||
to export, not the AMD API. See the usage section below for more details.
|
||||
|
||||
So, you get great code cleanliness with AMD and the use of powerful loader plugins
|
||||
in a tiny wrapper that makes it easy for others to use your code even if they do not use AMD.
|
||||
|
||||
If you want a single file build output but without the module APIs included, you might want to consider [AMDclean](https://github.com/gfranko/amdclean).
|
||||
|
||||
## Restrictions
|
||||
|
||||
It is best used for libraries or apps that use AMD and:
|
||||
|
||||
* optimize all the modules into one file -- no dynamic code loading.
|
||||
* all modules have IDs and dependency arrays in their define() calls -- the RequireJS optimizer will take care of this for you.
|
||||
* only have **one** requirejs.config() or require.config() call.
|
||||
* the requirejs.config/require.config call needs to be included in the build output. This is particularly important for making sure any [map config](http://requirejs.org/docs/api.html#config-map) use still works.
|
||||
* do not use the `var require = {};` style of [passing config](http://requirejs.org/docs/api.html#config).
|
||||
* do not use [RequireJS multiversion support/contexts](http://requirejs.org/docs/api.html#multiversion).
|
||||
* do not use require.toUrl() or require.nameToUrl().
|
||||
* do not use [packages/packagePaths config](http://requirejs.org/docs/api.html#packages). If you need to use packages that have a main property, [volo](https://github.com/volojs/volo) can create an adapter module so that it can work without this config. Use the `amdify add` command to add the dependency to your project.
|
||||
|
||||
What is supported:
|
||||
|
||||
* dependencies with relative IDs.
|
||||
* define('id', {}) definitions.
|
||||
* define(), require() and requirejs() calls.
|
||||
* loader plugins that can inline their resources into optimized files, and
|
||||
can access those inlined resources synchronously after the optimization pass.
|
||||
The [text](http://requirejs.org/docs/api.html#text) and
|
||||
[CoffeeScript](https://github.com/jrburke/require-cs) plugins are two such plugins.
|
||||
|
||||
## Download
|
||||
|
||||
[Latest release](https://github.com/jrburke/almond/raw/latest/almond.js)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
[Download the RequireJS optimizer](http://requirejs.org/docs/download.html#rjs).
|
||||
|
||||
[Download the current release of almond.js](https://github.com/jrburke/almond/raw/latest/almond.js).
|
||||
|
||||
Run the optimizer using [Node](http://nodejs.org) (also [works in Java](https://github.com/jrburke/r.js/blob/master/README.md)):
|
||||
|
||||
node r.js -o baseUrl=. name=path/to/almond include=main out=main-built.js wrap=true
|
||||
|
||||
This assumes your project's top-level script file is called main.js and the command
|
||||
above is run from the directory containing main.js. If you prefer to use a build.js build profile instead of command line arguments, [this RequireJS optimization section](http://requirejs.org/docs/optimization.html#pitfalls) has info on how to do that.
|
||||
|
||||
wrap=true will add this wrapper around the main-built.js contents (which will be minified by UglifyJS:
|
||||
|
||||
(function () {
|
||||
//almond will be here
|
||||
//main and its nested dependencies will be here
|
||||
}());
|
||||
|
||||
If you do not want that wrapper, leave off the wrap=true argument.
|
||||
|
||||
These optimizer arguments can also be used in a build config object, so it can be used
|
||||
in [runtime-generated server builds](https://github.com/jrburke/r.js/blob/master/build/tests/http/httpBuild.js).
|
||||
|
||||
|
||||
## Triggering module execution <a name="execution"></a>
|
||||
|
||||
As of RequireJS 2.0 and almond 0.1, modules are only executed if they are
|
||||
called by a top level require call. The data-main attribute on a script tag
|
||||
for require.js counts as a top level require call.
|
||||
|
||||
However with almond, it does not look for a data-main attribute, and if your
|
||||
main JS module does not use a top level require() or requirejs() call to
|
||||
trigger module loading/execution, after a build, it may appear that the code
|
||||
broke -- no modules execute.
|
||||
|
||||
The 2.0 RequireJS optimizer has a build config, option **insertRequire** that you
|
||||
can use to specify that a require([]) call is inserted at the end of the built
|
||||
file to trigger module loading. Example:
|
||||
|
||||
node r.js -o baseUrl=. name=path/to/almond.js include=main insertRequire=main out=main-built.js wrap=true
|
||||
|
||||
or, if using a build config file:
|
||||
|
||||
```javascript
|
||||
{
|
||||
baseUrl: '.',
|
||||
name: 'path/to/almond',
|
||||
include: ['main'],
|
||||
insertRequire: ['main'],
|
||||
out: 'main-built.js',
|
||||
wrap: true
|
||||
}
|
||||
```
|
||||
|
||||
This will result with `require(["main"]);` at the bottom of main-built.js.
|
||||
|
||||
## Exporting a public API
|
||||
|
||||
If you are making a library that is made up of AMD modules in source form, but will be built with almond into one file, and you want to export a small public
|
||||
API for that library, you can use the `wrap` build config to do so. Build
|
||||
config:
|
||||
|
||||
```javascript
|
||||
{
|
||||
baseUrl: '.',
|
||||
name: 'path/to/almond',
|
||||
include: ['main'],
|
||||
out: 'lib-built.js',
|
||||
wrap: {
|
||||
startFile: 'path/to/start.frag',
|
||||
endFile: 'path/to/end.frag'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where start.frag could look like this:
|
||||
|
||||
```javascript
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
//Allow using this built library as an AMD module
|
||||
//in another project. That other project will only
|
||||
//see this AMD call, not the internal modules in
|
||||
//the closure below.
|
||||
define([], factory);
|
||||
} else {
|
||||
//Browser globals case. Just assign the
|
||||
//result to a property on the global.
|
||||
root.libGlobalName = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
//almond, and your modules will be inlined here
|
||||
```
|
||||
|
||||
and end.frag is like this:
|
||||
```javascript
|
||||
//The modules for your project will be inlined above
|
||||
//this snippet. Ask almond to synchronously require the
|
||||
//module value for 'main' here and return it as the
|
||||
//value to use for the public API for the built file.
|
||||
return require('main');
|
||||
}));
|
||||
```
|
||||
|
||||
After the build, then the built file should be structured like so:
|
||||
|
||||
* start.frag
|
||||
* almond.js
|
||||
* modules for your lib, including 'main'
|
||||
* end.frag
|
||||
|
||||
## Common errors
|
||||
|
||||
Explanations of common errors:
|
||||
|
||||
### deps is undefined
|
||||
|
||||
Where this line is mentioned:
|
||||
|
||||
if (!deps.splice) {
|
||||
|
||||
It usually means that there is a define()'d module, but it is missing a name,
|
||||
something that looks like this:
|
||||
|
||||
define(function () {});
|
||||
//or
|
||||
define([], function () {});
|
||||
|
||||
|
||||
when it should look like:
|
||||
|
||||
define('someName', function () {});
|
||||
//or
|
||||
define('someName', [], function () {});
|
||||
|
||||
|
||||
This is usually a sign that the tool you used to combine all the modules
|
||||
together did not properly name an anonymous AMD module.
|
||||
|
||||
### x missing y
|
||||
|
||||
It means that module 'x' asked for module 'y', but module 'y' was not available.
|
||||
|
||||
This usually means that 'y' was not included in the built file that includes almond.
|
||||
|
||||
almond can only handle modules built in with it, it cannot dynamically load
|
||||
modules from the network.
|
||||
|
||||
|
||||
### No y
|
||||
|
||||
It means that a `require('y')` call was done but y was not available.
|
||||
|
||||
This usually means that 'y' was not included in the built file that includes almond.
|
||||
|
||||
almond can only handle modules built in with it, it cannot dynamically load
|
||||
modules from the network.
|
||||
|
||||
## How to get help
|
||||
|
||||
* Contact the [requirejs list](https://groups.google.com/group/requirejs).
|
||||
* Open issues in the [issue tracker](https://github.com/jrburke/almond/issues).
|
||||
|
||||
## Contributing
|
||||
|
||||
Almond follows the
|
||||
[same contribution model as requirejs](http://requirejs.org/docs/contributing.html)
|
||||
and is considered a sub-project of requirejs.
|
429
libs/almond/almond.js
Normal file
429
libs/almond/almond.js
Normal file
|
@ -0,0 +1,429 @@
|
|||
/**
|
||||
* @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/almond for details
|
||||
*/
|
||||
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
||||
//be followed.
|
||||
/*jslint sloppy: true */
|
||||
/*global setTimeout: false */
|
||||
|
||||
var requirejs, require, define;
|
||||
(function (undef) {
|
||||
var main, req, makeMap, handlers,
|
||||
defined = {},
|
||||
waiting = {},
|
||||
config = {},
|
||||
defining = {},
|
||||
hasOwn = Object.prototype.hasOwnProperty,
|
||||
aps = [].slice,
|
||||
jsSuffixRegExp = /\.js$/;
|
||||
|
||||
function hasProp(obj, prop) {
|
||||
return hasOwn.call(obj, prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a relative module name, like ./something, normalize it to
|
||||
* a real name that can be mapped to a path.
|
||||
* @param {String} name the relative name
|
||||
* @param {String} baseName a real name that the name arg is relative
|
||||
* to.
|
||||
* @returns {String} normalized name
|
||||
*/
|
||||
function normalize(name, baseName) {
|
||||
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
||||
foundI, foundStarMap, starI, i, j, part,
|
||||
baseParts = baseName && baseName.split("/"),
|
||||
map = config.map,
|
||||
starMap = (map && map['*']) || {};
|
||||
|
||||
//Adjust any relative paths.
|
||||
if (name && name.charAt(0) === ".") {
|
||||
//If have a base name, try to normalize against it,
|
||||
//otherwise, assume it is a top-level require that will
|
||||
//be relative to baseUrl in the end.
|
||||
if (baseName) {
|
||||
//Convert baseName to array, and lop off the last part,
|
||||
//so that . matches that "directory" and not name of the baseName's
|
||||
//module. For instance, baseName of "one/two/three", maps to
|
||||
//"one/two/three.js", but we want the directory, "one/two" for
|
||||
//this normalization.
|
||||
baseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
name = name.split('/');
|
||||
lastIndex = name.length - 1;
|
||||
|
||||
// Node .js allowance:
|
||||
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
||||
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
||||
}
|
||||
|
||||
name = baseParts.concat(name);
|
||||
|
||||
//start trimDots
|
||||
for (i = 0; i < name.length; i += 1) {
|
||||
part = name[i];
|
||||
if (part === ".") {
|
||||
name.splice(i, 1);
|
||||
i -= 1;
|
||||
} else if (part === "..") {
|
||||
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
||||
//End of the line. Keep at least one non-dot
|
||||
//path segment at the front so it can be mapped
|
||||
//correctly to disk. Otherwise, there is likely
|
||||
//no path mapping for a path starting with '..'.
|
||||
//This can still fail, but catches the most reasonable
|
||||
//uses of ..
|
||||
break;
|
||||
} else if (i > 0) {
|
||||
name.splice(i - 1, 2);
|
||||
i -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
//end trimDots
|
||||
|
||||
name = name.join("/");
|
||||
} else if (name.indexOf('./') === 0) {
|
||||
// No baseName, so this is ID is resolved relative
|
||||
// to baseUrl, pull off the leading dot.
|
||||
name = name.substring(2);
|
||||
}
|
||||
}
|
||||
|
||||
//Apply map config if available.
|
||||
if ((baseParts || starMap) && map) {
|
||||
nameParts = name.split('/');
|
||||
|
||||
for (i = nameParts.length; i > 0; i -= 1) {
|
||||
nameSegment = nameParts.slice(0, i).join("/");
|
||||
|
||||
if (baseParts) {
|
||||
//Find the longest baseName segment match in the config.
|
||||
//So, do joins on the biggest to smallest lengths of baseParts.
|
||||
for (j = baseParts.length; j > 0; j -= 1) {
|
||||
mapValue = map[baseParts.slice(0, j).join('/')];
|
||||
|
||||
//baseName segment has config, find if it has one for
|
||||
//this name.
|
||||
if (mapValue) {
|
||||
mapValue = mapValue[nameSegment];
|
||||
if (mapValue) {
|
||||
//Match, update name to the new value.
|
||||
foundMap = mapValue;
|
||||
foundI = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundMap) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Check for a star map match, but just hold on to it,
|
||||
//if there is a shorter segment match later in a matching
|
||||
//config, then favor over this star map.
|
||||
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
||||
foundStarMap = starMap[nameSegment];
|
||||
starI = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMap && foundStarMap) {
|
||||
foundMap = foundStarMap;
|
||||
foundI = starI;
|
||||
}
|
||||
|
||||
if (foundMap) {
|
||||
nameParts.splice(0, foundI, foundMap);
|
||||
name = nameParts.join('/');
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function makeRequire(relName, forceSync) {
|
||||
return function () {
|
||||
//A version of a require function that passes a moduleName
|
||||
//value for items that may need to
|
||||
//look up paths relative to the moduleName
|
||||
var args = aps.call(arguments, 0);
|
||||
|
||||
//If first arg is not require('string'), and there is only
|
||||
//one arg, it is the array form without a callback. Insert
|
||||
//a null so that the following concat is correct.
|
||||
if (typeof args[0] !== 'string' && args.length === 1) {
|
||||
args.push(null);
|
||||
}
|
||||
return req.apply(undef, args.concat([relName, forceSync]));
|
||||
};
|
||||
}
|
||||
|
||||
function makeNormalize(relName) {
|
||||
return function (name) {
|
||||
return normalize(name, relName);
|
||||
};
|
||||
}
|
||||
|
||||
function makeLoad(depName) {
|
||||
return function (value) {
|
||||
defined[depName] = value;
|
||||
};
|
||||
}
|
||||
|
||||
function callDep(name) {
|
||||
if (hasProp(waiting, name)) {
|
||||
var args = waiting[name];
|
||||
delete waiting[name];
|
||||
defining[name] = true;
|
||||
main.apply(undef, args);
|
||||
}
|
||||
|
||||
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
||||
throw new Error('No ' + name);
|
||||
}
|
||||
return defined[name];
|
||||
}
|
||||
|
||||
//Turns a plugin!resource to [plugin, resource]
|
||||
//with the plugin being undefined if the name
|
||||
//did not have a plugin prefix.
|
||||
function splitPrefix(name) {
|
||||
var prefix,
|
||||
index = name ? name.indexOf('!') : -1;
|
||||
if (index > -1) {
|
||||
prefix = name.substring(0, index);
|
||||
name = name.substring(index + 1, name.length);
|
||||
}
|
||||
return [prefix, name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a name map, normalizing the name, and using a plugin
|
||||
* for normalization if necessary. Grabs a ref to plugin
|
||||
* too, as an optimization.
|
||||
*/
|
||||
makeMap = function (name, relName) {
|
||||
var plugin,
|
||||
parts = splitPrefix(name),
|
||||
prefix = parts[0];
|
||||
|
||||
name = parts[1];
|
||||
|
||||
if (prefix) {
|
||||
prefix = normalize(prefix, relName);
|
||||
plugin = callDep(prefix);
|
||||
}
|
||||
|
||||
//Normalize according
|
||||
if (prefix) {
|
||||
if (plugin && plugin.normalize) {
|
||||
name = plugin.normalize(name, makeNormalize(relName));
|
||||
} else {
|
||||
name = normalize(name, relName);
|
||||
}
|
||||
} else {
|
||||
name = normalize(name, relName);
|
||||
parts = splitPrefix(name);
|
||||
prefix = parts[0];
|
||||
name = parts[1];
|
||||
if (prefix) {
|
||||
plugin = callDep(prefix);
|
||||
}
|
||||
}
|
||||
|
||||
//Using ridiculous property names for space reasons
|
||||
return {
|
||||
f: prefix ? prefix + '!' + name : name, //fullName
|
||||
n: name,
|
||||
pr: prefix,
|
||||
p: plugin
|
||||
};
|
||||
};
|
||||
|
||||
function makeConfig(name) {
|
||||
return function () {
|
||||
return (config && config.config && config.config[name]) || {};
|
||||
};
|
||||
}
|
||||
|
||||
handlers = {
|
||||
require: function (name) {
|
||||
return makeRequire(name);
|
||||
},
|
||||
exports: function (name) {
|
||||
var e = defined[name];
|
||||
if (typeof e !== 'undefined') {
|
||||
return e;
|
||||
} else {
|
||||
return (defined[name] = {});
|
||||
}
|
||||
},
|
||||
module: function (name) {
|
||||
return {
|
||||
id: name,
|
||||
uri: '',
|
||||
exports: defined[name],
|
||||
config: makeConfig(name)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
main = function (name, deps, callback, relName) {
|
||||
var cjsModule, depName, ret, map, i,
|
||||
args = [],
|
||||
callbackType = typeof callback,
|
||||
usingExports;
|
||||
|
||||
//Use name if no relName
|
||||
relName = relName || name;
|
||||
|
||||
//Call the callback to define the module, if necessary.
|
||||
if (callbackType === 'undefined' || callbackType === 'function') {
|
||||
//Pull out the defined dependencies and pass the ordered
|
||||
//values to the callback.
|
||||
//Default to [require, exports, module] if no deps
|
||||
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
||||
for (i = 0; i < deps.length; i += 1) {
|
||||
map = makeMap(deps[i], relName);
|
||||
depName = map.f;
|
||||
|
||||
//Fast path CommonJS standard dependencies.
|
||||
if (depName === "require") {
|
||||
args[i] = handlers.require(name);
|
||||
} else if (depName === "exports") {
|
||||
//CommonJS module spec 1.1
|
||||
args[i] = handlers.exports(name);
|
||||
usingExports = true;
|
||||
} else if (depName === "module") {
|
||||
//CommonJS module spec 1.1
|
||||
cjsModule = args[i] = handlers.module(name);
|
||||
} else if (hasProp(defined, depName) ||
|
||||
hasProp(waiting, depName) ||
|
||||
hasProp(defining, depName)) {
|
||||
args[i] = callDep(depName);
|
||||
} else if (map.p) {
|
||||
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
||||
args[i] = defined[depName];
|
||||
} else {
|
||||
throw new Error(name + ' missing ' + depName);
|
||||
}
|
||||
}
|
||||
|
||||
ret = callback ? callback.apply(defined[name], args) : undefined;
|
||||
|
||||
if (name) {
|
||||
//If setting exports via "module" is in play,
|
||||
//favor that over return value and exports. After that,
|
||||
//favor a non-undefined return value over exports use.
|
||||
if (cjsModule && cjsModule.exports !== undef &&
|
||||
cjsModule.exports !== defined[name]) {
|
||||
defined[name] = cjsModule.exports;
|
||||
} else if (ret !== undef || !usingExports) {
|
||||
//Use the return value from the function.
|
||||
defined[name] = ret;
|
||||
}
|
||||
}
|
||||
} else if (name) {
|
||||
//May just be an object definition for the module. Only
|
||||
//worry about defining if have a module name.
|
||||
defined[name] = callback;
|
||||
}
|
||||
};
|
||||
|
||||
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
||||
if (typeof deps === "string") {
|
||||
if (handlers[deps]) {
|
||||
//callback in this case is really relName
|
||||
return handlers[deps](callback);
|
||||
}
|
||||
//Just return the module wanted. In this scenario, the
|
||||
//deps arg is the module name, and second arg (if passed)
|
||||
//is just the relName.
|
||||
//Normalize module name, if it contains . or ..
|
||||
return callDep(makeMap(deps, callback).f);
|
||||
} else if (!deps.splice) {
|
||||
//deps is a config object, not an array.
|
||||
config = deps;
|
||||
if (config.deps) {
|
||||
req(config.deps, config.callback);
|
||||
}
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback.splice) {
|
||||
//callback is an array, which means it is a dependency list.
|
||||
//Adjust args if there are dependencies
|
||||
deps = callback;
|
||||
callback = relName;
|
||||
relName = null;
|
||||
} else {
|
||||
deps = undef;
|
||||
}
|
||||
}
|
||||
|
||||
//Support require(['a'])
|
||||
callback = callback || function () {};
|
||||
|
||||
//If relName is a function, it is an errback handler,
|
||||
//so remove it.
|
||||
if (typeof relName === 'function') {
|
||||
relName = forceSync;
|
||||
forceSync = alt;
|
||||
}
|
||||
|
||||
//Simulate async callback;
|
||||
if (forceSync) {
|
||||
main(undef, deps, callback, relName);
|
||||
} else {
|
||||
//Using a non-zero value because of concern for what old browsers
|
||||
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
||||
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
||||
//If want a value immediately, use require('id') instead -- something
|
||||
//that works in almond on the global level, but not guaranteed and
|
||||
//unlikely to work in other AMD implementations.
|
||||
setTimeout(function () {
|
||||
main(undef, deps, callback, relName);
|
||||
}, 4);
|
||||
}
|
||||
|
||||
return req;
|
||||
};
|
||||
|
||||
/**
|
||||
* Just drops the config on the floor, but returns req in case
|
||||
* the config return value is used.
|
||||
*/
|
||||
req.config = function (cfg) {
|
||||
return req(cfg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose module registry for debugging and tooling
|
||||
*/
|
||||
requirejs._defined = defined;
|
||||
|
||||
define = function (name, deps, callback) {
|
||||
|
||||
//This module may not have dependencies
|
||||
if (!deps.splice) {
|
||||
//deps is not an array, so probably means
|
||||
//an object literal or factory function for
|
||||
//the value. Adjust args.
|
||||
callback = deps;
|
||||
deps = [];
|
||||
}
|
||||
|
||||
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
||||
waiting[name] = [name, deps, callback];
|
||||
}
|
||||
};
|
||||
|
||||
define.amd = {
|
||||
jQuery: true
|
||||
};
|
||||
}());
|
9
libs/almond/bower.json
Normal file
9
libs/almond/bower.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "almond",
|
||||
"version": "0.3.0",
|
||||
"main": "almond.js",
|
||||
"ignore": [
|
||||
"tests",
|
||||
"shrinktest.sh"
|
||||
]
|
||||
}
|
28
libs/almond/package.json
Normal file
28
libs/almond/package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "almond",
|
||||
"description": "A minimal AMD API implementation for use in optimized browser builds.",
|
||||
"version": "0.3.0",
|
||||
"homepage": "http://github.com/jrburke/almond",
|
||||
"author": "James Burke <jrburke@gmail.com> (http://github.com/jrburke)",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jrburke/almond.git"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "https://github.com/jrburke/almond/blob/master/LICENSE"
|
||||
},
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jrburke/almond/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "almond.js",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"connect": "*"
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-cssmin": "~0.6.1",
|
||||
"grunt-contrib-jshint": "~0.6.1",
|
||||
"grunt-contrib-requirejs": "^0.4.4",
|
||||
"grunt-contrib-uglify": "~0.2.2",
|
||||
"grunt-contrib-watch": "^0.6.1"
|
||||
},
|
||||
|
|
0
src/end.frag
Normal file
0
src/end.frag
Normal file
|
@ -32,7 +32,7 @@ console.log(arguments);
|
|||
var containerDiv = dom.create('div',['id', tf.prfxLoader+tf.id]);
|
||||
containerDiv.className = tf.loaderCssClass;
|
||||
|
||||
var targetEl = (!tf.loaderTgtId) ?
|
||||
var targetEl = !tf.loaderTgtId ?
|
||||
(tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) :
|
||||
TF.id(tf.loaderTgtId);
|
||||
if(!tf.loaderTgtId){
|
||||
|
|
0
src/start.frag
Normal file
0
src/start.frag
Normal file
Loading…
Reference in a new issue