From ba5f1feef4ad2b8d3846acbd5c80bb020b2d4352 Mon Sep 17 00:00:00 2001 From: Itay Weinberger Date: Fri, 15 May 2015 15:45:52 +0300 Subject: [PATCH] #171 don't load viz if not in browser. --- build/release/joola.js | 56682 +------------------------------ build/release/joola.min.css | 2 +- build/release/joola.min.js | 63 +- build/release/joola.min.js.map | 2 +- build/temp/joola.js | 56682 +------------------------------ src/lib/index.js | 4 +- src/lib/viz/BarTable.js | 2 +- src/lib/viz/Canvas.js | 2 +- src/lib/viz/DatePicker.js | 2 +- src/lib/viz/DimensionPicker.js | 2 +- src/lib/viz/FilterBox.js | 2 +- src/lib/viz/Gauge.js | 2 +- src/lib/viz/Metric.js | 2 +- src/lib/viz/MetricPicker.js | 2 +- src/lib/viz/Pie.js | 2 +- src/lib/viz/Table.js | 2 +- src/lib/viz/Timeline.js | 2 +- src/lib/viz/index.js | 2 +- 18 files changed, 712 insertions(+), 112747 deletions(-) diff --git a/build/release/joola.js b/build/release/joola.js index 9ebe052..06f9352 100644 --- a/build/release/joola.js +++ b/build/release/joola.js @@ -4560,373 +4560,7 @@ module.exports={"users":{"list":{"name":"/users/list","description":"I list all }()); }).call(this,require("FWaASH")) -},{"FWaASH":23}],3:[function(require,module,exports){ - -},{}],4:[function(require,module,exports){ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// 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 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. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try { - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":38}],5:[function(require,module,exports){ -module.exports=require(3) -},{}],6:[function(require,module,exports){ +},{"FWaASH":19}],3:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -6037,7 +5671,7 @@ function assert (test, message) { if (!test) throw new Error(message || 'Failed assertion') } -},{"base64-js":7,"ieee754":8}],7:[function(require,module,exports){ +},{"base64-js":4,"ieee754":5}],4:[function(require,module,exports){ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; ;(function (exports) { @@ -6159,7 +5793,7 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; exports.fromByteArray = uint8ToBase64 }(typeof exports === 'undefined' ? (this.base64js = {}) : exports)) -},{}],8:[function(require,module,exports){ +},{}],5:[function(require,module,exports){ exports.read = function(buffer, offset, isLE, mLen, nBytes) { var e, m, eLen = nBytes * 8 - mLen - 1, @@ -6245,7 +5879,7 @@ exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128; }; -},{}],9:[function(require,module,exports){ +},{}],6:[function(require,module,exports){ var Buffer = require('buffer').Buffer; var intSize = 4; var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); @@ -6282,7 +5916,7 @@ function hash(buf, fn, hashSize, bigEndian) { module.exports = { hash: hash }; -},{"buffer":6}],10:[function(require,module,exports){ +},{"buffer":3}],7:[function(require,module,exports){ var Buffer = require('buffer').Buffer var sha = require('./sha') var sha256 = require('./sha256') @@ -6381,7 +6015,7 @@ each(['createCredentials' } }) -},{"./md5":11,"./rng":12,"./sha":13,"./sha256":14,"buffer":6}],11:[function(require,module,exports){ +},{"./md5":8,"./rng":9,"./sha":10,"./sha256":11,"buffer":3}],8:[function(require,module,exports){ /* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. @@ -6546,7 +6180,7 @@ module.exports = function md5(buf) { return helpers.hash(buf, core_md5, 16); }; -},{"./helpers":9}],12:[function(require,module,exports){ +},{"./helpers":6}],9:[function(require,module,exports){ // Original code adapted from Robert Kieffer. // details at https://github.com/broofa/node-uuid (function() { @@ -6579,7 +6213,7 @@ module.exports = function md5(buf) { }()) -},{}],13:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ /* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 @@ -6682,7 +6316,7 @@ module.exports = function sha1(buf) { return helpers.hash(buf, core_sha1, 20, true); }; -},{"./helpers":9}],14:[function(require,module,exports){ +},{"./helpers":6}],11:[function(require,module,exports){ /** * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined @@ -6763,7 +6397,7 @@ module.exports = function sha256(buf) { return helpers.hash(buf, core_sha256, 32, true); }; -},{"./helpers":9}],15:[function(require,module,exports){ +},{"./helpers":6}],12:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -7066,7 +6700,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],16:[function(require,module,exports){ +},{}],13:[function(require,module,exports){ var http = module.exports; var EventEmitter = require('events').EventEmitter; var Request = require('./lib/request'); @@ -7205,7 +6839,7 @@ http.STATUS_CODES = { 510 : 'Not Extended', // RFC 2774 511 : 'Network Authentication Required' // RFC 6585 }; -},{"./lib/request":17,"events":15,"url":36}],17:[function(require,module,exports){ +},{"./lib/request":14,"events":12,"url":32}],14:[function(require,module,exports){ var Stream = require('stream'); var Response = require('./response'); var Base64 = require('Base64'); @@ -7396,7 +7030,7 @@ var indexOf = function (xs, x) { return -1; }; -},{"./response":18,"Base64":19,"inherits":21,"stream":29}],18:[function(require,module,exports){ +},{"./response":15,"Base64":16,"inherits":18,"stream":25}],15:[function(require,module,exports){ var Stream = require('stream'); var util = require('util'); @@ -7518,7 +7152,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{"stream":29,"util":38}],19:[function(require,module,exports){ +},{"stream":25,"util":34}],16:[function(require,module,exports){ ;(function () { var object = typeof exports != 'undefined' ? exports : this; // #8: web workers @@ -7580,7 +7214,7 @@ var isArray = Array.isArray || function (xs) { }()); -},{}],20:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ var http = require('http'); var https = module.exports; @@ -7595,7 +7229,7 @@ https.request = function (params, cb) { return http.request.call(this, params, cb); } -},{"http":16}],21:[function(require,module,exports){ +},{"http":13}],18:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -7620,235 +7254,7 @@ if (typeof Object.create === 'function') { } } -},{}],22:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPath(path)[3]; -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,require("FWaASH")) -},{"FWaASH":23}],23:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -7913,7 +7319,7 @@ process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; -},{}],24:[function(require,module,exports){ +},{}],20:[function(require,module,exports){ (function (global){ /*! http://mths.be/punycode v1.2.4 by @mathias */ ;(function(root) { @@ -8424,7 +7830,7 @@ process.chdir = function (dir) { }(this)); }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],25:[function(require,module,exports){ +},{}],21:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8510,7 +7916,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],26:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8597,13 +8003,13 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],27:[function(require,module,exports){ +},{}],23:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":25,"./encode":26}],28:[function(require,module,exports){ +},{"./decode":21,"./encode":22}],24:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8677,7 +8083,7 @@ function onend() { }); } -},{"./readable.js":32,"./writable.js":34,"inherits":21,"process/browser.js":30}],29:[function(require,module,exports){ +},{"./readable.js":28,"./writable.js":30,"inherits":18,"process/browser.js":26}],25:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8806,7 +8212,7 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"./duplex.js":28,"./passthrough.js":31,"./readable.js":32,"./transform.js":33,"./writable.js":34,"events":15,"inherits":21}],30:[function(require,module,exports){ +},{"./duplex.js":24,"./passthrough.js":27,"./readable.js":28,"./transform.js":29,"./writable.js":30,"events":12,"inherits":18}],26:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -8861,7 +8267,7 @@ process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; -},{}],31:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8904,7 +8310,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"./transform.js":33,"inherits":21}],32:[function(require,module,exports){ +},{"./transform.js":29,"inherits":18}],28:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -9841,7 +9247,7 @@ function indexOf (xs, x) { } }).call(this,require("FWaASH")) -},{"./index.js":29,"FWaASH":23,"buffer":6,"events":15,"inherits":21,"process/browser.js":30,"string_decoder":35}],33:[function(require,module,exports){ +},{"./index.js":25,"FWaASH":19,"buffer":3,"events":12,"inherits":18,"process/browser.js":26,"string_decoder":31}],29:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -10047,7 +9453,7 @@ function done(stream, er) { return stream.push(null); } -},{"./duplex.js":28,"inherits":21}],34:[function(require,module,exports){ +},{"./duplex.js":24,"inherits":18}],30:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -10435,7 +9841,7 @@ function endWritable(stream, state, cb) { state.ended = true; } -},{"./index.js":29,"buffer":6,"inherits":21,"process/browser.js":30}],35:[function(require,module,exports){ +},{"./index.js":25,"buffer":3,"inherits":18,"process/browser.js":26}],31:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -10628,7 +10034,7 @@ function base64DetectIncompleteChar(buffer) { return incomplete; } -},{"buffer":6}],36:[function(require,module,exports){ +},{"buffer":3}],32:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -11337,14 +10743,14 @@ function isNullOrUndefined(arg) { return arg == null; } -},{"punycode":24,"querystring":27}],37:[function(require,module,exports){ +},{"punycode":20,"querystring":23}],33:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],38:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -11934,7 +11340,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":37,"FWaASH":23,"inherits":21}],39:[function(require,module,exports){ +},{"./support/isBuffer":33,"FWaASH":19,"inherits":18}],35:[function(require,module,exports){ function replace(a, b) { if (!b) @@ -12185,7 +11591,7 @@ function foreach(object, block, context) return value; } */ -},{}],40:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ (function (Buffer){ /*! * Node.JS module "Deep Extend" @@ -12279,7 +11685,7 @@ var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { } }).call(this,require("buffer").Buffer) -},{"buffer":6}],41:[function(require,module,exports){ +},{"buffer":3}],37:[function(require,module,exports){ /*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 @@ -12854,7 +12260,7 @@ var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { } }(); -},{}],42:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ var jQuery = require('jquery'); /*! @@ -13178,7 +12584,7 @@ $.extend( $.ui, { })( jQuery ); -},{"jquery":44}],43:[function(require,module,exports){ +},{"jquery":40}],39:[function(require,module,exports){ var jQuery = require('jquery'); require('./core'); @@ -15221,7 +14627,7 @@ $.datepicker.version = "1.10.4"; })(jQuery); -},{"./core":42,"jquery":44}],44:[function(require,module,exports){ +},{"./core":38,"jquery":40}],40:[function(require,module,exports){ /*! * jQuery JavaScript Library v2.1.3 * http://jquery.com/ @@ -24428,55665 +23834,253 @@ return jQuery; })); -},{}],45:[function(require,module,exports){ -(function (process){ -var fs = require('fs'); -var path = require('path'); -var URL = require('url'); - -var toFileUrl = require('./jsdom/utils').toFileUrl; -var defineGetter = require('./jsdom/utils').defineGetter; -var defineSetter = require('./jsdom/utils').defineSetter; -var features = require('./jsdom/browser/documentfeatures'); -var dom = require('./jsdom/living'); -var browserAugmentation = require('./jsdom/browser/index').browserAugmentation; -var domToHtml = require('./jsdom/browser/domtohtml').domToHtml; -var VirtualConsole = require('./jsdom/virtual-console'); - -var canReadFilesFromFS = !!fs.readFile; // in a browserify environment, this isn't present - -var request = function() { // lazy loading request - request = require('request'); - return request.apply(undefined, arguments); -} - -exports.getVirtualConsole = function (window) { - return window._virtualConsole; -}; -exports.debugMode = false; - -// Proxy feature functions to features module. -['availableDocumentFeatures', - 'defaultDocumentFeatures', - 'applyDocumentFeatures'].forEach(function (propName) { - defineGetter(exports, propName, function () { - return features[propName]; - }); - defineSetter(exports, propName, function (val) { - return features[propName] = val; - }); -}); - -exports.jsdom = function (html, options) { - if (options === undefined) { - options = {}; - } - if (options.parsingMode === undefined || options.parsingMode === 'auto') { - options.parsingMode = 'html'; - } - - var browser = browserAugmentation(dom, options); - var doc = new browser.HTMLDocument(options); - - if (options.created) { - options.created(null, doc.parentWindow); - } +},{}],41:[function(require,module,exports){ +//! moment.js +//! version : 2.10.2 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com - features.applyDocumentFeatures(doc, options.features); +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.moment = factory() +}(this, function () { 'use strict'; - if (html === undefined) { - html = ''; - } - html = String(html); - doc.write(html); + var hookCallback; - if (doc.close && !options.deferClose) { - doc.close(); - } + function utils_hooks__hooks () { + return hookCallback.apply(null, arguments); + } - return doc; -}; + // This is done to register the method called with moment() + // without creating circular dependencies. + function setHookCallback (callback) { + hookCallback = callback; + } -exports.jQueryify = exports.jsdom.jQueryify = function (window, jqueryUrl, callback) { - if (!window || !window.document) { - return; - } + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty : false, + unusedTokens : [], + unusedInput : [], + overflow : -2, + charsLeftOver : 0, + nullInput : false, + invalidMonth : null, + invalidFormat : false, + userInvalidated : false, + iso : false + }; + } - var features = window.document.implementation._features; - window.document.implementation._addFeature('FetchExternalResources', ['script']); - window.document.implementation._addFeature('ProcessExternalResources', ['script']); - window.document.implementation._addFeature('MutationEvents', ['2.0']); + function isArray(input) { + return Object.prototype.toString.call(input) === '[object Array]'; + } - var scriptEl = window.document.createElement('script'); - scriptEl.className = 'jsdom'; - scriptEl.src = jqueryUrl; - scriptEl.onload = scriptEl.onerror = function () { - window.document.implementation._features = features; + function isDate(input) { + return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date; + } - if (callback) { - callback(window, window.jQuery); + function map(arr, fn) { + var res = [], i; + for (i = 0; i < arr.length; ++i) { + res.push(fn(arr[i], i)); + } + return res; } - }; - window.document.body.appendChild(scriptEl); -}; + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } -exports.env = exports.jsdom.env = function () { - var config = getConfigFromArguments(arguments); + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } + } - if (config.file && canReadFilesFromFS) { - fs.readFile(config.file, 'utf-8', function (err, text) { - if (err) { - if (config.created) { - config.created(err); + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; } - if (config.done) { - config.done([err]); + + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; } - return; - } - setParsingModeFromExtension(config, config.file); + return a; + } - config.html = text; - processHTML(config); - }); - } else if (config.html !== undefined) { - processHTML(config); - } else if (config.url) { - handleUrl(config); - } else if (config.somethingToAutodetect !== undefined) { - var url = URL.parse(config.somethingToAutodetect); - if (url.protocol && url.hostname) { - config.url = config.somethingToAutodetect; - handleUrl(config.somethingToAutodetect); - } else if (canReadFilesFromFS) { - fs.readFile(config.somethingToAutodetect, 'utf-8', function (err, text) { - if (err) { - // the toString() test is because in Node.js, there is no proper code for this. - // This is fixed in io.js: https://github.com/iojs/io.js/issues/517 so: - // TODO: remove when we start requiring io.js - if (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG' - || (err.toString() == 'Error: Path must be a string without null bytes.') - ) { - config.html = config.somethingToAutodetect; - processHTML(config); - } else { - if (config.created) { - config.created(err); - } - if (config.done) { - config.done([err]); - } - } - } else { - setParsingModeFromExtension(config, config.somethingToAutodetect); + function create_utc__createUTC (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); + } + + function valid__isValid(m) { + if (m._isValid == null) { + m._isValid = !isNaN(m._d.getTime()) && + m._pf.overflow < 0 && + !m._pf.empty && + !m._pf.invalidMonth && + !m._pf.nullInput && + !m._pf.invalidFormat && + !m._pf.userInvalidated; - config.html = text; - config.url = toFileUrl(config.somethingToAutodetect); - processHTML(config); + if (m._strict) { + m._isValid = m._isValid && + m._pf.charsLeftOver === 0 && + m._pf.unusedTokens.length === 0 && + m._pf.bigHour === undefined; + } } - }); - } else { - config.html = config.somethingToAutodetect; - processHTML(config); + return m._isValid; } - } - - function handleUrl() { - var options = { - uri: config.url, - encoding: config.encoding || 'utf8', - headers: config.headers || {}, - proxy: config.proxy || null, - jar: config.jar !== undefined ? config.jar : true - }; - request(options, function (err, res, responseText) { - if (err) { - if (config.created) { - config.created(err); + function valid__createInvalid (flags) { + var m = create_utc__createUTC(NaN); + if (flags != null) { + extend(m._pf, flags); } - if (config.done) { - config.done([err]); + else { + m._pf.userInvalidated = true; } - return; - } - // The use of `res.request.uri.href` ensures that `window.location.href` - // is updated when `request` follows redirects. - config.html = responseText; - config.url = res.request.uri.href; - - if (config.parsingMode === "auto" && ( - res.headers["content-type"] === "application/xml" || - res.headers["content-type"] === "text/xml" || - res.headers["content-type"] === "application/xhtml+xml")) { - config.parsingMode = "xml"; - } + return m; + } - processHTML(config); - }); - } -}; + var momentProperties = utils_hooks__hooks.momentProperties = []; -exports.serializeDocument = function (doc) { - return domToHtml(doc, true); -}; + function copyConfig(to, from) { + var i, prop, val; -function processHTML(config) { - var options = { - features: config.features, - url: config.url, - parser: config.parser, - parsingMode: config.parsingMode, - created: config.created, - resourceLoader: config.resourceLoader - }; + if (typeof from._isAMomentObject !== 'undefined') { + to._isAMomentObject = from._isAMomentObject; + } + if (typeof from._i !== 'undefined') { + to._i = from._i; + } + if (typeof from._f !== 'undefined') { + to._f = from._f; + } + if (typeof from._l !== 'undefined') { + to._l = from._l; + } + if (typeof from._strict !== 'undefined') { + to._strict = from._strict; + } + if (typeof from._tzm !== 'undefined') { + to._tzm = from._tzm; + } + if (typeof from._isUTC !== 'undefined') { + to._isUTC = from._isUTC; + } + if (typeof from._offset !== 'undefined') { + to._offset = from._offset; + } + if (typeof from._pf !== 'undefined') { + to._pf = from._pf; + } + if (typeof from._locale !== 'undefined') { + to._locale = from._locale; + } - if (config.document) { - options.referrer = config.document.referrer; - options.cookie = config.document.cookie; - options.cookieDomain = config.document.cookieDomain; - } + if (momentProperties.length > 0) { + for (i in momentProperties) { + prop = momentProperties[i]; + val = from[prop]; + if (typeof val !== 'undefined') { + to[prop] = val; + } + } + } - var window = exports.jsdom(config.html, options).parentWindow; - var features = JSON.parse(JSON.stringify(window.document.implementation._features)); + return to; + } - var docsLoaded = 0; - var totalDocs = config.scripts.length + config.src.length; - var readyState = null; - var errors = []; + var updateInProgress = false; - if (!window || !window.document) { - if (config.created) { - config.created(new Error('JSDOM: a window object could not be created.')); - } - if (config.done) { - config.done([new Error('JSDOM: a window object could not be created.')]); + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(+config._d); + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + utils_hooks__hooks.updateOffset(this); + updateInProgress = false; + } } - return; - } - window.document.implementation._addFeature('FetchExternalResources', ['script']); - window.document.implementation._addFeature('ProcessExternalResources', ['script']); - window.document.implementation._addFeature('MutationEvents', ['2.0']); + function isMoment (obj) { + return obj instanceof Moment || (obj != null && hasOwnProp(obj, '_isAMomentObject')); + } - function scriptComplete() { - docsLoaded++; + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; - if (docsLoaded >= totalDocs) { - window.document.implementation._features = features; + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + if (coercedNumber >= 0) { + value = Math.floor(coercedNumber); + } else { + value = Math.ceil(coercedNumber); + } + } - errors = errors.concat(window.document.errors || []); - if (errors.length === 0) { - errors = null; - } + return value; + } - process.nextTick(function() { - if (config.loaded) { - config.loaded(errors, window); - } - if (config.done) { - config.done(errors, window); + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ((dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { + diffs++; + } } - }); + return diffs + lengthDiff; } - } - function handleScriptError(e) { - if (!errors) { - errors = []; + function Locale() { } - errors.push(e.error || e.message); - - // nextTick so that an exception within scriptComplete won't cause - // another script onerror (which would be an infinite loop) - process.nextTick(scriptComplete); - } - if (config.scripts.length > 0 || config.src.length > 0) { - config.scripts.forEach(function (scriptSrc) { - var script = window.document.createElement('script'); - script.className = 'jsdom'; - script.onload = scriptComplete; - script.onerror = handleScriptError; - script.src = scriptSrc; + var locales = {}; + var globalLocale; - try { - // protect against invalid dom - // ex: http://www.google.com/foo#bar - window.document.documentElement.appendChild(script); - } catch (e) { - handleScriptError(e); - } - }); + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } - config.src.forEach(function (scriptText) { - var script = window.document.createElement('script'); - script.onload = scriptComplete; - script.onerror = handleScriptError; - script.text = scriptText; + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, j, next, locale, split; - window.document.documentElement.appendChild(script); - window.document.documentElement.removeChild(script); - }); - } else { - if (window.document.readyState === 'complete') { - scriptComplete(); - } else { - window.addEventListener('load', function() { - scriptComplete(); - }); - } - } -} - -function getConfigFromArguments(args, callback) { - var config = {}; - if (typeof args[0] === 'object') { - var configToClone = args[0]; - Object.keys(configToClone).forEach(function (key) { - config[key] = configToClone[key]; - }); - } else { - var stringToAutodetect = null; - - Array.prototype.forEach.call(args, function (arg) { - switch (typeof arg) { - case 'string': - config.somethingToAutodetect = arg; - break; - case 'function': - config.done = arg; - break; - case 'object': - if (Array.isArray(arg)) { - config.scripts = arg; - } else { - extend(config, arg); - } - break; - } - }); - } - - if (!config.done && !config.created && !config.loaded) { - throw new Error('Must pass a "created", "loaded", "done" option or a callback to jsdom.env.'); - } - - if (config.somethingToAutodetect === undefined && - config.html === undefined && !config.file && !config.url) { - throw new Error('Must pass a "html", "file", or "url" option, or a string, to jsdom.env'); - } - - config.scripts = ensureArray(config.scripts); - config.src = ensureArray(config.src); - config.parsingMode = config.parsingMode || "auto"; - - config.features = config.features || { - FetchExternalResources: false, - ProcessExternalResources: false, - SkipExternalResources: false - }; - - if (!config.url && config.file) { - config.url = toFileUrl(config.file); - } - - return config; -} - -function ensureArray(value) { - var array = value || []; - if (typeof array === 'string') { - array = [array]; - } - return array; -} - -function extend(config, overrides) { - Object.keys(overrides).forEach(function (key) { - config[key] = overrides[key]; - }); -} - -function setParsingModeFromExtension(config, filename) { - if (config.parsingMode === "auto") { - var ext = path.extname(filename); - if (ext === ".xhtml" || ext === ".xml") { - config.parsingMode = "xml"; - } - } -} - -}).call(this,require("FWaASH")) -},{"./jsdom/browser/documentfeatures":48,"./jsdom/browser/domtohtml":49,"./jsdom/browser/index":52,"./jsdom/living":71,"./jsdom/utils":77,"./jsdom/virtual-console":78,"FWaASH":23,"fs":3,"path":22,"request":83,"url":36}],46:[function(require,module,exports){ -(function (process,global){ -"use strict"; - -var URL = require("url"); -var CSSStyleDeclaration = require("cssstyle").CSSStyleDeclaration; -var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; -var dom = require("../level1/core"); -var NOT_IMPLEMENTED = require("./utils").NOT_IMPLEMENTED; -var createFrom = require("../utils").createFrom; -var History = require("./history"); -var VirtualConsole = require("../virtual-console"); - -var cssSelectorSplitRE = /((?:[^,"']|"[^"]*"|'[^']*')+)/; - -function matchesDontThrow(el, selector) { - try { - return el.matches(selector); - } catch (e) { - return false; - } -} - -function startTimer(window, startFn, stopFn, callback, ms) { - var res = startFn(callback, ms); - window.__timers.push([res, stopFn]); - return res; -} - -function stopTimer(window, id) { - if (typeof id === "undefined") { - return; - } - for (var i in window.__timers) { - if (window.__timers[i][0] === id) { - window.__timers[i][1].call(window, id); - window.__timers.splice(i, 1); - break; - } - } -} - -function stopAllTimers(window) { - window.__timers.forEach(function (t) { - t[1].call(window, t[0]); - }); - window.__timers = []; -} - -function Window(document) { - this.__timers = []; - - // TODO: very little of this belongs on the instance; they should be prototype methods instead. - - var window = this; - this._document = document; - this.history = new History(this); - - this.addEventListener = function () { - dom.Node.prototype.addEventListener.apply(window, arguments); - }; - this.removeEventListener = function () { - dom.Node.prototype.removeEventListener.apply(window, arguments); - }; - this.dispatchEvent = function () { - dom.Node.prototype.dispatchEvent.apply(window, arguments); - }; - this.raise = function () { - dom.Node.prototype.raise.apply(window.document, arguments); - }; - - this.setTimeout = function (fn, ms) { return startTimer(window, setTimeout, clearTimeout, fn, ms); }; - this.setInterval = function (fn, ms) { return startTimer(window, setInterval, clearInterval, fn, ms); }; - this.clearInterval = stopTimer.bind(this, window); - this.clearTimeout = stopTimer.bind(this, window); - this.__stopAllTimers = stopAllTimers.bind(this, window); - this.Image = function (width, height) { - var element = window._document.createElement("img"); - element.width = width; - element.height = height; - return element; - }; - - this._virtualConsole = new VirtualConsole(); - - function wrapConsoleMethod(method) { - return function () { - var args = Array.prototype.slice.call(arguments); - window._virtualConsole.emit.apply(window._virtualConsole, [method].concat(args)); - }; - } - - this.console = { - assert: wrapConsoleMethod("assert"), - clear: wrapConsoleMethod("clear"), - count: wrapConsoleMethod("count"), - debug: wrapConsoleMethod("debug"), - error: wrapConsoleMethod("error"), - group: wrapConsoleMethod("group"), - groupCollapse: wrapConsoleMethod("groupCollapse"), - groupEnd: wrapConsoleMethod("groupEnd"), - info: wrapConsoleMethod("info"), - log: wrapConsoleMethod("log"), - table: wrapConsoleMethod("table"), - time: wrapConsoleMethod("time"), - timeEnd: wrapConsoleMethod("timeEnd"), - trace: wrapConsoleMethod("trace"), - warn: wrapConsoleMethod("warn") - }; - - this.XMLHttpRequest = function () { - var xhr = new XMLHttpRequest(); - var lastUrl = ""; - xhr._open = xhr.open; - xhr.open = function (method, url, async, user, password) { - url = URL.resolve(window.document.URL, url); - lastUrl = url; - return xhr._open(method, url, async, user, password); - }; - xhr._send = xhr.send; - xhr.send = function (data) { - if (window.document.cookie) { - var cookieDomain = window.document._cookieDomain; - var url = URL.parse(lastUrl); - var host = url.host.split(":")[0]; - if (host.indexOf(cookieDomain, host.length - cookieDomain.length) !== -1) { - xhr.setDisableHeaderCheck(true); - xhr.setRequestHeader("cookie", window.document.cookie); - xhr.setDisableHeaderCheck(false); - } - } - return xhr._send(data); - }; - return xhr; - }; -} - -Window.prototype = createFrom(dom || null, { - constructor: Window, - // This implements window.frames.length, since window.frames returns a - // self reference to the window object. This value is incremented in the - // HTMLFrameElement init function (see: level2/html.js). - _length: 0, - get length() { - return this._length; - }, - get document() { - return this._document; - }, - get location() { - return this._document._location; - }, - close: function () { - // Recursively close child frame windows, then ourselves. - var currentWindow = this; - (function windowCleaner(window) { - var i; - // We could call window.frames.length etc, but window.frames just points - // back to window. - if (window.length > 0) { - for (i = 0; i < window.length; i++) { - windowCleaner(window[i]); - } - } - // We"re already in our own window.close(). - if (window !== currentWindow) { - window.close(); - } - })(this); - - if (this._document) { - if (this._document.body) { - this._document.body.innerHTML = ""; - } - - if (this._document.close) { - // We need to empty out the event listener array because - // document.close() causes "load" event to re-fire. - this._document._listeners = []; - this._document.close(); - } - delete this._document; - } - - stopAllTimers(currentWindow); - // Clean up the window"s execution context. - // dispose() is added by Contextify. - this.dispose(); - }, - getComputedStyle: function (node) { - var s = node.style, - cs = new CSSStyleDeclaration(), - forEach = Array.prototype.forEach; - - function setPropertiesFromRule(rule) { - if (!rule.selectorText) { - return; - } - - var selectors = rule.selectorText.split(cssSelectorSplitRE); - var matched = false; - selectors.forEach(function (selectorText) { - if (selectorText !== "" && selectorText !== "," && !matched && matchesDontThrow(node, selectorText)) { - matched = true; - forEach.call(rule.style, function (property) { - cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property)); - }); - } - }); - } - - forEach.call(node.ownerDocument.styleSheets, function (sheet) { - forEach.call(sheet.cssRules, function (rule) { - if (rule.media) { - if (Array.prototype.indexOf.call(rule.media, "screen") !== -1) { - forEach.call(rule.cssRules, setPropertiesFromRule); - } - } else { - setPropertiesFromRule(rule); - } - }); - }); - - forEach.call(s, function (property) { - cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property)); - }); - - return cs; - }, - - // TODO: all of the below data properties should be getters; right now they are shared between Window instances - // which is of course bad. - navigator: { - get userAgent() { return "Node.js (" + process.platform + "; U; rv:" + process.version + ")"; }, - get appName() { return "Node.js jsDom"; }, - get platform() { return process.platform; }, - get appVersion() { return process.version; }, - noUI: true, - get cookieEnabled() { return true; } - }, - - name: "nodejs", - innerWidth: 1024, - innerHeight: 768, - outerWidth: 1024, - outerHeight: 768, - pageXOffset: 0, - pageYOffset: 0, - screenX: 0, - screenY: 0, - screenLeft: 0, - screenTop: 0, - scrollX: 0, - scrollY: 0, - scrollTop: 0, - scrollLeft: 0, - alert: NOT_IMPLEMENTED("window.alert"), - blur: NOT_IMPLEMENTED("window.blur"), - confirm: NOT_IMPLEMENTED("window.confirm"), - createPopup: NOT_IMPLEMENTED("window.createPopup"), - focus: NOT_IMPLEMENTED("window.focus"), - moveBy: NOT_IMPLEMENTED("window.moveBy"), - moveTo: NOT_IMPLEMENTED("window.moveTo"), - open: NOT_IMPLEMENTED("window.open"), - print: NOT_IMPLEMENTED("window.print"), - prompt: NOT_IMPLEMENTED("window.prompt"), - resizeBy: NOT_IMPLEMENTED("window.resizeBy"), - resizeTo: NOT_IMPLEMENTED("window.resizeTo"), - scroll: NOT_IMPLEMENTED("window.scroll"), - scrollBy: NOT_IMPLEMENTED("window.scrollBy"), - scrollTo: NOT_IMPLEMENTED("window.scrollTo"), - screen: { - width: 0, - height: 0 - }, - - // Note: these will not be necessary for newer Node.js versions, which have - // typed arrays in V8 and thus on every global object. (That is, in newer - // versions we"ll get `ArrayBuffer` just as automatically as we get - // `Array`.) But to support older versions, we explicitly set them here. - Int8Array: global.Int8Array, - Int16Array: global.Int16Array, - Int32Array: global.Int32Array, - Float32Array: global.Float32Array, - Float64Array: global.Float64Array, - Uint8Array: global.Uint8Array, - Uint8ClampedArray: global.Uint8ClampedArray, - Uint16Array: global.Uint16Array, - Uint32Array: global.Uint32Array, - ArrayBuffer: global.ArrayBuffer -}); - -module.exports = Window; - -}).call(this,require("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../level1/core":56,"../utils":77,"../virtual-console":78,"./history":50,"./utils":54,"FWaASH":23,"cssstyle":102,"url":36,"xmlhttprequest":573}],47:[function(require,module,exports){ -//Tree traversing -exports.getFirstChild = function (node) { - return node.childNodes[0]; -}; - -exports.getChildNodes = function (node) { - return node.childNodes; -}; - -exports.getParentNode = function (node) { - return node.parentNode; -}; - -exports.getAttrList = function (node) { - return node.attributes; -}; - -//Node data -exports.getTagName = function (element) { - return element.tagName.toLowerCase(); -}; - -exports.getNamespaceURI = function (element) { - return element.namespaceURI || 'http://www.w3.org/1999/xhtml'; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.nodeValue; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.nodeValue; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode.name; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode.publicId || null; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode.systemId || null; -}; - -//Node types -exports.isTextNode = function (node) { - return node.nodeName === '#text'; -}; - -exports.isCommentNode = function (node) { - return node.nodeName === '#comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.nodeType === 10; -}; - -exports.isElementNode = function (node) { - return !!node.tagName; -}; - -},{}],48:[function(require,module,exports){ -exports.availableDocumentFeatures = [ - 'FetchExternalResources', - 'ProcessExternalResources', - 'MutationEvents', - 'SkipExternalResources' -]; - -exports.defaultDocumentFeatures = { - "FetchExternalResources": ['script', 'link'/*, 'img', 'css', 'frame'*/], - "ProcessExternalResources": ['script'/*, 'frame', 'iframe'*/], - "MutationEvents": '2.0', - "SkipExternalResources": false -}; - -exports.applyDocumentFeatures = function(doc, features) { - var i, maxFeatures = exports.availableDocumentFeatures.length, - defaultFeatures = exports.defaultDocumentFeatures, - j, - k, - featureName, - featureSource; - - features = features || {}; - - for (i=0; i= this.length) { - return; - } - - this._index = newIndex; - - var state = this._states[newIndex]; - - this._applyState(state); - this._signalPopstate(state); - }, - - pushState: function (data, title, url) { - var state = new StateEntry(data, title, url); - if (this._index + 1 !== this._states.length) { - this._states = this._states.slice(0, this._index + 1); - } - this._states.push(state); - this._applyState(state); - this._index++; - }, - - replaceState: function (data, title, url) { - var state = new StateEntry(data, title, url); - this._states[this._index] = state; - this._applyState(state); - }, - - _applyState: function (state) { - this._location._url = URL.parse(resolveHref(this._location._url.href, state.url)); - }, - - _signalPopstate: function(state) { - if (this._window.document) { - var ev = this._window.document.createEvent("HTMLEvents"); - ev.initEvent("popstate", false, false); - ev.state = state.data; - process.nextTick(function () { - this._window.dispatchEvent(ev); - }.bind(this)); - } - }, - - toString: function () { - return "[object History]"; - } -}; - -}).call(this,require("FWaASH")) -},{"../utils":77,"FWaASH":23,"url":36}],51:[function(require,module,exports){ -var parse5 = require('parse5'); -var htmlparser2 = require('htmlparser2'); - -function HtmlToDom(parser, parsingMode) { - if (!parser) { - if (parsingMode === "xml") { - parser = htmlparser2; - } else { - parser = parse5; - } - } - - if (parser.DefaultHandler || (parser.Parser && parser.TreeAdapters)) { - - // Forgiving HTML parser - - if (parser.DefaultHandler){ - // fb55/htmlparser2 - - parser.ParseHtml = function(rawHtml) { - var handler = new parser.DefaultHandler(); - // Check if document is XML - var isXML = parsingMode === "xml"; - var parserInstance = new parser.Parser(handler, { - xmlMode: isXML, - lowerCaseTags: !isXML, - lowerCaseAttributeNames: !isXML, - decodeEntities: true - }); - - parserInstance.includeLocation = false; - parserInstance.parseComplete(rawHtml); - return handler.dom; - }; - } else if (parser.Parser && parser.TreeAdapters) { - parser.ParseHtml = function (rawHtml) { - if (parsingMode === 'xml') { - throw new Error('Can\'t parse XML with parse5, please use htmlparser2 instead.'); - } - var instance = new parser.Parser(parser.TreeAdapters.htmlparser2); - var dom = instance.parse(rawHtml); - return dom.children; - }; - } - - this.appendHtmlToElement = function(html, element) { - - if (typeof html !== 'string') { - html +=''; - } - - var parsed = parser.ParseHtml(html); - - for (var i = 0; i < parsed.length; i++) { - setChild(element, parsed[i]); - } - - return element; - }; - this.appendHtmlToDocument = this.appendHtmlToElement; - - if (parser.Parser && parser.TreeAdapters) { - this.appendHtmlToElement = function (html, element) { - - if (typeof html !== 'string') { - html += ''; - } - - var instance = new parser.Parser(parser.TreeAdapters.htmlparser2); - var parentElement = parser.TreeAdapters.htmlparser2.createElement(element.tagName.toLowerCase(), element.namespaceURI, []); - var dom = instance.parseFragment(html, parentElement); - var parsed = dom.children; - - for (var i = 0; i < parsed.length; i++) { - setChild(element, parsed[i]); - } - - return element; - }; - } - - } else if (parser.moduleName == 'HTML5') { /* HTML5 parser */ - this.appendHtmlToElement = function(html, element) { - - if (typeof html !== 'string') { - html += ''; - } - if (html.length > 0) { - if (element.nodeType == 9) { - new parser.Parser({document: element}).parse(html); - } - else { - var p = new parser.Parser({document: element.ownerDocument}); - p.parse_fragment(html, element); - } - } - }; - } else { - this.appendHtmlToElement = function () { - console.log(''); - console.log('###########################################################'); - console.log('# WARNING: No compatible HTML parser was given.'); - console.log('# Element.innerHTML setter support has been disabled'); - console.log('# Element.innerHTML getter support will still function'); - console.log('###########################################################'); - console.log(''); - }; - } -}; - -// utility function for forgiving parser -function setChild(parent, node) { - - var c, newNode, currentDocument = parent._ownerDocument || parent; - - switch (node.type) - { - case 'tag': - case 'script': - case 'style': - try { - newNode = currentDocument._createElementNoTagNameValidation(node.name); - newNode._namespaceURI = node.namespace || "http://www.w3.org/1999/xhtml"; - if (node.location) { - newNode.sourceLocation = node.location; - newNode.sourceLocation.file = parent.sourceLocation.file; - } - } catch (err) { - currentDocument.raise('error', 'invalid markup', { - exception: err, - node : node - }); - - return null; - } - break; - - case 'root': - // If we are in