We believe that the free version of Invoice Ninja is a truly awesome product loaded
+ with the key features you need to bill your clients electronically. But for those who
+ crave still more Ninja awesomeness, we've unmasked the Invoice Ninja Pro plan, which
+ offers more versatility, power and customization options for just $50 per year.
+
+
+
+
+
+
+
+
+
Number of clients per account
+
Unlimited client invoices
+
Add your company logo
+
Live .PDF invoice creation
+
4 beatiful invoice templates
+
Accept credit card payments
+
Custom invoice fields
+
Priority email support
+
Custom invoice colors
+
Remove "Created by Invoice Ninja"
+
Pricing
+
+
+
+
+
Free
+
Number of clients per account
500
+
Unlimited client invoices
+
Add your company logo
+
Live .PDF invoice creation
+
4 beatiful invoice templates
+
Accept credit card payments
+
Custom invoice fields
+
Priority email support
+
Custom invoice colors
+
Remove "Created by Invoice Ninja"
+
Pricing
Free /Always!
+
+
+
+
Pro Plan
+
Number of clients per account
5,000
+
Unlimited client invoices
+
Add your company logo
+
Live .PDF invoice creation
+
4 beatiful invoice templates
+
Accept credit card payments
+
Custom invoice fields
+
Priority email support
+
Custom invoice colors
+
Remove "Created by Invoice Ninja"
+
Pricing
$50 /Year
+
+
+
+
+
+
diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php
index 9f2db4ec9626..c5c18414b390 100755
--- a/app/views/invoices/edit.blade.php
+++ b/app/views/invoices/edit.blade.php
@@ -505,7 +505,9 @@
}); //.trigger('change');
$('#terms, #public_notes, #invoice_number, #invoice_date, #due_date, #po_number, #discount, #currency_id, #invoice_design_id, #recurring').change(function() {
- refreshPDF();
+ setTimeout(function() {
+ refreshPDF();
+ }, 1);
});
@if ($client || $invoice)
diff --git a/app/views/master.blade.php b/app/views/master.blade.php
index 0be69f72b584..419a719e164e 100755
--- a/app/views/master.blade.php
+++ b/app/views/master.blade.php
@@ -20,6 +20,7 @@
+
@@ -65,6 +66,7 @@
@yield('body')
+
+
@stop
@section('content')
diff --git a/public/built.css b/public/built.css
index 0f2c8dace270..8e79ad2f4c0a 100644
--- a/public/built.css
+++ b/public/built.css
@@ -2238,6 +2238,66 @@ div.fb_iframe_widget > span {
font-size:9px;
}
+
+.plans-table {float: none; margin-top: 10px; }
+.plans-table div {text-align:center; margin: 0 auto; }
+
+.plans-table .free, .plans-table .desc { padding: 0; }
+.plans-table .free .cell { padding-right: 15px; }
+.plans-table .desc .cell { text-align: right; padding-right: 15px; border-left: 1px solid #dfe0e1; font-size: 13px; font-weight: 800; }
+.plans-table .pro .cell { border-left: 1px solid #cccccc; border-right: 1px solid #cccccc;}
+
+
+.plans-table .cell {background-color: #fff; border-top: 1px solid #dfe0e1;padding: 18px 0; font-family: Roboto, sans-serif; height: 60px;}
+.plans-table .cell:nth-child(odd){background-color: #fbfbfb;}
+.plans-table .pro .cell:nth-child(odd){background-color: #f4f4f4;}
+.plans-table .pro {
+ background-color: #2299c0;
+ overflow:hidden;
+ padding: 0;
+-webkit-box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+-moz-box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+}
+
+.plans-table .free .cell:first-child, .plans-table .pro .cell:first-child {color: #fff; text-transform: uppercase; font-size: 24px; font-weight:800; line-height: 60px; padding: 0; position: relative; bottom: -1px; border: none;}
+.plans-table .free .cell:first-child {background-color: #9b9b9b; margin-right: 15px; padding-right: 0;}
+.plans-table .free, .plans-table .desc {border-bottom: 1px solid #dfe0e1;}
+.plans-table .pro .cell:first-child {background-color: #2299c0;}
+.plans-table .pro .cell:last-child {padding: 0; border: none;}
+.plans-table .desc .cell:first-child {background-color: transparent; border: none;}
+
+.plans-table .glyphicon {color: #fff; border-radius: 50px; padding: 5px; font-size: 10px;}
+.plans-table .glyphicon-remove {background-color: #da4830;}
+.plans-table .glyphicon-ok {background-color: #35c156;}
+.plans-table .glyphicon-star {border-radius: 0; background-color: #2e2b2b;
+ display: block;
+ width: 60px;
+ height: 30px;
+ position: absolute;
+ top: -5px;
+ right: -20px;
+ -webkit-transform: rotate(45deg);
+ -moz-transform: rotate(45deg);
+ -o-transform: rotate(45deg);
+ transform: rotate(45deg);
+ padding: 13px 0 0 1px;
+}
+
+.plans-table .price {padding: 0; }
+.plans-table .free .price p {color: #35c156;}
+.plans-table .pro .price p {color: #2299c0;}
+.plans-table .price p {font-size: 40px; text-transform: uppercase; font-weight: 800; margin: 0; line-height: 55px;}
+.plans-table .price p span {font-size: 16px; text-transform: none; font-weight: 400;}
+
+.plans-table a .cta h2 {background: #2299c0; color:#fff; margin: 0;}
+.plans-table a .cta h2 span {background: #1e84a5;}
+
+
+@media screen and (min-width: 769px) {
+ .hide-desktop {display: none;}
+}
+
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
@@ -2246,4 +2306,11 @@ div.fb_iframe_widget > span {
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffffff;
}
-}
\ No newline at end of file
+
+ .plans-table .cell {height: auto; padding: 14px 0; }
+ .plans-table .free .cell { padding-right: 0; }
+ .plans-table .free .cell:first-child {margin-right: 0;}
+ .plans-table .cell div:first-child {margin-bottom: 5px;}
+ .plans-table .cell .cta {margin-bottom: 0 !important;}
+ .plans-table .pro {margin-top: 40px;}
+}
diff --git a/public/built.js b/public/built.js
index 4e91914cb5f1..33a91ab71963 100644
--- a/public/built.js
+++ b/public/built.js
@@ -37107,9 +37107,9 @@ function displayInvoiceItems(doc, invoice, layout) {
y += 4;
if (invoice.invoice_design_id == 1) {
- SetPdfColor('LightBlue', doc);
+ SetPdfColor('LightBlue', doc, 'primary');
} else if (invoice.invoice_design_id == 2) {
- SetPdfColor('SomeGreen', doc);
+ SetPdfColor('SomeGreen', doc, 'primary');
} else if (invoice.invoice_design_id == 3) {
doc.setFontType('bold');
} else {
diff --git a/public/css/style.css b/public/css/style.css
index 7fa1166064d2..7f06998b61db 100755
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -641,6 +641,66 @@ div.fb_iframe_widget > span {
font-size:9px;
}
+
+.plans-table {float: none; margin-top: 10px; }
+.plans-table div {text-align:center; margin: 0 auto; }
+
+.plans-table .free, .plans-table .desc { padding: 0; }
+.plans-table .free .cell { padding-right: 15px; }
+.plans-table .desc .cell { text-align: right; padding-right: 15px; border-left: 1px solid #dfe0e1; font-size: 13px; font-weight: 800; }
+.plans-table .pro .cell { border-left: 1px solid #cccccc; border-right: 1px solid #cccccc;}
+
+
+.plans-table .cell {background-color: #fff; border-top: 1px solid #dfe0e1;padding: 18px 0; font-family: Roboto, sans-serif; height: 60px;}
+.plans-table .cell:nth-child(odd){background-color: #fbfbfb;}
+.plans-table .pro .cell:nth-child(odd){background-color: #f4f4f4;}
+.plans-table .pro {
+ background-color: #2299c0;
+ overflow:hidden;
+ padding: 0;
+-webkit-box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+-moz-box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
+}
+
+.plans-table .free .cell:first-child, .plans-table .pro .cell:first-child {color: #fff; text-transform: uppercase; font-size: 24px; font-weight:800; line-height: 60px; padding: 0; position: relative; bottom: -1px; border: none;}
+.plans-table .free .cell:first-child {background-color: #9b9b9b; margin-right: 15px; padding-right: 0;}
+.plans-table .free, .plans-table .desc {border-bottom: 1px solid #dfe0e1;}
+.plans-table .pro .cell:first-child {background-color: #2299c0;}
+.plans-table .pro .cell:last-child {padding: 0; border: none;}
+.plans-table .desc .cell:first-child {background-color: transparent; border: none;}
+
+.plans-table .glyphicon {color: #fff; border-radius: 50px; padding: 5px; font-size: 10px;}
+.plans-table .glyphicon-remove {background-color: #da4830;}
+.plans-table .glyphicon-ok {background-color: #35c156;}
+.plans-table .glyphicon-star {border-radius: 0; background-color: #2e2b2b;
+ display: block;
+ width: 60px;
+ height: 30px;
+ position: absolute;
+ top: -5px;
+ right: -20px;
+ -webkit-transform: rotate(45deg);
+ -moz-transform: rotate(45deg);
+ -o-transform: rotate(45deg);
+ transform: rotate(45deg);
+ padding: 13px 0 0 1px;
+}
+
+.plans-table .price {padding: 0; }
+.plans-table .free .price p {color: #35c156;}
+.plans-table .pro .price p {color: #2299c0;}
+.plans-table .price p {font-size: 40px; text-transform: uppercase; font-weight: 800; margin: 0; line-height: 55px;}
+.plans-table .price p span {font-size: 16px; text-transform: none; font-weight: 400;}
+
+.plans-table a .cta h2 {background: #2299c0; color:#fff; margin: 0;}
+.plans-table a .cta h2 span {background: #1e84a5;}
+
+
+@media screen and (min-width: 769px) {
+ .hide-desktop {display: none;}
+}
+
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
@@ -649,4 +709,11 @@ div.fb_iframe_widget > span {
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffffff;
}
-}
\ No newline at end of file
+
+ .plans-table .cell {height: auto; padding: 14px 0; }
+ .plans-table .free .cell { padding-right: 0; }
+ .plans-table .free .cell:first-child {margin-right: 0;}
+ .plans-table .cell div:first-child {margin-bottom: 5px;}
+ .plans-table .cell .cta {margin-bottom: 0 !important;}
+ .plans-table .pro {margin-top: 40px;}
+}
diff --git a/public/js/script.js b/public/js/script.js
index 03015294c8e7..0f2374e27ad1 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -1640,9 +1640,9 @@ function displayInvoiceItems(doc, invoice, layout) {
y += 4;
if (invoice.invoice_design_id == 1) {
- SetPdfColor('LightBlue', doc);
+ SetPdfColor('LightBlue', doc, 'primary');
} else if (invoice.invoice_design_id == 2) {
- SetPdfColor('SomeGreen', doc);
+ SetPdfColor('SomeGreen', doc, 'primary');
} else if (invoice.invoice_design_id == 3) {
doc.setFontType('bold');
} else {
diff --git a/public/vendor/.gitkeep b/public/vendor/.gitkeep
deleted file mode 100755
index e69de29bb2d1..000000000000
diff --git a/public/vendor/accounting/.bower.json b/public/vendor/accounting/.bower.json
deleted file mode 100644
index d31c9f8676fb..000000000000
--- a/public/vendor/accounting/.bower.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "accounting",
- "homepage": "https://github.com/josscrowcroft/accounting.js",
- "version": "0.3.2",
- "_release": "0.3.2",
- "_resolution": {
- "type": "version",
- "tag": "v0.3.2",
- "commit": "b14638fbec7a06cc7e87de0d7d7c8ea2a38d67f5"
- },
- "_source": "git://github.com/josscrowcroft/accounting.js.git",
- "_target": "~0.*",
- "_originalSource": "accounting"
-}
\ No newline at end of file
diff --git a/public/vendor/accounting/accounting.js b/public/vendor/accounting/accounting.js
deleted file mode 100644
index 6af704820ccf..000000000000
--- a/public/vendor/accounting/accounting.js
+++ /dev/null
@@ -1,411 +0,0 @@
-/*!
- * accounting.js v0.3.2
- * Copyright 2011, Joss Crowcroft
- *
- * Freely distributable under the MIT license.
- * Portions of accounting.js are inspired or borrowed from underscore.js
- *
- * Full details and documentation:
- * http://josscrowcroft.github.com/accounting.js/
- */
-
-(function(root, undefined) {
-
- /* --- Setup --- */
-
- // Create the local library object, to be exported or referenced globally later
- var lib = {};
-
- // Current version
- lib.version = '0.3.2';
-
-
- /* --- Exposed settings --- */
-
- // The library's settings configuration object. Contains default parameters for
- // currency and number formatting
- lib.settings = {
- currency: {
- symbol : "$", // default currency symbol is '$'
- format : "%s%v", // controls output: %s = symbol, %v = value (can be object, see docs)
- decimal : ".", // decimal point separator
- thousand : ",", // thousands separator
- precision : 2, // decimal places
- grouping : 3 // digit grouping (not implemented yet)
- },
- number: {
- precision : 0, // default precision on numbers is 0
- grouping : 3, // digit grouping (not implemented yet)
- thousand : ",",
- decimal : "."
- }
- };
-
-
- /* --- Internal Helper Methods --- */
-
- // Store reference to possibly-available ECMAScript 5 methods for later
- var nativeMap = Array.prototype.map,
- nativeIsArray = Array.isArray,
- toString = Object.prototype.toString;
-
- /**
- * Tests whether supplied parameter is a string
- * from underscore.js
- */
- function isString(obj) {
- return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
- }
-
- /**
- * Tests whether supplied parameter is a string
- * from underscore.js, delegates to ECMA5's native Array.isArray
- */
- function isArray(obj) {
- return nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]';
- }
-
- /**
- * Tests whether supplied parameter is a true object
- */
- function isObject(obj) {
- return toString.call(obj) === '[object Object]';
- }
-
- /**
- * Extends an object with a defaults object, similar to underscore's _.defaults
- *
- * Used for abstracting parameter handling from API methods
- */
- function defaults(object, defs) {
- var key;
- object = object || {};
- defs = defs || {};
- // Iterate over object non-prototype properties:
- for (key in defs) {
- if (defs.hasOwnProperty(key)) {
- // Replace values with defaults only if undefined (allow empty/zero values):
- if (object[key] == null) object[key] = defs[key];
- }
- }
- return object;
- }
-
- /**
- * Implementation of `Array.map()` for iteration loops
- *
- * Returns a new Array as a result of calling `iterator` on each array value.
- * Defers to native Array.map if available
- */
- function map(obj, iterator, context) {
- var results = [], i, j;
-
- if (!obj) return results;
-
- // Use native .map method if it exists:
- if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
-
- // Fallback for native .map:
- for (i = 0, j = obj.length; i < j; i++ ) {
- results[i] = iterator.call(context, obj[i], i, obj);
- }
- return results;
- }
-
- /**
- * Check and normalise the value of precision (must be positive integer)
- */
- function checkPrecision(val, base) {
- val = Math.round(Math.abs(val));
- return isNaN(val)? base : val;
- }
-
-
- /**
- * Parses a format string or object and returns format obj for use in rendering
- *
- * `format` is either a string with the default (positive) format, or object
- * containing `pos` (required), `neg` and `zero` values (or a function returning
- * either a string or object)
- *
- * Either string or format.pos must contain "%v" (value) to be valid
- */
- function checkCurrencyFormat(format) {
- var defaults = lib.settings.currency.format;
-
- // Allow function as format parameter (should return string or object):
- if ( typeof format === "function" ) format = format();
-
- // Format can be a string, in which case `value` ("%v") must be present:
- if ( isString( format ) && format.match("%v") ) {
-
- // Create and return positive, negative and zero formats:
- return {
- pos : format,
- neg : format.replace("-", "").replace("%v", "-%v"),
- zero : format
- };
-
- // If no format, or object is missing valid positive value, use defaults:
- } else if ( !format || !format.pos || !format.pos.match("%v") ) {
-
- // If defaults is a string, casts it to an object for faster checking next time:
- return ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = {
- pos : defaults,
- neg : defaults.replace("%v", "-%v"),
- zero : defaults
- };
-
- }
- // Otherwise, assume format was fine:
- return format;
- }
-
-
- /* --- API Methods --- */
-
- /**
- * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value
- * alias: accounting.`parse(string)`
- *
- * Decimal must be included in the regular expression to match floats (default: "."), so if the number
- * uses a non-standard decimal separator, provide it as the second argument.
- *
- * Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)
- *
- * Doesn't throw any errors (`NaN`s become 0) but this may change in future
- */
- var unformat = lib.unformat = lib.parse = function(value, decimal) {
- // Recursively unformat arrays:
- if (isArray(value)) {
- return map(value, function(val) {
- return unformat(val, decimal);
- });
- }
-
- // Fails silently (need decent errors):
- value = value || 0;
-
- // Return the value as-is if it's already a number:
- if (typeof value === "number") return value;
-
- // Default decimal point is "." but could be set to eg. "," in opts:
- decimal = decimal || ".";
-
- // Build regex to strip out everything except digits, decimal point and minus sign:
- var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]),
- unformatted = parseFloat(
- ("" + value)
- .replace(/\((.*)\)/, "-$1") // replace bracketed values with negatives
- .replace(regex, '') // strip out any cruft
- .replace(decimal, '.') // make sure decimal point is standard
- );
-
- // This will fail silently which may cause trouble, let's wait and see:
- return !isNaN(unformatted) ? unformatted : 0;
- };
-
-
- /**
- * Implementation of toFixed() that treats floats more like decimals
- *
- * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present
- * problems for accounting- and finance-related software.
- */
- var toFixed = lib.toFixed = function(value, precision) {
- precision = checkPrecision(precision, lib.settings.number.precision);
- var power = Math.pow(10, precision);
-
- // Multiply up by precision, round accurately, then divide and use native toFixed():
- return (Math.round(lib.unformat(value) * power) / power).toFixed(precision);
- };
-
-
- /**
- * Format a number, with comma-separated thousands and custom precision/decimal places
- *
- * Localise by overriding the precision and thousand / decimal separators
- * 2nd parameter `precision` can be an object matching `settings.number`
- */
- var formatNumber = lib.formatNumber = function(number, precision, thousand, decimal) {
- // Resursively format arrays:
- if (isArray(number)) {
- return map(number, function(val) {
- return formatNumber(val, precision, thousand, decimal);
- });
- }
-
- // Clean up number:
- number = unformat(number);
-
- // Build options object from second param (if object) or all params, extending defaults:
- var opts = defaults(
- (isObject(precision) ? precision : {
- precision : precision,
- thousand : thousand,
- decimal : decimal
- }),
- lib.settings.number
- ),
-
- // Clean up precision
- usePrecision = checkPrecision(opts.precision),
-
- // Do some calc:
- negative = number < 0 ? "-" : "",
- base = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + "",
- mod = base.length > 3 ? base.length % 3 : 0;
-
- // Format the number:
- return negative + (mod ? base.substr(0, mod) + opts.thousand : "") + base.substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : "");
- };
-
-
- /**
- * Format a number into currency
- *
- * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)
- * defaults: (0, "$", 2, ",", ".", "%s%v")
- *
- * Localise by overriding the symbol, precision, thousand / decimal separators and format
- * Second param can be an object matching `settings.currency` which is the easiest way.
- *
- * To do: tidy up the parameters
- */
- var formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {
- // Resursively format arrays:
- if (isArray(number)) {
- return map(number, function(val){
- return formatMoney(val, symbol, precision, thousand, decimal, format);
- });
- }
-
- // Clean up number:
- number = unformat(number);
-
- // Build options object from second param (if object) or all params, extending defaults:
- var opts = defaults(
- (isObject(symbol) ? symbol : {
- symbol : symbol,
- precision : precision,
- thousand : thousand,
- decimal : decimal,
- format : format
- }),
- lib.settings.currency
- ),
-
- // Check format (returns object with pos, neg and zero):
- formats = checkCurrencyFormat(opts.format),
-
- // Choose which format to use for this value:
- useFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero;
-
- // Return with currency symbol added:
- return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));
- };
-
-
- /**
- * Format a list of numbers into an accounting column, padding with whitespace
- * to line up currency symbols, thousand separators and decimals places
- *
- * List should be an array of numbers
- * Second parameter can be an object containing keys that match the params
- *
- * Returns array of accouting-formatted number strings of same length
- *
- * NB: `white-space:pre` CSS rule is required on the list container to prevent
- * browsers from collapsing the whitespace in the output strings.
- */
- lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {
- if (!list) return [];
-
- // Build options object from second param (if object) or all params, extending defaults:
- var opts = defaults(
- (isObject(symbol) ? symbol : {
- symbol : symbol,
- precision : precision,
- thousand : thousand,
- decimal : decimal,
- format : format
- }),
- lib.settings.currency
- ),
-
- // Check format (returns object with pos, neg and zero), only need pos for now:
- formats = checkCurrencyFormat(opts.format),
-
- // Whether to pad at start of string or after currency symbol:
- padAfterSymbol = formats.pos.indexOf("%s") < formats.pos.indexOf("%v") ? true : false,
-
- // Store value for the length of the longest string in the column:
- maxLength = 0,
-
- // Format the list according to options, store the length of the longest string:
- formatted = map(list, function(val, i) {
- if (isArray(val)) {
- // Recursively format columns if list is a multi-dimensional array:
- return lib.formatColumn(val, opts);
- } else {
- // Clean up the value
- val = unformat(val);
-
- // Choose which format to use for this value (pos, neg or zero):
- var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,
-
- // Format this value, push into formatted list and save the length:
- fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));
-
- if (fVal.length > maxLength) maxLength = fVal.length;
- return fVal;
- }
- });
-
- // Pad each number in the list and send back the column of numbers:
- return map(formatted, function(val, i) {
- // Only if this is a string (not a nested array, which would have already been padded):
- if (isString(val) && val.length < maxLength) {
- // Depending on symbol position, pad after symbol or at index 0:
- return padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(" "))) : (new Array(maxLength - val.length + 1).join(" ")) + val;
- }
- return val;
- });
- };
-
-
- /* --- Module Definition --- */
-
- // Export accounting for CommonJS. If being loaded as an AMD module, define it as such.
- // Otherwise, just add `accounting` to the global object
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = lib;
- }
- exports.accounting = lib;
- } else if (typeof define === 'function' && define.amd) {
- // Return the library as an AMD module:
- define([], function() {
- return lib;
- });
- } else {
- // Use accounting.noConflict to restore `accounting` back to its original value.
- // Returns a reference to the library's `accounting` object;
- // e.g. `var numbers = accounting.noConflict();`
- lib.noConflict = (function(oldAccounting) {
- return function() {
- // Reset the value of the root's `accounting` variable:
- root.accounting = oldAccounting;
- // Delete the noConflict method:
- lib.noConflict = undefined;
- // Return reference to the library to re-assign it:
- return lib;
- };
- })(root.accounting);
-
- // Declare `fx` on the root (global/window) object:
- root['accounting'] = lib;
- }
-
- // Root will be `window` in browser or `global` on the server:
-}(this));
diff --git a/public/vendor/accounting/accounting.min.js b/public/vendor/accounting/accounting.min.js
deleted file mode 100644
index 0fc755d38041..000000000000
--- a/public/vendor/accounting/accounting.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*!
- * accounting.js v0.3.2, copyright 2011 Joss Crowcroft, MIT license, http://josscrowcroft.github.com/accounting.js
- */
-(function(p,z){function q(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function m(a){return u?u(a):"[object Array]"===v.call(a)}function r(a){return"[object Object]"===v.call(a)}function s(a,b){var d,a=a||{},b=b||{};for(d in b)b.hasOwnProperty(d)&&null==a[d]&&(a[d]=b[d]);return a}function j(a,b,d){var c=[],e,h;if(!a)return c;if(w&&a.map===w)return a.map(b,d);for(e=0,h=a.length;ea?"-":"",g=parseInt(y(Math.abs(a||0),h),10)+"",l=3a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal))};c.formatColumn=function(a,b,d,i,e,h){if(!a)return[];var f=s(r(b)?b:{symbol:b,precision:d,thousand:i,decimal:e,format:h},c.settings.currency),g=x(f.format),l=g.pos.indexOf("%s")a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal));if(a.length>k)k=a.length;return a});return j(a,function(a){return q(a)&&a.length").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
accounting.js is a tiny JavaScript library for number, money and currency formatting, with optional excel-style column rendering (to line up symbols and decimals). It's lightweight, fully localisable and has zero dependencies.
The most basic function of this library is money-formatting numbers, with currency symbol, precision (places), and thousand/decimal separators:
-
// Default usage:
-accounting.formatMoney(12345678); // $12,345,678.00
-
-// European formatting (custom symbol and separators), could also use options object as second param:
-accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99
-
-// Negative values are formatted nicely, too:
-accounting.formatMoney(-500000, "£ ", 0); // £ -500,000
-
-// Simple `format` string allows control of symbol position [%v = value, %s = symbol]:
-accounting.formatMoney(5318008, { symbol: "GBP", format: "%v %s" }); // 5,318,008.00 GBP
-
formatColumn() - format a list of values for column-display
-
This table demonstrates how accounting.js can take a list of numbers and money-format them with padding to line up currency symbols and decimal places (NB: white-space:pre is needed for the browser to render the padded spaces):
-
-
-
-
Original Number:
-
With accounting.js:
-
Different settings:
-
European format:
-
Symbol after value:
-
-
-
-
-
// Format list of numbers for display:
-accounting.formatColumn([123.5, 3456.49, 777888.99, 12345678, -5432], "$ ");
-
-
formatNumber() - format a number with custom precision and localisation
-
The base function of the library, which takes any number or array of numbers, runs accounting.unformat() to remove any formatting, and returns the number(s) formatted with separated thousands and custom precision:
toFixed() - better rounding for floating point numbers
-
Implementation of toFixed() that treats floats more like decimal values than binary, fixing inconsistent precision rounding in JavaScript (where some .05 values round up, while others round down):
Enter any number into the box and choose currency. Uses accounting.formatMoney():
-
-
-
-
-
Result: $ 0.00
-
-
-
Column formatting:
-
-
Edit the values in the table to see how formatColumn() keeps them aligned:
-
-
-
-
-
$ 1,000,000.00
-
GBP 1,000,000
-
-
-
-
$ -5,000.00
-
GBP (5,000)
-
-
-
-
$ 0.00
-
GBP --
-
-
-
-
-
-
-
-
-
Instructions / How to use
-
1. Download the script and put it somewhere, then do this:
-
<script src="path/to/accounting.js"></script>
-
-<script type="text/javascript">
- // You can do this now:
- accounting.formatMoney(5318008);
-</script>
-
2. Check out the documentation and source-code for full method/parameter info if you get stuck.
-
-
-
-
-
Documentation
-
Information on the parameters of each method. See library methods above for more examples. Optional parameters are in [italics], with the default value indicated.
-
-
-
accounting.settings
-
// Settings object that controls default parameters for library methods:
-accounting.settings = {
- currency: {
- symbol : "$", // default currency symbol is '$'
- format: "%s%v", // controls output: %s = symbol, %v = value/number (can be object: see below)
- decimal : ".", // decimal point separator
- thousand: ",", // thousands separator
- precision : 2 // decimal places
- },
- number: {
- precision : 0, // default precision on numbers is 0
- thousand: ",",
- decimal : "."
- }
-}
-
-// These can be changed externally to edit the library's defaults:
-accounting.settings.currency.format = "%s %v";
-
-// Format can be an object, with `pos`, `neg` and `zero`:
-accounting.settings.currency.format = {
- pos : "%s %v", // for positive values, eg. "$ 1.00" (required)
- neg : "%s (%v)", // for negative values, eg. "$ (1.00)" [optional]
- zero: "%s -- " // for zero values, eg. "$ --" [optional]
-};
-
-// Example using underscore.js - extend default settings (also works with $.extend in jQuery):
-accounting.settings.number = _.defaults({
- precision: 2,
- thousand: " "
-}, accounting.settings.number);
-
-
-
accounting.formatMoney()
-
// Standard usage and parameters (returns string):
-accounting.formatMoney(number,[symbol = "$"],[precision = 2],[thousand = ","],[decimal = "."],[format = "%s%v"])
-
-// Second parameter can be an object:
-accounting.formatMoney(number, [options])
-
-// Available fields in options object, matching `settings.currency`:
-var options = {
- symbol : "$",
- decimal : ".",
- thousand: ",",
- precision : 2,
- format: "%s%v"
-};
-
-// Example usage:
-accounting.formatMoney(12345678); // $12,345,678.00
-accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99
-accounting.formatMoney(-500000, "£ ", 0); // £ -500,000
-
-// Example usage with options object:
-accounting.formatMoney(5318008, {
- symbol: "GBP",
- precision: 0,
- thousand: "·",
- format: {
- pos : "%s %v",
- neg : "%s (%v)",
- zero: "%s --"
- }
-});
-
-// Will recursively format an array of values:
-accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]]
-
-
-
-
accounting.formatColumn()
-
// Standard usage and parameters (returns array):
-accounting.formatColumn(list, [symbol = "$"],[precision = 2],[thousand = ","],[decimal = "."],[format = "%s%v"])
-
-// Second parameter can be an object (see formatNumber for available options):
-accounting.formatColumn(list, [options])
-
-// Example usage (NB. use a space after the symbol to add arbitrary padding to all values):
-var list = [123, 12345];
-accounting.formatColumn(list, "$ ", 0); // ["$ 123", "$ 12,345"]
-
-// List of numbers can be a multi-dimensional array (formatColumn is applied recursively):
-var list = [[1, 100], [900, 9]];
-accounting.formatColumn(list); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]
-
-
-
accounting.formatNumber()
-
// Standard usage and parameters (returns string):
-accounting.formatNumber(number, [precision = 0], [thousand = ","], [decimal = "."])
-
-// Second parameter can also be an object matching `settings.number`:
-accounting.formatNumber(number, [object])
-
-// Example usage:
-accounting.formatNumber(9876543); // 9,876,543
-accounting.formatNumber(4999.99, 2, ".", ","); // 4.999,99
-
-// Example usage with options object:
-accounting.formatNumber(5318008, {
- precision : 3,
- thousand : " "
-});
-
-// Will recursively format an array of values:
-accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]]
-
-
-
accounting.toFixed()
-
// Standard usage and parameters (returns string):
-accounting.toFixed(number, [precision = 0]);
-
-// Example usage:
-accounting.toFixed(0.615, 2); // "0.62"
-
-// Compare to regular JavaScript `Number.toFixed()` method:
-(0.615).toFixed(2); // "0.61"
-
-
-
accounting.unformat()
-
// Standard usage and parameters (returns number):
-accounting.unformat(string, [decimal]);
-
-// Example usage:
-accounting.unformat("GBP £ 12,345,678.90"); // 12345678.9
-
-// If a non-standard decimal separator was used (eg. a comma) unformat() will need it in order to work out
-// which part of the number is a decimal/float:
-accounting.unformat("€ 1.000.000,00", ","); // 1000000
accounting.js was made by Joss (that's me) in Hong Kong, for internal use in our enterprise analytics application at Demand Analytics. It seemed to be working pretty well, so I'm releasing it in the hope that other people and apps can make use of and contribute to it.
-
You can follow me on Twitter at @josscrowcroft, I mostly post about JS, HTML5, startups, Hong Kong and things I've built.
-
-
-
-
-
-
-
-
-
-
diff --git a/public/vendor/accounting/license b/public/vendor/accounting/license
deleted file mode 100644
index 13ba197d7290..000000000000
--- a/public/vendor/accounting/license
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2011 Joss Crowcroft
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/public/vendor/accounting/package.json b/public/vendor/accounting/package.json
deleted file mode 100644
index 2db80b804b00..000000000000
--- a/public/vendor/accounting/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name" : "accounting",
- "description" : "number, money and currency parsing/formatting library",
- "homepage": "http://josscrowcroft.github.com/accounting.js",
- "keywords" : ["accounting", "number", "money", "currency", "format", "utilities"],
- "author": "Joss Crowcroft (http://www.josscrowcroft.com)",
- "contributors" : [],
- "dependencies" : {},
- "repository" : {"type": "git", "url": "git://github.com/josscrowcroft/accounting.js.git"},
- "main" : "accounting.js",
- "version" : "0.3.2"
-}
\ No newline at end of file
diff --git a/public/vendor/accounting/readme.md b/public/vendor/accounting/readme.md
deleted file mode 100644
index 2e25b29a0a13..000000000000
--- a/public/vendor/accounting/readme.md
+++ /dev/null
@@ -1,75 +0,0 @@
-**accounting.js** is a tiny JavaScript library for number, money and currency parsing/formatting. It's lightweight and fully localisable, with zero dependencies, and works great as a nodeJS/npm and AMD/requireJS module.
-
-Check out the **[accounting.js homepage](http://josscrowcroft.github.com/accounting.js/)** for demos and documentation!
-
-Please checkout/download the latest stable tag before using in production. [Bug reports](https://github.com/josscrowcroft/accounting.js/issues) and pull requests hugely welcome.
-
-Made with love by [@josscrowcroft](http://twitter.com/josscrowcroft) and some excellent [contributors](https://github.com/josscrowcroft/accounting.js/contributors).
-
----
-
-### Also try:
-
-* **[money.js](http://josscrowcroft.github.com/money.js)** - a tiny (1kb) javascript currency conversion library, for web & nodeJS
-* **[open exchange rates](http://josscrowcroft.github.com/open-exchange-rates/)** - free / open source hourly-updated currency conversion data for everybody
-
----
-
-## Changelog
-
-**v0.3.2** - Fix package.json dependencies (should be empty object) and tweak comments
-
-**v0.3.0**
-
-* Rewrote library structure similar to underscore.js for use as a **nodeJS/npm** and **AMD/requireJS** module - now you can go `npm install accounting`, and then `var accounting = require("accounting");` in your nodeJS scripts.
-* **unformat** now only attempts to parse the number if it's not already a valid number. Also now aliased as `acounting.parse`
-* Fixed an IE bug in the `defaults` method
-
-**v0.2.2** - Fixed same issue as \#Num: #24 in **formatNumber**; switch to Google Closure Compiler for minified version.
-
-**v0.2.1** - Fixed issue \#Num: #24 where locally-defined settings object was being modified by **formatMoney** (still an issue in **formatNumber**)
-
-**v0.2**
-
-* Rewrote formatting system for **formatMoney** and **formatColumn**, to allow easier/better control of string output
-* Separate formats for negative and zero values now supported (optionally) via `accounting.settings.currency.format`
-* Internal improvements and helper methods
-
-**v0.1.4** - **formatMoney** recursively formats arrays; added Jasmine test suite (thx [millermedeiros](https://github.com/millermedeiros)!) and QUnit functionality/speed tests
-
-**v0.1.3**
-
-* Added configurable settings object for default formatting parameters.
-* Added `format` parameter to control symbol and value position (default `"%s%v"`, or [symbol][value])
-* Made methods more consistent in accepting an object as 2nd parameter, matching/overriding the library defaults
-
-**v0.1.2**
-
-* **formatColumn** works recursively on nested arrays, eg `accounting.formatColumn( [[1,12,123,1234], [1234,123,12,1]] )`, returns matching array with inner columns lined up
-* Another fix for rounding in **formatNumber**: `.535` now correctly rounds to ".54" instead of ".53"
-
-**v0.1.1**
-
-* Added **toFixed** method (`accounting.toFixed(value, precision)`), which treats floats more like decimals for more accurate currency rounding - now, `0.615` rounds up to `$0.62` instead of `$0.61`
-* Minified version preserves semicolons
-* Fixed NaN errors when no value in **unformat**
-
-**v0.1** - First version yo
-
-
----
-
-### Here's a neat little preview of **formatColumn()**:
-
-```html
- Original Number: | With accounting.js: | Different settings: | Symbol after value:
- -------------------+-------------------------+-------------------------+-----------------------
- 123.5 | $ 123.50 | HK$ 124 | 123.50 GBP
- 3456.615 | $ 3,456.62 | HK$ 3,457 | 3,456.62 GBP
- 777888.99 | $ 777,888.99 | HK$ 777,889 | 777,888.99 GBP
- -5432 | $ -5,432.00 | HK$ (5,432) | -5,432.00 GBP
- -1234567 | $ -1,234,567.00 | HK$ (1,234,567) | -1,234,567.00 GBP
- 0 | $ 0.00 | HK$ -- | 0.00 GBP
-```
-
-There's more demos and documentation on the **[accounting.js homepage](http://josscrowcroft.github.com/accounting.js/)**. Enjoy!
diff --git a/public/vendor/accounting/tests/jasmine/core/formatMoneySpec.js b/public/vendor/accounting/tests/jasmine/core/formatMoneySpec.js
deleted file mode 100644
index cbfe12df7573..000000000000
--- a/public/vendor/accounting/tests/jasmine/core/formatMoneySpec.js
+++ /dev/null
@@ -1,23 +0,0 @@
-describe('formatMoney()', function(){
-
- it('should work for small numbers', function(){
-
- expect( accounting.formatMoney(123) ).toBe( '$123.00' );
- expect( accounting.formatMoney(123.45) ).toBe( '$123.45' );
- expect( accounting.formatMoney(12345.67) ).toBe( '$12,345.67' );
-
- });
-
- it('should work for negative numbers', function(){
-
- expect( accounting.formatMoney(-123) ).toBe( '$-123.00' );
- expect( accounting.formatMoney(-123.45) ).toBe( '$-123.45' );
- expect( accounting.formatMoney(-12345.67) ).toBe( '$-12,345.67' );
-
- });
-
- it('should allow precision to be `0` and not override with default `2`', function(){
- expect( accounting.formatMoney(5318008, "$", 0) ).toBe( '$5,318,008' );
- });
-
-});
diff --git a/public/vendor/accounting/tests/jasmine/core/formatNumberSpec.js b/public/vendor/accounting/tests/jasmine/core/formatNumberSpec.js
deleted file mode 100644
index 6ee6a519f2b2..000000000000
--- a/public/vendor/accounting/tests/jasmine/core/formatNumberSpec.js
+++ /dev/null
@@ -1,132 +0,0 @@
-describe('formatNumber', function(){
-
- describe('rounding and enforce precision', function(){
-
- it('should enforce precision and round values', function(){
-
- expect( accounting.formatNumber(123.456789, 0) ).toBe( '123' );
- expect( accounting.formatNumber(123.456789, 1) ).toBe( '123.5' );
- expect( accounting.formatNumber(123.456789, 2) ).toBe( '123.46' );
- expect( accounting.formatNumber(123.456789, 3) ).toBe( '123.457' );
- expect( accounting.formatNumber(123.456789, 4) ).toBe( '123.4568' );
- expect( accounting.formatNumber(123.456789, 5) ).toBe( '123.45679' );
-
- });
-
- it('should fix floting point rounding error', function(){
-
- expect( accounting.formatNumber(0.615, 2) ).toBe( '0.62' );
- expect( accounting.formatNumber(0.614, 2) ).toBe( '0.61' );
-
- });
-
- it('should work for large numbers', function(){
-
- expect( accounting.formatNumber(123456.54321, 0) ).toBe( '123,457' );
- expect( accounting.formatNumber(123456.54321, 1) ).toBe( '123,456.5' );
- expect( accounting.formatNumber(123456.54321, 2) ).toBe( '123,456.54' );
- expect( accounting.formatNumber(123456.54321, 3) ).toBe( '123,456.543' );
- expect( accounting.formatNumber(123456.54321, 4) ).toBe( '123,456.5432' );
- expect( accounting.formatNumber(123456.54321, 5) ).toBe( '123,456.54321' );
-
- expect( accounting.formatNumber(98765432.12, 0) ).toBe( '98,765,432' );
- expect( accounting.formatNumber(98765432.12, 1) ).toBe( '98,765,432.1' );
- expect( accounting.formatNumber(98765432.12, 2) ).toBe( '98,765,432.12' );
- expect( accounting.formatNumber(98765432.12, 3) ).toBe( '98,765,432.120' );
- expect( accounting.formatNumber(98765432.12, 4) ).toBe( '98,765,432.1200' );
-
- });
-
- it('should work for negative numbers', function(){
-
- expect( accounting.formatNumber(-123456.54321, 0) ).toBe( '-123,457' );
- expect( accounting.formatNumber(-123456.54321, 1) ).toBe( '-123,456.5' );
- expect( accounting.formatNumber(-123456.54321, 2) ).toBe( '-123,456.54' );
- expect( accounting.formatNumber(-123456.54321, 3) ).toBe( '-123,456.543' );
- expect( accounting.formatNumber(-123456.54321, 4) ).toBe( '-123,456.5432' );
- expect( accounting.formatNumber(-123456.54321, 5) ).toBe( '-123,456.54321' );
-
- expect( accounting.formatNumber(-98765432.12, 0) ).toBe( '-98,765,432' );
- expect( accounting.formatNumber(-98765432.12, 1) ).toBe( '-98,765,432.1' );
- expect( accounting.formatNumber(-98765432.12, 2) ).toBe( '-98,765,432.12' );
- expect( accounting.formatNumber(-98765432.12, 3) ).toBe( '-98,765,432.120' );
- expect( accounting.formatNumber(-98765432.12, 4) ).toBe( '-98,765,432.1200' );
-
- });
-
- });
-
-
- describe('separators', function(){
-
- it('should allow setting thousands separator', function(){
- expect( accounting.formatNumber(98765432.12, 0, '|') ).toBe( '98|765|432' );
- expect( accounting.formatNumber(98765432.12, 1, '>') ).toBe( '98>765>432.1' );
- expect( accounting.formatNumber(98765432.12, 2, '*') ).toBe( '98*765*432.12' );
- expect( accounting.formatNumber(98765432.12, 3, '\'') ).toBe( '98\'765\'432.120' );
- expect( accounting.formatNumber(98765432.12, 4, ']') ).toBe( '98]765]432.1200' );
- });
-
-
- it('should allow setting decimal separator', function(){
- expect( accounting.formatNumber(98765432.12, 0, null, '|') ).toBe( '98,765,432' );
- expect( accounting.formatNumber(98765432.12, 1, null, '>') ).toBe( '98,765,432>1' );
- expect( accounting.formatNumber(98765432.12, 2, null, '*') ).toBe( '98,765,432*12' );
- expect( accounting.formatNumber(98765432.12, 3, null, '\'') ).toBe( '98,765,432\'120' );
- expect( accounting.formatNumber(98765432.12, 4, null, ']') ).toBe( '98,765,432]1200' );
- });
-
- it('should allow setting thousand and decimal separators', function(){
- expect( accounting.formatNumber(98765432.12, 0, '\\', '|') ).toBe( '98\\765\\432' );
- expect( accounting.formatNumber(98765432.12, 1, '<', '>') ).toBe( '98<765<432>1' );
- expect( accounting.formatNumber(98765432.12, 2, '&', '*') ).toBe( '98&765&432*12' );
- expect( accounting.formatNumber(98765432.12, 3, '"', '\'') ).toBe( '98"765"432\'120' );
- expect( accounting.formatNumber(98765432.12, 4, '[', ']') ).toBe( '98[765[432]1200' );
- });
-
- it('should use default separators if null', function(){
- expect( accounting.formatNumber(12345.12345, 2, null, null) ).toBe('12,345.12');
- });
-
- it('should use empty separators if passed as empty string', function(){
- expect( accounting.formatNumber(12345.12345, 2, '', '') ).toBe('1234512');
- });
-
- });
-
-
- describe('multiple numbers (array)', function(){
-
- it('should handle an array of numbers', function(){
-
- var vals = accounting.formatNumber([123, 456.78, 1234.123], 2);
-
- expect( vals[0] ).toBe( '123.00' );
- expect( vals[1] ).toBe( '456.78' );
- expect( vals[2] ).toBe( '1,234.12' );
- });
-
- });
-
- describe('properties object', function(){
-
- it('should accept a properties object', function(){
-
- var val = accounting.formatNumber(123456789.1234, {
- thousand : '.',
- decimal : ',',
- precision : 3
- });
-
- expect( val ).toBe( '123.456.789,123' );
- });
-
- it('properties should be optional', function(){
- var val = accounting.formatNumber(123456789.1234, {});
- expect( val ).toBe( '123,456,789' );
- });
-
- });
-
-
-});
diff --git a/public/vendor/accounting/tests/jasmine/core/unformatSpec.js b/public/vendor/accounting/tests/jasmine/core/unformatSpec.js
deleted file mode 100644
index 1f0f17e70fab..000000000000
--- a/public/vendor/accounting/tests/jasmine/core/unformatSpec.js
+++ /dev/null
@@ -1,31 +0,0 @@
-describe('unformat()', function(){
-
- it('should remove padding special chars', function(){
- expect( accounting.unformat('$ 123,456') ).toBe( 123456 );
- expect( accounting.unformat('$ 123,456.78') ).toBe( 123456.78 );
- expect( accounting.unformat('&*()$ 123,456') ).toBe( 123456 );
- expect( accounting.unformat(';$@#$%^&123,456.78') ).toBe( 123456.78 );
- });
-
- it('should work with negative numbers', function(){
- expect( accounting.unformat('$ -123,456') ).toBe( -123456 );
- expect( accounting.unformat('$ -123,456.78') ).toBe( -123456.78 );
- expect( accounting.unformat('&*()$ -123,456') ).toBe( -123456 );
- expect( accounting.unformat(';$@#$%^&-123,456.78') ).toBe( -123456.78 );
- });
-
- it('should accept different decimal separators', function(){
- expect( accounting.unformat('$ 123,456', ',') ).toBe( 123.456 );
- expect( accounting.unformat('$ 123456|78', '|') ).toBe( 123456.78 );
- expect( accounting.unformat('&*()$ 123>456', '>') ).toBe( 123.456 );
- expect( accounting.unformat(';$@#$%^&123,456\'78', '\'') ).toBe( 123456.78 );
- });
-
- it('should accept an array', function(){
- var vals = accounting.unformat(['$ 123', '$567.89', 'R$12,345,678.901']);
- expect( vals[0] ).toBe( 123 );
- expect( vals[1] ).toBe( 567.89 );
- expect( vals[2] ).toBe( 12345678.901 );
- });
-
-});
diff --git a/public/vendor/accounting/tests/jasmine/lib/jasmine/MIT.LICENSE b/public/vendor/accounting/tests/jasmine/lib/jasmine/MIT.LICENSE
deleted file mode 100644
index 1eb9b49e7e0d..000000000000
--- a/public/vendor/accounting/tests/jasmine/lib/jasmine/MIT.LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2008-2010 Pivotal Labs
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine-html.js b/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine-html.js
deleted file mode 100644
index 81402b9c10a7..000000000000
--- a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine-html.js
+++ /dev/null
@@ -1,188 +0,0 @@
-jasmine.TrivialReporter = function(doc) {
- this.document = doc || document;
- this.suiteDivs = {};
- this.logRunningSpecs = false;
-};
-
-jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
- var el = document.createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(document.createTextNode(child));
- } else {
- if (child) { el.appendChild(child); }
- }
- }
-
- for (var attr in attrs) {
- if (attr == "className") {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
- var showPassed, showSkipped;
-
- this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
- this.createDom('div', { className: 'banner' },
- this.createDom('div', { className: 'logo' },
- this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
- this.createDom('span', { className: 'version' }, runner.env.versionString())),
- this.createDom('div', { className: 'options' },
- "Show ",
- showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
- showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
- )
- ),
-
- this.runnerDiv = this.createDom('div', { className: 'runner running' },
- this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
- this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
- this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
- );
-
- this.document.body.appendChild(this.outerDiv);
-
- var suites = runner.suites();
- for (var i = 0; i < suites.length; i++) {
- var suite = suites[i];
- var suiteDiv = this.createDom('div', { className: 'suite' },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
- this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
- this.suiteDivs[suite.id] = suiteDiv;
- var parentDiv = this.outerDiv;
- if (suite.parentSuite) {
- parentDiv = this.suiteDivs[suite.parentSuite.id];
- }
- parentDiv.appendChild(suiteDiv);
- }
-
- this.startedAt = new Date();
-
- var self = this;
- showPassed.onclick = function(evt) {
- if (showPassed.checked) {
- self.outerDiv.className += ' show-passed';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
- }
- };
-
- showSkipped.onclick = function(evt) {
- if (showSkipped.checked) {
- self.outerDiv.className += ' show-skipped';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
- }
- };
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
- var results = runner.results();
- var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
- this.runnerDiv.setAttribute("class", className);
- //do it twice for IE
- this.runnerDiv.setAttribute("className", className);
- var specs = runner.specs();
- var specCount = 0;
- for (var i = 0; i < specs.length; i++) {
- if (this.specFilter(specs[i])) {
- specCount++;
- }
- }
- var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
- message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
- this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
-
- this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
-};
-
-jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
- var results = suite.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.totalCount == 0) { // todo: change this to check results.skipped
- status = 'skipped';
- }
- this.suiteDivs[suite.id].className += " " + status;
-};
-
-jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
- if (this.logRunningSpecs) {
- this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
- }
-};
-
-jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
- var results = spec.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.skipped) {
- status = 'skipped';
- }
- var specDiv = this.createDom('div', { className: 'spec ' + status },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
- this.createDom('a', {
- className: 'description',
- href: '?spec=' + encodeURIComponent(spec.getFullName()),
- title: spec.getFullName()
- }, spec.description));
-
-
- var resultItems = results.getItems();
- var messagesDiv = this.createDom('div', { className: 'messages' });
- for (var i = 0; i < resultItems.length; i++) {
- var result = resultItems[i];
-
- if (result.type == 'log') {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
- } else if (result.type == 'expect' && result.passed && !result.passed()) {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
-
- if (result.trace.stack) {
- messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
- }
- }
- }
-
- if (messagesDiv.childNodes.length > 0) {
- specDiv.appendChild(messagesDiv);
- }
-
- this.suiteDivs[spec.suite.id].appendChild(specDiv);
-};
-
-jasmine.TrivialReporter.prototype.log = function() {
- var console = jasmine.getGlobal().console;
- if (console && console.log) {
- if (console.log.apply) {
- console.log.apply(console, arguments);
- } else {
- console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
- }
- }
-};
-
-jasmine.TrivialReporter.prototype.getLocation = function() {
- return this.document.location;
-};
-
-jasmine.TrivialReporter.prototype.specFilter = function(spec) {
- var paramMap = {};
- var params = this.getLocation().search.substring(1).split('&');
- for (var i = 0; i < params.length; i++) {
- var p = params[i].split('=');
- paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
- }
-
- if (!paramMap["spec"]) return true;
- return spec.getFullName().indexOf(paramMap["spec"]) == 0;
-};
diff --git a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.css b/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.css
deleted file mode 100644
index 6583fe7c66d4..000000000000
--- a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.css
+++ /dev/null
@@ -1,166 +0,0 @@
-body {
- font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
-}
-
-
-.jasmine_reporter a:visited, .jasmine_reporter a {
- color: #303;
-}
-
-.jasmine_reporter a:hover, .jasmine_reporter a:active {
- color: blue;
-}
-
-.run_spec {
- float:right;
- padding-right: 5px;
- font-size: .8em;
- text-decoration: none;
-}
-
-.jasmine_reporter {
- margin: 0 5px;
-}
-
-.banner {
- color: #303;
- background-color: #fef;
- padding: 5px;
-}
-
-.logo {
- float: left;
- font-size: 1.1em;
- padding-left: 5px;
-}
-
-.logo .version {
- font-size: .6em;
- padding-left: 1em;
-}
-
-.runner.running {
- background-color: yellow;
-}
-
-
-.options {
- text-align: right;
- font-size: .8em;
-}
-
-
-
-
-.suite {
- border: 1px outset gray;
- margin: 5px 0;
- padding-left: 1em;
-}
-
-.suite .suite {
- margin: 5px;
-}
-
-.suite.passed {
- background-color: #dfd;
-}
-
-.suite.failed {
- background-color: #fdd;
-}
-
-.spec {
- margin: 5px;
- padding-left: 1em;
- clear: both;
-}
-
-.spec.failed, .spec.passed, .spec.skipped {
- padding-bottom: 5px;
- border: 1px solid gray;
-}
-
-.spec.failed {
- background-color: #fbb;
- border-color: red;
-}
-
-.spec.passed {
- background-color: #bfb;
- border-color: green;
-}
-
-.spec.skipped {
- background-color: #bbb;
-}
-
-.messages {
- border-left: 1px dashed gray;
- padding-left: 1em;
- padding-right: 1em;
-}
-
-.passed {
- background-color: #cfc;
- display: none;
-}
-
-.failed {
- background-color: #fbb;
-}
-
-.skipped {
- color: #777;
- background-color: #eee;
- display: none;
-}
-
-
-/*.resultMessage {*/
- /*white-space: pre;*/
-/*}*/
-
-.resultMessage span.result {
- display: block;
- line-height: 2em;
- color: black;
-}
-
-.resultMessage .mismatch {
- color: black;
-}
-
-.stackTrace {
- white-space: pre;
- font-size: .8em;
- margin-left: 10px;
- max-height: 5em;
- overflow: auto;
- border: 1px inset red;
- padding: 1em;
- background: #eef;
-}
-
-.finished-at {
- padding-left: 1em;
- font-size: .6em;
-}
-
-.show-passed .passed,
-.show-skipped .skipped {
- display: block;
-}
-
-
-#jasmine_content {
- position:fixed;
- right: 100%;
-}
-
-.runner {
- border: 1px solid gray;
- display: block;
- margin: 5px 0;
- padding: 2px 0 2px 10px;
-}
diff --git a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.js b/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.js
deleted file mode 100644
index 63e415d817eb..000000000000
--- a/public/vendor/accounting/tests/jasmine/lib/jasmine/jasmine.js
+++ /dev/null
@@ -1,2421 +0,0 @@
-/**
- * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
- *
- * @namespace
- */
-var jasmine = {};
-
-/**
- * @private
- */
-jasmine.unimplementedMethod_ = function() {
- throw new Error("unimplemented method");
-};
-
-/**
- * Use jasmine.undefined instead of undefined, since undefined is just
- * a plain old variable and may be redefined by somebody else.
- *
- * @private
- */
-jasmine.undefined = jasmine.___undefined___;
-
-/**
- * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
- *
- */
-jasmine.DEFAULT_UPDATE_INTERVAL = 250;
-
-/**
- * Default timeout interval in milliseconds for waitsFor() blocks.
- */
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
-
-jasmine.getGlobal = function() {
- function getGlobal() {
- return this;
- }
-
- return getGlobal();
-};
-
-/**
- * Allows for bound functions to be compared. Internal use only.
- *
- * @ignore
- * @private
- * @param base {Object} bound 'this' for the function
- * @param name {Function} function to find
- */
-jasmine.bindOriginal_ = function(base, name) {
- var original = base[name];
- if (original.apply) {
- return function() {
- return original.apply(base, arguments);
- };
- } else {
- // IE support
- return jasmine.getGlobal()[name];
- }
-};
-
-jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
-jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
-jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
-jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
-
-jasmine.MessageResult = function(values) {
- this.type = 'log';
- this.values = values;
- this.trace = new Error(); // todo: test better
-};
-
-jasmine.MessageResult.prototype.toString = function() {
- var text = "";
- for(var i = 0; i < this.values.length; i++) {
- if (i > 0) text += " ";
- if (jasmine.isString_(this.values[i])) {
- text += this.values[i];
- } else {
- text += jasmine.pp(this.values[i]);
- }
- }
- return text;
-};
-
-jasmine.ExpectationResult = function(params) {
- this.type = 'expect';
- this.matcherName = params.matcherName;
- this.passed_ = params.passed;
- this.expected = params.expected;
- this.actual = params.actual;
-
- this.message = this.passed_ ? 'Passed.' : params.message;
- this.trace = this.passed_ ? '' : new Error(this.message);
-};
-
-jasmine.ExpectationResult.prototype.toString = function () {
- return this.message;
-};
-
-jasmine.ExpectationResult.prototype.passed = function () {
- return this.passed_;
-};
-
-/**
- * Getter for the Jasmine environment. Ensures one gets created
- */
-jasmine.getEnv = function() {
- return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
-};
-
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
-jasmine.isArray_ = function(value) {
- return jasmine.isA_("Array", value);
-};
-
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
-jasmine.isString_ = function(value) {
- return jasmine.isA_("String", value);
-};
-
-/**
- * @ignore
- * @private
- * @param value
- * @returns {Boolean}
- */
-jasmine.isNumber_ = function(value) {
- return jasmine.isA_("Number", value);
-};
-
-/**
- * @ignore
- * @private
- * @param {String} typeName
- * @param value
- * @returns {Boolean}
- */
-jasmine.isA_ = function(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
-};
-
-/**
- * Pretty printer for expecations. Takes any object and turns it into a human-readable string.
- *
- * @param value {Object} an object to be outputted
- * @returns {String}
- */
-jasmine.pp = function(value) {
- var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
- stringPrettyPrinter.format(value);
- return stringPrettyPrinter.string;
-};
-
-/**
- * Returns true if the object is a DOM Node.
- *
- * @param {Object} obj object to check
- * @returns {Boolean}
- */
-jasmine.isDomNode = function(obj) {
- return obj['nodeType'] > 0;
-};
-
-/**
- * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
- *
- * @example
- * // don't care about which function is passed in, as long as it's a function
- * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
- *
- * @param {Class} clazz
- * @returns matchable object of the type clazz
- */
-jasmine.any = function(clazz) {
- return new jasmine.Matchers.Any(clazz);
-};
-
-/**
- * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
- *
- * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
- * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
- *
- * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
- *
- * Spies are torn down at the end of every spec.
- *
- * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
- *
- * @example
- * // a stub
- * var myStub = jasmine.createSpy('myStub'); // can be used anywhere
- *
- * // spy example
- * var foo = {
- * not: function(bool) { return !bool; }
- * }
- *
- * // actual foo.not will not be called, execution stops
- * spyOn(foo, 'not');
-
- // foo.not spied upon, execution will continue to implementation
- * spyOn(foo, 'not').andCallThrough();
- *
- * // fake example
- * var foo = {
- * not: function(bool) { return !bool; }
- * }
- *
- * // foo.not(val) will return val
- * spyOn(foo, 'not').andCallFake(function(value) {return value;});
- *
- * // mock example
- * foo.not(7 == 7);
- * expect(foo.not).toHaveBeenCalled();
- * expect(foo.not).toHaveBeenCalledWith(true);
- *
- * @constructor
- * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
- * @param {String} name
- */
-jasmine.Spy = function(name) {
- /**
- * The name of the spy, if provided.
- */
- this.identity = name || 'unknown';
- /**
- * Is this Object a spy?
- */
- this.isSpy = true;
- /**
- * The actual function this spy stubs.
- */
- this.plan = function() {
- };
- /**
- * Tracking of the most recent call to the spy.
- * @example
- * var mySpy = jasmine.createSpy('foo');
- * mySpy(1, 2);
- * mySpy.mostRecentCall.args = [1, 2];
- */
- this.mostRecentCall = {};
-
- /**
- * Holds arguments for each call to the spy, indexed by call count
- * @example
- * var mySpy = jasmine.createSpy('foo');
- * mySpy(1, 2);
- * mySpy(7, 8);
- * mySpy.mostRecentCall.args = [7, 8];
- * mySpy.argsForCall[0] = [1, 2];
- * mySpy.argsForCall[1] = [7, 8];
- */
- this.argsForCall = [];
- this.calls = [];
-};
-
-/**
- * Tells a spy to call through to the actual implemenatation.
- *
- * @example
- * var foo = {
- * bar: function() { // do some stuff }
- * }
- *
- * // defining a spy on an existing property: foo.bar
- * spyOn(foo, 'bar').andCallThrough();
- */
-jasmine.Spy.prototype.andCallThrough = function() {
- this.plan = this.originalValue;
- return this;
-};
-
-/**
- * For setting the return value of a spy.
- *
- * @example
- * // defining a spy from scratch: foo() returns 'baz'
- * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
- *
- * // defining a spy on an existing property: foo.bar() returns 'baz'
- * spyOn(foo, 'bar').andReturn('baz');
- *
- * @param {Object} value
- */
-jasmine.Spy.prototype.andReturn = function(value) {
- this.plan = function() {
- return value;
- };
- return this;
-};
-
-/**
- * For throwing an exception when a spy is called.
- *
- * @example
- * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
- * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
- *
- * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
- * spyOn(foo, 'bar').andThrow('baz');
- *
- * @param {String} exceptionMsg
- */
-jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
- this.plan = function() {
- throw exceptionMsg;
- };
- return this;
-};
-
-/**
- * Calls an alternate implementation when a spy is called.
- *
- * @example
- * var baz = function() {
- * // do some stuff, return something
- * }
- * // defining a spy from scratch: foo() calls the function baz
- * var foo = jasmine.createSpy('spy on foo').andCall(baz);
- *
- * // defining a spy on an existing property: foo.bar() calls an anonymnous function
- * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
- *
- * @param {Function} fakeFunc
- */
-jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
- this.plan = fakeFunc;
- return this;
-};
-
-/**
- * Resets all of a spy's the tracking variables so that it can be used again.
- *
- * @example
- * spyOn(foo, 'bar');
- *
- * foo.bar();
- *
- * expect(foo.bar.callCount).toEqual(1);
- *
- * foo.bar.reset();
- *
- * expect(foo.bar.callCount).toEqual(0);
- */
-jasmine.Spy.prototype.reset = function() {
- this.wasCalled = false;
- this.callCount = 0;
- this.argsForCall = [];
- this.calls = [];
- this.mostRecentCall = {};
-};
-
-jasmine.createSpy = function(name) {
-
- var spyObj = function() {
- spyObj.wasCalled = true;
- spyObj.callCount++;
- var args = jasmine.util.argsToArray(arguments);
- spyObj.mostRecentCall.object = this;
- spyObj.mostRecentCall.args = args;
- spyObj.argsForCall.push(args);
- spyObj.calls.push({object: this, args: args});
- return spyObj.plan.apply(this, arguments);
- };
-
- var spy = new jasmine.Spy(name);
-
- for (var prop in spy) {
- spyObj[prop] = spy[prop];
- }
-
- spyObj.reset();
-
- return spyObj;
-};
-
-/**
- * Determines whether an object is a spy.
- *
- * @param {jasmine.Spy|Object} putativeSpy
- * @returns {Boolean}
- */
-jasmine.isSpy = function(putativeSpy) {
- return putativeSpy && putativeSpy.isSpy;
-};
-
-/**
- * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
- * large in one call.
- *
- * @param {String} baseName name of spy class
- * @param {Array} methodNames array of names of methods to make spies
- */
-jasmine.createSpyObj = function(baseName, methodNames) {
- if (!jasmine.isArray_(methodNames) || methodNames.length == 0) {
- throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
- }
- var obj = {};
- for (var i = 0; i < methodNames.length; i++) {
- obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
- }
- return obj;
-};
-
-/**
- * All parameters are pretty-printed and concatenated together, then written to the current spec's output.
- *
- * Be careful not to leave calls to jasmine.log in production code.
- */
-jasmine.log = function() {
- var spec = jasmine.getEnv().currentSpec;
- spec.log.apply(spec, arguments);
-};
-
-/**
- * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
- *
- * @example
- * // spy example
- * var foo = {
- * not: function(bool) { return !bool; }
- * }
- * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
- *
- * @see jasmine.createSpy
- * @param obj
- * @param methodName
- * @returns a Jasmine spy that can be chained with all spy methods
- */
-var spyOn = function(obj, methodName) {
- return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
-};
-
-/**
- * Creates a Jasmine spec that will be added to the current suite.
- *
- * // TODO: pending tests
- *
- * @example
- * it('should be true', function() {
- * expect(true).toEqual(true);
- * });
- *
- * @param {String} desc description of this specification
- * @param {Function} func defines the preconditions and expectations of the spec
- */
-var it = function(desc, func) {
- return jasmine.getEnv().it(desc, func);
-};
-
-/**
- * Creates a disabled Jasmine spec.
- *
- * A convenience method that allows existing specs to be disabled temporarily during development.
- *
- * @param {String} desc description of this specification
- * @param {Function} func defines the preconditions and expectations of the spec
- */
-var xit = function(desc, func) {
- return jasmine.getEnv().xit(desc, func);
-};
-
-/**
- * Starts a chain for a Jasmine expectation.
- *
- * It is passed an Object that is the actual value and should chain to one of the many
- * jasmine.Matchers functions.
- *
- * @param {Object} actual Actual value to test against and expected value
- */
-var expect = function(actual) {
- return jasmine.getEnv().currentSpec.expect(actual);
-};
-
-/**
- * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
- *
- * @param {Function} func Function that defines part of a jasmine spec.
- */
-var runs = function(func) {
- jasmine.getEnv().currentSpec.runs(func);
-};
-
-/**
- * Waits a fixed time period before moving to the next block.
- *
- * @deprecated Use waitsFor() instead
- * @param {Number} timeout milliseconds to wait
- */
-var waits = function(timeout) {
- jasmine.getEnv().currentSpec.waits(timeout);
-};
-
-/**
- * Waits for the latchFunction to return true before proceeding to the next block.
- *
- * @param {Function} latchFunction
- * @param {String} optional_timeoutMessage
- * @param {Number} optional_timeout
- */
-var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
- jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
-};
-
-/**
- * A function that is called before each spec in a suite.
- *
- * Used for spec setup, including validating assumptions.
- *
- * @param {Function} beforeEachFunction
- */
-var beforeEach = function(beforeEachFunction) {
- jasmine.getEnv().beforeEach(beforeEachFunction);
-};
-
-/**
- * A function that is called after each spec in a suite.
- *
- * Used for restoring any state that is hijacked during spec execution.
- *
- * @param {Function} afterEachFunction
- */
-var afterEach = function(afterEachFunction) {
- jasmine.getEnv().afterEach(afterEachFunction);
-};
-
-/**
- * Defines a suite of specifications.
- *
- * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
- * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
- * of setup in some tests.
- *
- * @example
- * // TODO: a simple suite
- *
- * // TODO: a simple suite with a nested describe block
- *
- * @param {String} description A string, usually the class under test.
- * @param {Function} specDefinitions function that defines several specs.
- */
-var describe = function(description, specDefinitions) {
- return jasmine.getEnv().describe(description, specDefinitions);
-};
-
-/**
- * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
- *
- * @param {String} description A string, usually the class under test.
- * @param {Function} specDefinitions function that defines several specs.
- */
-var xdescribe = function(description, specDefinitions) {
- return jasmine.getEnv().xdescribe(description, specDefinitions);
-};
-
-
-// Provide the XMLHttpRequest class for IE 5.x-6.x:
-jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
- try {
- return new ActiveXObject("Msxml2.XMLHTTP.6.0");
- } catch(e) {
- }
- try {
- return new ActiveXObject("Msxml2.XMLHTTP.3.0");
- } catch(e) {
- }
- try {
- return new ActiveXObject("Msxml2.XMLHTTP");
- } catch(e) {
- }
- try {
- return new ActiveXObject("Microsoft.XMLHTTP");
- } catch(e) {
- }
- throw new Error("This browser does not support XMLHttpRequest.");
-} : XMLHttpRequest;
-/**
- * @namespace
- */
-jasmine.util = {};
-
-/**
- * Declare that a child class inherit it's prototype from the parent class.
- *
- * @private
- * @param {Function} childClass
- * @param {Function} parentClass
- */
-jasmine.util.inherit = function(childClass, parentClass) {
- /**
- * @private
- */
- var subclass = function() {
- };
- subclass.prototype = parentClass.prototype;
- childClass.prototype = new subclass;
-};
-
-jasmine.util.formatException = function(e) {
- var lineNumber;
- if (e.line) {
- lineNumber = e.line;
- }
- else if (e.lineNumber) {
- lineNumber = e.lineNumber;
- }
-
- var file;
-
- if (e.sourceURL) {
- file = e.sourceURL;
- }
- else if (e.fileName) {
- file = e.fileName;
- }
-
- var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
-
- if (file && lineNumber) {
- message += ' in ' + file + ' (line ' + lineNumber + ')';
- }
-
- return message;
-};
-
-jasmine.util.htmlEscape = function(str) {
- if (!str) return str;
- return str.replace(/&/g, '&')
- .replace(//g, '>');
-};
-
-jasmine.util.argsToArray = function(args) {
- var arrayOfArgs = [];
- for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
- return arrayOfArgs;
-};
-
-jasmine.util.extend = function(destination, source) {
- for (var property in source) destination[property] = source[property];
- return destination;
-};
-
-/**
- * Environment for Jasmine
- *
- * @constructor
- */
-jasmine.Env = function() {
- this.currentSpec = null;
- this.currentSuite = null;
- this.currentRunner_ = new jasmine.Runner(this);
-
- this.reporter = new jasmine.MultiReporter();
-
- this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
- this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
- this.lastUpdate = 0;
- this.specFilter = function() {
- return true;
- };
-
- this.nextSpecId_ = 0;
- this.nextSuiteId_ = 0;
- this.equalityTesters_ = [];
-
- // wrap matchers
- this.matchersClass = function() {
- jasmine.Matchers.apply(this, arguments);
- };
- jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
-
- jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
-};
-
-
-jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
-jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
-jasmine.Env.prototype.setInterval = jasmine.setInterval;
-jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
-
-/**
- * @returns an object containing jasmine version build info, if set.
- */
-jasmine.Env.prototype.version = function () {
- if (jasmine.version_) {
- return jasmine.version_;
- } else {
- throw new Error('Version not set');
- }
-};
-
-/**
- * @returns string containing jasmine version build info, if set.
- */
-jasmine.Env.prototype.versionString = function() {
- if (jasmine.version_) {
- var version = this.version();
- return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
- } else {
- return "version unknown";
- }
-};
-
-/**
- * @returns a sequential integer starting at 0
- */
-jasmine.Env.prototype.nextSpecId = function () {
- return this.nextSpecId_++;
-};
-
-/**
- * @returns a sequential integer starting at 0
- */
-jasmine.Env.prototype.nextSuiteId = function () {
- return this.nextSuiteId_++;
-};
-
-/**
- * Register a reporter to receive status updates from Jasmine.
- * @param {jasmine.Reporter} reporter An object which will receive status updates.
- */
-jasmine.Env.prototype.addReporter = function(reporter) {
- this.reporter.addReporter(reporter);
-};
-
-jasmine.Env.prototype.execute = function() {
- this.currentRunner_.execute();
-};
-
-jasmine.Env.prototype.describe = function(description, specDefinitions) {
- var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
-
- var parentSuite = this.currentSuite;
- if (parentSuite) {
- parentSuite.add(suite);
- } else {
- this.currentRunner_.add(suite);
- }
-
- this.currentSuite = suite;
-
- var declarationError = null;
- try {
- specDefinitions.call(suite);
- } catch(e) {
- declarationError = e;
- }
-
- this.currentSuite = parentSuite;
-
- if (declarationError) {
- this.it("encountered a declaration exception", function() {
- throw declarationError;
- });
- }
-
- return suite;
-};
-
-jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
- if (this.currentSuite) {
- this.currentSuite.beforeEach(beforeEachFunction);
- } else {
- this.currentRunner_.beforeEach(beforeEachFunction);
- }
-};
-
-jasmine.Env.prototype.currentRunner = function () {
- return this.currentRunner_;
-};
-
-jasmine.Env.prototype.afterEach = function(afterEachFunction) {
- if (this.currentSuite) {
- this.currentSuite.afterEach(afterEachFunction);
- } else {
- this.currentRunner_.afterEach(afterEachFunction);
- }
-
-};
-
-jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
- return {
- execute: function() {
- }
- };
-};
-
-jasmine.Env.prototype.it = function(description, func) {
- var spec = new jasmine.Spec(this, this.currentSuite, description);
- this.currentSuite.add(spec);
- this.currentSpec = spec;
-
- if (func) {
- spec.runs(func);
- }
-
- return spec;
-};
-
-jasmine.Env.prototype.xit = function(desc, func) {
- return {
- id: this.nextSpecId(),
- runs: function() {
- }
- };
-};
-
-jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
- if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
- return true;
- }
-
- a.__Jasmine_been_here_before__ = b;
- b.__Jasmine_been_here_before__ = a;
-
- var hasKey = function(obj, keyName) {
- return obj != null && obj[keyName] !== jasmine.undefined;
- };
-
- for (var property in b) {
- if (!hasKey(a, property) && hasKey(b, property)) {
- mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
- }
- }
- for (property in a) {
- if (!hasKey(b, property) && hasKey(a, property)) {
- mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
- }
- }
- for (property in b) {
- if (property == '__Jasmine_been_here_before__') continue;
- if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
- mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
- }
- }
-
- if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
- mismatchValues.push("arrays were not the same length");
- }
-
- delete a.__Jasmine_been_here_before__;
- delete b.__Jasmine_been_here_before__;
- return (mismatchKeys.length == 0 && mismatchValues.length == 0);
-};
-
-jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
- mismatchKeys = mismatchKeys || [];
- mismatchValues = mismatchValues || [];
-
- for (var i = 0; i < this.equalityTesters_.length; i++) {
- var equalityTester = this.equalityTesters_[i];
- var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
- if (result !== jasmine.undefined) return result;
- }
-
- if (a === b) return true;
-
- if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
- return (a == jasmine.undefined && b == jasmine.undefined);
- }
-
- if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
- return a === b;
- }
-
- if (a instanceof Date && b instanceof Date) {
- return a.getTime() == b.getTime();
- }
-
- if (a instanceof jasmine.Matchers.Any) {
- return a.matches(b);
- }
-
- if (b instanceof jasmine.Matchers.Any) {
- return b.matches(a);
- }
-
- if (jasmine.isString_(a) && jasmine.isString_(b)) {
- return (a == b);
- }
-
- if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
- return (a == b);
- }
-
- if (typeof a === "object" && typeof b === "object") {
- return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
- }
-
- //Straight check
- return (a === b);
-};
-
-jasmine.Env.prototype.contains_ = function(haystack, needle) {
- if (jasmine.isArray_(haystack)) {
- for (var i = 0; i < haystack.length; i++) {
- if (this.equals_(haystack[i], needle)) return true;
- }
- return false;
- }
- return haystack.indexOf(needle) >= 0;
-};
-
-jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
- this.equalityTesters_.push(equalityTester);
-};
-/** No-op base class for Jasmine reporters.
- *
- * @constructor
- */
-jasmine.Reporter = function() {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.reportSpecStarting = function(spec) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.reportSpecResults = function(spec) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.Reporter.prototype.log = function(str) {
-};
-
-/**
- * Blocks are functions with executable code that make up a spec.
- *
- * @constructor
- * @param {jasmine.Env} env
- * @param {Function} func
- * @param {jasmine.Spec} spec
- */
-jasmine.Block = function(env, func, spec) {
- this.env = env;
- this.func = func;
- this.spec = spec;
-};
-
-jasmine.Block.prototype.execute = function(onComplete) {
- try {
- this.func.apply(this.spec);
- } catch (e) {
- this.spec.fail(e);
- }
- onComplete();
-};
-/** JavaScript API reporter.
- *
- * @constructor
- */
-jasmine.JsApiReporter = function() {
- this.started = false;
- this.finished = false;
- this.suites_ = [];
- this.results_ = {};
-};
-
-jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
- this.started = true;
- var suites = runner.topLevelSuites();
- for (var i = 0; i < suites.length; i++) {
- var suite = suites[i];
- this.suites_.push(this.summarize_(suite));
- }
-};
-
-jasmine.JsApiReporter.prototype.suites = function() {
- return this.suites_;
-};
-
-jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
- var isSuite = suiteOrSpec instanceof jasmine.Suite;
- var summary = {
- id: suiteOrSpec.id,
- name: suiteOrSpec.description,
- type: isSuite ? 'suite' : 'spec',
- children: []
- };
-
- if (isSuite) {
- var children = suiteOrSpec.children();
- for (var i = 0; i < children.length; i++) {
- summary.children.push(this.summarize_(children[i]));
- }
- }
- return summary;
-};
-
-jasmine.JsApiReporter.prototype.results = function() {
- return this.results_;
-};
-
-jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
- return this.results_[specId];
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
- this.finished = true;
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
- this.results_[spec.id] = {
- messages: spec.results().getItems(),
- result: spec.results().failedCount > 0 ? "failed" : "passed"
- };
-};
-
-//noinspection JSUnusedLocalSymbols
-jasmine.JsApiReporter.prototype.log = function(str) {
-};
-
-jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
- var results = {};
- for (var i = 0; i < specIds.length; i++) {
- var specId = specIds[i];
- results[specId] = this.summarizeResult_(this.results_[specId]);
- }
- return results;
-};
-
-jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
- var summaryMessages = [];
- var messagesLength = result.messages.length;
- for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
- var resultMessage = result.messages[messageIndex];
- summaryMessages.push({
- text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
- passed: resultMessage.passed ? resultMessage.passed() : true,
- type: resultMessage.type,
- message: resultMessage.message,
- trace: {
- stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
- }
- });
- }
-
- return {
- result : result.result,
- messages : summaryMessages
- };
-};
-
-/**
- * @constructor
- * @param {jasmine.Env} env
- * @param actual
- * @param {jasmine.Spec} spec
- */
-jasmine.Matchers = function(env, actual, spec, opt_isNot) {
- this.env = env;
- this.actual = actual;
- this.spec = spec;
- this.isNot = opt_isNot || false;
- this.reportWasCalled_ = false;
-};
-
-// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
-jasmine.Matchers.pp = function(str) {
- throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
-};
-
-// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
-jasmine.Matchers.prototype.report = function(result, failing_message, details) {
- throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
-};
-
-jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) {
- for (var methodName in prototype) {
- if (methodName == 'report') continue;
- var orig = prototype[methodName];
- matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
- }
-};
-
-jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
- return function() {
- var matcherArgs = jasmine.util.argsToArray(arguments);
- var result = matcherFunction.apply(this, arguments);
-
- if (this.isNot) {
- result = !result;
- }
-
- if (this.reportWasCalled_) return result;
-
- var message;
- if (!result) {
- if (this.message) {
- message = this.message.apply(this, arguments);
- if (jasmine.isArray_(message)) {
- message = message[this.isNot ? 1 : 0];
- }
- } else {
- var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
- message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
- if (matcherArgs.length > 0) {
- for (var i = 0; i < matcherArgs.length; i++) {
- if (i > 0) message += ",";
- message += " " + jasmine.pp(matcherArgs[i]);
- }
- }
- message += ".";
- }
- }
- var expectationResult = new jasmine.ExpectationResult({
- matcherName: matcherName,
- passed: result,
- expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
- actual: this.actual,
- message: message
- });
- this.spec.addMatcherResult(expectationResult);
- return jasmine.undefined;
- };
-};
-
-
-
-
-/**
- * toBe: compares the actual to the expected using ===
- * @param expected
- */
-jasmine.Matchers.prototype.toBe = function(expected) {
- return this.actual === expected;
-};
-
-/**
- * toNotBe: compares the actual to the expected using !==
- * @param expected
- * @deprecated as of 1.0. Use not.toBe() instead.
- */
-jasmine.Matchers.prototype.toNotBe = function(expected) {
- return this.actual !== expected;
-};
-
-/**
- * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
- *
- * @param expected
- */
-jasmine.Matchers.prototype.toEqual = function(expected) {
- return this.env.equals_(this.actual, expected);
-};
-
-/**
- * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
- * @param expected
- * @deprecated as of 1.0. Use not.toNotEqual() instead.
- */
-jasmine.Matchers.prototype.toNotEqual = function(expected) {
- return !this.env.equals_(this.actual, expected);
-};
-
-/**
- * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
- * a pattern or a String.
- *
- * @param expected
- */
-jasmine.Matchers.prototype.toMatch = function(expected) {
- return new RegExp(expected).test(this.actual);
-};
-
-/**
- * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
- * @param expected
- * @deprecated as of 1.0. Use not.toMatch() instead.
- */
-jasmine.Matchers.prototype.toNotMatch = function(expected) {
- return !(new RegExp(expected).test(this.actual));
-};
-
-/**
- * Matcher that compares the actual to jasmine.undefined.
- */
-jasmine.Matchers.prototype.toBeDefined = function() {
- return (this.actual !== jasmine.undefined);
-};
-
-/**
- * Matcher that compares the actual to jasmine.undefined.
- */
-jasmine.Matchers.prototype.toBeUndefined = function() {
- return (this.actual === jasmine.undefined);
-};
-
-/**
- * Matcher that compares the actual to null.
- */
-jasmine.Matchers.prototype.toBeNull = function() {
- return (this.actual === null);
-};
-
-/**
- * Matcher that boolean not-nots the actual.
- */
-jasmine.Matchers.prototype.toBeTruthy = function() {
- return !!this.actual;
-};
-
-
-/**
- * Matcher that boolean nots the actual.
- */
-jasmine.Matchers.prototype.toBeFalsy = function() {
- return !this.actual;
-};
-
-
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was called.
- */
-jasmine.Matchers.prototype.toHaveBeenCalled = function() {
- if (arguments.length > 0) {
- throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
- }
-
- if (!jasmine.isSpy(this.actual)) {
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
- }
-
- this.message = function() {
- return [
- "Expected spy " + this.actual.identity + " to have been called.",
- "Expected spy " + this.actual.identity + " not to have been called."
- ];
- };
-
- return this.actual.wasCalled;
-};
-
-/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
-jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
-
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was not called.
- *
- * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
- */
-jasmine.Matchers.prototype.wasNotCalled = function() {
- if (arguments.length > 0) {
- throw new Error('wasNotCalled does not take arguments');
- }
-
- if (!jasmine.isSpy(this.actual)) {
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
- }
-
- this.message = function() {
- return [
- "Expected spy " + this.actual.identity + " to not have been called.",
- "Expected spy " + this.actual.identity + " to have been called."
- ];
- };
-
- return !this.actual.wasCalled;
-};
-
-/**
- * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
- *
- * @example
- *
- */
-jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
- var expectedArgs = jasmine.util.argsToArray(arguments);
- if (!jasmine.isSpy(this.actual)) {
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
- }
- this.message = function() {
- if (this.actual.callCount == 0) {
- // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
- return [
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
- ];
- } else {
- return [
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
- ];
- }
- };
-
- return this.env.contains_(this.actual.argsForCall, expectedArgs);
-};
-
-/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
-jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
-
-/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
-jasmine.Matchers.prototype.wasNotCalledWith = function() {
- var expectedArgs = jasmine.util.argsToArray(arguments);
- if (!jasmine.isSpy(this.actual)) {
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
- }
-
- this.message = function() {
- return [
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
- ]
- };
-
- return !this.env.contains_(this.actual.argsForCall, expectedArgs);
-};
-
-/**
- * Matcher that checks that the expected item is an element in the actual Array.
- *
- * @param {Object} expected
- */
-jasmine.Matchers.prototype.toContain = function(expected) {
- return this.env.contains_(this.actual, expected);
-};
-
-/**
- * Matcher that checks that the expected item is NOT an element in the actual Array.
- *
- * @param {Object} expected
- * @deprecated as of 1.0. Use not.toNotContain() instead.
- */
-jasmine.Matchers.prototype.toNotContain = function(expected) {
- return !this.env.contains_(this.actual, expected);
-};
-
-jasmine.Matchers.prototype.toBeLessThan = function(expected) {
- return this.actual < expected;
-};
-
-jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
- return this.actual > expected;
-};
-
-/**
- * Matcher that checks that the expected exception was thrown by the actual.
- *
- * @param {String} expected
- */
-jasmine.Matchers.prototype.toThrow = function(expected) {
- var result = false;
- var exception;
- if (typeof this.actual != 'function') {
- throw new Error('Actual is not a function');
- }
- try {
- this.actual();
- } catch (e) {
- exception = e;
- }
- if (exception) {
- result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
- }
-
- var not = this.isNot ? "not " : "";
-
- this.message = function() {
- if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
- return ["Expected function " + not + "to throw", expected ? expected.message || expected : " an exception", ", but it threw", exception.message || exception].join(' ');
- } else {
- return "Expected function to throw an exception.";
- }
- };
-
- return result;
-};
-
-jasmine.Matchers.Any = function(expectedClass) {
- this.expectedClass = expectedClass;
-};
-
-jasmine.Matchers.Any.prototype.matches = function(other) {
- if (this.expectedClass == String) {
- return typeof other == 'string' || other instanceof String;
- }
-
- if (this.expectedClass == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
-
- if (this.expectedClass == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
-
- if (this.expectedClass == Object) {
- return typeof other == 'object';
- }
-
- return other instanceof this.expectedClass;
-};
-
-jasmine.Matchers.Any.prototype.toString = function() {
- return '';
-};
-
-/**
- * @constructor
- */
-jasmine.MultiReporter = function() {
- this.subReporters_ = [];
-};
-jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
-
-jasmine.MultiReporter.prototype.addReporter = function(reporter) {
- this.subReporters_.push(reporter);
-};
-
-(function() {
- var functionNames = [
- "reportRunnerStarting",
- "reportRunnerResults",
- "reportSuiteResults",
- "reportSpecStarting",
- "reportSpecResults",
- "log"
- ];
- for (var i = 0; i < functionNames.length; i++) {
- var functionName = functionNames[i];
- jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
- return function() {
- for (var j = 0; j < this.subReporters_.length; j++) {
- var subReporter = this.subReporters_[j];
- if (subReporter[functionName]) {
- subReporter[functionName].apply(subReporter, arguments);
- }
- }
- };
- })(functionName);
- }
-})();
-/**
- * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
- *
- * @constructor
- */
-jasmine.NestedResults = function() {
- /**
- * The total count of results
- */
- this.totalCount = 0;
- /**
- * Number of passed results
- */
- this.passedCount = 0;
- /**
- * Number of failed results
- */
- this.failedCount = 0;
- /**
- * Was this suite/spec skipped?
- */
- this.skipped = false;
- /**
- * @ignore
- */
- this.items_ = [];
-};
-
-/**
- * Roll up the result counts.
- *
- * @param result
- */
-jasmine.NestedResults.prototype.rollupCounts = function(result) {
- this.totalCount += result.totalCount;
- this.passedCount += result.passedCount;
- this.failedCount += result.failedCount;
-};
-
-/**
- * Adds a log message.
- * @param values Array of message parts which will be concatenated later.
- */
-jasmine.NestedResults.prototype.log = function(values) {
- this.items_.push(new jasmine.MessageResult(values));
-};
-
-/**
- * Getter for the results: message & results.
- */
-jasmine.NestedResults.prototype.getItems = function() {
- return this.items_;
-};
-
-/**
- * Adds a result, tracking counts (total, passed, & failed)
- * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
- */
-jasmine.NestedResults.prototype.addResult = function(result) {
- if (result.type != 'log') {
- if (result.items_) {
- this.rollupCounts(result);
- } else {
- this.totalCount++;
- if (result.passed()) {
- this.passedCount++;
- } else {
- this.failedCount++;
- }
- }
- }
- this.items_.push(result);
-};
-
-/**
- * @returns {Boolean} True if everything below passed
- */
-jasmine.NestedResults.prototype.passed = function() {
- return this.passedCount === this.totalCount;
-};
-/**
- * Base class for pretty printing for expectation results.
- */
-jasmine.PrettyPrinter = function() {
- this.ppNestLevel_ = 0;
-};
-
-/**
- * Formats a value in a nice, human-readable string.
- *
- * @param value
- */
-jasmine.PrettyPrinter.prototype.format = function(value) {
- if (this.ppNestLevel_ > 40) {
- throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
- }
-
- this.ppNestLevel_++;
- try {
- if (value === jasmine.undefined) {
- this.emitScalar('undefined');
- } else if (value === null) {
- this.emitScalar('null');
- } else if (value === jasmine.getGlobal()) {
- this.emitScalar('');
- } else if (value instanceof jasmine.Matchers.Any) {
- this.emitScalar(value.toString());
- } else if (typeof value === 'string') {
- this.emitString(value);
- } else if (jasmine.isSpy(value)) {
- this.emitScalar("spy on " + value.identity);
- } else if (value instanceof RegExp) {
- this.emitScalar(value.toString());
- } else if (typeof value === 'function') {
- this.emitScalar('Function');
- } else if (typeof value.nodeType === 'number') {
- this.emitScalar('HTMLNode');
- } else if (value instanceof Date) {
- this.emitScalar('Date(' + value + ')');
- } else if (value.__Jasmine_been_here_before__) {
- this.emitScalar('');
- } else if (jasmine.isArray_(value) || typeof value == 'object') {
- value.__Jasmine_been_here_before__ = true;
- if (jasmine.isArray_(value)) {
- this.emitArray(value);
- } else {
- this.emitObject(value);
- }
- delete value.__Jasmine_been_here_before__;
- } else {
- this.emitScalar(value.toString());
- }
- } finally {
- this.ppNestLevel_--;
- }
-};
-
-jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
- for (var property in obj) {
- if (property == '__Jasmine_been_here_before__') continue;
- fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
- }
-};
-
-jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
-jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
-jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
-jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
-
-jasmine.StringPrettyPrinter = function() {
- jasmine.PrettyPrinter.call(this);
-
- this.string = '';
-};
-jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
-
-jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
- this.append(value);
-};
-
-jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
- this.append("'" + value + "'");
-};
-
-jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
- this.append('[ ');
- for (var i = 0; i < array.length; i++) {
- if (i > 0) {
- this.append(', ');
- }
- this.format(array[i]);
- }
- this.append(' ]');
-};
-
-jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
- var self = this;
- this.append('{ ');
- var first = true;
-
- this.iterateObject(obj, function(property, isGetter) {
- if (first) {
- first = false;
- } else {
- self.append(', ');
- }
-
- self.append(property);
- self.append(' : ');
- if (isGetter) {
- self.append('');
- } else {
- self.format(obj[property]);
- }
- });
-
- this.append(' }');
-};
-
-jasmine.StringPrettyPrinter.prototype.append = function(value) {
- this.string += value;
-};
-jasmine.Queue = function(env) {
- this.env = env;
- this.blocks = [];
- this.running = false;
- this.index = 0;
- this.offset = 0;
- this.abort = false;
-};
-
-jasmine.Queue.prototype.addBefore = function(block) {
- this.blocks.unshift(block);
-};
-
-jasmine.Queue.prototype.add = function(block) {
- this.blocks.push(block);
-};
-
-jasmine.Queue.prototype.insertNext = function(block) {
- this.blocks.splice((this.index + this.offset + 1), 0, block);
- this.offset++;
-};
-
-jasmine.Queue.prototype.start = function(onComplete) {
- this.running = true;
- this.onComplete = onComplete;
- this.next_();
-};
-
-jasmine.Queue.prototype.isRunning = function() {
- return this.running;
-};
-
-jasmine.Queue.LOOP_DONT_RECURSE = true;
-
-jasmine.Queue.prototype.next_ = function() {
- var self = this;
- var goAgain = true;
-
- while (goAgain) {
- goAgain = false;
-
- if (self.index < self.blocks.length && !this.abort) {
- var calledSynchronously = true;
- var completedSynchronously = false;
-
- var onComplete = function () {
- if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
- completedSynchronously = true;
- return;
- }
-
- if (self.blocks[self.index].abort) {
- self.abort = true;
- }
-
- self.offset = 0;
- self.index++;
-
- var now = new Date().getTime();
- if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
- self.env.lastUpdate = now;
- self.env.setTimeout(function() {
- self.next_();
- }, 0);
- } else {
- if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
- goAgain = true;
- } else {
- self.next_();
- }
- }
- };
- self.blocks[self.index].execute(onComplete);
-
- calledSynchronously = false;
- if (completedSynchronously) {
- onComplete();
- }
-
- } else {
- self.running = false;
- if (self.onComplete) {
- self.onComplete();
- }
- }
- }
-};
-
-jasmine.Queue.prototype.results = function() {
- var results = new jasmine.NestedResults();
- for (var i = 0; i < this.blocks.length; i++) {
- if (this.blocks[i].results) {
- results.addResult(this.blocks[i].results());
- }
- }
- return results;
-};
-
-
-/**
- * Runner
- *
- * @constructor
- * @param {jasmine.Env} env
- */
-jasmine.Runner = function(env) {
- var self = this;
- self.env = env;
- self.queue = new jasmine.Queue(env);
- self.before_ = [];
- self.after_ = [];
- self.suites_ = [];
-};
-
-jasmine.Runner.prototype.execute = function() {
- var self = this;
- if (self.env.reporter.reportRunnerStarting) {
- self.env.reporter.reportRunnerStarting(this);
- }
- self.queue.start(function () {
- self.finishCallback();
- });
-};
-
-jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
- beforeEachFunction.typeName = 'beforeEach';
- this.before_.splice(0,0,beforeEachFunction);
-};
-
-jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
- afterEachFunction.typeName = 'afterEach';
- this.after_.splice(0,0,afterEachFunction);
-};
-
-
-jasmine.Runner.prototype.finishCallback = function() {
- this.env.reporter.reportRunnerResults(this);
-};
-
-jasmine.Runner.prototype.addSuite = function(suite) {
- this.suites_.push(suite);
-};
-
-jasmine.Runner.prototype.add = function(block) {
- if (block instanceof jasmine.Suite) {
- this.addSuite(block);
- }
- this.queue.add(block);
-};
-
-jasmine.Runner.prototype.specs = function () {
- var suites = this.suites();
- var specs = [];
- for (var i = 0; i < suites.length; i++) {
- specs = specs.concat(suites[i].specs());
- }
- return specs;
-};
-
-jasmine.Runner.prototype.suites = function() {
- return this.suites_;
-};
-
-jasmine.Runner.prototype.topLevelSuites = function() {
- var topLevelSuites = [];
- for (var i = 0; i < this.suites_.length; i++) {
- if (!this.suites_[i].parentSuite) {
- topLevelSuites.push(this.suites_[i]);
- }
- }
- return topLevelSuites;
-};
-
-jasmine.Runner.prototype.results = function() {
- return this.queue.results();
-};
-/**
- * Internal representation of a Jasmine specification, or test.
- *
- * @constructor
- * @param {jasmine.Env} env
- * @param {jasmine.Suite} suite
- * @param {String} description
- */
-jasmine.Spec = function(env, suite, description) {
- if (!env) {
- throw new Error('jasmine.Env() required');
- }
- if (!suite) {
- throw new Error('jasmine.Suite() required');
- }
- var spec = this;
- spec.id = env.nextSpecId ? env.nextSpecId() : null;
- spec.env = env;
- spec.suite = suite;
- spec.description = description;
- spec.queue = new jasmine.Queue(env);
-
- spec.afterCallbacks = [];
- spec.spies_ = [];
-
- spec.results_ = new jasmine.NestedResults();
- spec.results_.description = description;
- spec.matchersClass = null;
-};
-
-jasmine.Spec.prototype.getFullName = function() {
- return this.suite.getFullName() + ' ' + this.description + '.';
-};
-
-
-jasmine.Spec.prototype.results = function() {
- return this.results_;
-};
-
-/**
- * All parameters are pretty-printed and concatenated together, then written to the spec's output.
- *
- * Be careful not to leave calls to jasmine.log in production code.
- */
-jasmine.Spec.prototype.log = function() {
- return this.results_.log(arguments);
-};
-
-jasmine.Spec.prototype.runs = function (func) {
- var block = new jasmine.Block(this.env, func, this);
- this.addToQueue(block);
- return this;
-};
-
-jasmine.Spec.prototype.addToQueue = function (block) {
- if (this.queue.isRunning()) {
- this.queue.insertNext(block);
- } else {
- this.queue.add(block);
- }
-};
-
-/**
- * @param {jasmine.ExpectationResult} result
- */
-jasmine.Spec.prototype.addMatcherResult = function(result) {
- this.results_.addResult(result);
-};
-
-jasmine.Spec.prototype.expect = function(actual) {
- var positive = new (this.getMatchersClass_())(this.env, actual, this);
- positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
- return positive;
-};
-
-/**
- * Waits a fixed time period before moving to the next block.
- *
- * @deprecated Use waitsFor() instead
- * @param {Number} timeout milliseconds to wait
- */
-jasmine.Spec.prototype.waits = function(timeout) {
- var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
- this.addToQueue(waitsFunc);
- return this;
-};
-
-/**
- * Waits for the latchFunction to return true before proceeding to the next block.
- *
- * @param {Function} latchFunction
- * @param {String} optional_timeoutMessage
- * @param {Number} optional_timeout
- */
-jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
- var latchFunction_ = null;
- var optional_timeoutMessage_ = null;
- var optional_timeout_ = null;
-
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- switch (typeof arg) {
- case 'function':
- latchFunction_ = arg;
- break;
- case 'string':
- optional_timeoutMessage_ = arg;
- break;
- case 'number':
- optional_timeout_ = arg;
- break;
- }
- }
-
- var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
- this.addToQueue(waitsForFunc);
- return this;
-};
-
-jasmine.Spec.prototype.fail = function (e) {
- var expectationResult = new jasmine.ExpectationResult({
- passed: false,
- message: e ? jasmine.util.formatException(e) : 'Exception'
- });
- this.results_.addResult(expectationResult);
-};
-
-jasmine.Spec.prototype.getMatchersClass_ = function() {
- return this.matchersClass || this.env.matchersClass;
-};
-
-jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
- var parent = this.getMatchersClass_();
- var newMatchersClass = function() {
- parent.apply(this, arguments);
- };
- jasmine.util.inherit(newMatchersClass, parent);
- jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
- this.matchersClass = newMatchersClass;
-};
-
-jasmine.Spec.prototype.finishCallback = function() {
- this.env.reporter.reportSpecResults(this);
-};
-
-jasmine.Spec.prototype.finish = function(onComplete) {
- this.removeAllSpies();
- this.finishCallback();
- if (onComplete) {
- onComplete();
- }
-};
-
-jasmine.Spec.prototype.after = function(doAfter) {
- if (this.queue.isRunning()) {
- this.queue.add(new jasmine.Block(this.env, doAfter, this));
- } else {
- this.afterCallbacks.unshift(doAfter);
- }
-};
-
-jasmine.Spec.prototype.execute = function(onComplete) {
- var spec = this;
- if (!spec.env.specFilter(spec)) {
- spec.results_.skipped = true;
- spec.finish(onComplete);
- return;
- }
-
- this.env.reporter.reportSpecStarting(this);
-
- spec.env.currentSpec = spec;
-
- spec.addBeforesAndAftersToQueue();
-
- spec.queue.start(function () {
- spec.finish(onComplete);
- });
-};
-
-jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
- var runner = this.env.currentRunner();
- var i;
-
- for (var suite = this.suite; suite; suite = suite.parentSuite) {
- for (i = 0; i < suite.before_.length; i++) {
- this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
- }
- }
- for (i = 0; i < runner.before_.length; i++) {
- this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
- }
- for (i = 0; i < this.afterCallbacks.length; i++) {
- this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
- }
- for (suite = this.suite; suite; suite = suite.parentSuite) {
- for (i = 0; i < suite.after_.length; i++) {
- this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
- }
- }
- for (i = 0; i < runner.after_.length; i++) {
- this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
- }
-};
-
-jasmine.Spec.prototype.explodes = function() {
- throw 'explodes function should not have been called';
-};
-
-jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
- if (obj == jasmine.undefined) {
- throw "spyOn could not find an object to spy upon for " + methodName + "()";
- }
-
- if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
- throw methodName + '() method does not exist';
- }
-
- if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
- throw new Error(methodName + ' has already been spied upon');
- }
-
- var spyObj = jasmine.createSpy(methodName);
-
- this.spies_.push(spyObj);
- spyObj.baseObj = obj;
- spyObj.methodName = methodName;
- spyObj.originalValue = obj[methodName];
-
- obj[methodName] = spyObj;
-
- return spyObj;
-};
-
-jasmine.Spec.prototype.removeAllSpies = function() {
- for (var i = 0; i < this.spies_.length; i++) {
- var spy = this.spies_[i];
- spy.baseObj[spy.methodName] = spy.originalValue;
- }
- this.spies_ = [];
-};
-
-/**
- * Internal representation of a Jasmine suite.
- *
- * @constructor
- * @param {jasmine.Env} env
- * @param {String} description
- * @param {Function} specDefinitions
- * @param {jasmine.Suite} parentSuite
- */
-jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
- var self = this;
- self.id = env.nextSuiteId ? env.nextSuiteId() : null;
- self.description = description;
- self.queue = new jasmine.Queue(env);
- self.parentSuite = parentSuite;
- self.env = env;
- self.before_ = [];
- self.after_ = [];
- self.children_ = [];
- self.suites_ = [];
- self.specs_ = [];
-};
-
-jasmine.Suite.prototype.getFullName = function() {
- var fullName = this.description;
- for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
- fullName = parentSuite.description + ' ' + fullName;
- }
- return fullName;
-};
-
-jasmine.Suite.prototype.finish = function(onComplete) {
- this.env.reporter.reportSuiteResults(this);
- this.finished = true;
- if (typeof(onComplete) == 'function') {
- onComplete();
- }
-};
-
-jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
- beforeEachFunction.typeName = 'beforeEach';
- this.before_.unshift(beforeEachFunction);
-};
-
-jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
- afterEachFunction.typeName = 'afterEach';
- this.after_.unshift(afterEachFunction);
-};
-
-jasmine.Suite.prototype.results = function() {
- return this.queue.results();
-};
-
-jasmine.Suite.prototype.add = function(suiteOrSpec) {
- this.children_.push(suiteOrSpec);
- if (suiteOrSpec instanceof jasmine.Suite) {
- this.suites_.push(suiteOrSpec);
- this.env.currentRunner().addSuite(suiteOrSpec);
- } else {
- this.specs_.push(suiteOrSpec);
- }
- this.queue.add(suiteOrSpec);
-};
-
-jasmine.Suite.prototype.specs = function() {
- return this.specs_;
-};
-
-jasmine.Suite.prototype.suites = function() {
- return this.suites_;
-};
-
-jasmine.Suite.prototype.children = function() {
- return this.children_;
-};
-
-jasmine.Suite.prototype.execute = function(onComplete) {
- var self = this;
- this.queue.start(function () {
- self.finish(onComplete);
- });
-};
-jasmine.WaitsBlock = function(env, timeout, spec) {
- this.timeout = timeout;
- jasmine.Block.call(this, env, null, spec);
-};
-
-jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
-
-jasmine.WaitsBlock.prototype.execute = function (onComplete) {
- this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
- this.env.setTimeout(function () {
- onComplete();
- }, this.timeout);
-};
-/**
- * A block which waits for some condition to become true, with timeout.
- *
- * @constructor
- * @extends jasmine.Block
- * @param {jasmine.Env} env The Jasmine environment.
- * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true.
- * @param {Function} latchFunction A function which returns true when the desired condition has been met.
- * @param {String} message The message to display if the desired condition hasn't been met within the given time period.
- * @param {jasmine.Spec} spec The Jasmine spec.
- */
-jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
- this.timeout = timeout || env.defaultTimeoutInterval;
- this.latchFunction = latchFunction;
- this.message = message;
- this.totalTimeSpentWaitingForLatch = 0;
- jasmine.Block.call(this, env, null, spec);
-};
-jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
-
-jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10;
-
-jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
- this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
- var latchFunctionResult;
- try {
- latchFunctionResult = this.latchFunction.apply(this.spec);
- } catch (e) {
- this.spec.fail(e);
- onComplete();
- return;
- }
-
- if (latchFunctionResult) {
- onComplete();
- } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) {
- var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen');
- this.spec.fail({
- name: 'timeout',
- message: message
- });
-
- this.abort = true;
- onComplete();
- } else {
- this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
- var self = this;
- this.env.setTimeout(function() {
- self.execute(onComplete);
- }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
- }
-};
-// Mock setTimeout, clearTimeout
-// Contributed by Pivotal Computer Systems, www.pivotalsf.com
-
-jasmine.FakeTimer = function() {
- this.reset();
-
- var self = this;
- self.setTimeout = function(funcToCall, millis) {
- self.timeoutsMade++;
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
- return self.timeoutsMade;
- };
-
- self.setInterval = function(funcToCall, millis) {
- self.timeoutsMade++;
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
- return self.timeoutsMade;
- };
-
- self.clearTimeout = function(timeoutKey) {
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
- };
-
- self.clearInterval = function(timeoutKey) {
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
- };
-
-};
-
-jasmine.FakeTimer.prototype.reset = function() {
- this.timeoutsMade = 0;
- this.scheduledFunctions = {};
- this.nowMillis = 0;
-};
-
-jasmine.FakeTimer.prototype.tick = function(millis) {
- var oldMillis = this.nowMillis;
- var newMillis = oldMillis + millis;
- this.runFunctionsWithinRange(oldMillis, newMillis);
- this.nowMillis = newMillis;
-};
-
-jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
- var scheduledFunc;
- var funcsToRun = [];
- for (var timeoutKey in this.scheduledFunctions) {
- scheduledFunc = this.scheduledFunctions[timeoutKey];
- if (scheduledFunc != jasmine.undefined &&
- scheduledFunc.runAtMillis >= oldMillis &&
- scheduledFunc.runAtMillis <= nowMillis) {
- funcsToRun.push(scheduledFunc);
- this.scheduledFunctions[timeoutKey] = jasmine.undefined;
- }
- }
-
- if (funcsToRun.length > 0) {
- funcsToRun.sort(function(a, b) {
- return a.runAtMillis - b.runAtMillis;
- });
- for (var i = 0; i < funcsToRun.length; ++i) {
- try {
- var funcToRun = funcsToRun[i];
- this.nowMillis = funcToRun.runAtMillis;
- funcToRun.funcToCall();
- if (funcToRun.recurring) {
- this.scheduleFunction(funcToRun.timeoutKey,
- funcToRun.funcToCall,
- funcToRun.millis,
- true);
- }
- } catch(e) {
- }
- }
- this.runFunctionsWithinRange(oldMillis, nowMillis);
- }
-};
-
-jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
- this.scheduledFunctions[timeoutKey] = {
- runAtMillis: this.nowMillis + millis,
- funcToCall: funcToCall,
- recurring: recurring,
- timeoutKey: timeoutKey,
- millis: millis
- };
-};
-
-/**
- * @namespace
- */
-jasmine.Clock = {
- defaultFakeTimer: new jasmine.FakeTimer(),
-
- reset: function() {
- jasmine.Clock.assertInstalled();
- jasmine.Clock.defaultFakeTimer.reset();
- },
-
- tick: function(millis) {
- jasmine.Clock.assertInstalled();
- jasmine.Clock.defaultFakeTimer.tick(millis);
- },
-
- runFunctionsWithinRange: function(oldMillis, nowMillis) {
- jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
- },
-
- scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
- jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
- },
-
- useMock: function() {
- if (!jasmine.Clock.isInstalled()) {
- var spec = jasmine.getEnv().currentSpec;
- spec.after(jasmine.Clock.uninstallMock);
-
- jasmine.Clock.installMock();
- }
- },
-
- installMock: function() {
- jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
- },
-
- uninstallMock: function() {
- jasmine.Clock.assertInstalled();
- jasmine.Clock.installed = jasmine.Clock.real;
- },
-
- real: {
- setTimeout: jasmine.getGlobal().setTimeout,
- clearTimeout: jasmine.getGlobal().clearTimeout,
- setInterval: jasmine.getGlobal().setInterval,
- clearInterval: jasmine.getGlobal().clearInterval
- },
-
- assertInstalled: function() {
- if (!jasmine.Clock.isInstalled()) {
- throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
- }
- },
-
- isInstalled: function() {
- return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
- },
-
- installed: null
-};
-jasmine.Clock.installed = jasmine.Clock.real;
-
-//else for IE support
-jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
- if (jasmine.Clock.installed.setTimeout.apply) {
- return jasmine.Clock.installed.setTimeout.apply(this, arguments);
- } else {
- return jasmine.Clock.installed.setTimeout(funcToCall, millis);
- }
-};
-
-jasmine.getGlobal().setInterval = function(funcToCall, millis) {
- if (jasmine.Clock.installed.setInterval.apply) {
- return jasmine.Clock.installed.setInterval.apply(this, arguments);
- } else {
- return jasmine.Clock.installed.setInterval(funcToCall, millis);
- }
-};
-
-jasmine.getGlobal().clearTimeout = function(timeoutKey) {
- if (jasmine.Clock.installed.clearTimeout.apply) {
- return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
- } else {
- return jasmine.Clock.installed.clearTimeout(timeoutKey);
- }
-};
-
-jasmine.getGlobal().clearInterval = function(timeoutKey) {
- if (jasmine.Clock.installed.clearTimeout.apply) {
- return jasmine.Clock.installed.clearInterval.apply(this, arguments);
- } else {
- return jasmine.Clock.installed.clearInterval(timeoutKey);
- }
-};
-
-
-jasmine.version_= {
- "major": 1,
- "minor": 0,
- "build": 2,
- "revision": 1298837858
-};
diff --git a/public/vendor/accounting/tests/jasmine/runner.html b/public/vendor/accounting/tests/jasmine/runner.html
deleted file mode 100644
index 54be51c757d8..000000000000
--- a/public/vendor/accounting/tests/jasmine/runner.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- Jasmine Test Runner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/vendor/accounting/tests/qunit/methods.js b/public/vendor/accounting/tests/qunit/methods.js
deleted file mode 100644
index 816580b8e1a7..000000000000
--- a/public/vendor/accounting/tests/qunit/methods.js
+++ /dev/null
@@ -1,92 +0,0 @@
-$(document).ready(function() {
-
- module("Library Methods");
-
- test("accounting.unformat()", function() {
- equals(accounting.unformat("$12,345,678.90 USD"), 12345678.9, 'Can unformat currency to float');
- equals(accounting.unformat(1234567890), 1234567890, 'Returns same value when passed an integer');
- equals(accounting.unformat("string"), 0, 'Returns 0 for a string with no numbers');
- equals(accounting.unformat({joss:1}), 0, 'Returns 0 for object');
- });
-
- test("accounting.toFixed()", function() {
- equals(accounting.toFixed(54321, 5), "54321.00000", 'Performs basic float zero-padding');
- equals(accounting.toFixed(0.615, 2), "0.62", 'Rounds 0.615 to "0.62" instead of "0.61"');
- });
-
- test("accounting.formatNumber()", function() {
- // Check custom precision and separators:
- equals(accounting.formatNumber(4999.99, 2, ".", ","), "4.999,99", 'Custom precision and decimal/thousand separators are a-ok')
-
- // check usage with options object parameter:
- equal(accounting.formatNumber(5318008, {
- precision : 3,
- thousand : "__",
- decimal : "--"
- }), "5__318__008--000", 'Correctly handles custom precision and separators passed in via second param options object');
-
-
- // check rounding:
- equals(accounting.formatNumber(0.615, 2), "0.62", 'Rounds 0.615 up to "0.62" with precision of 2');
-
- // manually and recursively formatted arrays should have same values:
- var numbers = [8008135, [1234, 5678], 1000];
- var formattedManually = [accounting.formatNumber(8008135), [accounting.formatNumber(1234), accounting.formatNumber(5678)], accounting.formatNumber(1000)];
- var formattedRecursively = accounting.formatNumber(numbers);
- equals(formattedRecursively.toString(), formattedManually.toString(), 'can recursively format multi-dimensional arrays');
- });
-
-
- test("accounting.formatMoney()", function() {
- equals(accounting.formatMoney(12345678), "$12,345,678.00", "Default usage with default parameters is ok");
- equals(accounting.formatMoney(4999.99, "$ ", 2, ".", ","), "$ 4.999,99", 'custom formatting via straight params works ok');
- equals(accounting.formatMoney(-500000, "£ ", 0), "£ -500,000", 'negative values, custom params, works ok');
- equals(accounting.formatMoney(5318008, { symbol: "GBP", format: "%v %s" }), "5,318,008.00 GBP", "`format` parameter is observed in string output");
- equals(accounting.formatMoney(1000, { format: "test %v 123 %s test" }), "test 1,000.00 123 $ test", "`format` parameter is observed in string output, despite being rather strange");
-
- // Format param is an object:
- var format = {
- pos: "%s %v",
- neg: "%s (%v)",
- zero:"%s --"
- }
- equals(accounting.formatMoney(0, { symbol: "GBP", format:format}), "GBP --", "`format` parameter provided given as an object with `zero` format, correctly observed in string output");
- equals(accounting.formatMoney(-1000, { symbol: "GBP", format:format}), "GBP (1,000.00)", "`format` parameter provided given as an object with `neg` format, correctly observed in string output");
- equals(accounting.formatMoney(1000, { symbol: "GBP", format:{neg:"--%v %s"}}), "GBP1,000.00", "`format` parameter provided, but only `neg` value provided - positive value should be formatted by default format (%s%v)");
-
- accounting.settings.currency.format = "%s%v";
- accounting.formatMoney(0, {format:""});
- equals(typeof accounting.settings.currency.format, "object", "`settings.currency.format` default string value should be reformatted to an object, the first time it is used");
- });
-
-
- test("accounting.formatColumn()", function() {
- // standard usage:
- var list = [123, 12345];
- equals(accounting.formatColumn(list, "$ ", 0).toString(), (["$ 123", "$ 12,345"]).toString(), "formatColumn works as expected");
-
-
- // multi-dimensional array (formatColumn should be applied recursively):
- var list = [[1, 100], [900, 9]];
- equals(accounting.formatColumn(list).toString(), ([["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]).toString(), "formatcolumn works on multi-dimensional array");
-
-
- // random numbers, must come back same length:
- var column = accounting.formatColumn([Math.random(), Math.random() * 1000, Math.random() * 10000000]);
- ok((column[0].length === column[2].length && column[1].length === column[2].length), "formatColumn() with 3 random numbers returned strings of matching length");
-
-
- // random numbers, must come back same length:
- var column = accounting.formatColumn([Math.random(), Math.random() * 1000, Math.random() * 10000000], {
- format: '(%v] --++== %s',
- thousand: ')(',
- decimal: ')[',
- precision: 3
- });
- ok((column[0].length === column[2].length && column[1].length === column[2].length), "formatColumn() with 3 random numbers returned strings of matching length, even with a weird custom `format` parameter");
-
-
-
- });
-
-});
diff --git a/public/vendor/accounting/tests/qunit/speed.js b/public/vendor/accounting/tests/qunit/speed.js
deleted file mode 100644
index c5d0f86d169f..000000000000
--- a/public/vendor/accounting/tests/qunit/speed.js
+++ /dev/null
@@ -1,76 +0,0 @@
-(function() {
-
- var numbers = [];
- for (var i=0; i<1000; i++) numbers.push((Math.random() * (1000*i)));
- var strings = $.map(numbers, function(num){ return accounting.formatMoney(num*1000, "HK$ "); });
-
- JSLitmus.test('unformat()', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.unformat(strings[i])
- i++;
- i > strings.length && (i = 0);
- }
- });
-
- JSLitmus.test('unformat(array)', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.unformat([strings[i], strings[i+1]]);
- i += 2;
- i > numbers.length && (i = 0);
- }
- });
-
- JSLitmus.test('toFixed()', function(count) {
- while ( count-- ) {
- accounting.toFixed(count*1000, 2);
- }
- });
-
- JSLitmus.test('formatNumber()', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.formatNumber(numbers[i]);
- i++;
- i > numbers.length && (i = 0);
- }
- });
-
- JSLitmus.test('formatNumber(array)', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.formatNumber([numbers[i], numbers[i+1]]);
- i += 2;
- i > numbers.length && (i = 0);
- }
- });
-
- JSLitmus.test('formatMoney()', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.formatMoney(numbers[i]);
- i++;
- i > numbers.length && (i = 0);
- }
- });
-
- JSLitmus.test('formatMoney(array)', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.formatMoney([numbers[i], numbers[i+1]]);
- i += 2;
- i > numbers.length && (i = 0);
- }
- });
-
- JSLitmus.test('formatColumn()', function(count) {
- var i = 0;
- while ( count-- ) {
- accounting.formatColumn([numbers[i], numbers[i+1]]);
- i += 2;
- i > numbers.length && (i = 0);
- }
- });
-
-})();
diff --git a/public/vendor/accounting/tests/qunit/test.html b/public/vendor/accounting/tests/qunit/test.html
deleted file mode 100644
index 7c9b02c02c20..000000000000
--- a/public/vendor/accounting/tests/qunit/test.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- accounting.js test suite
-
-
-
-
-
-
-
-
-
-
-
-
accounting.js tests
-
-
-
-
-
accounting.js speed tests
-
Each library method is represented here running on predefined random numbers/strings, with default parameters, to provide a sense of how fast they might run in different browsers.
a';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("").append(M.responseText.replace(/
-
-::
-
- $('.datepicker').datepicker({
- language: 'XX'
- });
diff --git a/public/vendor/bootstrap-datepicker/docs/index.rst b/public/vendor/bootstrap-datepicker/docs/index.rst
deleted file mode 100644
index 03ff9ac639fb..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/index.rst
+++ /dev/null
@@ -1,122 +0,0 @@
-bootstrap-datepicker
-====================
-
-Bootstrap-datepicker provides a flexible datepicker widget in the Twitter bootstrap style.
-
-.. figure:: _static/demo_head.png
- :align: center
-
-This is a fork of Stefan Petre's `original code `_; thanks go to him for getting this thing started!
-
-Please note that this fork is not used on Stefan's page at this time, nor is it maintained or contributed to by him.
-
-Versions are incremented according to `semver `_.
-
-`Online Demo `_
-
-
-Requirements
-------------
-
-* `Bootstrap`_ 2.0.4+
-* `jQuery`_ 1.7.1+
-
-.. _Bootstrap: http://twitter.github.com/bootstrap/
-.. _jQuery: http://jquery.com/
-
-These are the specific versions bootstrap-datepicker is tested against (``js`` files) and built against (``css`` files). Use other versions at your own risk.
-
-
-Dependencies
-------------
-
-Requires bootstrap's dropdown component (``dropdowns.less``) for some styles, and bootstrap's sprites (``sprites.less`` and associated images) for arrows.
-
-A standalone .css file (including necessary dropdown styles and alternative, text-based arrows) can be generated by running ``build/build_standalone.less`` through the ``lessc`` compiler::
-
- $ lessc build/build_standalone.less datepicker.css
-
-
-Usage
------
-
-Call the datepicker via javascript::
-
- $('.datepicker').datepicker()
-
-
-Data API
-^^^^^^^^
-
-As with bootstrap's own plugins, datepicker provides a data-api that can be used to instantiate datepickers without the need for custom javascript. For most datepickers, simply set ``data-provide="datepicker"`` on the element you want to initialize, and it will be intialized lazily, in true bootstrap fashion. For inline datepickers, use ``data-provide="datepicker-inline"``; these will be immediately initialized on page load, and cannot be lazily loaded.
-
-.. code-block:: html
-
-
-
-You can disable datepicker's data-api in the same way as you would disable other bootstrap plugins::
-
- $(document).off('.datepicker.data-api');
-
-
-Configuration
-^^^^^^^^^^^^^
-
-:doc:`options` are passed to the ``datepicker`` function via an options hash at instantiation::
-
- $('.datepicker').datepicker({
- format: 'mm/dd/yyyy',
- startDate: '-3d'
- })
-
-Most options may be provided as data-attributes on the target element:
-
-.. code-block:: html
-
-
-
-::
-
- $('.datepicker').datepicker({
- startDate: '-3d'
- })
-
-Defaults for all options can be modified directly by changing values in the ``$.fn.datepicker.defaults`` hash::
-
- $.fn.datepicker.defaults.format = "mm/dd/yyyy";
- $('.datepicker').datepicker({
- startDate: '-3d'
- })
-
-
-No Conflict mode
-^^^^^^^^^^^^^^^^
-
-``$.fn.datepicker.noConflict`` provides a way to avoid conflict with other jQuery datepicker plugins::
-
- var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
- $.fn.bootstrapDP = datepicker; // give $().bootstrapDP the bootstrap-datepicker functionality
-
-
-
-Table of Contents
------------------
-
-.. toctree::
-
- markup
- options
- methods
- events
- keyboard
- i18n
-
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
diff --git a/public/vendor/bootstrap-datepicker/docs/keyboard.rst b/public/vendor/bootstrap-datepicker/docs/keyboard.rst
deleted file mode 100644
index e34ba65d6e90..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/keyboard.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-Keyboard support
-================
-
-The datepicker includes keyboard navigation. The "focused date" is kept track of and highlighted (as with mouse hover) during keyboard nav, and is cleared when a date is toggled or the picker is hidden.
-
-up, down, left, right arrow keys
---------------------------------
-
-By themselves, left/right will move focus backward/forward one day, up/down will move focus back/forward one week.
-
-With the shift key, up/left will move focus backward one month, down/right will move focus forward one month.
-
-With the ctrl key, up/left will move focus backward one year, down/right will move focus forward one year.
-
-Shift+ctrl behaves the same as ctrl -- that is, it does not change both month and year simultaneously, only the year.
-
-enter
------
-
-When the picker is visible, enter will toggle the focused date (if there is one). When the picker is not visible, enter will have normal effects -- submitting the current form, etc.
-
-When the date is deselected, the ``clearDate`` event is triggered; otherwise, the ``changeDate`` event is triggered. If ``autoclose`` is enabled, the picker will be hidden after selection or deselection.
-
-escape
-------
-
-The escape key can be used to clear the focused date and hide and re-show the datepicker; hiding the picker is necessary if the user wants to manually edit the value.
diff --git a/public/vendor/bootstrap-datepicker/docs/make.bat b/public/vendor/bootstrap-datepicker/docs/make.bat
deleted file mode 100644
index 282b37a8f362..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/make.bat
+++ /dev/null
@@ -1,190 +0,0 @@
-@ECHO OFF
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set BUILDDIR=_build
-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
-set I18NSPHINXOPTS=%SPHINXOPTS% .
-if NOT "%PAPER%" == "" (
- set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
- set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
-)
-
-if "%1" == "" goto help
-
-if "%1" == "help" (
- :help
- echo.Please use `make ^` where ^ is one of
- echo. html to make standalone HTML files
- echo. dirhtml to make HTML files named index.html in directories
- echo. singlehtml to make a single large HTML file
- echo. pickle to make pickle files
- echo. json to make JSON files
- echo. htmlhelp to make HTML files and a HTML help project
- echo. qthelp to make HTML files and a qthelp project
- echo. devhelp to make HTML files and a Devhelp project
- echo. epub to make an epub
- echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
- echo. text to make text files
- echo. man to make manual pages
- echo. texinfo to make Texinfo files
- echo. gettext to make PO message catalogs
- echo. changes to make an overview over all changed/added/deprecated items
- echo. linkcheck to check all external links for integrity
- echo. doctest to run all doctests embedded in the documentation if enabled
- goto end
-)
-
-if "%1" == "clean" (
- for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
- del /q /s %BUILDDIR%\*
- goto end
-)
-
-if "%1" == "html" (
- %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/html.
- goto end
-)
-
-if "%1" == "dirhtml" (
- %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
- goto end
-)
-
-if "%1" == "singlehtml" (
- %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
- goto end
-)
-
-if "%1" == "pickle" (
- %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the pickle files.
- goto end
-)
-
-if "%1" == "json" (
- %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the JSON files.
- goto end
-)
-
-if "%1" == "htmlhelp" (
- %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run HTML Help Workshop with the ^
-.hhp project file in %BUILDDIR%/htmlhelp.
- goto end
-)
-
-if "%1" == "qthelp" (
- %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run "qcollectiongenerator" with the ^
-.qhcp project file in %BUILDDIR%/qthelp, like this:
- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\bootstrap-datepicker.qhcp
- echo.To view the help file:
- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\bootstrap-datepicker.ghc
- goto end
-)
-
-if "%1" == "devhelp" (
- %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished.
- goto end
-)
-
-if "%1" == "epub" (
- %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The epub file is in %BUILDDIR%/epub.
- goto end
-)
-
-if "%1" == "latex" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
- goto end
-)
-
-if "%1" == "text" (
- %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The text files are in %BUILDDIR%/text.
- goto end
-)
-
-if "%1" == "man" (
- %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The manual pages are in %BUILDDIR%/man.
- goto end
-)
-
-if "%1" == "texinfo" (
- %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
- goto end
-)
-
-if "%1" == "gettext" (
- %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
- goto end
-)
-
-if "%1" == "changes" (
- %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
- if errorlevel 1 exit /b 1
- echo.
- echo.The overview file is in %BUILDDIR%/changes.
- goto end
-)
-
-if "%1" == "linkcheck" (
- %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
- if errorlevel 1 exit /b 1
- echo.
- echo.Link check complete; look for any errors in the above output ^
-or in %BUILDDIR%/linkcheck/output.txt.
- goto end
-)
-
-if "%1" == "doctest" (
- %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of doctests in the sources finished, look at the ^
-results in %BUILDDIR%/doctest/output.txt.
- goto end
-)
-
-:end
diff --git a/public/vendor/bootstrap-datepicker/docs/markup.rst b/public/vendor/bootstrap-datepicker/docs/markup.rst
deleted file mode 100644
index a6ec82b24742..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/markup.rst
+++ /dev/null
@@ -1,50 +0,0 @@
-Markup
-=======
-
-The following are examples of supported markup. On their own, these will not provide a datepicker widget; you will need to instantiate the datepicker on the markup.
-
-
-input
------
-
-The simplest case: focusing the input (clicking or tabbing into it) will show the picker.
-
-.. code-block:: html
-
-
-
-component
----------
-
-Adding the ``date`` class to an ``input-append`` or ``input-prepend`` bootstrap component will allow the ``add-on`` elements to trigger the picker.
-
-.. code-block:: html
-
-
-
-
-
-
-
-date-range
-----------
-
-Using the ``input-daterange`` construct with multiple child inputs will instantiate one picker per input and link them together to allow selecting ranges.
-
-.. code-block:: html
-
-
-
- to
-
-
-
-
-inline or embedded
-------------------
-
-Instantiating the datepicker on a simple div will give an embedded picker that is always visible.
-
-.. code-block:: html
-
-
diff --git a/public/vendor/bootstrap-datepicker/docs/methods.rst b/public/vendor/bootstrap-datepicker/docs/methods.rst
deleted file mode 100644
index 3e38f9515b19..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/methods.rst
+++ /dev/null
@@ -1,164 +0,0 @@
-Methods
-=======
-
-Methods are called on a datepicker by call the ``datepicker`` function with a string first argument, followed by any arguments the method takes::
-
- $('.datepicker').datepicker('method', arg1, arg2);
-
-
-remove
-------
-
-Arguments: None
-
-Remove the datepicker. Removes attached events, internal attached objects, and added HTML elements.
-
-
-show
-----
-
-Arguments: None
-
-Show the picker.
-
-
-hide
-----
-
-Arguments: None
-
-Hide the picker.
-
-
-update
-------
-
-Arguments:
-
-* date (String|Date, optional)
-
-Update the datepicker with given argument or the current input value.
-
-If ``date`` is provided and is a Date object, it is assumed to be a "local" date object, and will be converted to UTC for internal use.
-
-::
-
- $('.datepicker').datepicker('update');
- $('.datepicker').datepicker('update', '2011-03-05');
- $('.datepicker').datepicker('update', new Date(2011, 2, 5));
-
-
-setDate
--------
-
-Arguments:
-
-* date (Date)
-
-Sets the internal date. ``date`` is assumed to be a "local" date object, and will be converted to UTC for internal use.
-
-
-setUTCDate
-----------
-
-Arguments:
-
-* date (Date)
-
-Sets the internal date. ``date`` is assumed to be a UTC date object, and will not be converted.
-
-
-setDates
---------
-
-Arguments:
-
-* date[, date[, ...]] (Date)
-
-or
-
-* [date[, date[, ...]]] (Array)
-
-Sets the internal date list; accepts multiple dates or a single array of dates as arguments. Each ``date`` is assumed to mbe a "local" date object, and will be converted to UTC for internal use. For use with multidate pickers.
-
-
-setUTCDates
------------
-
-Arguments:
-
-* date[, date[, ...]] (Date)
-
-or
-
-* [date[, date[, ...]]] (Array)
-
-Sets the internal date list. Each ``date`` is assumed to be a UTC date object, and will not be converted. For use with multidate pickers.
-
-
-getDate
--------
-
-Arguments: None
-
-Returns a localized date object representing the internal date object of the first datepicker in the selection. For multidate pickers, returns the latest date selected.
-
-
-getUTCDate
-----------
-
-Arguments: None
-
-Returns the internal UTC date object, as-is and unconverted to local time, of the first datepicker in the selection. For multidate pickers, returns the latest date selected.
-
-
-getDates
---------
-
-Arguments: None
-
-Returns a list of localized date objects representing the internal date objects of the first datepicker in the selection. For use with multidate pickers.
-
-
-getUTCDates
------------
-
-Arguments: None
-
-Returns the internal list of UTC date objects, as they are and unconverted to local time, of the first datepicker in the selection. For use with multidate pickers.
-
-
-setStartDate
-------------
-
-Arguments:
-
-* startDate (Date)
-
-Sets a new lower date limit on the datepicker. See :ref:`startdate` for valid values.
-
-Omit startDate (or provide an otherwise falsey value) to unset the limit.
-
-
-setEndDate
-----------
-
-Arguments:
-
-* endDate (Date)
-
-Sets a new upper date limit on the datepicker. See :ref:`enddate` for valid values.
-
-Omit endDate (or provide an otherwise falsey value) to unset the limit.
-
-
-setDaysOfWeekDisabled
----------------------
-
-Arguments:
-
-* daysOfWeekDisabled (String|Array)
-
-Sets the days of week that should be disabled. See :ref:`daysofweekdisabled` for valid values.
-
-Omit daysOfWeekDisabled (or provide an otherwise falsey value) to unset the disabled days.
diff --git a/public/vendor/bootstrap-datepicker/docs/options.rst b/public/vendor/bootstrap-datepicker/docs/options.rst
deleted file mode 100644
index 82459c40ec60..000000000000
--- a/public/vendor/bootstrap-datepicker/docs/options.rst
+++ /dev/null
@@ -1,191 +0,0 @@
-Options
-=======
-
-All options that take a "Date" can handle a ``Date`` object; a String formatted according to the given ``format``; or a timedelta relative to today, eg "-1d", "+6m +1y", etc, where valid units are "d" (day), "w" (week), "m" (month), and "y" (year).
-
-Most options can be provided via data-attributes. An option can be converted to a data-attribute by taking its name, replacing each uppercase letter with its lowercase equivalent preceded by a dash, and prepending "data-date-" to the result. For example, ``startDate`` would be ``data-date-start-date``, ``format`` would be ``data-date-format``, and ``daysOfWeekDisabled`` would be ``data-date-days-of-week-disabled``.
-
-
-autoclose
----------
-
-Boolean. Default: false
-
-Whether or not to close the datepicker immediately when a date is selected.
-
-
-beforeShowDay
--------------
-
-Function(Date). Default: $.noop
-
-A function that takes a date as a parameter and returns one of the following values:
-
- * undefined to have no effect
- * A Boolean, indicating whether or not this date is selectable
- * A String representing additional CSS classes to apply to the date's cell
- * An object with the following properties:
-
- * ``enabled``: same as the Boolean value above
- * ``classes``: same as the String value above
- * ``tooltip``: a tooltip to apply to this date, via the ``title`` HTML attribute
-
-
-calendarWeeks
--------------
-
-Boolean. Default: false
-
-Whether or not to show week numbers to the left of week rows.
-
-
-clearBtn
---------
-
-Boolean. Default: false
-
-If true, displays a "Clear" button at the bottom of the datepicker to clear the input value. If "autoclose" is also set to true, this button will also close the datepicker.
-
-
-.. _daysofweekdisabled:
-
-daysOfWeekDisabled
-------------------
-
-String, Array. Default: '', []
-
-Days of the week that should be disabled. Values are 0 (Sunday) to 6 (Saturday). Multiple values should be comma-separated. Example: disable weekends: ``'0,6'`` or ``[0,6]``.
-
-
-.. _enddate:
-
-endDate
--------
-
-Date. Default: End of time
-
-The latest date that may be selected; all later dates will be disabled.
-
-
-forceParse
-----------
-
-Boolean. Default: true
-
-Whether or not to force parsing of the input value when the picker is closed. That is, when an invalid date is left in the input field by the user, the picker will forcibly parse that value, and set the input's value to the new, valid date, conforming to the given `format`.
-
-
-format
-------
-
-String. Default: "mm/dd/yyyy"
-
-The date format, combination of d, dd, D, DD, m, mm, M, MM, yy, yyyy.
-
-* d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
-* D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
-* m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
-* M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
-* yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.
-
-
-inputs
-------
-
-Array. Default: None
-
-A list of inputs to be used in a range picker, which will be attached to the selected element. Allows for explicitly creating a range picker on a non-standard element.
-
-
-keyboardNavigation
-------------------
-
-Boolean. Default: true
-
-Whether or not to allow date navigation by arrow keys.
-
-
-language
---------
-
-String. Default: "en"
-
-The IETF code (eg "en" for English, "pt-BR" for Brazilian Portuguese) of the language to use for month and day names. These will also be used as the input's value (and subsequently sent to the server in the case of form submissions). If a full code (eg "de-DE") is supplied the picker will first check for an "de-DE" language and if not found will fallback and check for a "de" language. If an unknown language code is given, English will be used. See :doc:`i18n`.
-
-
-minViewMode
------------
-
-Number, String. Default: 0, "days"
-
-Set a limit for the view mode. Accepts: "days" or 0, "months" or 1, and "years" or 2.
-Gives the ability to pick only a month or an year. The day is set to the 1st for "months", and the month is set to January for "years".
-
-
-multidate
----------
-
-Boolean, Number. Default: false
-
-Enable multidate picking. Each date in month view acts as a toggle button, keeping track of which dates the user has selected in order. If a number is given, the picker will limit how many dates can be selected to that number, dropping the oldest dates from the list when the number is exceeded. ``true`` equates to no limit. The input's value (if present) is set to a string generated by joining the dates, formatted, with ``multidateSeparator``.
-
-
-multidateSeparator
-------------------
-
-String. Default: ","
-
-The string that will appear between dates when generating the input's value. When parsing the input's value for a multidate picker, this will also be used to split the incoming string to separate multiple formatted dates; as such, it is highly recommended that you not use a string that could be a substring of a formatted date (eg, using '-' to separate dates when your format is 'yyyy-mm-dd').
-
-
-orientation
------------
-
-String. Default: "auto"
-
-A space-separated string consisting of one or two of "left" or "right", "top" or "bottom", and "auto" (may be omitted); for example, "top left", "bottom" (horizontal orientation will default to "auto"), "right" (vertical orientation will default to "auto"), "auto top". Allows for fixed placement of the picker popup.
-
-"orientation" refers to the location of the picker popup's "anchor"; you can also think of it as the location of the trigger element (input, component, etc) relative to the picker.
-
-"auto" triggers "smart orientation" of the picker. Horizontal orientation will default to "left" and left offset will be tweaked to keep the picker inside the browser viewport; vertical orientation will simply choose "top" or "bottom", whichever will show more of the picker in the viewport.
-
-.. _startdate:
-
-startDate
----------
-
-Date. Default: Beginning of time
-
-The earliest date that may be selected; all earlier dates will be disabled.
-
-
-startView
----------
-
-Number, String. Default: 0, "month"
-
-The view that the datepicker should show when it is opened. Accepts values of 0 or "month" for month view (the default), 1 or "year" for the 12-month overview, and 2 or "decade" for the 10-year overview. Useful for date-of-birth datepickers.
-
-
-todayBtn
---------
-
-Boolean, "linked". Default: false
-
-If true or "linked", displays a "Today" button at the bottom of the datepicker to select the current date. If true, the "Today" button will only move the current date into view; if "linked", the current date will also be selected.
-
-
-todayHighlight
---------------
-
-Boolean. Default: false
-
-If true, highlights the current date.
-
-
-weekStart
----------
-
-Integer. Default: 0
-
-Day of the week start. 0 (Sunday) to 6 (Saturday)
diff --git a/public/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js b/public/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js
deleted file mode 100644
index 4975226d32d6..000000000000
--- a/public/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js
+++ /dev/null
@@ -1,1671 +0,0 @@
-/* =========================================================
- * bootstrap-datepicker.js
- * Repo: https://github.com/eternicode/bootstrap-datepicker/
- * Demo: http://eternicode.github.io/bootstrap-datepicker/
- * Docs: http://bootstrap-datepicker.readthedocs.org/
- * Forked from http://www.eyecon.ro/bootstrap-datepicker
- * =========================================================
- * Started by Stefan Petre; improvements by Andrew Rowls + contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-(function($, undefined){
-
- var $window = $(window);
-
- function UTCDate(){
- return new Date(Date.UTC.apply(Date, arguments));
- }
- function UTCToday(){
- var today = new Date();
- return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
- }
- function alias(method){
- return function(){
- return this[method].apply(this, arguments);
- };
- }
-
- var DateArray = (function(){
- var extras = {
- get: function(i){
- return this.slice(i)[0];
- },
- contains: function(d){
- // Array.indexOf is not cross-browser;
- // $.inArray doesn't work with Dates
- var val = d && d.valueOf();
- for (var i=0, l=this.length; i < l; i++)
- if (this[i].valueOf() === val)
- return i;
- return -1;
- },
- remove: function(i){
- this.splice(i,1);
- },
- replace: function(new_array){
- if (!new_array)
- return;
- if (!$.isArray(new_array))
- new_array = [new_array];
- this.clear();
- this.push.apply(this, new_array);
- },
- clear: function(){
- this.splice(0);
- },
- copy: function(){
- var a = new DateArray();
- a.replace(this);
- return a;
- }
- };
-
- return function(){
- var a = [];
- a.push.apply(a, arguments);
- $.extend(a, extras);
- return a;
- };
- })();
-
-
- // Picker object
-
- var Datepicker = function(element, options){
- this.dates = new DateArray();
- this.viewDate = UTCToday();
- this.focusDate = null;
-
- this._process_options(options);
-
- this.element = $(element);
- this.isInline = false;
- this.isInput = this.element.is('input');
- this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
- this.hasInput = this.component && this.element.find('input').length;
- if (this.component && this.component.length === 0)
- this.component = false;
-
- this.picker = $(DPGlobal.template);
- this._buildEvents();
- this._attachEvents();
-
- if (this.isInline){
- this.picker.addClass('datepicker-inline').appendTo(this.element);
- }
- else {
- this.picker.addClass('datepicker-dropdown dropdown-menu');
- }
-
- if (this.o.rtl){
- this.picker.addClass('datepicker-rtl');
- }
-
- this.viewMode = this.o.startView;
-
- if (this.o.calendarWeeks)
- this.picker.find('tfoot th.today')
- .attr('colspan', function(i, val){
- return parseInt(val) + 1;
- });
-
- this._allow_update = false;
-
- this.setStartDate(this._o.startDate);
- this.setEndDate(this._o.endDate);
- this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
-
- this.fillDow();
- this.fillMonths();
-
- this._allow_update = true;
-
- this.update();
- this.showMode();
-
- if (this.isInline){
- this.show();
- }
- };
-
- Datepicker.prototype = {
- constructor: Datepicker,
-
- _process_options: function(opts){
- // Store raw options for reference
- this._o = $.extend({}, this._o, opts);
- // Processed options
- var o = this.o = $.extend({}, this._o);
-
- // Check if "de-DE" style date is available, if not language should
- // fallback to 2 letter code eg "de"
- var lang = o.language;
- if (!dates[lang]){
- lang = lang.split('-')[0];
- if (!dates[lang])
- lang = defaults.language;
- }
- o.language = lang;
-
- switch (o.startView){
- case 2:
- case 'decade':
- o.startView = 2;
- break;
- case 1:
- case 'year':
- o.startView = 1;
- break;
- default:
- o.startView = 0;
- }
-
- switch (o.minViewMode){
- case 1:
- case 'months':
- o.minViewMode = 1;
- break;
- case 2:
- case 'years':
- o.minViewMode = 2;
- break;
- default:
- o.minViewMode = 0;
- }
-
- o.startView = Math.max(o.startView, o.minViewMode);
-
- // true, false, or Number > 0
- if (o.multidate !== true){
- o.multidate = Number(o.multidate) || false;
- if (o.multidate !== false)
- o.multidate = Math.max(0, o.multidate);
- else
- o.multidate = 1;
- }
- o.multidateSeparator = String(o.multidateSeparator);
-
- o.weekStart %= 7;
- o.weekEnd = ((o.weekStart + 6) % 7);
-
- var format = DPGlobal.parseFormat(o.format);
- if (o.startDate !== -Infinity){
- if (!!o.startDate){
- if (o.startDate instanceof Date)
- o.startDate = this._local_to_utc(this._zero_time(o.startDate));
- else
- o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
- }
- else {
- o.startDate = -Infinity;
- }
- }
- if (o.endDate !== Infinity){
- if (!!o.endDate){
- if (o.endDate instanceof Date)
- o.endDate = this._local_to_utc(this._zero_time(o.endDate));
- else
- o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
- }
- else {
- o.endDate = Infinity;
- }
- }
-
- o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
- if (!$.isArray(o.daysOfWeekDisabled))
- o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
- o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
- return parseInt(d, 10);
- });
-
- var plc = String(o.orientation).toLowerCase().split(/\s+/g),
- _plc = o.orientation.toLowerCase();
- plc = $.grep(plc, function(word){
- return (/^auto|left|right|top|bottom$/).test(word);
- });
- o.orientation = {x: 'auto', y: 'auto'};
- if (!_plc || _plc === 'auto')
- ; // no action
- else if (plc.length === 1){
- switch (plc[0]){
- case 'top':
- case 'bottom':
- o.orientation.y = plc[0];
- break;
- case 'left':
- case 'right':
- o.orientation.x = plc[0];
- break;
- }
- }
- else {
- _plc = $.grep(plc, function(word){
- return (/^left|right$/).test(word);
- });
- o.orientation.x = _plc[0] || 'auto';
-
- _plc = $.grep(plc, function(word){
- return (/^top|bottom$/).test(word);
- });
- o.orientation.y = _plc[0] || 'auto';
- }
- },
- _events: [],
- _secondaryEvents: [],
- _applyEvents: function(evs){
- for (var i=0, el, ch, ev; i < evs.length; i++){
- el = evs[i][0];
- if (evs[i].length === 2){
- ch = undefined;
- ev = evs[i][1];
- }
- else if (evs[i].length === 3){
- ch = evs[i][1];
- ev = evs[i][2];
- }
- el.on(ev, ch);
- }
- },
- _unapplyEvents: function(evs){
- for (var i=0, el, ev, ch; i < evs.length; i++){
- el = evs[i][0];
- if (evs[i].length === 2){
- ch = undefined;
- ev = evs[i][1];
- }
- else if (evs[i].length === 3){
- ch = evs[i][1];
- ev = evs[i][2];
- }
- el.off(ev, ch);
- }
- },
- _buildEvents: function(){
- if (this.isInput){ // single input
- this._events = [
- [this.element, {
- focus: $.proxy(this.show, this),
- keyup: $.proxy(function(e){
- if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
- this.update();
- }, this),
- keydown: $.proxy(this.keydown, this)
- }]
- ];
- }
- else if (this.component && this.hasInput){ // component: input + button
- this._events = [
- // For components that are not readonly, allow keyboard nav
- [this.element.find('input'), {
- focus: $.proxy(this.show, this),
- keyup: $.proxy(function(e){
- if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
- this.update();
- }, this),
- keydown: $.proxy(this.keydown, this)
- }],
- [this.component, {
- click: $.proxy(this.show, this)
- }]
- ];
- }
- else if (this.element.is('div')){ // inline datepicker
- this.isInline = true;
- }
- else {
- this._events = [
- [this.element, {
- click: $.proxy(this.show, this)
- }]
- ];
- }
- this._events.push(
- // Component: listen for blur on element descendants
- [this.element, '*', {
- blur: $.proxy(function(e){
- this._focused_from = e.target;
- }, this)
- }],
- // Input: listen for blur on element
- [this.element, {
- blur: $.proxy(function(e){
- this._focused_from = e.target;
- }, this)
- }]
- );
-
- this._secondaryEvents = [
- [this.picker, {
- click: $.proxy(this.click, this)
- }],
- [$(window), {
- resize: $.proxy(this.place, this)
- }],
- [$(document), {
- 'mousedown touchstart': $.proxy(function(e){
- // Clicked outside the datepicker, hide it
- if (!(
- this.element.is(e.target) ||
- this.element.find(e.target).length ||
- this.picker.is(e.target) ||
- this.picker.find(e.target).length
- )){
- this.hide();
- }
- }, this)
- }]
- ];
- },
- _attachEvents: function(){
- this._detachEvents();
- this._applyEvents(this._events);
- },
- _detachEvents: function(){
- this._unapplyEvents(this._events);
- },
- _attachSecondaryEvents: function(){
- this._detachSecondaryEvents();
- this._applyEvents(this._secondaryEvents);
- },
- _detachSecondaryEvents: function(){
- this._unapplyEvents(this._secondaryEvents);
- },
- _trigger: function(event, altdate){
- var date = altdate || this.dates.get(-1),
- local_date = this._utc_to_local(date);
-
- this.element.trigger({
- type: event,
- date: local_date,
- dates: $.map(this.dates, this._utc_to_local),
- format: $.proxy(function(ix, format){
- if (arguments.length === 0){
- ix = this.dates.length - 1;
- format = this.o.format;
- }
- else if (typeof ix === 'string'){
- format = ix;
- ix = this.dates.length - 1;
- }
- format = format || this.o.format;
- var date = this.dates.get(ix);
- return DPGlobal.formatDate(date, format, this.o.language);
- }, this)
- });
- },
-
- show: function(){
- if (!this.isInline)
- this.picker.appendTo('body');
- this.picker.show();
- this.place();
- this._attachSecondaryEvents();
- this._trigger('show');
- },
-
- hide: function(){
- if (this.isInline)
- return;
- if (!this.picker.is(':visible'))
- return;
- this.focusDate = null;
- this.picker.hide().detach();
- this._detachSecondaryEvents();
- this.viewMode = this.o.startView;
- this.showMode();
-
- if (
- this.o.forceParse &&
- (
- this.isInput && this.element.val() ||
- this.hasInput && this.element.find('input').val()
- )
- )
- this.setValue();
- this._trigger('hide');
- },
-
- remove: function(){
- this.hide();
- this._detachEvents();
- this._detachSecondaryEvents();
- this.picker.remove();
- delete this.element.data().datepicker;
- if (!this.isInput){
- delete this.element.data().date;
- }
- },
-
- _utc_to_local: function(utc){
- return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
- },
- _local_to_utc: function(local){
- return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
- },
- _zero_time: function(local){
- return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
- },
- _zero_utc_time: function(utc){
- return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
- },
-
- getDates: function(){
- return $.map(this.dates, this._utc_to_local);
- },
-
- getUTCDates: function(){
- return $.map(this.dates, function(d){
- return new Date(d);
- });
- },
-
- getDate: function(){
- return this._utc_to_local(this.getUTCDate());
- },
-
- getUTCDate: function(){
- return new Date(this.dates.get(-1));
- },
-
- setDates: function(){
- var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
- this.update.apply(this, args);
- this._trigger('changeDate');
- this.setValue();
- },
-
- setUTCDates: function(){
- var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
- this.update.apply(this, $.map(args, this._utc_to_local));
- this._trigger('changeDate');
- this.setValue();
- },
-
- setDate: alias('setDates'),
- setUTCDate: alias('setUTCDates'),
-
- setValue: function(){
- var formatted = this.getFormattedDate();
- if (!this.isInput){
- if (this.component){
- this.element.find('input').val(formatted).change();
- }
- }
- else {
- this.element.val(formatted); //.change();
- }
- },
-
- getFormattedDate: function(format){
- if (format === undefined)
- format = this.o.format;
-
- var lang = this.o.language;
- return $.map(this.dates, function(d){
- return DPGlobal.formatDate(d, format, lang);
- }).join(this.o.multidateSeparator);
- },
-
- setStartDate: function(startDate){
- this._process_options({startDate: startDate});
- this.update();
- this.updateNavArrows();
- },
-
- setEndDate: function(endDate){
- this._process_options({endDate: endDate});
- this.update();
- this.updateNavArrows();
- },
-
- setDaysOfWeekDisabled: function(daysOfWeekDisabled){
- this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
- this.update();
- this.updateNavArrows();
- },
-
- place: function(){
- if (this.isInline)
- return;
- var calendarWidth = this.picker.outerWidth(),
- calendarHeight = this.picker.outerHeight(),
- visualPadding = 10,
- windowWidth = $window.width(),
- windowHeight = $window.height(),
- scrollTop = $window.scrollTop();
-
- var zIndex = parseInt(this.element.parents().filter(function(){
- return $(this).css('z-index') !== 'auto';
- }).first().css('z-index'))+10;
- var offset = this.component ? this.component.parent().offset() : this.element.offset();
- var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
- var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
- var left = offset.left,
- top = offset.top;
-
- this.picker.removeClass(
- 'datepicker-orient-top datepicker-orient-bottom '+
- 'datepicker-orient-right datepicker-orient-left'
- );
-
- if (this.o.orientation.x !== 'auto'){
- this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
- if (this.o.orientation.x === 'right')
- left -= calendarWidth - width;
- }
- // auto x orientation is best-placement: if it crosses a window
- // edge, fudge it sideways
- else {
- // Default to left
- this.picker.addClass('datepicker-orient-left');
- if (offset.left < 0)
- left -= offset.left - visualPadding;
- else if (offset.left + calendarWidth > windowWidth)
- left = windowWidth - calendarWidth - visualPadding;
- }
-
- // auto y orientation is best-situation: top or bottom, no fudging,
- // decision based on which shows more of the calendar
- var yorient = this.o.orientation.y,
- top_overflow, bottom_overflow;
- if (yorient === 'auto'){
- top_overflow = -scrollTop + offset.top - calendarHeight;
- bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
- if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
- yorient = 'top';
- else
- yorient = 'bottom';
- }
- this.picker.addClass('datepicker-orient-' + yorient);
- if (yorient === 'top')
- top += height;
- else
- top -= calendarHeight + parseInt(this.picker.css('padding-top'));
-
- this.picker.css({
- top: top,
- left: left,
- zIndex: zIndex
- });
- },
-
- _allow_update: true,
- update: function(){
- if (!this._allow_update)
- return;
-
- var oldDates = this.dates.copy(),
- dates = [],
- fromArgs = false;
- if (arguments.length){
- $.each(arguments, $.proxy(function(i, date){
- if (date instanceof Date)
- date = this._local_to_utc(date);
- dates.push(date);
- }, this));
- fromArgs = true;
- }
- else {
- dates = this.isInput
- ? this.element.val()
- : this.element.data('date') || this.element.find('input').val();
- if (dates && this.o.multidate)
- dates = dates.split(this.o.multidateSeparator);
- else
- dates = [dates];
- delete this.element.data().date;
- }
-
- dates = $.map(dates, $.proxy(function(date){
- return DPGlobal.parseDate(date, this.o.format, this.o.language);
- }, this));
- dates = $.grep(dates, $.proxy(function(date){
- return (
- date < this.o.startDate ||
- date > this.o.endDate ||
- !date
- );
- }, this), true);
- this.dates.replace(dates);
-
- if (this.dates.length)
- this.viewDate = new Date(this.dates.get(-1));
- else if (this.viewDate < this.o.startDate)
- this.viewDate = new Date(this.o.startDate);
- else if (this.viewDate > this.o.endDate)
- this.viewDate = new Date(this.o.endDate);
-
- if (fromArgs){
- // setting date by clicking
- this.setValue();
- }
- else if (dates.length){
- // setting date by typing
- if (String(oldDates) !== String(this.dates))
- this._trigger('changeDate');
- }
- if (!this.dates.length && oldDates.length)
- this._trigger('clearDate');
-
- this.fill();
- },
-
- fillDow: function(){
- var dowCnt = this.o.weekStart,
- html = '
';
- if (this.o.calendarWeeks){
- var cell = '
';
- html += cell;
- this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
- }
- while (dowCnt < this.o.weekStart + 7){
- html += '
'+dates[this.o.language].daysMin[(dowCnt++)%7]+'
';
- }
- html += '
';
- this.picker.find('.datepicker-days thead').append(html);
- },
-
- fillMonths: function(){
- var html = '',
- i = 0;
- while (i < 12){
- html += ''+dates[this.o.language].monthsShort[i++]+'';
- }
- this.picker.find('.datepicker-months td').html(html);
- },
-
- setRange: function(range){
- if (!range || !range.length)
- delete this.range;
- else
- this.range = $.map(range, function(d){
- return d.valueOf();
- });
- this.fill();
- },
-
- getClassNames: function(date){
- var cls = [],
- year = this.viewDate.getUTCFullYear(),
- month = this.viewDate.getUTCMonth(),
- today = new Date();
- if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
- cls.push('old');
- }
- else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
- cls.push('new');
- }
- if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
- cls.push('focused');
- // Compare internal UTC date with local today, not UTC today
- if (this.o.todayHighlight &&
- date.getUTCFullYear() === today.getFullYear() &&
- date.getUTCMonth() === today.getMonth() &&
- date.getUTCDate() === today.getDate()){
- cls.push('today');
- }
- if (this.dates.contains(date) !== -1)
- cls.push('active');
- if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
- $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
- cls.push('disabled');
- }
- if (this.range){
- if (date > this.range[0] && date < this.range[this.range.length-1]){
- cls.push('range');
- }
- if ($.inArray(date.valueOf(), this.range) !== -1){
- cls.push('selected');
- }
- }
- return cls;
- },
-
- fill: function(){
- var d = new Date(this.viewDate),
- year = d.getUTCFullYear(),
- month = d.getUTCMonth(),
- startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
- startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
- endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
- endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
- todaytxt = dates[this.o.language].today || dates['en'].today || '',
- cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
- tooltip;
- this.picker.find('.datepicker-days thead th.datepicker-switch')
- .text(dates[this.o.language].months[month]+' '+year);
- this.picker.find('tfoot th.today')
- .text(todaytxt)
- .toggle(this.o.todayBtn !== false);
- this.picker.find('tfoot th.clear')
- .text(cleartxt)
- .toggle(this.o.clearBtn !== false);
- this.updateNavArrows();
- this.fillMonths();
- var prevMonth = UTCDate(year, month-1, 28),
- day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
- prevMonth.setUTCDate(day);
- prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
- var nextMonth = new Date(prevMonth);
- nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
- nextMonth = nextMonth.valueOf();
- var html = [];
- var clsName;
- while (prevMonth.valueOf() < nextMonth){
- if (prevMonth.getUTCDay() === this.o.weekStart){
- html.push('
');
- if (this.o.calendarWeeks){
- // ISO 8601: First week contains first thursday.
- // ISO also states week starts on Monday, but we can be more abstract here.
- var
- // Start of current week: based on weekstart/current date
- ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
- // Thursday of this week
- th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
- // First Thursday of year, year from thursday
- yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
- // Calendar week: ms between thursdays, div ms per day, div 7 days
- calWeek = (th - yth) / 864e5 / 7 + 1;
- html.push('
'+ calWeek +'
');
-
- }
- }
- clsName = this.getClassNames(prevMonth);
- clsName.push('day');
-
- if (this.o.beforeShowDay !== $.noop){
- var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
- if (before === undefined)
- before = {};
- else if (typeof(before) === 'boolean')
- before = {enabled: before};
- else if (typeof(before) === 'string')
- before = {classes: before};
- if (before.enabled === false)
- clsName.push('disabled');
- if (before.classes)
- clsName = clsName.concat(before.classes.split(/\s+/));
- if (before.tooltip)
- tooltip = before.tooltip;
- }
-
- clsName = $.unique(clsName);
- html.push('
'+prevMonth.getUTCDate() + '
');
- if (prevMonth.getUTCDay() === this.o.weekEnd){
- html.push('
');
- }
- prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
- }
- this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
-
- var months = this.picker.find('.datepicker-months')
- .find('th:eq(1)')
- .text(year)
- .end()
- .find('span').removeClass('active');
-
- $.each(this.dates, function(i, d){
- if (d.getUTCFullYear() === year)
- months.eq(d.getUTCMonth()).addClass('active');
- });
-
- if (year < startYear || year > endYear){
- months.addClass('disabled');
- }
- if (year === startYear){
- months.slice(0, startMonth).addClass('disabled');
- }
- if (year === endYear){
- months.slice(endMonth+1).addClass('disabled');
- }
-
- html = '';
- year = parseInt(year/10, 10) * 10;
- var yearCont = this.picker.find('.datepicker-years')
- .find('th:eq(1)')
- .text(year + '-' + (year + 9))
- .end()
- .find('td');
- year -= 1;
- var years = $.map(this.dates, function(d){
- return d.getUTCFullYear();
- }),
- classes;
- for (var i = -1; i < 11; i++){
- classes = ['year'];
- if (i === -1)
- classes.push('old');
- else if (i === 10)
- classes.push('new');
- if ($.inArray(year, years) !== -1)
- classes.push('active');
- if (year < startYear || year > endYear)
- classes.push('disabled');
- html += ''+year+'';
- year += 1;
- }
- yearCont.html(html);
- },
-
- updateNavArrows: function(){
- if (!this._allow_update)
- return;
-
- var d = new Date(this.viewDate),
- year = d.getUTCFullYear(),
- month = d.getUTCMonth();
- switch (this.viewMode){
- case 0:
- if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
- this.picker.find('.prev').css({visibility: 'hidden'});
- }
- else {
- this.picker.find('.prev').css({visibility: 'visible'});
- }
- if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
- this.picker.find('.next').css({visibility: 'hidden'});
- }
- else {
- this.picker.find('.next').css({visibility: 'visible'});
- }
- break;
- case 1:
- case 2:
- if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
- this.picker.find('.prev').css({visibility: 'hidden'});
- }
- else {
- this.picker.find('.prev').css({visibility: 'visible'});
- }
- if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
- this.picker.find('.next').css({visibility: 'hidden'});
- }
- else {
- this.picker.find('.next').css({visibility: 'visible'});
- }
- break;
- }
- },
-
- click: function(e){
- e.preventDefault();
- var target = $(e.target).closest('span, td, th'),
- year, month, day;
- if (target.length === 1){
- switch (target[0].nodeName.toLowerCase()){
- case 'th':
- switch (target[0].className){
- case 'datepicker-switch':
- this.showMode(1);
- break;
- case 'prev':
- case 'next':
- var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
- switch (this.viewMode){
- case 0:
- this.viewDate = this.moveMonth(this.viewDate, dir);
- this._trigger('changeMonth', this.viewDate);
- break;
- case 1:
- case 2:
- this.viewDate = this.moveYear(this.viewDate, dir);
- if (this.viewMode === 1)
- this._trigger('changeYear', this.viewDate);
- break;
- }
- this.fill();
- break;
- case 'today':
- var date = new Date();
- date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
-
- this.showMode(-2);
- var which = this.o.todayBtn === 'linked' ? null : 'view';
- this._setDate(date, which);
- break;
- case 'clear':
- var element;
- if (this.isInput)
- element = this.element;
- else if (this.component)
- element = this.element.find('input');
- if (element)
- element.val("").change();
- this.update();
- this._trigger('changeDate');
- if (this.o.autoclose)
- this.hide();
- break;
- }
- break;
- case 'span':
- if (!target.is('.disabled')){
- this.viewDate.setUTCDate(1);
- if (target.is('.month')){
- day = 1;
- month = target.parent().find('span').index(target);
- year = this.viewDate.getUTCFullYear();
- this.viewDate.setUTCMonth(month);
- this._trigger('changeMonth', this.viewDate);
- if (this.o.minViewMode === 1){
- this._setDate(UTCDate(year, month, day));
- }
- }
- else {
- day = 1;
- month = 0;
- year = parseInt(target.text(), 10)||0;
- this.viewDate.setUTCFullYear(year);
- this._trigger('changeYear', this.viewDate);
- if (this.o.minViewMode === 2){
- this._setDate(UTCDate(year, month, day));
- }
- }
- this.showMode(-1);
- this.fill();
- }
- break;
- case 'td':
- if (target.is('.day') && !target.is('.disabled')){
- day = parseInt(target.text(), 10)||1;
- year = this.viewDate.getUTCFullYear();
- month = this.viewDate.getUTCMonth();
- if (target.is('.old')){
- if (month === 0){
- month = 11;
- year -= 1;
- }
- else {
- month -= 1;
- }
- }
- else if (target.is('.new')){
- if (month === 11){
- month = 0;
- year += 1;
- }
- else {
- month += 1;
- }
- }
- this._setDate(UTCDate(year, month, day));
- }
- break;
- }
- }
- if (this.picker.is(':visible') && this._focused_from){
- $(this._focused_from).focus();
- }
- delete this._focused_from;
- },
-
- _toggle_multidate: function(date){
- var ix = this.dates.contains(date);
- if (!date){
- this.dates.clear();
- }
- else if (ix !== -1){
- this.dates.remove(ix);
- }
- else {
- this.dates.push(date);
- }
- if (typeof this.o.multidate === 'number')
- while (this.dates.length > this.o.multidate)
- this.dates.remove(0);
- },
-
- _setDate: function(date, which){
- if (!which || which === 'date')
- this._toggle_multidate(date && new Date(date));
- if (!which || which === 'view')
- this.viewDate = date && new Date(date);
-
- this.fill();
- this.setValue();
- this._trigger('changeDate');
- var element;
- if (this.isInput){
- element = this.element;
- }
- else if (this.component){
- element = this.element.find('input');
- }
- if (element){
- element.change();
- }
- if (this.o.autoclose && (!which || which === 'date')){
- this.hide();
- }
- },
-
- moveMonth: function(date, dir){
- if (!date)
- return undefined;
- if (!dir)
- return date;
- var new_date = new Date(date.valueOf()),
- day = new_date.getUTCDate(),
- month = new_date.getUTCMonth(),
- mag = Math.abs(dir),
- new_month, test;
- dir = dir > 0 ? 1 : -1;
- if (mag === 1){
- test = dir === -1
- // If going back one month, make sure month is not current month
- // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
- ? function(){
- return new_date.getUTCMonth() === month;
- }
- // If going forward one month, make sure month is as expected
- // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
- : function(){
- return new_date.getUTCMonth() !== new_month;
- };
- new_month = month + dir;
- new_date.setUTCMonth(new_month);
- // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
- if (new_month < 0 || new_month > 11)
- new_month = (new_month + 12) % 12;
- }
- else {
- // For magnitudes >1, move one month at a time...
- for (var i=0; i < mag; i++)
- // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
- new_date = this.moveMonth(new_date, dir);
- // ...then reset the day, keeping it in the new month
- new_month = new_date.getUTCMonth();
- new_date.setUTCDate(day);
- test = function(){
- return new_month !== new_date.getUTCMonth();
- };
- }
- // Common date-resetting loop -- if date is beyond end of month, make it
- // end of month
- while (test()){
- new_date.setUTCDate(--day);
- new_date.setUTCMonth(new_month);
- }
- return new_date;
- },
-
- moveYear: function(date, dir){
- return this.moveMonth(date, dir*12);
- },
-
- dateWithinRange: function(date){
- return date >= this.o.startDate && date <= this.o.endDate;
- },
-
- keydown: function(e){
- if (this.picker.is(':not(:visible)')){
- if (e.keyCode === 27) // allow escape to hide and re-show picker
- this.show();
- return;
- }
- var dateChanged = false,
- dir, newDate, newViewDate,
- focusDate = this.focusDate || this.viewDate;
- switch (e.keyCode){
- case 27: // escape
- if (this.focusDate){
- this.focusDate = null;
- this.viewDate = this.dates.get(-1) || this.viewDate;
- this.fill();
- }
- else
- this.hide();
- e.preventDefault();
- break;
- case 37: // left
- case 39: // right
- if (!this.o.keyboardNavigation)
- break;
- dir = e.keyCode === 37 ? -1 : 1;
- if (e.ctrlKey){
- newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
- newViewDate = this.moveYear(focusDate, dir);
- this._trigger('changeYear', this.viewDate);
- }
- else if (e.shiftKey){
- newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
- newViewDate = this.moveMonth(focusDate, dir);
- this._trigger('changeMonth', this.viewDate);
- }
- else {
- newDate = new Date(this.dates.get(-1) || UTCToday());
- newDate.setUTCDate(newDate.getUTCDate() + dir);
- newViewDate = new Date(focusDate);
- newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
- }
- if (this.dateWithinRange(newDate)){
- this.focusDate = this.viewDate = newViewDate;
- this.setValue();
- this.fill();
- e.preventDefault();
- }
- break;
- case 38: // up
- case 40: // down
- if (!this.o.keyboardNavigation)
- break;
- dir = e.keyCode === 38 ? -1 : 1;
- if (e.ctrlKey){
- newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
- newViewDate = this.moveYear(focusDate, dir);
- this._trigger('changeYear', this.viewDate);
- }
- else if (e.shiftKey){
- newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
- newViewDate = this.moveMonth(focusDate, dir);
- this._trigger('changeMonth', this.viewDate);
- }
- else {
- newDate = new Date(this.dates.get(-1) || UTCToday());
- newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
- newViewDate = new Date(focusDate);
- newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
- }
- if (this.dateWithinRange(newDate)){
- this.focusDate = this.viewDate = newViewDate;
- this.setValue();
- this.fill();
- e.preventDefault();
- }
- break;
- case 32: // spacebar
- // Spacebar is used in manually typing dates in some formats.
- // As such, its behavior should not be hijacked.
- break;
- case 13: // enter
- focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
- this._toggle_multidate(focusDate);
- dateChanged = true;
- this.focusDate = null;
- this.viewDate = this.dates.get(-1) || this.viewDate;
- this.setValue();
- this.fill();
- if (this.picker.is(':visible')){
- e.preventDefault();
- if (this.o.autoclose)
- this.hide();
- }
- break;
- case 9: // tab
- this.focusDate = null;
- this.viewDate = this.dates.get(-1) || this.viewDate;
- this.fill();
- this.hide();
- break;
- }
- if (dateChanged){
- if (this.dates.length)
- this._trigger('changeDate');
- else
- this._trigger('clearDate');
- var element;
- if (this.isInput){
- element = this.element;
- }
- else if (this.component){
- element = this.element.find('input');
- }
- if (element){
- element.change();
- }
- }
- },
-
- showMode: function(dir){
- if (dir){
- this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
- }
- this.picker
- .find('>div')
- .hide()
- .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
- .css('display', 'block');
- this.updateNavArrows();
- }
- };
-
- var DateRangePicker = function(element, options){
- this.element = $(element);
- this.inputs = $.map(options.inputs, function(i){
- return i.jquery ? i[0] : i;
- });
- delete options.inputs;
-
- $(this.inputs)
- .datepicker(options)
- .bind('changeDate', $.proxy(this.dateUpdated, this));
-
- this.pickers = $.map(this.inputs, function(i){
- return $(i).data('datepicker');
- });
- this.updateDates();
- };
- DateRangePicker.prototype = {
- updateDates: function(){
- this.dates = $.map(this.pickers, function(i){
- return i.getUTCDate();
- });
- this.updateRanges();
- },
- updateRanges: function(){
- var range = $.map(this.dates, function(d){
- return d.valueOf();
- });
- $.each(this.pickers, function(i, p){
- p.setRange(range);
- });
- },
- dateUpdated: function(e){
- // `this.updating` is a workaround for preventing infinite recursion
- // between `changeDate` triggering and `setUTCDate` calling. Until
- // there is a better mechanism.
- if (this.updating)
- return;
- this.updating = true;
-
- var dp = $(e.target).data('datepicker'),
- new_date = dp.getUTCDate(),
- i = $.inArray(e.target, this.inputs),
- l = this.inputs.length;
- if (i === -1)
- return;
-
- $.each(this.pickers, function(i, p){
- if (!p.getUTCDate())
- p.setUTCDate(new_date);
- });
-
- if (new_date < this.dates[i]){
- // Date being moved earlier/left
- while (i >= 0 && new_date < this.dates[i]){
- this.pickers[i--].setUTCDate(new_date);
- }
- }
- else if (new_date > this.dates[i]){
- // Date being moved later/right
- while (i < l && new_date > this.dates[i]){
- this.pickers[i++].setUTCDate(new_date);
- }
- }
- this.updateDates();
-
- delete this.updating;
- },
- remove: function(){
- $.map(this.pickers, function(p){ p.remove(); });
- delete this.element.data().datepicker;
- }
- };
-
- function opts_from_el(el, prefix){
- // Derive options from element data-attrs
- var data = $(el).data(),
- out = {}, inkey,
- replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
- prefix = new RegExp('^' + prefix.toLowerCase());
- function re_lower(_,a){
- return a.toLowerCase();
- }
- for (var key in data)
- if (prefix.test(key)){
- inkey = key.replace(replace, re_lower);
- out[inkey] = data[key];
- }
- return out;
- }
-
- function opts_from_locale(lang){
- // Derive options from locale plugins
- var out = {};
- // Check if "de-DE" style date is available, if not language should
- // fallback to 2 letter code eg "de"
- if (!dates[lang]){
- lang = lang.split('-')[0];
- if (!dates[lang])
- return;
- }
- var d = dates[lang];
- $.each(locale_opts, function(i,k){
- if (k in d)
- out[k] = d[k];
- });
- return out;
- }
-
- var old = $.fn.datepicker;
- $.fn.datepicker = function(option){
- var args = Array.apply(null, arguments);
- args.shift();
- var internal_return;
- this.each(function(){
- var $this = $(this),
- data = $this.data('datepicker'),
- options = typeof option === 'object' && option;
- if (!data){
- var elopts = opts_from_el(this, 'date'),
- // Preliminary otions
- xopts = $.extend({}, defaults, elopts, options),
- locopts = opts_from_locale(xopts.language),
- // Options priority: js args, data-attrs, locales, defaults
- opts = $.extend({}, defaults, locopts, elopts, options);
- if ($this.is('.input-daterange') || opts.inputs){
- var ropts = {
- inputs: opts.inputs || $this.find('input').toArray()
- };
- $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
- }
- else {
- $this.data('datepicker', (data = new Datepicker(this, opts)));
- }
- }
- if (typeof option === 'string' && typeof data[option] === 'function'){
- internal_return = data[option].apply(data, args);
- if (internal_return !== undefined)
- return false;
- }
- });
- if (internal_return !== undefined)
- return internal_return;
- else
- return this;
- };
-
- var defaults = $.fn.datepicker.defaults = {
- autoclose: false,
- beforeShowDay: $.noop,
- calendarWeeks: false,
- clearBtn: false,
- daysOfWeekDisabled: [],
- endDate: Infinity,
- forceParse: true,
- format: 'mm/dd/yyyy',
- keyboardNavigation: true,
- language: 'en',
- minViewMode: 0,
- multidate: false,
- multidateSeparator: ',',
- orientation: "auto",
- rtl: false,
- startDate: -Infinity,
- startView: 0,
- todayBtn: false,
- todayHighlight: false,
- weekStart: 0
- };
- var locale_opts = $.fn.datepicker.locale_opts = [
- 'format',
- 'rtl',
- 'weekStart'
- ];
- $.fn.datepicker.Constructor = Datepicker;
- var dates = $.fn.datepicker.dates = {
- en: {
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
- daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- today: "Today",
- clear: "Clear"
- }
- };
-
- var DPGlobal = {
- modes: [
- {
- clsName: 'days',
- navFnc: 'Month',
- navStep: 1
- },
- {
- clsName: 'months',
- navFnc: 'FullYear',
- navStep: 1
- },
- {
- clsName: 'years',
- navFnc: 'FullYear',
- navStep: 10
- }],
- isLeapYear: function(year){
- return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
- },
- getDaysInMonth: function(year, month){
- return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
- },
- validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
- nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
- parseFormat: function(format){
- // IE treats \0 as a string end in inputs (truncating the value),
- // so it's a bad format delimiter, anyway
- var separators = format.replace(this.validParts, '\0').split('\0'),
- parts = format.match(this.validParts);
- if (!separators || !separators.length || !parts || parts.length === 0){
- throw new Error("Invalid date format.");
- }
- return {separators: separators, parts: parts};
- },
- parseDate: function(date, format, language){
- if (!date)
- return undefined;
- if (date instanceof Date)
- return date;
- if (typeof format === 'string')
- format = DPGlobal.parseFormat(format);
- var part_re = /([\-+]\d+)([dmwy])/,
- parts = date.match(/([\-+]\d+)([dmwy])/g),
- part, dir, i;
- if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
- date = new Date();
- for (i=0; i < parts.length; i++){
- part = part_re.exec(parts[i]);
- dir = parseInt(part[1]);
- switch (part[2]){
- case 'd':
- date.setUTCDate(date.getUTCDate() + dir);
- break;
- case 'm':
- date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
- break;
- case 'w':
- date.setUTCDate(date.getUTCDate() + dir * 7);
- break;
- case 'y':
- date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
- break;
- }
- }
- return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
- }
- parts = date && date.match(this.nonpunctuation) || [];
- date = new Date();
- var parsed = {},
- setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
- setters_map = {
- yyyy: function(d,v){
- return d.setUTCFullYear(v);
- },
- yy: function(d,v){
- return d.setUTCFullYear(2000+v);
- },
- m: function(d,v){
- if (isNaN(d))
- return d;
- v -= 1;
- while (v < 0) v += 12;
- v %= 12;
- d.setUTCMonth(v);
- while (d.getUTCMonth() !== v)
- d.setUTCDate(d.getUTCDate()-1);
- return d;
- },
- d: function(d,v){
- return d.setUTCDate(v);
- }
- },
- val, filtered;
- setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
- setters_map['dd'] = setters_map['d'];
- date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
- var fparts = format.parts.slice();
- // Remove noop parts
- if (parts.length !== fparts.length){
- fparts = $(fparts).filter(function(i,p){
- return $.inArray(p, setters_order) !== -1;
- }).toArray();
- }
- // Process remainder
- function match_part(){
- var m = this.slice(0, parts[i].length),
- p = parts[i].slice(0, m.length);
- return m === p;
- }
- if (parts.length === fparts.length){
- var cnt;
- for (i=0, cnt = fparts.length; i < cnt; i++){
- val = parseInt(parts[i], 10);
- part = fparts[i];
- if (isNaN(val)){
- switch (part){
- case 'MM':
- filtered = $(dates[language].months).filter(match_part);
- val = $.inArray(filtered[0], dates[language].months) + 1;
- break;
- case 'M':
- filtered = $(dates[language].monthsShort).filter(match_part);
- val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
- break;
- }
- }
- parsed[part] = val;
- }
- var _date, s;
- for (i=0; i < setters_order.length; i++){
- s = setters_order[i];
- if (s in parsed && !isNaN(parsed[s])){
- _date = new Date(date);
- setters_map[s](_date, parsed[s]);
- if (!isNaN(_date))
- date = _date;
- }
- }
- }
- return date;
- },
- formatDate: function(date, format, language){
- if (!date)
- return '';
- if (typeof format === 'string')
- format = DPGlobal.parseFormat(format);
- var val = {
- d: date.getUTCDate(),
- D: dates[language].daysShort[date.getUTCDay()],
- DD: dates[language].days[date.getUTCDay()],
- m: date.getUTCMonth() + 1,
- M: dates[language].monthsShort[date.getUTCMonth()],
- MM: dates[language].months[date.getUTCMonth()],
- yy: date.getUTCFullYear().toString().substring(2),
- yyyy: date.getUTCFullYear()
- };
- val.dd = (val.d < 10 ? '0' : '') + val.d;
- val.mm = (val.m < 10 ? '0' : '') + val.m;
- date = [];
- var seps = $.extend([], format.separators);
- for (var i=0, cnt = format.parts.length; i <= cnt; i++){
- if (seps.length)
- date.push(seps.shift());
- date.push(val[format.parts[i]]);
- }
- return date.join('');
- },
- headTemplate: ''+
- '