-
- Textarea Autosize Demo
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/autosize.js/1.17.2/package/jquery.autosize-min.js b/temp/autosize.js/1.17.2/package/jquery.autosize-min.js
deleted file mode 100644
index 4a1b70679..000000000
--- a/temp/autosize.js/1.17.2/package/jquery.autosize-min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- Autosize v1.17.2 - 2013-07-28
- Automatically adjust textarea height based on user input.
- (c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
- license: http://www.opensource.org/licenses/mit-license.php
-*/
-(function(e){"function"==typeof define&&define.amd?define("jquery-autosize",["jquery"],e):e(window.jQuery||window.$)})(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var o,a={};if(t=c,s.className=i.className,l=parseInt(h.css("maxHeight"),10),e.each(n,function(e,t){a[t]=h.css(t)}),e(s).css(a),"oninput"in c){var r=c.style.width;c.style.width="0px",o=c.offsetWidth,c.style.width=r}}function a(){var n,a,r,u;t!==c&&o(),s.value=c.value+i.append,s.style.overflowY=c.style.overflowY,a=parseInt(c.style.height,10),"getComputedStyle"in window?(u=window.getComputedStyle(c),r=c.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,t){r-=parseInt(u[t],10)}),s.style.width=r+"px"):s.style.width=Math.max(h.width(),0)+"px",s.scrollTop=0,s.scrollTop=9e4,n=s.scrollTop,l&&n>l?(c.style.overflowY="scroll",n=l):(c.style.overflowY="hidden",d>n&&(n=d)),n+=p,a!==n&&(c.style.height=n+"px",f&&i.callback.call(c,c))}function r(){clearTimeout(u),u=setTimeout(function(){h.width()!==z&&a()},parseInt(i.resizeDelay,10))}var l,d,u,c=this,h=e(c),p=0,f=e.isFunction(i.callback),w={height:c.style.height,overflow:c.style.overflow,overflowY:c.style.overflowY,wordWrap:c.style.wordWrap,resize:c.style.resize},z=h.width();h.data("autosize")||(h.data("autosize",!0),("border-box"===h.css("box-sizing")||"border-box"===h.css("-moz-box-sizing")||"border-box"===h.css("-webkit-box-sizing"))&&(p=h.outerHeight()-h.height()),d=Math.max(parseInt(h.css("minHeight"),10)-p||0,h.height()),h.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===h.css("resize")||"vertical"===h.css("resize")?"none":"horizontal"}),"onpropertychange"in c?"oninput"in c?h.on("input.autosize keyup.autosize",a):h.on("propertychange.autosize",function(){"value"===event.propertyName&&a()}):h.on("input.autosize",a),i.resizeDelay!==!1&&e(window).on("resize.autosize",r),h.on("autosize.resize",a),h.on("autosize.resizeIncludeStyle",function(){t=null,a()}),h.on("autosize.destroy",function(){t=null,clearTimeout(u),e(window).off("resize",r),h.off("autosize").off(".autosize").css(w).removeData("autosize")}),a())})}});
\ No newline at end of file
diff --git a/temp/autosize.js/1.17.2/package/jquery.autosize.js b/temp/autosize.js/1.17.2/package/jquery.autosize.js
deleted file mode 100644
index 50c5b7e74..000000000
--- a/temp/autosize.js/1.17.2/package/jquery.autosize.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/*!
- Autosize v1.17.2 - 2013-07-28
- Automatically adjust textarea height based on user input.
- (c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
- license: http://www.opensource.org/licenses/mit-license.php
-*/
-(function (factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define('jquery-autosize', ['jquery'], factory);
- } else {
- // Browser globals: jQuery or jQuery-like library, such as Zepto
- factory(window.jQuery || window.$);
- }
-}(function ($) {
- var
- defaults = {
- className: 'autosizejs',
- append: '',
- callback: false,
- resizeDelay: 10
- },
-
- // border:0 is unnecessary, but avoids a bug in FireFox on OSX
- copy = '',
-
- // line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
- typographyStyles = [
- 'fontFamily',
- 'fontSize',
- 'fontWeight',
- 'fontStyle',
- 'letterSpacing',
- 'textTransform',
- 'wordSpacing',
- 'textIndent'
- ],
-
- // to keep track which textarea is being mirrored when adjust() is called.
- mirrored,
-
- // the mirror element, which is used to calculate what size the mirrored element should be.
- mirror = $(copy).data('autosize', true)[0];
-
- // test that line-height can be accurately copied.
- mirror.style.lineHeight = '99px';
- if ($(mirror).css('lineHeight') === '99px') {
- typographyStyles.push('lineHeight');
- }
- mirror.style.lineHeight = '';
-
- $.fn.autosize = function (options) {
- options = $.extend({}, defaults, options || {});
-
- if (mirror.parentNode !== document.body) {
- $(document.body).append(mirror);
- }
-
- return this.each(function () {
- var
- ta = this,
- $ta = $(ta),
- maxHeight,
- minHeight,
- boxOffset = 0,
- callback = $.isFunction(options.callback),
- originalStyles = {
- height: ta.style.height,
- overflow: ta.style.overflow,
- overflowY: ta.style.overflowY,
- wordWrap: ta.style.wordWrap,
- resize: ta.style.resize
- },
- timeout,
- width = $ta.width();
-
- if ($ta.data('autosize')) {
- // exit if autosize has already been applied, or if the textarea is the mirror element.
- return;
- }
- $ta.data('autosize', true);
-
- if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
- boxOffset = $ta.outerHeight() - $ta.height();
- }
-
- // IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
- minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
-
- $ta.css({
- overflow: 'hidden',
- overflowY: 'hidden',
- wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
- resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
- });
-
- function initMirror() {
- var styles = {}, ignore;
-
- mirrored = ta;
- mirror.className = options.className;
- maxHeight = parseInt($ta.css('maxHeight'), 10);
-
- // mirror is a duplicate textarea located off-screen that
- // is automatically updated to contain the same text as the
- // original textarea. mirror always has a height of 0.
- // This gives a cross-browser supported way getting the actual
- // height of the text, through the scrollTop property.
- $.each(typographyStyles, function(i,val){
- styles[val] = $ta.css(val);
- });
- $(mirror).css(styles);
-
- // The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
- // new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
- if ('oninput' in ta) {
- var width = ta.style.width;
- ta.style.width = '0px';
- ignore = ta.offsetWidth; // This value isn't used, but getting it triggers the necessary reflow
- ta.style.width = width;
- }
- }
-
- // Using mainly bare JS in this function because it is going
- // to fire very often while typing, and needs to very efficient.
- function adjust() {
- var height, original, width, style;
-
- if (mirrored !== ta) {
- initMirror();
- }
-
- mirror.value = ta.value + options.append;
- mirror.style.overflowY = ta.style.overflowY;
- original = parseInt(ta.style.height,10);
-
- // window.getComputedStyle, getBoundingClientRect returning a width are unsupported in IE8 and lower.
- // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
- if ('getComputedStyle' in window) {
- style = window.getComputedStyle(ta);
- width = ta.getBoundingClientRect().width;
-
- $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
- width -= parseInt(style[val],10);
- });
-
- mirror.style.width = width + 'px';
- }
- else {
- mirror.style.width = Math.max($ta.width(), 0) + 'px';
- }
-
- // Needed for IE8 and lower to reliably return the correct scrollTop
- mirror.scrollTop = 0;
-
- mirror.scrollTop = 9e4;
-
- // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
- height = mirror.scrollTop;
-
- if (maxHeight && height > maxHeight) {
- ta.style.overflowY = 'scroll';
- height = maxHeight;
- } else {
- ta.style.overflowY = 'hidden';
- if (height < minHeight) {
- height = minHeight;
- }
- }
-
- height += boxOffset;
-
- if (original !== height) {
- ta.style.height = height + 'px';
- if (callback) {
- options.callback.call(ta,ta);
- }
- }
- }
-
- function resize () {
- clearTimeout(timeout);
- timeout = setTimeout(function(){
- if ($ta.width() !== width) {
- adjust();
- }
- }, parseInt(options.resizeDelay,10));
- }
-
- if ('onpropertychange' in ta) {
- if ('oninput' in ta) {
- // Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
- // so binding to onkeyup to catch most of those occasions. There is no way that I
- // know of to detect something like 'cut' in IE9.
- $ta.on('input.autosize keyup.autosize', adjust);
- } else {
- // IE7 / IE8
- $ta.on('propertychange.autosize', function(){
- if(event.propertyName === 'value'){
- adjust();
- }
- });
- }
- } else {
- // Modern Browsers
- $ta.on('input.autosize', adjust);
- }
-
- // Set options.resizeDelay to false if using fixed-width textarea elements.
- // Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
-
- if (options.resizeDelay !== false) {
- $(window).on('resize.autosize', resize);
- }
-
- // Event for manual triggering if needed.
- // Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
- $ta.on('autosize.resize', adjust);
-
- // Event for manual triggering that also forces the styles to update as well.
- // Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
- $ta.on('autosize.resizeIncludeStyle', function() {
- mirrored = null;
- adjust();
- });
-
- $ta.on('autosize.destroy', function(){
- mirrored = null;
- clearTimeout(timeout);
- $(window).off('resize', resize);
- $ta
- .off('autosize')
- .off('.autosize')
- .css(originalStyles)
- .removeData('autosize');
- });
-
- // Call adjust in case the textarea already contains text.
- adjust();
- });
- };
-}));
diff --git a/temp/autosize.js/1.17.2/package/package.json b/temp/autosize.js/1.17.2/package/package.json
deleted file mode 100644
index 7ed8b39b8..000000000
--- a/temp/autosize.js/1.17.2/package/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "jquery-autosize",
- "description": "Automatically adjust textarea height based on user input.",
- "version": "1.17.2",
- "dependencies": {},
- "keywords": [
- "form",
- "textarea",
- "ui",
- "jQuery"
- ],
- "authors": [
- {
- "name": "Jack Moore",
- "url": "http://www.jacklmoore.com",
- "email": "hello@jacklmoore.com"
- }
- ],
- "licenses": [
- {
- "type": "MIT",
- "url": "http://www.opensource.org/licenses/mit-license.php"
- }
- ],
- "homepage": "http://www.jacklmoore.com/autosize",
- "main": "jquery.autosize.js"
-}
\ No newline at end of file
diff --git a/temp/autosize.js/1.17.2/package/readme.md b/temp/autosize.js/1.17.2/package/readme.md
deleted file mode 100644
index 3b491339a..000000000
--- a/temp/autosize.js/1.17.2/package/readme.md
+++ /dev/null
@@ -1,139 +0,0 @@
-## Autosize
-
-Small jQuery plugin to allow dynamic resizing of textarea height, so that it grows as based on visitor input. To use, just call the `.autosize()` method on any textarea element. Example `$('textarea').autosize();`. See the [project page](http://jacklmoore.com/autosize/) for documentation, caveats, and a demonstration. Released under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
-
-## Changelog
-
-### v1.17.2 - 2013/7/28
-* Added support for loading as an AMD module.
-* Added package.json for installing through NPM.
-
-### v1.17.1 - 2013/6/22
-* Fixed potential memory leak when using autosize.destroy.
-
-### v1.17.0 - 2013/6/19
-* Renamed 'autosize' event to 'autosize.resize'
-* Renamed 'autosize.includeStyle' event to 'autosize.resizeIncludeStyle'
-* Fixes problem introduced in 1.16.18 with manually triggering the 'autosize' event:
-
-### v1.16.20 - 2013/6/18
-* Minor improvement to the destroy event.
-
-### v1.16.19 - 2013/6/18
-* Added event for removing autosize from a textarea element:
- $('textarea.example').trigger('autosize.destroy');
-
-### v1.16.18 - 2013/6/18
-* Added event for manually triggering resize that also accounts for typographic styles that have changed on the textarea element. Example:
- $('textarea.example').css('text-indent', 25);
- $('textarea.example').trigger('autosize.includeStyle');
-* Minor optimization
-
-### v1.16.17 - 2013/6/12
-* Fixed a compatibility issue with jQuery versions before 1.9 introduced in the previous update.
-
-### v1.16.16 - 2013/6/11
-* Fixed an issue where the calculated height might be slightly off in modern browsers when the width of the textarea has a sub-pixel value.
-
-### v1.16.15 - 2013/6/7
-* Reduced how frequently autosize is triggered when resizing the window. Added resizeDelay property so that the frequency can be adjusted or disabled.
-
-### v1.16.14 - 2013/6/6
-* Fixed an issue with autosize working poorly if the mirror element has a transition applied to it's width.
-
-### v1.16.13 - 2013/6/4
-* Fixed a Chrome cursor position issue introduced with the reflow workaround added in 1.16.10.
-
-### v1.16.12 - 2013/5/31
-* Much better efficiency and smoothness for IE8 and lower.
-
-### v1.16.11 - 2013/5/31
-* Fixed a default height issue in IE8 and lower.
-
-### v1.16.10 - 2013/5/30
-* Dropped scrollHeight for scrollTop. This fixed a height problem relating to padding. (Fixes #70)
-* Re-added workaround to get Chrome to reflow text after hiding overflow.
-
-### v1.16.9 - 2013/5/20
-* Reverted change from 1.16.8 as it caused an issue in IE8. (Fixes #69)
-
-### v1.16.8 - 2013/5/7
-* Fixed issue where autosize was creating a horizontal scrollbar for a user
-
-### v1.16.7 - 2013/3/20
-* Added workaround for a very edge-case iOS bug (Fixes #58).
-
-### v1.16.6 - 2013/3/12
-* Replaced jQuery shorthand methods with on() in anticipation of jQuery 2.0 conditional builds
-
-### v1.16.5 - 2013/3/12
-* Fixed a bug where triggering the autosize event immediately after assigning autosize had no effect.
-
-### v1.16.4 - 2013/1/29
-* Fixed a conflict with direction:ltr pages.
-
-### v1.16.3 - 2013/1/23
-* Added minified file back to repository
-
-### v1.16.2 - 2013/1/20
-* Minor box-sizing issue dealing with min-heights.
-
-### v1.16.1 - 2013/1/20
-* Added to plugins.jquery.com
-
-### v1.15 - 2012/11/16
-* Reworked to only create a single mirror element, instead of one for each textarea.
-* Dropped feature detection for FF3 and Safari 4.
-
-### v1.14 - 2012/10/6
-* Added 'append' option for appending whitespace to the end of the height calculation (an extra newline improves the apperance when animating).
-* Added a demonstration of animating the height change using a CSS transition.
-
-### v1.13 - 2012/9/21
-* Added optional callback that fires after resize.
-
-### v1.12 - 2012/9/3
-* Fixed a bug I introduced in the last update.
-
-### v1.11 - 2012/8/8
-* Added workaround to get Chrome to reflow default text better.
-
-### v1.10 - 2012/4/30
-* Added 'lineHeight' to the list of styles considered for size detection.
-
-### v1.9 - 2012/6/19
-* Added 'textIndent' to the list of styles considered for size detection.
-* Added vender prefixes to box-sizing detection
-
-### v1.8 - 2012/6/7
-* Added conditional so that autosize cannot be applied twice to the same element
-* When autosize is applied to an element, it will have a data property that links it to the mirrored textarea element. This will make it easier to keep track of and remove unneeded mirror elements. Example:
-
- $('textarea.example').data('mirror').remove(); // delete the mirror
-
- $('textarea.example').remove(); // delete the original
-
-### v1.7 - 2012/5/3
-* Now supports box-sizing:border-box
-
-### v1.6 - 2012/2/11
-* added binding to allow autosize to be triggered manually. Example:
- $('#myTextArea').trigger('autosize');
-
-### v1.5 - 2011/12/7
-* fixed a regression in detecting FireFox support
-
-### v1.4 - 2011/11/22
-* added branching to exclude old browsers (FF3- & Safari4-)
-
-### v1.3 - 2011/11/13
-* fixed a regression in 1.1 relating to Opera.
-
-### v1.2 - 2011/11/10
-* fixed a regression in 1.1 that broke autosize for IE9.
-
-### v1.1 - 2011/11/10
-* autosize now follows the max-height of textareas. OverflowY will be set to scroll once the content height exceeds max-height.
-
-### v1.0 - 2011/11/7
-* first release
diff --git a/temp/idbwrapper/0.1.0/dist.tar.gz b/temp/idbwrapper/0.1.0/dist.tar.gz
deleted file mode 100644
index b17abc1fc..000000000
Binary files a/temp/idbwrapper/0.1.0/dist.tar.gz and /dev/null differ
diff --git a/temp/idbwrapper/0.1.0/package/.npmignore b/temp/idbwrapper/0.1.0/package/.npmignore
deleted file mode 100644
index 14c279342..000000000
--- a/temp/idbwrapper/0.1.0/package/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.idea
diff --git a/temp/idbwrapper/0.1.0/package/IDBStore.js b/temp/idbwrapper/0.1.0/package/IDBStore.js
deleted file mode 100644
index 7aad5b5bd..000000000
--- a/temp/idbwrapper/0.1.0/package/IDBStore.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- function fixupConstants (object, constants) {
- for (var prop in constants) {
- if (!(prop in object))
- object[prop] = constants[prop];
- }
- }
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = window.IDBTransaction || window.webkitIDBTransaction;
- fixupConstants(this.consts, {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange'
- });
-
- this.cursor = window.IDBCursor || window.webkitIDBCursor;
- fixupConstants(this.cursor, {
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- });
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- throw new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.');
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- console.error('Could not open database, version error:', error);
- } else {
- console.error('Could not open database, error:', error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- throw new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- } else {
- throw new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- throw new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.cursor[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.1.0/package/LICENSE b/temp/idbwrapper/0.1.0/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.1.0/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/README.md b/temp/idbwrapper/0.1.0/package/README.md
deleted file mode 100644
index 480e14c6b..000000000
--- a/temp/idbwrapper/0.1.0/package/README.md
+++ /dev/null
@@ -1,313 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS to load the file,
-and you will receive the constructor in your load callback (the constructor
-will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){}
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-You can also pass a callback function to the options object. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.1.0/package/example/basic/app.js b/temp/idbwrapper/0.1.0/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.1.0/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/example/basic/index.html b/temp/idbwrapper/0.1.0/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.1.0/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/example/index/app.js b/temp/idbwrapper/0.1.0/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.1.0/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.1.0/package/example/index/index.html b/temp/idbwrapper/0.1.0/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.1.0/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.0/package/example/index/style.css b/temp/idbwrapper/0.1.0/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.1.0/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.1.0/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.1.0/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.1.0/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.1.0/package/example/objectstore/app.js b/temp/idbwrapper/0.1.0/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.1.0/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/example/objectstore/index.html b/temp/idbwrapper/0.1.0/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.1.0/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.0/package/example/quicktest/style.css b/temp/idbwrapper/0.1.0/package/example/quicktest/style.css
deleted file mode 100644
index 90f382838..000000000
--- a/temp/idbwrapper/0.1.0/package/example/quicktest/style.css
+++ /dev/null
@@ -1,94 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/example/style.css b/temp/idbwrapper/0.1.0/package/example/style.css
deleted file mode 100644
index fb96076ca..000000000
--- a/temp/idbwrapper/0.1.0/package/example/style.css
+++ /dev/null
@@ -1,87 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.0/package/package.json b/temp/idbwrapper/0.1.0/package/package.json
deleted file mode 100644
index 53f7b1d11..000000000
--- a/temp/idbwrapper/0.1.0/package/package.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "idb-wrapper",
- "version": "0.1.0",
- "description": "This is a wrapper for indexedDB.",
- "keywords": [],
- "author": "jensarps ",
- "repository": "git://github.com/jensarps/IDBWrapper.git",
- "main": "IDBStore",
- "homepage": "https://github.com/jensarps/IDBWrapper",
- "contributors": [
- ],
- "bugs": {
- "url": "https://github.com/jensarps/IDBWrapper/issues",
- "email": "mail@jensarps.de"
- },
- "dependencies": {
- },
- "devDependencies": {
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/jensarps/IDBWrapper/raw/master/LICENSE"
- }
- ],
- "scripts": {
- }
-}
diff --git a/temp/idbwrapper/0.1.1/dist.tar.gz b/temp/idbwrapper/0.1.1/dist.tar.gz
deleted file mode 100644
index 13b0f2173..000000000
Binary files a/temp/idbwrapper/0.1.1/dist.tar.gz and /dev/null differ
diff --git a/temp/idbwrapper/0.1.1/package/.npmignore b/temp/idbwrapper/0.1.1/package/.npmignore
deleted file mode 100644
index 14c279342..000000000
--- a/temp/idbwrapper/0.1.1/package/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.idea
diff --git a/temp/idbwrapper/0.1.1/package/IDBStore.js b/temp/idbwrapper/0.1.1/package/IDBStore.js
deleted file mode 100644
index 68d632afb..000000000
--- a/temp/idbwrapper/0.1.1/package/IDBStore.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- function fixupConstants (object, constants) {
- for (var prop in constants) {
- object[prop] = constants[prop];
- }
- }
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = window.IDBTransaction || window.webkitIDBTransaction;
- fixupConstants(this.consts, {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange'
- });
-
- this.cursor = window.IDBCursor || window.webkitIDBCursor;
- fixupConstants(this.cursor, {
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- });
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- throw new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.');
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- console.error('Could not open database, version error:', error);
- } else {
- console.error('Could not open database, error:', error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- throw new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- } else {
- throw new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- throw new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
-
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.cursor[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.1.1/package/LICENSE b/temp/idbwrapper/0.1.1/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.1.1/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/README.md b/temp/idbwrapper/0.1.1/package/README.md
deleted file mode 100644
index 480e14c6b..000000000
--- a/temp/idbwrapper/0.1.1/package/README.md
+++ /dev/null
@@ -1,313 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS to load the file,
-and you will receive the constructor in your load callback (the constructor
-will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){}
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-You can also pass a callback function to the options object. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.1.1/package/example/basic/app.js b/temp/idbwrapper/0.1.1/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.1.1/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/example/basic/index.html b/temp/idbwrapper/0.1.1/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.1.1/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/example/index/app.js b/temp/idbwrapper/0.1.1/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.1.1/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.1.1/package/example/index/index.html b/temp/idbwrapper/0.1.1/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.1.1/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.1/package/example/index/style.css b/temp/idbwrapper/0.1.1/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.1.1/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.1.1/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.1.1/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.1.1/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.1.1/package/example/objectstore/app.js b/temp/idbwrapper/0.1.1/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.1.1/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/example/objectstore/index.html b/temp/idbwrapper/0.1.1/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.1.1/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.1/package/example/quicktest/style.css b/temp/idbwrapper/0.1.1/package/example/quicktest/style.css
deleted file mode 100644
index 90f382838..000000000
--- a/temp/idbwrapper/0.1.1/package/example/quicktest/style.css
+++ /dev/null
@@ -1,94 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/example/style.css b/temp/idbwrapper/0.1.1/package/example/style.css
deleted file mode 100644
index fb96076ca..000000000
--- a/temp/idbwrapper/0.1.1/package/example/style.css
+++ /dev/null
@@ -1,87 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.1/package/package.json b/temp/idbwrapper/0.1.1/package/package.json
deleted file mode 100644
index 53700272a..000000000
--- a/temp/idbwrapper/0.1.1/package/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "idb-wrapper",
- "version": "0.1.1",
- "description": "This is a wrapper for indexedDB.",
- "keywords": [],
- "author": "jensarps ",
- "repository": "git://github.com/jensarps/IDBWrapper.git",
- "main": "IDBStore",
- "homepage": "https://github.com/jensarps/IDBWrapper",
- "contributors": [],
- "bugs": {
- "url": "https://github.com/jensarps/IDBWrapper/issues",
- "email": "mail@jensarps.de"
- },
- "dependencies": {},
- "devDependencies": {},
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/jensarps/IDBWrapper/raw/master/LICENSE"
- }
- ],
- "scripts": {}
-}
diff --git a/temp/idbwrapper/0.1.2/dist.tar.gz b/temp/idbwrapper/0.1.2/dist.tar.gz
deleted file mode 100644
index 6990fdefe..000000000
Binary files a/temp/idbwrapper/0.1.2/dist.tar.gz and /dev/null differ
diff --git a/temp/idbwrapper/0.1.2/package/.npmignore b/temp/idbwrapper/0.1.2/package/.npmignore
deleted file mode 100644
index 14c279342..000000000
--- a/temp/idbwrapper/0.1.2/package/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.idea
diff --git a/temp/idbwrapper/0.1.2/package/IDBStore.js b/temp/idbwrapper/0.1.2/package/IDBStore.js
deleted file mode 100644
index 765c15292..000000000
--- a/temp/idbwrapper/0.1.2/package/IDBStore.js
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- function fixupConstants (object, constants) {
- for (var prop in constants) {
- object[prop] = constants[prop];
- }
- }
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange'
- }
-
- this.cursor = window.IDBCursor || window.webkitIDBCursor;
- fixupConstants(this.cursor, {
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- });
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- throw new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.');
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- console.error('Could not open database, version error:', error);
- } else {
- console.error('Could not open database, error:', error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- throw new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- } else {
- throw new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- throw new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
-
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.cursor[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.1.2/package/LICENSE b/temp/idbwrapper/0.1.2/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.1.2/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/README.md b/temp/idbwrapper/0.1.2/package/README.md
deleted file mode 100644
index 480e14c6b..000000000
--- a/temp/idbwrapper/0.1.2/package/README.md
+++ /dev/null
@@ -1,313 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS to load the file,
-and you will receive the constructor in your load callback (the constructor
-will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){}
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-You can also pass a callback function to the options object. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.1.2/package/example/basic/app.js b/temp/idbwrapper/0.1.2/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.1.2/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/example/basic/index.html b/temp/idbwrapper/0.1.2/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.1.2/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/example/index/app.js b/temp/idbwrapper/0.1.2/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.1.2/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.1.2/package/example/index/index.html b/temp/idbwrapper/0.1.2/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.1.2/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.2/package/example/index/style.css b/temp/idbwrapper/0.1.2/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.1.2/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.1.2/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.1.2/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.1.2/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.1.2/package/example/objectstore/app.js b/temp/idbwrapper/0.1.2/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.1.2/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/example/objectstore/index.html b/temp/idbwrapper/0.1.2/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.1.2/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.2/package/example/quicktest/style.css b/temp/idbwrapper/0.1.2/package/example/quicktest/style.css
deleted file mode 100644
index 90f382838..000000000
--- a/temp/idbwrapper/0.1.2/package/example/quicktest/style.css
+++ /dev/null
@@ -1,94 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/example/style.css b/temp/idbwrapper/0.1.2/package/example/style.css
deleted file mode 100644
index fb96076ca..000000000
--- a/temp/idbwrapper/0.1.2/package/example/style.css
+++ /dev/null
@@ -1,87 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.2/package/package.json b/temp/idbwrapper/0.1.2/package/package.json
deleted file mode 100644
index 3b748fc47..000000000
--- a/temp/idbwrapper/0.1.2/package/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "idb-wrapper",
- "version": "0.1.2",
- "description": "This is a wrapper for indexedDB.",
- "keywords": [],
- "author": "jensarps ",
- "repository": "git://github.com/jensarps/IDBWrapper.git",
- "main": "IDBStore",
- "homepage": "https://github.com/jensarps/IDBWrapper",
- "contributors": [],
- "bugs": {
- "url": "https://github.com/jensarps/IDBWrapper/issues",
- "email": "mail@jensarps.de"
- },
- "dependencies": {},
- "devDependencies": {},
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/jensarps/IDBWrapper/raw/master/LICENSE"
- }
- ],
- "scripts": {}
-}
diff --git a/temp/idbwrapper/0.1.3/dist.tar.gz b/temp/idbwrapper/0.1.3/dist.tar.gz
deleted file mode 100644
index 5e393e216..000000000
Binary files a/temp/idbwrapper/0.1.3/dist.tar.gz and /dev/null differ
diff --git a/temp/idbwrapper/0.1.3/package/.npmignore b/temp/idbwrapper/0.1.3/package/.npmignore
deleted file mode 100644
index 14c279342..000000000
--- a/temp/idbwrapper/0.1.3/package/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.idea
diff --git a/temp/idbwrapper/0.1.3/package/IDBStore.js b/temp/idbwrapper/0.1.3/package/IDBStore.js
deleted file mode 100644
index fef8b5efc..000000000
--- a/temp/idbwrapper/0.1.3/package/IDBStore.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- function fixupConstants (object, constants) {
- for (var prop in constants) {
- if (!(prop in object))
- object[prop] = constants[prop];
- }
- }
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange'
- }
-
- this.cursor = window.IDBCursor || window.webkitIDBCursor;
- fixupConstants(this.cursor, {
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- });
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- throw new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.');
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- console.error('Could not open database, version error:', error);
- } else {
- console.error('Could not open database, error:', error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- throw new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- } else {
- throw new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- throw new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
-
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.cursor[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.1.3/package/LICENSE b/temp/idbwrapper/0.1.3/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.1.3/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/README.md b/temp/idbwrapper/0.1.3/package/README.md
deleted file mode 100644
index 480e14c6b..000000000
--- a/temp/idbwrapper/0.1.3/package/README.md
+++ /dev/null
@@ -1,313 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS to load the file,
-and you will receive the constructor in your load callback (the constructor
-will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){}
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-You can also pass a callback function to the options object. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.1.3/package/example/basic/app.js b/temp/idbwrapper/0.1.3/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.1.3/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/example/basic/index.html b/temp/idbwrapper/0.1.3/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.1.3/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/example/index/app.js b/temp/idbwrapper/0.1.3/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.1.3/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.1.3/package/example/index/index.html b/temp/idbwrapper/0.1.3/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.1.3/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.3/package/example/index/style.css b/temp/idbwrapper/0.1.3/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.1.3/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.1.3/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.1.3/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.1.3/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.1.3/package/example/objectstore/app.js b/temp/idbwrapper/0.1.3/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.1.3/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/example/objectstore/index.html b/temp/idbwrapper/0.1.3/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.1.3/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.3/package/example/quicktest/style.css b/temp/idbwrapper/0.1.3/package/example/quicktest/style.css
deleted file mode 100644
index 90f382838..000000000
--- a/temp/idbwrapper/0.1.3/package/example/quicktest/style.css
+++ /dev/null
@@ -1,94 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/example/style.css b/temp/idbwrapper/0.1.3/package/example/style.css
deleted file mode 100644
index fb96076ca..000000000
--- a/temp/idbwrapper/0.1.3/package/example/style.css
+++ /dev/null
@@ -1,87 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.3/package/package.json b/temp/idbwrapper/0.1.3/package/package.json
deleted file mode 100644
index 72c250e7a..000000000
--- a/temp/idbwrapper/0.1.3/package/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "idb-wrapper",
- "version": "0.1.3",
- "description": "This is a wrapper for indexedDB.",
- "keywords": [],
- "author": "jensarps ",
- "repository": "git://github.com/jensarps/IDBWrapper.git",
- "main": "IDBStore",
- "homepage": "https://github.com/jensarps/IDBWrapper",
- "contributors": [],
- "bugs": {
- "url": "https://github.com/jensarps/IDBWrapper/issues",
- "email": "mail@jensarps.de"
- },
- "dependencies": {},
- "devDependencies": {},
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/jensarps/IDBWrapper/raw/master/LICENSE"
- }
- ],
- "scripts": {}
-}
diff --git a/temp/idbwrapper/0.1.4/dist.tar.gz b/temp/idbwrapper/0.1.4/dist.tar.gz
deleted file mode 100644
index 2c3f258de..000000000
Binary files a/temp/idbwrapper/0.1.4/dist.tar.gz and /dev/null differ
diff --git a/temp/idbwrapper/0.1.4/package/.npmignore b/temp/idbwrapper/0.1.4/package/.npmignore
deleted file mode 100644
index 14c279342..000000000
--- a/temp/idbwrapper/0.1.4/package/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.idea
diff --git a/temp/idbwrapper/0.1.4/package/IDBStore.js b/temp/idbwrapper/0.1.4/package/IDBStore.js
deleted file mode 100644
index 76317bba0..000000000
--- a/temp/idbwrapper/0.1.4/package/IDBStore.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- function fixupConstants (object, constants) {
- for (var prop in constants) {
- if (!(prop in object))
- object[prop] = constants[prop];
- }
- }
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange'
- }
-
- this.cursor = window.IDBCursor || window.webkitIDBCursor;
- fixupConstants(this.cursor, {
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- });
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- throw new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.');
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- console.error('Could not open database, version error:', error);
- } else {
- console.error('Could not open database, error:', error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- throw new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- } else {
- throw new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- throw new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.');
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
-
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'prev' : 'next';
- if (options.filterDuplicates) {
- directionType += 'unique';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, directionType);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.1.4/package/LICENSE b/temp/idbwrapper/0.1.4/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.1.4/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.4/package/README.md b/temp/idbwrapper/0.1.4/package/README.md
deleted file mode 100644
index 480e14c6b..000000000
--- a/temp/idbwrapper/0.1.4/package/README.md
+++ /dev/null
@@ -1,313 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS to load the file,
-and you will receive the constructor in your load callback (the constructor
-will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){}
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-You can also pass a callback function to the options object. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.1.4/package/example/basic/app.js b/temp/idbwrapper/0.1.4/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.1.4/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.4/package/example/basic/index.html b/temp/idbwrapper/0.1.4/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.1.4/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.4/package/example/index/app.js b/temp/idbwrapper/0.1.4/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.1.4/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.1.4/package/example/index/index.html b/temp/idbwrapper/0.1.4/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.1.4/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.1.4/package/example/index/style.css b/temp/idbwrapper/0.1.4/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.1.4/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.1.4/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.1.4/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.1.4/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.1.4/package/example/objectstore/app.js b/temp/idbwrapper/0.1.4/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.1.4/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.1.4/package/example/objectstore/index.html b/temp/idbwrapper/0.1.4/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.1.4/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.2.1/package/CHANGELOG b/temp/idbwrapper/0.2.1/package/CHANGELOG
deleted file mode 100644
index 30b0e4389..000000000
--- a/temp/idbwrapper/0.2.1/package/CHANGELOG
+++ /dev/null
@@ -1,14 +0,0 @@
-0.2.1 / 2012-11-20
-------------------
-
-* Add error handler to constructor
-* Remove support for numeric transaction and cursor types.
-* Misc cleanup
-
-
-
-0.2.0 / 2012-11-20
-------------------
-
-* Start versioning
-
diff --git a/temp/idbwrapper/0.2.1/package/IDBStore.js b/temp/idbwrapper/0.2.1/package/IDBStore.js
deleted file mode 100644
index 23304c582..000000000
--- a/temp/idbwrapper/0.2.1/package/IDBStore.js
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- onError: function(error){
- throw error;
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange',
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- };
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- onError: null,
-
- openDB: function () {
-
- this.newVersionAPI = typeof this.idb.setVersion == 'undefined';
-
- if(!this.newVersionAPI){
- this.onError(new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.'));
- }
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- this.onError(new Error('The version number provided is lower than the existing one.'));
- } else {
- this.onError(error);
- }
- }.bind(this);
-
-
- openRequest.onsuccess = function (event) {
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- if(!this.store){
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
- }
- // check indexes
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- throw new Error('Cannot create index: No index name given.');
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- this.onError(new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));
- }
- } else {
- this.onError(new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));
- }
-
- }, this);
-
- this.onStoreReady();
- } else {
- // We should never get here.
- this.onError(new Error('Cannot create a new store for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));
- }
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- // normalize and provide existing keys
- indexData.keyPath = indexData.keyPath || indexName;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
-
- if(!indexName){
- this.onError(new Error('Cannot create index: No index name given.'));
- }
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function(key){
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actualIndex[key] === undefined && indexData[key] === false) {
- return true;
- }
- return indexData[key] == actualIndex[key];
- });
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return +new Date();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.consts[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.2.1/package/LICENSE b/temp/idbwrapper/0.2.1/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.2.1/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.2.1/package/README.md b/temp/idbwrapper/0.2.1/package/README.md
deleted file mode 100644
index c9b36bf5e..000000000
--- a/temp/idbwrapper/0.2.1/package/README.md
+++ /dev/null
@@ -1,319 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS, or a CommonJS loader
-to load the module, and you will receive the constructor in your load callback
-(the constructor will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){},
- onError: function(error){ throw error; }
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-'onError' gets called if an error occurred while trying to open the store. It
-receives the error instance as only argument.
-
-As an alternative to passing a ready handler as second argument, you can also
-pass it in the 'onStoreReady' property. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second
-parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.2.1/package/example/basic/app.js b/temp/idbwrapper/0.2.1/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.2.1/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.2.1/package/example/basic/index.html b/temp/idbwrapper/0.2.1/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.2.1/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.2.1/package/example/index/app.js b/temp/idbwrapper/0.2.1/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.2.1/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.2.1/package/example/index/index.html b/temp/idbwrapper/0.2.1/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.2.1/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.2.1/package/example/index/style.css b/temp/idbwrapper/0.2.1/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.2.1/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.2.1/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.2.1/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.2.1/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.2.1/package/example/objectstore/app.js b/temp/idbwrapper/0.2.1/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.2.1/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.2.1/package/example/objectstore/index.html b/temp/idbwrapper/0.2.1/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.2.1/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.3.0/package/CHANGELOG b/temp/idbwrapper/0.3.0/package/CHANGELOG
deleted file mode 100644
index 2d8277225..000000000
--- a/temp/idbwrapper/0.3.0/package/CHANGELOG
+++ /dev/null
@@ -1,24 +0,0 @@
-0.3.0 /
-------------------
-
-* Fix potentially non-unique generated IDs
-* Add batch() method [Raynos]
-* Fix a bug where the success handler could be called even if there was an error
-* Fix a bug where old IndexedDB implementations were not detected successfully
-
-
-
-0.2.1 / 2012-11-20
-------------------
-
-* Add error handler to constructor
-* Remove support for numeric transaction and cursor types.
-* Misc cleanup
-
-
-
-0.2.0 / 2012-11-20
-------------------
-
-* Start versioning
-
diff --git a/temp/idbwrapper/0.3.0/package/IDBStore.js b/temp/idbwrapper/0.3.0/package/IDBStore.js
deleted file mode 100644
index ece8ea01a..000000000
--- a/temp/idbwrapper/0.3.0/package/IDBStore.js
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * IDBWrapper - A cross-browser wrapper for IndexedDB
- * Copyright (c) 2011 - 2012 Jens Arps
- * http://jensarps.de/
- *
- * Licensed under the MIT (X11) license
- */
-
-"use strict";
-
-(function (name, definition, global) {
- if (typeof define === 'function') {
- define(definition);
- } else if (typeof module !== 'undefined' && module.exports) {
- module.exports = definition();
- } else {
- global[name] = definition();
- }
-})('IDBStore', function () {
-
- var IDBStore;
-
- var defaults = {
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: function () {
- },
- onError: function(error){
- throw error;
- },
- indexes: []
- };
-
- IDBStore = function (kwArgs, onStoreReady) {
-
- for(var key in defaults){
- this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];
- }
-
- this.dbName = 'IDBWrapper-' + this.storeName;
- this.dbVersion = parseInt(this.dbVersion, 10);
-
- onStoreReady && (this.onStoreReady = onStoreReady);
-
- this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
- this.keyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
-
- this.consts = {
- 'READ_ONLY': 'readonly',
- 'READ_WRITE': 'readwrite',
- 'VERSION_CHANGE': 'versionchange',
- 'NEXT': 'next',
- 'NEXT_NO_DUPLICATE': 'nextunique',
- 'PREV': 'prev',
- 'PREV_NO_DUPLICATE': 'prevunique'
- };
-
- this.openDB();
- };
-
- IDBStore.prototype = {
-
- db: null,
-
- dbName: null,
-
- dbVersion: null,
-
- store: null,
-
- storeName: null,
-
- keyPath: null,
-
- autoIncrement: null,
-
- indexes: null,
-
- features: null,
-
- onStoreReady: null,
-
- onError: null,
-
- _insertIdCount: 0,
-
- openDB: function () {
-
- var features = this.features = {};
- features.hasAutoIncrement = !window.mozIndexedDB; // TODO: Still, really?
-
- var openRequest = this.idb.open(this.dbName, this.dbVersion);
- var preventSuccessCallback = false;
-
- openRequest.onerror = function (error) {
-
- var gotVersionErr = false;
- if ('error' in error.target) {
- gotVersionErr = error.target.error.name == "VersionError";
- } else if ('errorCode' in error.target) {
- gotVersionErr = error.target.errorCode == 12; // TODO: Use const
- }
-
- if (gotVersionErr) {
- this.onError(new Error('The version number provided is lower than the existing one.'));
- } else {
- this.onError(error);
- }
- }.bind(this);
-
- openRequest.onsuccess = function (event) {
-
- if (preventSuccessCallback) {
- return;
- }
-
- if(this.db){
- this.onStoreReady();
- return;
- }
-
- this.db = event.target.result;
-
- if(typeof this.db.version == 'string'){
- this.onError(new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.'));
- return;
- }
-
- if(!this.db.objectStoreNames.contains(this.storeName)){
- // We should never ever get here.
- // Lets notify the user anyway.
- this.onError(new Error('Something is wrong with the IndexedDB implementation in this browser. Please upgrade your browser.'));
- return;
- }
-
- var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- this.store = emptyTransaction.objectStore(this.storeName);
-
- // check indexes
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- if(!indexName){
- preventSuccessCallback = true;
- this.onError(new Error('Cannot create index: No index name given.'));
- return;
- }
-
- this.normalizeIndexData(indexData);
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = this.indexComplies(actualIndex, indexData);
- if(!complies){
- preventSuccessCallback = true;
- this.onError(new Error('Cannot modify index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));
- }
- } else {
- preventSuccessCallback = true;
- this.onError(new Error('Cannot create new index "' + indexName + '" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));
- }
-
- }, this);
-
- preventSuccessCallback || this.onStoreReady();
- }.bind(this);
-
- openRequest.onupgradeneeded = function(/* IDBVersionChangeEvent */ event){
-
- this.db = event.target.result;
-
- if(this.db.objectStoreNames.contains(this.storeName)){
- this.store = event.target.transaction.objectStore(this.storeName);
- } else {
- this.store = this.db.createObjectStore(this.storeName, { keyPath: this.keyPath, autoIncrement: this.autoIncrement});
- }
-
- this.indexes.forEach(function(indexData){
- var indexName = indexData.name;
-
- if(!indexName){
- preventSuccessCallback = true;
- this.onError(new Error('Cannot create index: No index name given.'));
- }
-
- this.normalizeIndexData(indexData);
-
- if(this.hasIndex(indexName)){
- // check if it complies
- var actualIndex = this.store.index(indexName);
- var complies = this.indexComplies(actualIndex, indexData);
- if(!complies){
- // index differs, need to delete and re-create
- this.store.deleteIndex(indexName);
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
- } else {
- this.store.createIndex(indexName, indexData.keyPath, { unique: indexData.unique, multiEntry: indexData.multiEntry });
- }
-
- }, this);
-
- }.bind(this);
- },
-
- deleteDatabase: function () {
- if (this.idb.deleteDatabase) {
- this.idb.deleteDatabase(this.dbName);
- }
- },
-
- /*********************
- * data manipulation *
- *********************/
-
-
- put: function (dataObj, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not write data.', error);
- });
- onSuccess || (onSuccess = noop);
- if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- dataObj[this.keyPath] = this._getUID();
- }
- var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
- putRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- putRequest.onerror = onError;
- },
-
- get: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var getRequest = getTransaction.objectStore(this.storeName).get(key);
- getRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getRequest.onerror = onError;
- },
-
- remove: function (key, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not remove data.', error);
- });
- onSuccess || (onSuccess = noop);
- var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var deleteRequest = removeTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- deleteRequest.onerror = onError;
- },
-
- batch: function (arr, onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not apply batch.', error);
- });
- onSuccess || (onSuccess = noop);
- var batchTransaction = this.db.transaction([this.storeName] , this.consts.READ_WRITE);
- var count = arr.length;
- var called = false;
-
- arr.forEach(function (operation) {
- var type = operation.type;
- var key = operation.key;
- var value = operation.value;
-
- if (type == "remove") {
- var deleteRequest = batchTransaction.objectStore(this.storeName).delete(key);
- deleteRequest.onsuccess = function (event) {
- count--;
- if (count == 0 && !called) {
- called = true;
- onSuccess();
- }
- };
- deleteRequest.onerror = function (err) {
- batchTransaction.abort();
- if (!called) {
- called = true;
- onError(err, type, key);
- }
- };
- } else if (type == "put") {
- if (typeof value[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {
- value[this.keyPath] = this._getUID()
- }
- var putRequest = batchTransaction.objectStore(this.storeName).put(value);
- putRequest.onsuccess = function (event) {
- count--;
- if (count == 0 && !called) {
- called = true;
- onSuccess();
- }
- };
- putRequest.onerror = function (err) {
- batchTransaction.abort();
- if (!called) {
- called = true;
- onError(err, type, value);
- }
- };
- }
- }, this);
- },
-
- getAll: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not read data.', error);
- });
- onSuccess || (onSuccess = noop);
- var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var store = getAllTransaction.objectStore(this.storeName);
- if (store.getAll) {
- var getAllRequest = store.getAll();
- getAllRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- getAllRequest.onerror = onError;
- } else {
- this._getAllCursor(getAllTransaction, onSuccess, onError);
- }
- },
-
- _getAllCursor: function (tr, onSuccess, onError) {
- var all = [];
- var store = tr.objectStore(this.storeName);
- var cursorRequest = store.openCursor();
-
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- all.push(cursor.value);
- cursor['continue']();
- }
- else {
- onSuccess(all);
- }
- };
- cursorRequest.onError = onError;
- },
-
- clear: function (onSuccess, onError) {
- onError || (onError = function (error) {
- console.error('Could not clear store.', error);
- });
- onSuccess || (onSuccess = noop);
- var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
- var clearRequest = clearTransaction.objectStore(this.storeName).clear();
- clearRequest.onsuccess = function (event) {
- onSuccess(event.target.result);
- };
- clearRequest.onerror = onError;
- },
-
- _getUID: function () {
- // FF bails at times on non-numeric ids. So we take an even
- // worse approach now, using current time as id. Sigh.
- return this._insertIdCount++ + Date.now();
- },
-
-
- /************
- * indexing *
- ************/
-
- getIndexList: function () {
- return this.store.indexNames;
- },
-
- hasIndex: function (indexName) {
- return this.store.indexNames.contains(indexName);
- },
-
- normalizeIndexData: function (indexData) {
- indexData.keyPath = indexData.keyPath || indexData.name;
- indexData.unique = !!indexData.unique;
- indexData.multiEntry = !!indexData.multiEntry;
- },
-
- indexComplies: function (actual, expected) {
- var complies = ['keyPath', 'unique', 'multiEntry'].every(function (key) {
- // IE10 returns undefined for no multiEntry
- if (key == 'multiEntry' && actual[key] === undefined && expected[key] === false) {
- return true;
- }
- return expected[key] == actual[key];
- });
- return complies;
- },
-
- /**********
- * cursor *
- **********/
-
- iterate: function (onItem, options) {
- options = mixin({
- index: null,
- order: 'ASC',
- filterDuplicates: false,
- keyRange: null,
- writeAccess: false,
- onEnd: null,
- onError: function (error) {
- console.error('Could not open cursor.', error);
- }
- }, options || {});
-
- var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
- if (options.filterDuplicates) {
- directionType += '_NO_DUPLICATE';
- }
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var cursorRequest = cursorTarget.openCursor(options.keyRange, this.consts[directionType]);
- cursorRequest.onerror = options.onError;
- cursorRequest.onsuccess = function (event) {
- var cursor = event.target.result;
- if (cursor) {
- onItem(cursor.value, cursor, cursorTransaction);
- cursor['continue']();
- } else {
- if(options.onEnd){
- options.onEnd()
- } else {
- onItem(null);
- }
- }
- };
- },
-
- count: function (onSuccess, options) {
-
- options = mixin({
- index: null,
- keyRange: null
- }, options || {});
-
- var onError = options.onError || function (error) {
- console.error('Could not open cursor.', error);
- };
-
- var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
- var cursorTarget = cursorTransaction.objectStore(this.storeName);
- if (options.index) {
- cursorTarget = cursorTarget.index(options.index);
- }
-
- var countRequest = cursorTarget.count(options.keyRange);
- countRequest.onsuccess = function (evt) {
- onSuccess(evt.target.result);
- };
- countRequest.onError = function (error) {
- onError(error);
- };
- },
-
- /**************/
- /* key ranges */
- /**************/
-
- makeKeyRange: function(options){
- var keyRange,
- hasLower = typeof options.lower != 'undefined',
- hasUpper = typeof options.upper != 'undefined';
-
- switch(true){
- case hasLower && hasUpper:
- keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);
- break;
- case hasLower:
- keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);
- break;
- case hasUpper:
- keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);
- break;
- default:
- throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');
- break;
- }
-
- return keyRange;
-
- }
-
- };
-
- /** helpers **/
-
- var noop = function () {
- };
- var empty = {};
- var mixin = function (target, source) {
- var name, s;
- for (name in source) {
- s = source[name];
- if (s !== empty[name] && s !== target[name]) {
- target[name] = s;
- }
- }
- return target;
- };
-
- return IDBStore;
-
-}, this);
diff --git a/temp/idbwrapper/0.3.0/package/LICENSE b/temp/idbwrapper/0.3.0/package/LICENSE
deleted file mode 100644
index 93f5d87c8..000000000
--- a/temp/idbwrapper/0.3.0/package/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011 - 2012 Jens Arps
-
-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.
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/README.md b/temp/idbwrapper/0.3.0/package/README.md
deleted file mode 100644
index bb5b35102..000000000
--- a/temp/idbwrapper/0.3.0/package/README.md
+++ /dev/null
@@ -1,358 +0,0 @@
-About
-=====
-
-This is a wrapper for indexedDB. It is meant to
-
-a) ease the use of indexedDB and abstract away the differences between the
-existing impls in Chrome, Firefox and IE10 (yes, it works in all three), and
-
-b) show how IDB works. The code is split up into short methods, so that it's
-easy to see what happens in what method.
-
-"Showing how it works" is the main intention of this project. IndexedDB is
-all the buzz, but only a few people actually know how to use it.
-
-The code in IDBWrapper.js is not optimized for anything, nor minified or anything.
-It is meant to be read and easy to understand. So, please, go ahead and check out
-the source!
-
-There are two tutorials to get you up and running:
-
-Part 1: Setup and CRUD operations
-http://jensarps.de/2011/11/25/working-with-idbwrapper-part-1/
-
-Part 2: Running Queries against the store
-http://jensarps.de/2012/11/13/working-with-idbwrapper-part-2/
-
-##November Rewrite
-
-I rewrote IDBWrapper to cope with all the issues, and the new version is on
-master since Nov, 13th 2012. The API didn't change much, I just removed some
-of the methods. Method signatures remain unchanged.
-
-However, if you have a previous version of IDBWrapper in use, there's an
-issue: The new version won't be able to access the store created with the old
-version, because database names changed. In that case, you need to manually
-migrate the data: Include both versions of IDBWrapper (use a different name for
-them), do a getAll() on the old store and write the data to the new store.
-
-I am very sorry about any inconveniences, but there was no other way.
-
-The 'old' version of IDBWrapper is still available in the `legacy` branch:
-https://github.com/jensarps/IDBWrapper/tree/legacy
-
-Also, "showing how it works" is no longer the main intention behind this. Now,
-it's rather "just works".
-
-
-Examples
-========
-
-There are some examples to run right in your browser over here: http://jensarps.github.com/IDBWrapper/example/
-
-The source for these examples are in the `example` folder of this repository.
-
-Usage
-=====
-
-Including the IDBStore.js file will add an IDBStore constructor to the global scope.
-
-Alternatively, you can use an AMD loader such as RequireJS, or a CommonJS loader
-to load the module, and you will receive the constructor in your load callback
-(the constructor will then, of course, have whatever name you call it).
-
-You can then create an IDB store:
-
-```javascript
-var myStore = new IDBStore();
-```
-
-You may pass two parameters to the constructor: the first is an object with optional parameters,
-the second is a function reference to a function that is called when the store is ready to use.
-
-The options object may contain the following properties (default values are shown):
-
-```javascript
-{
- storeName: 'Store',
- dbVersion: 1,
- keyPath: 'id',
- autoIncrement: true,
- indexes: [],
- onStoreReady: function(){},
- onError: function(error){ throw error; }
-}
-```
-
-'keyPath' is the name of the property to be used as key index. If 'autoIncrement' is set to true,
-the database will automatically add a unique key to the keyPath index when storing objects missing
-that property. 'indexes' contains objects defining indexes (see below for details on indexes).
-
-'onError' gets called if an error occurred while trying to open the store. It
-receives the error instance as only argument.
-
-As an alternative to passing a ready handler as second argument, you can also
-pass it in the 'onStoreReady' property. If a callback is provided both as second
-parameter and inside of the options object, the function passed as second
-parameter will be used.
-
-Methods
-=======
-
-Here's an overview of available methods in IDBStore:
-
-Data Manipulation
------------------
-
-Use the following methods to read and write data:
-
-___
-
-1) The put method.
-
-
-```javascript
-put(/*Object*/ dataObj, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`dataObj` is the Object to store. `onSuccess` will be called when the insertion/update was successful,
-and it will receive the keyPath value (the id, so to say) of the inserted object as first and only
-argument. `onError` will be called if the insertion/update failed and it will receive the error event
-object as first and only argument. If the store already contains an object with the given keyPath id,
-it will be overwritten by `dataObj`.
-
-___
-
-2) The get method.
-
-```javascript
-get(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to retrieve. `onSuccess` will be called if
-the get operation was successful, and it will receive the stored object as first and only argument. If
-no object was found with the given keyPath value, this argument will be null. `onError` will be called
-if the get operation failed and it will receive the error event object as first and only argument.
-
-___
-
-3) The getAll method.
-
-```javascript
-getAll: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the getAll operation was successful, and it will receive an Array of
-all objects currently stored in the store as first and only argument. `onError` will be called if
-the getAll operation failed and it will receive the error event object as first and only argument.
-
-___
-
-4) The remove method.
-
-```javascript
-remove: function(/*keyPath value*/ key, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`key` is the keyPath property value (the id) of the object to remove. `onSuccess` will be called if
-the remove operation was successful, and it _should_ receive `false` as first and only argument if the
-object to remove was not found, and `true` if it was found and removed.
-
-NOTE: FF 8 will pass the key to the onSuccess handler, no matter if there is an corresponding object
-or not. Chrome 15 will pass `null` if removal was successful, and call the error handler if the object
-wasn't found. Chrome 17 will behave as described above.
-
-`onError` will be called if the remove operation failed and it will receive the error event object as first
-and only argument.
-
-___
-
-5) The clear method.
-
-```javascript
-clear: function(/*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`onSuccess` will be called if the clear operation was successful. `onError` will be called if the clear
-operation failed and it will receive the error event object as first and only argument.
-
-6) The batch method.
-
-```javascript
-batch: function (/*Array*/operations, /*Function?*/onSuccess, /*Function?*/onError)
-```
-
-`batch` expects an array of operations that you want to apply in a single
-IndexedDB transaction. `operations` is an Array of objects, each containing two
-properties, defining the type of operation. There are two operations
-supported, put and remove. A put entry looks like this:
-
-```javascript
-{ type: "put", value: dataObj } // dataObj being the object to store
-```
-
-A remove entry looks like this;
-
-```javascript
-{ type: "remove", key: someKey } // someKey being the keyPath value of the item to remove
-```
-
-You can mix both types in the `operations` Array:
-
-```javascript
-db.batch([
- { type: "put", value: dataObj },
- { type: "remove", key: someKey }
-], onSuccess, onError)
-```
-
-`onSuccess` will be called if all operations were successful and will receive no
-arguments. `onError` will be called if an error happens for one of the
-operations and will receive three arguments: the Error instance, the type of
-operation that caused the error and either the key or the value property
-(depending on the type).
-
-If an error occurs, no changes will be made to the store, even if some
-of the given operations would have succeeded.
-
-
-Index Operations
-----------------
-
-To create indexes, you need to pass the index information to the IDBStore()
-constructor, for example:
-
-
-```javascript
-{
- storeName: 'customers',
- dbVersion: 1,
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: function(){},
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
-}
-```
-
-An entry in the index Array is an object containing the following properties:
-
-The `name` property is the identifier of the index. If you want to work with the created index later, this name is used to identify the index. This is the only property that is mandatory.
-
-The `keyPath` property is the name of the property in your stored data that you want to index. If you omit that, IDBWrapper will assume that it is the same as the provided name, and will use this instead.
-
-The `unique` property tells the store whether the indexed property in your data is unique. If you set this to true, it will add a uniqueness constraint to the store which will make it throw if you try to store data that violates that constraint. If you omit that, IDBWrapper will set this to false.
-
-The `multiEntry` property is kinda weird. You can read up on it here: http://www.w3.org/TR/IndexedDB/#dfn-multientry. However, you can live perfectly fine with setting this to false (or just omitting it, this is set to false by default).
-
-
-If you want to add an index to an existing store, you need to increase the
-version number of your store, as adding an index changes the structure of
-the database.
-
-To modify an index, modify the object in the indexes Array in the constructor.
-Again, you need to increase the version of your store.
-
-In addition, there are still some convenience methods available:
-
-___
-
-
-1) The hasIndex method.
-
-```javascript
-hasIndex: function(/*String*/ indexName)
-```
-
-Return true if an index with the given name exists in the store, false if not.
-
-___
-
-2) The getIndexList method.
-
-```javascript
-getIndexList: function()
-```
-
-Returns a `DOMStringList` with all existing indices.
-
-
-Running Queries
----------------
-
-To run queries, IDBWrapper provides an `iterate()` method. To create keyRanges,
-there is the `makeKeyRange()` method. In addition to these, IDBWrapper comes
-with a `count()` method.
-
-___
-
-1) The iterate method.
-
-
-```javascript
-iterate: function(/*Function*/ onItem, /*Object*/ iterateOptions)
-```
-
-The `onItem` callback will be called once for every match. It will receive three arguments: the object that matched the query, a reference to the current cursor object (IDBWrapper uses IndexedDB's Cursor internally to iterate), and a reference to the current ongoing transaction.
-
-There's one special situation: if you didn't pass an onEnd handler in the options objects (see below), the onItem handler will be called one extra time when the transaction is over. In this case, it will receive null as only argument. So, to check when the iteration is over and you won't get any more data objects, you can either pass an onEnd handler, or check for null in the onItem handler.
-
-The `iterateOptions` object can contain one or more of the following properties:
-
-
-The `index` property contains the name of the index to operate on. If you omit this, IDBWrapper will use the store's keyPath as index.
-
-In the `keyRange` property you can pass a keyRange.
-
-The `order` property can be set to 'ASC' or 'DESC', and determines the ordering direction of results. If you omit this, IDBWrapper will use 'ASC'.
-
-The `filterDuplicates` property is an interesting one: If you set this to true (it defaults to false), and have several objects that have the same value in their key, the store will only fetch the first of those. It is not about objects being the same, it's about their key being the same. For example, in the customers database are a couple of guys having 'Smith' as last name. Setting filterDuplicates to true in the above example will make `iterate()` call the onItem callback only for the first of those.
-
-The `writeAccess` property defaults to false. If you need write access to the store during the iteration, you need to set this to true.
-
-In the `onEnd` property you can pass a callback that gets called after the iteration is over and the transaction is closed. It does not receive any arguments.
-
-In the `onError` property you can pass a custom error handler. In case of an error, it will be called and receives the Error object as only argument.
-
-
-___
-
-
-2) The makeKeyRange method.
-
-
-```javascript
-iterate: function(/*Object*/ keyRangeOptions)
-```
-
-Returns an IDBKeyRange.
-
-The `keyRangeOptions` object must have one or more of the following properties:
-
-`lower`: The lower bound of the range
-
-`excludeLower`: Boolean, whether to exclude the lower bound itself. Default: false
-
-`upper`: The upper bound of the range
-
-`excludeUpper`: Boolean, whether to exclude the upper bound itself. Default: false
-
-___
-
-
-3) The count method.
-
-
-```javascript
-iterate: function(/*Function*/ onSuccess, /*Object*/ countOptions)
-```
-
-The onSuccess receives the result of the count as only argument.
-
-The `countOptions` object may have one or more of the following properties:
-
-index: The name of an index to operate on.
-
-keyRange: A keyRange to use
-
diff --git a/temp/idbwrapper/0.3.0/package/example/basic/app.js b/temp/idbwrapper/0.3.0/package/example/basic/app.js
deleted file mode 100644
index e1e2a2f55..000000000
--- a/temp/idbwrapper/0.3.0/package/example/basic/app.js
+++ /dev/null
@@ -1,94 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
',
- table: '
ID
Last Name
First Name
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = new IDBStore({
- storeName: 'customer',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'customerid', 'firstname', 'lastname', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){ // We want the id to be numeric:
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function updateItem(id){
- var data = {
- customerid: id,
- firstname: document.getElementById('firstname_' + id).value.trim(),
- lastname: document.getElementById('lastname_' + id).value.trim()
- };
- customers.put(data, refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- updateItem: updateItem
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/example/basic/index.html b/temp/idbwrapper/0.3.0/package/example/basic/index.html
deleted file mode 100644
index 5d7a596c6..000000000
--- a/temp/idbwrapper/0.3.0/package/example/basic/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- IDBWrapper Basic CRUD Example
-
-
-
-
-
IDBWrapper Basic CRUD Example
-
-
- QueryResults
-
-
-
-
-
- Enter some data to save. As ID, enter a numeric value or leave blank.
-
- There are a couple of examples to try out / look at:
-
-
-
Quicktest - Just a quick test to see if IDB opens and fool around in the console.
-
Basic CRUD - A basic CRUD example using an IDB store as fixed table.
-
ObjectStore - An example to show the difference between a table and an object store.
-
Index - An example to show how to work with indexes.
-
-
-
-
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/example/index/app.js b/temp/idbwrapper/0.3.0/package/example/index/app.js
deleted file mode 100644
index 974280137..000000000
--- a/temp/idbwrapper/0.3.0/package/example/index/app.js
+++ /dev/null
@@ -1,163 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var tpls = {
- row: '
{customerid}
{lastname}
{firstname}
{age}
',
- table: '
ID
Last Name
First Name
Age
{content}
'
- };
-
- var customers;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table") for the customers
- customers = app.customers = new IDBStore({
- dbVersion: 1,
- storeName: 'customer-index',
- keyPath: 'customerid',
- autoIncrement: true,
- onStoreReady: refreshTable,
- indexes: [
- { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }
- ]
- });
-
- // create references for some nodes we have to work with
- [
- 'submit', 'submitQuery',
- 'upper', 'lower', 'excludeLower', 'excludeUpper',
- 'sortOrder', 'index', 'filterDuplicates',
- 'customerid', 'firstname', 'lastname', 'age',
- 'results-container'
- ].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit buttons.
- nodeCache.submit.addEventListener('click', enterData);
- nodeCache.submitQuery.addEventListener('click', runQuery);
- }
-
- function refreshTable(){
- customers.getAll(listItems);
- }
-
- function listItems(data){
- var content = '';
- data.forEach(function(item){
- content += tpls.row.replace(/\{([^\}]+)\}/g, function(_, key){
- return item[key];
- });
- });
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- }
-
- function enterData(){
- // read data from inputs…
- var data = {};
- ['customerid','firstname','lastname', 'age'].forEach(function(key){
- var value = nodeCache[key].value.trim();
- if(value.length){
- if(key == 'customerid'){
- value = parseInt(value, 10);
- }
- data[key] = value;
- }
- });
-
- // …and store them away.
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function clearForm(){
- ['customerid','firstname','lastname', 'age'].forEach(function(id){
- nodeCache[id].value = '';
- });
- }
-
- function deleteItem(id){
- customers.remove(id, refreshTable);
- }
-
- function makeRandomEntry(){
- var lastnames = ['Smith','Miller','Doe','Frankenstein','Furter'],
- firstnames = ['Peter','John','Frank', 'James', 'Jill'];
-
- var entry = {
- lastname: lastnames[Math.floor(Math.random()*5)],
- firstname: firstnames[Math.floor(Math.random()*4)],
- age: Math.floor(Math.random() * (100 - 20)) + 20,
- customerid: parseInt( ( "" + ( Date.now() * Math.random() ) ).substring(0, 6), 10)
- };
-
- return entry;
- }
-
- function addRandomCustomer(){
- var data = makeRandomEntry();
-
- customers.put(data, function(){
- clearForm();
- refreshTable();
- });
- }
-
- function runQuery(){
- var upper = nodeCache.upper.value,
- hasUpper = upper != '',
- lower = nodeCache.lower.value,
- hasLower = lower != '',
-
- indexName = nodeCache.index.value,
- sortOrder = nodeCache.sortOrder.value,
- filterDuplicates = nodeCache.filterDuplicates.checked,
- keyRange,
-
- content = '';
-
- if(hasUpper || hasLower){ // create a keyRange only if bounds are given
- var options = {};
- if(hasUpper){
- options.upper = upper;
- options.excludeUpper = nodeCache.excludeUpper.checked;
- }
- if(hasLower){
- options.lower = lower;
- options.excludeLower = nodeCache.excludeLower.checked;
- }
- keyRange = customers.makeKeyRange(options);
- }
-
- var onItem = function (item) {
- content += tpls.row.replace(/\{([^\}]+)\}/g, function (_, key) {
- return item[key];
- });
- };
- var onEnd = function () {
- nodeCache['results-container'].innerHTML = tpls.table.replace('{content}', content);
- };
-
- customers.iterate(onItem, {
- index: indexName,
- keyRange: keyRange,
- filterDuplicates: filterDuplicates,
- order: sortOrder,
- onEnd: onEnd
- });
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- deleteItem: deleteItem,
- addRandomCustomer: addRandomCustomer
- };
-
- // go!
- init();
-
-});
diff --git a/temp/idbwrapper/0.3.0/package/example/index/index.html b/temp/idbwrapper/0.3.0/package/example/index/index.html
deleted file mode 100644
index 63a50039d..000000000
--- a/temp/idbwrapper/0.3.0/package/example/index/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- IDBWrapper Basic Index Example
-
-
-
-
-
IDBWrapper Basic Index Example
-
-
- QueryResults
-
-
-
Query
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add data
-
-
- Add a random customer:
-
-
-
- Or, enter customer data below:
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.3.0/package/example/index/style.css b/temp/idbwrapper/0.3.0/package/example/index/style.css
deleted file mode 100644
index 8f7ddd9fe..000000000
--- a/temp/idbwrapper/0.3.0/package/example/index/style.css
+++ /dev/null
@@ -1,89 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input,
-#query {
- padding: 10px;
- width: 350px;
- border-left: solid 1px black;
-}
-#input div,
-#query div{
- padding: 5px;
-}
-#input label,
-#query label{
- display: inline-block;
- width: 120px;
-}
diff --git a/temp/idbwrapper/0.3.0/package/example/lib/requirejs/require.js b/temp/idbwrapper/0.3.0/package/example/lib/requirejs/require.js
deleted file mode 100644
index ba861994a..000000000
--- a/temp/idbwrapper/0.3.0/package/example/lib/requirejs/require.js
+++ /dev/null
@@ -1,2013 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 0.26.0+ Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-/*jslint strict: false, plusplus: false */
-/*global window: false, navigator: false, document: false, importScripts: false,
- jQuery: false, clearInterval: false, setInterval: false, self: false,
- setTimeout: false, opera: false */
-
-var requirejs, require, define;
-(function () {
- //Change this version number for each release.
- var version = "0.26.0+",
- commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
- currDirRegExp = /^\.\//,
- jsSuffixRegExp = /\.js$/,
- ostring = Object.prototype.toString,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== "undefined" && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== "undefined",
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is "loading", "loaded", execution,
- // then "complete". The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = "_",
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
- reqWaitIdPrefix = "_r@@",
- empty = {},
- contexts = {},
- globalDefQueue = [],
- interactiveScript = null,
- isDone = false,
- checkLoadedDepth = 0,
- useInteractive = false,
- req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
- src, subPath, mainScript, dataMain, i, scrollIntervalId, setReadyState, ctx,
- jQueryCheck, checkLoadedTimeoutId;
-
- function isFunction(it) {
- return ostring.call(it) === "[object Function]";
- }
-
- function isArray(it) {
- return ostring.call(it) === "[object Array]";
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force) {
- for (var prop in source) {
- if (!(prop in empty) && (!(prop in target) || force)) {
- target[prop] = source[prop];
- }
- }
- return req;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- /**
- * Used to set up package paths from a packagePaths or packages config object.
- * @param {Object} pkgs the object to store the new package config
- * @param {Array} currentPackages an array of packages to configure
- * @param {String} [dir] a prefix dir to use.
- */
- function configurePackageDir(pkgs, currentPackages, dir) {
- var i, location, pkgObj;
-
- for (i = 0; (pkgObj = currentPackages[i]); i++) {
- pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Add dir to the path, but avoid paths that start with a slash
- //or have a colon (indicates a protocol)
- if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
- location = dir + "/" + (location || pkgObj.name);
- }
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || "main")
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- }
- }
-
- /**
- * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
- * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
- * At some point remove the readyWait/ready() support and just stick
- * with using holdReady.
- */
- function jQueryHoldReady($, shouldHold) {
- if ($.holdReady) {
- $.holdReady(shouldHold);
- } else if (shouldHold) {
- $.readyWait += 1;
- } else {
- $.ready(true);
- }
- }
-
- if (typeof define !== "undefined") {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== "undefined") {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- } else {
- cfg = requirejs;
- requirejs = undefined;
- }
- }
-
- //Allow for a require config object
- if (typeof require !== "undefined" && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- /**
- * Creates a new context for use in require and define calls.
- * Handle most of the heavy lifting. Do not want to use an object
- * with prototype here to avoid using "this" in require, in case it
- * needs to be used in more super secure envs that do not want this.
- * Also there should not be that many contexts in the page. Usually just
- * one for the default context, but could be extra for multiversion cases
- * or if a package needs a special context for a dependency that conflicts
- * with the standard context.
- */
- function newContext(contextName) {
- var context, resume,
- config = {
- waitSeconds: 7,
- baseUrl: s.baseUrl || "./",
- paths: {},
- pkgs: {},
- catchError: {}
- },
- defQueue = [],
- specified = {
- "require": true,
- "exports": true,
- "module": true
- },
- urlMap = {},
- defined = {},
- loaded = {},
- waiting = {},
- waitAry = [],
- waitIdCounter = 0,
- managerCallbacks = {},
- plugins = {},
- pluginsQueue = {},
- resumeDepth = 0,
- normalizedWaiting = {};
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; (part = ary[i]); i++) {
- if (part === ".") {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (ary[2] === '..' || ary[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) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * 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 pkgName, pkgConfig;
-
- //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) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- baseName = [baseName];
- } else {
- //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.
- baseName = baseName.split("/");
- baseName = baseName.slice(0, baseName.length - 1);
- }
-
- name = baseName.concat(name.split("/"));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //"main" module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join("/");
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- }
- }
- return name;
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap) {
- var index = name ? name.indexOf("!") : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- normalizedName, url, pluginModule;
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- pluginModule = defined[prefix];
- if (pluginModule) {
- //Plugin is loaded, use its normalize method, otherwise,
- //normalize name as usual.
- if (pluginModule.normalize) {
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName);
- });
- } else {
- normalizedName = normalize(name, parentName);
- }
- } else {
- //Plugin is not loaded yet, so do not normalize
- //the name, wait for plugin to load to see if
- //it has a normalize method. To avoid possible
- //ambiguity with relative names loaded from another
- //plugin, use the parent's name as part of this name.
- normalizedName = '__$p' + parentName + '@' + (name || '');
- }
- } else {
- normalizedName = normalize(name, parentName);
- }
-
- url = urlMap[normalizedName];
- if (!url) {
- //Calculate url for the module, if it has a name.
- if (req.toModuleUrl) {
- //Special logic required for a particular engine,
- //like Node.
- url = req.toModuleUrl(context, normalizedName, parentModuleMap);
- } else {
- url = context.nameToUrl(normalizedName, null, parentModuleMap);
- }
-
- //Store the URL mapping for later.
- urlMap[normalizedName] = url;
- }
- }
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- url: url,
- originalName: originalName,
- fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
- };
- }
-
- /**
- * Determine if priority loading is done. If so clear the priorityWait
- */
- function isPriorityDone() {
- var priorityDone = true,
- priorityWait = config.priorityWait,
- priorityName, i;
- if (priorityWait) {
- for (i = 0; (priorityName = priorityWait[i]); i++) {
- if (!loaded[priorityName]) {
- priorityDone = false;
- break;
- }
- }
- if (priorityDone) {
- delete config.priorityWait;
- }
- }
- return priorityDone;
- }
-
- /**
- * Helper function that creates a setExports function for a "module"
- * CommonJS dependency. Do this here to avoid creating a closure that
- * is part of a loop.
- */
- function makeSetExports(moduleObj) {
- return function (exports) {
- moduleObj.exports = exports;
- };
- }
-
- function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
- 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 = [].concat(aps.call(arguments, 0)), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relModuleMap);
- return func.apply(null, args);
- };
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(relModuleMap, enableBuildCallback) {
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
-
- mixin(modRequire, {
- nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
- toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
- defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
- specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
- ready: req.ready,
- isBrowser: req.isBrowser
- });
- //Something used by node.
- if (req.paths) {
- modRequire.paths = req.paths;
- }
- return modRequire;
- }
-
- /**
- * Used to update the normalized name for plugin-based dependencies
- * after a plugin loads, since it can have its own normalization structure.
- * @param {String} pluginName the normalized plugin module name.
- */
- function updateNormalizedNames(pluginName) {
-
- var oldFullName, oldModuleMap, moduleMap, fullName, callbacks,
- i, j, k, depArray, existingCallbacks,
- maps = normalizedWaiting[pluginName];
-
- if (maps) {
- for (i = 0; (oldModuleMap = maps[i]); i++) {
- oldFullName = oldModuleMap.fullName;
- moduleMap = makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap);
- fullName = moduleMap.fullName;
- //Callbacks could be undefined if the same plugin!name was
- //required twice in a row, so use empty array in that case.
- callbacks = managerCallbacks[oldFullName] || [];
- existingCallbacks = managerCallbacks[fullName];
-
- if (fullName !== oldFullName) {
- //Update the specified object, but only if it is already
- //in there. In sync environments, it may not be yet.
- if (oldFullName in specified) {
- delete specified[oldFullName];
- specified[fullName] = true;
- }
-
- //Update managerCallbacks to use the correct normalized name.
- //If there are already callbacks for the normalized name,
- //just add to them.
- if (existingCallbacks) {
- managerCallbacks[fullName] = existingCallbacks.concat(callbacks);
- } else {
- managerCallbacks[fullName] = callbacks;
- }
- delete managerCallbacks[oldFullName];
-
- //In each manager callback, update the normalized name in the depArray.
- for (j = 0; j < callbacks.length; j++) {
- depArray = callbacks[j].depArray;
- for (k = 0; k < depArray.length; k++) {
- if (depArray[k] === oldFullName) {
- depArray[k] = fullName;
- }
- }
- }
- }
- }
- }
-
- delete normalizedWaiting[pluginName];
- }
-
- /*
- * Queues a dependency for checking after the loader is out of a
- * "paused" state, for example while a script file is being loaded
- * in the browser, where it may have many modules defined in it.
- *
- * depName will be fully qualified, no relative . or .. path.
- */
- function queueDependency(dep) {
- //Make sure to load any plugin and associate the dependency
- //with that plugin.
- var prefix = dep.prefix,
- fullName = dep.fullName;
-
- //Do not bother if the depName is already in transit
- if (specified[fullName] || fullName in defined) {
- return;
- }
-
- if (prefix && !plugins[prefix]) {
- //Queue up loading of the dependency, track it
- //via context.plugins. Mark it as a plugin so
- //that the build system will know to treat it
- //special.
- plugins[prefix] = undefined;
-
- //Remember this dep that needs to have normaliztion done
- //after the plugin loads.
- (normalizedWaiting[prefix] || (normalizedWaiting[prefix] = []))
- .push(dep);
-
- //Register an action to do once the plugin loads, to update
- //all managerCallbacks to use a properly normalized module
- //name.
- (managerCallbacks[prefix] ||
- (managerCallbacks[prefix] = [])).push({
- onDep: function (name, value) {
- if (name === prefix) {
- updateNormalizedNames(prefix);
- }
- }
- });
-
- queueDependency(makeModuleMap(prefix));
- }
-
- context.paused.push(dep);
- }
-
- function execManager(manager) {
- var i, ret, waitingCallbacks, err, errFile, errModuleTree,
- cb = manager.callback,
- fullName = manager.fullName,
- args = [],
- ary = manager.depArray;
-
- //Call the callback to define the module, if necessary.
- if (cb && isFunction(cb)) {
- //Pull out the defined dependencies and pass the ordered
- //values to the callback.
- if (ary) {
- for (i = 0; i < ary.length; i++) {
- args.push(manager.deps[ary[i]]);
- }
- }
-
- if (config.catchError.define) {
- try {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- } catch (e) {
- err = e;
- }
- } else {
- ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
- }
-
- if (fullName) {
- //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 (manager.cjsModule && manager.cjsModule.exports !== undefined) {
- ret = defined[fullName] = manager.cjsModule.exports;
- } else if (ret === undefined && manager.usingExports) {
- //exports already set the defined value.
- ret = defined[fullName];
- } else {
- //Use the return value from the function.
- defined[fullName] = ret;
- }
- }
- } else if (fullName) {
- //May just be an object definition for the module. Only
- //worry about defining if have a module name.
- ret = defined[fullName] = cb;
- }
-
- //Clean up waiting. Do this before error calls, and before
- //calling back waitingCallbacks, so that bookkeeping is correct
- //in the event of an error and error is reported in correct order,
- //since the waitingCallbacks will likely have errors if the
- //onError function does not throw.
- if (waiting[manager.waitId]) {
- delete waiting[manager.waitId];
- manager.isDone = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- if (err) {
- errFile = (fullName ? makeModuleMap(fullName).url : '') ||
- err.fileName || err.sourceURL;
- errModuleTree = err.moduleTree;
- err = makeError('defineerror', 'Error evaluating ' +
- 'module "' + fullName + '" at location "' +
- errFile + '":\n' +
- err + '\nfileName:' + errFile +
- '\nlineNumber: ' + (err.lineNumber || err.line), err);
- err.moduleName = fullName;
- err.moduleTree = errModuleTree;
- return req.onError(err);
- }
-
- if (fullName) {
- //If anything was waiting for this module to be defined,
- //notify them now.
- waitingCallbacks = managerCallbacks[fullName];
- if (waitingCallbacks) {
- for (i = 0; i < waitingCallbacks.length; i++) {
- waitingCallbacks[i].onDep(fullName, ret);
- }
- delete managerCallbacks[fullName];
- }
- }
-
- return undefined;
- }
-
- function main(inName, depArray, callback, relModuleMap) {
- var moduleMap = makeModuleMap(inName, relModuleMap),
- name = moduleMap.name,
- fullName = moduleMap.fullName,
- uniques = {},
- manager = {
- //Use a wait ID because some entries are anon
- //async require calls.
- waitId: name || reqWaitIdPrefix + (waitIdCounter++),
- depCount: 0,
- depMax: 0,
- prefix: moduleMap.prefix,
- name: name,
- fullName: fullName,
- deps: {},
- depArray: depArray,
- callback: callback,
- onDep: function (depName, value) {
- if (!(depName in manager.deps)) {
- manager.deps[depName] = value;
- manager.depCount += 1;
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- }
- }
- }
- },
- i, depArg, depName, cjsMod;
-
- if (fullName) {
- //If module already defined for context, or already loaded,
- //then leave. Also leave if jQuery is registering but it does
- //not match the desired version number in the config.
- if (fullName in defined || loaded[fullName] === true ||
- (fullName === "jquery" && config.jQuery &&
- config.jQuery !== callback().fn.jquery)) {
- return;
- }
-
- //Set specified/loaded here for modules that are also loaded
- //as part of a layer, where onScriptLoad is not fired
- //for those cases. Do this after the inline define and
- //dependency tracing is done.
- specified[fullName] = true;
- loaded[fullName] = true;
-
- //If module is jQuery set up delaying its dom ready listeners.
- if (fullName === "jquery" && callback) {
- jQueryCheck(callback());
- }
- }
-
- //Add the dependencies to the deps field, and register for callbacks
- //on the dependencies.
- for (i = 0; i < depArray.length; i++) {
- depArg = depArray[i];
- //There could be cases like in IE, where a trailing comma will
- //introduce a null dependency, so only treat a real dependency
- //value as a dependency.
- if (depArg) {
- //Split the dependency name into plugin and name parts
- depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
- depName = depArg.fullName;
-
- //Fix the name in depArray to be just the name, since
- //that is how it will be called back later.
- depArray[i] = depName;
-
- //Fast path CommonJS standard dependencies.
- if (depName === "require") {
- manager.deps[depName] = makeRequire(moduleMap);
- } else if (depName === "exports") {
- //CommonJS module spec 1.1
- manager.deps[depName] = defined[fullName] = {};
- manager.usingExports = true;
- } else if (depName === "module") {
- //CommonJS module spec 1.1
- manager.cjsModule = cjsMod = manager.deps[depName] = {
- id: name,
- uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
- exports: defined[fullName]
- };
- cjsMod.setExports = makeSetExports(cjsMod);
- } else if (depName in defined && !(depName in waiting)) {
- //Module already defined, no need to wait for it.
- manager.deps[depName] = defined[depName];
- } else if (!uniques[depName]) {
-
- //A dynamic dependency.
- manager.depMax += 1;
-
- queueDependency(depArg);
-
- //Register to get notification when dependency loads.
- (managerCallbacks[depName] ||
- (managerCallbacks[depName] = [])).push(manager);
-
- uniques[depName] = true;
- }
- }
- }
-
- //Do not bother tracking the manager if it is all done.
- if (manager.depCount === manager.depMax) {
- //All done, execute!
- execManager(manager);
- } else {
- waiting[manager.waitId] = manager;
- waitAry.push(manager);
- context.waitCount += 1;
- }
- }
-
- /**
- * Convenience method to call main for a define call that was put on
- * hold in the defQueue.
- */
- function callDefMain(args) {
- main.apply(null, args);
- //Mark the module loaded. Must do it here in addition
- //to doing it in define in case a script does
- //not call define
- loaded[args[0]] = true;
- }
-
- /**
- * jQuery 1.4.3+ supports ways to hold off calling
- * calling jQuery ready callbacks until all scripts are loaded. Be sure
- * to track it if the capability exists.. Also, since jQuery 1.4.3 does
- * not register as a module, need to do some global inference checking.
- * Even if it does register as a module, not guaranteed to be the precise
- * name of the global. If a jQuery is tracked for this context, then go
- * ahead and register it as a module too, if not already in process.
- */
- jQueryCheck = function (jqCandidate) {
- if (!context.jQuery) {
- var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
-
- if ($) {
- //If a specific version of jQuery is wanted, make sure to only
- //use this jQuery if it matches.
- if (config.jQuery && $.fn.jquery !== config.jQuery) {
- return;
- }
-
- if ("holdReady" in $ || "readyWait" in $) {
- context.jQuery = $;
-
- //Manually create a "jquery" module entry if not one already
- //or in process. Note this could trigger an attempt at
- //a second jQuery registration, but does no harm since
- //the first one wins, and it is the same value anyway.
- callDefMain(["jquery", [], function () {
- return jQuery;
- }]);
-
- //Ask jQuery to hold DOM ready callbacks.
- if (context.scriptCount) {
- jQueryHoldReady($, true);
- context.jQueryIncremented = true;
- }
- }
- }
- }
- };
-
- function forceExec(manager, traced) {
- if (manager.isDone) {
- return undefined;
- }
-
- var fullName = manager.fullName,
- depArray = manager.depArray,
- depName, i;
- if (fullName) {
- if (traced[fullName]) {
- return defined[fullName];
- }
-
- traced[fullName] = true;
- }
-
- //forceExec all of its dependencies.
- for (i = 0; i < depArray.length; i++) {
- //Some array members may be null, like if a trailing comma
- //IE, so do the explicit [i] access and check if it has a value.
- depName = depArray[i];
- if (depName) {
- if (!manager.deps[depName] && waiting[depName]) {
- manager.onDep(depName, forceExec(waiting[depName], traced));
- }
- }
- }
-
- return fullName ? defined[fullName] : undefined;
- }
-
- /**
- * Checks if all modules for a context are loaded, and if so, evaluates the
- * new ones in right dependency order.
- *
- * @private
- */
- function checkLoaded() {
- var waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
- err, manager;
-
- //If there are items still in the paused queue processing wait.
- //This is particularly important in the sync case where each paused
- //item is processed right away but there may be more waiting.
- if (context.pausedCount > 0) {
- return undefined;
- }
-
- //Determine if priority loading is done. If so clear the priority. If
- //not, then do not check
- if (config.priorityWait) {
- if (isPriorityDone()) {
- //Call resume, since it could have
- //some waiting dependencies to trace.
- resume();
- } else {
- return undefined;
- }
- }
-
- //See if anything is still in flight.
- for (prop in loaded) {
- if (!(prop in empty)) {
- hasLoadedProp = true;
- if (!loaded[prop]) {
- if (expired) {
- noLoads += prop + " ";
- } else {
- stillLoading = true;
- break;
- }
- }
- }
- }
-
- //Check for exit conditions.
- if (!hasLoadedProp && !context.waitCount) {
- //If the loaded object had no items, then the rest of
- //the work below does not need to be done.
- return undefined;
- }
- if (expired && noLoads) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError("timeout", "Load timeout for modules: " + noLoads);
- err.requireType = "timeout";
- err.requireModules = noLoads;
- return req.onError(err);
- }
- if (stillLoading || context.scriptCount) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- return undefined;
- }
-
- //If still have items in the waiting cue, but all modules have
- //been loaded, then it means there are some circular dependencies
- //that need to be broken.
- //However, as a waiting thing is fired, then it can add items to
- //the waiting cue, and those items should not be fired yet, so
- //make sure to redo the checkLoaded call after breaking a single
- //cycle, if nothing else loaded then this logic will pick it up
- //again.
- if (context.waitCount) {
- //Cycle through the waitAry, and call items in sequence.
- for (i = 0; (manager = waitAry[i]); i++) {
- forceExec(manager, {});
- }
-
- //Only allow this recursion to a certain depth. Only
- //triggered by errors in calling a module in which its
- //modules waiting on it cannot finish loading, or some circular
- //dependencies that then may add more dependencies.
- //The value of 5 is a bit arbitrary. Hopefully just one extra
- //pass, or two for the case of circular dependencies generating
- //more work that gets resolved in the sync node case.
- if (checkLoadedDepth < 5) {
- checkLoadedDepth += 1;
- checkLoaded();
- }
- }
-
- checkLoadedDepth = 0;
-
- //Check for DOM ready, and nothing is waiting across contexts.
- req.checkReadyState();
-
- return undefined;
- }
-
- function callPlugin(pluginName, dep) {
- var name = dep.name,
- fullName = dep.fullName,
- load;
-
- //Do not bother if plugin is already defined or being loaded.
- if (fullName in defined || fullName in loaded) {
- return;
- }
-
- if (!plugins[pluginName]) {
- plugins[pluginName] = defined[pluginName];
- }
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[fullName]) {
- loaded[fullName] = false;
- }
-
- load = function (ret) {
- //Allow the build process to register plugin-loaded dependencies.
- if (req.onPluginLoad) {
- req.onPluginLoad(context, pluginName, name, ret);
- }
-
- execManager({
- prefix: dep.prefix,
- name: dep.name,
- fullName: dep.fullName,
- callback: function () {
- return ret;
- }
- });
- loaded[fullName] = true;
- };
-
- //Allow plugins to load other code without having to know the
- //context or how to "complete" the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugins[pluginName].load(name, makeRequire(dep.parentMap, true), load, config);
- }
-
- function loadPaused(dep) {
- //Renormalize dependency if its name was waiting on a plugin
- //to load, which as since loaded.
- if (dep.prefix && dep.name && dep.name.indexOf('__$p') === 0 && defined[dep.prefix]) {
- dep = makeModuleMap(dep.originalName, dep.parentMap);
- }
-
- var pluginName = dep.prefix,
- fullName = dep.fullName,
- urlFetched = context.urlFetched;
-
- //Do not bother if the dependency has already been specified.
- if (specified[fullName] || loaded[fullName]) {
- return;
- } else {
- specified[fullName] = true;
- }
-
- if (pluginName) {
- //If plugin not loaded, wait for it.
- //set up callback list. if no list, then register
- //managerCallback for that plugin.
- if (defined[pluginName]) {
- callPlugin(pluginName, dep);
- } else {
- if (!pluginsQueue[pluginName]) {
- pluginsQueue[pluginName] = [];
- (managerCallbacks[pluginName] ||
- (managerCallbacks[pluginName] = [])).push({
- onDep: function (name, value) {
- if (name === pluginName) {
- var i, oldModuleMap, ary = pluginsQueue[pluginName];
-
- //Now update all queued plugin actions.
- for (i = 0; i < ary.length; i++) {
- oldModuleMap = ary[i];
- //Update the moduleMap since the
- //module name may be normalized
- //differently now.
- callPlugin(pluginName,
- makeModuleMap(oldModuleMap.originalName, oldModuleMap.parentMap));
- }
- delete pluginsQueue[pluginName];
- }
- }
- });
- }
- pluginsQueue[pluginName].push(dep);
- }
- } else {
- if (!urlFetched[dep.url]) {
- req.load(context, fullName, dep.url);
- urlFetched[dep.url] = true;
- }
- }
- }
-
- /**
- * Resumes tracing of dependencies and then checks if everything is loaded.
- */
- resume = function () {
- var args, i, p;
-
- resumeDepth += 1;
-
- if (context.scriptCount <= 0) {
- //Synchronous envs will push the number below zero with the
- //decrement above, be sure to set it back to zero for good measure.
- //require() calls that also do not end up loading scripts could
- //push the number negative too.
- context.scriptCount = 0;
- }
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- callDefMain(args);
- }
- }
-
- //Skip the resume of paused dependencies
- //if current context is in priority wait.
- if (!config.priorityWait || isPriorityDone()) {
- while (context.paused.length) {
- p = context.paused;
- context.pausedCount += p.length;
- //Reset paused list
- context.paused = [];
-
- for (i = 0; (args = p[i]); i++) {
- loadPaused(args);
- }
- //Move the start time for timeout forward.
- context.startTime = (new Date()).getTime();
- context.pausedCount -= p.length;
- }
- }
-
- //Only check if loaded when resume depth is 1. It is likely that
- //it is only greater than 1 in sync environments where a factory
- //function also then calls the callback-style require. In those
- //cases, the checkLoaded should not occur until the resume
- //depth is back at the top level.
- if (resumeDepth === 1) {
- checkLoaded();
- }
-
- resumeDepth -= 1;
-
- return undefined;
- };
-
- //Define the context object. Many of these fields are on here
- //just to make debugging easier.
- context = {
- contextName: contextName,
- config: config,
- defQueue: defQueue,
- waiting: waiting,
- waitCount: 0,
- specified: specified,
- loaded: loaded,
- urlMap: urlMap,
- scriptCount: 0,
- urlFetched: {},
- defined: defined,
- paused: [],
- pausedCount: 0,
- plugins: plugins,
- managerCallbacks: managerCallbacks,
- makeModuleMap: makeModuleMap,
- normalize: normalize,
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- var paths, prop, packages, pkgs, packagePaths, requireWait;
-
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
- cfg.baseUrl += "/";
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- paths = config.paths;
- packages = config.packages;
- pkgs = config.pkgs;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Adjust paths if necessary.
- if (cfg.paths) {
- for (prop in cfg.paths) {
- if (!(prop in empty)) {
- paths[prop] = cfg.paths[prop];
- }
- }
- config.paths = paths;
- }
-
- packagePaths = cfg.packagePaths;
- if (packagePaths || cfg.packages) {
- //Convert packagePaths into a packages config.
- if (packagePaths) {
- for (prop in packagePaths) {
- if (!(prop in empty)) {
- configurePackageDir(pkgs, packagePaths[prop], prop);
- }
- }
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- configurePackageDir(pkgs, cfg.packages);
- }
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If priority loading is in effect, trigger the loads now
- if (cfg.priority) {
- //Hold on to requireWait value, and reset it after done
- requireWait = context.requireWait;
-
- //Allow tracing some require calls to allow the fetching
- //of the priority config.
- context.requireWait = false;
- //But first, call resume to register any defined modules that may
- //be in a data-main built file before the priority config
- //call. Also grab any waiting define calls for this context.
- context.takeGlobalQueue();
- resume();
-
- context.require(cfg.priority);
-
- //Trigger a resume right away, for the case when
- //the script with the priority load is done as part
- //of a data-main call. In that case the normal resume
- //call will not happen because the scriptCount will be
- //at 1, since the script for data-main is being processed.
- resume();
-
- //Restore previous state.
- context.requireWait = requireWait;
- config.priorityWait = cfg.priority;
- }
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
-
- //Set up ready callback, if asked. Useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.ready) {
- req.ready(cfg.ready);
- }
- },
-
- requireDefined: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in defined;
- },
-
- requireSpecified: function (moduleName, relModuleMap) {
- return makeModuleMap(moduleName, relModuleMap).fullName in specified;
- },
-
- require: function (deps, callback, relModuleMap) {
- var moduleName, fullName, moduleMap;
- if (typeof deps === "string") {
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relModuleMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relModuleMap.
- moduleName = deps;
- relModuleMap = callback;
-
- //Normalize module name, if it contains . or ..
- moduleMap = makeModuleMap(moduleName, relModuleMap);
- fullName = moduleMap.fullName;
-
- if (!(fullName in defined)) {
- return req.onError(makeError("notloaded", "Module name '" +
- moduleMap.fullName +
- "' has not been loaded yet for context: " +
- contextName));
- }
- return defined[fullName];
- }
-
- main(null, deps, callback, relModuleMap);
-
- //If the require call does not trigger anything new to load,
- //then resume the dependency processing.
- if (!context.requireWait) {
- while (!context.scriptCount && context.paused.length) {
- //For built layers, there can be some defined
- //modules waiting for intake into the context,
- //in particular module plugins. Take them.
- context.takeGlobalQueue();
- resume();
- }
- }
- return context.require;
- },
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- takeGlobalQueue: function () {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(context.defQueue,
- [context.defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var args;
-
- context.takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
-
- if (args[0] === null) {
- args[0] = moduleName;
- break;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- break;
- } else {
- //Some other named define call, most likely the result
- //of a build layer that included many define calls.
- callDefMain(args);
- args = null;
- }
- }
- if (args) {
- callDefMain(args);
- } else {
- //A script that does not call define(), so just simulate
- //the call for it. Special exception for jQuery dynamic load.
- callDefMain([moduleName, [],
- moduleName === "jquery" && typeof jQuery !== "undefined" ?
- function () {
- return jQuery;
- } : null]);
- }
-
- //Mark the script as loaded. Note that this can be different from a
- //moduleName that maps to a define call. This line is important
- //for traditional browser scripts.
- loaded[moduleName] = true;
-
- //If a global jQuery is defined, check for it. Need to do it here
- //instead of main() since stock jQuery does not register as
- //a module via define.
- jQueryCheck();
-
- //Doing this scriptCount decrement branching because sync envs
- //need to decrement after resume, otherwise it looks like
- //loading is complete after the first dependency is fetched.
- //For browsers, it works fine to decrement after, but it means
- //the checkLoaded setTimeout 50 ms cost is taken. To avoid
- //that cost, decrement beforehand.
- if (req.isAsync) {
- context.scriptCount -= 1;
- }
- resume();
- if (!req.isAsync) {
- context.scriptCount -= 1;
- }
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf("."),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- */
- nameToUrl: function (moduleName, ext, relModuleMap) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- config = context.config;
-
- //Normalize module name if have a base relative module name to work from.
- moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext ? ext : "");
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split("/");
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i--) {
- parentModule = syms.slice(0, i).join("/");
- if (paths[parentModule]) {
- syms.splice(0, i, paths[parentModule]);
- break;
- } else if ((pkg = pkgs[parentModule])) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join("/") + (ext || ".js");
- url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- }
- };
-
- //Make these visible on the context so can be called at the very
- //end of the file to bootstrap
- context.jQueryCheck = jQueryCheck;
- context.resume = resume;
-
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback) {
-
- //Find the right context, use default
- var contextName = defContextName,
- context, config;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== "string") {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = arguments[2];
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName] ||
- (contexts[contextName] = newContext(contextName));
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (typeof require === "undefined") {
- require = req;
- }
-
- /**
- * Global require.toUrl(), to match global require, mostly useful
- * for debugging/work in the global space.
- */
- req.toUrl = function (moduleNamePlusExt) {
- return contexts[defContextName].toUrl(moduleNamePlusExt);
- };
-
- req.version = version;
- req.isArray = isArray;
- req.isFunction = isFunction;
- req.mixin = mixin;
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- s = req.s = {
- contexts: contexts,
- //Stores a list of URLs that should not get async script tag treatment.
- skipAsync: {},
- isPageLoaded: !isBrowser,
- readyCalls: []
- };
-
- req.isAsync = req.isBrowser = isBrowser;
- if (isBrowser) {
- head = s.head = document.getElementsByTagName("head")[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName("base")[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var loaded = context.loaded;
-
- isDone = false;
-
- //Only set loaded to false for tracking if it has not already been set.
- if (!loaded[moduleName]) {
- loaded[moduleName] = false;
- }
-
- context.scriptCount += 1;
- req.attach(url, context, moduleName);
-
- //If tracking a jQuery, then make sure its ready callbacks
- //are put on hold to prevent its ready callbacks from
- //triggering too soon.
- if (context.jQuery && !context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, true);
- context.jQueryIncremented = true;
- }
- };
-
- function getInteractiveScript() {
- var scripts, i, script;
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- scripts = document.getElementsByTagName('script');
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- }
-
- return null;
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = req.def = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!req.isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!name && !deps.length && req.isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, "")
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute("data-requiremodule");
- }
- context = contexts[node.getAttribute("data-requirecontext")];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
-
- return undefined;
- };
-
- define.amd = {
- multiversion: true,
- plugins: true,
- jQuery: true
- };
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a more environment specific call.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- return eval(text);
- };
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- req.execCb = function (name, callback, args, exports) {
- return callback.apply(exports, args);
- };
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- *
- * @private
- */
- req.onScriptLoad = function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
- context;
-
- if (evt.type === "load" || readyRegExp.test(node.readyState)) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- contextName = node.getAttribute("data-requirecontext");
- moduleName = node.getAttribute("data-requiremodule");
- context = contexts[contextName];
-
- contexts[contextName].completeLoad(moduleName);
-
- //Clean up script binding. Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- node.detachEvent("onreadystatechange", req.onScriptLoad);
- } else {
- node.removeEventListener("load", req.onScriptLoad, false);
- }
- }
- };
-
- /**
- * Attaches the script represented by the URL to the current
- * environment. Right now only supports browser loading,
- * but can be redefined in other environments to do the right thing.
- * @param {String} url the url of the script to attach.
- * @param {Object} context the context that wants the script.
- * @param {moduleName} the name of the module that is associated with the script.
- * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
- * @param {String} [type] optional type, defaults to text/javascript
- */
- req.attach = function (url, context, moduleName, callback, type) {
- var node, loaded;
- if (isBrowser) {
- //In the browser so use a script tag
- callback = callback || req.onScriptLoad;
- node = context && context.config && context.config.xhtml ?
- document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
- document.createElement("script");
- node.type = type || "text/javascript";
- node.charset = "utf-8";
- //Use async so Gecko does not block on executing the script if something
- //like a long-polling comet tag is being run first. Gecko likes
- //to evaluate scripts in DOM order, even for dynamic scripts.
- //It will fetch them async, but only evaluate the contents in DOM
- //order, so a long-polling script tag can delay execution of scripts
- //after it. But telling Gecko we expect async gets us the behavior
- //we want -- execute it whenever it is finished downloading. Only
- //Helps Firefox 3.6+
- //Allow some URLs to not be fetched async. Mostly helps the order!
- //plugin
- node.async = !s.skipAsync[url];
-
- if (context) {
- node.setAttribute("data-requirecontext", context.contextName);
- }
- node.setAttribute("data-requiremodule", moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent && !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in "interactive"
- //readyState at the time of the define call.
- useInteractive = true;
- node.attachEvent("onreadystatechange", callback);
- } else {
- node.addEventListener("load", callback, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- loaded = context.loaded;
- loaded[moduleName] = false;
-
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- return null;
- };
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- scripts = document.getElementsByTagName("script");
-
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
- //Set the "head" where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- if ((dataMain = script.getAttribute('data-main'))) {
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- //Set final config.
- cfg.baseUrl = subPath;
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = mainScript.replace(jsSuffixRegExp, '');
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- break;
- }
- }
- }
-
- //Set baseUrl based on config.
- s.baseUrl = cfg.baseUrl;
-
- //****** START page load functionality ****************
- /**
- * Sets the page as loaded and triggers check for all modules loaded.
- */
- req.pageLoaded = function () {
- if (!s.isPageLoaded) {
- s.isPageLoaded = true;
- if (scrollIntervalId) {
- clearInterval(scrollIntervalId);
- }
-
- //Part of a fix for FF < 3.6 where readyState was not set to
- //complete so libraries like jQuery that check for readyState
- //after page load where not getting initialized correctly.
- //Original approach suggested by Andrea Giammarchi:
- //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
- //see other setReadyState reference for the rest of the fix.
- if (setReadyState) {
- document.readyState = "complete";
- }
-
- req.callReady();
- }
- };
-
- //See if there is nothing waiting across contexts, and if not, trigger
- //callReady.
- req.checkReadyState = function () {
- var contexts = s.contexts, prop;
- for (prop in contexts) {
- if (!(prop in empty)) {
- if (contexts[prop].waitCount) {
- return;
- }
- }
- }
- s.isDone = true;
- req.callReady();
- };
-
- /**
- * Internal function that calls back any ready functions. If you are
- * integrating RequireJS with another library without require.ready support,
- * you can define this method to call your page ready code instead.
- */
- req.callReady = function () {
- var callbacks = s.readyCalls, i, callback, contexts, context, prop;
-
- if (s.isPageLoaded && s.isDone) {
- if (callbacks.length) {
- s.readyCalls = [];
- for (i = 0; (callback = callbacks[i]); i++) {
- callback();
- }
- }
-
- //If jQuery with DOM ready delayed, release it now.
- contexts = s.contexts;
- for (prop in contexts) {
- if (!(prop in empty)) {
- context = contexts[prop];
- if (context.jQueryIncremented) {
- jQueryHoldReady(context.jQuery, false);
- context.jQueryIncremented = false;
- }
- }
- }
- }
- };
-
- /**
- * Registers functions to call when the page is loaded
- */
- req.ready = function (callback) {
- if (s.isPageLoaded && s.isDone) {
- callback();
- } else {
- s.readyCalls.push(callback);
- }
- return req;
- };
-
- if (isBrowser) {
- if (document.addEventListener) {
- //Standards. Hooray! Assumption here that if standards based,
- //it knows about DOMContentLoaded.
- document.addEventListener("DOMContentLoaded", req.pageLoaded, false);
- window.addEventListener("load", req.pageLoaded, false);
- //Part of FF < 3.6 readystate fix (see setReadyState refs for more info)
- if (!document.readyState) {
- setReadyState = true;
- document.readyState = "loading";
- }
- } else if (window.attachEvent) {
- window.attachEvent("onload", req.pageLoaded);
-
- //DOMContentLoaded approximation, as found by Diego Perini:
- //http://javascript.nwbox.com/IEContentLoaded/
- if (self === self.top) {
- scrollIntervalId = setInterval(function () {
- try {
- //From this ticket:
- //http://bugs.dojotoolkit.org/ticket/11106,
- //In IE HTML Application (HTA), such as in a selenium test,
- //javascript in the iframe can't see anything outside
- //of it, so self===self.top is true, but the iframe is
- //not the top window and doScroll will be available
- //before document.body is set. Test document.body
- //before trying the doScroll trick.
- if (document.body) {
- document.documentElement.doScroll("left");
- req.pageLoaded();
- }
- } catch (e) {}
- }, 30);
- }
- }
-
- //Check if document already complete, and if so, just trigger page load
- //listeners. NOTE: does not work with Firefox before 3.6. To support
- //those browsers, manually call require.pageLoaded().
- if (document.readyState === "complete") {
- req.pageLoaded();
- }
- }
- //****** END page load functionality ****************
-
- //Set up default context. If require was a configuration object, use that as base config.
- req(cfg);
-
- //If modules are built into require.js, then need to make sure dependencies are
- //traced. Use a setTimeout in the browser world, to allow all the modules to register
- //themselves. In a non-browser env, assume that modules are not built into require.js,
- //which seems odd to do on the server.
- if (req.isAsync && typeof setTimeout !== "undefined") {
- ctx = s.contexts[(cfg.context || defContextName)];
- //Indicate that the script that includes require() is still loading,
- //so that require()'d dependencies are not traced until the end of the
- //file is parsed (approximated via the setTimeout call).
- ctx.requireWait = true;
- setTimeout(function () {
- ctx.requireWait = false;
-
- //Any modules included with the require.js file will be in the
- //global queue, assign them to this context.
- ctx.takeGlobalQueue();
-
- //Allow for jQuery to be loaded/already in the page, and if jQuery 1.4.3,
- //make sure to hold onto it for readyWait triggering.
- ctx.jQueryCheck();
-
- if (!ctx.scriptCount) {
- ctx.resume();
- }
- req.checkReadyState();
- }, 0);
- }
-}());
diff --git a/temp/idbwrapper/0.3.0/package/example/objectstore/app.js b/temp/idbwrapper/0.3.0/package/example/objectstore/app.js
deleted file mode 100644
index 21e828a52..000000000
--- a/temp/idbwrapper/0.3.0/package/example/objectstore/app.js
+++ /dev/null
@@ -1,93 +0,0 @@
-require(['../../IDBStore.js'], function(IDBStore){
-
- var objStore;
-
- var nodeCache = {};
-
- function init(){
-
- // create a store ("table")
- objStore = new IDBStore({
- storeName: 'objectstore',
- keyPath: 'id',
- autoIncrement: true,
- onStoreReady: refreshTable
- });
-
- // create references for some nodes we have to work with
- ['submit', 'results-container'].forEach(function(id){
- nodeCache[id] = document.getElementById(id);
- });
-
- // and listen to the form's submit button.
- nodeCache.submit.addEventListener('click', enterData);
- }
-
- function refreshTable(){
- objStore.getAll(listItems);
- }
-
- function listItems(data){
- var header, tpl,
- props = ['id'],
- content = '';
-
- data.forEach(function(item){
- for(var prop in item){
- if(props.indexOf(prop) < 0){
- props.push(prop);
- }
- }
- });
-
- header = '
';
- }
-
- function enterData(){
- // read data from inputs
- var propName, value, hasData,
- data = {},
- count = 4;
-
- while(--count){
- propName = document.getElementById('prop_' + count).value.trim();
- if(propName.length){
- hasData = true;
- value = document.getElementById('value_' + count).value.trim();
- // Don't do this at home. This is just a very dirty hack to 'guess' what
- // type of data you just entered. If you do stuff like this in production
- // code, UNICORNS WILL DIE. You have been warned.
- data[propName] = ['{', '['].indexOf(value.substring(0,1)) !== -1 ? eval('(' + value + ')') : parseInt(value, 10) || value;
- }
- }
- if(!hasData){
- return;
- }
-
- // and store them away.
- objStore.put(data, refreshTable);
- }
-
- function clear(){
- objStore.clear(refreshTable);
- }
-
- // export some functions to the outside to
- // make the onclick="" attributes work.
- window.app = {
- clear: clear
- };
-
- // go!
- init();
-
-});
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/example/objectstore/index.html b/temp/idbwrapper/0.3.0/package/example/objectstore/index.html
deleted file mode 100644
index 44a316628..000000000
--- a/temp/idbwrapper/0.3.0/package/example/objectstore/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- IDBWrapper ObjectStore Example
-
-
-
-
-
IDBWrapper ObjectStore Example
-
-
- QueryResults
-
-
-
-
-
- IDB is not a relational database; it's an object store. That means you
- have
- no such things as fixed, defined columns.
- Just enter any name as key and anything as value.
-
- To enter non-primitive values, use literal notaion.
-
Open the console and click 'Open DB'. You will then see a bunch of buttons
- that allow data manipulation. Click them, and check the console for
- results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/temp/idbwrapper/0.3.0/package/example/quicktest/style.css b/temp/idbwrapper/0.3.0/package/example/quicktest/style.css
deleted file mode 100644
index 90f382838..000000000
--- a/temp/idbwrapper/0.3.0/package/example/quicktest/style.css
+++ /dev/null
@@ -1,94 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
- text-decoration: none;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
- -ms-flex-direction: column;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- -ms-flex-direction: row;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- -ms-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- background: linear-gradient(to bottom, #ffffff, #e5e5e5);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/example/style.css b/temp/idbwrapper/0.3.0/package/example/style.css
deleted file mode 100644
index fb96076ca..000000000
--- a/temp/idbwrapper/0.3.0/package/example/style.css
+++ /dev/null
@@ -1,87 +0,0 @@
-html {
- width: 100%;
- height: 100%;
-}
-body {
- width: 100%;
- height: 100%;
- margin: 0;
- font-family: sans-serif;
-}
-a {
- color: black;
-}
-
-/* box setup */
-.vbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: vertical;
- -moz-box-orient: vertical;
-}
-.hbox {
- display: -webkit-box;
- display: -moz-box;
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
-}
-.flex {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
-}
-.container {
- overflow: auto;
- padding: 10px;
-}
-
-/* head */
-#head {
- background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%);
- background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%);
- padding: 10px;
- border-bottom: solid 1px #9E9E9E;
-}
-
-/* table */
-#results-container {
- border-right: solid 1px black;
- padding: 10px;
- overflow: auto;
-}
-#results-container table {
- border-collapse: collapse;
-}
-#results-container th {
- border-bottom: solid 1px #808080;
-}
-#results-container th,
-#results-container td {
- padding: 2px 5px;
- font-size: 14px;
-}
-#results-container input {
- border: none;
- border-bottom: solid 1px white;
- font-size: 14px;
-}
-#results-container input:hover,
-#results-container input:active {
- border-bottom: dotted 1px black;
-}
-
-/* input */
-#input {
- padding: 10px;
- width: 300px;
-}
-#input div {
- padding: 5px;
-}
-#input label {
- display: inline-block;
- width: 100px;
-}
-
-#clear {
- padding: 10px;
-}
\ No newline at end of file
diff --git a/temp/idbwrapper/0.3.0/package/package.json b/temp/idbwrapper/0.3.0/package/package.json
deleted file mode 100644
index d7f9f7051..000000000
--- a/temp/idbwrapper/0.3.0/package/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "idb-wrapper",
- "version": "0.3.0",
- "description": "A cross-browser wrapper for IndexedDB",
- "keywords": [],
- "author": "jensarps (http://jensarps.de/)",
- "repository": "git://github.com/jensarps/IDBWrapper.git",
- "main": "IDBStore",
- "homepage": "https://github.com/jensarps/IDBWrapper",
- "contributors": [
- "Josh Matthews (http://www.joshmatthews.net/blog/)",
- "Raynos (http://raynos.org)"
- ],
- "bugs": {
- "url": "https://github.com/jensarps/IDBWrapper/issues",
- "email": "mail@jensarps.de"
- },
- "dependencies": {
- },
- "devDependencies": {
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/jensarps/IDBWrapper/raw/master/LICENSE"
- }
- ],
- "scripts": {
- }
-}
diff --git a/temp/loglevel/0.1.0/dist.tar.gz b/temp/loglevel/0.1.0/dist.tar.gz
deleted file mode 100644
index bec4c3cf8..000000000
Binary files a/temp/loglevel/0.1.0/dist.tar.gz and /dev/null differ
diff --git a/temp/loglevel/0.1.0/package/.jshintrc b/temp/loglevel/0.1.0/package/.jshintrc
deleted file mode 100644
index 284ce67f0..000000000
--- a/temp/loglevel/0.1.0/package/.jshintrc
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": true,
- "unused": true,
- "boss": true,
- "eqnull": true,
- "node": true,
- "es5": true
-}
diff --git a/temp/loglevel/0.1.0/package/.npmignore b/temp/loglevel/0.1.0/package/.npmignore
deleted file mode 100644
index 674a52cf9..000000000
--- a/temp/loglevel/0.1.0/package/.npmignore
+++ /dev/null
@@ -1,21 +0,0 @@
-/node_modules/
-/.idea/
-lib-cov
-*.seed
-*.log
-*.csv
-*.dat
-*.out
-*.pid
-*.gz
-
-pids
-logs
-results
-
-npm-debug.log
-*.iml
-/dist
-
-_SpecRunner.html
-.grunt
\ No newline at end of file
diff --git a/temp/loglevel/0.1.0/package/.travis.yml b/temp/loglevel/0.1.0/package/.travis.yml
deleted file mode 100644
index 9a61f6bd7..000000000
--- a/temp/loglevel/0.1.0/package/.travis.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
\ No newline at end of file
diff --git a/temp/loglevel/0.1.0/package/Gruntfile.js b/temp/loglevel/0.1.0/package/Gruntfile.js
deleted file mode 100644
index 7d1ded4a6..000000000
--- a/temp/loglevel/0.1.0/package/Gruntfile.js
+++ /dev/null
@@ -1,141 +0,0 @@
-'use strict';
-
-module.exports = function (grunt) {
-
- // Project configuration.
- grunt.initConfig({
- // Metadata.
- pkg: grunt.file.readJSON('package.json'),
- banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
- '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
- '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
- '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
- ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
- // Task configuration.
- concat: {
- options: {
- banner: '<%= banner %>',
- stripBanners: true
- },
- dist: {
- src: ['lib/<%= pkg.name %>.js'],
- dest: 'dist/<%= pkg.name %>.js'
- },
- },
- uglify: {
- options: {
- banner: '<%= banner %>'
- },
- dist: {
- src: '<%= concat.dist.dest %>',
- dest: 'dist/<%= pkg.name %>.min.js'
- },
- },
- jasmine: {
- src: 'src/**/*.js',
- options: {
- specs: 'test/*-test.js',
- vendor: 'test/vendor/*.js',
- template: require('grunt-template-jasmine-requirejs')
- }
- },
- open: {
- jasmine: {
- path: 'http://127.0.0.1:8000/_SpecRunner.html'
- }
- },
- connect: {
- test: {
- port: 8000,
- keepalive: true
- }
- },
- 'saucelabs-jasmine': {
- all: {
- username: 'pimterry',
- key: 'KEY',
- urls: ['http://localhost:8000/_SpecRunner.html'],
- browsers: [
- {"browserName": "iehta", "platform": "Windows 2008", "version": "9"},
- // {"browserName": "firefox", "platform": "Windows 2003", "version": "3.0"},
- // {"browserName": "firefox", "platform": "Windows 2003", "version": "3.5"},
- {"browserName": "firefox", "platform": "Windows 2003", "version": "3.6"},
- {"browserName": "firefox", "platform": "Windows 2003", "version": "4"},
- {"browserName": "firefox", "platform": "Windows 2003", "version": "19"},
- {"browserName": "safari", "platform": "Mac 10.6", "version": "5"},
- {"browserName": "safari", "platform": "Mac 10.8", "version": "6"},
- {"browserName": "googlechrome", "platform": "Windows 2003"},
- {"browserName": "opera", "platform": "Windows 2003", "version": "12"},
- {"browserName": "iehta", "platform": "Windows 2003", "version": "6"},
- {"browserName": "iehta", "platform": "Windows 2003", "version": "7"},
- {"browserName": "iehta", "platform": "Windows 2008", "version": "8"},
- ],
- concurrency: 3,
- detailedError: true,
- testTimeout:10000,
- testInterval:1000,
- testReadyTimeout:2000,
- testname: 'loglevel jasmine test',
- tags: [process.env.TRAVIS_REPO_SLUG || "local", process.env.TRAVIS_COMMIT || "manual"]
- }
- },
- jshint: {
- options: {
- jshintrc: '.jshintrc'
- },
- gruntfile: {
- src: 'Gruntfile.js'
- },
- lib: {
- options: {
- jshintrc: 'lib/.jshintrc'
- },
- src: ['lib/**/*.js']
- },
- test: {
- options: {
- jshintrc: 'test/.jshintrc'
- },
- src: ['test/*.js']
- },
- },
- watch: {
- gruntfile: {
- files: '<%= jshint.gruntfile.src %>',
- tasks: ['jshint:gruntfile']
- },
- lib: {
- files: '<%= jshint.lib.src %>',
- tasks: ['jshint:lib', 'jasmine']
- },
- test: {
- files: '<%= jshint.test.src %>',
- tasks: ['jshint:test', 'jasmine']
- },
- },
- });
-
- // These plugins provide necessary tasks.
- grunt.loadNpmTasks('grunt-contrib-concat');
- grunt.loadNpmTasks('grunt-contrib-uglify');
- grunt.loadNpmTasks('grunt-contrib-jasmine');
- grunt.loadNpmTasks('grunt-contrib-jshint');
- grunt.loadNpmTasks('grunt-contrib-watch');
-
- grunt.loadNpmTasks('grunt-contrib-connect');
- grunt.loadNpmTasks('grunt-open');
- grunt.loadNpmTasks('grunt-saucelabs');
-
- // Default task.
- grunt.registerTask('default', ['jshint', 'jasmine', 'concat', 'uglify']);
-
- // Just tests
- grunt.registerTask('test', ['jshint', 'jasmine']);
-
- // Test with a live server and an actual browser
- grunt.registerTask('integration-test', ['jasmine:src:build', 'connect:test:keepalive', 'open:jasmine']);
-
- // Test with lots of browsers on saucelabs
- grunt.registerTask('saucelabs', ['jasmine:src:build', 'connect:test', 'saucelabs-jasmine']);
-
-};
diff --git a/temp/loglevel/0.1.0/package/LICENSE-MIT b/temp/loglevel/0.1.0/package/LICENSE-MIT
deleted file mode 100644
index d384208be..000000000
--- a/temp/loglevel/0.1.0/package/LICENSE-MIT
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2013 Tim Perry
-
-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.
diff --git a/temp/loglevel/0.1.0/package/README.md b/temp/loglevel/0.1.0/package/README.md
deleted file mode 100644
index 8c6de08cc..000000000
--- a/temp/loglevel/0.1.0/package/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# loglevel [](https://travis-ci.org/pimterry/loglevel)
-
-=========================================================
-
-Minimal lightweight simple logging for JavaScript. loglevel replaces console.log() and friends with level-based logging and filtering, with none of console's downsides.
-
-This is a barebones reliable everyday logging library. It does not do fancy things, it does not let you reconfigure appenders or add complex log filtering rules or boil tea (more's the pity), but it does have the all core functionality that you actually use:
-
-## Features
-
-### Simple
-
-* Log things at a given level (trace/debug/info/warn/error) to the console object (as seen in all modern browers & node.js)
-* Filter logging by level (all the above or 'silent'), so you can disable all but error logging in production, and then run log.setLevel("trace") in your console to turn it all back on for a furious debugging session
-
-### Effective
-
-* Log methods gracefully fall back to simpler console logging methods if more specific ones aren't available: so calls to log.debug() go to console.debug() if possible, or console.log() if not
-* Logging calls still succeed even if there's no console object at all, so your site doesn't break when people visit with old browsers that don't support the console object (here's looking at you IE) and similar
-* This then comes together giving a consistent reliable API that works in every JavaScript environment with a console available, and doesn't break anything anywhere else (er, *not quite true yet*: see #5)
-
-### Convenient
-
-* Log output keeps line numbers: most JS logging frameworks call console.log methods through wrapper functions, clobbering your stacktrace and making the extra info many browsers provide useless. We'll have none of that thanks.
-* It works with all the standard JavaScript loading systems out of the box (CommonJS, AMD, or just as a global)
-* Logging is filtered to silent by default, to keep your live site clean (or you can trivially re-enable it with an initial log.enableAll() call)
-
-## Downloading loglevel
-
-If you're using node, you can run `npm install loglevel`. (n.b. not yet, see #6)
-
-Alternatively if you want to grab the file directly, you can download either the [production version][min] or the [development version][max] directly.
-
-[min]: https://raw.github.com/pimterry/loglevel/master/dist/loglevel.min.js
-[max]: https://raw.github.com/pimterry/loglevel/master/dist/loglevel.js
-
-## Setting it up
-
-loglevel supports AMD (e.g. RequireJS), CommonJS (e.g. Node.js) and direct usage (e.g. loading globally with a <script> tag) loading methods. You should be able to do nearly anything, and then skip to the next section anyway and have it work. Just in case though, here's some specific examples that definitely do the right thing:
-
-### CommonsJS (e.g. Node)
-
-```javascript
-var log = require('loglevel');
-log.info("unreasonably simple");
-```
-
-### AMD (e.g. RequireJS)
-
-```javascript
-define(['loglevel'], function(log) {
- log.warn("dangerously convenient");
-});
-```
-
-### Directly in your web page:
-
-```html
-
-
-```
-
-## Documentation
-_(Coming soon, see #4)_
-
-## Contributing
-In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Builds can be run with grunt, just run 'grunt' in the root directory of the project.
-
-_Also, please don't edit files in the "dist" subdirectory as they are generated via Grunt. You'll find source code in the "lib" subdirectory!_
-
-## Release History
-_No official release yet, this is en route extremely soon though (i.e. this week)_
-
-## License
-Copyright (c) 2013 Tim Perry
-Licensed under the MIT license.
diff --git a/temp/loglevel/0.1.0/package/lib/.jshintrc b/temp/loglevel/0.1.0/package/lib/.jshintrc
deleted file mode 100644
index e4462b279..000000000
--- a/temp/loglevel/0.1.0/package/lib/.jshintrc
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": true,
- "boss": true,
- "eqnull": true,
- "predef": [
- "console",
- "exports",
- "define",
- "module"
- ]
-}
diff --git a/temp/loglevel/0.1.0/package/lib/loglevel.js b/temp/loglevel/0.1.0/package/lib/loglevel.js
deleted file mode 100644
index 47e8ed8fb..000000000
--- a/temp/loglevel/0.1.0/package/lib/loglevel.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * loglevel - https://github.com/pimterry/loglevel
- *
- * Copyright (c) 2013 Tim Perry
- * Licensed under the MIT license.
- */
-
-(function (name, definition) {
- if (typeof module !== 'undefined') {
- module.exports = definition();
- } else if (typeof define === 'function' && typeof define.amd === 'object') {
- define(definition);
- } else {
- this.name = definition();
- }
-}('log', function () {
- var self = {},
- noop = function() { };
-
- self.levels = { "TRACE": 1, "DEBUG": 2, "INFO": 3, "WARN": 4,
- "ERROR": 5, "SILENT": 6};
-
- function realMethod(methodName) {
- if (typeof console === "undefined") {
- return noop;
- } else if (typeof console[methodName] === "undefined") {
- return console.log || noop;
- } else {
- return boundToConsole(console, methodName);
- }
- }
-
- function boundToConsole(console, methodName) {
- var method = console[methodName];
- if (typeof method.bind === "undefined") {
- if (typeof Function.prototype.bind === "undefined") {
- return function() {
- method.apply(console, arguments);
- };
- } else {
- return Function.prototype.bind.call(console[methodName], console);
- }
- } else {
- return console[methodName].bind(console);
- }
- }
-
- var logMethods = [
- "trace",
- "debug",
- "info",
- "warn",
- "error"
- ];
-
- function clearMethods() {
- for (var ii = 0; ii < logMethods.length; ii++) {
- self[logMethods[ii]] = noop;
- }
- }
-
- self.setLevel = function (level) {
- if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
- if (level === self.levels.SILENT) {
- clearMethods();
- return;
- } else if (typeof console === "undefined") {
- clearMethods();
- throw "No console available for logging";
- } else {
- for (var ii = 0; ii < logMethods.length; ii++) {
- var methodName = logMethods[ii];
-
- if (level <= self.levels[methodName.toUpperCase()]) {
- self[methodName] = realMethod(methodName);
- } else {
- self[methodName] = noop;
- }
- }
- }
- } else if (typeof level === "string") {
- self.setLevel(self.levels[level.toUpperCase()]);
- } else {
- throw "log.setLevel called with invalid level: " + level;
- }
- };
-
- self.enableAll = function() {
- self.setLevel(self.levels.TRACE);
- };
-
- self.disableAll = function() {
- self.setLevel(self.levels.SILENT);
- };
-
- self.disableAll();
- return self;
-}));
\ No newline at end of file
diff --git a/temp/loglevel/0.1.0/package/package.json b/temp/loglevel/0.1.0/package/package.json
deleted file mode 100644
index e4d1a0bf2..000000000
--- a/temp/loglevel/0.1.0/package/package.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "name": "loglevel",
- "description": "Minimal lightweight logging for JavaScript, adding reliable log level methods to any available console.log methods",
- "version": "0.1.0",
- "homepage": "https://github.com/pimterry/loglevel",
- "author": {
- "name": "Tim Perry",
- "email": "pimterry@gmail.com",
- "url": "http://tim-perry.co.uk"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/pimterry/loglevel.git"
- },
- "bugs": {
- "url": "https://github.com/pimterry/loglevel/issues"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "https://github.com/pimterry/loglevel/blob/master/LICENSE-MIT"
- }
- ],
- "main": "lib/loglevel",
- "engines": {
- "node": ">= 0.6.0"
- },
- "scripts": {
- "test": "grunt test"
- },
- "dependencies": {
- },
- "devDependencies": {
- "grunt": "~0.4.1",
- "grunt-cli": "~0.1.6",
- "grunt-contrib-concat": "~0.1.2",
- "grunt-contrib-uglify": "~0.1.1",
- "grunt-contrib-jshint": "~0.1.1",
- "grunt-contrib-watch": "~0.2.0",
- "grunt-contrib-jasmine": "~0.4.1",
- "grunt-template-jasmine-requirejs": "~0.1.0",
- "grunt-open": "~0.2.0",
- "grunt-contrib-connect": "~0.2.0",
- "grunt-saucelabs": "~3.0.7"
- },
- "keywords": []
-}
diff --git a/temp/loglevel/0.1.0/package/test/.jshintrc b/temp/loglevel/0.1.0/package/test/.jshintrc
deleted file mode 100644
index 401ffde0b..000000000
--- a/temp/loglevel/0.1.0/package/test/.jshintrc
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "curly": true,
- "globalstrict": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": true,
- "boss": true,
- "eqnull": true,
- "predef": [
- "define",
- "window",
- "require",
- "log",
- "console",
- "exports",
- "_",
- "afterEach",
- "beforeEach",
- "confirm",
- "context",
- "describe",
- "xdescribe",
- "expect",
- "it",
- "jasmine"
- ]
-}
\ No newline at end of file
diff --git a/temp/loglevel/0.1.0/package/test/basic-usage-test.js b/temp/loglevel/0.1.0/package/test/basic-usage-test.js
deleted file mode 100644
index 331350fa0..000000000
--- a/temp/loglevel/0.1.0/package/test/basic-usage-test.js
+++ /dev/null
@@ -1,43 +0,0 @@
-"use strict";
-
-define(['../lib/loglevel'], function(log) {
- describe("Integration smoke tests", function() {
- var describeIfConsoleAvailable =
- typeof console !== "undefined" ? describe : xdescribe;
-
- describeIfConsoleAvailable("log methods", function() {
- it("can all be called", function() {
- if (typeof console !== "undefined") {
- log.setLevel(log.levels.TRACE);
- }
-
- log.trace("trace");
- log.debug("debug");
- log.info("info");
- log.warn("warn");
- log.error("error");
- });
- });
-
- describe("log methods", function() {
- it("can all be disabled", function() {
- log.setLevel(log.levels.SILENT);
- log.trace("trace");
- log.debug("debug");
- log.info("info");
- log.warn("warn");
- log.error("error");
- });
- });
-
- describeIfConsoleAvailable("log levels", function() {
- it("are all settable", function() {
- log.setLevel(log.levels.TRACE);
- log.setLevel(log.levels.DEBUG);
- log.setLevel(log.levels.INFO);
- log.setLevel(log.levels.WARN);
- log.setLevel(log.levels.ERROR);
- });
- });
- });
-});
diff --git a/temp/loglevel/0.1.0/package/test/console-fallback-test.js b/temp/loglevel/0.1.0/package/test/console-fallback-test.js
deleted file mode 100644
index 2f94287a8..000000000
--- a/temp/loglevel/0.1.0/package/test/console-fallback-test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-
-function consoleLogIsCalledBy(log, methodName) {
- it(methodName + " calls console.log", function() {
- log.setLevel(log.levels.TRACE);
- log[methodName]("Log message for call to " + methodName);
- expect(console.log.calls.length).toEqual(1);
- });
-}
-
-define(['../lib/loglevel'], function(log) {
- var originalConsole = window.console;
-
- describe("LogLevel fallback functionality", function() {
- describe("with no console present", function() {
- beforeEach(function() {
- window.console = undefined;
- });
-
- afterEach(function() {
- window.console = originalConsole;
- });
-
- it("silent method calls are allowed", function() {
- log.setLevel(log.levels.SILENT);
- log.trace("hello");
- });
-
- it("setting an active level fails", function() {
- expect(function() {
- log.setLevel(log.levels.TRACE);
- }).toThrow("No console available for logging");
- });
-
- it("setting to silent level is fine", function() {
- log.setLevel(log.levels.SILENT);
- });
-
- it("active method calls are allowed, once the active setLevel fails", function() {
- try {
- log.setLevel(log.levels.TRACE);
- } catch (e) { }
- log.trace("hello");
- });
- });
-
- describe("with a console that only supports console.log", function() {
- beforeEach(function() {
- window.console = {"log" : jasmine.createSpy("console.log")};
- });
-
- afterEach(function() {
- window.console = originalConsole;
- });
-
- it("log can be set to silent", function() {
- log.setLevel(log.levels.SILENT);
- });
-
- it("log can be set to an active level", function() {
- log.setLevel(log.levels.ERROR);
- });
-
- consoleLogIsCalledBy(log, "trace");
- consoleLogIsCalledBy(log, "debug");
- consoleLogIsCalledBy(log, "info");
- consoleLogIsCalledBy(log, "warn");
- consoleLogIsCalledBy(log, "trace");
- });
- });
-});
-
diff --git a/temp/loglevel/0.1.0/package/test/level-setting-test.js b/temp/loglevel/0.1.0/package/test/level-setting-test.js
deleted file mode 100644
index 76dbb423b..000000000
--- a/temp/loglevel/0.1.0/package/test/level-setting-test.js
+++ /dev/null
@@ -1,240 +0,0 @@
-"use strict";
-
-var logMethods = [
- "trace",
- "debug",
- "info",
- "warn",
- "error"
-];
-
-define(['../lib/loglevel'], function(log) {
- var originalConsole = window.console;
-
- describe("Log levels", function() {
- beforeEach(function() {
- window.console = {};
-
- for (var ii = 0; ii < logMethods.length; ii++) {
- window.console[logMethods[ii]] = jasmine.createSpy(logMethods[ii]);
- }
- });
-
- afterEach(function() {
- window.console = originalConsole;
- });
-
- describe("initial log level", function() {
- it("disables all log methods", function() {
- for (var ii = 0; ii < logMethods.length; ii++) {
- var method = logMethods[ii];
- log[method]("a log message");
-
- expect(console[method]).not.toHaveBeenCalled();
- }
- });
- });
-
- describe("log.enableAll()", function() {
- it("enables all log methods", function() {
- log.enableAll();
-
- for (var ii = 0; ii < logMethods.length; ii++) {
- var method = logMethods[ii];
- log[method]("a log message");
-
- expect(console[method]).toHaveBeenCalled();
- }
- });
- });
-
- describe("invalid setLevel inputs", function() {
- it("error thrown if no level is given", function() {
- expect(function() {
- log.setLevel();
- }).toThrow();
- });
-
- it("error thrown if null level is given", function() {
- expect(function() {
- log.setLevel(null);
- }).toThrow();
- });
-
- it("error thrown if undefined level is given", function() {
- expect(function() {
- log.setLevel(undefined);
- }).toThrow();
- });
-
- it("error thrown if invalid level number is given", function() {
- expect(function() {
- log.setLevel(-1);
- }).toThrow();
- });
-
- it("error thrown if invalid level name is given", function() {
- expect(function() {
- log.setLevel("InvalidLevelName");
- }).toThrow();
- });
- });
-
- describe("setting log level by name", function() {
- function itCanSetLogLevelTo(level) {
- it("can set log level to " + level, function() {
- log.disableAll();
- log.setLevel(level);
-
- log[level]("log message");
- expect(console[level]).toHaveBeenCalled();
- });
- }
-
- itCanSetLogLevelTo("trace");
- itCanSetLogLevelTo("debug");
- itCanSetLogLevelTo("info");
- itCanSetLogLevelTo("warn");
- itCanSetLogLevelTo("error");
- });
-
- describe("log level settings", function() {
- describe("log.trace", function() {
- it("is enabled at trace level", function() {
- log.setLevel(log.levels.TRACE);
-
- log.trace("a log message");
- expect(console.trace).toHaveBeenCalled();
- });
-
- it("is disabled at debug level", function() {
- log.setLevel(log.levels.DEBUG);
-
- log.trace("a log message");
- expect(console.trace).not.toHaveBeenCalled();
- });
-
- it("is disabled at silent level", function() {
- log.setLevel(log.levels.SILENT);
-
- log.trace("a log message");
- expect(console.trace).not.toHaveBeenCalled();
- });
- });
-
- describe("log.debug", function() {
- it("is enabled at trace level", function() {
- log.setLevel(log.levels.TRACE);
-
- log.debug("a log message");
- expect(console.debug).toHaveBeenCalled();
- });
-
- it("is enabled at debug level", function() {
- log.setLevel(log.levels.DEBUG);
-
- log.debug("a log message");
- expect(console.debug).toHaveBeenCalled();
- });
-
- it("is disabled at info level", function() {
- log.setLevel(log.levels.INFO);
-
- log.debug("a log message");
- expect(console.debug).not.toHaveBeenCalled();
- });
-
- it("is disabled at silent level", function() {
- log.setLevel(log.levels.SILENT);
-
- log.debug("a log message");
- expect(console.debug).not.toHaveBeenCalled();
- });
- });
-
- describe("log.info", function() {
- it("is enabled at debug level", function() {
- log.setLevel(log.levels.DEBUG);
-
- log.info("a log message");
- expect(console.info).toHaveBeenCalled();
- });
-
- it("is enabled at info level", function() {
- log.setLevel(log.levels.INFO);
-
- log.info("a log message");
- expect(console.info).toHaveBeenCalled();
- });
-
- it("is disabled at warn level", function() {
- log.setLevel(log.levels.WARN);
-
- log.info("a log message");
- expect(console.info).not.toHaveBeenCalled();
- });
-
- it("is disabled at silent level", function() {
- log.setLevel(log.levels.SILENT);
-
- log.info("a log message");
- expect(console.info).not.toHaveBeenCalled();
- });
- });
-
- describe("log.warn", function() {
- it("is enabled at info level", function() {
- log.setLevel(log.levels.INFO);
-
- log.warn("a log message");
- expect(console.warn).toHaveBeenCalled();
- });
-
- it("is enabled at warn level", function() {
- log.setLevel(log.levels.WARN);
-
- log.warn("a log message");
- expect(console.warn).toHaveBeenCalled();
- });
-
- it("is disabled at error level", function() {
- log.setLevel(log.levels.ERROR);
-
- log.warn("a log message");
- expect(console.warn).not.toHaveBeenCalled();
- });
-
- it("is disabled at silent level", function() {
- log.setLevel(log.levels.SILENT);
-
- log.warn("a log message");
- expect(console.warn).not.toHaveBeenCalled();
- });
- });
-
- describe("log.error", function() {
- it("is enabled at warn level", function() {
- log.setLevel(log.levels.WARN);
-
- log.error("a log message");
- expect(console.error).toHaveBeenCalled();
- });
-
- it("is enabled at error level", function() {
- log.setLevel(log.levels.ERROR);
-
- log.error("a log message");
- expect(console.error).toHaveBeenCalled();
- });
-
- it("is disabled at silent level", function() {
- log.setLevel(log.levels.SILENT);
-
- log.error("a log message");
- expect(console.error).not.toHaveBeenCalled();
- });
- });
- });
- });
-});
-
diff --git a/temp/loglevel/0.1.0/package/test/vendor/json2.js b/temp/loglevel/0.1.0/package/test/vendor/json2.js
deleted file mode 100644
index f7eb6463d..000000000
--- a/temp/loglevel/0.1.0/package/test/vendor/json2.js
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- json2.js
- 2012-10-08
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, regexp: true */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (typeof JSON !== 'object') {
- JSON = {};
-}
-
-(function () {
- 'use strict';
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf())
- ? this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z'
- : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string'
- ? c
- : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0
- ? '[]'
- : gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- if (typeof rep[i] === 'string') {
- k = rep[i];
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0
- ? '{}'
- : gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function'
- ? walk({'': j}, '')
- : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
diff --git a/temp/numeral.js/1.0.1/dist.tar.gz b/temp/numeral.js/1.0.1/dist.tar.gz
deleted file mode 100644
index ab0fe018a..000000000
Binary files a/temp/numeral.js/1.0.1/dist.tar.gz and /dev/null differ
diff --git a/temp/numeral.js/1.0.1/package/LICENSE b/temp/numeral.js/1.0.1/package/LICENSE
deleted file mode 100644
index 145e65bcd..000000000
--- a/temp/numeral.js/1.0.1/package/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.1/package/README.md b/temp/numeral.js/1.0.1/package/README.md
deleted file mode 100644
index 40d80977b..000000000
--- a/temp/numeral.js/1.0.1/package/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-[Numeral.js](http://adamwdraper.github.com/Numeral-js/)
-=======================================================
-
-A javascript library for formatting and manipulating numbers.
-
-[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
-
-
-Changelog
-=========
-
-### 1.0.1
-
-Added abbreviations for thousands and millions using 'a' in the format
-
-### 1.0.0
-
-Initial release
-
-
-Acknowlegements
-===============
-
-Numeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)
-
-
-License
-=======
-
-Numeral.js is freely distributable under the terms of the MIT license.
-
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.1/package/examples/example.html b/temp/numeral.js/1.0.1/package/examples/example.html
deleted file mode 100644
index ab681107a..000000000
--- a/temp/numeral.js/1.0.1/package/examples/example.html
+++ /dev/null
@@ -1,247 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Numeral.js
-
A javascript library for formatting and manipulating numbers.
-
Initialize
-
-<script src="numeral-min.js"></script>
-var number = numeral(1000);
-
-
Format
-
- Numbers can be formatted to look like money, percentages, times, or even plain old numbers with decimal places, comma delineated thousands, and abbreviations.
-
-var number = numeral(1000);
-
-var string = number.format('0,000');
-// 1,000
-
-var value = number.value();
-// 1000
-
-
Set
-
- Set the value of your numeral object.
-
-
-var number = numeral();
-
-number.set(1000);
-
-var value = number.value();
-// 1000
-
-
Acknowlegements
-
- Numeral.js, while less complex, was inspired by and heavily borrowed from Moment.js
-
-
-
-
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.1/package/min/numeral-min.js b/temp/numeral.js/1.0.1/package/min/numeral-min.js
deleted file mode 100644
index 63d098d4c..000000000
--- a/temp/numeral.js/1.0.1/package/min/numeral-min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// numeral.js
-// version : 1.0.1
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-(function(){function s(e){this._n=e}function o(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function u(e,t){var n;return t.indexOf("$")>-1?n=f(e,t):t.indexOf("%")>-1?n=l(e,t):t.indexOf(":")>-1?n=c(e,t):n=p(e,t),n}function a(e,t){return t.indexOf(":")>-1?e._n=h(t):e._n=(t.indexOf("k")>-1?1e3:1)*(t.indexOf("m")>-1?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/\$|,|%|k|m|\(|\)*/ig,"")),e._n}function f(e,t){t=t.replace("$","");var n=u(e,t);return n.indexOf("(")>-1||n.indexOf("-")>-1?(n=n.split(""),n.splice(1,0,"$"),n=n.join("")):n="$"+n,n}function l(e,t){t=t.replace("%",""),e._n=e._n*100;var n=u(e,t);return n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,"%"),n=n.join("")):n+="%",n}function c(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function h(e){var t=e.split(":"),n=0;return t.length===3?(n+=Number(t[0])*60*60,n+=Number(t[1])*60,n+=Number(t[2])):t.lenght===2&&(n+=Number(t[0])*60,n+=Number(t[1])),Number(n)}function p(e,t){var n=!1,r=!1;t.indexOf("(")>-1&&(n=!0,t=t.slice(1,-1)),t.indexOf("a")>-1&&(t=t.replace("a",""),e._n>1e6?(r="m",e._n=e._n/1e6):(r="k",e._n=e._n/1e3));var i=e._n.toString().split(".")[0],s=t.split(".")[1],u=t.indexOf(","),a="",f=!1;return e._n<0&&(i=i.slice(1),f=!0),u>-1&&(i=i.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")),t.indexOf(".")===0&&(i=""),s&&(a="."+o(e._n,s.length).split(".")[1]),r,(n?"(":"")+(!n&&f?"-":"")+i+a+(r?r:"")+(n?")":"")}var e,t="1.0.0",n=Math.round,r,i=typeof module!="undefined"&&module.exports;e=function(e){return Number(e)||(e=0),new s(Number(e))},e.version=t,e.isNumeral=function(e){return e instanceof s},e.fn=s.prototype={clone:function(){return e(this)},format:function(t){return u(this,t?t:e.defaultFormat)},unformat:function(t){return a(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){return this._n=Number(e),this},add:function(e){return this._n=this._n+Number(e),this},subtract:function(e){return this._n=this._n-Number(e),this},multiply:function(e){return this._n=this._n*Number(e),this},divide:function(e){return this._n=this._n/Number(e),this},difference:function(e){return this._n-Number(e)}},i&&(module.exports=e),typeof ender=="undefined"&&(this.numeral=e),typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.1/package/numeral.js b/temp/numeral.js/1.0.1/package/numeral.js
deleted file mode 100644
index 8fe80ae8c..000000000
--- a/temp/numeral.js/1.0.1/package/numeral.js
+++ /dev/null
@@ -1,284 +0,0 @@
-
-// numeral.js
-// version : 1.0.1
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-
-(function () {
-
- /************************************
- Constants
- ************************************/
-
- var numeral,
- VERSION = '1.0.0',
- round = Math.round, i,
-
- // check for nodeJS
- hasModule = (typeof module !== 'undefined' && module.exports);
-
-
- /************************************
- Constructors
- ************************************/
-
-
- // Numeral prototype object
- function Numeral(number) {
- this._n = number;
- }
-
- /**
- * Implementation of toFixed() that treats floats more like decimals
- *
- * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
- * problems for accounting- and finance-related software.
- */
- function toFixed (value, precision) {
- var power = Math.pow(10, precision);
-
- // Multiply up by precision, round accurately, then divide and use native toFixed():
- return (Math.round(value * power) / power).toFixed(precision);
- }
-
- /************************************
- Formatting
- ************************************/
-
- // determine what type of formatting we need to do
- function formatNumeral (n, format) {
- var output;
-
- // figure out what kind of format we are dealing with
- if (format.indexOf('$') > -1) { // money!!!!!
- output = formatMoney(n, format);
- } else if (format.indexOf('%') > -1) { // percentage
- output = formatPercentage(n, format);
- } else if (format.indexOf(':') > -1) { // time
- output = formatTime(n, format);
- } else { // plain ol' number
- output = formatNumber(n, format);
- }
-
- // return string
- return output;
- }
-
- // revert to number
- function unformatNumeral (n, string) {
- if (string.indexOf(':') > -1) {
- n._n = unformatTime(string);
- } else {
- n._n = ((string.indexOf('k') > -1) ? 1000 : 1) * ((string.indexOf('m') > -1) ? 1000000 : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/\$|,|%|k|m|\(|\)*/ig, ''));
- }
- return n._n;
- }
-
- function formatMoney (n, format) {
- format = format.replace('$', '');
- var output = formatNumeral(n, format);
- if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
- output = output.split('');
- output.splice(1, 0, '$');
- output = output.join('');
- } else {
- output = '$' + output;
- }
- return output;
- }
-
- function formatPercentage (n, format) {
- format = format.replace('%', '');
- n._n = n._n * 100;
- var output = formatNumeral(n, format);
- if (output.indexOf(')') > -1 ) {
- output = output.split('');
- output.splice(-1, 0, '%');
- output = output.join('');
- } else {
- output = output + '%';
- }
- return output;
- }
-
- function formatTime (n, format) {
- var hours = Math.floor(n._n/60/60),
- minutes = Math.floor((n._n - (hours * 60 * 60))/60),
- seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
- return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
- }
-
- function unformatTime (string) {
- var timeArray = string.split(':'),
- seconds = 0;
- // turn hours and minutes into seconds and add them all up
- if (timeArray.length === 3) {
- // hours
- seconds = seconds + (Number(timeArray[0]) * 60 * 60);
- // minutes
- seconds = seconds + (Number(timeArray[1]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[2]);
- } else if (timeArray.lenght === 2) {
- // minutes
- seconds = seconds + (Number(timeArray[0]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[1]);
- }
- return Number(seconds);
- }
-
- function formatNumber (n, format) {
- var negP = false,
- abbr = false;
-
- // see if we should use parentheses for negative number
- if (format.indexOf('(') > -1) {
- negP = true;
- format = format.slice(1, -1);
- }
-
- // see if abbreviation is wanted
- if (format.indexOf('a') > -1) {
- format = format.replace('a', '');
-
- if (n._n > 1000000) {
- abbr = 'm';
- n._n = n._n / 1000000;
- } else {
- abbr = 'k';
- n._n = n._n / 1000;
- }
- }
-
- var w = n._n.toString().split('.')[0],
- precision = format.split('.')[1],
- thousands = format.indexOf(','),
- d = '',
- neg = false;
-
- // format number
- if (n._n < 0) {
- w = w.slice(1);
- neg = true;
- }
-
- if (thousands > -1) {
- w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
- }
-
- if (format.indexOf('.') === 0) {
- w = '';
- }
-
- if (precision) {
- // do to fixed
- d = '.' + toFixed(n._n, precision.length).split('.')[1];
- }
-
- if (abbr) {
-
- }
-
- return ((negP) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((abbr) ? abbr : '') + ((negP) ? ')' : '');
- }
-
- /************************************
- Top Level Functions
- ************************************/
-
- numeral = function (input) {
- if (!Number(input)) {
- input = 0;
- }
- return new Numeral(Number(input));
- };
-
- // version number
- numeral.version = VERSION;
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- return obj instanceof Numeral;
- };
-
-
- /************************************
- Numeral Prototype
- ************************************/
-
-
- numeral.fn = Numeral.prototype = {
-
- clone : function () {
- return numeral(this);
- },
-
- format : function (inputString) {
- return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- unformat : function (inputString) {
- return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- value : function () {
- return this._n;
- },
-
- set : function (value) {
- this._n = Number(value);
- return this;
- },
-
- add : function (value) {
- this._n = this._n + Number(value);
- return this;
- },
-
- subtract : function (value) {
- this._n = this._n - Number(value);
- return this;
- },
-
- multiply : function (value) {
- this._n = this._n * Number(value);
- return this;
- },
-
- divide : function (value) {
- this._n = this._n / Number(value);
- return this;
- },
-
- difference : function (value) {
- return this._n - Number(value);
- }
-
- };
-
- /************************************
- Exposing Numeral
- ************************************/
-
- // Commenting out common js and global variable
- // // CommonJS module is defined
- if (hasModule) {
- module.exports = numeral;
- }
- /*global ender:false */
- if (typeof ender === 'undefined') {
- // here, `this` means `window` in the browser, or `global` on the server
- // add `numeral` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode
- this['numeral'] = numeral;
- }
-
- /*global define:false */
- if (typeof define === 'function' && define.amd) {
- define([], function () {
- return numeral;
- });
- }
-}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.1/package/package.json b/temp/numeral.js/1.0.1/package/package.json
deleted file mode 100644
index 34937a81a..000000000
--- a/temp/numeral.js/1.0.1/package/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "numeral",
- "version": "1.0.1",
- "description": "Formatand manipulate numbers.",
- "homepage": "http://adamwdraper.github.com/Numeral-js/",
- "author": {
- "name": "Adam Draper",
- "email": "adamwdraper@gmail.com",
- "url": "http://github.com/adamwdraper"
- },
- "keywords": [
- "numeral",
- "number",
- "time",
- "money",
- "percentage",
- "validate"
- ],
- "main": "./numeral.js",
- "engines": {
- "node": "*"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/adamwdraper/Numeral-js"
- },
- "bugs": {
- "url": "https://github.com/adamwdraper/Numeral-js/issues"
- },
- "licenses": [
- {
- "type": "MIT"
- }
- ],
- "devDependencies": {},
- "ender": "./ender.js",
- "readme": "[Numeral.js](http://adamwdraper.github.com/Numeral-js/)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission 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:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE 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.",
- "_id": "numeral@1.0.1",
- "_from": "numeral"
-}
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/dist.tar.gz b/temp/numeral.js/1.0.2/dist.tar.gz
deleted file mode 100644
index f8d3f97aa..000000000
Binary files a/temp/numeral.js/1.0.2/dist.tar.gz and /dev/null differ
diff --git a/temp/numeral.js/1.0.2/package/LICENSE b/temp/numeral.js/1.0.2/package/LICENSE
deleted file mode 100644
index 145e65bcd..000000000
--- a/temp/numeral.js/1.0.2/package/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/package/README.md b/temp/numeral.js/1.0.2/package/README.md
deleted file mode 100644
index 2bef4b8e1..000000000
--- a/temp/numeral.js/1.0.2/package/README.md
+++ /dev/null
@@ -1,44 +0,0 @@
-[Numeral.js](http://adamwdraper.github.com/Numeral-js/)
-=======================================================
-
-A javascript library for formatting and manipulating numbers.
-
-[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
-
-
-Changelog
-=========
-
-### 1.0.2
-
-Add clone functionality
-
-### 1.0.1
-
-Added abbreviations for thousands and millions using 'a' in the format
-
-### 1.0.0
-
-Initial release
-
-
-Acknowlegements
-===============
-
-Numeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)
-
-
-License
-=======
-
-Numeral.js is freely distributable under the terms of the MIT license.
-
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/package/examples/example.html b/temp/numeral.js/1.0.2/package/examples/example.html
deleted file mode 100644
index a63cb7931..000000000
--- a/temp/numeral.js/1.0.2/package/examples/example.html
+++ /dev/null
@@ -1,288 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Numeral.js
-
A javascript library for formatting and manipulating numbers.
-
Use it
-
In the Browser
-
-<script src="numeral-min.js"></script>
-
-
In Node.js
-
-npm install numeral
-
-
-var numeral = require('numeral');
-
-
-
Format
-
- Numbers can be formatted to look like money, percentages, times, or even plain old numbers with decimal places, comma delineated thousands, and abbreviations.
-
- Numeral.js, while less complex, was inspired by and heavily borrowed from Moment.js
-
-
-
-
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/package/min/numeral-min.js b/temp/numeral.js/1.0.2/package/min/numeral-min.js
deleted file mode 100644
index fcfeb0a9a..000000000
--- a/temp/numeral.js/1.0.2/package/min/numeral-min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// numeral.js
-// version : 1.0.2
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-(function(){function s(e){this._n=e}function o(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function u(e,t){var n;return t.indexOf("$")>-1?n=f(e,t):t.indexOf("%")>-1?n=l(e,t):t.indexOf(":")>-1?n=c(e,t):n=p(e,t),n}function a(e,t){return t.indexOf(":")>-1?e._n=h(t):e._n=(t.indexOf("k")>-1?1e3:1)*(t.indexOf("m")>-1?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/\$|,|%|k|m|\(|\)*/ig,"")),e._n}function f(e,t){t=t.replace("$","");var n=u(e,t);return n.indexOf("(")>-1||n.indexOf("-")>-1?(n=n.split(""),n.splice(1,0,"$"),n=n.join("")):n="$"+n,n}function l(e,t){t=t.replace("%",""),e._n=e._n*100;var n=u(e,t);return n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,"%"),n=n.join("")):n+="%",n}function c(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function h(e){var t=e.split(":"),n=0;return t.length===3?(n+=Number(t[0])*60*60,n+=Number(t[1])*60,n+=Number(t[2])):t.lenght===2&&(n+=Number(t[0])*60,n+=Number(t[1])),Number(n)}function p(e,t){var n=!1,r=!1;t.indexOf("(")>-1&&(n=!0,t=t.slice(1,-1)),t.indexOf("a")>-1&&(t=t.replace("a",""),e._n>1e6?(r="m",e._n=e._n/1e6):(r="k",e._n=e._n/1e3));var i=e._n.toString().split(".")[0],s=t.split(".")[1],u=t.indexOf(","),a="",f=!1;return e._n<0&&(i=i.slice(1),f=!0),u>-1&&(i=i.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")),t.indexOf(".")===0&&(i=""),s&&(a="."+o(e._n,s.length).split(".")[1]),r,(n?"(":"")+(!n&&f?"-":"")+i+a+(r?r:"")+(n?")":"")}var e,t="1.0.2",n=Math.round,r,i=typeof module!="undefined"&&module.exports;e=function(t){return e.isNumeral(t)?t=t.value():Number(t)||(t=0),new s(Number(t))},e.isNumeral=function(e){return console.log(e),e instanceof s},e.version=t,e.isNumeral=function(e){return e instanceof s},e.fn=s.prototype={clone:function(){return e(this)},format:function(t){return u(this,t?t:e.defaultFormat)},unformat:function(t){return a(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){return this._n=Number(e),this},add:function(e){return this._n=this._n+Number(e),this},subtract:function(e){return this._n=this._n-Number(e),this},multiply:function(e){return this._n=this._n*Number(e),this},divide:function(e){return this._n=this._n/Number(e),this},difference:function(e){return this._n-Number(e)}},i&&(module.exports=e),typeof ender=="undefined"&&(this.numeral=e),typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/package/numeral.js b/temp/numeral.js/1.0.2/package/numeral.js
deleted file mode 100644
index c0c5f5598..000000000
--- a/temp/numeral.js/1.0.2/package/numeral.js
+++ /dev/null
@@ -1,293 +0,0 @@
-
-// numeral.js
-// version : 1.0.2
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-
-(function () {
-
- /************************************
- Constants
- ************************************/
-
- var numeral,
- VERSION = '1.0.2',
- round = Math.round, i,
-
- // check for nodeJS
- hasModule = (typeof module !== 'undefined' && module.exports);
-
-
- /************************************
- Constructors
- ************************************/
-
-
- // Numeral prototype object
- function Numeral(number) {
- this._n = number;
- }
-
- /**
- * Implementation of toFixed() that treats floats more like decimals
- *
- * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
- * problems for accounting- and finance-related software.
- */
- function toFixed (value, precision) {
- var power = Math.pow(10, precision);
-
- // Multiply up by precision, round accurately, then divide and use native toFixed():
- return (Math.round(value * power) / power).toFixed(precision);
- }
-
- /************************************
- Formatting
- ************************************/
-
- // determine what type of formatting we need to do
- function formatNumeral (n, format) {
- var output;
-
- // figure out what kind of format we are dealing with
- if (format.indexOf('$') > -1) { // money!!!!!
- output = formatMoney(n, format);
- } else if (format.indexOf('%') > -1) { // percentage
- output = formatPercentage(n, format);
- } else if (format.indexOf(':') > -1) { // time
- output = formatTime(n, format);
- } else { // plain ol' number
- output = formatNumber(n, format);
- }
-
- // return string
- return output;
- }
-
- // revert to number
- function unformatNumeral (n, string) {
- if (string.indexOf(':') > -1) {
- n._n = unformatTime(string);
- } else {
- n._n = ((string.indexOf('k') > -1) ? 1000 : 1) * ((string.indexOf('m') > -1) ? 1000000 : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/\$|,|%|k|m|\(|\)*/ig, ''));
- }
- return n._n;
- }
-
- function formatMoney (n, format) {
- format = format.replace('$', '');
- var output = formatNumeral(n, format);
- if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
- output = output.split('');
- output.splice(1, 0, '$');
- output = output.join('');
- } else {
- output = '$' + output;
- }
- return output;
- }
-
- function formatPercentage (n, format) {
- format = format.replace('%', '');
- n._n = n._n * 100;
- var output = formatNumeral(n, format);
- if (output.indexOf(')') > -1 ) {
- output = output.split('');
- output.splice(-1, 0, '%');
- output = output.join('');
- } else {
- output = output + '%';
- }
- return output;
- }
-
- function formatTime (n, format) {
- var hours = Math.floor(n._n/60/60),
- minutes = Math.floor((n._n - (hours * 60 * 60))/60),
- seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
- return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
- }
-
- function unformatTime (string) {
- var timeArray = string.split(':'),
- seconds = 0;
- // turn hours and minutes into seconds and add them all up
- if (timeArray.length === 3) {
- // hours
- seconds = seconds + (Number(timeArray[0]) * 60 * 60);
- // minutes
- seconds = seconds + (Number(timeArray[1]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[2]);
- } else if (timeArray.lenght === 2) {
- // minutes
- seconds = seconds + (Number(timeArray[0]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[1]);
- }
- return Number(seconds);
- }
-
- function formatNumber (n, format) {
- var negP = false,
- abbr = false;
-
- // see if we should use parentheses for negative number
- if (format.indexOf('(') > -1) {
- negP = true;
- format = format.slice(1, -1);
- }
-
- // see if abbreviation is wanted
- if (format.indexOf('a') > -1) {
- format = format.replace('a', '');
-
- if (n._n > 1000000) {
- abbr = 'm';
- n._n = n._n / 1000000;
- } else {
- abbr = 'k';
- n._n = n._n / 1000;
- }
- }
-
- var w = n._n.toString().split('.')[0],
- precision = format.split('.')[1],
- thousands = format.indexOf(','),
- d = '',
- neg = false;
-
- // format number
- if (n._n < 0) {
- w = w.slice(1);
- neg = true;
- }
-
- if (thousands > -1) {
- w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
- }
-
- if (format.indexOf('.') === 0) {
- w = '';
- }
-
- if (precision) {
- // do to fixed
- d = '.' + toFixed(n._n, precision.length).split('.')[1];
- }
-
- if (abbr) {
-
- }
-
- return ((negP) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((abbr) ? abbr : '') + ((negP) ? ')' : '');
- }
-
- /************************************
- Top Level Functions
- ************************************/
-
- numeral = function (input) {
- if (numeral.isNumeral(input)) {
- input = input.value();
- } else if (!Number(input)) {
- input = 0;
- }
-
- return new Numeral(Number(input));
- };
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- console.log(obj);
- return obj instanceof Numeral;
- };
-
- // version number
- numeral.version = VERSION;
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- return obj instanceof Numeral;
- };
-
-
- /************************************
- Numeral Prototype
- ************************************/
-
-
- numeral.fn = Numeral.prototype = {
-
- clone : function () {
- return numeral(this);
- },
-
- format : function (inputString) {
- return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- unformat : function (inputString) {
- return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- value : function () {
- return this._n;
- },
-
- set : function (value) {
- this._n = Number(value);
- return this;
- },
-
- add : function (value) {
- this._n = this._n + Number(value);
- return this;
- },
-
- subtract : function (value) {
- this._n = this._n - Number(value);
- return this;
- },
-
- multiply : function (value) {
- this._n = this._n * Number(value);
- return this;
- },
-
- divide : function (value) {
- this._n = this._n / Number(value);
- return this;
- },
-
- difference : function (value) {
- return this._n - Number(value);
- }
-
- };
-
- /************************************
- Exposing Numeral
- ************************************/
-
- // Commenting out common js and global variable
- // // CommonJS module is defined
- if (hasModule) {
- module.exports = numeral;
- }
- /*global ender:false */
- if (typeof ender === 'undefined') {
- // here, `this` means `window` in the browser, or `global` on the server
- // add `numeral` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode
- this['numeral'] = numeral;
- }
-
- /*global define:false */
- if (typeof define === 'function' && define.amd) {
- define([], function () {
- return numeral;
- });
- }
-}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.2/package/package.json b/temp/numeral.js/1.0.2/package/package.json
deleted file mode 100644
index c594b1374..000000000
--- a/temp/numeral.js/1.0.2/package/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "numeral",
- "version": "1.0.2",
- "description": "Format and manipulate numbers.",
- "homepage": "http://adamwdraper.github.com/Numeral-js/",
- "author": {
- "name": "Adam Draper",
- "email": "adamwdraper@gmail.com",
- "url": "http://github.com/adamwdraper"
- },
- "keywords": [
- "numeral",
- "number",
- "format",
- "time",
- "money",
- "percentage"
- ],
- "main": "./numeral.js",
- "engines": {
- "node": "*"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/adamwdraper/Numeral-js"
- },
- "bugs": {
- "url": "https://github.com/adamwdraper/Numeral-js/issues"
- },
- "licenses": [
- {
- "type": "MIT"
- }
- ],
- "devDependencies": {},
- "ender": "./ender.js",
- "readme": "[Numeral.js](http://adamwdraper.github.com/Numeral-js/)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.0.2\nAdd clone functionality\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission 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:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE 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.",
- "_id": "numeral@1.0.2",
- "_from": "numeral"
-}
diff --git a/temp/numeral.js/1.0.3/dist.tar.gz b/temp/numeral.js/1.0.3/dist.tar.gz
deleted file mode 100644
index cfaf43dbf..000000000
Binary files a/temp/numeral.js/1.0.3/dist.tar.gz and /dev/null differ
diff --git a/temp/numeral.js/1.0.3/package/LICENSE b/temp/numeral.js/1.0.3/package/LICENSE
deleted file mode 100644
index 145e65bcd..000000000
--- a/temp/numeral.js/1.0.3/package/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.3/package/README.md b/temp/numeral.js/1.0.3/package/README.md
deleted file mode 100644
index ffba9355c..000000000
--- a/temp/numeral.js/1.0.3/package/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-[Numeral.js](http://adamwdraper.github.com/Numeral-js/)
-=======================================================
-
-A javascript library for formatting and manipulating numbers.
-
-[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
-
-
-Changelog
-=========
-
-### 1.0.3
-
-Add ordinal formatting using 'o' in the format
-
-### 1.0.2
-
-Add clone functionality
-
-### 1.0.1
-
-Added abbreviations for thousands and millions using 'a' in the format
-
-### 1.0.0
-
-Initial release
-
-
-Acknowlegements
-===============
-
-Numeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)
-
-
-License
-=======
-
-Numeral.js is freely distributable under the terms of the MIT license.
-
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.3/package/examples/example.html b/temp/numeral.js/1.0.3/package/examples/example.html
deleted file mode 100644
index 6d41af33d..000000000
--- a/temp/numeral.js/1.0.3/package/examples/example.html
+++ /dev/null
@@ -1,297 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Numeral.js
-
A javascript library for formatting and manipulating numbers.
-
Use it
-
In the Browser
-
-<script src="numeral-min.js"></script>
-
-
In Node.js
-
-npm install numeral
-
-
-var numeral = require('numeral');
-
-
-
Format
-
- Numbers can be formatted to look like money, percentages, times, or even plain old numbers with decimal places, comma delineated thousands, and abbreviations.
-
- Numeral.js, while less complex, was inspired by and heavily borrowed from Moment.js
-
-
-
-
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.3/package/min/numeral-min.js b/temp/numeral.js/1.0.3/package/min/numeral-min.js
deleted file mode 100644
index cb05992a3..000000000
--- a/temp/numeral.js/1.0.3/package/min/numeral-min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// numeral.js
-// version : 1.0.3
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-(function(){function s(e){this._n=e}function o(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function u(e,t){var n;t.indexOf("$")>-1?n=f(e,t):t.indexOf("%")>-1?n=l(e,t):t.indexOf(":")>-1?n=c(e,t):n=p(e,t);return n}function a(e,t){t.indexOf(":")>-1?e._n=h(t):e._n=(t.indexOf("k")>-1?1e3:1)*(t.indexOf("m")>-1?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/\$|,|%|k|m|th|st|nd|rd|\(|\)*/ig,""));return e._n}function f(e,t){t=t.replace("$","");var n=u(e,t);if(n.indexOf("(")>-1||n.indexOf("-")>-1){n=n.split("");n.splice(1,0,"$");n=n.join("")}else n="$"+n;return n}function l(e,t){t=t.replace("%","");e._n=e._n*100;var n=u(e,t);if(n.indexOf(")")>-1){n=n.split("");n.splice(-1,0,"%");n=n.join("")}else n+="%";return n}function c(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function h(e){var t=e.split(":"),n=0;if(t.length===3){n+=Number(t[0])*60*60;n+=Number(t[1])*60;n+=Number(t[2])}else if(t.lenght===2){n+=Number(t[0])*60;n+=Number(t[1])}return Number(n)}function p(e,t){var n=!1,r=!1,i=!1;if(t.indexOf("(")>-1){n=!0;t=t.slice(1,-1)}if(t.indexOf("a")>-1){t=t.replace("a","");if(e._n>1e6){r="m";e._n=e._n/1e6}else{r="k";e._n=e._n/1e3}}if(t.indexOf("o")>-1){t=t.replace("o","");var s=e._n%100,u=["th","st","nd","rd","th"];i=s<21?s<4?u[s]:u[0]:s%10>4?u[0]:u[s%10]}var a=e._n.toString().split(".")[0],f=t.split(".")[1],l=t.indexOf(","),c="",h=!1;if(e._n<0){a=a.slice(1);h=!0}l>-1&&(a=a.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"));t.indexOf(".")===0&&(a="");f&&(c="."+o(e._n,f.length).split(".")[1]);r;return(n?"(":"")+(!n&&h?"-":"")+a+c+(i?i:"")+(r?r:"")+(n?")":"")}var e,t="1.0.3",n=Math.round,r,i=typeof module!="undefined"&&module.exports;e=function(t){e.isNumeral(t)?t=t.value():Number(t)||(t=0);return new s(Number(t))};e.isNumeral=function(e){console.log(e);return e instanceof s};e.version=t;e.isNumeral=function(e){return e instanceof s};e.fn=s.prototype={clone:function(){return e(this)},format:function(t){return u(this,t?t:e.defaultFormat)},unformat:function(t){return a(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){this._n=Number(e);return this},add:function(e){this._n=this._n+Number(e);return this},subtract:function(e){this._n=this._n-Number(e);return this},multiply:function(e){this._n=this._n*Number(e);return this},divide:function(e){this._n=this._n/Number(e);return this},difference:function(e){return this._n-Number(e)}};i&&(module.exports=e);typeof ender=="undefined"&&(this.numeral=e);typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.3/package/numeral.js b/temp/numeral.js/1.0.3/package/numeral.js
deleted file mode 100644
index 4177040b3..000000000
--- a/temp/numeral.js/1.0.3/package/numeral.js
+++ /dev/null
@@ -1,304 +0,0 @@
-
-// numeral.js
-// version : 1.0.3
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-
-(function () {
-
- /************************************
- Constants
- ************************************/
-
- var numeral,
- VERSION = '1.0.3',
- round = Math.round, i,
-
- // check for nodeJS
- hasModule = (typeof module !== 'undefined' && module.exports);
-
-
- /************************************
- Constructors
- ************************************/
-
-
- // Numeral prototype object
- function Numeral(number) {
- this._n = number;
- }
-
- /**
- * Implementation of toFixed() that treats floats more like decimals
- *
- * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
- * problems for accounting- and finance-related software.
- */
- function toFixed (value, precision) {
- var power = Math.pow(10, precision);
-
- // Multiply up by precision, round accurately, then divide and use native toFixed():
- return (Math.round(value * power) / power).toFixed(precision);
- }
-
- /************************************
- Formatting
- ************************************/
-
- // determine what type of formatting we need to do
- function formatNumeral (n, format) {
- var output;
-
- // figure out what kind of format we are dealing with
- if (format.indexOf('$') > -1) { // money!!!!!
- output = formatMoney(n, format);
- } else if (format.indexOf('%') > -1) { // percentage
- output = formatPercentage(n, format);
- } else if (format.indexOf(':') > -1) { // time
- output = formatTime(n, format);
- } else { // plain ol' number
- output = formatNumber(n, format);
- }
-
- // return string
- return output;
- }
-
- // revert to number
- function unformatNumeral (n, string) {
- if (string.indexOf(':') > -1) {
- n._n = unformatTime(string);
- } else {
- n._n = ((string.indexOf('k') > -1) ? 1000 : 1) * ((string.indexOf('m') > -1) ? 1000000 : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/\$|,|%|k|m|th|st|nd|rd|\(|\)*/ig, ''));
- }
- return n._n;
- }
-
- function formatMoney (n, format) {
- format = format.replace('$', '');
- var output = formatNumeral(n, format);
- if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
- output = output.split('');
- output.splice(1, 0, '$');
- output = output.join('');
- } else {
- output = '$' + output;
- }
- return output;
- }
-
- function formatPercentage (n, format) {
- format = format.replace('%', '');
- n._n = n._n * 100;
- var output = formatNumeral(n, format);
- if (output.indexOf(')') > -1 ) {
- output = output.split('');
- output.splice(-1, 0, '%');
- output = output.join('');
- } else {
- output = output + '%';
- }
- return output;
- }
-
- function formatTime (n, format) {
- var hours = Math.floor(n._n/60/60),
- minutes = Math.floor((n._n - (hours * 60 * 60))/60),
- seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
- return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
- }
-
- function unformatTime (string) {
- var timeArray = string.split(':'),
- seconds = 0;
- // turn hours and minutes into seconds and add them all up
- if (timeArray.length === 3) {
- // hours
- seconds = seconds + (Number(timeArray[0]) * 60 * 60);
- // minutes
- seconds = seconds + (Number(timeArray[1]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[2]);
- } else if (timeArray.lenght === 2) {
- // minutes
- seconds = seconds + (Number(timeArray[0]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[1]);
- }
- return Number(seconds);
- }
-
- function formatNumber (n, format) {
- var negP = false,
- abbr = false,
- ord = false;
-
- // see if we should use parentheses for negative number
- if (format.indexOf('(') > -1) {
- negP = true;
- format = format.slice(1, -1);
- }
-
- // see if abbreviation is wanted
- if (format.indexOf('a') > -1) {
- format = format.replace('a', '');
-
- if (n._n > 1000000) {
- abbr = 'm';
- n._n = n._n / 1000000;
- } else {
- abbr = 'k';
- n._n = n._n / 1000;
- }
- }
-
- // see if ordinal is wanted
- if (format.indexOf('o') > -1) {
- format = format.replace('o', '');
-
- var r = n._n % 100,
- suffix = ['th', 'st', 'nd', 'rd', 'th'];
-
- ord = r < 21 ? (r < 4 ? suffix[r] : suffix[0]) : (r % 10 > 4 ? suffix[0] : suffix[r % 10]);
- }
-
- var w = n._n.toString().split('.')[0],
- precision = format.split('.')[1],
- thousands = format.indexOf(','),
- d = '',
- neg = false;
-
- // format number
- if (n._n < 0) {
- w = w.slice(1);
- neg = true;
- }
-
- if (thousands > -1) {
- w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
- }
-
- if (format.indexOf('.') === 0) {
- w = '';
- }
-
- if (precision) {
- // do to fixed
- d = '.' + toFixed(n._n, precision.length).split('.')[1];
- }
-
- if (abbr) {
-
- }
-
- return ((negP) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((negP) ? ')' : '');
- }
-
- /************************************
- Top Level Functions
- ************************************/
-
- numeral = function (input) {
- if (numeral.isNumeral(input)) {
- input = input.value();
- } else if (!Number(input)) {
- input = 0;
- }
-
- return new Numeral(Number(input));
- };
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- console.log(obj);
- return obj instanceof Numeral;
- };
-
- // version number
- numeral.version = VERSION;
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- return obj instanceof Numeral;
- };
-
-
- /************************************
- Numeral Prototype
- ************************************/
-
-
- numeral.fn = Numeral.prototype = {
-
- clone : function () {
- return numeral(this);
- },
-
- format : function (inputString) {
- return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- unformat : function (inputString) {
- return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- value : function () {
- return this._n;
- },
-
- set : function (value) {
- this._n = Number(value);
- return this;
- },
-
- add : function (value) {
- this._n = this._n + Number(value);
- return this;
- },
-
- subtract : function (value) {
- this._n = this._n - Number(value);
- return this;
- },
-
- multiply : function (value) {
- this._n = this._n * Number(value);
- return this;
- },
-
- divide : function (value) {
- this._n = this._n / Number(value);
- return this;
- },
-
- difference : function (value) {
- return this._n - Number(value);
- }
-
- };
-
- /************************************
- Exposing Numeral
- ************************************/
-
- // Commenting out common js and global variable
- // // CommonJS module is defined
- if (hasModule) {
- module.exports = numeral;
- }
- /*global ender:false */
- if (typeof ender === 'undefined') {
- // here, `this` means `window` in the browser, or `global` on the server
- // add `numeral` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode
- this['numeral'] = numeral;
- }
-
- /*global define:false */
- if (typeof define === 'function' && define.amd) {
- define([], function () {
- return numeral;
- });
- }
-}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.3/package/package.json b/temp/numeral.js/1.0.3/package/package.json
deleted file mode 100644
index b12c2aacd..000000000
--- a/temp/numeral.js/1.0.3/package/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "numeral",
- "version": "1.0.3",
- "description": "Format and manipulate numbers.",
- "homepage": "http://adamwdraper.github.com/Numeral-js/",
- "author": {
- "name": "Adam Draper",
- "email": "adamwdraper@gmail.com",
- "url": "http://github.com/adamwdraper"
- },
- "keywords": [
- "numeral",
- "number",
- "format",
- "time",
- "money",
- "percentage"
- ],
- "main": "./numeral.js",
- "engines": {
- "node": "*"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/adamwdraper/Numeral-js"
- },
- "bugs": {
- "url": "https://github.com/adamwdraper/Numeral-js/issues"
- },
- "licenses": [
- {
- "type": "MIT"
- }
- ],
- "devDependencies": {},
- "ender": "./ender.js",
- "readme": "[Numeral.js](http://adamwdraper.github.com/Numeral-js/)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.0.3\nAdd ordinal formatting using 'o' in the format\n### 1.0.2\nAdd clone functionality\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission 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:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE 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.",
- "_id": "numeral@1.0.3",
- "_from": "numeral"
-}
diff --git a/temp/numeral.js/1.0.4/dist.tar.gz b/temp/numeral.js/1.0.4/dist.tar.gz
deleted file mode 100644
index d395a9507..000000000
Binary files a/temp/numeral.js/1.0.4/dist.tar.gz and /dev/null differ
diff --git a/temp/numeral.js/1.0.4/package/LICENSE b/temp/numeral.js/1.0.4/package/LICENSE
deleted file mode 100644
index 145e65bcd..000000000
--- a/temp/numeral.js/1.0.4/package/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.4/package/README.md b/temp/numeral.js/1.0.4/package/README.md
deleted file mode 100644
index 67e34d2cc..000000000
--- a/temp/numeral.js/1.0.4/package/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-[Numeral.js](http://adamwdraper.github.com/Numeral-js/)
-=======================================================
-
-A javascript library for formatting and manipulating numbers.
-
-[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
-
-
-Changelog
-=========
-
-### 1.0.4
-
-Bug fix: Non negative numbers were displaying as negative when using parentheses
-
-### 1.0.3
-
-Add ordinal formatting using 'o' in the format
-
-### 1.0.2
-
-Add clone functionality
-
-### 1.0.1
-
-Added abbreviations for thousands and millions using 'a' in the format
-
-### 1.0.0
-
-Initial release
-
-
-Acknowlegements
-===============
-
-Numeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)
-
-
-License
-=======
-
-Numeral.js is freely distributable under the terms of the MIT license.
-
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.4/package/examples/example.html b/temp/numeral.js/1.0.4/package/examples/example.html
deleted file mode 100644
index b31e4a5a1..000000000
--- a/temp/numeral.js/1.0.4/package/examples/example.html
+++ /dev/null
@@ -1,282 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Numeral.js
-
A javascript library for formatting and manipulating numbers.
-
Use it
-
In the Browser
-
-<script src="numeral-min.js"></script>
-
-
In Node.js
-
-npm install numeral
-
-
-var numeral = require('numeral');
-
-
-
Format
-
- Numbers can be formatted to look like money, percentages, times, or even plain old numbers with decimal places, comma delineated thousands, and abbreviations.
-
- Numeral.js, while less complex, was inspired by and heavily borrowed from Moment.js
-
-
-
-
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.4/package/min/numeral-min.js b/temp/numeral.js/1.0.4/package/min/numeral-min.js
deleted file mode 100644
index 229441da4..000000000
--- a/temp/numeral.js/1.0.4/package/min/numeral-min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// numeral.js
-// version : 1.0.4
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-(function(){function s(e){this._n=e}function o(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function u(e,t){var n;t.indexOf("$")>-1?n=f(e,t):t.indexOf("%")>-1?n=l(e,t):t.indexOf(":")>-1?n=c(e,t):n=p(e,t);return n}function a(e,t){t.indexOf(":")>-1?e._n=h(t):e._n=(t.indexOf("k")>-1?1e3:1)*(t.indexOf("m")>-1?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/\$|,|%|k|m|th|st|nd|rd|\(|\)*/ig,""));return e._n}function f(e,t){t=t.replace("$","");var n=u(e,t);if(n.indexOf("(")>-1||n.indexOf("-")>-1){n=n.split("");n.splice(1,0,"$");n=n.join("")}else n="$"+n;return n}function l(e,t){t=t.replace("%","");e._n=e._n*100;var n=u(e,t);if(n.indexOf(")")>-1){n=n.split("");n.splice(-1,0,"%");n=n.join("")}else n+="%";return n}function c(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function h(e){var t=e.split(":"),n=0;if(t.length===3){n+=Number(t[0])*60*60;n+=Number(t[1])*60;n+=Number(t[2])}else if(t.lenght===2){n+=Number(t[0])*60;n+=Number(t[1])}return Number(n)}function p(e,t){var n=!1,r=!1,i=!1;if(t.indexOf("(")>-1){n=!0;t=t.slice(1,-1)}if(t.indexOf("a")>-1){t=t.replace("a","");if(e._n>1e6){r="m";e._n=e._n/1e6}else{r="k";e._n=e._n/1e3}}if(t.indexOf("o")>-1){t=t.replace("o","");var s=e._n%100,u=["th","st","nd","rd","th"];i=s<21?s<4?u[s]:u[0]:s%10>4?u[0]:u[s%10]}var a=e._n.toString().split(".")[0],f=t.split(".")[1],l=t.indexOf(","),c="",h=!1;if(e._n<0){a=a.slice(1);h=!0}l>-1&&(a=a.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"));t.indexOf(".")===0&&(a="");f&&(c="."+o(e._n,f.length).split(".")[1]);r;return(n&&h?"(":"")+(!n&&h?"-":"")+a+c+(i?i:"")+(r?r:"")+(n&&h?")":"")}var e,t="1.0.4",n=Math.round,r,i=typeof module!="undefined"&&module.exports;e=function(t){e.isNumeral(t)?t=t.value():Number(t)||(t=0);return new s(Number(t))};e.isNumeral=function(e){console.log(e);return e instanceof s};e.version=t;e.isNumeral=function(e){return e instanceof s};e.fn=s.prototype={clone:function(){return e(this)},format:function(t){return u(this,t?t:e.defaultFormat)},unformat:function(t){return a(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){this._n=Number(e);return this},add:function(e){this._n=this._n+Number(e);return this},subtract:function(e){this._n=this._n-Number(e);return this},multiply:function(e){this._n=this._n*Number(e);return this},divide:function(e){this._n=this._n/Number(e);return this},difference:function(e){return this._n-Number(e)}};i&&(module.exports=e);typeof ender=="undefined"&&(this.numeral=e);typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.4/package/numeral.js b/temp/numeral.js/1.0.4/package/numeral.js
deleted file mode 100644
index 01734a53b..000000000
--- a/temp/numeral.js/1.0.4/package/numeral.js
+++ /dev/null
@@ -1,304 +0,0 @@
-
-// numeral.js
-// version : 1.0.4
-// author : Adam Draper
-// license : MIT
-// http://adamwdraper.github.com/Numeral-js/
-
-(function () {
-
- /************************************
- Constants
- ************************************/
-
- var numeral,
- VERSION = '1.0.4',
- round = Math.round, i,
-
- // check for nodeJS
- hasModule = (typeof module !== 'undefined' && module.exports);
-
-
- /************************************
- Constructors
- ************************************/
-
-
- // Numeral prototype object
- function Numeral(number) {
- this._n = number;
- }
-
- /**
- * Implementation of toFixed() that treats floats more like decimals
- *
- * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
- * problems for accounting- and finance-related software.
- */
- function toFixed (value, precision) {
- var power = Math.pow(10, precision);
-
- // Multiply up by precision, round accurately, then divide and use native toFixed():
- return (Math.round(value * power) / power).toFixed(precision);
- }
-
- /************************************
- Formatting
- ************************************/
-
- // determine what type of formatting we need to do
- function formatNumeral (n, format) {
- var output;
-
- // figure out what kind of format we are dealing with
- if (format.indexOf('$') > -1) { // money!!!!!
- output = formatMoney(n, format);
- } else if (format.indexOf('%') > -1) { // percentage
- output = formatPercentage(n, format);
- } else if (format.indexOf(':') > -1) { // time
- output = formatTime(n, format);
- } else { // plain ol' number
- output = formatNumber(n, format);
- }
-
- // return string
- return output;
- }
-
- // revert to number
- function unformatNumeral (n, string) {
- if (string.indexOf(':') > -1) {
- n._n = unformatTime(string);
- } else {
- n._n = ((string.indexOf('k') > -1) ? 1000 : 1) * ((string.indexOf('m') > -1) ? 1000000 : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/\$|,|%|k|m|th|st|nd|rd|\(|\)*/ig, ''));
- }
- return n._n;
- }
-
- function formatMoney (n, format) {
- format = format.replace('$', '');
- var output = formatNumeral(n, format);
- if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
- output = output.split('');
- output.splice(1, 0, '$');
- output = output.join('');
- } else {
- output = '$' + output;
- }
- return output;
- }
-
- function formatPercentage (n, format) {
- format = format.replace('%', '');
- n._n = n._n * 100;
- var output = formatNumeral(n, format);
- if (output.indexOf(')') > -1 ) {
- output = output.split('');
- output.splice(-1, 0, '%');
- output = output.join('');
- } else {
- output = output + '%';
- }
- return output;
- }
-
- function formatTime (n, format) {
- var hours = Math.floor(n._n/60/60),
- minutes = Math.floor((n._n - (hours * 60 * 60))/60),
- seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
- return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
- }
-
- function unformatTime (string) {
- var timeArray = string.split(':'),
- seconds = 0;
- // turn hours and minutes into seconds and add them all up
- if (timeArray.length === 3) {
- // hours
- seconds = seconds + (Number(timeArray[0]) * 60 * 60);
- // minutes
- seconds = seconds + (Number(timeArray[1]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[2]);
- } else if (timeArray.lenght === 2) {
- // minutes
- seconds = seconds + (Number(timeArray[0]) * 60);
- // seconds
- seconds = seconds + Number(timeArray[1]);
- }
- return Number(seconds);
- }
-
- function formatNumber (n, format) {
- var negP = false,
- abbr = false,
- ord = false;
-
- // see if we should use parentheses for negative number
- if (format.indexOf('(') > -1) {
- negP = true;
- format = format.slice(1, -1);
- }
-
- // see if abbreviation is wanted
- if (format.indexOf('a') > -1) {
- format = format.replace('a', '');
-
- if (n._n > 1000000) {
- abbr = 'm';
- n._n = n._n / 1000000;
- } else {
- abbr = 'k';
- n._n = n._n / 1000;
- }
- }
-
- // see if ordinal is wanted
- if (format.indexOf('o') > -1) {
- format = format.replace('o', '');
-
- var r = n._n % 100,
- suffix = ['th', 'st', 'nd', 'rd', 'th'];
-
- ord = r < 21 ? (r < 4 ? suffix[r] : suffix[0]) : (r % 10 > 4 ? suffix[0] : suffix[r % 10]);
- }
-
- var w = n._n.toString().split('.')[0],
- precision = format.split('.')[1],
- thousands = format.indexOf(','),
- d = '',
- neg = false;
-
- // format number
- if (n._n < 0) {
- w = w.slice(1);
- neg = true;
- }
-
- if (thousands > -1) {
- w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
- }
-
- if (format.indexOf('.') === 0) {
- w = '';
- }
-
- if (precision) {
- // do to fixed
- d = '.' + toFixed(n._n, precision.length).split('.')[1];
- }
-
- if (abbr) {
-
- }
-
- return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((negP && neg) ? ')' : '');
- }
-
- /************************************
- Top Level Functions
- ************************************/
-
- numeral = function (input) {
- if (numeral.isNumeral(input)) {
- input = input.value();
- } else if (!Number(input)) {
- input = 0;
- }
-
- return new Numeral(Number(input));
- };
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- console.log(obj);
- return obj instanceof Numeral;
- };
-
- // version number
- numeral.version = VERSION;
-
- // compare numeral object
- numeral.isNumeral = function (obj) {
- return obj instanceof Numeral;
- };
-
-
- /************************************
- Numeral Prototype
- ************************************/
-
-
- numeral.fn = Numeral.prototype = {
-
- clone : function () {
- return numeral(this);
- },
-
- format : function (inputString) {
- return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- unformat : function (inputString) {
- return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
- },
-
- value : function () {
- return this._n;
- },
-
- set : function (value) {
- this._n = Number(value);
- return this;
- },
-
- add : function (value) {
- this._n = this._n + Number(value);
- return this;
- },
-
- subtract : function (value) {
- this._n = this._n - Number(value);
- return this;
- },
-
- multiply : function (value) {
- this._n = this._n * Number(value);
- return this;
- },
-
- divide : function (value) {
- this._n = this._n / Number(value);
- return this;
- },
-
- difference : function (value) {
- return this._n - Number(value);
- }
-
- };
-
- /************************************
- Exposing Numeral
- ************************************/
-
- // Commenting out common js and global variable
- // // CommonJS module is defined
- if (hasModule) {
- module.exports = numeral;
- }
- /*global ender:false */
- if (typeof ender === 'undefined') {
- // here, `this` means `window` in the browser, or `global` on the server
- // add `numeral` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode
- this['numeral'] = numeral;
- }
-
- /*global define:false */
- if (typeof define === 'function' && define.amd) {
- define([], function () {
- return numeral;
- });
- }
-}).call(this);
\ No newline at end of file
diff --git a/temp/numeral.js/1.0.4/package/package.json b/temp/numeral.js/1.0.4/package/package.json
deleted file mode 100644
index 9f4a829bc..000000000
--- a/temp/numeral.js/1.0.4/package/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "numeral",
- "version": "1.0.4",
- "description": "Format and manipulate numbers.",
- "homepage": "http://adamwdraper.github.com/Numeral-js/",
- "author": {
- "name": "Adam Draper",
- "email": "adamwdraper@gmail.com",
- "url": "http://github.com/adamwdraper"
- },
- "keywords": [
- "numeral",
- "number",
- "format",
- "time",
- "money",
- "percentage"
- ],
- "main": "./numeral.js",
- "engines": {
- "node": "*"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/adamwdraper/Numeral-js"
- },
- "bugs": {
- "url": "https://github.com/adamwdraper/Numeral-js/issues"
- },
- "licenses": [
- {
- "type": "MIT"
- }
- ],
- "devDependencies": {},
- "ender": "./ender.js",
- "readme": "[Numeral.js](http://adamwdraper.github.com/Numeral-js/)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.0.4\nBug fix: Non negative numbers were displaying as negative when using parentheses\n### 1.0.3\nAdd ordinal formatting using 'o' in the format\n### 1.0.2\nAdd clone functionality\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission 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:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE 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.",
- "_id": "numeral@1.0.4",
- "_from": "numeral"
-}
diff --git a/temp/numeral.js/1.1.0/dist.tar.gz b/temp/numeral.js/1.1.0/dist.tar.gz
deleted file mode 100644
index 3968df0cf..000000000
Binary files a/temp/numeral.js/1.1.0/dist.tar.gz and /dev/null differ
diff --git a/temp/numeral.js/1.1.0/package/LICENSE b/temp/numeral.js/1.1.0/package/LICENSE
deleted file mode 100644
index 145e65bcd..000000000
--- a/temp/numeral.js/1.1.0/package/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.1.0/package/README.md b/temp/numeral.js/1.1.0/package/README.md
deleted file mode 100644
index bab4899ca..000000000
--- a/temp/numeral.js/1.1.0/package/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-[Numeral.js](http://adamwdraper.github.com/Numeral-js/)
-=======================================================
-
-A javascript library for formatting and manipulating numbers.
-
-[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
-
-
-Changelog
-=========
-
-### 1.1.0
-
-Add Tests
-Bug fix: Fix difference returning negative values
-
-### 1.0.4
-
-Bug fix: Non negative numbers were displaying as negative when using parentheses
-
-### 1.0.3
-
-Add ordinal formatting using 'o' in the format
-
-### 1.0.2
-
-Add clone functionality
-
-### 1.0.1
-
-Added abbreviations for thousands and millions using 'a' in the format
-
-### 1.0.0
-
-Initial release
-
-
-Acknowlegements
-===============
-
-Numeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)
-
-
-License
-=======
-
-Numeral.js is freely distributable under the terms of the MIT license.
-
-Copyright (c) 2012 Adam Draper
-
-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.
\ No newline at end of file
diff --git a/temp/numeral.js/1.1.0/package/examples/example.html b/temp/numeral.js/1.1.0/package/examples/example.html
deleted file mode 100644
index 0aacf71fe..000000000
--- a/temp/numeral.js/1.1.0/package/examples/example.html
+++ /dev/null
@@ -1,284 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
Numeral.js
-
A javascript library for formatting and manipulating numbers.
-
Use it
-
In the Browser
-
-<script src="numeral-min.js"></script>
-
-
In Node.js
-
-npm install numeral
-
-
-var numeral = require('numeral');
-
-
-
Format
-
- Numbers can be formatted to look like money, percentages, times, or even plain old numbers with decimal places, comma delineated thousands, and abbreviations.
-