Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
224 changed files with 9982925 additions and 369 deletions
8
gaia/apps/camera/.jshintrc
Executable file
8
gaia/apps/camera/.jshintrc
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../.jshintrc",
|
||||
"predef": [
|
||||
"define",
|
||||
"require",
|
||||
"requirejs"
|
||||
]
|
||||
}
|
||||
31
gaia/apps/camera/bower.json
Executable file
31
gaia/apps/camera/bower.json
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "camera",
|
||||
"version": "0.0.0",
|
||||
"homepage": "https://github.com/mozilla-b2g/gaia/tree/master/apps/camera",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"main": "index.html",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "https://raw.githubusercontent.com/visionmedia/debug/1.0.2/dist/debug.js",
|
||||
"requirejs": "https://raw.githubusercontent.com/jrburke/requirejs/2.1.14/require.js",
|
||||
"evt": "fxos-components/evt#~0.4.0",
|
||||
"attach": "fxos-components/attach#0.1.1",
|
||||
"device-orientation": "fxos-components/device-orientation",
|
||||
"view": "fxos-components/view#~0.1.1",
|
||||
"model": "fxos-components/model#~0.1.0",
|
||||
"drag": "fxos-components/drag#0.1.4",
|
||||
"gaia-header": "fxos-components/gaia-header#~0.9.5",
|
||||
"gaia-theme": "fxos-components/gaia-theme#~0.4.1",
|
||||
"gaia-icons": "fxos-components/gaia-icons#~1.0.2"
|
||||
}
|
||||
}
|
||||
31
gaia/apps/camera/bower_components/attach/.bower.json
vendored
Executable file
31
gaia/apps/camera/bower_components/attach/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "attach",
|
||||
"main": "index.js",
|
||||
"version": "0.1.1",
|
||||
"homepage": "https://github.com/wilsonpage/attach",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"description": "Small event delegation library",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"examples",
|
||||
"test",
|
||||
"tests",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"_release": "0.1.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.1.1",
|
||||
"commit": "f5195ba8fe78c2a4f421b26caf431f385fa6b61d"
|
||||
},
|
||||
"_source": "git://github.com/fxos-components/attach.git",
|
||||
"_target": "0.1.1",
|
||||
"_originalSource": "fxos-components/attach"
|
||||
}
|
||||
22
gaia/apps/camera/bower_components/attach/bower.json
vendored
Executable file
22
gaia/apps/camera/bower_components/attach/bower.json
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "attach",
|
||||
"main": "index.js",
|
||||
"version": "0.1.1",
|
||||
"homepage": "https://github.com/wilsonpage/attach",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"description": "Small event delegation library",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"examples",
|
||||
"test",
|
||||
"tests",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
254
gaia/apps/camera/bower_components/attach/index.js
vendored
Executable file
254
gaia/apps/camera/bower_components/attach/index.js
vendored
Executable file
|
|
@ -0,0 +1,254 @@
|
|||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Namespace to store
|
||||
* references under on root
|
||||
*/
|
||||
|
||||
var ns = '_attach';
|
||||
|
||||
/**
|
||||
* Normalize `matchesSelector`
|
||||
*/
|
||||
|
||||
var proto = Element.prototype;
|
||||
var matches = proto.matchesSelector
|
||||
|| proto.webkitMatchesSelector
|
||||
|| proto.mozMatchesSelector
|
||||
|| proto.msMatchesSelector
|
||||
|| proto.oMatchesSelector;
|
||||
|
||||
/**
|
||||
* Bind an event listener
|
||||
* to the given element.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* attach(myEl, 'click', '.my-class', function(event, el) {
|
||||
* // Do stuff
|
||||
* });
|
||||
*
|
||||
* @param {Element} root
|
||||
* @param {String} type
|
||||
* @param {String} selector (optional)
|
||||
* @param {Function} fn
|
||||
* @param {Object} ctx (optional)
|
||||
*/
|
||||
function attach(root, type, selector, fn, ctx) {
|
||||
if (arguments.length === 2) {
|
||||
return attach.many.apply(null, arguments);
|
||||
}
|
||||
|
||||
// `selector` is optional
|
||||
if (typeof selector === 'function') {
|
||||
ctx = fn;
|
||||
fn = selector;
|
||||
selector = null;
|
||||
}
|
||||
|
||||
// We use the key 'null' to
|
||||
// indicate that we are binding
|
||||
// an event handler to the root.
|
||||
selector = selector || 'null';
|
||||
|
||||
var store = getStore(root);
|
||||
var master = store.master[type];
|
||||
var delegates = store.delegates[type] = (store.delegates[type] || {});
|
||||
|
||||
// Add the function to the delegates
|
||||
delegates[selector] = fn;
|
||||
|
||||
// Only one master event listener
|
||||
// is needed per event type.
|
||||
if (master) { return; }
|
||||
|
||||
// Add the master callbak to the
|
||||
// root node and to the store.
|
||||
master = store.master[type] = callback;
|
||||
root.addEventListener(type, master);
|
||||
|
||||
/**
|
||||
* The master callback passed
|
||||
* to `addEventListener`.
|
||||
*
|
||||
* @param {Event} event
|
||||
*/
|
||||
function callback(e) {
|
||||
var el = e.target;
|
||||
var selector;
|
||||
var matched;
|
||||
var out;
|
||||
var fn;
|
||||
|
||||
// Walk up the DOM tree
|
||||
// until we hit the root
|
||||
while (el) {
|
||||
|
||||
// Loop over each selector
|
||||
// bound to this e type.
|
||||
for (selector in delegates) {
|
||||
fn = delegates[selector];
|
||||
|
||||
// There are two types of match. A
|
||||
// 'null' selector at the root node,
|
||||
// or a selector match on the current el.
|
||||
matched = (el === root && selector === 'null') ||
|
||||
matches.call(el, selector);
|
||||
|
||||
if (matched) {
|
||||
out = fn.call(ctx || el, e, el);
|
||||
|
||||
// Stop propagation if the
|
||||
// user returns false from the
|
||||
// callback. Ideally we would
|
||||
// use .stopPropagation, but I
|
||||
// don't know of any way to detect
|
||||
// if this has been called.
|
||||
if (out === false) { return e.stopPropagation(); }
|
||||
}
|
||||
}
|
||||
|
||||
// Don't go any higher
|
||||
// than the root element.
|
||||
if (el == root) break;
|
||||
|
||||
// Move on up!
|
||||
el = el.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attach.on = attach;
|
||||
|
||||
/**
|
||||
* Unbind an event attach
|
||||
* from the given root element.
|
||||
*
|
||||
* If no selector if given, all
|
||||
* callbacks for the given event
|
||||
* type are removed.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* // Remove one
|
||||
* attach.off(myEl, 'click', '.my-class');
|
||||
*
|
||||
* // Remove all
|
||||
* attach.off(myEl, 'click');
|
||||
*
|
||||
* @param {Element} root
|
||||
* @param {String} type (optional)
|
||||
* @param {String} selector (optional)
|
||||
*/
|
||||
attach.off = function(root, type, selector) {
|
||||
var store = getStore(root);
|
||||
var master = store.master[type];
|
||||
var delegates = store.delegates[type];
|
||||
|
||||
// Remove just one
|
||||
if (type && selector) {
|
||||
delete delegates[selector];
|
||||
}
|
||||
|
||||
// Remove all of type
|
||||
else if (type) {
|
||||
delete store.delegates[type];
|
||||
}
|
||||
|
||||
// Remove all
|
||||
else {
|
||||
for (type in store.master) {
|
||||
attach.off(root, type);
|
||||
}
|
||||
}
|
||||
|
||||
// If there aren't any callbacks
|
||||
// of this type left, remove the master.
|
||||
if (isEmpty(store.delegates[type])) {
|
||||
root.removeEventListener(type, master);
|
||||
delete store.master[type];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles Backbone style
|
||||
* shorthand event binding.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* attach(myElement, {
|
||||
* 'click .foo': onFooClick,
|
||||
* 'click .bar': onBarClick
|
||||
* });
|
||||
*
|
||||
* @param {element} root
|
||||
* @param {Object} config
|
||||
* @param {Object} ctx
|
||||
*/
|
||||
attach.many = function(root, config, ctx) {
|
||||
var parts;
|
||||
var key;
|
||||
|
||||
for (key in config) {
|
||||
parts = key.split(' ');
|
||||
attach.on(
|
||||
root,
|
||||
parts[0],
|
||||
parts[1],
|
||||
config[key],
|
||||
ctx);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the reference store
|
||||
* attached to the given node.
|
||||
*
|
||||
* If one is not found, we
|
||||
* create a fresh one.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @return {Object}
|
||||
*/
|
||||
function getStore(el) {
|
||||
return el[ns] || createStore(el);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fresh reference
|
||||
* store on the given element.
|
||||
*
|
||||
* @param {Element} el
|
||||
* @return {Object}
|
||||
*/
|
||||
function createStore(el) {
|
||||
el[ns] = { master: {}, delegates: {} };
|
||||
return el[ns];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given
|
||||
* element has no keys.
|
||||
*
|
||||
* @param {Object} ob
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isEmpty(ob) {
|
||||
for (var key in ob) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose 'attach' (UMD)
|
||||
*/
|
||||
|
||||
if (typeof exports === "object") {
|
||||
module.exports = attach;
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define(function(){ return attach; });
|
||||
} else {
|
||||
window.attach = attach;
|
||||
}
|
||||
|
||||
})();
|
||||
13
gaia/apps/camera/bower_components/debug/.bower.json
vendored
Executable file
13
gaia/apps/camera/bower_components/debug/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "debug",
|
||||
"_cacheHeaders": {
|
||||
"ETag": "\"3fa8ae0741057b60f6e8629b9ede7fda1e09af27\"",
|
||||
"Content-Length": "10073",
|
||||
"Content-Type": "text/plain; charset=utf-8"
|
||||
},
|
||||
"_release": "e-tag:3fa8ae074",
|
||||
"main": "index.js",
|
||||
"_source": "https://raw.githubusercontent.com/visionmedia/debug/1.0.2/dist/debug.js",
|
||||
"_target": "*",
|
||||
"_originalSource": "https://raw.githubusercontent.com/visionmedia/debug/1.0.2/dist/debug.js"
|
||||
}
|
||||
461
gaia/apps/camera/bower_components/debug/index.js
vendored
Executable file
461
gaia/apps/camera/bower_components/debug/index.js
vendored
Executable file
|
|
@ -0,0 +1,461 @@
|
|||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.debug=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = _dereq_('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors and the Firebug
|
||||
* extension (*not* the built-in Firefox web inpector) are
|
||||
* known to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
return ('WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(window.console && (console.firebug || (console.exception && console.table)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
return JSON.stringify(v);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return args
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args = [args[0], c, ''].concat(Array.prototype.slice.call(args, 1));
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// This hackery is required for IE8,
|
||||
// where the `console.log` function doesn't have 'apply'
|
||||
return 'object' == typeof console
|
||||
&& 'function' == typeof console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
localStorage.removeItem('debug');
|
||||
} else {
|
||||
localStorage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = localStorage.debug;
|
||||
} catch(e) {}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
},{"./debug":2}],2:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = debug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = _dereq_('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lowercased letter, i.e. "n".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previously assigned color.
|
||||
*/
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor() {
|
||||
return exports.colors[prevColor++ % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function debug(namespace) {
|
||||
|
||||
// define the `disabled` version
|
||||
function disabled() {
|
||||
}
|
||||
disabled.enabled = false;
|
||||
|
||||
// define the `enabled` version
|
||||
function enabled() {
|
||||
|
||||
var self = enabled;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// add the `color` if not set
|
||||
if (null == self.useColors) self.useColors = exports.useColors();
|
||||
if (null == self.color && self.useColors) self.color = selectColor();
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %o
|
||||
args = ['%o'].concat(args);
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
if ('function' === typeof exports.formatArgs) {
|
||||
args = exports.formatArgs.apply(self, args);
|
||||
}
|
||||
var logFn = exports.log || enabled.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
enabled.enabled = true;
|
||||
|
||||
var fn = exports.enabled(namespace) ? enabled : disabled;
|
||||
|
||||
fn.namespace = namespace;
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
var split = (namespaces || '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace('*', '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
||||
|
||||
},{"ms":3}],3:[function(_dereq_,module,exports){
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} options
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options){
|
||||
options = options || {};
|
||||
if ('string' == typeof val) return parse(val);
|
||||
return options.long
|
||||
? long(val)
|
||||
: short(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
|
||||
if (!match) return;
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'ms':
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function short(ms) {
|
||||
if (ms >= d) return Math.round(ms / d) + 'd';
|
||||
if (ms >= h) return Math.round(ms / h) + 'h';
|
||||
if (ms >= m) return Math.round(ms / m) + 'm';
|
||||
if (ms >= s) return Math.round(ms / s) + 's';
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function long(ms) {
|
||||
return plural(ms, d, 'day')
|
||||
|| plural(ms, h, 'hour')
|
||||
|| plural(ms, m, 'minute')
|
||||
|| plural(ms, s, 'second')
|
||||
|| ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) return;
|
||||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
|
||||
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||
}
|
||||
|
||||
},{}]},{},[1])
|
||||
(1)
|
||||
});
|
||||
23
gaia/apps/camera/bower_components/device-orientation/.bower.json
vendored
Executable file
23
gaia/apps/camera/bower_components/device-orientation/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "device-orientation",
|
||||
"main": "device-orientation.js",
|
||||
"homepage": "https://github.com/fxos-components/device-orientation",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"_release": "1.0.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.0",
|
||||
"commit": "6f6921e80c4f1ab8a2600f9ecebf6afabdca02c9"
|
||||
},
|
||||
"_source": "git://github.com/fxos-components/device-orientation.git",
|
||||
"_target": "*",
|
||||
"_originalSource": "fxos-components/device-orientation"
|
||||
}
|
||||
13
gaia/apps/camera/bower_components/device-orientation/bower.json
vendored
Executable file
13
gaia/apps/camera/bower_components/device-orientation/bower.json
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "device-orientation",
|
||||
"main": "device-orientation.js",
|
||||
"homepage": "https://github.com/fxos-components/device-orientation",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
192
gaia/apps/camera/bower_components/device-orientation/device-orientation.js
vendored
Executable file
192
gaia/apps/camera/bower_components/device-orientation/device-orientation.js
vendored
Executable file
|
|
@ -0,0 +1,192 @@
|
|||
(function(define){define(function(require,exports,module){
|
||||
'use strict';
|
||||
|
||||
// The time interval is allowed between two orientation change event
|
||||
const ORIENTATION_CHANGE_INTERVAL = 300;
|
||||
|
||||
// The maximum sample inter-arrival time in milliseconds. If the acceleration
|
||||
// samples are further apart than this amount in time, we reset the state of
|
||||
// the low-pass filter and orientation properties. This helps to handle
|
||||
// boundary conditions when the app becomes invisisble, wakes from suspend or
|
||||
// there is a significant gap in samples.
|
||||
const MAX_MOTION_FILTER_TIME = 1000;
|
||||
|
||||
// Filtering adds latency proportional the time constant (inversely
|
||||
// proportional to the cutoff frequency) so we don't want to make the time
|
||||
// constant too large or we can lose responsiveness. Likewise we don't want
|
||||
// to make it too small or we do a poor job suppressing acceleration spikes.
|
||||
// Empirically, 100ms seems to be too small and 500ms is too large. Android
|
||||
// default is 200. The original version is from:
|
||||
// http://mxr.mozilla.org/mozilla-central/source/widget/gonk/
|
||||
// ProcessOrientation.cpp
|
||||
const MOTION_FILTER_TIME_CONSTANT = 200;
|
||||
|
||||
var lastMotionFilteredTime = 0;
|
||||
var lastMotionData = {x: 0, y: 0, z: 0, t: 0};
|
||||
var pendingOrientation = null;
|
||||
var orientationChangeTimer = 0;
|
||||
var eventListeners = {'orientation': []};
|
||||
|
||||
function applyFilter(x, y, z) {
|
||||
var now = new Date().getTime();
|
||||
var filterReset = false;
|
||||
// The motion event is too far from last filtered data, reset the data.
|
||||
// This may be the case of hide app and go back.
|
||||
if (now > lastMotionData.t + MAX_MOTION_FILTER_TIME) {
|
||||
// clear data to re-initialize it.
|
||||
lastMotionData.x = 0;
|
||||
lastMotionData.y = 0;
|
||||
lastMotionData.z = 0;
|
||||
filterReset = true;
|
||||
}
|
||||
// applying the exponential moving average to x, y, z, when we already have
|
||||
// value of it.
|
||||
if (lastMotionData.x || lastMotionData.y || lastMotionData.z) {
|
||||
// use time to calculate alpha
|
||||
var diff = now - lastMotionFilteredTime;
|
||||
var alpha = diff / (MOTION_FILTER_TIME_CONSTANT + diff);
|
||||
|
||||
// weight the x, y, z with alpha
|
||||
x = alpha * (x - lastMotionData.x) + lastMotionData.x;
|
||||
y = alpha * (y - lastMotionData.y) + lastMotionData.y;
|
||||
z = alpha * (z - lastMotionData.z) + lastMotionData.z;
|
||||
}
|
||||
|
||||
// update the filter state.
|
||||
lastMotionData.x = x;
|
||||
lastMotionData.y = y;
|
||||
lastMotionData.z = z;
|
||||
lastMotionData.t = now;
|
||||
return filterReset;
|
||||
}
|
||||
|
||||
function calcOrientation(x, y) {
|
||||
// use atan2(-x, y) to calculate the rotation on z axis.
|
||||
var orientationAngle = (Math.atan2(-x, y) * 180 / Math.PI);
|
||||
// The value range of atan2 is [-180, 180]. To have the [0, 360] value
|
||||
// range, we need to add 360 degrees when the angle is less than 0.
|
||||
if (orientationAngle < 0) {
|
||||
orientationAngle += 360;
|
||||
}
|
||||
|
||||
// find the nearest orientation.
|
||||
// If an angle is >= 45 degrees, we view it as 90 degrees. If an angle is <
|
||||
// 45, we view it as 0 degree.
|
||||
var orientation = (((orientationAngle + 45) / 90) >> 0) % 4 * 90;
|
||||
return orientation;
|
||||
}
|
||||
|
||||
function handleMotionEvent(e) {
|
||||
if (!e.accelerationIncludingGravity) {
|
||||
return;
|
||||
}
|
||||
|
||||
var filterReset = applyFilter(e.accelerationIncludingGravity.x,
|
||||
e.accelerationIncludingGravity.y,
|
||||
e.accelerationIncludingGravity.z);
|
||||
|
||||
// We don't need to process the event when filter is reset or no data.
|
||||
if (filterReset) {
|
||||
return;
|
||||
}
|
||||
|
||||
var x = lastMotionData.x;
|
||||
var y = lastMotionData.y;
|
||||
var z = lastMotionData.z;
|
||||
|
||||
// We only want to measure gravity, so ignore events when there is
|
||||
// significant acceleration in addition to gravity because this means the
|
||||
// user is moving the phone.
|
||||
if ((x * x + y * y + z * z) > 110) {
|
||||
return;
|
||||
}
|
||||
// If the camera is close to horizontal (pointing up or down) then we can't
|
||||
// tell what orientation the user intends, so we just return now without
|
||||
// changing the orientation. The constant 9.2 is the force of gravity (9.8)
|
||||
// times the cosine of 20 degrees. So if the phone is within 20 degrees of
|
||||
// horizontal, we will never change the orientation.
|
||||
if (z > 9.2 || z < -9.2) {
|
||||
return;
|
||||
}
|
||||
|
||||
var orientation = calcOrientation(x, y);
|
||||
|
||||
if (orientation === pendingOrientation) {
|
||||
return;
|
||||
}
|
||||
|
||||
// When phone keeps the same orientation for ORIENTATION_CHANGE_INTERVAL
|
||||
// time interval, we change the orientation. Otherwrise the change is
|
||||
// cancelled. This may be that user rotates phone rapidly but captured by
|
||||
// device motion.
|
||||
if (orientationChangeTimer) {
|
||||
window.clearTimeout(orientationChangeTimer);
|
||||
}
|
||||
|
||||
// If we don't have any current orientation, then send an event right away
|
||||
// Otherwise, wait to make sure we're stable before sending it.
|
||||
if (pendingOrientation === null) {
|
||||
pendingOrientation = orientation;
|
||||
fireOrientationChangeEvent(pendingOrientation);
|
||||
}
|
||||
else {
|
||||
// create timer for waiting to rotate the phone
|
||||
pendingOrientation = orientation;
|
||||
orientationChangeTimer = window.setTimeout(function doOrient() {
|
||||
fireOrientationChangeEvent(pendingOrientation);
|
||||
orientationChangeTimer = 0;
|
||||
}, ORIENTATION_CHANGE_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
// Reset our state so that the first devicemotion event we get
|
||||
// will always generate an orientation event.
|
||||
pendingOrientation = null;
|
||||
window.addEventListener('devicemotion', handleMotionEvent);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
window.removeEventListener('devicemotion', handleMotionEvent);
|
||||
if (orientationChangeTimer) {
|
||||
clearTimeout(orientationChangeTimer);
|
||||
orientationChangeTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function addEventListener(type, listener) {
|
||||
if (eventListeners[type] && listener) {
|
||||
eventListeners[type].push(listener);
|
||||
}
|
||||
}
|
||||
|
||||
function removeEventListener(type, listener) {
|
||||
if (!eventListeners[type]) {
|
||||
return;
|
||||
}
|
||||
var idx = eventListeners[type].indexOf(listener);
|
||||
if (idx > -1) {
|
||||
eventListeners.slice(idx, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function fireOrientationChangeEvent(orientation) {
|
||||
eventListeners.orientation.forEach(function(listener) {
|
||||
if (listener.handleEvent) {
|
||||
listener.handleEvent(orientation);
|
||||
} else if ((typeof listener) === 'function') {
|
||||
listener(orientation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
start: start,
|
||||
stop: stop,
|
||||
on: addEventListener,
|
||||
off: removeEventListener
|
||||
};
|
||||
|
||||
});})((function(n,w){return typeof define=='function'&&define.amd?
|
||||
define:typeof module=='object'?function(c){c(require,exports,module);}:function(c){
|
||||
var m={exports:{}},r=function(n){return w[n];};w[n]=c(r,m.exports,m)||m.exports;};})('device-orientation',this));
|
||||
17
gaia/apps/camera/bower_components/device-orientation/package.json
vendored
Executable file
17
gaia/apps/camera/bower_components/device-orientation/package.json
vendored
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "device-orientation",
|
||||
"description": "Tracks device orientation using accelerometer when orientation locked.",
|
||||
"main": "device-orientation.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fxos-components/device-orientation.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/fxos-components/device-orientation/issues"
|
||||
},
|
||||
"homepage": "https://github.com/fxos-components/device-orientation",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
29
gaia/apps/camera/bower_components/drag/.bower.json
vendored
Executable file
29
gaia/apps/camera/bower_components/drag/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "drag",
|
||||
"main": "index.js",
|
||||
"version": "0.1.4",
|
||||
"homepage": "https://github.com/gaia-components/drag",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"evt": "gaia-components/evt#~0.4.0"
|
||||
},
|
||||
"_release": "0.1.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.1.4",
|
||||
"commit": "c56942e7e15abd42f38d3634e540739f96d545d3"
|
||||
},
|
||||
"_source": "git://github.com/fxos-components/drag.git",
|
||||
"_target": "0.1.4",
|
||||
"_originalSource": "fxos-components/drag"
|
||||
}
|
||||
20
gaia/apps/camera/bower_components/drag/bower.json
vendored
Executable file
20
gaia/apps/camera/bower_components/drag/bower.json
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "drag",
|
||||
"main": "index.js",
|
||||
"version": "0.1.4",
|
||||
"homepage": "https://github.com/gaia-components/drag",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"evt": "gaia-components/evt#~0.4.0"
|
||||
}
|
||||
}
|
||||
229
gaia/apps/camera/bower_components/drag/index.js
vendored
Executable file
229
gaia/apps/camera/bower_components/drag/index.js
vendored
Executable file
|
|
@ -0,0 +1,229 @@
|
|||
(function(define){'use strict';define(function(require,exports,module){
|
||||
/*globals define*//*jshint node:true*/
|
||||
|
||||
/**
|
||||
* Dependencies
|
||||
*/
|
||||
|
||||
var events = require('evt');
|
||||
|
||||
/**
|
||||
* Exports
|
||||
*/
|
||||
|
||||
module.exports = Drag;
|
||||
|
||||
/**
|
||||
* Mixin Emitter
|
||||
*/
|
||||
|
||||
events(Drag.prototype);
|
||||
|
||||
/**
|
||||
* Pointer event abstraction to make
|
||||
* it work for touch and mouse.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var pointer = [
|
||||
{ down: 'touchstart', up: 'touchend', move: 'touchmove' },
|
||||
{ down: 'mousedown', up: 'mouseup', move: 'mousemove' }
|
||||
]['ontouchstart' in window ? 0 : 1];
|
||||
|
||||
/**
|
||||
* Drag creates a draggable 'handle' element,
|
||||
* constrained within a 'container' element.
|
||||
*
|
||||
* Drag instances emit useful events and provides
|
||||
* methods to support common draggable UI use-cases,
|
||||
* like `snapToClosestEdge`
|
||||
*
|
||||
* In Gaia we use `Drag` for our switch components.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* // Create a new `Drag`
|
||||
* var drag = new Drag({
|
||||
* container: myContainer,
|
||||
* handle: myHandle
|
||||
* });
|
||||
*
|
||||
* // Once elements are in the DOM we
|
||||
* // need to take some measurements
|
||||
* drag.updateDimensions();
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - {Element} `container`
|
||||
* - {Element} `handle`
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
function Drag(options) {
|
||||
this.container = { el: options.container };
|
||||
this.handle = { el: options.handle };
|
||||
this.onTouchStart = this.onTouchStart.bind(this);
|
||||
this.onTouchMove = this.onTouchMove.bind(this);
|
||||
this.onTouchEnd = this.onTouchEnd.bind(this);
|
||||
this.slideDuration = options.slideDuration || 140;
|
||||
this.tapTime = options.tapTime || 180;
|
||||
this.bindEvents();
|
||||
}
|
||||
|
||||
Drag.prototype.bindEvents = function() {
|
||||
this.container.el.addEventListener(pointer.down, this.onTouchStart);
|
||||
};
|
||||
|
||||
Drag.prototype.onTouchStart = function(e) {
|
||||
this.updateDimensions();
|
||||
this.touch = ~e.type.indexOf('mouse') ? e : e.touches[0];
|
||||
this.firstTouch = this.touch;
|
||||
this.startTime = e.timeStamp;
|
||||
|
||||
addEventListener(pointer.move, this.onTouchMove);
|
||||
addEventListener(pointer.up, this.onTouchEnd);
|
||||
};
|
||||
|
||||
Drag.prototype.onTouchMove = function(e) {
|
||||
e.preventDefault();
|
||||
e = ~e.type.indexOf('mouse') ? e : e.touches[0];
|
||||
|
||||
var delta = {
|
||||
x: e.clientX - this.touch.clientX,
|
||||
y: e.clientY - this.touch.clientY
|
||||
};
|
||||
|
||||
this.dragging = true;
|
||||
this.move(delta);
|
||||
this.touch = e;
|
||||
};
|
||||
|
||||
Drag.prototype.onTouchEnd = function(e) {
|
||||
var tapped = (e.timeStamp - this.startTime) < this.tapTime;
|
||||
this.dragging = false;
|
||||
|
||||
removeEventListener(pointer.move, this.onTouchMove);
|
||||
removeEventListener(pointer.up, this.onTouchEnd);
|
||||
|
||||
if (tapped) { this.emit('tapped', e); }
|
||||
else { this.emit('ended', e); }
|
||||
};
|
||||
|
||||
Drag.prototype.move = function(delta) {
|
||||
this.translate({
|
||||
x: this.handle.position.x + delta.x,
|
||||
y: this.handle.position.y + delta.y
|
||||
});
|
||||
};
|
||||
|
||||
Drag.prototype.set = function(pos) {
|
||||
if (!this.edges) { this.pendingSet = pos; return; }
|
||||
var x = typeof pos.x === 'string' ? this.edges[pos.x] : (pos.x || 0);
|
||||
var y = typeof pos.y === 'string' ? this.edges[pos.y] : (pos.y || 0);
|
||||
this.translate({ x: x, y: y });
|
||||
};
|
||||
|
||||
Drag.prototype.snapToClosestEdge = function() {
|
||||
var edges = this.getClosestEdges();
|
||||
|
||||
this.translate({
|
||||
x: this.edges[edges.x],
|
||||
y: this.edges[edges.y]
|
||||
});
|
||||
|
||||
this.emit('snapped', edges);
|
||||
};
|
||||
|
||||
Drag.prototype.translate = function(options) {
|
||||
var position = this.clamp(options);
|
||||
var translate = 'translate(' + position.x + 'px,' + position.y + 'px)';
|
||||
var ratio = {
|
||||
x: (position.x / this.max.x) || 0,
|
||||
y: (position.y / this.max.y) || 0
|
||||
};
|
||||
|
||||
this.setTransition(position);
|
||||
|
||||
// Set the transform to move the handle
|
||||
this.handle.el.style.transform = translate;
|
||||
|
||||
// Update the handle position reference
|
||||
this.handle.position = position;
|
||||
|
||||
// Emit event with useful data
|
||||
this.emit('translate', {
|
||||
position: {
|
||||
px: position,
|
||||
ratio: ratio
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Drag.prototype.clamp = function(position) {
|
||||
return {
|
||||
x: Math.max(this.min.x, Math.min(this.max.x, position.x)),
|
||||
y: Math.max(this.min.y, Math.min(this.max.y, position.y)),
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* [setTransition description]
|
||||
* @param {[type]} position [description]
|
||||
*/
|
||||
Drag.prototype.setTransition = function(position) {
|
||||
var duration = !this.dragging ? this.transitionDuration(position) : 0;
|
||||
this.handle.el.style.transitionDuration = duration + 'ms';
|
||||
};
|
||||
|
||||
Drag.prototype.transitionDuration = function(position) {
|
||||
var current = this.handle.position;
|
||||
var distanceX = Math.abs(current.x - position.x);
|
||||
var distanceY = Math.abs(current.y - position.y);
|
||||
var distance = Math.max(distanceX, distanceY);
|
||||
var axis = distanceY > distanceX ? 'y' : 'x';
|
||||
var ratio = distance / this.max[axis];
|
||||
return this.slideDuration * ratio;
|
||||
};
|
||||
|
||||
Drag.prototype.getClosestEdges = function() {
|
||||
return {
|
||||
x: this.handle.position.x <= (this.max.x / 2) ? 'left' : 'right',
|
||||
y: this.handle.position.y <= (this.max.y / 2) ? 'top' : 'bottom'
|
||||
};
|
||||
};
|
||||
|
||||
Drag.prototype.updateDimensions = function() {
|
||||
var container = this.container.el.getBoundingClientRect();
|
||||
var handle = this.handle.el.getBoundingClientRect();
|
||||
|
||||
this.min = { x: 0, y: 0 };
|
||||
this.max = {
|
||||
x: container.width - handle.width,
|
||||
y: container.height - handle.height
|
||||
};
|
||||
|
||||
this.edges = {
|
||||
top: this.min.y,
|
||||
right: this.max.x,
|
||||
bottom: this.max.y,
|
||||
left: this.min.x
|
||||
};
|
||||
|
||||
this.handle.position = {
|
||||
x: handle.left - container.left,
|
||||
y: handle.top - container.top
|
||||
};
|
||||
|
||||
this.clearPendingSet();
|
||||
};
|
||||
|
||||
Drag.prototype.clearPendingSet = function() {
|
||||
if (!this.pendingSet) { return; }
|
||||
this.set(this.pendingSet);
|
||||
delete this.pendingSet;
|
||||
};
|
||||
|
||||
});})((function(n,w){'use strict';return typeof define=='function'&&define.amd?
|
||||
define:typeof module=='object'?function(c){c(require,exports,module);}:
|
||||
function(c){var m={exports:{}},r=function(n){return w[n];};
|
||||
w[n]=c(r,m.exports,m)||m.exports;};})('drag',this));
|
||||
25
gaia/apps/camera/bower_components/drag/package.json
vendored
Executable file
25
gaia/apps/camera/bower_components/drag/package.json
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "drag",
|
||||
"version": "0.1.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "gaia-test-unit"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/gaia-components/drag.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/gaia-components/drag/issues"
|
||||
},
|
||||
"homepage": "https://github.com/gaia-components/drag",
|
||||
"dependencies": {
|
||||
"evt": "git://github.com/gaia-components/evt#v0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gaia-test": "git://github.com/gaia-components/gaia-test"
|
||||
}
|
||||
}
|
||||
28
gaia/apps/camera/bower_components/evt/.bower.json
vendored
Executable file
28
gaia/apps/camera/bower_components/evt/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "evt",
|
||||
"main": "index.js",
|
||||
"version": "0.4.0",
|
||||
"homepage": "https://github.com/wilsonpage/evt",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"package.json",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
],
|
||||
"_release": "0.4.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.4.0",
|
||||
"commit": "3593dd6b4dd19f683d00fd0eaf2581c11a128da6"
|
||||
},
|
||||
"_source": "git://github.com/fxos-components/evt.git",
|
||||
"_target": "~0.4.0",
|
||||
"_originalSource": "fxos-components/evt"
|
||||
}
|
||||
19
gaia/apps/camera/bower_components/evt/bower.json
vendored
Executable file
19
gaia/apps/camera/bower_components/evt/bower.json
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "evt",
|
||||
"main": "index.js",
|
||||
"version": "0.4.0",
|
||||
"homepage": "https://github.com/wilsonpage/evt",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"package.json",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
154
gaia/apps/camera/bower_components/evt/index.js
vendored
Executable file
154
gaia/apps/camera/bower_components/evt/index.js
vendored
Executable file
|
|
@ -0,0 +1,154 @@
|
|||
|
||||
/**
|
||||
* Evt
|
||||
*
|
||||
* A super lightweight
|
||||
* event emitter library.
|
||||
*
|
||||
* @version 0.3.3
|
||||
* @author Wilson Page <wilson.page@me.com>
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
|
||||
/**
|
||||
* Locals
|
||||
*/
|
||||
|
||||
var proto = Events.prototype;
|
||||
var slice = [].slice;
|
||||
|
||||
/**
|
||||
* Creates a new event emitter
|
||||
* instance, or if passed an
|
||||
* object, mixes the event logic
|
||||
* into it.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
*/
|
||||
function Events(obj) {
|
||||
if (!(this instanceof Events)) return new Events(obj);
|
||||
if (obj) return mixin(obj, proto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a callback
|
||||
* with an event name.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} cb
|
||||
* @return {Event}
|
||||
*/
|
||||
proto.on = function(name, cb) {
|
||||
this._cbs = this._cbs || {};
|
||||
(this._cbs[name] || (this._cbs[name] = [])).push(cb);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach a callback that once
|
||||
* called, detaches itself.
|
||||
*
|
||||
* TODO: Implement `.off()` to work
|
||||
* with `once()` callbacks.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} cb
|
||||
* @public
|
||||
*/
|
||||
proto.once = function(name, cb) {
|
||||
this.on(name, one);
|
||||
function one() {
|
||||
cb.apply(this, arguments);
|
||||
this.off(name, one);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a single callback,
|
||||
* or all callbacks associated
|
||||
* with the passed event name.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} cb
|
||||
* @return {Event}
|
||||
*/
|
||||
proto.off = function(name, cb) {
|
||||
this._cbs = this._cbs || {};
|
||||
|
||||
if (!name) { this._cbs = {}; return; }
|
||||
if (!cb) { return delete this._cbs[name]; }
|
||||
|
||||
var cbs = this._cbs[name] || [];
|
||||
var i;
|
||||
|
||||
while (cbs && ~(i = cbs.indexOf(cb))) { cbs.splice(i, 1); }
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires an event, triggering
|
||||
* all callbacks registered on this
|
||||
* event name.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Event}
|
||||
*/
|
||||
proto.fire = proto.emit = function(options) {
|
||||
var cbs = this._cbs = this._cbs || {};
|
||||
var name = options.name || options;
|
||||
var batch = (cbs[name] || []).concat(cbs['*'] || []);
|
||||
var ctx = options.ctx || this;
|
||||
|
||||
if (batch.length) {
|
||||
this._fireArgs = arguments;
|
||||
var args = slice.call(arguments, 1);
|
||||
while (batch.length) {
|
||||
batch.shift().apply(ctx, args);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.firer = function(name) {
|
||||
var self = this;
|
||||
return function() {
|
||||
var args = slice.call(arguments);
|
||||
args.unshift(name);
|
||||
self.fire.apply(self, args);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Util
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mixes in the properties
|
||||
* of the second object into
|
||||
* the first.
|
||||
*
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
* @return {Object}
|
||||
*/
|
||||
function mixin(a, b) {
|
||||
for (var key in b) a[key] = b[key];
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose 'Event' (UMD)
|
||||
*/
|
||||
|
||||
if (typeof exports === 'object') {
|
||||
module.exports = Events;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(function(){ return Events; });
|
||||
} else {
|
||||
window.evt = Events;
|
||||
}
|
||||
|
||||
})();
|
||||
28
gaia/apps/camera/bower_components/font-fit/.bower.json
vendored
Executable file
28
gaia/apps/camera/bower_components/font-fit/.bower.json
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "font-fit",
|
||||
"main": "font-fit.js",
|
||||
"version": "0.3.1",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"README.md",
|
||||
"index.html",
|
||||
"package.json"
|
||||
],
|
||||
"homepage": "https://github.com/gaia-components/font-fit",
|
||||
"_release": "0.3.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.3.1",
|
||||
"commit": "07a497519b335a3d86a66268f990d8844b83d517"
|
||||
},
|
||||
"_source": "git://github.com/gaia-components/font-fit.git",
|
||||
"_target": "~0.3.0",
|
||||
"_originalSource": "gaia-components/font-fit"
|
||||
}
|
||||
18
gaia/apps/camera/bower_components/font-fit/bower.json
vendored
Executable file
18
gaia/apps/camera/bower_components/font-fit/bower.json
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "font-fit",
|
||||
"main": "font-fit.js",
|
||||
"version": "0.3.1",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"README.md",
|
||||
"index.html",
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue