code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u04d5\u043c\u0431\u0438\u0441\u0431\u043e\u043d\u044b \u0440\u0430\u0437\u043c\u04d5", "\u04d5\u043c\u0431\u0438\u0441\u0431\u043e\u043d\u044b \u0444\u04d5\u0441\u0442\u04d5" ], "DAY": [ "\u0445\u0443\u044b\u0446\u0430\u0443\u0431\u043e\u043d", "\u043a\u044a\u0443\u044b\u0440\u0438\u0441\u04d5\u0440", "\u0434\u044b\u0446\u0446\u04d5\u0433", "\u04d5\u0440\u0442\u044b\u0446\u0446\u04d5\u0433", "\u0446\u044b\u043f\u043f\u04d5\u0440\u04d5\u043c", "\u043c\u0430\u0439\u0440\u04d5\u043c\u0431\u043e\u043d", "\u0441\u0430\u0431\u0430\u0442" ], "MONTH": [ "\u044f\u043d\u0432\u0430\u0440\u044b", "\u0444\u0435\u0432\u0440\u0430\u043b\u044b", "\u043c\u0430\u0440\u0442\u044a\u0438\u0439\u044b", "\u0430\u043f\u0440\u0435\u043b\u044b", "\u043c\u0430\u0439\u044b", "\u0438\u044e\u043d\u044b", "\u0438\u044e\u043b\u044b", "\u0430\u0432\u0433\u0443\u0441\u0442\u044b", "\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044b", "\u043e\u043a\u0442\u044f\u0431\u0440\u044b", "\u043d\u043e\u044f\u0431\u0440\u044b", "\u0434\u0435\u043a\u0430\u0431\u0440\u044b" ], "SHORTDAY": [ "\u0445\u0446\u0431", "\u043a\u0440\u0441", "\u0434\u0446\u0433", "\u04d5\u0440\u0442", "\u0446\u043f\u0440", "\u043c\u0440\u0431", "\u0441\u0431\u0442" ], "SHORTMONTH": [ "\u044f\u043d\u0432.", "\u0444\u0435\u0432.", "\u043c\u0430\u0440.", "\u0430\u043f\u0440.", "\u043c\u0430\u044f", "\u0438\u044e\u043d\u044b", "\u0438\u044e\u043b\u044b", "\u0430\u0432\u0433.", "\u0441\u0435\u043d.", "\u043e\u043a\u0442.", "\u043d\u043e\u044f.", "\u0434\u0435\u043a." ], "fullDate": "EEEE, d MMMM, y '\u0430\u0437'", "longDate": "d MMMM, y '\u0430\u0437'", "medium": "dd MMM y '\u0430\u0437' HH:mm:ss", "mediumDate": "dd MMM y '\u0430\u0437'", "mediumTime": "HH:mm:ss", "short": "dd.MM.yy HH:mm", "shortDate": "dd.MM.yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "GEL", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "os", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
bspaulding/cdnjs
ajax/libs/angular-i18n/1.4.0-beta.1/angular-locale_os.js
JavaScript
mit
3,473
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\ua3b8\ua111", "\ua06f\ua2d2" ], "DAY": [ "\ua46d\ua18f\ua44d", "\ua18f\ua282\ua2cd", "\ua18f\ua282\ua44d", "\ua18f\ua282\ua315", "\ua18f\ua282\ua1d6", "\ua18f\ua282\ua26c", "\ua18f\ua282\ua0d8" ], "MONTH": [ "\ua2cd\ua1aa", "\ua44d\ua1aa", "\ua315\ua1aa", "\ua1d6\ua1aa", "\ua26c\ua1aa", "\ua0d8\ua1aa", "\ua3c3\ua1aa", "\ua246\ua1aa", "\ua22c\ua1aa", "\ua2b0\ua1aa", "\ua2b0\ua2aa\ua1aa", "\ua2b0\ua44b\ua1aa" ], "SHORTDAY": [ "\ua46d\ua18f", "\ua18f\ua2cd", "\ua18f\ua44d", "\ua18f\ua315", "\ua18f\ua1d6", "\ua18f\ua26c", "\ua18f\ua0d8" ], "SHORTMONTH": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "fullDate": "y MMMM d, EEEE", "longDate": "y MMMM d", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u00a5", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ii", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
jackdoyle/cdnjs
ajax/libs/angular.js/1.3.5/i18n/angular-locale_ii.js
JavaScript
mit
2,509
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], "MONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "SHORTDAY": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], "fullDate": "EEEE, MMMM d, y", "longDate": "MMMM d, y", "medium": "MMM d, y h:mm:ss a", "mediumDate": "MMM d, y", "mediumTime": "h:mm:ss a", "short": "M/d/yy h:mm a", "shortDate": "M/d/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "en-cx", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
maruilian11/cdnjs
ajax/libs/angular-i18n/1.3.11/angular-locale_en-cx.js
JavaScript
mit
2,281
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "Muhi", "Chilo" ], "DAY": [ "Liduva lyapili", "Liduva lyatatu", "Liduva lyanchechi", "Liduva lyannyano", "Liduva lyannyano na linji", "Liduva lyannyano na mavili", "Liduva litandi" ], "MONTH": [ "Mwedi Ntandi", "Mwedi wa Pili", "Mwedi wa Tatu", "Mwedi wa Nchechi", "Mwedi wa Nnyano", "Mwedi wa Nnyano na Umo", "Mwedi wa Nnyano na Mivili", "Mwedi wa Nnyano na Mitatu", "Mwedi wa Nnyano na Nchechi", "Mwedi wa Nnyano na Nnyano", "Mwedi wa Nnyano na Nnyano na U", "Mwedi wa Nnyano na Nnyano na M" ], "SHORTDAY": [ "Ll2", "Ll3", "Ll4", "Ll5", "Ll6", "Ll7", "Ll1" ], "SHORTMONTH": [ "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des" ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "TSh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "kde-tz", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
LaurensRietveld/cdnjs
ajax/libs/angular.js/1.4.0-beta.4/angular-1.4.0-beta.5/i18n/angular-locale_kde-tz.js
JavaScript
mit
2,541
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "\u0627\u064e\u062a\u06be\u0648\u0627\u0631", "\u0698\u0654\u0646\u065b\u062f\u0631\u0655\u0631\u0648\u0627\u0631", "\u0628\u0648\u065a\u0645\u0648\u0627\u0631", "\u0628\u0648\u062f\u0648\u0627\u0631", "\u0628\u0631\u065b\u066e\u06ea\u0633\u0648\u0627\u0631", "\u062c\u064f\u0645\u06c1", "\u0628\u0679\u0648\u0627\u0631" ], "MONTH": [ "\u062c\u0646\u0624\u0631\u06cc", "\u0641\u0631\u0624\u0631\u06cc", "\u0645\u0627\u0631\u0655\u0686", "\u0627\u067e\u0631\u06cc\u0644", "\u0645\u06cc\u0654", "\u062c\u0648\u0657\u0646", "\u062c\u0648\u0657\u0644\u0627\u06cc\u06cc", "\u0627\u06af\u0633\u062a", "\u0633\u062a\u0645\u0628\u0631", "\u0627\u06a9\u062a\u0648\u0657\u0628\u0631", "\u0646\u0648\u0645\u0628\u0631", "\u062f\u0633\u0645\u0628\u0631" ], "SHORTDAY": [ "\u0622\u062a\u06be\u0648\u0627\u0631", "\u0698\u0654\u0646\u065b\u062f\u0655\u0631\u0648\u0627\u0631", "\u0628\u0648\u065a\u0645\u0648\u0627\u0631", "\u0628\u0648\u062f\u0648\u0627\u0631", "\u0628\u0631\u065b\u066e\u06ea\u0633\u0648\u0627\u0631", "\u062c\u064f\u0645\u06c1", "\u0628\u0679\u0648\u0627\u0631" ], "SHORTMONTH": [ "\u062c\u0646\u0624\u0631\u06cc", "\u0641\u0631\u0624\u0631\u06cc", "\u0645\u0627\u0631\u0655\u0686", "\u0627\u067e\u0631\u06cc\u0644", "\u0645\u06cc\u0654", "\u062c\u0648\u0657\u0646", "\u062c\u0648\u0657\u0644\u0627\u06cc\u06cc", "\u0627\u06af\u0633\u062a", "\u0633\u062a\u0645\u0628\u0631", "\u0627\u06a9\u062a\u0648\u0657\u0628\u0631", "\u0646\u0648\u0645\u0628\u0631", "\u062f\u0633\u0645\u0628\u0631" ], "fullDate": "EEEE, MMMM d, y", "longDate": "MMMM d, y", "medium": "MMM d, y h:mm:ss a", "mediumDate": "MMM d, y", "mediumTime": "h:mm:ss a", "short": "M/d/yy h:mm a", "shortDate": "M/d/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20b9", "DECIMAL_SEP": "\u066b", "GROUP_SEP": "\u066c", "PATTERNS": [ { "gSize": 2, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 2, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ks-arab-in", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
honestree/cdnjs
ajax/libs/angular-i18n/1.4.0-beta.1/angular-locale_ks-arab-in.js
JavaScript
mit
3,428
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "dimans", "lindi", "mardi", "merkredi", "zedi", "vandredi", "samdi" ], "MONTH": [ "zanvie", "fevriye", "mars", "avril", "me", "zin", "zilye", "out", "septam", "oktob", "novam", "desam" ], "SHORTDAY": [ "dim", "lin", "mar", "mer", "ze", "van", "sam" ], "SHORTMONTH": [ "zan", "fev", "mar", "avr", "me", "zin", "zil", "out", "sep", "okt", "nov", "des" ], "fullDate": "EEEE d MMMM y", "longDate": "d MMMM y", "medium": "d MMM, y HH:mm:ss", "mediumDate": "d MMM, y", "mediumTime": "HH:mm:ss", "short": "d/M/y HH:mm", "shortDate": "d/M/y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "MURs", "DECIMAL_SEP": ".", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "mfe-mu", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
melvinsembrano/cdnjs
ajax/libs/angular-i18n/1.4.0-beta.0/angular-locale_mfe-mu.js
JavaScript
mit
2,264
var baseOrderBy = require('./_baseOrderBy'), isArray = require('./isArray'); /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } module.exports = orderBy;
JPMendenhall/Kuva-Front-End
node_modules/lodash/orderBy.js
JavaScript
mit
1,620
var baseOrderBy = require('./_baseOrderBy'), isArray = require('./isArray'); /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } module.exports = orderBy;
ethan1341/heroku-league
node_modules/gulp-sass/node_modules/node-sass/node_modules/gaze/node_modules/globule/node_modules/lodash/orderBy.js
JavaScript
mit
1,620
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pdfjs-dist/web/compatibility",[],e):"object"==typeof exports?exports["pdfjs-dist/web/compatibility"]=e():t["pdfjs-dist/web/compatibility"]=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};if("undefined"==typeof PDFJS||!PDFJS.compatibilityChecked){var n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:void 0,i="undefined"!=typeof navigator&&navigator.userAgent||"",r=/Android/.test(i),o=/Android\s[0-2][^\d]/.test(i),s=/Android\s[0-4][^\d]/.test(i),a=i.indexOf("Chrom")>=0,c=/Chrome\/(39|40)\./.test(i),u=i.indexOf("CriOS")>=0,h=i.indexOf("Trident")>=0,f=/\b(iPad|iPhone|iPod)(?=;)/.test(i),l=i.indexOf("Opera")>=0,d=/Safari\//.test(i)&&!/(Chrome\/|Android\s)/.test(i),p="object"===("undefined"==typeof window?"undefined":e(window))&&"object"===("undefined"==typeof document?"undefined":e(document));"undefined"==typeof PDFJS&&(n.PDFJS={}),PDFJS.compatibilityChecked=!0,function(){function t(t,e){return new a(this.slice(t,e))}function i(t,e){arguments.length<2&&(e=0);for(var n=0,i=t.length;n<i;++n,++e)this[e]=255&t[n]}function r(t,e){this.buffer=t,this.byteLength=t.length,this.length=e,s(this.length)}function o(t){return{get:function(){var e=this.buffer,n=t<<2;return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0},set:function(e){var n=this.buffer,i=t<<2;n[i]=255&e,n[i+1]=e>>8&255,n[i+2]=e>>16&255,n[i+3]=e>>>24&255}}}function s(t){for(;c<t;)Object.defineProperty(r.prototype,c,o(c)),c++}function a(n){var r,o,s;if("number"==typeof n)for(r=[],o=0;o<n;++o)r[o]=0;else if("slice"in n)r=n.slice(0);else for(r=[],o=0,s=n.length;o<s;++o)r[o]=n[o];return r.subarray=t,r.buffer=r,r.byteLength=r.length,r.set=i,"object"===(void 0===n?"undefined":e(n))&&n.buffer&&(r.buffer=n.buffer),r}if("undefined"!=typeof Uint8Array)return void 0===Uint8Array.prototype.subarray&&(Uint8Array.prototype.subarray=function(t,e){return new Uint8Array(this.slice(t,e))},Float32Array.prototype.subarray=function(t,e){return new Float32Array(this.slice(t,e))}),void("undefined"==typeof Float64Array&&(n.Float64Array=Float32Array));r.prototype=Object.create(null);var c=0;n.Uint8Array=a,n.Int8Array=a,n.Int32Array=a,n.Uint16Array=a,n.Float32Array=a,n.Float64Array=a,n.Uint32Array=function(){if(3===arguments.length){if(0!==arguments[1])throw new Error("offset !== 0 is not supported");return new r(arguments[0],arguments[2])}return a.apply(this,arguments)}}(),function(){if(p&&window.CanvasPixelArray){var t=window.CanvasPixelArray.prototype;"buffer"in t||(Object.defineProperty(t,"buffer",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(t,"byteLength",{get:function(){return this.length},enumerable:!1,configurable:!0}))}}(),function(){n.URL||(n.URL=n.webkitURL)}(),function(){if(void 0!==Object.defineProperty){var t=!0;try{p&&Object.defineProperty(new Image,"id",{value:"test"});var e=function(){};e.prototype={get id(){}},Object.defineProperty(new e,"id",{value:"",configurable:!0,enumerable:!0,writable:!1})}catch(e){t=!1}if(t)return}Object.defineProperty=function(t,e,n){delete t[e],"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),"value"in n&&(t.__defineSetter__(e,function(t){return this.__defineGetter__(e,function(){return t}),t}),t[e]=n.value)}}(),function(){if("undefined"!=typeof XMLHttpRequest){var t=XMLHttpRequest.prototype,e=new XMLHttpRequest;if("overrideMimeType"in e||Object.defineProperty(t,"overrideMimeType",{value:function(t){}}),!("responseType"in e)){if(Object.defineProperty(t,"responseType",{get:function(){return this._responseType||"text"},set:function(t){"text"!==t&&"arraybuffer"!==t||(this._responseType=t,"arraybuffer"===t&&"function"==typeof this.overrideMimeType&&this.overrideMimeType("text/plain; charset=x-user-defined"))}}),"undefined"!=typeof VBArray)return void Object.defineProperty(t,"response",{get:function(){return"arraybuffer"===this.responseType?new Uint8Array(new VBArray(this.responseBody).toArray()):this.responseText}});Object.defineProperty(t,"response",{get:function(){if("arraybuffer"!==this.responseType)return this.responseText;var t,e=this.responseText,n=e.length,i=new Uint8Array(n);for(t=0;t<n;++t)i[t]=255&e.charCodeAt(t);return i.buffer}})}}}(),function(){if(!("btoa"in n)){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.btoa=function(e){var n,i,r="";for(n=0,i=e.length;n<i;n+=3){var o=255&e.charCodeAt(n),s=255&e.charCodeAt(n+1),a=255&e.charCodeAt(n+2),c=o>>2,u=(3&o)<<4|s>>4,h=n+1<i?(15&s)<<2|a>>6:64,f=n+2<i?63&a:64;r+=t.charAt(c)+t.charAt(u)+t.charAt(h)+t.charAt(f)}return r}}}(),function(){if(!("atob"in n)){n.atob=function(t){if((t=t.replace(/=+$/,"")).length%4==1)throw new Error("bad atob input");for(var e,n,i=0,r=0,o="";n=t.charAt(r++);~n&&(e=i%4?64*e+n:n,i++%4)?o+=String.fromCharCode(255&e>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o}}}(),function(){void 0===Function.prototype.bind&&(Function.prototype.bind=function(t){var e=this,n=Array.prototype.slice.call(arguments,1);return function(){var i=n.concat(Array.prototype.slice.call(arguments));return e.apply(t,i)}})}(),function(){p&&("dataset"in document.createElement("div")||Object.defineProperty(HTMLElement.prototype,"dataset",{get:function(){if(this._dataset)return this._dataset;for(var t={},e=0,n=this.attributes.length;e<n;e++){var i=this.attributes[e];"data-"===i.name.substring(0,5)&&(t[i.name.substring(5).replace(/\-([a-z])/g,function(t,e){return e.toUpperCase()})]=i.value)}return Object.defineProperty(this,"_dataset",{value:t,writable:!1,enumerable:!1}),t},enumerable:!0}))}(),function(){function t(t,e,n,i){var r=(t.className||"").split(/\s+/g);""===r[0]&&r.shift();var o=r.indexOf(e);return o<0&&n&&r.push(e),o>=0&&i&&r.splice(o,1),t.className=r.join(" "),o>=0}if(p&&!("classList"in document.createElement("div"))){var e={add:function(e){t(this.element,e,!0,!1)},contains:function(e){return t(this.element,e,!1,!1)},remove:function(e){t(this.element,e,!1,!0)},toggle:function(e){t(this.element,e,!0,!0)}};Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){if(this._classList)return this._classList;var t=Object.create(e,{element:{value:this,writable:!1,enumerable:!0}});return Object.defineProperty(this,"_classList",{value:t,writable:!1,enumerable:!1}),t},enumerable:!0})}}(),function(){if(!("undefined"==typeof importScripts||"console"in n)){var t={},e={log:function(){var t=Array.prototype.slice.call(arguments);n.postMessage({targetName:"main",action:"console_log",data:t})},error:function(){var t=Array.prototype.slice.call(arguments);n.postMessage({targetName:"main",action:"console_error",data:t})},time:function(e){t[e]=Date.now()},timeEnd:function(e){var n=t[e];if(!n)throw new Error("Unknown timer name "+e);this.log("Timer:",e,Date.now()-n)}};n.console=e}}(),function(){if(p)"console"in window?"bind"in console.log||(console.log=function(t){return function(e){return t(e)}}(console.log),console.error=function(t){return function(e){return t(e)}}(console.error),console.warn=function(t){return function(e){return t(e)}}(console.warn)):window.console={log:function(){},error:function(){},warn:function(){}}}(),function(){function t(t){e(t.target)&&t.stopPropagation()}function e(t){return t.disabled||t.parentNode&&e(t.parentNode)}l&&document.addEventListener("click",t,!0)}(),function(){(h||u)&&(PDFJS.disableCreateObjectURL=!0)}(),function(){"undefined"!=typeof navigator&&("language"in navigator||(PDFJS.locale=navigator.userLanguage||"en-US"))}(),function(){(d||o||c||f)&&(PDFJS.disableRange=!0,PDFJS.disableStream=!0)}(),function(){p&&(history.pushState&&!o||(PDFJS.disableHistory=!0))}(),function(){if(p)if(window.CanvasPixelArray)"function"!=typeof window.CanvasPixelArray.prototype.set&&(window.CanvasPixelArray.prototype.set=function(t){for(var e=0,n=this.length;e<n;e++)this[e]=t[e]});else{var t,e=!1;if(a?e=(t=i.match(/Chrom(e|ium)\/([0-9]+)\./))&&parseInt(t[2])<21:r?e=s:d&&(e=(t=i.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//))&&parseInt(t[1])<6),e){var n=window.CanvasRenderingContext2D.prototype,o=n.createImageData;n.createImageData=function(t,e){var n=o.call(this,t,e);return n.data.set=function(t){for(var e=0,n=this.length;e<n;e++)this[e]=t[e]},n},n=null}}}(),function(){function t(){window.requestAnimationFrame=function(t){return window.setTimeout(t,20)},window.cancelAnimationFrame=function(t){window.clearTimeout(t)}}if(p)f?t():"requestAnimationFrame"in window||(window.requestAnimationFrame=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame,window.requestAnimationFrame||t())}(),function(){(f||r)&&(PDFJS.maxCanvasPixels=5242880)}(),function(){p&&h&&window.parent!==window&&(PDFJS.disableFullscreen=!0)}(),function(){p&&("currentScript"in document||Object.defineProperty(document,"currentScript",{get:function(){var t=document.getElementsByTagName("script");return t[t.length-1]},enumerable:!0,configurable:!0}))}(),function(){if(p){var t=document.createElement("input");try{t.type="number"}catch(i){var e=t.constructor.prototype,n=Object.getOwnPropertyDescriptor(e,"type");Object.defineProperty(e,"type",{get:function(){return n.get.call(this)},set:function(t){n.set.call(this,"number"===t?"text":t)},enumerable:!0,configurable:!0})}}}(),function(){if(p&&document.attachEvent){var t=document.constructor.prototype,e=Object.getOwnPropertyDescriptor(t,"readyState");Object.defineProperty(t,"readyState",{get:function(){var t=e.get.call(this);return"interactive"===t?"loading":t},set:function(t){e.set.call(this,t)},enumerable:!0,configurable:!0})}}(),function(){p&&void 0===Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}(),function(){if(n.Promise)return"function"!=typeof n.Promise.all&&(n.Promise.all=function(t){var e,i,r=0,o=[],s=new n.Promise(function(t,n){e=t,i=n});return t.forEach(function(t,n){r++,t.then(function(t){o[n]=t,0===--r&&e(o)},i)}),0===r&&e(o),s}),"function"!=typeof n.Promise.resolve&&(n.Promise.resolve=function(t){return new n.Promise(function(e){e(t)})}),"function"!=typeof n.Promise.reject&&(n.Promise.reject=function(t){return new n.Promise(function(e,n){n(t)})}),void("function"!=typeof n.Promise.prototype.catch&&(n.Promise.prototype.catch=function(t){return n.Promise.prototype.then(void 0,t)}));var t=2,e={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(t){0!==t._status&&(this.handlers=this.handlers.concat(t._handlers),t._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var e=Date.now()+1;this.handlers.length>0;){var n=this.handlers.shift(),i=n.thisPromise._status,r=n.thisPromise._value;try{1===i?"function"==typeof n.onResolve&&(r=n.onResolve(r)):"function"==typeof n.onReject&&(r=n.onReject(r),i=1,n.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(n.thisPromise))}catch(e){i=t,r=e}if(n.nextPromise._updateStatus(i,r),Date.now()>=e)break}if(this.handlers.length>0)return void setTimeout(this.runHandlers.bind(this),0);this.running=!1},addUnhandledRejection:function(t){this.unhandledRejections.push({promise:t,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(t){t._unhandledRejection=!1;for(var e=0;e<this.unhandledRejections.length;e++)this.unhandledRejections[e].promise===t&&(this.unhandledRejections.splice(e),e--)},scheduleRejectionCheck:function(){var t=this;this.pendingRejectionCheck||(this.pendingRejectionCheck=!0,setTimeout(function(){t.pendingRejectionCheck=!1;for(var e=Date.now(),n=0;n<t.unhandledRejections.length;n++)if(e-t.unhandledRejections[n].time>500){var i=t.unhandledRejections[n].promise._value,r="Unhandled rejection: "+i;i.stack&&(r+="\n"+i.stack);try{throw new Error(r)}catch(t){console.warn(r)}t.unhandledRejections.splice(n),n--}t.unhandledRejections.length&&t.scheduleRejectionCheck()},500))}},i=function(t){this._status=0,this._handlers=[];try{t.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(t){this._reject(t)}};i.all=function(e){function n(e){s._status!==t&&(c=[],o(e))}var r,o,s=new i(function(t,e){r=t,o=e}),a=e.length,c=[];if(0===a)return r(c),s;for(var u=0,h=e.length;u<h;++u){var f=e[u],l=function(e){return function(n){s._status!==t&&(c[e]=n,0===--a&&r(c))}}(u);i.isPromise(f)?f.then(l,n):l(f)}return s},i.isPromise=function(t){return t&&"function"==typeof t.then},i.resolve=function(t){return new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(n,r){if(1!==this._status&&this._status!==t){if(1===n&&i.isPromise(r))return void r.then(this._updateStatus.bind(this,1),this._updateStatus.bind(this,t));this._status=n,this._value=r,n===t&&0===this._handlers.length&&(this._unhandledRejection=!0,e.addUnhandledRejection(this)),e.scheduleHandlers(this)}},_resolve:function(t){this._updateStatus(1,t)},_reject:function(e){this._updateStatus(t,e)},then:function(t,n){var r=new i(function(t,e){this.resolve=t,this.reject=e});return this._handlers.push({thisPromise:this,onResolve:t,onReject:n,nextPromise:r}),e.scheduleHandlers(this),r},catch:function(t){return this.then(void 0,t)}},n.Promise=i}(),function(){function t(){this.id="$weakmap"+e++}if(!n.WeakMap){var e=0;t.prototype={has:function(t){return!!Object.getOwnPropertyDescriptor(t,this.id)},get:function(t,e){return this.has(t)?t[this.id]:e},set:function(t,e){Object.defineProperty(t,this.id,{value:e,enumerable:!1,configurable:!0})},delete:function(t){delete t[this.id]}},n.WeakMap=t}}(),function(){function t(t){return void 0!==l[t]}function i(){c.call(this),this._isInvalid=!0}function r(t){return""===t&&i.call(this),t.toLowerCase()}function o(t){var e=t.charCodeAt(0);return e>32&&e<127&&-1===[34,35,60,62,63,96].indexOf(e)?t:encodeURIComponent(t)}function s(t){var e=t.charCodeAt(0);return e>32&&e<127&&-1===[34,35,60,62,96].indexOf(e)?t:encodeURIComponent(t)}function a(e,n,a){function c(t){v.push(t)}var u=n||"scheme start",h=0,f="",_=!1,b=!1,v=[];t:for(;(e[h-1]!==p||0===h)&&!this._isInvalid;){var g=e[h];switch(u){case"scheme start":if(!g||!m.test(g)){if(n){c("Invalid scheme.");break t}f="",u="no scheme";continue}f+=g.toLowerCase(),u="scheme";break;case"scheme":if(g&&y.test(g))f+=g.toLowerCase();else{if(":"!==g){if(n){if(g===p)break t;c("Code point not allowed in scheme: "+g);break t}f="",h=0,u="no scheme";continue}if(this._scheme=f,f="",n)break t;t(this._scheme)&&(this._isRelative=!0),u="file"===this._scheme?"relative":this._isRelative&&a&&a._scheme===this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"===g?(this._query="?",u="query"):"#"===g?(this._fragment="#",u="fragment"):g!==p&&"\t"!==g&&"\n"!==g&&"\r"!==g&&(this._schemeData+=o(g));break;case"no scheme":if(a&&t(a._scheme)){u="relative";continue}c("Missing scheme."),i.call(this);break;case"relative or authority":if("/"!==g||"/"!==e[h+1]){c("Expected /, got: "+g),u="relative";continue}u="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!==this._scheme&&(this._scheme=a._scheme),g===p){this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._username=a._username,this._password=a._password;break t}if("/"===g||"\\"===g)"\\"===g&&c("\\ is an invalid code point."),u="relative slash";else if("?"===g)this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query="?",this._username=a._username,this._password=a._password,u="query";else{if("#"!==g){var w=e[h+1],j=e[h+2];("file"!==this._scheme||!m.test(g)||":"!==w&&"|"!==w||j!==p&&"/"!==j&&"\\"!==j&&"?"!==j&&"#"!==j)&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password,this._path=a._path.slice(),this._path.pop()),u="relative path";continue}this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._fragment="#",this._username=a._username,this._password=a._password,u="fragment"}break;case"relative slash":if("/"!==g&&"\\"!==g){"file"!==this._scheme&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password),u="relative path";continue}"\\"===g&&c("\\ is an invalid code point."),u="file"===this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!==g){c("Expected '/', got: "+g),u="authority ignore slashes";continue}u="authority second slash";break;case"authority second slash":if(u="authority ignore slashes","/"!==g){c("Expected '/', got: "+g);continue}break;case"authority ignore slashes":if("/"!==g&&"\\"!==g){u="authority";continue}c("Expected authority, got: "+g);break;case"authority":if("@"===g){_&&(c("@ already seen."),f+="%40"),_=!0;for(var P=0;P<f.length;P++){var R=f[P];if("\t"!==R&&"\n"!==R&&"\r"!==R)if(":"!==R||null!==this._password){var O=o(R);null!==this._password?this._password+=O:this._username+=O}else this._password="";else c("Invalid whitespace in authority.")}f=""}else{if(g===p||"/"===g||"\\"===g||"?"===g||"#"===g){h-=f.length,f="",u="host";continue}f+=g}break;case"file host":if(g===p||"/"===g||"\\"===g||"?"===g||"#"===g){2!==f.length||!m.test(f[0])||":"!==f[1]&&"|"!==f[1]?0===f.length?u="relative path start":(this._host=r.call(this,f),f="",u="relative path start"):u="relative path";continue}"\t"===g||"\n"===g||"\r"===g?c("Invalid whitespace in file host."):f+=g;break;case"host":case"hostname":if(":"!==g||b){if(g===p||"/"===g||"\\"===g||"?"===g||"#"===g){if(this._host=r.call(this,f),f="",u="relative path start",n)break t;continue}"\t"!==g&&"\n"!==g&&"\r"!==g?("["===g?b=!0:"]"===g&&(b=!1),f+=g):c("Invalid code point in host/hostname: "+g)}else if(this._host=r.call(this,f),f="",u="port","hostname"===n)break t;break;case"port":if(/[0-9]/.test(g))f+=g;else{if(g===p||"/"===g||"\\"===g||"?"===g||"#"===g||n){if(""!==f){var A=parseInt(f,10);A!==l[this._scheme]&&(this._port=A+""),f=""}if(n)break t;u="relative path start";continue}"\t"===g||"\n"===g||"\r"===g?c("Invalid code point in port: "+g):i.call(this)}break;case"relative path start":if("\\"===g&&c("'\\' not allowed in path."),u="relative path","/"!==g&&"\\"!==g)continue;break;case"relative path":if(g!==p&&"/"!==g&&"\\"!==g&&(n||"?"!==g&&"#"!==g))"\t"!==g&&"\n"!==g&&"\r"!==g&&(f+=o(g));else{"\\"===g&&c("\\ not allowed in relative path.");var k;(k=d[f.toLowerCase()])&&(f=k),".."===f?(this._path.pop(),"/"!==g&&"\\"!==g&&this._path.push("")):"."===f&&"/"!==g&&"\\"!==g?this._path.push(""):"."!==f&&("file"===this._scheme&&0===this._path.length&&2===f.length&&m.test(f[0])&&"|"===f[1]&&(f=f[0]+":"),this._path.push(f)),f="","?"===g?(this._query="?",u="query"):"#"===g&&(this._fragment="#",u="fragment")}break;case"query":n||"#"!==g?g!==p&&"\t"!==g&&"\n"!==g&&"\r"!==g&&(this._query+=s(g)):(this._fragment="#",u="fragment");break;case"fragment":g!==p&&"\t"!==g&&"\n"!==g&&"\r"!==g&&(this._fragment+=g)}h++}}function c(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function u(t,e){void 0===e||e instanceof u||(e=new u(String(e))),this._url=t,c.call(this);var n=t.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");a.call(this,n,null,e)}var h=!1;try{if("function"==typeof URL&&"object"===e(URL.prototype)&&"origin"in URL.prototype){var f=new URL("b","http://a");f.pathname="c%20d",h="http://a/c%20d"===f.href}}catch(t){}if(!h){var l=Object.create(null);l.ftp=21,l.file=0,l.gopher=70,l.http=80,l.https=443,l.ws=80,l.wss=443;var d=Object.create(null);d["%2e"]=".",d[".%2e"]="..",d["%2e."]="..",d["%2e%2e"]="..";var p,m=/[a-zA-Z]/,y=/[a-zA-Z0-9\+\-\.]/;u.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var t="";return""===this._username&&null===this._password||(t=this._username+(null!==this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+t+this.host:"")+this.pathname+this._query+this._fragment},set href(t){c.call(this),a.call(this,t)},get protocol(){return this._scheme+":"},set protocol(t){this._isInvalid||a.call(this,t+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(t){!this._isInvalid&&this._isRelative&&a.call(this,t,"host")},get hostname(){return this._host},set hostname(t){!this._isInvalid&&this._isRelative&&a.call(this,t,"hostname")},get port(){return this._port},set port(t){!this._isInvalid&&this._isRelative&&a.call(this,t,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(t){!this._isInvalid&&this._isRelative&&(this._path=[],a.call(this,t,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"===this._query?"":this._query},set search(t){!this._isInvalid&&this._isRelative&&(this._query="?","?"===t[0]&&(t=t.slice(1)),a.call(this,t,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"===this._fragment?"":this._fragment},set hash(t){this._isInvalid||(this._fragment="#","#"===t[0]&&(t=t.slice(1)),a.call(this,t,"fragment"))},get origin(){var t;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return t=this.host,t?this._scheme+"://"+t:""}};var _=n.URL;_&&(u.createObjectURL=function(t){return _.createObjectURL.apply(_,arguments)},u.revokeObjectURL=function(t){_.revokeObjectURL(t)}),n.URL=u}}()}}).call(e,n(1))},function(t,e,n){"use strict";var i,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(i=window)}t.exports=i},function(t,e,n){"use strict";n(0)}])});
jonobr1/cdnjs
ajax/libs/pdf.js/1.8.404/compatibility.min.js
JavaScript
mit
22,817
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; function wordRegexp(words) { return new RegExp("^((" + words.join(")|(") + "))\\b"); } var wordOperators = wordRegexp(["and", "or", "not", "is"]); var commonKeywords = ["as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "finally", "for", "from", "global", "if", "import", "lambda", "pass", "raise", "return", "try", "while", "with", "yield", "in"]; var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "filter", "float", "format", "frozenset", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "map", "max", "memoryview", "min", "next", "object", "oct", "open", "ord", "pow", "property", "range", "repr", "reversed", "round", "set", "setattr", "slice", "sorted", "staticmethod", "str", "sum", "super", "tuple", "type", "vars", "zip", "__import__", "NotImplemented", "Ellipsis", "__debug__"]; CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); function top(state) { return state.scopes[state.scopes.length - 1]; } CodeMirror.defineMode("python", function(conf, parserConf) { var ERRORCLASS = "error"; var singleDelimiters = parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/; var doubleOperators = parserConf.doubleOperators || /^([!<>]==|<>|<<|>>|\/\/|\*\*)/; var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/; var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/; var hangingIndent = parserConf.hangingIndent || conf.indentUnit; var myKeywords = commonKeywords, myBuiltins = commonBuiltins; if (parserConf.extra_keywords != undefined) myKeywords = myKeywords.concat(parserConf.extra_keywords); if (parserConf.extra_builtins != undefined) myBuiltins = myBuiltins.concat(parserConf.extra_builtins); var py3 = !(parserConf.version && Number(parserConf.version) < 3) if (py3) { // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/; var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]); myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]); var stringPrefixes = new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))", "i"); } else { var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!]/; var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/; myKeywords = myKeywords.concat(["exec", "print"]); myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile", "file", "intern", "long", "raw_input", "reduce", "reload", "unichr", "unicode", "xrange", "False", "True", "None"]); var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); } var keywords = wordRegexp(myKeywords); var builtins = wordRegexp(myBuiltins); // tokenizers function tokenBase(stream, state) { if (stream.sol()) state.indent = stream.indentation() // Handle scope changes if (stream.sol() && top(state).type == "py") { var scopeOffset = top(state).offset; if (stream.eatSpace()) { var lineOffset = stream.indentation(); if (lineOffset > scopeOffset) pushPyScope(state); else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#") state.errorToken = true; return null; } else { var style = tokenBaseInner(stream, state); if (scopeOffset > 0 && dedent(stream, state)) style += " " + ERRORCLASS; return style; } } return tokenBaseInner(stream, state); } function tokenBaseInner(stream, state) { if (stream.eatSpace()) return null; var ch = stream.peek(); // Handle Comments if (ch == "#") { stream.skipToEnd(); return "comment"; } // Handle Number Literals if (stream.match(/^[0-9\.]/, false)) { var floatLiteral = false; // Floats if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; } if (stream.match(/^\.\d+/)) { floatLiteral = true; } if (floatLiteral) { // Float literals may be "imaginary" stream.eat(/J/i); return "number"; } // Integers var intLiteral = false; // Hex if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true; // Binary if (stream.match(/^0b[01_]+/i)) intLiteral = true; // Octal if (stream.match(/^0o[0-7_]+/i)) intLiteral = true; // Decimal if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) { // Decimal literals may be "imaginary" stream.eat(/J/i); // TODO - Can you have imaginary longs? intLiteral = true; } // Zero by itself with no other piece of number. if (stream.match(/^0(?![\dx])/i)) intLiteral = true; if (intLiteral) { // Integer literals may be "long" stream.eat(/L/i); return "number"; } } // Handle Strings if (stream.match(stringPrefixes)) { state.tokenize = tokenStringFactory(stream.current()); return state.tokenize(stream, state); } // Handle operators and Delimiters if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) return "punctuation"; if (stream.match(doubleOperators) || stream.match(singleOperators)) return "operator"; if (stream.match(singleDelimiters)) return "punctuation"; if (state.lastToken == "." && stream.match(identifiers)) return "property"; if (stream.match(keywords) || stream.match(wordOperators)) return "keyword"; if (stream.match(builtins)) return "builtin"; if (stream.match(/^(self|cls)\b/)) return "variable-2"; if (stream.match(identifiers)) { if (state.lastToken == "def" || state.lastToken == "class") return "def"; return "variable"; } // Handle non-detected items stream.next(); return ERRORCLASS; } function tokenStringFactory(delimiter) { while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) delimiter = delimiter.substr(1); var singleline = delimiter.length == 1; var OUTCLASS = "string"; function tokenString(stream, state) { while (!stream.eol()) { stream.eatWhile(/[^'"\\]/); if (stream.eat("\\")) { stream.next(); if (singleline && stream.eol()) return OUTCLASS; } else if (stream.match(delimiter)) { state.tokenize = tokenBase; return OUTCLASS; } else { stream.eat(/['"]/); } } if (singleline) { if (parserConf.singleLineStringErrors) return ERRORCLASS; else state.tokenize = tokenBase; } return OUTCLASS; } tokenString.isString = true; return tokenString; } function pushPyScope(state) { while (top(state).type != "py") state.scopes.pop() state.scopes.push({offset: top(state).offset + conf.indentUnit, type: "py", align: null}) } function pushBracketScope(stream, state, type) { var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1 state.scopes.push({offset: state.indent + hangingIndent, type: type, align: align}) } function dedent(stream, state) { var indented = stream.indentation(); while (state.scopes.length > 1 && top(state).offset > indented) { if (top(state).type != "py") return true; state.scopes.pop(); } return top(state).offset != indented; } function tokenLexer(stream, state) { if (stream.sol()) state.beginningOfLine = true; var style = state.tokenize(stream, state); var current = stream.current(); // Handle decorators if (state.beginningOfLine && current == "@") return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS; if (/\S/.test(current)) state.beginningOfLine = false; if ((style == "variable" || style == "builtin") && state.lastToken == "meta") style = "meta"; // Handle scope changes. if (current == "pass" || current == "return") state.dedent += 1; if (current == "lambda") state.lambda = true; if (current == ":" && !state.lambda && top(state).type == "py") pushPyScope(state); var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1; if (delimiter_index != -1) pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); delimiter_index = "])}".indexOf(current); if (delimiter_index != -1) { if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent else return ERRORCLASS; } if (state.dedent > 0 && stream.eol() && top(state).type == "py") { if (state.scopes.length > 1) state.scopes.pop(); state.dedent -= 1; } return style; } var external = { startState: function(basecolumn) { return { tokenize: tokenBase, scopes: [{offset: basecolumn || 0, type: "py", align: null}], indent: basecolumn || 0, lastToken: null, lambda: false, dedent: 0 }; }, token: function(stream, state) { var addErr = state.errorToken; if (addErr) state.errorToken = false; var style = tokenLexer(stream, state); if (style && style != "comment") state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style; if (style == "punctuation") style = null; if (stream.eol() && state.lambda) state.lambda = false; return addErr ? style + " " + ERRORCLASS : style; }, indent: function(state, textAfter) { if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0; var scope = top(state), closing = scope.type == textAfter.charAt(0) if (scope.align != null) return scope.align - (closing ? 1 : 0) else return scope.offset - (closing ? hangingIndent : 0) }, electricInput: /^\s*[\}\]\)]$/, closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" }; return external; }); CodeMirror.defineMIME("text/x-python", "python"); var words = function(str) { return str.split(" "); }; CodeMirror.defineMIME("text/x-cython", { name: "python", extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+ "extern gil include nogil property public "+ "readonly struct union DEF IF ELIF ELSE") }); });
ahocevar/cdnjs
ajax/libs/codemirror/5.27.0/mode/python/python.js
JavaScript
mit
12,479
/* ****************************************************************************** * Copyright (C) 1999-2010, International Business Machines Corporation and * * others. All Rights Reserved. * ****************************************************************************** * Date Name Description * 10/22/99 alan Creation. ********************************************************************** */ #include "uvectr32.h" #include "cmemory.h" #include "putilimp.h" U_NAMESPACE_BEGIN #define DEFAULT_CAPACITY 8 /* * Constants for hinting whether a key is an integer * or a pointer. If a hint bit is zero, then the associated * token is assumed to be an integer. This is needed for iSeries */ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector32) UVector32::UVector32(UErrorCode &status) : count(0), capacity(0), maxCapacity(0), elements(NULL) { _init(DEFAULT_CAPACITY, status); } UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) : count(0), capacity(0), maxCapacity(0), elements(0) { _init(initialCapacity, status); } void UVector32::_init(int32_t initialCapacity, UErrorCode &status) { // Fix bogus initialCapacity values; avoid malloc(0) if (initialCapacity < 1) { initialCapacity = DEFAULT_CAPACITY; } if (maxCapacity>0 && maxCapacity<initialCapacity) { initialCapacity = maxCapacity; } if (initialCapacity > (int32_t)(INT32_MAX / sizeof(int32_t))) { initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity); } elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity); if (elements == 0) { status = U_MEMORY_ALLOCATION_ERROR; } else { capacity = initialCapacity; } } UVector32::~UVector32() { uprv_free(elements); elements = 0; } /** * Assign this object to another (make this a copy of 'other'). */ void UVector32::assign(const UVector32& other, UErrorCode &ec) { if (ensureCapacity(other.count, ec)) { setSize(other.count); for (int32_t i=0; i<other.count; ++i) { elements[i] = other.elements[i]; } } } UBool UVector32::operator==(const UVector32& other) { int32_t i; if (count != other.count) return FALSE; for (i=0; i<count; ++i) { if (elements[i] != other.elements[i]) { return FALSE; } } return TRUE; } void UVector32::setElementAt(int32_t elem, int32_t index) { if (0 <= index && index < count) { elements[index] = elem; } /* else index out of range */ } void UVector32::insertElementAt(int32_t elem, int32_t index, UErrorCode &status) { // must have 0 <= index <= count if (0 <= index && index <= count && ensureCapacity(count + 1, status)) { for (int32_t i=count; i>index; --i) { elements[i] = elements[i-1]; } elements[index] = elem; ++count; } /* else index out of range */ } UBool UVector32::containsAll(const UVector32& other) const { for (int32_t i=0; i<other.size(); ++i) { if (indexOf(other.elements[i]) < 0) { return FALSE; } } return TRUE; } UBool UVector32::containsNone(const UVector32& other) const { for (int32_t i=0; i<other.size(); ++i) { if (indexOf(other.elements[i]) >= 0) { return FALSE; } } return TRUE; } UBool UVector32::removeAll(const UVector32& other) { UBool changed = FALSE; for (int32_t i=0; i<other.size(); ++i) { int32_t j = indexOf(other.elements[i]); if (j >= 0) { removeElementAt(j); changed = TRUE; } } return changed; } UBool UVector32::retainAll(const UVector32& other) { UBool changed = FALSE; for (int32_t j=size()-1; j>=0; --j) { int32_t i = other.indexOf(elements[j]); if (i < 0) { removeElementAt(j); changed = TRUE; } } return changed; } void UVector32::removeElementAt(int32_t index) { if (index >= 0) { for (int32_t i=index; i<count-1; ++i) { elements[i] = elements[i+1]; } --count; } } void UVector32::removeAllElements(void) { count = 0; } UBool UVector32::equals(const UVector32 &other) const { int i; if (this->count != other.count) { return FALSE; } for (i=0; i<count; i++) { if (elements[i] != other.elements[i]) { return FALSE; } } return TRUE; } int32_t UVector32::indexOf(int32_t key, int32_t startIndex) const { int32_t i; for (i=startIndex; i<count; ++i) { if (key == elements[i]) { return i; } } return -1; } UBool UVector32::expandCapacity(int32_t minimumCapacity, UErrorCode &status) { if (minimumCapacity < 0) { status = U_ILLEGAL_ARGUMENT_ERROR; return FALSE; } if (capacity >= minimumCapacity) { return TRUE; } if (maxCapacity>0 && minimumCapacity>maxCapacity) { status = U_BUFFER_OVERFLOW_ERROR; return FALSE; } if (capacity > (INT32_MAX - 1) / 2) { // integer overflow check status = U_ILLEGAL_ARGUMENT_ERROR; return FALSE; } int32_t newCap = capacity * 2; if (newCap < minimumCapacity) { newCap = minimumCapacity; } if (maxCapacity > 0 && newCap > maxCapacity) { newCap = maxCapacity; } if (newCap > (int32_t)(INT32_MAX / sizeof(int32_t))) { // integer overflow check // We keep the original memory contents on bad minimumCapacity/maxCapacity. status = U_ILLEGAL_ARGUMENT_ERROR; return FALSE; } int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*newCap); if (newElems == NULL) { // We keep the original contents on the memory failure on realloc. status = U_MEMORY_ALLOCATION_ERROR; return FALSE; } elements = newElems; capacity = newCap; return TRUE; } void UVector32::setMaxCapacity(int32_t limit) { U_ASSERT(limit >= 0); if (limit < 0) { limit = 0; } if (limit > (int32_t)(INT32_MAX / sizeof(int32_t))) { // integer overflow check for realloc // Something is very wrong, don't realloc, leave capacity and maxCapacity unchanged return; } maxCapacity = limit; if (capacity <= maxCapacity || maxCapacity == 0) { // Current capacity is within the new limit. return; } // New maximum capacity is smaller than the current size. // Realloc the storage to the new, smaller size. int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*maxCapacity); if (newElems == NULL) { // Realloc to smaller failed. // Just keep what we had. No need to call it a failure. return; } elements = newElems; capacity = maxCapacity; if (count > capacity) { count = capacity; } } /** * Change the size of this vector as follows: If newSize is smaller, * then truncate the array, possibly deleting held elements for i >= * newSize. If newSize is larger, grow the array, filling in new * slots with NULL. */ void UVector32::setSize(int32_t newSize) { int32_t i; if (newSize < 0) { return; } if (newSize > count) { UErrorCode ec = U_ZERO_ERROR; if (!ensureCapacity(newSize, ec)) { return; } for (i=count; i<newSize; ++i) { elements[i] = 0; } } count = newSize; } /** * Insert the given integer into this vector at its sorted position * as defined by 'compare'. The current elements are assumed to * be sorted already. */ void UVector32::sortedInsert(int32_t tok, UErrorCode& ec) { // Perform a binary search for the location to insert tok at. Tok // will be inserted between two elements a and b such that a <= // tok && tok < b, where there is a 'virtual' elements[-1] always // less than tok and a 'virtual' elements[count] always greater // than tok. int32_t min = 0, max = count; while (min != max) { int32_t probe = (min + max) / 2; //int8_t c = (*compare)(elements[probe], tok); //if (c > 0) { if (elements[probe] > tok) { max = probe; } else { // assert(c <= 0); min = probe + 1; } } if (ensureCapacity(count + 1, ec)) { for (int32_t i=count; i>min; --i) { elements[i] = elements[i-1]; } elements[min] = tok; ++count; } } U_NAMESPACE_END
Bogon/WinObjC
deps/3rdparty/iculegacy/source/common/uvectr32.cpp
C++
mit
8,670
/* * websupport.js * ~~~~~~~~~~~~~ * * sphinx.websupport utilities for all documentation. * * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ (function($) { $.fn.autogrow = function() { return this.each(function() { var textarea = this; $.fn.autogrow.resize(textarea); $(textarea) .focus(function() { textarea.interval = setInterval(function() { $.fn.autogrow.resize(textarea); }, 500); }) .blur(function() { clearInterval(textarea.interval); }); }); }; $.fn.autogrow.resize = function(textarea) { var lineHeight = parseInt($(textarea).css('line-height'), 10); var lines = textarea.value.split('\n'); var columns = textarea.cols; var lineCount = 0; $.each(lines, function() { lineCount += Math.ceil(this.length / columns) || 1; }); var height = lineHeight * (lineCount + 1); $(textarea).css('height', height); }; })(jQuery); (function($) { var comp, by; function init() { initEvents(); initComparator(); } function initEvents() { $(document).on("click", 'a.comment-close', function(event) { event.preventDefault(); hide($(this).attr('id').substring(2)); }); $(document).on("click", 'a.vote', function(event) { event.preventDefault(); handleVote($(this)); }); $(document).on("click", 'a.reply', function(event) { event.preventDefault(); openReply($(this).attr('id').substring(2)); }); $(document).on("click", 'a.close-reply', function(event) { event.preventDefault(); closeReply($(this).attr('id').substring(2)); }); $(document).on("click", 'a.sort-option', function(event) { event.preventDefault(); handleReSort($(this)); }); $(document).on("click", 'a.show-proposal', function(event) { event.preventDefault(); showProposal($(this).attr('id').substring(2)); }); $(document).on("click", 'a.hide-proposal', function(event) { event.preventDefault(); hideProposal($(this).attr('id').substring(2)); }); $(document).on("click", 'a.show-propose-change', function(event) { event.preventDefault(); showProposeChange($(this).attr('id').substring(2)); }); $(document).on("click", 'a.hide-propose-change', function(event) { event.preventDefault(); hideProposeChange($(this).attr('id').substring(2)); }); $(document).on("click", 'a.accept-comment', function(event) { event.preventDefault(); acceptComment($(this).attr('id').substring(2)); }); $(document).on("click", 'a.delete-comment', function(event) { event.preventDefault(); deleteComment($(this).attr('id').substring(2)); }); $(document).on("click", 'a.comment-markup', function(event) { event.preventDefault(); toggleCommentMarkupBox($(this).attr('id').substring(2)); }); } /** * Set comp, which is a comparator function used for sorting and * inserting comments into the list. */ function setComparator() { // If the first three letters are "asc", sort in ascending order // and remove the prefix. if (by.substring(0,3) == 'asc') { var i = by.substring(3); comp = function(a, b) { return a[i] - b[i]; }; } else { // Otherwise sort in descending order. comp = function(a, b) { return b[by] - a[by]; }; } // Reset link styles and format the selected sort option. $('a.sel').attr('href', '#').removeClass('sel'); $('a.by' + by).removeAttr('href').addClass('sel'); } /** * Create a comp function. If the user has preferences stored in * the sortBy cookie, use those, otherwise use the default. */ function initComparator() { by = 'rating'; // Default to sort by rating. // If the sortBy cookie is set, use that instead. if (document.cookie.length > 0) { var start = document.cookie.indexOf('sortBy='); if (start != -1) { start = start + 7; var end = document.cookie.indexOf(";", start); if (end == -1) { end = document.cookie.length; by = unescape(document.cookie.substring(start, end)); } } } setComparator(); } /** * Show a comment div. */ function show(id) { $('#ao' + id).hide(); $('#ah' + id).show(); var context = $.extend({id: id}, opts); var popup = $(renderTemplate(popupTemplate, context)).hide(); popup.find('textarea[name="proposal"]').hide(); popup.find('a.by' + by).addClass('sel'); var form = popup.find('#cf' + id); form.submit(function(event) { event.preventDefault(); addComment(form); }); $('#s' + id).after(popup); popup.slideDown('fast', function() { getComments(id); }); } /** * Hide a comment div. */ function hide(id) { $('#ah' + id).hide(); $('#ao' + id).show(); var div = $('#sc' + id); div.slideUp('fast', function() { div.remove(); }); } /** * Perform an ajax request to get comments for a node * and insert the comments into the comments tree. */ function getComments(id) { $.ajax({ type: 'GET', url: opts.getCommentsURL, data: {node: id}, success: function(data, textStatus, request) { var ul = $('#cl' + id); var speed = 100; $('#cf' + id) .find('textarea[name="proposal"]') .data('source', data.source); if (data.comments.length === 0) { ul.html('<li>No comments yet.</li>'); ul.data('empty', true); } else { // If there are comments, sort them and put them in the list. var comments = sortComments(data.comments); speed = data.comments.length * 100; appendComments(comments, ul); ul.data('empty', false); } $('#cn' + id).slideUp(speed + 200); ul.slideDown(speed); }, error: function(request, textStatus, error) { showError('Oops, there was a problem retrieving the comments.'); }, dataType: 'json' }); } /** * Add a comment via ajax and insert the comment into the comment tree. */ function addComment(form) { var node_id = form.find('input[name="node"]').val(); var parent_id = form.find('input[name="parent"]').val(); var text = form.find('textarea[name="comment"]').val(); var proposal = form.find('textarea[name="proposal"]').val(); if (text == '') { showError('Please enter a comment.'); return; } // Disable the form that is being submitted. form.find('textarea,input').attr('disabled', 'disabled'); // Send the comment to the server. $.ajax({ type: "POST", url: opts.addCommentURL, dataType: 'json', data: { node: node_id, parent: parent_id, text: text, proposal: proposal }, success: function(data, textStatus, error) { // Reset the form. if (node_id) { hideProposeChange(node_id); } form.find('textarea') .val('') .add(form.find('input')) .removeAttr('disabled'); var ul = $('#cl' + (node_id || parent_id)); if (ul.data('empty')) { $(ul).empty(); ul.data('empty', false); } insertComment(data.comment); var ao = $('#ao' + node_id); ao.find('img').attr({'src': opts.commentBrightImage}); if (node_id) { // if this was a "root" comment, remove the commenting box // (the user can get it back by reopening the comment popup) $('#ca' + node_id).slideUp(); } }, error: function(request, textStatus, error) { form.find('textarea,input').removeAttr('disabled'); showError('Oops, there was a problem adding the comment.'); } }); } /** * Recursively append comments to the main comment list and children * lists, creating the comment tree. */ function appendComments(comments, ul) { $.each(comments, function() { var div = createCommentDiv(this); ul.append($(document.createElement('li')).html(div)); appendComments(this.children, div.find('ul.comment-children')); // To avoid stagnating data, don't store the comments children in data. this.children = null; div.data('comment', this); }); } /** * After adding a new comment, it must be inserted in the correct * location in the comment tree. */ function insertComment(comment) { var div = createCommentDiv(comment); // To avoid stagnating data, don't store the comments children in data. comment.children = null; div.data('comment', comment); var ul = $('#cl' + (comment.node || comment.parent)); var siblings = getChildren(ul); var li = $(document.createElement('li')); li.hide(); // Determine where in the parents children list to insert this comment. for(i=0; i < siblings.length; i++) { if (comp(comment, siblings[i]) <= 0) { $('#cd' + siblings[i].id) .parent() .before(li.html(div)); li.slideDown('fast'); return; } } // If we get here, this comment rates lower than all the others, // or it is the only comment in the list. ul.append(li.html(div)); li.slideDown('fast'); } function acceptComment(id) { $.ajax({ type: 'POST', url: opts.acceptCommentURL, data: {id: id}, success: function(data, textStatus, request) { $('#cm' + id).fadeOut('fast'); $('#cd' + id).removeClass('moderate'); }, error: function(request, textStatus, error) { showError('Oops, there was a problem accepting the comment.'); } }); } function deleteComment(id) { $.ajax({ type: 'POST', url: opts.deleteCommentURL, data: {id: id}, success: function(data, textStatus, request) { var div = $('#cd' + id); if (data == 'delete') { // Moderator mode: remove the comment and all children immediately div.slideUp('fast', function() { div.remove(); }); return; } // User mode: only mark the comment as deleted div .find('span.user-id:first') .text('[deleted]').end() .find('div.comment-text:first') .text('[deleted]').end() .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id + ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id) .remove(); var comment = div.data('comment'); comment.username = '[deleted]'; comment.text = '[deleted]'; div.data('comment', comment); }, error: function(request, textStatus, error) { showError('Oops, there was a problem deleting the comment.'); } }); } function showProposal(id) { $('#sp' + id).hide(); $('#hp' + id).show(); $('#pr' + id).slideDown('fast'); } function hideProposal(id) { $('#hp' + id).hide(); $('#sp' + id).show(); $('#pr' + id).slideUp('fast'); } function showProposeChange(id) { $('#pc' + id).hide(); $('#hc' + id).show(); var textarea = $('#pt' + id); textarea.val(textarea.data('source')); $.fn.autogrow.resize(textarea[0]); textarea.slideDown('fast'); } function hideProposeChange(id) { $('#hc' + id).hide(); $('#pc' + id).show(); var textarea = $('#pt' + id); textarea.val('').removeAttr('disabled'); textarea.slideUp('fast'); } function toggleCommentMarkupBox(id) { $('#mb' + id).toggle(); } /** Handle when the user clicks on a sort by link. */ function handleReSort(link) { var classes = link.attr('class').split(/\s+/); for (var i=0; i<classes.length; i++) { if (classes[i] != 'sort-option') { by = classes[i].substring(2); } } setComparator(); // Save/update the sortBy cookie. var expiration = new Date(); expiration.setDate(expiration.getDate() + 365); document.cookie= 'sortBy=' + escape(by) + ';expires=' + expiration.toUTCString(); $('ul.comment-ul').each(function(index, ul) { var comments = getChildren($(ul), true); comments = sortComments(comments); appendComments(comments, $(ul).empty()); }); } /** * Function to process a vote when a user clicks an arrow. */ function handleVote(link) { if (!opts.voting) { showError("You'll need to login to vote."); return; } var id = link.attr('id'); if (!id) { // Didn't click on one of the voting arrows. return; } // If it is an unvote, the new vote value is 0, // Otherwise it's 1 for an upvote, or -1 for a downvote. var value = 0; if (id.charAt(1) != 'u') { value = id.charAt(0) == 'u' ? 1 : -1; } // The data to be sent to the server. var d = { comment_id: id.substring(2), value: value }; // Swap the vote and unvote links. link.hide(); $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id) .show(); // The div the comment is displayed in. var div = $('div#cd' + d.comment_id); var data = div.data('comment'); // If this is not an unvote, and the other vote arrow has // already been pressed, unpress it. if ((d.value !== 0) && (data.vote === d.value * -1)) { $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide(); $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show(); } // Update the comments rating in the local data. data.rating += (data.vote === 0) ? d.value : (d.value - data.vote); data.vote = d.value; div.data('comment', data); // Change the rating text. div.find('.rating:first') .text(data.rating + ' point' + (data.rating == 1 ? '' : 's')); // Send the vote information to the server. $.ajax({ type: "POST", url: opts.processVoteURL, data: d, error: function(request, textStatus, error) { showError('Oops, there was a problem casting that vote.'); } }); } /** * Open a reply form used to reply to an existing comment. */ function openReply(id) { // Swap out the reply link for the hide link $('#rl' + id).hide(); $('#cr' + id).show(); // Add the reply li to the children ul. var div = $(renderTemplate(replyTemplate, {id: id})).hide(); $('#cl' + id) .prepend(div) // Setup the submit handler for the reply form. .find('#rf' + id) .submit(function(event) { event.preventDefault(); addComment($('#rf' + id)); closeReply(id); }) .find('input[type=button]') .click(function() { closeReply(id); }); div.slideDown('fast', function() { $('#rf' + id).find('textarea').focus(); }); } /** * Close the reply form opened with openReply. */ function closeReply(id) { // Remove the reply div from the DOM. $('#rd' + id).slideUp('fast', function() { $(this).remove(); }); // Swap out the hide link for the reply link $('#cr' + id).hide(); $('#rl' + id).show(); } /** * Recursively sort a tree of comments using the comp comparator. */ function sortComments(comments) { comments.sort(comp); $.each(comments, function() { this.children = sortComments(this.children); }); return comments; } /** * Get the children comments from a ul. If recursive is true, * recursively include childrens' children. */ function getChildren(ul, recursive) { var children = []; ul.children().children("[id^='cd']") .each(function() { var comment = $(this).data('comment'); if (recursive) comment.children = getChildren($(this).find('#cl' + comment.id), true); children.push(comment); }); return children; } /** Create a div to display a comment in. */ function createCommentDiv(comment) { if (!comment.displayed && !opts.moderator) { return $('<div class="moderate">Thank you! Your comment will show up ' + 'once it is has been approved by a moderator.</div>'); } // Prettify the comment rating. comment.pretty_rating = comment.rating + ' point' + (comment.rating == 1 ? '' : 's'); // Make a class (for displaying not yet moderated comments differently) comment.css_class = comment.displayed ? '' : ' moderate'; // Create a div for this comment. var context = $.extend({}, opts, comment); var div = $(renderTemplate(commentTemplate, context)); // If the user has voted on this comment, highlight the correct arrow. if (comment.vote) { var direction = (comment.vote == 1) ? 'u' : 'd'; div.find('#' + direction + 'v' + comment.id).hide(); div.find('#' + direction + 'u' + comment.id).show(); } if (opts.moderator || comment.text != '[deleted]') { div.find('a.reply').show(); if (comment.proposal_diff) div.find('#sp' + comment.id).show(); if (opts.moderator && !comment.displayed) div.find('#cm' + comment.id).show(); if (opts.moderator || (opts.username == comment.username)) div.find('#dc' + comment.id).show(); } return div; } /** * A simple template renderer. Placeholders such as <%id%> are replaced * by context['id'] with items being escaped. Placeholders such as <#id#> * are not escaped. */ function renderTemplate(template, context) { var esc = $(document.createElement('div')); function handle(ph, escape) { var cur = context; $.each(ph.split('.'), function() { cur = cur[this]; }); return escape ? esc.text(cur || "").html() : cur; } return template.replace(/<([%#])([\w\.]*)\1>/g, function() { return handle(arguments[2], arguments[1] == '%' ? true : false); }); } /** Flash an error message briefly. */ function showError(message) { $(document.createElement('div')).attr({'class': 'popup-error'}) .append($(document.createElement('div')) .attr({'class': 'error-message'}).text(message)) .appendTo('body') .fadeIn("slow") .delay(2000) .fadeOut("slow"); } /** Add a link the user uses to open the comments popup. */ $.fn.comment = function() { return this.each(function() { var id = $(this).attr('id').substring(1); var count = COMMENT_METADATA[id]; var title = count + ' comment' + (count == 1 ? '' : 's'); var image = count > 0 ? opts.commentBrightImage : opts.commentImage; var addcls = count == 0 ? ' nocomment' : ''; $(this) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-open' + addcls, id: 'ao' + id }) .append($(document.createElement('img')).attr({ src: image, alt: 'comment', title: title })) .click(function(event) { event.preventDefault(); show($(this).attr('id').substring(2)); }) ) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-close hidden', id: 'ah' + id }) .append($(document.createElement('img')).attr({ src: opts.closeCommentImage, alt: 'close', title: 'close' })) .click(function(event) { event.preventDefault(); hide($(this).attr('id').substring(2)); }) ); }); }; var opts = { processVoteURL: '/_process_vote', addCommentURL: '/_add_comment', getCommentsURL: '/_get_comments', acceptCommentURL: '/_accept_comment', deleteCommentURL: '/_delete_comment', commentImage: '/static/_static/comment.png', closeCommentImage: '/static/_static/comment-close.png', loadingImage: '/static/_static/ajax-loader.gif', commentBrightImage: '/static/_static/comment-bright.png', upArrow: '/static/_static/up.png', downArrow: '/static/_static/down.png', upArrowPressed: '/static/_static/up-pressed.png', downArrowPressed: '/static/_static/down-pressed.png', voting: false, moderator: false }; if (typeof COMMENT_OPTIONS != "undefined") { opts = jQuery.extend(opts, COMMENT_OPTIONS); } var popupTemplate = '\ <div class="sphinx-comments" id="sc<%id%>">\ <p class="sort-options">\ Sort by:\ <a href="#" class="sort-option byrating">best rated</a>\ <a href="#" class="sort-option byascage">newest</a>\ <a href="#" class="sort-option byage">oldest</a>\ </p>\ <div class="comment-header">Comments</div>\ <div class="comment-loading" id="cn<%id%>">\ loading comments... <img src="<%loadingImage%>" alt="" /></div>\ <ul id="cl<%id%>" class="comment-ul"></ul>\ <div id="ca<%id%>">\ <p class="add-a-comment">Add a comment\ (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\ <div class="comment-markup-box" id="mb<%id%>">\ reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \ <code>``code``</code>, \ code blocks: <code>::</code> and an indented block after blank line</div>\ <form method="post" id="cf<%id%>" class="comment-form" action="">\ <textarea name="comment" cols="80"></textarea>\ <p class="propose-button">\ <a href="#" id="pc<%id%>" class="show-propose-change">\ Propose a change &#9657;\ </a>\ <a href="#" id="hc<%id%>" class="hide-propose-change">\ Propose a change &#9663;\ </a>\ </p>\ <textarea name="proposal" id="pt<%id%>" cols="80"\ spellcheck="false"></textarea>\ <input type="submit" value="Add comment" />\ <input type="hidden" name="node" value="<%id%>" />\ <input type="hidden" name="parent" value="" />\ </form>\ </div>\ </div>'; var commentTemplate = '\ <div id="cd<%id%>" class="sphinx-comment<%css_class%>">\ <div class="vote">\ <div class="arrow">\ <a href="#" id="uv<%id%>" class="vote" title="vote up">\ <img src="<%upArrow%>" />\ </a>\ <a href="#" id="uu<%id%>" class="un vote" title="vote up">\ <img src="<%upArrowPressed%>" />\ </a>\ </div>\ <div class="arrow">\ <a href="#" id="dv<%id%>" class="vote" title="vote down">\ <img src="<%downArrow%>" id="da<%id%>" />\ </a>\ <a href="#" id="du<%id%>" class="un vote" title="vote down">\ <img src="<%downArrowPressed%>" />\ </a>\ </div>\ </div>\ <div class="comment-content">\ <p class="tagline comment">\ <span class="user-id"><%username%></span>\ <span class="rating"><%pretty_rating%></span>\ <span class="delta"><%time.delta%></span>\ </p>\ <div class="comment-text comment"><#text#></div>\ <p class="comment-opts comment">\ <a href="#" class="reply hidden" id="rl<%id%>">reply &#9657;</a>\ <a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>\ <a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>\ <a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</a>\ <a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\ <span id="cm<%id%>" class="moderation hidden">\ <a href="#" id="ac<%id%>" class="accept-comment">accept</a>\ </span>\ </p>\ <pre class="proposal" id="pr<%id%>">\ <#proposal_diff#>\ </pre>\ <ul class="comment-children" id="cl<%id%>"></ul>\ </div>\ <div class="clearleft"></div>\ </div>\ </div>'; var replyTemplate = '\ <li>\ <div class="reply-div" id="rd<%id%>">\ <form id="rf<%id%>">\ <textarea name="comment" cols="80"></textarea>\ <input type="submit" value="Add reply" />\ <input type="button" value="Cancel" />\ <input type="hidden" name="parent" value="<%id%>" />\ <input type="hidden" name="node" value="" />\ </form>\ </div>\ </li>'; $(document).ready(function() { init(); }); })(jQuery); $(document).ready(function() { // add comment anchors for all paragraphs that are commentable $('.sphinx-has-comment').comment(); // highlight search words in search results $("div.context").each(function() { var params = $.getQueryParameters(); var terms = (params.q) ? params.q[0].split(/\s+/) : []; var result = $(this); $.each(terms, function() { result.highlightText(this.toLowerCase(), 'highlighted'); }); }); // directly open comment window if requested var anchor = document.location.hash; if (anchor.substring(0, 9) == '#comment-') { $('#ao' + anchor.substring(9)).click(); document.location.hash = '#s' + anchor.substring(9); } });
previtus/MGR-Project-Code
____CD folder/Documentation/html documentation/_static/websupport.js
JavaScript
mit
25,351
//! moment.js locale configuration //! locale : Turkish [tr] //! authors : Erhan Gundogan : https://github.com/erhangundogan, //! Burak Yiğit Kaya: https://github.com/BYK import moment from '../moment'; var suffixes = { 1: '\'inci', 5: '\'inci', 8: '\'inci', 70: '\'inci', 80: '\'inci', 2: '\'nci', 7: '\'nci', 20: '\'nci', 50: '\'nci', 3: '\'ΓΌncΓΌ', 4: '\'ΓΌncΓΌ', 100: '\'ΓΌncΓΌ', 6: '\'ncΔ±', 9: '\'uncu', 10: '\'uncu', 30: '\'uncu', 60: '\'Δ±ncΔ±', 90: '\'Δ±ncΔ±' }; export default moment.defineLocale('tr', { months : 'Ocak_Şubat_Mart_Nisan_MayΔ±s_Haziran_Temmuz_Ağustos_EylΓΌl_Ekim_KasΔ±m_AralΔ±k'.split('_'), monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), weekdays : 'Pazar_Pazartesi_SalΔ±_Γ‡arşamba_Perşembe_Cuma_Cumartesi'.split('_'), weekdaysShort : 'Paz_Pts_Sal_Γ‡ar_Per_Cum_Cts'.split('_'), weekdaysMin : 'Pz_Pt_Sa_Γ‡a_Pe_Cu_Ct'.split('_'), longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', L : 'DD.MM.YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'dddd, D MMMM YYYY HH:mm' }, calendar : { sameDay : '[bugΓΌn saat] LT', nextDay : '[yarΔ±n saat] LT', nextWeek : '[haftaya] dddd [saat] LT', lastDay : '[dΓΌn] LT', lastWeek : '[geΓ§en hafta] dddd [saat] LT', sameElse : 'L' }, relativeTime : { future : '%s sonra', past : '%s ΓΆnce', s : 'birkaΓ§ saniye', m : 'bir dakika', mm : '%d dakika', h : 'bir saat', hh : '%d saat', d : 'bir gΓΌn', dd : '%d gΓΌn', M : 'bir ay', MM : '%d ay', y : 'bir yΔ±l', yy : '%d yΔ±l' }, ordinalParse: /\d{1,2}'(inci|nci|ΓΌncΓΌ|ncΔ±|uncu|Δ±ncΔ±)/, ordinal : function (number) { if (number === 0) { // special case for zero return number + '\'Δ±ncΔ±'; } var a = number % 10, b = number % 100 - a, c = number >= 100 ? 100 : null; return number + (suffixes[a] || suffixes[b] || suffixes[c]); }, week : { dow : 1, // Monday is the first day of the week. doy : 7 // The week that contains Jan 1st is the first week of the year. } });
tafazul/Angular
node_modules/moment/src/locale/tr.js
JavaScript
mit
2,357
html { padding:0 10px; } body { margin:0; padding:10px 0; background:#000; } #epiceditor-preview h1, #epiceditor-preview h2, #epiceditor-preview h3, #epiceditor-preview h4, #epiceditor-preview h5, #epiceditor-preview h6, #epiceditor-preview p, #epiceditor-preview blockquote { margin: 0; padding: 0; } #epiceditor-preview { background:#000; font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif; font-size: 13px; line-height: 18px; color: #ccc; } #epiceditor-preview a { color: #fff; } #epiceditor-preview a:hover { color: #00ff00; text-decoration: none; } #epiceditor-preview a img { border: none; } #epiceditor-preview p { margin-bottom: 9px; } #epiceditor-preview h1, #epiceditor-preview h2, #epiceditor-preview h3, #epiceditor-preview h4, #epiceditor-preview h5, #epiceditor-preview h6 { color: #cdcdcd; line-height: 36px; } #epiceditor-preview h1 { margin-bottom: 18px; font-size: 30px; } #epiceditor-preview h2 { font-size: 24px; } #epiceditor-preview h3 { font-size: 18px; } #epiceditor-preview h4 { font-size: 16px; } #epiceditor-preview h5 { font-size: 14px; } #epiceditor-preview h6 { font-size: 13px; } #epiceditor-preview hr { margin: 0 0 19px; border: 0; border-bottom: 1px solid #ccc; } #epiceditor-preview blockquote { padding: 13px 13px 21px 15px; margin-bottom: 18px; font-family:georgia,serif; font-style: italic; } #epiceditor-preview blockquote:before { content:"\201C"; font-size:40px; margin-left:-10px; font-family:georgia,serif; color:#eee; } #epiceditor-preview blockquote p { font-size: 14px; font-weight: 300; line-height: 18px; margin-bottom: 0; font-style: italic; } #epiceditor-preview code, #epiceditor-preview pre { font-family: Monaco, Andale Mono, Courier New, monospace; } #epiceditor-preview code { background-color: #000; color: #f92672; padding: 1px 3px; font-size: 12px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } #epiceditor-preview pre { display: block; padding: 14px; color:#66d9ef; margin: 0 0 18px; line-height: 16px; font-size: 11px; border: 1px solid #d9d9d9; white-space: pre-wrap; word-wrap: break-word; } #epiceditor-preview pre code { background-color: #000; color:#ccc; font-size: 11px; padding: 0; }
Dervisevic/cdnjs
ajax/libs/epiceditor/0.2.0/themes/preview/preview-dark.css
CSS
mit
2,454
'use strict'; /*jshint asi: true*/ var test = require('tap').test , util = require('util') , redeyed = require('..') function inspect (obj) { return util.inspect(obj, false, 5, true) } test('adding custom asserts ... ', function (t) { t.constructor.prototype.assertSurrounds = function (code, opts, expected) { var optsi = inspect(opts); var result = redeyed(code, opts).code this.equals( result , expected , util.format('%s: %s => %s', optsi, inspect(code), inspect(expected)) ) return this; } t.end() }) test('\n undefineds only', function (t) { t.assertSurrounds('1 + 2', { Numeric: { _default: undefined } }, '1 + 2') t.assertSurrounds('1 + 2', { Numeric: { _default: undefined }, _default: undefined }, '1 + 2') t.assertSurrounds( 'return true' , { 'Boolean': { 'true': undefined, 'false': undefined, _default: undefined } , _default: undefined } , 'return true' ) t.end() }) test('\n mixed', function (t) { t.assertSurrounds( 'return true || false' , { 'Boolean': { 'true': '&:', 'false': undefined, _default: undefined } , _default: undefined } , 'return &true || false' ) t.assertSurrounds( 'return true || false' , { 'Boolean': { 'true': '&:', 'false': undefined, _default: ':?' } , _default: undefined } , 'return &true? || false?' ) t.assertSurrounds( 'return true || false' , { 'Boolean': { 'true': '&:', 'false': undefined, _default: undefined } , _default: ':?' } , 'return &true? || false' ) t.end() })
sonomar/sonomar.github.io
_site/bootstrap/bootstrap-3.3.5/node_modules/npm-shrinkwrap/node_modules/msee/node_modules/cardinal/node_modules/redeyed/test/redeyed-config-with-undefineds.js
JavaScript
mit
1,589
YUI.add('event-focus', function (Y, NAME) { /** * Adds bubbling and delegation support to DOM events focus and blur. * * @module event * @submodule event-focus */ var Event = Y.Event, YLang = Y.Lang, isString = YLang.isString, arrayIndex = Y.Array.indexOf, useActivate = (function() { // Changing the structure of this test, so that it doesn't use inline JS in HTML, // which throws an exception in Win8 packaged apps, due to additional security restrictions: // http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences var supported = false, doc = Y.config.doc, p; if (doc) { p = doc.createElement("p"); p.setAttribute("onbeforeactivate", ";"); // onbeforeactivate is a function in IE8+. // onbeforeactivate is a string in IE6,7 (unfortunate, otherwise we could have just checked for function below). // onbeforeactivate is a function in IE10, in a Win8 App environment (no exception running the test). // onbeforeactivate is undefined in Webkit/Gecko. // onbeforeactivate is a function in Webkit/Gecko if it's a supported event (e.g. onclick). supported = (p.onbeforeactivate !== undefined); } return supported; }()); function define(type, proxy, directEvent) { var nodeDataKey = '_' + type + 'Notifiers'; Y.Event.define(type, { _useActivate : useActivate, _attach: function (el, notifier, delegate) { if (Y.DOM.isWindow(el)) { return Event._attach([type, function (e) { notifier.fire(e); }, el]); } else { return Event._attach( [proxy, this._proxy, el, this, notifier, delegate], { capture: true }); } }, _proxy: function (e, notifier, delegate) { var target = e.target, currentTarget = e.currentTarget, notifiers = target.getData(nodeDataKey), yuid = Y.stamp(currentTarget._node), defer = (useActivate || target !== currentTarget), directSub; notifier.currentTarget = (delegate) ? target : currentTarget; notifier.container = (delegate) ? currentTarget : null; // Maintain a list to handle subscriptions from nested // containers div#a>div#b>input #a.on(focus..) #b.on(focus..), // use one focus or blur subscription that fires notifiers from // #b then #a to emulate bubble sequence. if (!notifiers) { notifiers = {}; target.setData(nodeDataKey, notifiers); // only subscribe to the element's focus if the target is // not the current target ( if (defer) { directSub = Event._attach( [directEvent, this._notify, target._node]).sub; directSub.once = true; } } else { // In old IE, defer is always true. In capture-phase browsers, // The delegate subscriptions will be encountered first, which // will establish the notifiers data and direct subscription // on the node. If there is also a direct subscription to the // node's focus/blur, it should not call _notify because the // direct subscription from the delegate sub(s) exists, which // will call _notify. So this avoids _notify being called // twice, unnecessarily. defer = true; } if (!notifiers[yuid]) { notifiers[yuid] = []; } notifiers[yuid].push(notifier); if (!defer) { this._notify(e); } }, _notify: function (e, container) { var currentTarget = e.currentTarget, notifierData = currentTarget.getData(nodeDataKey), axisNodes = currentTarget.ancestors(), doc = currentTarget.get('ownerDocument'), delegates = [], // Used to escape loops when there are no more // notifiers to consider count = notifierData ? Y.Object.keys(notifierData).length : 0, target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret; // clear the notifications list (mainly for delegation) currentTarget.clearData(nodeDataKey); // Order the delegate subs by their placement in the parent axis axisNodes.push(currentTarget); // document.get('ownerDocument') returns null // which we'll use to prevent having duplicate Nodes in the list if (doc) { axisNodes.unshift(doc); } // ancestors() returns the Nodes from top to bottom axisNodes._nodes.reverse(); if (count) { // Store the count for step 2 tmp = count; axisNodes.some(function (node) { var yuid = Y.stamp(node), notifiers = notifierData[yuid], i, len; if (notifiers) { count--; for (i = 0, len = notifiers.length; i < len; ++i) { if (notifiers[i].handle.sub.filter) { delegates.push(notifiers[i]); } } } return !count; }); count = tmp; } // Walk up the parent axis, notifying direct subscriptions and // testing delegate filters. while (count && (target = axisNodes.shift())) { yuid = Y.stamp(target); notifiers = notifierData[yuid]; if (notifiers) { for (i = 0, len = notifiers.length; i < len; ++i) { notifier = notifiers[i]; sub = notifier.handle.sub; match = true; e.currentTarget = target; if (sub.filter) { match = sub.filter.apply(target, [target, e].concat(sub.args || [])); // No longer necessary to test against this // delegate subscription for the nodes along // the parent axis. delegates.splice( arrayIndex(delegates, notifier), 1); } if (match) { // undefined for direct subs e.container = notifier.container; ret = notifier.fire(e); } if (ret === false || e.stopped === 2) { break; } } delete notifiers[yuid]; count--; } if (e.stopped !== 2) { // delegates come after subs targeting this specific node // because they would not normally report until they'd // bubbled to the container node. for (i = 0, len = delegates.length; i < len; ++i) { notifier = delegates[i]; sub = notifier.handle.sub; if (sub.filter.apply(target, [target, e].concat(sub.args || []))) { e.container = notifier.container; e.currentTarget = target; ret = notifier.fire(e); } if (ret === false || e.stopped === 2) { break; } } } if (e.stopped) { break; } } }, on: function (node, sub, notifier) { sub.handle = this._attach(node._node, notifier); }, detach: function (node, sub) { sub.handle.detach(); }, delegate: function (node, sub, notifier, filter) { if (isString(filter)) { sub.filter = function (target) { return Y.Selector.test(target._node, filter, node === target ? null : node._node); }; } sub.handle = this._attach(node._node, notifier, true); }, detachDelegate: function (node, sub) { sub.handle.detach(); } }, true); } // For IE, we need to defer to focusin rather than focus because // `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate, // el.onfocusin, doSomething, then el.onfocus. All others support capture // phase focus, which executes before doSomething. To guarantee consistent // behavior for this use case, IE's direct subscriptions are made against // focusin so subscribers will be notified before js following el.focus() is // executed. if (useActivate) { // name capture phase direct subscription define("focus", "beforeactivate", "focusin"); define("blur", "beforedeactivate", "focusout"); } else { define("focus", "focus", "focus"); define("blur", "blur", "blur"); } }, '@VERSION@', {"requires": ["event-synthetic"]});
camelotceo/cdnjs
ajax/libs/yui/3.10.3/event-focus/event-focus-debug.js
JavaScript
mit
10,066
ο»Ώ/* Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("a11yhelp","ug",{title:"Ω‚ΩˆΨ΄Ϋ‡Ω…Ϊ†Ϋ• Ϊ†ΫˆΨ΄Ϋ•Ω†Ψ―ΫˆΨ±ΫˆΨ΄",contents:"ΩŠΨ§Ψ±Ψ―Ϋ•Ω… Ω…Ϋ•Ψ²Ω…Ϋ‡Ω†Ω‰. Ψ¨Ϋ‡ Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΩ†Ω‰ ΩŠΨ§ΩΎΩ…Ψ§Ω‚Ϊ†Ω‰ Ψ¨ΩˆΩ„Ψ³Ω‰Ϊ­Ω‰Ψ² ESC Ω†Ω‰ بېسىڭ.",legend:[{name:"Ψ¦Ψ§Ψ―Ϋ•ΨͺΨͺΩ‰ΩƒΩ‰",items:[{name:"Ω‚ΩˆΨ±Ψ§Ω„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚ ΨͺΫ•ΪΎΨ±Ω‰Ψ±",legend:"${toolbarFocus} بېسىلسا Ω‚ΩˆΨ±Ψ§Ω„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚Ω‚Ψ§ يېΨͺΫ•ΩƒΩ„Ϋ•ΩŠΨ―Ϋ‡ΨŒ TAB ΩŠΨ§ΩƒΩ‰ SHIFT+TAB Ψ¦Ψ§Ψ±Ω‚Ω‰Ω„Ω‰Ω‚ Ω‚ΩˆΨ±Ψ§Ω„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚ Ϊ―Ϋ‡Ψ±Ϋ‡ΩΎΩΎΩ‰Ψ³Ω‰ ΨͺΨ§Ω„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡ΨŒ ئوڭ Ψ³ΩˆΩ„ يا Ψ¦ΩˆΩ‚ΨͺΨ§ ΨͺΩˆΩΎΪ†Ψ§ ΨͺΨ§Ω„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡ΨŒ Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ ΩŠΨ§ΩƒΩ‰ Enter ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΨ§Ω„Ω„Ψ§Ω†ΨΊΨ§Ω† ΨͺΩˆΩΎΪ†Ω‰Ω†Ω‰ Ω‚ΩˆΩ„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡."},{name:"ΨͺΫ•ΪΎΨ±Ω‰Ψ±Ω„Ω‰Ϊ―ΫˆΪ† Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΨ³Ω‰",legend:"Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΨ―Ϋ• TAB ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ Ψ³Ϋ†Ψ² Ψ¨Ϋ†Ω„Ω‰ΩƒΩ‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΩ‰Ω„Ω‰Ψ―Ϋ‡ΨŒ SHIFT + TAB Ψ¨Ω‰Ψ±Ω‰ΩƒΩ…Ϋ• ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ Ψ³Ϋ†Ψ² Ψ¨Ϋ†Ω„Ω‰ΩƒΩ‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΩ‰Ω„Ω‰Ψ―Ϋ‡ΨŒ ENTER ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΩ†Ω‰ ΨͺΨ§ΩΎΨ΄Ϋ‡Ψ±Ω‰Ψ―Ϋ‡ΨŒ ESC ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΨ―Ω‰Ω† Ϋ‹Ψ§Ψ² كېچىدۇ. ΩƒΫ†ΩΎ Ψ¨Ϋ•ΨͺΩƒΫˆΪ†Ω„ΫˆΩƒ Ψ³Ϋ†Ψ²Ω„Ϋ•Ψ΄ΩƒΫˆΪ―Ϋ• Ω†Ω‰Ψ³Ψ¨Ϋ•ΨͺΫ•Ω†ΨŒ ALT + F10 Ψ―Ψ§ Ψ¨Ϋ•ΨͺΩƒΫˆΪ† ΨͺΩ‰Ψ²Ω‰Ω…Ω‰ΨΊΨ§ ΩŠΫ†ΨͺΩƒΫ•ΩŠΨ―Ϋ‡. Ψ¦Ψ§Ω†Ψ―Ω‰Ω† TAB ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ ΩŠΨ§ΩƒΩ‰ ئوڭ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ Ψ¨Ϋ•ΨͺΩƒΫˆΪ†ΩƒΫ• ΩŠΫ†ΨͺΩƒΫ•ΩŠΨ―Ϋ‡Ψ› SHIFT + TAB ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ ΩŠΨ§ΩƒΩ‰ Ψ³ΩˆΩ„ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ Ψ¨Ϋ•ΨͺΩƒΫˆΪ†ΩƒΫ• ΩŠΫ†ΨͺΩƒΫ•ΩŠΨ―Ϋ‡. Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ ΩŠΨ§ΩƒΩ‰ ENTER ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ¨Ϋ•ΨͺΩƒΫˆΪ†Ω†Ω‰ ΨͺΨ§Ω„Ω„Ψ§ΩŠΨ―Ϋ‡."}, {name:"ΨͺΫ•ΪΎΨ±Ω‰Ψ±Ω„Ω‰Ϊ―ΫˆΪ† ΨͺΩ‰Ω„ Ω…Ϋ‡ΪΎΩ‰Ψͺ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰ΩƒΩ‰",legend:"${contextMenu} ΩŠΨ§ΩƒΩ‰ Ψ¦Ϋ•ΩΎ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΩ‰Ω„ Ω…Ϋ‡ΪΎΩ‰Ψͺ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰ΩƒΩ‰Ω†Ω‰ Ψ¦Ψ§Ϊ†Ω‰Ψ―Ϋ‡. Ψ¦Ψ§Ω†Ψ―Ω‰Ω† TAB ΩŠΨ§ΩƒΩ‰ Ψ¦Ψ§Ψ³ΨͺΩ‰ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰Ωƒ ΨͺΫˆΨ±Ω‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΫ•ΩŠΨ―Ϋ‡Ψ› SHIFT+TAB ΩŠΨ§ΩƒΩ‰ ئۈسΨͺΩ‰ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰Ωƒ ΨͺΫˆΨ±Ω‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΫ•ΩŠΨ―Ϋ‡. Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ ΩŠΨ§ΩƒΩ‰ ENTER ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰Ωƒ ΨͺΫˆΨ±Ω‰Ω†Ω‰ ΨͺΨ§Ω„Ω„Ψ§ΩŠΨ―Ϋ‡. Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ΨŒ ENTER ΩŠΨ§ΩƒΩ‰ ئوڭ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΨ§Ψ±Ω…Ψ§Ω‚ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰ΩƒΩ†Ω‰ Ψ¦Ψ§Ϊ†Ω‰Ψ―Ϋ‡. Ω‚Ψ§ΩŠΨͺΩ‰Ψ΄ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰ΩƒΩ‰Ϊ―Ϋ• ESC ΩŠΨ§ΩƒΩ‰ Ψ³ΩˆΩ„ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ¦Ω‰Ψ΄Ω„Ω‰ΨͺΩ‰Ω„Ω‰Ψ―Ϋ‡. ESC ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΩ‰Ω„ Ω…Ϋ‡ΪΎΩ‰Ψͺ ΨͺΩ‰Ψ²Ω‰Ω…Ω„Ω‰ΩƒΩ‰ ΨͺΨ§Ω‚Ω‰Ω„Ω‰Ψ―Ϋ‡."},{name:"ΨͺΫ•ΪΎΨ±Ω‰Ψ±Ω„Ω‰Ϊ―ΫˆΪ† ΨͺΩ‰Ψ²Ω‰Ω…Ω‰", legend:"ΨͺΩ‰Ψ²Ω‰Ω… Ω‚Ϋ‡ΨͺΩ‰Ψ³Ω‰Ψ―Ψ§ΨŒ ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ ΨͺΩ‰Ψ²Ω‰Ω… ΨͺΫˆΨ±Ω‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΫ•Ψ΄ΨͺΫ• TAB ΩŠΨ§ΩƒΩ‰ Ψ¦Ψ§Ψ³ΨͺΩ‰ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ¦Ω‰Ψ΄Ω„Ω‰ΨͺΩ‰Ω„Ω‰Ψ―Ϋ‡. Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ ΨͺΩ‰Ψ²Ω‰Ω… ΨͺΫˆΨ±Ω‰Ϊ―Ϋ• ΩŠΫ†ΨͺΩƒΫ•Ψ΄ΨͺΫ• SHIFT + TAB ΩŠΨ§ΩƒΩ‰ ئۈسΨͺΩ‰ يا Ψ¦ΩˆΩ‚ ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰ Ψ¦Ω‰Ψ΄Ω„Ω‰ΨͺΩ‰Ω„Ω‰Ψ―Ϋ‡. Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ ΩŠΨ§ΩƒΩ‰ ENTER ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΩ‰Ψ²Ω‰Ω… ΨͺΫˆΨ±Ω‰Ω†Ω‰ ΨͺΨ§Ω„Ω„Ψ§ΩŠΨ―Ϋ‡.ESC ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΩ‰Ψ²Ω‰Ω… Ω‚Ϋ‡ΨͺΩ‰Ψ³Ω‰Ω†Ω‰ ΩŠΩ‰ΨΊΩ‰Ψ―Ϋ‡."},{name:"ΨͺΫ•ΪΎΨ±Ω‰Ψ±Ω„Ω‰Ϊ―ΫˆΪ† ئېلېمېنΨͺ ΩŠΩˆΩ„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚",legend:"${elementsPathFocus} بېسىلسا ئېلېمېنΨͺ ΩŠΩˆΩ„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚Ω‚Ψ§ يېΨͺΫ•ΩƒΩ„Ϋ•ΩŠΨ―Ϋ‡ΨŒ TAB ΩŠΨ§ΩƒΩ‰ ئوڭ يا Ψ¦ΩˆΩ‚ΨͺΨ§ ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ ئېلېمېنΨͺ ΨͺΨ§Ω„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡ΨŒ SHIFT+TAB ΩŠΨ§ΩƒΩ‰ Ψ³ΩˆΩ„ يا Ψ¦ΩˆΩ‚ΨͺΨ§ Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ ئېلېمېنΨͺ ΨͺΨ§Ω„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡ΨŒ Ψ¨ΩˆΨ΄Ω„Ϋ‡Ω‚ ΩŠΨ§ΩƒΩ‰ Enter ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΩ‰Ψ³Ω‰Ψ―Ψ§ ΨͺΫ•ΪΎΨ±Ω‰Ψ±Ω„Ω‰Ϊ―ΫˆΪ†ΨͺΩ‰ΩƒΩ‰ ئېلېمېنΨͺ ΨͺΨ§Ω„Ω„Ω‰Ω†Ω‰Ψ―Ϋ‡."}]}, {name:"Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚",items:[{name:"Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚ΨͺΩ‰Ω† ΩŠΫΩ†Ω‰Ϋ‹Ψ§Ω„",legend:"${undo} Ω†Ω‰ بېسىڭ"},{name:"Ω‚Ψ§ΩŠΨͺΩ‰Ω„Ψ§Ψ΄ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${redo} Ω†Ω‰ بېسىڭ"},{name:"ΨͺΩˆΩ…Ω„Ω‰ΨͺΩ‰Ψ΄ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${bold} Ω†Ω‰ بېسىڭ"},{name:"ΩŠΨ§Ω†ΨͺΫ‡ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${italic} Ω†Ω‰ بېسىڭ"},{name:"Ψ¦Ψ§Ψ³ΨͺΩ‰ Ψ³Ω‰Ψ²Ω‰Ω‚ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${underline} Ω†Ω‰ بېسىڭ"},{name:"Ψ¦Ϋ‡Ω„Ψ§Ω†Ω…Ψ§ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${link} Ω†Ω‰ بېسىڭ"},{name:"Ω‚ΩˆΨ±Ψ§Ω„ Ψ¨Ψ§Ω„Ψ―Ψ§Ω‚ Ω‚Ψ§ΨͺΩ„Ψ§Ψ΄ Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚Ω‰",legend:"${toolbarCollapse} Ω†Ω‰ بېسىڭ"},{name:"Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‚Ω‰ ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΩ‰Ψ³Ω‰Ω†Ω‰ Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„Ω‰Ψ―Ω‰ΨΊΨ§Ω† Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚",legend:"${accessPreviousSpace} بېسىپ ^ Ψ¨Ϋ•Ω„Ϊ―Ω‰Ψ³Ω‰Ϊ―Ϋ• Ψ¦Ϋ•Ϊ­ ΩŠΫΩ‚Ω‰Ω† Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„ΨΊΩ‰Ω„Ω‰ Ψ¨ΩˆΩ„Ω…Ψ§ΩŠΨ―Ω‰ΨΊΨ§Ω† ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΨ§ Ψ±Ψ§ΩŠΩˆΩ†Ω‰Ω†Ω‰Ϊ­ Ψ¦Ψ§Ω„Ψ―Ω‰Ω†Ω‰ Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„Ω‰Ψ―Ϋ‡ΨŒ Ω…Ϋ•Ψ³Ω‰Ω„Ϋ•Ω†: Ψ¦Ϋ†Ψ² Ψ¦Ψ§Ψ±Ψ§ Ω‚ΩˆΨ΄Ω†Ψ§ Ψ¦Ω‰ΩƒΩƒΩ‰ HR ئېلېمېنΨͺ. Ψ¨Ϋ‡ Ψ¨Ω‰Ψ±Ω‰ΩƒΩ…Ϋ• ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΨ§ ΨͺΫ•ΩƒΨ±Ψ§Ψ±Ω„Ψ§Ω†Ψ³Ψ§ ΩŠΩ‰Ψ±Ψ§Ω‚ΨͺΩ‰ΩƒΩ‰ ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΨ§ Ψ±Ψ§ΩŠΩˆΩ†Ω‰ΨΊΨ§ ΩŠΫ•ΨͺΩƒΩ‰Ω„Ω‰ Ψ¨ΩˆΩ„Ω‰Ψ―Ϋ‡."}, {name:"ΩƒΫΩŠΩ‰Ω†ΩƒΩ‰ ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΩ‰Ψ³Ω‰Ω†Ω‰ Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„Ω‰Ψ―Ω‰ΨΊΨ§Ω† Ψ¨Ϋ‡ΩŠΨ±Ϋ‡Ω‚",legend:"${accessNextSpace} بېسىپ ^ Ψ¨Ϋ•Ω„Ϊ―Ω‰Ψ³Ω‰Ϊ―Ϋ• Ψ¦Ϋ•Ϊ­ ΩŠΫΩ‚Ω‰Ω† Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„ΨΊΩ‰Ω„Ω‰ Ψ¨ΩˆΩ„Ω…Ψ§ΩŠΨ―Ω‰ΨΊΨ§Ω† ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΨ§ Ψ±Ψ§ΩŠΩˆΩ†Ω‰Ω†Ω‰Ϊ­ ΩƒΫ•ΩŠΩ†Ω‰Ω†Ω‰ Ψ²Ω‰ΩŠΨ§Ψ±Ϋ•Ψͺ Ω‚Ω‰Ω„Ω‰Ψ―Ϋ‡ΨŒ Ω…Ϋ•Ψ³Ω‰Ω„Ϋ•Ω†: Ψ¦Ϋ†Ψ² Ψ¦Ψ§Ψ±Ψ§ Ω‚ΩˆΨ΄Ω†Ψ§ Ψ¦Ω‰ΩƒΩƒΩ‰ HR ئېلېمېنΨͺ. Ψ¨Ϋ‡ Ψ¨Ω‰Ψ±Ω‰ΩƒΩ…Ϋ• ΩƒΫ‡Ω†Ϋ‡ΩΎΩƒΨ§ ΨͺΫ•ΩƒΨ±Ψ§Ψ±Ω„Ψ§Ω†Ψ³Ψ§ ΩŠΩ‰Ψ±Ψ§Ω‚ΨͺΩ‰ΩƒΩ‰ ΩΩˆΩƒΫ‡Ψ³ Ω†Ϋ‡Ω‚ΨͺΨ§ Ψ±Ψ§ΩŠΩˆΩ†Ω‰ΨΊΨ§ ΩŠΫ•ΨͺΩƒΩ‰Ω„Ω‰ Ψ¨ΩˆΩ„Ω‰Ψ―Ϋ‡."},{name:"ΨͺΩˆΨ³Ψ§Ω„ΨΊΫ‡Ψ³Ω‰Ψ² Ω„Ψ§ΩŠΩ‰ΪΎΫ• Ϊ†ΫˆΨ΄Ϋ•Ω†Ψ―ΫˆΨ±ΫˆΨ΄Ω‰",legend:"${a11yHelp} Ω†Ω‰ بېسىڭ"}]}],backspace:"Backspace",tab:"Tab",enter:"Enter",shift:"Shift",ctrl:"Ctrl",alt:"Alt",pause:"Pause",capslock:"Caps Lock",escape:"Escape", pageUp:"Page Up",pageDown:"Page Down",end:"End",home:"Home",leftArrow:"Left Arrow",upArrow:"Up Arrow",rightArrow:"Right Arrow",downArrow:"Down Arrow",insert:"Insert","delete":"Delete",leftWindowKey:"Left Windows key",rightWindowKey:"Right Windows key",selectKey:"Select key",numpad0:"Numpad 0",numpad1:"Numpad 1",numpad2:"Numpad 2",numpad3:"Numpad 3",numpad4:"Numpad 4",numpad5:"Numpad 5",numpad6:"Numpad 6",numpad7:"Numpad 7",numpad8:"Numpad 8",numpad9:"Numpad 9",multiply:"Multiply",add:"Add",subtract:"Subtract", decimalPoint:"Decimal Point",divide:"Divide",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",numLock:"Num Lock",scrollLock:"Scroll Lock",semiColon:"Semicolon",equalSign:"Equal Sign",comma:"Comma",dash:"Dash",period:"Period",forwardSlash:"Forward Slash",graveAccent:"Grave Accent",openBracket:"Open Bracket",backSlash:"Backslash",closeBracket:"Close Bracket",singleQuote:"Single Quote"});
premiumBH/bamaex
theme/assets/global/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js
JavaScript
mit
6,464
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a.m.", "p.m." ], "DAY": [ "duminic\u0103", "luni", "mar\u021bi", "miercuri", "joi", "vineri", "s\u00e2mb\u0103t\u0103" ], "MONTH": [ "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie" ], "SHORTDAY": [ "Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "S\u00e2m" ], "SHORTMONTH": [ "ian.", "feb.", "mar.", "apr.", "mai", "iun.", "iul.", "aug.", "sept.", "oct.", "nov.", "dec." ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "dd.MM.y HH:mm", "shortDate": "dd.MM.y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "RON", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "ro-ro", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } if (vf.v != 0 || n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;} }); }]);
lobbin/cdnjs
ajax/libs/angular-i18n/1.3.3/angular-locale_ro-ro.js
JavaScript
mit
2,443
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u4e0a\u5348", "\u4e0b\u5348" ], "DAY": [ "\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d" ], "MONTH": [ "\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708" ], "SHORTDAY": [ "\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d" ], "SHORTMONTH": [ "1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708" ], "fullDate": "y\u5e74M\u6708d\u65e5EEEE", "longDate": "y\u5e74M\u6708d\u65e5", "medium": "y\u5e74M\u6708d\u65e5 ah:mm:ss", "mediumDate": "y\u5e74M\u6708d\u65e5", "mediumTime": "ah:mm:ss", "short": "dd/MM/yy ahh:mm", "shortDate": "dd/MM/yy", "shortTime": "ahh:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "zh-hans-sg", "pluralCat": function(n, opt_precision) { return PLURAL_CATEGORY.OTHER;} }); }]);
Sneezry/cdnjs
ajax/libs/angular.js/1.4.0-beta.4/angular-1.4.0-beta.5/i18n/angular-locale_zh-hans-sg.js
JavaScript
mit
2,184
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u13cc\u13be\u13b4", "\u13d2\u13af\u13f1\u13a2\u13d7\u13e2" ], "DAY": [ "\u13a4\u13be\u13d9\u13d3\u13c6\u13cd\u13ac", "\u13a4\u13be\u13d9\u13d3\u13c9\u13c5\u13af", "\u13d4\u13b5\u13c1\u13a2\u13a6", "\u13e6\u13a2\u13c1\u13a2\u13a6", "\u13c5\u13a9\u13c1\u13a2\u13a6", "\u13e7\u13be\u13a9\u13b6\u13cd\u13d7", "\u13a4\u13be\u13d9\u13d3\u13c8\u13d5\u13be" ], "MONTH": [ "\u13a4\u13c3\u13b8\u13d4\u13c5", "\u13a7\u13a6\u13b5", "\u13a0\u13c5\u13f1", "\u13a7\u13ec\u13c2", "\u13a0\u13c2\u13cd\u13ac\u13d8", "\u13d5\u13ad\u13b7\u13f1", "\u13ab\u13f0\u13c9\u13c2", "\u13a6\u13b6\u13c2", "\u13da\u13b5\u13cd\u13d7", "\u13da\u13c2\u13c5\u13d7", "\u13c5\u13d3\u13d5\u13c6", "\u13a5\u13cd\u13a9\u13f1" ], "SHORTDAY": [ "\u13c6\u13cd\u13ac", "\u13c9\u13c5\u13af", "\u13d4\u13b5\u13c1", "\u13e6\u13a2\u13c1", "\u13c5\u13a9\u13c1", "\u13e7\u13be\u13a9", "\u13c8\u13d5\u13be" ], "SHORTMONTH": [ "\u13a4\u13c3", "\u13a7\u13a6", "\u13a0\u13c5", "\u13a7\u13ec", "\u13a0\u13c2", "\u13d5\u13ad", "\u13ab\u13f0", "\u13a6\u13b6", "\u13da\u13b5", "\u13da\u13c2", "\u13c5\u13d3", "\u13a5\u13cd" ], "fullDate": "EEEE, MMMM d, y", "longDate": "MMMM d, y", "medium": "MMM d, y h:mm:ss a", "mediumDate": "MMM d, y", "mediumTime": "h:mm:ss a", "short": "M/d/yy h:mm a", "shortDate": "M/d/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "chr", "pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
BitsyCode/cdnjs
ajax/libs/angular-i18n/1.3.6/angular-locale_chr.js
JavaScript
mit
2,551
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "MONTH": [ "Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba" ], "SHORTDAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "SHORTMONTH": [ "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des" ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Ksh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "sw-ke", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
codevinsky/cdnjs
ajax/libs/angular.js/1.4.0-beta.4/i18n/angular-locale_sw-ke.js
JavaScript
mit
2,314
YUI.add("scrollview-paginator",function(e,t){function w(){w.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r="scrollview",i=n(r,"hidden"),s=n(r,"paged"),o=e.ScrollView?e.ScrollView.UI_SRC:"ui",u="index",a="scrollX",f="scrollY",l="total",c="host",h="boundingBox",p="contentBox",d="selector",v="flick",m="drag",g="axis",y="x",b="y";e.extend(w,e.Plugin.Base,{initializer:function(e){var t=this,n=t.get(c);t._pageDims=[],t._pageBuffer=1,t._optimizeMemory=!1,t._host=n,t._bb=n._bb,t._cb=n._cb,t._cIndex=t.get(u),t._cAxis=t.get(g),e._optimizeMemory&&(t._optimizeMemory=e._optimizeMemory),e._pageBuffer&&(t._pageBuffer=e._pageBuffer),t._bindAttrs()},_bindAttrs:function(){var e=this;e.after({indexChange:e._afterIndexChange,axisChange:e._afterAxisChange}),e.beforeHostMethod("scrollTo",e._beforeHostScrollTo),e.beforeHostMethod("_mousewheel",e._beforeHostMousewheel),e.afterHostMethod("_onGestureMoveEnd",e._afterHostGestureMoveEnd),e.afterHostMethod("_uiDimensionsChange",e._afterHostUIDimensionsChange),e.afterHostMethod("syncUI",e._afterHostSyncUI),e.afterHostEvent("render",e._afterHostRender),e.afterHostEvent("scrollEnd",e._afterHostScrollEnded)},_afterHostRender:function(e){var t=this,n=t._bb,r=t._host,i=t._cIndex,o=t._cAxis,u=t._getPageNodes(),a=u.size(),f=t._pageDims[i].maxScrollX,c=t._pageDims[i].maxScrollY;o[b]?r._maxScrollX=f:o[y]&&(r._maxScrollY=c),t.set(l,a),i!==0&&t.scrollToIndex(i,0),n.addClass(s),t._optimize()},_afterHostSyncUI:function(e){var t=this,n=t._host,r=n.get(v),i;t._cAxis===undefined&&t._set(g,n.get(g)),i=t.get(g),i[r.axis]&&n.set(v,!1)},_afterHostUIDimensionsChange:function(e){var t=this,n=t._host,r=t._bb,i=r.get("offsetWidth"),s=r.get("offsetHeight"),o=t._getPageNodes();o.each(function(e,n){var r=e.get("scrollWidth"),o=e.get("scrollHeight"),u=Math.max(0,r-i),a=Math.max(0,o-s);t._pageDims[n]?(t._pageDims[n].maxScrollX=u,t._pageDims[n].maxScrollY=a):t._pageDims[n]={scrollX:0,scrollY:0,_minScrollX:0,_minScrollY:0,maxScrollX:u,maxScrollY:a}})},_beforeHostScrollTo:function(t,n,r,i,s){var o=this,u=o._host,a=u._gesture,f=o._cIndex,l=o._cAxis,c=this._getPageNodes(),h;return a&&(h=a.axis,h===b?t=null:n=null,l[h]===!1&&(s=c.item(f))),new e.Do.AlterArgs("new args",[t,n,r,i,s])},_afterHostGestureMoveEnd:function(e){var t=this,n=t._host,r=n._gesture,i=t._cAxis,s=r&&r.axis;i[s]&&(r[s===y?"deltaX":"deltaY"]>0?t[n.rtl?"prev":"next"]():t[n.rtl?"next":"prev"]())},_beforeHostMousewheel:function(t){var n=this,r=n._host,i=r._bb,s=t.wheelDelta<0,o=n._cAxis;r._gesture={axis:b};if(i.contains(t.target)&&o[b])return s?n.next():n.prev(),t.preventDefault(),new e.Do.Prevent},_afterHostScrollEnded:function(e){var t=this,n=t._host,r=t._cIndex,i=n.get(a),s=n.get(f),o=t._cAxis;o[b]?t._pageDims[r].scrollX=i:t._pageDims[r].scrollY=s,t._optimize()},_afterIndexChange:function(e){var t=this,n=this._host,r=e.newVal,i=t._pageDims[r].maxScrollX,s=t._pageDims[r].maxScrollY,u=n._gesture,l=u&&u.axis;t._cIndex=r,l===b?(n._maxScrollX=i,n.set(a,t._pageDims[r].scrollX,{src:o})):l===y&&(n._maxScrollY=s,n.set(f,t._pageDims[r].scrollY,{src:o})),e.src!==o&&t.scrollToIndex(r)},_optimize:function(){if(!this._optimizeMemory)return!1;var e=this,t=e._cIndex,n=e._getStage(t);e._showNodes(n.visible),e._hideNodes(n.hidden)},_getStage:function(e){var t=this._pageBuffer,n=this.get(l),r=this._getPageNodes(),i=Math.max(0,e-t),s=Math.min(n,e+1+t);return{visible:r.splice(i,s-i),hidden:r}},_showNodes:function(e){e&&e.removeClass(i).setStyle("visibility","")},_hideNodes:function(e){e&&e.addClass(i).setStyle("visibility","hidden")},_getPageNodes:function(){var e=this,t=e._host,n=t._cb,r=e.get(d),i=r?n.all(r):n.get("children");return i},next:function(){var e=this,t=e._cIndex,n=t+1,r=this.get(l);if(n>=r)return;e.set(u,n)},prev:function(){var e=this,t=e._cIndex,n=t-1;if(n<0)return;e.set(u,n)},scrollTo:function(){return this.scrollToIndex.apply(this,arguments)},scrollToIndex:function(e,t,n){var r=this,i=r._host,s=r._getPageNodes().item(e),o=r._cAxis[y]?a:f,l=s.get(o===a?"offsetLeft":"offsetTop");t=t!==undefined?t:w.TRANSITION.duration,n=n!==undefined?t:w.TRANSITION.easing,r.set(u,e),r._showNodes(s),i.set(o,l,{duration:t,easing:n})},_axisSetter:function(t,n){if(e.Lang.isString(t))return{x:t.match(/x/i)?!0:!1,y:t.match(/y/i)?!0:!1}},_afterAxisChange:function(e){this._cAxis=e.newVal}},{NAME:"pluginScrollViewPaginator",NS:"pages",ATTRS:{axis:{setter:"_axisSetter",writeOnce:"initOnly"},selector:{value:null},index:{value:0,validator:function(e){return!0}},total:{value:0}},TRANSITION:{duration:300,easing:"ease-out"}}),e.namespace("Plugin").ScrollViewPaginator=w},"@VERSION@",{requires:["plugin","classnamemanager"]})
aashish24/cdnjs
ajax/libs/yui/3.7.0pr2/scrollview-paginator/scrollview-paginator-min.js
JavaScript
mit
4,662
YUI.add("history-html5",function(a,h){var b=a.HistoryBase,e=a.Lang,f=a.config.win,i=a.config.useHistoryHTML5,c="popstate",d=b.SRC_REPLACE;function g(){g.superclass.constructor.apply(this,arguments);}a.extend(g,b,{_init:function(j){var k=f.history.state;if(a.Object.isEmpty(k)){k=null;}j||(j={});if(j.initialState&&e.type(j.initialState)==="object"&&e.type(k)==="object"){this._initialState=a.merge(j.initialState,k);}else{this._initialState=k;}a.on("popstate",this._onPopState,f,this);g.superclass._init.apply(this,arguments);},_storeState:function(l,k,j){if(l!==c){f.history[l===d?"replaceState":"pushState"](k,j.title||a.config.doc.title||"",j.url||null);}g.superclass._storeState.apply(this,arguments);},_onPopState:function(j){this._resolveChanges(c,j._event.state||null);}},{NAME:"historyhtml5",SRC_POPSTATE:c});if(!a.Node.DOM_EVENTS.popstate){a.Node.DOM_EVENTS.popstate=1;}a.HistoryHTML5=g;if(i===true||(i!==false&&b.html5)){a.History=g;}},"@VERSION@",{"optional":["json"],"requires":["event-base","history-base","node-base"]});
tonytlwu/cdnjs
ajax/libs/yui/3.7.0pr2/history-html5/history-html5-min.js
JavaScript
mit
1,034
YUI.add("get",function(e){var B=e.UA,p=e.Lang,b="text/javascript",v="text/css",I="stylesheet",s="script",q="autopurge",A="utf-8",w="link",C="async",h=true,l={script:h,css:!(B.webkit||B.gecko)},z={},r=0,g,u=function(J){var K=J.timer;if(K){clearTimeout(K);J.timer=null;}},m=function(M,J,P,N){var K=N||e.config.win,O=K.document,Q=O.createElement(M),L;if(P){e.mix(J,P);}for(L in J){if(J[L]&&J.hasOwnProperty(L)){Q.setAttribute(L,J[L]);}}return Q;},k=function(K,L,J){return m(w,{id:e.guid(),type:v,rel:I,href:K},J,L);},E=function(K,L,J){return m(s,{id:e.guid(),type:b,src:K},J,L);},a=function(K,L,J){return{tId:K.tId,win:K.win,data:K.data,nodes:K.nodes,msg:L,statusText:J,purge:function(){d(this.tId);}};},o=function(N,M,J){var L=z[N],K=L&&L.onEnd;L.finished=true;if(K){K.call(L.context,a(L,M,J));}},F=function(M,L){var K=z[M],J=K.onFailure;u(K);if(J){J.call(K.context,a(K,L));}o(M,L,"failure");},y=function(J){F(J,"transaction "+J+" was aborted");},x=function(L){var J=z[L],K=J.onSuccess;u(J);if(J.aborted){y(L);}else{if(K){K.call(J.context,a(J));}o(L,undefined,"OK");}},H=function(J,M){var K=z[M],L=(p.isString(J))?K.win.document.getElementById(J):J;if(!L){F(M,"target node not found: "+J);}return L;},d=function(O){var K,R,S,T,L,Q,P,N,M,J=z[O];if(J){K=J.nodes;M=K.length;for(N=0;N<M;N++){L=K[N];S=L.parentNode;if(L.clearAttributes){L.clearAttributes();}else{for(Q in L){if(L.hasOwnProperty(Q)){delete L[Q];}}}S.removeChild(L);}}J.nodes=[];},t=function(N,J){var K=z[N],L=K.onProgress,M;if(L){M=a(K);M.url=J;L.call(K.context,M);}},D=function(L){var J=z[L],K=J.onTimeout;if(K){K.call(J.context,a(J));}o(L,"timeout","timeout");},f=function(M,J){var L=z[M],K=!L.async;if(K){u(L);}t(M,J);if(!L.finished){if(L.aborted){y(M);}else{if((--L.remaining)===0){x(M);}else{if(K){i(M);}}}}},c=function(K,M,L,J){if(B.ie){M.onreadystatechange=function(){var N=this.readyState;if("loaded"===N||"complete"===N){M.onreadystatechange=null;f(L,J);}};}else{if(B.webkit){if(K===s){M.addEventListener("load",function(){f(L,J);},false);}}else{M.onload=function(){f(L,J);};M.onerror=function(N){F(L,N+": "+J);};}}},G=function(L,P,O){var M=z[P],N=O.document,J=M.insertBefore||N.getElementsByTagName("base")[0],K;if(J){K=H(J,P);if(K){K.parentNode.insertBefore(L,K);}}else{N.getElementsByTagName("head")[0].appendChild(L);}},i=function(Q){var O=z[Q],L=O.type,K=O.attributes,P=O.win,N=O.timeout,M,J;if(O.url.length>0){J=O.url.shift();if(N&&!O.timer){O.timer=setTimeout(function(){D(Q);},N);}if(L===s){M=E(J,P,K);}else{M=k(J,P,K);}O.nodes.push(M);c(L,M,Q,J);G(M,Q,P);if(!l[L]){f(Q,J);}if(O.async){i(Q);}}},n=function(){if(g){return;}g=true;var J,K;for(J in z){if(z.hasOwnProperty(J)){K=z[J];if(K.autopurge&&K.finished){d(K.tId);delete z[J];}}}g=false;},j=function(K,J,L){L=L||{};var O="q"+(r++),N=L.purgethreshold||e.Get.PURGE_THRESH,M;if(r%N===0){n();}M=z[O]=e.merge(L);M.tId=O;M.type=K;M.url=J;M.finished=false;M.nodes=[];M.win=M.win||e.config.win;M.context=M.context||M;M.autopurge=(q in M)?M.autopurge:(K===s)?true:false;M.attributes=M.attributes||{};M.attributes.charset=L.charset||M.attributes.charset||A;if(C in M&&K===s){M.attributes.async=M.async;}M.url=(p.isString(M.url))?[M.url]:M.url;if(!M.url[0]){M.url.shift();}M.remaining=M.url.length;i(O);return{tId:O};};e.Get={PURGE_THRESH:20,abort:function(K){var L=(p.isString(K))?K:K.tId,J=z[L];if(J){J.aborted=true;}},script:function(J,K){return j(s,J,K);},css:function(J,K){return j("css",J,K);}};},"@VERSION@",{requires:["yui-base"]});
kiwi89/cdnjs
ajax/libs/yui/3.4.0pr2/yui/get-min.js
JavaScript
mit
3,459
.yui3-resize,.yui3-resize-wrapper{z-index:0;zoom:1}.yui3-resize-handle{position:absolute;display:block;z-index:100;zoom:1}.yui3-resize-proxy{position:absolute;border:1px dashed #000;position:absolute;z-index:10000}.yui3-resize-hidden-handles .yui3-resize-handle{opacity:0;filter:alpha(opacity=0)}.yui3-resize-handle-t,.yui3-resize-handle-b{width:100%;left:0;height:6px}.yui3-resize-handle-l,.yui3-resize-handle-r{height:100%;top:0;width:6px}.yui3-resize-handle-t{cursor:n-resize;top:0}.yui3-resize-handle-b{cursor:s-resize;bottom:0}.yui3-resize-handle-l{cursor:w-resize;left:0}.yui3-resize-handle-r{cursor:e-resize;right:0}.yui3-resize-handle-inner{position:absolute;zoom:1}@media only screen and (min-device-width :320px) and (max-device-width:480px){.yui3-resize-handle-inner:after{content:"";width:40px;height:40px;position:absolute}.yui3-resize-handle-inner-r,.yui3-resize-handle-inner-l,.yui3-resize-handle-inner-t,.yui3-resize-handle-inner-b,.yui3-resize-handle-inner-tr,.yui3-resize-handle-inner-br,.yui3-resize-handle-inner-tl,.yui3-resize-handle-inner-bl{overflow:visible!important}.yui3-resize-handle-inner-r:after{top:-12px;right:0}.yui3-resize-handle-inner-l:after{top:-12px;left:0}.yui3-resize-handle-inner-t:after{top:0;left:-12px}.yui3-resize-handle-inner-b:after{bottom:0;left:-12px}.yui3-resize-handle-inner-tr:after{top:0;right:0}.yui3-resize-handle-inner-br:after{bottom:0;right:0}.yui3-resize-handle-inner-tl:after{top:0;left:0}.yui3-resize-handle-inner-bl:after{bottom:0;left:0}}@media only screen and (min-device-width :768px) and (max-device-width:1024px){.yui3-resize-handle-inner:after{content:"";width:30px;height:30px;position:absolute}.yui3-resize-handle-inner-r,.yui3-resize-handle-inner-l,.yui3-resize-handle-inner-t,.yui3-resize-handle-inner-b,.yui3-resize-handle-inner-tr,.yui3-resize-handle-inner-br,.yui3-resize-handle-inner-tl,.yui3-resize-handle-inner-bl{overflow:visible!important}.yui3-resize-handle-inner-r:after{top:-6px;right:0}.yui3-resize-handle-inner-l:after{top:-6px;left:0}.yui3-resize-handle-inner-t:after{top:0;left:-6px}.yui3-resize-handle-inner-b:after{bottom:0;left:-6px}.yui3-resize-handle-inner-tr:after{top:0;right:0}.yui3-resize-handle-inner-br:after{bottom:0;right:0}.yui3-resize-handle-inner-tl:after{top:0;left:0}.yui3-resize-handle-inner-bl:after{bottom:0;left:0}}.yui3-resize-handle-inner-t,.yui3-resize-handle-inner-b{margin-left:-8px;left:50%}.yui3-resize-handle-inner-l,.yui3-resize-handle-inner-r{margin-top:-8px;top:50%}.yui3-resize-handle-inner-t{top:-4px}.yui3-resize-handle-inner-b{bottom:-4px}.yui3-resize-handle-inner-l{left:-4px}.yui3-resize-handle-inner-r{right:-4px}.yui3-resize-handle-tr,.yui3-resize-handle-br,.yui3-resize-handle-tl,.yui3-resize-handle-bl{height:15px;width:15px;z-index:200}.yui3-resize-handle-tr{cursor:ne-resize;top:0;right:0}.yui3-resize-handle-tl{cursor:nw-resize;top:0;left:0}.yui3-resize-handle-br{cursor:se-resize;bottom:0;right:0}.yui3-resize-handle-bl{cursor:sw-resize;bottom:0;left:0}.yui3-resize-handle-inner-r,.yui3-resize-handle-inner-l,.yui3-resize-handle-inner-t,.yui3-resize-handle-inner-b,.yui3-resize-handle-inner-tr,.yui3-resize-handle-inner-br,.yui3-resize-handle-inner-tl,.yui3-resize-handle-inner-bl{background-repeat:no-repeat;background:url(arrows.png) no-repeat 0 0;display:block;height:15px;overflow:hidden;text-indent:-99999em;width:15px}.yui3-resize-handle-inner-br{background-position:-30px 0;bottom:-2px;right:-2px}.yui3-resize-handle-inner-tr{background-position:-58px 0;bottom:0;right:-2px}.yui3-resize-handle-inner-bl{background-position:-75px 0;bottom:-2px;right:-2px}.yui3-resize-handle-inner-tl{background-position:-47px 0;bottom:0;right:-2px}.yui3-resize-handle-inner-b,.yui3-resize-handle-inner-t{background-position:-15px 0}#yui3-css-stamp.skin-sam-resize-base{display:none}
Olical/cdnjs
ajax/libs/yui/3.7.0pr2/resize-base/assets/skins/sam/resize-base.css
CSS
mit
3,805
if (typeof _yuitest_coverage == "undefined"){ _yuitest_coverage = {}; _yuitest_coverline = function(src, line){ var coverage = _yuitest_coverage[src]; if (!coverage.lines[line]){ coverage.calledLines++; } coverage.lines[line]++; }; _yuitest_coverfunc = function(src, name, line){ var coverage = _yuitest_coverage[src], funcId = name + ":" + line; if (!coverage.functions[funcId]){ coverage.calledFunctions++; } coverage.functions[funcId]++; }; } _yuitest_coverage["/build/datasource-cache/datasource-cache.js"] = { lines: {}, functions: {}, coveredLines: 0, calledLines: 0, coveredFunctions: 0, calledFunctions: 0, path: "/build/datasource-cache/datasource-cache.js", code: [] }; _yuitest_coverage["/build/datasource-cache/datasource-cache.js"].code=["YUI.add('datasource-cache', function(Y) {","","/**"," * Plugs DataSource with caching functionality."," *"," * @module datasource"," * @submodule datasource-cache"," */","","/**"," * DataSourceCache extension binds Cache to DataSource."," * @class DataSourceCacheExtension"," */","var DataSourceCacheExtension = function() {","};","","Y.mix(DataSourceCacheExtension, {"," /**"," * The namespace for the plugin. This will be the property on the host which"," * references the plugin instance."," *"," * @property NS"," * @type String"," * @static"," * @final"," * @value \"cache\""," */"," NS: \"cache\",",""," /**"," * Class name."," *"," * @property NAME"," * @type String"," * @static"," * @final"," * @value \"dataSourceCacheExtension\""," */"," NAME: \"dataSourceCacheExtension\"","});","","DataSourceCacheExtension.prototype = {"," /**"," * Internal init() handler."," *"," * @method initializer"," * @param config {Object} Config object."," * @private"," */"," initializer: function(config) {"," this.doBefore(\"_defRequestFn\", this._beforeDefRequestFn);"," this.doBefore(\"_defResponseFn\", this._beforeDefResponseFn);"," },",""," /**"," * First look for cached response, then send request to live data."," *"," * @method _beforeDefRequestFn"," * @param e {Event.Facade} Event Facade with the following properties:"," * <dl>"," * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd>"," * <dt>request (Object)</dt> <dd>The request.</dd>"," * <dt>callback (Object)</dt> <dd>The callback object.</dd>"," * <dt>cfg (Object)</dt> <dd>Configuration object.</dd>"," * </dl>"," * @protected"," */"," _beforeDefRequestFn: function(e) {"," // Is response already in the Cache?"," var entry = (this.retrieve(e.request)) || null,"," payload = e.details[0];",""," if (entry && entry.response) {"," payload.cached = entry.cached;"," payload.response = entry.response;"," payload.data = entry.data;",""," this.get(\"host\").fire(\"response\", payload);",""," return new Y.Do.Halt(\"DataSourceCache extension halted _defRequestFn\");"," }"," },",""," /**"," * Adds data to cache before returning data."," *"," * @method _beforeDefResponseFn"," * @param e {Event.Facade} Event Facade with the following properties:"," * <dl>"," * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd>"," * <dt>request (Object)</dt> <dd>The request.</dd>"," * <dt>callback (Object)</dt> <dd>The callback object with the following properties:"," * <dl>"," * <dt>success (Function)</dt> <dd>Success handler.</dd>"," * <dt>failure (Function)</dt> <dd>Failure handler.</dd>"," * </dl>"," * </dd>"," * <dt>data (Object)</dt> <dd>Raw data.</dd>"," * <dt>response (Object)</dt> <dd>Normalized response object with the following properties:"," * <dl>"," * <dt>cached (Object)</dt> <dd>True when response is cached.</dd>"," * <dt>results (Object)</dt> <dd>Parsed results.</dd>"," * <dt>meta (Object)</dt> <dd>Parsed meta data.</dd>"," * <dt>error (Object)</dt> <dd>Error object.</dd>"," * </dl>"," * </dd>"," * <dt>cfg (Object)</dt> <dd>Configuration object.</dd>"," * </dl>"," * @protected"," */"," _beforeDefResponseFn: function(e) {"," // Add to Cache before returning"," if(e.response && !e.cached) {"," this.add(e.request, e.response);"," }"," }","};","","Y.namespace(\"Plugin\").DataSourceCacheExtension = DataSourceCacheExtension;","","","","/**"," * DataSource plugin adds cache functionality."," * @class DataSourceCache"," * @extends Cache"," * @uses Plugin.Base, DataSourceCachePlugin"," */","function DataSourceCache(config) {"," var cache = config && config.cache ? config.cache : Y.Cache,"," tmpclass = Y.Base.create(\"dataSourceCache\", cache, [Y.Plugin.Base, Y.Plugin.DataSourceCacheExtension]),"," tmpinstance = new tmpclass(config);"," tmpclass.NS = \"tmpClass\";"," return tmpinstance;","}","","Y.mix(DataSourceCache, {"," /**"," * The namespace for the plugin. This will be the property on the host which"," * references the plugin instance."," *"," * @property NS"," * @type String"," * @static"," * @final"," * @value \"cache\""," */"," NS: \"cache\",",""," /**"," * Class name."," *"," * @property NAME"," * @type String"," * @static"," * @final"," * @value \"dataSourceCache\""," */"," NAME: \"dataSourceCache\"","});","","","Y.namespace(\"Plugin\").DataSourceCache = DataSourceCache;","","","}, '@VERSION@' ,{requires:['datasource-local', 'cache-base', 'plugin']});"]; _yuitest_coverage["/build/datasource-cache/datasource-cache.js"].lines = {"1":0,"14":0,"17":0,"42":0,"51":0,"52":0,"70":0,"73":0,"74":0,"75":0,"76":0,"78":0,"80":0,"113":0,"114":0,"119":0,"129":0,"130":0,"133":0,"134":0,"137":0,"163":0}; _yuitest_coverage["/build/datasource-cache/datasource-cache.js"].functions = {"initializer:50":0,"_beforeDefRequestFn:68":0,"_beforeDefResponseFn:111":0,"DataSourceCache:129":0,"(anonymous 1):1":0}; _yuitest_coverage["/build/datasource-cache/datasource-cache.js"].coveredLines = 22; _yuitest_coverage["/build/datasource-cache/datasource-cache.js"].coveredFunctions = 5; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 1); YUI.add('datasource-cache', function(Y) { /** * Plugs DataSource with caching functionality. * * @module datasource * @submodule datasource-cache */ /** * DataSourceCache extension binds Cache to DataSource. * @class DataSourceCacheExtension */ _yuitest_coverfunc("/build/datasource-cache/datasource-cache.js", "(anonymous 1)", 1); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 14); var DataSourceCacheExtension = function() { }; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 17); Y.mix(DataSourceCacheExtension, { /** * The namespace for the plugin. This will be the property on the host which * references the plugin instance. * * @property NS * @type String * @static * @final * @value "cache" */ NS: "cache", /** * Class name. * * @property NAME * @type String * @static * @final * @value "dataSourceCacheExtension" */ NAME: "dataSourceCacheExtension" }); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 42); DataSourceCacheExtension.prototype = { /** * Internal init() handler. * * @method initializer * @param config {Object} Config object. * @private */ initializer: function(config) { _yuitest_coverfunc("/build/datasource-cache/datasource-cache.js", "initializer", 50); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 51); this.doBefore("_defRequestFn", this._beforeDefRequestFn); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 52); this.doBefore("_defResponseFn", this._beforeDefResponseFn); }, /** * First look for cached response, then send request to live data. * * @method _beforeDefRequestFn * @param e {Event.Facade} Event Facade with the following properties: * <dl> * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>cfg (Object)</dt> <dd>Configuration object.</dd> * </dl> * @protected */ _beforeDefRequestFn: function(e) { // Is response already in the Cache? _yuitest_coverfunc("/build/datasource-cache/datasource-cache.js", "_beforeDefRequestFn", 68); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 70); var entry = (this.retrieve(e.request)) || null, payload = e.details[0]; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 73); if (entry && entry.response) { _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 74); payload.cached = entry.cached; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 75); payload.response = entry.response; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 76); payload.data = entry.data; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 78); this.get("host").fire("response", payload); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 80); return new Y.Do.Halt("DataSourceCache extension halted _defRequestFn"); } }, /** * Adds data to cache before returning data. * * @method _beforeDefResponseFn * @param e {Event.Facade} Event Facade with the following properties: * <dl> * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object with the following properties: * <dl> * <dt>success (Function)</dt> <dd>Success handler.</dd> * <dt>failure (Function)</dt> <dd>Failure handler.</dd> * </dl> * </dd> * <dt>data (Object)</dt> <dd>Raw data.</dd> * <dt>response (Object)</dt> <dd>Normalized response object with the following properties: * <dl> * <dt>cached (Object)</dt> <dd>True when response is cached.</dd> * <dt>results (Object)</dt> <dd>Parsed results.</dd> * <dt>meta (Object)</dt> <dd>Parsed meta data.</dd> * <dt>error (Object)</dt> <dd>Error object.</dd> * </dl> * </dd> * <dt>cfg (Object)</dt> <dd>Configuration object.</dd> * </dl> * @protected */ _beforeDefResponseFn: function(e) { // Add to Cache before returning _yuitest_coverfunc("/build/datasource-cache/datasource-cache.js", "_beforeDefResponseFn", 111); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 113); if(e.response && !e.cached) { _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 114); this.add(e.request, e.response); } } }; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 119); Y.namespace("Plugin").DataSourceCacheExtension = DataSourceCacheExtension; /** * DataSource plugin adds cache functionality. * @class DataSourceCache * @extends Cache * @uses Plugin.Base, DataSourceCachePlugin */ _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 129); function DataSourceCache(config) { _yuitest_coverfunc("/build/datasource-cache/datasource-cache.js", "DataSourceCache", 129); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 130); var cache = config && config.cache ? config.cache : Y.Cache, tmpclass = Y.Base.create("dataSourceCache", cache, [Y.Plugin.Base, Y.Plugin.DataSourceCacheExtension]), tmpinstance = new tmpclass(config); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 133); tmpclass.NS = "tmpClass"; _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 134); return tmpinstance; } _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 137); Y.mix(DataSourceCache, { /** * The namespace for the plugin. This will be the property on the host which * references the plugin instance. * * @property NS * @type String * @static * @final * @value "cache" */ NS: "cache", /** * Class name. * * @property NAME * @type String * @static * @final * @value "dataSourceCache" */ NAME: "dataSourceCache" }); _yuitest_coverline("/build/datasource-cache/datasource-cache.js", 163); Y.namespace("Plugin").DataSourceCache = DataSourceCache; }, '@VERSION@' ,{requires:['datasource-local', 'cache-base', 'plugin']});
jdh8/cdnjs
ajax/libs/yui/3.7.0pr1/datasource-cache/datasource-cache-coverage.js
JavaScript
mit
13,071
YUI.add('base-base', function(Y) { /** * The base module provides the Base class, which objects requiring attribute and custom event support can extend. * The module also provides two ways to reuse code - It augments Base with the Plugin.Host interface which provides * plugin support and also provides the Base.build method which provides a way to build custom classes using extensions. * * @module base */ /** * The base-base submodule provides the Base class without the Plugin support, provided by Plugin.Host, * and without the extension support provided by Base.build. * * @module base * @submodule base-base */ var O = Y.Object, L = Y.Lang, DOT = ".", DESTROY = "destroy", INIT = "init", INITIALIZED = "initialized", DESTROYED = "destroyed", INITIALIZER = "initializer", BUBBLETARGETS = "bubbleTargets", _BUBBLETARGETS = "_bubbleTargets", OBJECT_CONSTRUCTOR = Object.prototype.constructor, DEEP = "deep", SHALLOW = "shallow", DESTRUCTOR = "destructor", Attribute = Y.Attribute, _wlmix = function(r, s, wlhash) { var p; for (p in s) { if(wlhash[p]) { r[p] = s[p]; } } return r; }; /** * <p> * A base class which objects requiring attributes and custom event support can * extend. Base also handles the chaining of initializer and destructor methods across * the hierarchy as part of object construction and destruction. Additionally, attributes configured * through the static <a href="#property_Base.ATTRS">ATTRS</a> property for each class * in the hierarchy will be initialized by Base. * </p> * * <p> * The static <a href="#property_Base.NAME">NAME</a> property of each class extending * from Base will be used as the identifier for the class, and is used by Base to prefix * all events fired by instances of that class. * </p> * * @class Base * @constructor * @uses Attribute * @uses Plugin.Host * * @param {Object} config Object with configuration property name/value pairs. The object can be * used to provide default values for the objects published attributes. * * <p> * The config object can also contain the following non-attribute properties, providing a convenient * way to configure events listeners and plugins for the instance, as part of the constructor call: * </p> * * <dl> * <dt>on</dt> * <dd>An event name to listener function map, to register event listeners for the "on" moment of the event. A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd> * <dt>after</dt> * <dd>An event name to listener function map, to register event listeners for the "after" moment of the event. A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd> * <dt>bubbleTargets</dt> * <dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd> * <dt>plugins</dt> * <dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd> * </dl> */ function Base() { if (!this._BaseInvoked) { this._BaseInvoked = true; Y.log('constructor called', 'life', 'base'); // So the object can be used as a hash key (as DD does) Y.stamp(this); Attribute.call(this); // If Plugin.Host has been augmented [ through base-pluginhost ], setup it's // initial state, but don't initialize Plugins yet. That's done after initialization. var PluginHost = Y.Plugin && Y.Plugin.Host; if (this._initPlugins && PluginHost) { PluginHost.call(this); } if (this._lazyAddAttrs !== false) { this._lazyAddAttrs = true; } /** * The string used to identify the class of this object. * * @deprecated Use this.constructor.NAME * @property name * @type String */ this.name = this.constructor.NAME; this._eventPrefix = this.constructor.EVENT_PREFIX || this.constructor.NAME; this.init.apply(this, arguments); } else { Y.log('Based constructor called more than once. Ignoring duplicate calls', 'life', 'base'); } } /** * The list of properties which can be configured for * each attribute (e.g. setter, getter, writeOnce, readOnly etc.) * * @property _ATTR_CFG * @type Array * @static * @private */ Base._ATTR_CFG = Attribute._ATTR_CFG.concat("cloneDefaultValue"); Base._ATTR_CFG_HASH = Y.Array.hash(Base._ATTR_CFG); /** * <p> * The string to be used to identify instances of * this class, for example in prefixing events. * </p> * <p> * Classes extending Base, should define their own * static NAME property, which should be camelCase by * convention (e.g. MyClass.NAME = "myClass";). * </p> * @property NAME * @type String * @static */ Base.NAME = "base"; /** * The default set of attributes which will be available for instances of this class, and * their configuration. In addition to the configuration properties listed by * Attribute's <a href="Attribute.html#method_addAttr">addAttr</a> method, the attribute * can also be configured with a "cloneDefaultValue" property, which defines how the statically * defined value field should be protected ("shallow", "deep" and false are supported values). * * By default if the value is an object literal or an array it will be "shallow" cloned, to * protect the default value. * * @property ATTRS * @type Object * @static */ Base.ATTRS = { /** * Flag indicating whether or not this object * has been through the init lifecycle phase. * * @attribute initialized * @readonly * @default false * @type boolean */ initialized: { readOnly:true, value:false }, /** * Flag indicating whether or not this object * has been through the destroy lifecycle phase. * * @attribute destroyed * @readonly * @default false * @type boolean */ destroyed: { readOnly:true, value:false } }; Base.prototype = { /** * Init lifecycle method, invoked during construction. * Fires the init event prior to setting up attributes and * invoking initializers for the class hierarchy. * * @method init * @chainable * @param {Object} config Object with configuration property name/value pairs * @return {Base} A reference to this object */ init: function(config) { Y.log('init called', 'life', 'base'); this._yuievt.config.prefix = this._eventPrefix; /** * <p> * Lifecycle event for the init phase, fired prior to initialization. * Invoking the preventDefault() method on the event object provided * to subscribers will prevent initialization from occuring. * </p> * <p> * Subscribers to the "after" momemt of this event, will be notified * after initialization of the object is complete (and therefore * cannot prevent initialization). * </p> * * @event init * @preventable _defInitFn * @param {EventFacade} e Event object, with a cfg property which * refers to the configuration object passed to the constructor. */ this.publish(INIT, { queuable:false, fireOnce:true, defaultTargetOnly:true, defaultFn:this._defInitFn }); this._preInitEventCfg(config); this.fire(INIT, {cfg: config}); return this; }, /** * Handles the special on, after and target properties which allow the user to * easily configure on and after listeners as well as bubble targets during * construction, prior to init. * * @private * @method _preInitEventCfg * @param {Object} config The user configuration object */ _preInitEventCfg : function(config) { if (config) { if (config.on) { this.on(config.on); } if (config.after) { this.after(config.after); } } var i, l, target, userTargets = (config && BUBBLETARGETS in config); if (userTargets || _BUBBLETARGETS in this) { target = userTargets ? (config && config.bubbleTargets) : this._bubbleTargets; if (L.isArray(target)) { for (i = 0, l = target.length; i < l; i++) { this.addTarget(target[i]); } } else if (target) { this.addTarget(target); } } }, /** * <p> * Destroy lifecycle method. Fires the destroy * event, prior to invoking destructors for the * class hierarchy. * </p> * <p> * Subscribers to the destroy * event can invoke preventDefault on the event object, to prevent destruction * from proceeding. * </p> * @method destroy * @return {Base} A reference to this object * @chainable */ destroy: function() { Y.log('destroy called', 'life', 'base'); /** * <p> * Lifecycle event for the destroy phase, * fired prior to destruction. Invoking the preventDefault * method on the event object provided to subscribers will * prevent destruction from proceeding. * </p> * <p> * Subscribers to the "after" moment of this event, will be notified * after destruction is complete (and as a result cannot prevent * destruction). * </p> * @event destroy * @preventable _defDestroyFn * @param {EventFacade} e Event object */ this.publish(DESTROY, { queuable:false, fireOnce:true, defaultTargetOnly:true, defaultFn: this._defDestroyFn }); this.fire(DESTROY); this.detachAll(); return this; }, /** * Default init event handler * * @method _defInitFn * @param {EventFacade} e Event object, with a cfg property which * refers to the configuration object passed to the constructor. * @protected */ _defInitFn : function(e) { this._initHierarchy(e.cfg); if (this._initPlugins) { // Need to initPlugins manually, to handle constructor parsing, static Plug parsing this._initPlugins(e.cfg); } this._set(INITIALIZED, true); }, /** * Default destroy event handler * * @method _defDestroyFn * @param {EventFacade} e Event object * @protected */ _defDestroyFn : function(e) { if (this._destroyPlugins) { this._destroyPlugins(); } this._destroyHierarchy(); this._set(DESTROYED, true); }, /** * Returns the class hierarchy for this object, with Base being the last class in the array. * * @method _getClasses * @protected * @return {Function[]} An array of classes (constructor functions), making up the class hierarchy for this object. * This value is cached the first time the method, or _getAttrCfgs, is invoked. Subsequent invocations return the * cached value. */ _getClasses : function() { if (!this._classes) { this._initHierarchyData(); } return this._classes; }, /** * Returns an aggregated set of attribute configurations, by traversing the class hierarchy. * * @method _getAttrCfgs * @protected * @return {Object} The hash of attribute configurations, aggregated across classes in the hierarchy * This value is cached the first time the method, or _getClasses, is invoked. Subsequent invocations return * the cached value. */ _getAttrCfgs : function() { if (!this._attrs) { this._initHierarchyData(); } return this._attrs; }, /** * A helper method used when processing ATTRS across the class hierarchy during * initialization. Returns a disposable object with the attributes defined for * the provided class, extracted from the set of all attributes passed in . * * @method _filterAttrCfs * @private * * @param {Function} clazz The class for which the desired attributes are required. * @param {Object} allCfgs The set of all attribute configurations for this instance. * Attributes will be removed from this set, if they belong to the filtered class, so * that by the time all classes are processed, allCfgs will be empty. * * @return {Object} The set of attributes belonging to the class passed in, in the form * of an object with attribute name/configuration pairs. */ _filterAttrCfgs : function(clazz, allCfgs) { var cfgs = null, attr, attrs = clazz.ATTRS; if (attrs) { for (attr in attrs) { if (allCfgs[attr]) { cfgs = cfgs || {}; cfgs[attr] = allCfgs[attr]; allCfgs[attr] = null; } } } return cfgs; }, /** * A helper method used by _getClasses and _getAttrCfgs, which determines both * the array of classes and aggregate set of attribute configurations * across the class hierarchy for the instance. * * @method _initHierarchyData * @private */ _initHierarchyData : function() { var c = this.constructor, classes = [], attrs = []; while (c) { // Add to classes classes[classes.length] = c; // Add to attributes if (c.ATTRS) { attrs[attrs.length] = c.ATTRS; } c = c.superclass ? c.superclass.constructor : null; } this._classes = classes; this._attrs = this._aggregateAttrs(attrs); }, /** * A helper method, used by _initHierarchyData to aggregate * attribute configuration across the instances class hierarchy. * * The method will protect the attribute configuration value to protect the statically defined * default value in ATTRS if required (if the value is an object literal, array or the * attribute configuration has cloneDefaultValue set to shallow or deep). * * @method _aggregateAttrs * @private * @param {Array} allAttrs An array of ATTRS definitions across classes in the hierarchy * (subclass first, Base last) * @return {Object} The aggregate set of ATTRS definitions for the instance */ _aggregateAttrs : function(allAttrs) { var attr, attrs, cfg, val, path, i, clone, cfgPropsHash = Base._ATTR_CFG_HASH, aggAttrs = {}; if (allAttrs) { for (i = allAttrs.length-1; i >= 0; --i) { attrs = allAttrs[i]; for (attr in attrs) { if (attrs.hasOwnProperty(attr)) { // Protect config passed in //cfg = Y.mix({}, attrs[attr], true, cfgProps); //cfg = Y.Object(attrs[attr]); cfg = _wlmix({}, attrs[attr], cfgPropsHash); val = cfg.value; clone = cfg.cloneDefaultValue; if (val) { if ( (clone === undefined && (OBJECT_CONSTRUCTOR === val.constructor || L.isArray(val))) || clone === DEEP || clone === true) { Y.log('Cloning default value for attribute:' + attr, 'info', 'base'); cfg.value = Y.clone(val); } else if (clone === SHALLOW) { Y.log('Merging default value for attribute:' + attr, 'info', 'base'); cfg.value = Y.merge(val); } // else if (clone === false), don't clone the static default value. // It's intended to be used by reference. } path = null; if (attr.indexOf(DOT) !== -1) { path = attr.split(DOT); attr = path.shift(); } if (path && aggAttrs[attr] && aggAttrs[attr].value) { O.setValue(aggAttrs[attr].value, path, val); } else if (!path) { if (!aggAttrs[attr]) { aggAttrs[attr] = cfg; } else { _wlmix(aggAttrs[attr], cfg, cfgPropsHash); } } } } } } return aggAttrs; }, /** * Initializes the class hierarchy for the instance, which includes * initializing attributes for each class defined in the class's * static <a href="#property_Base.ATTRS">ATTRS</a> property and * invoking the initializer method on the prototype of each class in the hierarchy. * * @method _initHierarchy * @param {Object} userVals Object with configuration property name/value pairs * @private */ _initHierarchy : function(userVals) { var lazy = this._lazyAddAttrs, constr, constrProto, ci, ei, el, extProto, exts, classes = this._getClasses(), attrCfgs = this._getAttrCfgs(); for (ci = classes.length-1; ci >= 0; ci--) { constr = classes[ci]; constrProto = constr.prototype; exts = constr._yuibuild && constr._yuibuild.exts; if (exts) { for (ei = 0, el = exts.length; ei < el; ei++) { exts[ei].apply(this, arguments); } } this.addAttrs(this._filterAttrCfgs(constr, attrCfgs), userVals, lazy); // Using INITIALIZER in hasOwnProperty check, for performance reasons (helps IE6 avoid GC thresholds when // referencing string literals). Not using it in apply, again, for performance "." is faster. if (constrProto.hasOwnProperty(INITIALIZER)) { constrProto.initializer.apply(this, arguments); } if (exts) { for (ei = 0; ei < el; ei++) { extProto = exts[ei].prototype; if (extProto.hasOwnProperty(INITIALIZER)) { extProto.initializer.apply(this, arguments); } } } } }, /** * Destroys the class hierarchy for this instance by invoking * the destructor method on the prototype of each class in the hierarchy. * * @method _destroyHierarchy * @private */ _destroyHierarchy : function() { var constr, constrProto, ci, cl, ei, el, exts, extProto, classes = this._getClasses(); for (ci = 0, cl = classes.length; ci < cl; ci++) { constr = classes[ci]; constrProto = constr.prototype; exts = constr._yuibuild && constr._yuibuild.exts; if (exts) { for (ei = 0, el = exts.length; ei < el; ei++) { extProto = exts[ei].prototype; if (extProto.hasOwnProperty(DESTRUCTOR)) { extProto.destructor.apply(this, arguments); } } } if (constrProto.hasOwnProperty(DESTRUCTOR)) { constrProto.destructor.apply(this, arguments); } } }, /** * Default toString implementation. Provides the constructor NAME * and the instance guid, if set. * * @method toString * @return {String} String representation for this object */ toString: function() { return this.name + "[" + Y.stamp(this, true) + "]"; } }; // Straightup augment, no wrapper functions Y.mix(Base, Attribute, false, null, 1); // Fix constructor Base.prototype.constructor = Base; Y.Base = Base; }, '@VERSION@' ,{requires:['attribute-base']});
AMoo-Miki/cdnjs
ajax/libs/yui/3.5.0pr1/base-base/base-base-debug.js
JavaScript
mit
23,186
YUI.add("dd-ddm",function(A){A.mix(A.DD.DDM,{_pg:null,_debugShim:false,_activateTargets:function(){},_deactivateTargets:function(){},_startDrag:function(){if(this.activeDrag.get("useShim")){this._pg_activate();this._activateTargets();}},_endDrag:function(){this._pg_deactivate();this._deactivateTargets();},_pg_deactivate:function(){this._pg.setStyle("display","none");},_pg_activate:function(){var B=this.activeDrag.get("activeHandle"),C="auto";if(B){C=B.getStyle("cursor");}if(C=="auto"){C=this.get("dragCursor");}this._pg_size();this._pg.setStyles({top:0,left:0,display:"block",opacity:((this._debugShim)?".5":"0"),cursor:C});},_pg_size:function(){if(this.activeDrag){var B=A.Node.get("body"),D=B.get("docHeight"),C=B.get("docWidth");this._pg.setStyles({height:D+"px",width:C+"px"});}},_createPG:function(){var C=A.Node.create("<div></div>"),B=A.Node.get("body");C.setStyles({top:"0",left:"0",position:"absolute",zIndex:"9999",overflow:"hidden",backgroundColor:"red",display:"none",height:"5px",width:"5px"});if(B.get("firstChild")){B.insertBefore(C,B.get("firstChild"));}else{B.appendChild(C);}this._pg=C;this._pg.on("mouseup",this._end,this,true);this._pg.on("mousemove",this._move,this,true);A.on("resize",this._pg_size,window,this,true);A.on("scroll",this._pg_size,window,this,true);}},true);A.DD.DDM._createPG();},"@VERSION@",{skinnable:false,requires:["dd-ddm-base"]});
nareshs435/cdnjs
ajax/libs/yui/3.0.0beta1m1/dd/dd-ddm-min.js
JavaScript
mit
1,378
YUI.add('dom-base', function(Y) { (function(Y) { /** * The DOM utility provides a cross-browser abtraction layer * normalizing DOM tasks, and adds extra helper functionality * for other common tasks. * @module dom * @submodule dom-base * @for DOM * */ /** * Provides DOM helper methods. * @class DOM * */ var NODE_TYPE = 'nodeType', OWNER_DOCUMENT = 'ownerDocument', DOCUMENT_ELEMENT = 'documentElement', DEFAULT_VIEW = 'defaultView', PARENT_WINDOW = 'parentWindow', TAG_NAME = 'tagName', PARENT_NODE = 'parentNode', FIRST_CHILD = 'firstChild', PREVIOUS_SIBLING = 'previousSibling', NEXT_SIBLING = 'nextSibling', CONTAINS = 'contains', COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition', EMPTY_STRING = '', documentElement = Y.config.doc.documentElement, re_tag = /<([a-z]+)/i, createFromDIV = function(html, tag) { var div = Y.config.doc.createElement('div'), ret = true; div.innerHTML = html; if (!div.firstChild || div.firstChild.tagName !== tag) { ret = false; } return ret; }, Y_DOM = { /** * Returns the HTMLElement with the given ID (Wrapper for document.getElementById). * @method byId * @param {String} id the id attribute * @param {Object} doc optional The document to search. Defaults to current document * @return {HTMLElement | null} The HTMLElement with the id, or null if none found. */ byId: function(id, doc) { // handle dupe IDs and IE name collision return Y_DOM.allById(id, doc)[0] || null; }, /** * Returns the text content of the HTMLElement. * @method getText * @param {HTMLElement} element The html element. * @return {String} The text content of the element (includes text of any descending elements). */ getText: (documentElement.textContent !== undefined) ? function(element) { var ret = ''; if (element) { ret = element.textContent; } return ret || ''; } : function(element) { var ret = ''; if (element) { ret = element.innerText || element.nodeValue; // might be a textNode } return ret || ''; }, /** * Sets the text content of the HTMLElement. * @method setText * @param {HTMLElement} element The html element. * @param {String} content The content to add. */ setText: (documentElement.textContent !== undefined) ? function(element, content) { if (element) { element.textContent = content; } } : function(element, content) { if ('innerText' in element) { element.innerText = content; } else if ('nodeValue' in element) { element.nodeValue = content; } }, /* * Finds the ancestor of the element. * @method ancestor * @param {HTMLElement} element The html element. * @param {Function} fn optional An optional boolean test to apply. * The optional function is passed the current DOM node being tested as its only argument. * If no function is given, the parentNode is returned. * @param {Boolean} testSelf optional Whether or not to include the element in the scan * @return {HTMLElement | null} The matching DOM node or null if none found. */ ancestor: function(element, fn, testSelf) { var ret = null; if (testSelf) { ret = (!fn || fn(element)) ? element : null; } return ret || Y_DOM.elementByAxis(element, PARENT_NODE, fn, null); }, /* * Finds the ancestors of the element. * @method ancestors * @param {HTMLElement} element The html element. * @param {Function} fn optional An optional boolean test to apply. * The optional function is passed the current DOM node being tested as its only argument. * If no function is given, all ancestors are returned. * @param {Boolean} testSelf optional Whether or not to include the element in the scan * @return {Array} An array containing all matching DOM nodes. */ ancestors: function(element, fn, testSelf) { var ancestor = Y_DOM.ancestor.apply(Y_DOM, arguments), ret = (ancestor) ? [ancestor] : []; while ((ancestor = Y_DOM.ancestor(ancestor, fn))) { if (ancestor) { ret.unshift(ancestor); } } return ret; }, /** * Searches the element by the given axis for the first matching element. * @method elementByAxis * @param {HTMLElement} element The html element. * @param {String} axis The axis to search (parentNode, nextSibling, previousSibling). * @param {Function} fn optional An optional boolean test to apply. * @param {Boolean} all optional Whether all node types should be returned, or just element nodes. * The optional function is passed the current HTMLElement being tested as its only argument. * If no function is given, the first element is returned. * @return {HTMLElement | null} The matching element or null if none found. */ elementByAxis: function(element, axis, fn, all) { while (element && (element = element[axis])) { // NOTE: assignment if ( (all || element[TAG_NAME]) && (!fn || fn(element)) ) { return element; } } return null; }, /** * Determines whether or not one HTMLElement is or contains another HTMLElement. * @method contains * @param {HTMLElement} element The containing html element. * @param {HTMLElement} needle The html element that may be contained. * @return {Boolean} Whether or not the element is or contains the needle. */ contains: function(element, needle) { var ret = false; if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) { ret = false; } else if (element[CONTAINS]) { if (Y.UA.opera || needle[NODE_TYPE] === 1) { // IE & SAF contains fail if needle not an ELEMENT_NODE ret = element[CONTAINS](needle); } else { ret = Y_DOM._bruteContains(element, needle); } } else if (element[COMPARE_DOCUMENT_POSITION]) { // gecko if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) { ret = true; } } return ret; }, /** * Determines whether or not the HTMLElement is part of the document. * @method inDoc * @param {HTMLElement} element The containing html element. * @param {HTMLElement} doc optional The document to check. * @return {Boolean} Whether or not the element is attached to the document. */ inDoc: function(element, doc) { var ret = false, rootNode; if (element && element.nodeType) { (doc) || (doc = element[OWNER_DOCUMENT]); rootNode = doc[DOCUMENT_ELEMENT]; // contains only works with HTML_ELEMENT if (rootNode && rootNode.contains && element.tagName) { ret = rootNode.contains(element); } else { ret = Y_DOM.contains(rootNode, element); } } return ret; }, allById: function(id, root) { root = root || Y.config.doc; var nodes = [], ret = [], i, node; if (root.querySelectorAll) { ret = root.querySelectorAll('[id="' + id + '"]'); } else if (root.all) { nodes = root.all(id); if (nodes && nodes.nodeType) { // root.all may return one or many nodes = [nodes]; } if (nodes && nodes.length) { for (i = 0; node = nodes[i++];) { // check for a match if (node.attributes && node.attributes.id && node.attributes.id.value === id) { // avoid false positive for node.name & form.id ret.push(node); } } } } else { ret = [Y_DOM._getDoc(root).getElementById(id)]; } return ret; }, /** * Creates a new dom node using the provided markup string. * @method create * @param {String} html The markup used to create the element * @param {HTMLDocument} doc An optional document context * @return {HTMLElement|DocumentFragment} returns a single HTMLElement * when creating one node, and a documentFragment when creating * multiple nodes. */ create: function(html, doc) { if (typeof html === 'string') { html = Y.Lang.trim(html); // match IE which trims whitespace from innerHTML } doc = doc || Y.config.doc; var m = re_tag.exec(html), create = Y_DOM._create, custom = Y_DOM.creators, ret = null, tag, nodes; if (html != undefined) { // not undefined or null if (m && custom[m[1]]) { if (typeof custom[m[1]] === 'function') { create = custom[m[1]]; } else { tag = custom[m[1]]; } } nodes = create(html, doc, tag).childNodes; if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment" ret = nodes[0].parentNode.removeChild(nodes[0]); } else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected) if (nodes.length === 2) { ret = nodes[0].nextSibling; } else { nodes[0].parentNode.removeChild(nodes[0]); ret = Y_DOM._nl2frag(nodes, doc); } } else { // return multiple nodes as a fragment ret = Y_DOM._nl2frag(nodes, doc); } } return ret; }, _nl2frag: function(nodes, doc) { var ret = null, i, len; if (nodes && (nodes.push || nodes.item) && nodes[0]) { doc = doc || nodes[0].ownerDocument; ret = doc.createDocumentFragment(); if (nodes.item) { // convert live list to static array nodes = Y.Array(nodes, 0, true); } for (i = 0, len = nodes.length; i < len; i++) { ret.appendChild(nodes[i]); } } // else inline with log for minification return ret; }, CUSTOM_ATTRIBUTES: (!documentElement.hasAttribute) ? { // IE < 8 'for': 'htmlFor', 'class': 'className' } : { // w3c 'htmlFor': 'for', 'className': 'class' }, /** * Provides a normalized attribute interface. * @method setAttibute * @param {String | HTMLElement} el The target element for the attribute. * @param {String} attr The attribute to set. * @param {String} val The value of the attribute. */ setAttribute: function(el, attr, val, ieAttr) { if (el && attr && el.setAttribute) { attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; el.setAttribute(attr, val, ieAttr); } }, /** * Provides a normalized attribute interface. * @method getAttibute * @param {String | HTMLElement} el The target element for the attribute. * @param {String} attr The attribute to get. * @return {String} The current value of the attribute. */ getAttribute: function(el, attr, ieAttr) { ieAttr = (ieAttr !== undefined) ? ieAttr : 2; var ret = ''; if (el && attr && el.getAttribute) { attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; ret = el.getAttribute(attr, ieAttr); if (ret === null) { ret = ''; // per DOM spec } } return ret; }, isWindow: function(obj) { return !!(obj && obj.alert && obj.document); }, _fragClones: {}, _create: function(html, doc, tag) { tag = tag || 'div'; var frag = Y_DOM._fragClones[tag]; if (frag) { frag = frag.cloneNode(false); } else { frag = Y_DOM._fragClones[tag] = doc.createElement(tag); } frag.innerHTML = html; return frag; }, _removeChildNodes: function(node) { while (node.firstChild) { node.removeChild(node.firstChild); } }, /** * Inserts content in a node at the given location * @method addHTML * @param {HTMLElement} node The node to insert into * @param {String | HTMLElement | Array | HTMLCollection} content The content to be inserted * @param {String | HTMLElement} where Where to insert the content * If no "where" is given, content is appended to the node * Possible values for "where" * <dl> * <dt>HTMLElement</dt> * <dd>The element to insert before</dd> * <dt>"replace"</dt> * <dd>Replaces the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts before the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts content before the node</dd> * <dt>"after"</dt> * <dd>Inserts content after the node</dd> * </dl> */ addHTML: function(node, content, where) { var nodeParent = node.parentNode, i = 0, item, ret = content, newNode; if (content != undefined) { // not null or undefined (maybe 0) if (content.nodeType) { // DOM node, just add it newNode = content; } else if (typeof content == 'string' || typeof content == 'number') { ret = newNode = Y_DOM.create(content); } else if (content[0] && content[0].nodeType) { // array or collection newNode = Y.config.doc.createDocumentFragment(); while ((item = content[i++])) { newNode.appendChild(item); // append to fragment for insertion } } } if (where) { if (where.nodeType) { // insert regardless of relationship to node where.parentNode.insertBefore(newNode, where); } else { switch (where) { case 'replace': while (node.firstChild) { node.removeChild(node.firstChild); } if (newNode) { // allow empty content to clear node node.appendChild(newNode); } break; case 'before': nodeParent.insertBefore(newNode, node); break; case 'after': if (node.nextSibling) { // IE errors if refNode is null nodeParent.insertBefore(newNode, node.nextSibling); } else { nodeParent.appendChild(newNode); } break; default: node.appendChild(newNode); } } } else if (newNode) { node.appendChild(newNode); } return ret; }, VALUE_SETTERS: {}, VALUE_GETTERS: {}, getValue: function(node) { var ret = '', // TODO: return null? getter; if (node && node[TAG_NAME]) { getter = Y_DOM.VALUE_GETTERS[node[TAG_NAME].toLowerCase()]; if (getter) { ret = getter(node); } else { ret = node.value; } } // workaround for IE8 JSON stringify bug // which converts empty string values to null if (ret === EMPTY_STRING) { ret = EMPTY_STRING; // for real } return (typeof ret === 'string') ? ret : ''; }, setValue: function(node, val) { var setter; if (node && node[TAG_NAME]) { setter = Y_DOM.VALUE_SETTERS[node[TAG_NAME].toLowerCase()]; if (setter) { setter(node, val); } else { node.value = val; } } }, siblings: function(node, fn) { var nodes = [], sibling = node; while ((sibling = sibling[PREVIOUS_SIBLING])) { if (sibling[TAG_NAME] && (!fn || fn(sibling))) { nodes.unshift(sibling); } } sibling = node; while ((sibling = sibling[NEXT_SIBLING])) { if (sibling[TAG_NAME] && (!fn || fn(sibling))) { nodes.push(sibling); } } return nodes; }, /** * Brute force version of contains. * Used for browsers without contains support for non-HTMLElement Nodes (textNodes, etc). * @method _bruteContains * @private * @param {HTMLElement} element The containing html element. * @param {HTMLElement} needle The html element that may be contained. * @return {Boolean} Whether or not the element is or contains the needle. */ _bruteContains: function(element, needle) { while (needle) { if (element === needle) { return true; } needle = needle.parentNode; } return false; }, // TODO: move to Lang? /** * Memoizes dynamic regular expressions to boost runtime performance. * @method _getRegExp * @private * @param {String} str The string to convert to a regular expression. * @param {String} flags optional An optinal string of flags. * @return {RegExp} An instance of RegExp */ _getRegExp: function(str, flags) { flags = flags || ''; Y_DOM._regexCache = Y_DOM._regexCache || {}; if (!Y_DOM._regexCache[str + flags]) { Y_DOM._regexCache[str + flags] = new RegExp(str, flags); } return Y_DOM._regexCache[str + flags]; }, // TODO: make getDoc/Win true privates? /** * returns the appropriate document. * @method _getDoc * @private * @param {HTMLElement} element optional Target element. * @return {Object} The document for the given element or the default document. */ _getDoc: function(element) { var doc = Y.config.doc; if (element) { doc = (element[NODE_TYPE] === 9) ? element : // element === document element[OWNER_DOCUMENT] || // element === DOM node element.document || // element === window Y.config.doc; // default } return doc; }, /** * returns the appropriate window. * @method _getWin * @private * @param {HTMLElement} element optional Target element. * @return {Object} The window for the given element or the default window. */ _getWin: function(element) { var doc = Y_DOM._getDoc(element); return doc[DEFAULT_VIEW] || doc[PARENT_WINDOW] || Y.config.win; }, _batch: function(nodes, fn, arg1, arg2, arg3, etc) { fn = (typeof fn === 'string') ? Y_DOM[fn] : fn; var result, args = Array.prototype.slice.call(arguments, 2), i = 0, node, ret; if (fn && nodes) { while ((node = nodes[i++])) { result = result = fn.call(Y_DOM, node, arg1, arg2, arg3, etc); if (typeof result !== 'undefined') { (ret) || (ret = []); ret.push(result); } } } return (typeof ret !== 'undefined') ? ret : nodes; }, wrap: function(node, html) { var parent = Y.DOM.create(html), nodes = parent.getElementsByTagName('*'); if (nodes.length) { parent = nodes[nodes.length - 1]; } if (node.parentNode) { node.parentNode.replaceChild(parent, node); } parent.appendChild(node); }, unwrap: function(node) { var parent = node.parentNode, lastChild = parent.lastChild, node = parent.firstChild, next = node, grandparent; if (parent) { grandparent = parent.parentNode; if (grandparent) { while (node !== lastChild) { next = node.nextSibling; grandparent.insertBefore(node, parent); node = next; } grandparent.replaceChild(lastChild, parent); } else { parent.removeChild(node); } } }, creators: {} }; (function(Y) { var creators = Y_DOM.creators, create = Y_DOM.create, re_tbody = /(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/, TABLE_OPEN = '<table>', TABLE_CLOSE = '</table>'; if (Y.UA.ie) { Y.mix(creators, { // TODO: thead/tfoot with nested tbody // IE adds TBODY when creating TABLE elements (which may share this impl) tbody: function(html, doc) { var frag = create(TABLE_OPEN + html + TABLE_CLOSE, doc), tb = frag.children.tags('tbody')[0]; if (frag.children.length > 1 && tb && !re_tbody.test(html)) { tb[PARENT_NODE].removeChild(tb); // strip extraneous tbody } return frag; }, script: function(html, doc) { var frag = doc.createElement('div'); frag.innerHTML = '-' + html; frag.removeChild(frag[FIRST_CHILD]); return frag; } }, true); Y.mix(Y_DOM.VALUE_GETTERS, { button: function(node) { return (node.attributes && node.attributes.value) ? node.attributes.value.value : ''; } }); Y.mix(Y_DOM.VALUE_SETTERS, { // IE: node.value changes the button text, which should be handled via innerHTML button: function(node, val) { var attr = node.attributes.value; if (!attr) { attr = node[OWNER_DOCUMENT].createAttribute('value'); node.setAttributeNode(attr); } attr.value = val; }, select: function(node, val) { for (var i = 0, options = node.getElementsByTagName('option'), option; option = options[i++];) { if (Y_DOM.getValue(option) === val) { Y_DOM.setAttribute(option, 'selected', true); break; } } } }); Y_DOM.creators.col = Y_DOM.creators.link = Y_DOM.creators.style = Y_DOM.creators.script; } if (!createFromDIV('<tr/>', 'TR')) { Y.mix(creators, { option: function(html, doc) { return create('<select><option class="yui3-big-dummy" selected></option>' + html + '</select>', doc); }, tr: function(html, doc) { return create('<tbody>' + html + '</tbody>', doc); }, td: function(html, doc) { return create('<tr>' + html + '</tr>', doc); }, col: function(html, doc) { return create('<colgroup>' + html + '</colgroup>', doc); }, tbody: 'table' }); Y.mix(creators, { legend: 'fieldset', th: creators.td, thead: creators.tbody, tfoot: creators.tbody, caption: creators.tbody, colgroup: creators.tbody, optgroup: creators.option }); } Y.mix(Y_DOM.VALUE_GETTERS, { option: function(node) { var attrs = node.attributes; return (attrs.value && attrs.value.specified) ? node.value : node.text; }, select: function(node) { var val = node.value, options = node.options; if (options && options.length && val === '') { // TODO: implement multipe select if (node.multiple) { } else { val = Y_DOM.getValue(options[node.selectedIndex]); } } return val; } }); })(Y); Y.DOM = Y_DOM; })(Y); var addClass, hasClass, removeClass; Y.mix(Y.DOM, { /** * Determines whether a DOM element has the given className. * @method hasClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to search for * @return {Boolean} Whether or not the element has the given class. */ hasClass: function(node, className) { var re = Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); return re.test(node.className); }, /** * Adds a class name to a given DOM element. * @method addClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to add to the class attribute */ addClass: function(node, className) { if (!Y.DOM.hasClass(node, className)) { // skip if already present node.className = Y.Lang.trim([node.className, className].join(' ')); } }, /** * Removes a class name from a given element. * @method removeClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to remove from the class attribute */ removeClass: function(node, className) { if (className && hasClass(node, className)) { node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'), ' ')); if ( hasClass(node, className) ) { // in case of multiple adjacent removeClass(node, className); } } }, /** * Replace a class with another class for a given element. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @for DOM * @param {HTMLElement} element The DOM element * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name */ replaceClass: function(node, oldC, newC) { removeClass(node, oldC); // remove first in case oldC === newC addClass(node, newC); }, /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @for DOM * @param {HTMLElement} element The DOM element * @param {String} className the class name to be toggled * @param {Boolean} addClass optional boolean to indicate whether class * should be added or removed regardless of current state */ toggleClass: function(node, className, force) { var add = (force !== undefined) ? force : !(hasClass(node, className)); if (add) { addClass(node, className); } else { removeClass(node, className); } } }); hasClass = Y.DOM.hasClass; removeClass = Y.DOM.removeClass; addClass = Y.DOM.addClass; Y.mix(Y.DOM, { /** * Sets the width of the element to the given size, regardless * of box model, border, padding, etc. * @method setWidth * @param {HTMLElement} element The DOM element. * @param {String|Int} size The pixel height to size to */ setWidth: function(node, size) { Y.DOM._setSize(node, 'width', size); }, /** * Sets the height of the element to the given size, regardless * of box model, border, padding, etc. * @method setHeight * @param {HTMLElement} element The DOM element. * @param {String|Int} size The pixel height to size to */ setHeight: function(node, size) { Y.DOM._setSize(node, 'height', size); }, _setSize: function(node, prop, val) { val = (val > 0) ? val : 0; var size = 0; node.style[prop] = val + 'px'; size = (prop === 'height') ? node.offsetHeight : node.offsetWidth; if (size > val) { val = val - (size - val); if (val < 0) { val = 0; } node.style[prop] = val + 'px'; } } }); }, '@VERSION@' ,{requires:['oop']}); YUI.add('dom-style', function(Y) { (function(Y) { /** * Add style management functionality to DOM. * @module dom * @submodule dom-style * @for DOM */ var DOCUMENT_ELEMENT = 'documentElement', DEFAULT_VIEW = 'defaultView', OWNER_DOCUMENT = 'ownerDocument', STYLE = 'style', FLOAT = 'float', CSS_FLOAT = 'cssFloat', STYLE_FLOAT = 'styleFloat', TRANSPARENT = 'transparent', GET_COMPUTED_STYLE = 'getComputedStyle', GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', DOCUMENT = Y.config.doc, UNDEFINED = undefined, Y_DOM = Y.DOM, TRANSFORM = 'transform', VENDOR_TRANSFORM = [ 'WebkitTransform', 'MozTransform', 'OTransform' ], re_color = /color$/i, re_unit = /width|height|top|left|right|bottom|margin|padding/i; Y.Array.each(VENDOR_TRANSFORM, function(val) { if (val in DOCUMENT[DOCUMENT_ELEMENT].style) { TRANSFORM = val; } }); Y.mix(Y_DOM, { DEFAULT_UNIT: 'px', CUSTOM_STYLES: { }, /** * Sets a style property for a given element. * @method setStyle * @param {HTMLElement} An HTMLElement to apply the style to. * @param {String} att The style property to set. * @param {String|Number} val The value. */ setStyle: function(node, att, val, style) { style = style || node.style; var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES, current; if (style) { if (val === null || val === '') { // normalize unsetting val = ''; } else if (!isNaN(new Number(val)) && re_unit.test(att)) { // number values may need a unit val += Y_DOM.DEFAULT_UNIT; } if (att in CUSTOM_STYLES) { if (CUSTOM_STYLES[att].set) { CUSTOM_STYLES[att].set(node, val, style); return; // NOTE: return } else if (typeof CUSTOM_STYLES[att] === 'string') { att = CUSTOM_STYLES[att]; } } style[att] = val; } }, /** * Returns the current style value for the given property. * @method getStyle * @param {HTMLElement} An HTMLElement to get the style from. * @param {String} att The style property to get. */ getStyle: function(node, att, style) { style = style || node.style; var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES, val = ''; if (style) { if (att in CUSTOM_STYLES) { if (CUSTOM_STYLES[att].get) { return CUSTOM_STYLES[att].get(node, att, style); // NOTE: return } else if (typeof CUSTOM_STYLES[att] === 'string') { att = CUSTOM_STYLES[att]; } } val = style[att]; if (val === '') { // TODO: is empty string sufficient? val = Y_DOM[GET_COMPUTED_STYLE](node, att); } } return val; }, /** * Sets multiple style properties. * @method setStyles * @param {HTMLElement} node An HTMLElement to apply the styles to. * @param {Object} hash An object literal of property:value pairs. */ setStyles: function(node, hash) { var style = node.style; Y.each(hash, function(v, n) { Y_DOM.setStyle(node, n, v, style); }, Y_DOM); }, /** * Returns the computed style for the given node. * @method getComputedStyle * @param {HTMLElement} An HTMLElement to get the style from. * @param {String} att The style property to get. * @return {String} The computed value of the style property. */ getComputedStyle: function(node, att) { var val = '', doc = node[OWNER_DOCUMENT]; if (node[STYLE] && doc[DEFAULT_VIEW] && doc[DEFAULT_VIEW][GET_COMPUTED_STYLE]) { val = doc[DEFAULT_VIEW][GET_COMPUTED_STYLE](node, null)[att]; } return val; } }); // normalize reserved word float alternatives ("cssFloat" or "styleFloat") if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][CSS_FLOAT] !== UNDEFINED) { Y_DOM.CUSTOM_STYLES[FLOAT] = CSS_FLOAT; } else if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][STYLE_FLOAT] !== UNDEFINED) { Y_DOM.CUSTOM_STYLES[FLOAT] = STYLE_FLOAT; } // fix opera computedStyle default color unit (convert to rgb) if (Y.UA.opera) { Y_DOM[GET_COMPUTED_STYLE] = function(node, att) { var view = node[OWNER_DOCUMENT][DEFAULT_VIEW], val = view[GET_COMPUTED_STYLE](node, '')[att]; if (re_color.test(att)) { val = Y.Color.toRGB(val); } return val; }; } // safari converts transparent to rgba(), others use "transparent" if (Y.UA.webkit) { Y_DOM[GET_COMPUTED_STYLE] = function(node, att) { var view = node[OWNER_DOCUMENT][DEFAULT_VIEW], val = view[GET_COMPUTED_STYLE](node, '')[att]; if (val === 'rgba(0, 0, 0, 0)') { val = TRANSPARENT; } return val; }; } Y.DOM._getAttrOffset = function(node, attr) { var val = Y.DOM[GET_COMPUTED_STYLE](node, attr), offsetParent = node.offsetParent, position, parentOffset, offset; if (val === 'auto') { position = Y.DOM.getStyle(node, 'position'); if (position === 'static' || position === 'relative') { val = 0; } else if (offsetParent && offsetParent[GET_BOUNDING_CLIENT_RECT]) { parentOffset = offsetParent[GET_BOUNDING_CLIENT_RECT]()[attr]; offset = node[GET_BOUNDING_CLIENT_RECT]()[attr]; if (attr === 'left' || attr === 'top') { val = offset - parentOffset; } else { val = parentOffset - node[GET_BOUNDING_CLIENT_RECT]()[attr]; } } } return val; }; Y.DOM._getOffset = function(node) { var pos, xy = null; if (node) { pos = Y_DOM.getStyle(node, 'position'); xy = [ parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'left'), 10), parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'top'), 10) ]; if ( isNaN(xy[0]) ) { // in case of 'auto' xy[0] = parseInt(Y_DOM.getStyle(node, 'left'), 10); // try inline if ( isNaN(xy[0]) ) { // default to offset value xy[0] = (pos === 'relative') ? 0 : node.offsetLeft || 0; } } if ( isNaN(xy[1]) ) { // in case of 'auto' xy[1] = parseInt(Y_DOM.getStyle(node, 'top'), 10); // try inline if ( isNaN(xy[1]) ) { // default to offset value xy[1] = (pos === 'relative') ? 0 : node.offsetTop || 0; } } } return xy; }; Y_DOM.CUSTOM_STYLES.transform = { set: function(node, val, style) { style[TRANSFORM] = val; }, get: function(node, style) { return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORM); } }; })(Y); (function(Y) { var PARSE_INT = parseInt, RE = RegExp; Y.Color = { KEYWORDS: { black: '000', silver: 'c0c0c0', gray: '808080', white: 'fff', maroon: '800000', red: 'f00', purple: '800080', fuchsia: 'f0f', green: '008000', lime: '0f0', olive: '808000', yellow: 'ff0', navy: '000080', blue: '00f', teal: '008080', aqua: '0ff' }, re_RGB: /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i, re_hex: /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i, re_hex3: /([0-9A-F])/gi, toRGB: function(val) { if (!Y.Color.re_RGB.test(val)) { val = Y.Color.toHex(val); } if(Y.Color.re_hex.exec(val)) { val = 'rgb(' + [ PARSE_INT(RE.$1, 16), PARSE_INT(RE.$2, 16), PARSE_INT(RE.$3, 16) ].join(', ') + ')'; } return val; }, toHex: function(val) { val = Y.Color.KEYWORDS[val] || val; if (Y.Color.re_RGB.exec(val)) { val = [ Number(RE.$1).toString(16), Number(RE.$2).toString(16), Number(RE.$3).toString(16) ]; for (var i = 0; i < val.length; i++) { if (val[i].length < 2) { val[i] = '0' + val[i]; } } val = val.join(''); } if (val.length < 6) { val = val.replace(Y.Color.re_hex3, '$1$1'); } if (val !== 'transparent' && val.indexOf('#') < 0) { val = '#' + val; } return val.toUpperCase(); } }; })(Y); }, '@VERSION@' ,{requires:['dom-base']}); YUI.add('dom-screen', function(Y) { (function(Y) { /** * Adds position and region management functionality to DOM. * @module dom * @submodule dom-screen * @for DOM */ var DOCUMENT_ELEMENT = 'documentElement', COMPAT_MODE = 'compatMode', POSITION = 'position', FIXED = 'fixed', RELATIVE = 'relative', LEFT = 'left', TOP = 'top', _BACK_COMPAT = 'BackCompat', MEDIUM = 'medium', BORDER_LEFT_WIDTH = 'borderLeftWidth', BORDER_TOP_WIDTH = 'borderTopWidth', GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', GET_COMPUTED_STYLE = 'getComputedStyle', Y_DOM = Y.DOM, // TODO: how about thead/tbody/tfoot/tr? // TODO: does caption matter? RE_TABLE = /^t(?:able|d|h)$/i, SCROLL_NODE; if (Y.UA.ie) { if (Y.config.doc[COMPAT_MODE] !== 'quirks') { SCROLL_NODE = DOCUMENT_ELEMENT; } else { SCROLL_NODE = 'body'; } } Y.mix(Y_DOM, { /** * Returns the inner height of the viewport (exludes scrollbar). * @method winHeight * @return {Number} The current height of the viewport. */ winHeight: function(node) { var h = Y_DOM._getWinSize(node).height; return h; }, /** * Returns the inner width of the viewport (exludes scrollbar). * @method winWidth * @return {Number} The current width of the viewport. */ winWidth: function(node) { var w = Y_DOM._getWinSize(node).width; return w; }, /** * Document height * @method docHeight * @return {Number} The current height of the document. */ docHeight: function(node) { var h = Y_DOM._getDocSize(node).height; return Math.max(h, Y_DOM._getWinSize(node).height); }, /** * Document width * @method docWidth * @return {Number} The current width of the document. */ docWidth: function(node) { var w = Y_DOM._getDocSize(node).width; return Math.max(w, Y_DOM._getWinSize(node).width); }, /** * Amount page has been scroll horizontally * @method docScrollX * @return {Number} The current amount the screen is scrolled horizontally. */ docScrollX: function(node, doc) { doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization var dv = doc.defaultView, pageOffset = (dv) ? dv.pageXOffset : 0; return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft, pageOffset); }, /** * Amount page has been scroll vertically * @method docScrollY * @return {Number} The current amount the screen is scrolled vertically. */ docScrollY: function(node, doc) { doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization var dv = doc.defaultView, pageOffset = (dv) ? dv.pageYOffset : 0; return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop, pageOffset); }, /** * Gets the current position of an element based on page coordinates. * Element must be part of the DOM tree to have page coordinates * (display:none or elements not appended return false). * @method getXY * @param element The target element * @return {Array} The XY position of the element TODO: test inDocument/display? */ getXY: function() { if (Y.config.doc[DOCUMENT_ELEMENT][GET_BOUNDING_CLIENT_RECT]) { return function(node) { var xy = null, scrollLeft, scrollTop, box, off1, off2, bLeft, bTop, mode, doc, inDoc, rootNode; if (node && node.tagName) { doc = node.ownerDocument; rootNode = doc[DOCUMENT_ELEMENT]; // inline inDoc check for perf if (rootNode.contains) { inDoc = rootNode.contains(node); } else { inDoc = Y.DOM.contains(rootNode, node); } if (inDoc) { scrollLeft = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollLeft : Y_DOM.docScrollX(node, doc); scrollTop = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollTop : Y_DOM.docScrollY(node, doc); box = node[GET_BOUNDING_CLIENT_RECT](); xy = [box.left, box.top]; if (Y.UA.ie) { off1 = 2; off2 = 2; mode = doc[COMPAT_MODE]; bLeft = Y_DOM[GET_COMPUTED_STYLE](doc[DOCUMENT_ELEMENT], BORDER_LEFT_WIDTH); bTop = Y_DOM[GET_COMPUTED_STYLE](doc[DOCUMENT_ELEMENT], BORDER_TOP_WIDTH); if (Y.UA.ie === 6) { if (mode !== _BACK_COMPAT) { off1 = 0; off2 = 0; } } if ((mode == _BACK_COMPAT)) { if (bLeft !== MEDIUM) { off1 = parseInt(bLeft, 10); } if (bTop !== MEDIUM) { off2 = parseInt(bTop, 10); } } xy[0] -= off1; xy[1] -= off2; } if ((scrollTop || scrollLeft)) { if (!Y.UA.ios) { xy[0] += scrollLeft; xy[1] += scrollTop; } } } else { xy = Y_DOM._getOffset(node); } } return xy; } } else { return function(node) { // manually calculate by crawling up offsetParents //Calculate the Top and Left border sizes (assumes pixels) var xy = null, doc, parentNode, bCheck, scrollTop, scrollLeft; if (node) { if (Y_DOM.inDoc(node)) { xy = [node.offsetLeft, node.offsetTop]; doc = node.ownerDocument; parentNode = node; // TODO: refactor with !! or just falsey bCheck = ((Y.UA.gecko || Y.UA.webkit > 519) ? true : false); // TODO: worth refactoring for TOP/LEFT only? while ((parentNode = parentNode.offsetParent)) { xy[0] += parentNode.offsetLeft; xy[1] += parentNode.offsetTop; if (bCheck) { xy = Y_DOM._calcBorders(parentNode, xy); } } // account for any scrolled ancestors if (Y_DOM.getStyle(node, POSITION) != FIXED) { parentNode = node; while ((parentNode = parentNode.parentNode)) { scrollTop = parentNode.scrollTop; scrollLeft = parentNode.scrollLeft; //Firefox does something funky with borders when overflow is not visible. if (Y.UA.gecko && (Y_DOM.getStyle(parentNode, 'overflow') !== 'visible')) { xy = Y_DOM._calcBorders(parentNode, xy); } if (scrollTop || scrollLeft) { xy[0] -= scrollLeft; xy[1] -= scrollTop; } } xy[0] += Y_DOM.docScrollX(node, doc); xy[1] += Y_DOM.docScrollY(node, doc); } else { //Fix FIXED position -- add scrollbars xy[0] += Y_DOM.docScrollX(node, doc); xy[1] += Y_DOM.docScrollY(node, doc); } } else { xy = Y_DOM._getOffset(node); } } return xy; }; } }(),// NOTE: Executing for loadtime branching /** * Gets the current X position of an element based on page coordinates. * Element must be part of the DOM tree to have page coordinates * (display:none or elements not appended return false). * @method getX * @param element The target element * @return {Int} The X position of the element */ getX: function(node) { return Y_DOM.getXY(node)[0]; }, /** * Gets the current Y position of an element based on page coordinates. * Element must be part of the DOM tree to have page coordinates * (display:none or elements not appended return false). * @method getY * @param element The target element * @return {Int} The Y position of the element */ getY: function(node) { return Y_DOM.getXY(node)[1]; }, /** * Set the position of an html element in page coordinates. * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). * @method setXY * @param element The target element * @param {Array} xy Contains X & Y values for new position (coordinates are page-based) * @param {Boolean} noRetry By default we try and set the position a second time if the first fails */ setXY: function(node, xy, noRetry) { var setStyle = Y_DOM.setStyle, pos, delta, newXY, currentXY; if (node && xy) { pos = Y_DOM.getStyle(node, POSITION); delta = Y_DOM._getOffset(node); if (pos == 'static') { // default to relative pos = RELATIVE; setStyle(node, POSITION, pos); } currentXY = Y_DOM.getXY(node); if (xy[0] !== null) { setStyle(node, LEFT, xy[0] - currentXY[0] + delta[0] + 'px'); } if (xy[1] !== null) { setStyle(node, TOP, xy[1] - currentXY[1] + delta[1] + 'px'); } if (!noRetry) { newXY = Y_DOM.getXY(node); if (newXY[0] !== xy[0] || newXY[1] !== xy[1]) { Y_DOM.setXY(node, xy, true); } } } else { } }, /** * Set the X position of an html element in page coordinates, regardless of how the element is positioned. * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). * @method setX * @param element The target element * @param {Int} x The X values for new position (coordinates are page-based) */ setX: function(node, x) { return Y_DOM.setXY(node, [x, null]); }, /** * Set the Y position of an html element in page coordinates, regardless of how the element is positioned. * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). * @method setY * @param element The target element * @param {Int} y The Y values for new position (coordinates are page-based) */ setY: function(node, y) { return Y_DOM.setXY(node, [null, y]); }, /** * @method swapXY * @description Swap the xy position with another node * @param {Node} node The node to swap with * @param {Node} otherNode The other node to swap with * @return {Node} */ swapXY: function(node, otherNode) { var xy = Y_DOM.getXY(node); Y_DOM.setXY(node, Y_DOM.getXY(otherNode)); Y_DOM.setXY(otherNode, xy); }, _calcBorders: function(node, xy2) { var t = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_TOP_WIDTH), 10) || 0, l = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_LEFT_WIDTH), 10) || 0; if (Y.UA.gecko) { if (RE_TABLE.test(node.tagName)) { t = 0; l = 0; } } xy2[0] += l; xy2[1] += t; return xy2; }, _getWinSize: function(node, doc) { doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; var win = doc.defaultView || doc.parentWindow, mode = doc[COMPAT_MODE], h = win.innerHeight, w = win.innerWidth, root = doc[DOCUMENT_ELEMENT]; if ( mode && !Y.UA.opera ) { // IE, Gecko if (mode != 'CSS1Compat') { // Quirks root = doc.body; } h = root.clientHeight; w = root.clientWidth; } return { height: h, width: w }; }, _getDocSize: function(node) { var doc = (node) ? Y_DOM._getDoc(node) : Y.config.doc, root = doc[DOCUMENT_ELEMENT]; if (doc[COMPAT_MODE] != 'CSS1Compat') { root = doc.body; } return { height: root.scrollHeight, width: root.scrollWidth }; } }); })(Y); (function(Y) { var TOP = 'top', RIGHT = 'right', BOTTOM = 'bottom', LEFT = 'left', getOffsets = function(r1, r2) { var t = Math.max(r1[TOP], r2[TOP]), r = Math.min(r1[RIGHT], r2[RIGHT]), b = Math.min(r1[BOTTOM], r2[BOTTOM]), l = Math.max(r1[LEFT], r2[LEFT]), ret = {}; ret[TOP] = t; ret[RIGHT] = r; ret[BOTTOM] = b; ret[LEFT] = l; return ret; }, DOM = Y.DOM; Y.mix(DOM, { /** * Returns an Object literal containing the following about this element: (top, right, bottom, left) * @for DOM * @method region * @param {HTMLElement} element The DOM element. @return {Object} Object literal containing the following about this element: (top, right, bottom, left) */ region: function(node) { var xy = DOM.getXY(node), ret = false; if (node && xy) { ret = DOM._getRegion( xy[1], // top xy[0] + node.offsetWidth, // right xy[1] + node.offsetHeight, // bottom xy[0] // left ); } return ret; }, /** * Find the intersect information for the passes nodes. * @method intersect * @for DOM * @param {HTMLElement} element The first element * @param {HTMLElement | Object} element2 The element or region to check the interect with * @param {Object} altRegion An object literal containing the region for the first element if we already have the data (for performance i.e. DragDrop) @return {Object} Object literal containing the following intersection data: (top, right, bottom, left, area, yoff, xoff, inRegion) */ intersect: function(node, node2, altRegion) { var r = altRegion || DOM.region(node), region = {}, n = node2, off; if (n.tagName) { region = DOM.region(n); } else if (Y.Lang.isObject(node2)) { region = node2; } else { return false; } off = getOffsets(region, r); return { top: off[TOP], right: off[RIGHT], bottom: off[BOTTOM], left: off[LEFT], area: ((off[BOTTOM] - off[TOP]) * (off[RIGHT] - off[LEFT])), yoff: ((off[BOTTOM] - off[TOP])), xoff: (off[RIGHT] - off[LEFT]), inRegion: DOM.inRegion(node, node2, false, altRegion) }; }, /** * Check if any part of this node is in the passed region * @method inRegion * @for DOM * @param {Object} node2 The node to get the region from or an Object literal of the region * $param {Boolean} all Should all of the node be inside the region * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop) * @return {Boolean} True if in region, false if not. */ inRegion: function(node, node2, all, altRegion) { var region = {}, r = altRegion || DOM.region(node), n = node2, off; if (n.tagName) { region = DOM.region(n); } else if (Y.Lang.isObject(node2)) { region = node2; } else { return false; } if (all) { return ( r[LEFT] >= region[LEFT] && r[RIGHT] <= region[RIGHT] && r[TOP] >= region[TOP] && r[BOTTOM] <= region[BOTTOM] ); } else { off = getOffsets(region, r); if (off[BOTTOM] >= off[TOP] && off[RIGHT] >= off[LEFT]) { return true; } else { return false; } } }, /** * Check if any part of this element is in the viewport * @method inViewportRegion * @for DOM * @param {HTMLElement} element The DOM element. * @param {Boolean} all Should all of the node be inside the region * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop) * @return {Boolean} True if in region, false if not. */ inViewportRegion: function(node, all, altRegion) { return DOM.inRegion(node, DOM.viewportRegion(node), all, altRegion); }, _getRegion: function(t, r, b, l) { var region = {}; region[TOP] = region[1] = t; region[LEFT] = region[0] = l; region[BOTTOM] = b; region[RIGHT] = r; region.width = region[RIGHT] - region[LEFT]; region.height = region[BOTTOM] - region[TOP]; return region; }, /** * Returns an Object literal containing the following about the visible region of viewport: (top, right, bottom, left) * @method viewportRegion * @for DOM * @return {Object} Object literal containing the following about the visible region of the viewport: (top, right, bottom, left) */ viewportRegion: function(node) { node = node || Y.config.doc.documentElement; var ret = false, scrollX, scrollY; if (node) { scrollX = DOM.docScrollX(node); scrollY = DOM.docScrollY(node); ret = DOM._getRegion(scrollY, // top DOM.winWidth(node) + scrollX, // right scrollY + DOM.winHeight(node), // bottom scrollX); // left } return ret; } }); })(Y); }, '@VERSION@' ,{requires:['dom-base', 'dom-style', 'event-base']}); YUI.add('selector-native', function(Y) { (function(Y) { /** * The selector-native module provides support for native querySelector * @module dom * @submodule selector-native * @for Selector */ /** * Provides support for using CSS selectors to query the DOM * @class Selector * @static * @for Selector */ Y.namespace('Selector'); // allow native module to standalone var COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition', OWNER_DOCUMENT = 'ownerDocument'; var Selector = { _foundCache: [], useNative: true, _compare: ('sourceIndex' in Y.config.doc.documentElement) ? function(nodeA, nodeB) { var a = nodeA.sourceIndex, b = nodeB.sourceIndex; if (a === b) { return 0; } else if (a > b) { return 1; } return -1; } : (Y.config.doc.documentElement[COMPARE_DOCUMENT_POSITION] ? function(nodeA, nodeB) { if (nodeA[COMPARE_DOCUMENT_POSITION](nodeB) & 4) { return -1; } else { return 1; } } : function(nodeA, nodeB) { var rangeA, rangeB, compare; if (nodeA && nodeB) { rangeA = nodeA[OWNER_DOCUMENT].createRange(); rangeA.setStart(nodeA, 0); rangeB = nodeB[OWNER_DOCUMENT].createRange(); rangeB.setStart(nodeB, 0); compare = rangeA.compareBoundaryPoints(1, rangeB); // 1 === Range.START_TO_END } return compare; }), _sort: function(nodes) { if (nodes) { nodes = Y.Array(nodes, 0, true); if (nodes.sort) { nodes.sort(Selector._compare); } } return nodes; }, _deDupe: function(nodes) { var ret = [], i, node; for (i = 0; (node = nodes[i++]);) { if (!node._found) { ret[ret.length] = node; node._found = true; } } for (i = 0; (node = ret[i++]);) { node._found = null; node.removeAttribute('_found'); } return ret; }, /** * Retrieves a set of nodes based on a given CSS selector. * @method query * * @param {string} selector The CSS Selector to test the node against. * @param {HTMLElement} root optional An HTMLElement to start the query from. Defaults to Y.config.doc * @param {Boolean} firstOnly optional Whether or not to return only the first match. * @return {Array} An array of nodes that match the given selector. * @static */ query: function(selector, root, firstOnly, skipNative) { root = root || Y.config.doc; var ret = [], useNative = (Y.Selector.useNative && Y.config.doc.querySelector && !skipNative), queries = [[selector, root]], query, result, i, fn = (useNative) ? Y.Selector._nativeQuery : Y.Selector._bruteQuery; if (selector && fn) { // split group into seperate queries if (!skipNative && // already done if skipping (!useNative || root.tagName)) { // split native when element scoping is needed queries = Selector._splitQueries(selector, root); } for (i = 0; (query = queries[i++]);) { result = fn(query[0], query[1], firstOnly); if (!firstOnly) { // coerce DOM Collection to Array result = Y.Array(result, 0, true); } if (result) { ret = ret.concat(result); } } if (queries.length > 1) { // remove dupes and sort by doc order ret = Selector._sort(Selector._deDupe(ret)); } } return (firstOnly) ? (ret[0] || null) : ret; }, // allows element scoped queries to begin with combinator // e.g. query('> p', document.body) === query('body > p') _splitQueries: function(selector, node) { var groups = selector.split(','), queries = [], prefix = '', i, len; if (node) { // enforce for element scoping if (node.tagName) { node.id = node.id || Y.guid(); prefix = '[id="' + node.id + '"] '; } for (i = 0, len = groups.length; i < len; ++i) { selector = prefix + groups[i]; queries.push([selector, node]); } } return queries; }, _nativeQuery: function(selector, root, one) { if (Y.UA.webkit && selector.indexOf(':checked') > -1 && (Y.Selector.pseudos && Y.Selector.pseudos.checked)) { // webkit (chrome, safari) fails to find "selected" return Y.Selector.query(selector, root, one, true); // redo with skipNative true to try brute query } try { return root['querySelector' + (one ? '' : 'All')](selector); } catch(e) { // fallback to brute if available return Y.Selector.query(selector, root, one, true); // redo with skipNative true } }, filter: function(nodes, selector) { var ret = [], i, node; if (nodes && selector) { for (i = 0; (node = nodes[i++]);) { if (Y.Selector.test(node, selector)) { ret[ret.length] = node; } } } else { } return ret; }, test: function(node, selector, root) { var ret = false, groups = selector.split(','), useFrag = false, parent, item, items, frag, i, j, group; if (node && node.tagName) { // only test HTMLElements // we need a root if off-doc if (!root && !Y.DOM.inDoc(node)) { parent = node.parentNode; if (parent) { root = parent; } else { // only use frag when no parent to query frag = node[OWNER_DOCUMENT].createDocumentFragment(); frag.appendChild(node); root = frag; useFrag = true; } } root = root || node[OWNER_DOCUMENT]; if (!node.id) { node.id = Y.guid(); } for (i = 0; (group = groups[i++]);) { // TODO: off-dom test group += '[id="' + node.id + '"]'; items = Y.Selector.query(group, root); for (j = 0; item = items[j++];) { if (item === node) { ret = true; break; } } if (ret) { break; } } if (useFrag) { // cleanup frag.removeChild(node); } } return ret; }, /** * A convenience function to emulate Y.Node's aNode.ancestor(selector). * @param {HTMLElement} element An HTMLElement to start the query from. * @param {String} selector The CSS selector to test the node against. * @return {HTMLElement} The ancestor node matching the selector, or null. * @param {Boolean} testSelf optional Whether or not to include the element in the scan * @static * @method ancestor */ ancestor: function (element, selector, testSelf) { return Y.DOM.ancestor(element, function(n) { return Y.Selector.test(n, selector); }, testSelf); } }; Y.mix(Y.Selector, Selector, true); })(Y); }, '@VERSION@' ,{requires:['dom-base']}); YUI.add('selector-css2', function(Y) { /** * The selector module provides helper methods allowing CSS2 Selectors to be used with DOM elements. * @module dom * @submodule selector-css2 * @for Selector */ /** * Provides helper methods for collecting and filtering DOM elements. */ var PARENT_NODE = 'parentNode', TAG_NAME = 'tagName', ATTRIBUTES = 'attributes', COMBINATOR = 'combinator', PSEUDOS = 'pseudos', Selector = Y.Selector, SelectorCSS2 = { _reRegExpTokens: /([\^\$\?\[\]\*\+\-\.\(\)\|\\])/, // TODO: move? SORT_RESULTS: true, _children: function(node, tag) { var ret = node.children, i, children = [], childNodes, child; if (node.children && tag && node.children.tags) { children = node.children.tags(tag); } else if ((!ret && node[TAG_NAME]) || (ret && tag)) { // only HTMLElements have children childNodes = ret || node.childNodes; ret = []; for (i = 0; (child = childNodes[i++]);) { if (child.tagName) { if (!tag || tag === child.tagName) { ret.push(child); } } } } return ret || []; }, _re: { //attr: /(\[.*\])/g, attr: /(\[[^\]]*\])/g, pseudos: /:([\-\w]+(?:\(?:['"]?(.+)['"]?\)))*/i }, /** * Mapping of shorthand tokens to corresponding attribute selector * @property shorthand * @type object */ shorthand: { '\\#(-?[_a-z]+[-\\w]*)': '[id=$1]', '\\.(-?[_a-z]+[-\\w]*)': '[className~=$1]' }, /** * List of operators and corresponding boolean functions. * These functions are passed the attribute and the current node's value of the attribute. * @property operators * @type object */ operators: { '': function(node, attr) { return Y.DOM.getAttribute(node, attr) !== ''; }, // Just test for existence of attribute //'': '.+', //'=': '^{val}$', // equality '~=': '(?:^|\\s+){val}(?:\\s+|$)', // space-delimited '|=': '^{val}-?' // optional hyphen-delimited }, pseudos: { 'first-child': function(node) { return Y.Selector._children(node[PARENT_NODE])[0] === node; } }, _bruteQuery: function(selector, root, firstOnly) { var ret = [], nodes = [], tokens = Selector._tokenize(selector), token = tokens[tokens.length - 1], rootDoc = Y.DOM._getDoc(root), child, id, className, tagName; // if we have an initial ID, set to root when in document /* if (tokens[0] && rootDoc === root && (id = tokens[0].id) && rootDoc.getElementById(id)) { root = rootDoc.getElementById(id); } */ if (token) { // prefilter nodes id = token.id; className = token.className; tagName = token.tagName || '*'; if (root.getElementsByTagName) { // non-IE lacks DOM api on doc frags // try ID first, unless no root.all && root not in document // (root.all works off document, but not getElementById) // TODO: move to allById? if (id && (root.all || (root.nodeType === 9 || Y.DOM.inDoc(root)))) { nodes = Y.DOM.allById(id, root); // try className } else if (className) { nodes = root.getElementsByClassName(className); } else { // default to tagName nodes = root.getElementsByTagName(tagName); } } else { // brute getElementsByTagName('*') child = root.firstChild; while (child) { if (child.tagName) { // only collect HTMLElements nodes.push(child); } child = child.nextSilbing || child.firstChild; } } if (nodes.length) { ret = Selector._filterNodes(nodes, tokens, firstOnly); } } return ret; }, _filterNodes: function(nodes, tokens, firstOnly) { var i = 0, j, len = tokens.length, n = len - 1, result = [], node = nodes[0], tmpNode = node, getters = Y.Selector.getters, operator, combinator, token, path, pass, //FUNCTION = 'function', value, tests, test; //do { for (i = 0; (tmpNode = node = nodes[i++]);) { n = len - 1; path = null; testLoop: while (tmpNode && tmpNode.tagName) { token = tokens[n]; tests = token.tests; j = tests.length; if (j && !pass) { while ((test = tests[--j])) { operator = test[1]; if (getters[test[0]]) { value = getters[test[0]](tmpNode, test[0]); } else { value = tmpNode[test[0]]; // use getAttribute for non-standard attributes if (value === undefined && tmpNode.getAttribute) { value = tmpNode.getAttribute(test[0]); } } if ((operator === '=' && value !== test[2]) || // fast path for equality (typeof operator !== 'string' && // protect against String.test monkey-patch (Moo) operator.test && !operator.test(value)) || // regex test (!operator.test && // protect against RegExp as function (webkit) typeof operator === 'function' && !operator(tmpNode, test[0]))) { // function test // skip non element nodes or non-matching tags if ((tmpNode = tmpNode[path])) { while (tmpNode && (!tmpNode.tagName || (token.tagName && token.tagName !== tmpNode.tagName)) ) { tmpNode = tmpNode[path]; } } continue testLoop; } } } n--; // move to next token // now that we've passed the test, move up the tree by combinator if (!pass && (combinator = token.combinator)) { path = combinator.axis; tmpNode = tmpNode[path]; // skip non element nodes while (tmpNode && !tmpNode.tagName) { tmpNode = tmpNode[path]; } if (combinator.direct) { // one pass only path = null; } } else { // success if we made it this far result.push(node); if (firstOnly) { return result; } break; } } }// while (tmpNode = node = nodes[++i]); node = tmpNode = null; return result; }, combinators: { ' ': { axis: 'parentNode' }, '>': { axis: 'parentNode', direct: true }, '+': { axis: 'previousSibling', direct: true } }, _parsers: [ { name: ATTRIBUTES, re: /^\[(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i, fn: function(match, token) { var operator = match[2] || '', operators = Y.Selector.operators, test; // add prefiltering for ID and CLASS if ((match[1] === 'id' && operator === '=') || (match[1] === 'className' && Y.config.doc.documentElement.getElementsByClassName && (operator === '~=' || operator === '='))) { token.prefilter = match[1]; token[match[1]] = match[3]; } // add tests if (operator in operators) { test = operators[operator]; if (typeof test === 'string') { match[3] = match[3].replace(Y.Selector._reRegExpTokens, '\\$1'); test = Y.DOM._getRegExp(test.replace('{val}', match[3])); } match[2] = test; } if (!token.last || token.prefilter !== match[1]) { return match.slice(1); } } }, { name: TAG_NAME, re: /^((?:-?[_a-z]+[\w-]*)|\*)/i, fn: function(match, token) { var tag = match[1].toUpperCase(); token.tagName = tag; if (tag !== '*' && (!token.last || token.prefilter)) { return [TAG_NAME, '=', tag]; } if (!token.prefilter) { token.prefilter = 'tagName'; } } }, { name: COMBINATOR, re: /^\s*([>+~]|\s)\s*/, fn: function(match, token) { } }, { name: PSEUDOS, re: /^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i, fn: function(match, token) { var test = Selector[PSEUDOS][match[1]]; if (test) { // reorder match array return [match[2], test]; } else { // selector token not supported (possibly missing CSS3 module) return false; } } } ], _getToken: function(token) { return { tagName: null, id: null, className: null, attributes: {}, combinator: null, tests: [] }; }, /** Break selector into token units per simple selector. Combinator is attached to the previous token. */ _tokenize: function(selector) { selector = selector || ''; selector = Selector._replaceShorthand(Y.Lang.trim(selector)); var token = Selector._getToken(), // one token per simple selector (left selector holds combinator) query = selector, // original query for debug report tokens = [], // array of tokens found = false, // whether or not any matches were found this pass match, // the regex match test, i, parser; /* Search for selector patterns, store, and strip them from the selector string until no patterns match (invalid selector) or we run out of chars. Multiple attributes and pseudos are allowed, in any order. for example: 'form:first-child[type=button]:not(button)[lang|=en]' */ outer: do { found = false; // reset after full pass for (i = 0; (parser = Selector._parsers[i++]);) { if ( (match = parser.re.exec(selector)) ) { // note assignment if (parser.name !== COMBINATOR ) { token.selector = selector; } selector = selector.replace(match[0], ''); // strip current match from selector if (!selector.length) { token.last = true; } if (Selector._attrFilters[match[1]]) { // convert class to className, etc. match[1] = Selector._attrFilters[match[1]]; } test = parser.fn(match, token); if (test === false) { // selector not supported found = false; break outer; } else if (test) { token.tests.push(test); } if (!selector.length || parser.name === COMBINATOR) { tokens.push(token); token = Selector._getToken(token); if (parser.name === COMBINATOR) { token.combinator = Y.Selector.combinators[match[1]]; } } found = true; } } } while (found && selector.length); if (!found || selector.length) { // not fully parsed tokens = []; } return tokens; }, _replaceShorthand: function(selector) { var shorthand = Selector.shorthand, attrs = selector.match(Selector._re.attr), // pull attributes to avoid false pos on "." and "#" pseudos = selector.match(Selector._re.pseudos), // pull attributes to avoid false pos on "." and "#" re, i, len; if (pseudos) { selector = selector.replace(Selector._re.pseudos, '!!REPLACED_PSEUDO!!'); } if (attrs) { selector = selector.replace(Selector._re.attr, '!!REPLACED_ATTRIBUTE!!'); } for (re in shorthand) { if (shorthand.hasOwnProperty(re)) { selector = selector.replace(Y.DOM._getRegExp(re, 'gi'), shorthand[re]); } } if (attrs) { for (i = 0, len = attrs.length; i < len; ++i) { selector = selector.replace('!!REPLACED_ATTRIBUTE!!', attrs[i]); } } if (pseudos) { for (i = 0, len = pseudos.length; i < len; ++i) { selector = selector.replace('!!REPLACED_PSEUDO!!', pseudos[i]); } } return selector; }, _attrFilters: { 'class': 'className', 'for': 'htmlFor' }, getters: { href: function(node, attr) { return Y.DOM.getAttribute(node, attr); } } }; Y.mix(Y.Selector, SelectorCSS2, true); Y.Selector.getters.src = Y.Selector.getters.rel = Y.Selector.getters.href; // IE wants class with native queries if (Y.Selector.useNative && Y.config.doc.querySelector) { Y.Selector.shorthand['\\.(-?[_a-z]+[-\\w]*)'] = '[class~=$1]'; } }, '@VERSION@' ,{requires:['selector-native']}); YUI.add('selector', function(Y){}, '@VERSION@' ,{use:['selector-native', 'selector-css2']}); YUI.add('dom', function(Y){}, '@VERSION@' ,{use:['dom-base', 'dom-style', 'dom-screen', 'selector']});
boneskull/cdnjs
ajax/libs/yui/3.3.0pr1/dom/dom.js
JavaScript
mit
82,549
/*! JointJS v0.8.1 - JavaScript diagramming library 2014-05-13 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ if(function(a,b){function c(a){var b=a.length,c=fb.type(a);return fb.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||"function"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){var b=ob[a]={};return fb.each(a.match(hb)||[],function(a,c){b[c]=!0}),b}function e(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=fb.expando+Math.random()}function f(a,c,d){var e;if(d===b&&1===a.nodeType)if(e="data-"+c.replace(sb,"-$1").toLowerCase(),d=a.getAttribute(e),"string"==typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:rb.test(d)?JSON.parse(d):d}catch(f){}pb.set(a,c,d)}else d=b;return d}function g(){return!0}function h(){return!1}function i(){try{return T.activeElement}catch(a){}}function j(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function k(a,b,c){if(fb.isFunction(b))return fb.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return fb.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(Cb.test(b))return fb.filter(b,a,c);b=fb.filter(b,a)}return fb.grep(a,function(a){return bb.call(b,a)>=0!==c})}function l(a,b){return fb.nodeName(a,"table")&&fb.nodeName(1===b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function m(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function n(a){var b=Nb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function o(a,b){for(var c=a.length,d=0;c>d;d++)qb.set(a[d],"globalEval",!b||qb.get(b[d],"globalEval"))}function p(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(qb.hasData(a)&&(f=qb.access(a),g=qb.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)fb.event.add(b,e,j[e][c])}pb.hasData(a)&&(h=pb.access(a),i=fb.extend({},h),pb.set(b,i))}}function q(a,c){var d=a.getElementsByTagName?a.getElementsByTagName(c||"*"):a.querySelectorAll?a.querySelectorAll(c||"*"):[];return c===b||c&&fb.nodeName(a,c)?fb.merge([a],d):d}function r(a,b){var c=b.nodeName.toLowerCase();"input"===c&&Kb.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function s(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=_b.length;e--;)if(b=_b[e]+c,b in a)return b;return d}function t(a,b){return a=b||a,"none"===fb.css(a,"display")||!fb.contains(a.ownerDocument,a)}function u(b){return a.getComputedStyle(b,null)}function v(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=qb.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&t(d)&&(f[g]=qb.access(d,"olddisplay",z(d.nodeName)))):f[g]||(e=t(d),(c&&"none"!==c||!e)&&qb.set(d,"olddisplay",e?c:fb.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function w(a,b,c){var d=Ub.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function x(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=fb.css(a,c+$b[f],!0,e)),d?("content"===c&&(g-=fb.css(a,"padding"+$b[f],!0,e)),"margin"!==c&&(g-=fb.css(a,"border"+$b[f]+"Width",!0,e))):(g+=fb.css(a,"padding"+$b[f],!0,e),"padding"!==c&&(g+=fb.css(a,"border"+$b[f]+"Width",!0,e)));return g}function y(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=u(a),g=fb.support.boxSizing&&"border-box"===fb.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Qb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Vb.test(e))return e;d=g&&(fb.support.boxSizingReliable||e===a.style[b]),e=parseFloat(e)||0}return e+x(a,b,c||(g?"border":"content"),d,f)+"px"}function z(a){var b=T,c=Xb[a];return c||(c=A(a,b),"none"!==c&&c||(Rb=(Rb||fb("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(Rb[0].contentWindow||Rb[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),c=A(a,b),Rb.detach()),Xb[a]=c),c}function A(a,b){var c=fb(b.createElement(a)).appendTo(b.body),d=fb.css(c[0],"display");return c.remove(),d}function B(a,b,c,d){var e;if(fb.isArray(b))fb.each(b,function(b,e){c||bc.test(a)?d(a,e):B(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==fb.type(b))d(a,b);else for(e in b)B(a+"["+e+"]",b[e],c,d)}function C(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(hb)||[];if(fb.isFunction(c))for(;d=f[e++];)"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function D(a,b,c,d){function e(h){var i;return f[h]=!0,fb.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===sc;return e(b.dataTypes[0])||!f["*"]&&e("*")}function E(a,c){var d,e,f=fb.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);return e&&fb.extend(!0,a,e),a}function F(a,c,d){for(var e,f,g,h,i=a.contents,j=a.dataTypes;"*"===j[0];)j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("Content-Type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}return g?(g!==j[0]&&j.unshift(g),d[g]):void 0}function G(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];for(f=k.shift();f;)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}function H(){return setTimeout(function(){Bc=b}),Bc=fb.now()}function I(a,b,c){for(var d,e=(Hc[b]||[]).concat(Hc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function J(a,b,c){var d,e,f=0,g=Gc.length,h=fb.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Bc||H(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:fb.extend({},b),opts:fb.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Bc||H(),duration:c.duration,tweens:[],createTween:function(b,c){var d=fb.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(K(k,j.opts.specialEasing);g>f;f++)if(d=Gc[f].call(j,a,k,j.opts))return d;return fb.map(k,I,j),fb.isFunction(j.opts.start)&&j.opts.start.call(a,j),fb.fx.timer(fb.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function K(a,b){var c,d,e,f,g;for(c in a)if(d=fb.camelCase(c),e=b[d],f=a[c],fb.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=fb.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function L(a,c,d){var e,f,g,h,i,j,k=this,l={},m=a.style,n=a.nodeType&&t(a),o=qb.get(a,"fxshow");d.queue||(i=fb._queueHooks(a,"fx"),null==i.unqueued&&(i.unqueued=0,j=i.empty.fire,i.empty.fire=function(){i.unqueued||j()}),i.unqueued++,k.always(function(){k.always(function(){i.unqueued--,fb.queue(a,"fx").length||i.empty.fire()})})),1===a.nodeType&&("height"in c||"width"in c)&&(d.overflow=[m.overflow,m.overflowX,m.overflowY],"inline"===fb.css(a,"display")&&"none"===fb.css(a,"float")&&(m.display="inline-block")),d.overflow&&(m.overflow="hidden",k.always(function(){m.overflow=d.overflow[0],m.overflowX=d.overflow[1],m.overflowY=d.overflow[2]}));for(e in c)if(f=c[e],Dc.exec(f)){if(delete c[e],g=g||"toggle"===f,f===(n?"hide":"show")){if("show"!==f||!o||o[e]===b)continue;n=!0}l[e]=o&&o[e]||fb.style(a,e)}if(!fb.isEmptyObject(l)){o?"hidden"in o&&(n=o.hidden):o=qb.access(a,"fxshow",{}),g&&(o.hidden=!n),n?fb(a).show():k.done(function(){fb(a).hide()}),k.done(function(){var b;qb.remove(a,"fxshow");for(b in l)fb.style(a,b,l[b])});for(e in l)h=I(n?o[e]:0,e,k),e in o||(o[e]=h.start,n&&(h.end=h.start,h.start="width"===e||"height"===e?1:0))}}function M(a,b,c,d,e){return new M.prototype.init(a,b,c,d,e)}function N(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=$b[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function O(a){return fb.isWindow(a)?a:9===a.nodeType&&a.defaultView}var P,Q,R=typeof b,S=a.location,T=a.document,U=T.documentElement,V=a.jQuery,W=a.$,X={},Y=[],Z="2.0.3",$=Y.concat,_=Y.push,ab=Y.slice,bb=Y.indexOf,cb=X.toString,db=X.hasOwnProperty,eb=Z.trim,fb=function(a,b){return new fb.fn.init(a,b,P)},gb=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,hb=/\S+/g,ib=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,jb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,kb=/^-ms-/,lb=/-([\da-z])/gi,mb=function(a,b){return b.toUpperCase()},nb=function(){T.removeEventListener("DOMContentLoaded",nb,!1),a.removeEventListener("load",nb,!1),fb.ready()};fb.fn=fb.prototype={jquery:Z,constructor:fb,init:function(a,c,d){var e,f;if(!a)return this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:ib.exec(a),!e||!e[1]&&c)return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a);if(e[1]){if(c=c instanceof fb?c[0]:c,fb.merge(this,fb.parseHTML(e[1],c&&c.nodeType?c.ownerDocument||c:T,!0)),jb.test(e[1])&&fb.isPlainObject(c))for(e in c)fb.isFunction(this[e])?this[e](c[e]):this.attr(e,c[e]);return this}return f=T.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=T,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):fb.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),fb.makeArray(a,this))},selector:"",length:0,toArray:function(){return ab.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){var b=fb.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return fb.each(this,a,b)},ready:function(a){return fb.ready.promise().done(a),this},slice:function(){return this.pushStack(ab.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},map:function(a){return this.pushStack(fb.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:_,sort:[].sort,splice:[].splice},fb.fn.init.prototype=fb.fn,fb.extend=fb.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),"object"==typeof h||fb.isFunction(h)||(h={}),j===i&&(h=this,--i);j>i;i++)if(null!=(a=arguments[i]))for(c in a)d=h[c],e=a[c],h!==e&&(k&&e&&(fb.isPlainObject(e)||(f=fb.isArray(e)))?(f?(f=!1,g=d&&fb.isArray(d)?d:[]):g=d&&fb.isPlainObject(d)?d:{},h[c]=fb.extend(k,g,e)):e!==b&&(h[c]=e));return h},fb.extend({expando:"jQuery"+(Z+Math.random()).replace(/\D/g,""),noConflict:function(b){return a.$===fb&&(a.$=W),b&&a.jQuery===fb&&(a.jQuery=V),fb},isReady:!1,readyWait:1,holdReady:function(a){a?fb.readyWait++:fb.ready(!0)},ready:function(a){(a===!0?--fb.readyWait:fb.isReady)||(fb.isReady=!0,a!==!0&&--fb.readyWait>0||(Q.resolveWith(T,[fb]),fb.fn.trigger&&fb(T).trigger("ready").off("ready")))},isFunction:function(a){return"function"===fb.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):"object"==typeof a||"function"==typeof a?X[cb.call(a)]||"object":typeof a},isPlainObject:function(a){if("object"!==fb.type(a)||a.nodeType||fb.isWindow(a))return!1;try{if(a.constructor&&!db.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||T;var d=jb.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=fb.buildFragment([a],b,e),e&&fb(e).remove(),fb.merge([],d.childNodes))},parseJSON:JSON.parse,parseXML:function(a){var c,d;if(!a||"string"!=typeof a)return null;try{d=new DOMParser,c=d.parseFromString(a,"text/xml")}catch(e){c=b}return(!c||c.getElementsByTagName("parsererror").length)&&fb.error("Invalid XML: "+a),c},noop:function(){},globalEval:function(a){var b,c=eval;a=fb.trim(a),a&&(1===a.indexOf("use strict")?(b=T.createElement("script"),b.text=a,T.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(kb,"ms-").replace(lb,mb)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;g>f&&(e=b.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=b.apply(a[f],d),e===!1)break}else if(h)for(;g>f&&(e=b.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),e===!1)break;return a},trim:function(a){return null==a?"":eb.call(a)},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?fb.merge(d,"string"==typeof a?[a]:a):_.call(d,a)),d},inArray:function(a,b,c){return null==b?-1:bb.call(b,a,c)},merge:function(a,c){var d=c.length,e=a.length,f=0;if("number"==typeof d)for(;d>f;f++)a[e++]=c[f];else for(;c[f]!==b;)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;g>f;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h)for(;g>f;f++)e=b(a[f],f,d),null!=e&&(i[i.length]=e);else for(f in a)e=b(a[f],f,d),null!=e&&(i[i.length]=e);return $.apply([],i)},guid:1,proxy:function(a,c){var d,e,f;return"string"==typeof c&&(d=a[c],c=a,a=d),fb.isFunction(a)?(e=ab.call(arguments,2),f=function(){return a.apply(c||this,e.concat(ab.call(arguments)))},f.guid=a.guid=a.guid||fb.guid++,f):b},access:function(a,c,d,e,f,g,h){var i=0,j=a.length,k=null==d;if("object"===fb.type(d)){f=!0;for(i in d)fb.access(a,c,i,d[i],!0,g,h)}else if(e!==b&&(f=!0,fb.isFunction(e)||(h=!0),k&&(h?(c.call(a,e),c=null):(k=c,c=function(a,b,c){return k.call(fb(a),c)})),c))for(;j>i;i++)c(a[i],d,h?e:e.call(a[i],i,c(a[i],d)));return f?a:k?c.call(a):j?c(a[0],d):g},now:Date.now,swap:function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e}}),fb.ready.promise=function(b){return Q||(Q=fb.Deferred(),"complete"===T.readyState?setTimeout(fb.ready):(T.addEventListener("DOMContentLoaded",nb,!1),a.addEventListener("load",nb,!1))),Q.promise(b)},fb.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){X["[object "+b+"]"]=b.toLowerCase()}),P=fb(T),function(a,b){function c(a,b,c,d){var e,f,g,h,i,j,k,l,o,p;if((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(I&&!d){if(e=tb.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&M(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return ab.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&x.getElementsByClassName&&b.getElementsByClassName)return ab.apply(c,b.getElementsByClassName(g)),c}if(x.qsa&&(!J||!J.test(a))){if(l=k=N,o=b,p=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=m(a),(k=b.getAttribute("id"))?l=k.replace(wb,"\\$&"):b.setAttribute("id",l),l="[id='"+l+"'] ",i=j.length;i--;)j[i]=l+n(j[i]);o=nb.test(a)&&b.parentNode||b,p=j.join(",")}if(p)try{return ab.apply(c,o.querySelectorAll(p)),c}catch(q){}finally{k||b.removeAttribute("id")}}}return v(a.replace(kb,"$1"),b,c,d)}function d(){function a(c,d){return b.push(c+=" ")>z.cacheLength&&delete a[b.shift()],a[c]=d}var b=[];return a}function e(a){return a[N]=!0,a}function f(a){var b=G.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function g(a,b){for(var c=a.split("|"),d=a.length;d--;)z.attrHandle[c[d]]=b}function h(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||X)-(~a.sourceIndex||X);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function i(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function j(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function k(a){return e(function(b){return b=+b,e(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function l(){}function m(a,b){var d,e,f,g,h,i,j,k=S[a+" "];if(k)return b?0:k.slice(0);for(h=a,i=[],j=z.preFilter;h;){(!d||(e=lb.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=mb.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(kb," ")}),h=h.slice(d.length));for(g in z.filter)!(e=rb[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return b?h.length:h?c.error(a):S(a,i).slice(0)}function n(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function o(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=P+" "+f;if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(j=b[N]||(b[N]={}),(i=j[d])&&i[0]===k){if((h=i[1])===!0||h===y)return h===!0}else if(i=j[d]=[k],i[1]=a(b,c,g)||y,i[1]===!0)return!0}}function p(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function r(a,b,c,d,f,g){return d&&!d[N]&&(d=r(d)),f&&!f[N]&&(f=r(f,g)),e(function(e,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=e||u(b||"*",h.nodeType?[h]:h,[]),r=!a||!e&&b?p:q(p,m,a,h,i),s=c?f||(e?a:o||d)?[]:g:r;if(c&&c(r,s,h,i),d)for(j=q(s,n),d(j,[],h,i),k=j.length;k--;)(l=j[k])&&(s[n[k]]=!(r[n[k]]=l));if(e){if(f||a){if(f){for(j=[],k=s.length;k--;)(l=s[k])&&j.push(r[k]=l);f(null,s=[],j,i)}for(k=s.length;k--;)(l=s[k])&&(j=f?cb.call(e,l):m[k])>-1&&(e[j]=!(g[j]=l))}}else s=q(s===g?s.splice(o,s.length):s),f?f(null,g,s,i):ab.apply(g,s)})}function s(a){for(var b,c,d,e=a.length,f=z.relative[a[0].type],g=f||z.relative[" "],h=f?1:0,i=o(function(a){return a===b},g,!0),j=o(function(a){return cb.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==D)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++)if(c=z.relative[a[h].type])k=[o(p(k),c)];else{if(c=z.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!z.relative[a[d].type];d++);return r(h>1&&p(k),h>1&&n(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(kb,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&n(a))}k.push(c)}return p(k)}function t(a,b){var d=0,f=b.length>0,g=a.length>0,h=function(e,h,i,j,k){var l,m,n,o=[],p=0,r="0",s=e&&[],t=null!=k,u=D,v=e||g&&z.find.TAG("*",k&&h.parentNode||h),w=P+=null==u?1:Math.random()||.1;for(t&&(D=h!==G&&h,y=d);null!=(l=v[r]);r++){if(g&&l){for(m=0;n=a[m++];)if(n(l,h,i)){j.push(l);break}t&&(P=w,y=++d)}f&&((l=!n&&l)&&p--,e&&s.push(l))}if(p+=r,f&&r!==p){for(m=0;n=b[m++];)n(s,o,h,i);if(e){if(p>0)for(;r--;)s[r]||o[r]||(o[r]=$.call(j));o=q(o)}ab.apply(j,o),t&&!e&&o.length>0&&p+b.length>1&&c.uniqueSort(j)}return t&&(P=w,D=u),s};return f?e(h):h}function u(a,b,d){for(var e=0,f=b.length;f>e;e++)c(a,b[e],d);return d}function v(a,b,c,d){var e,f,g,h,i,j=m(a);if(!d&&1===j.length){if(f=j[0]=j[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&x.getById&&9===b.nodeType&&I&&z.relative[f[1].type]){if(b=(z.find.ID(g.matches[0].replace(xb,yb),b)||[])[0],!b)return c;a=a.slice(f.shift().value.length)}for(e=rb.needsContext.test(a)?0:f.length;e--&&(g=f[e],!z.relative[h=g.type]);)if((i=z.find[h])&&(d=i(g.matches[0].replace(xb,yb),nb.test(f[0].type)&&b.parentNode||b))){if(f.splice(e,1),a=d.length&&n(f),!a)return ab.apply(c,d),c;break}}return C(a,j)(d,b,!I,c,nb.test(a)),c}var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=d(),S=d(),T=d(),U=!1,V=function(a,b){return a===b?(U=!0,0):0},W=typeof b,X=1<<31,Y={}.hasOwnProperty,Z=[],$=Z.pop,_=Z.push,ab=Z.push,bb=Z.slice,cb=Z.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},db="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",eb="[\\x20\\t\\r\\n\\f]",gb="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",hb=gb.replace("w","w#"),ib="\\["+eb+"*("+gb+")"+eb+"*(?:([*^$|!~]?=)"+eb+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+hb+")|)|)"+eb+"*\\]",jb=":("+gb+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ib.replace(3,8)+")*)|.*)\\)|)",kb=new RegExp("^"+eb+"+|((?:^|[^\\\\])(?:\\\\.)*)"+eb+"+$","g"),lb=new RegExp("^"+eb+"*,"+eb+"*"),mb=new RegExp("^"+eb+"*([>+~]|"+eb+")"+eb+"*"),nb=new RegExp(eb+"*[+~]"),ob=new RegExp("="+eb+"*([^\\]'\"]*)"+eb+"*\\]","g"),pb=new RegExp(jb),qb=new RegExp("^"+hb+"$"),rb={ID:new RegExp("^#("+gb+")"),CLASS:new RegExp("^\\.("+gb+")"),TAG:new RegExp("^("+gb.replace("w","w*")+")"),ATTR:new RegExp("^"+ib),PSEUDO:new RegExp("^"+jb),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+eb+"*(even|odd|(([+-]|)(\\d*)n|)"+eb+"*(?:([+-]|)"+eb+"*(\\d+)|))"+eb+"*\\)|)","i"),bool:new RegExp("^(?:"+db+")$","i"),needsContext:new RegExp("^"+eb+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+eb+"*((?:-\\d)?\\d*)"+eb+"*\\)|)(?=[^-]|$)","i")},sb=/^[^{]+\{\s*\[native \w/,tb=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ub=/^(?:input|select|textarea|button)$/i,vb=/^h\d$/i,wb=/'|\\/g,xb=new RegExp("\\\\([\\da-f]{1,6}"+eb+"?|("+eb+")|.)","ig"),yb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(55296|d>>10,56320|1023&d)};try{ab.apply(Z=bb.call(O.childNodes),O.childNodes),Z[O.childNodes.length].nodeType}catch(zb){ab={apply:Z.length?function(a,b){_.apply(a,bb.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}B=c.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},x=c.support={},F=c.setDocument=function(a){var b=a?a.ownerDocument||a:O,c=b.defaultView;return b!==G&&9===b.nodeType&&b.documentElement?(G=b,H=b.documentElement,I=!B(b),c&&c.attachEvent&&c!==c.top&&c.attachEvent("onbeforeunload",function(){F()}),x.attributes=f(function(a){return a.className="i",!a.getAttribute("className")}),x.getElementsByTagName=f(function(a){return a.appendChild(b.createComment("")),!a.getElementsByTagName("*").length}),x.getElementsByClassName=f(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),x.getById=f(function(a){return H.appendChild(a).id=N,!b.getElementsByName||!b.getElementsByName(N).length}),x.getById?(z.find.ID=function(a,b){if(typeof b.getElementById!==W&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},z.filter.ID=function(a){var b=a.replace(xb,yb);return function(a){return a.getAttribute("id")===b}}):(delete z.find.ID,z.filter.ID=function(a){var b=a.replace(xb,yb);return function(a){var c=typeof a.getAttributeNode!==W&&a.getAttributeNode("id");return c&&c.value===b}}),z.find.TAG=x.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==W?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},z.find.CLASS=x.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==W&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(x.qsa=sb.test(b.querySelectorAll))&&(f(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||J.push("\\["+eb+"*(?:value|"+db+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),f(function(a){var c=b.createElement("input");c.setAttribute("type","hidden"),a.appendChild(c).setAttribute("t",""),a.querySelectorAll("[t^='']").length&&J.push("[*^$]="+eb+"*(?:''|\"\")"),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(x.matchesSelector=sb.test(L=H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&f(function(a){x.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",jb)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),M=sb.test(H.contains)||H.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},V=H.compareDocumentPosition?function(a,c){if(a===c)return U=!0,0;var d=c.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(c);return d?1&d||!x.sortDetached&&c.compareDocumentPosition(a)===d?a===b||M(O,a)?-1:c===b||M(O,c)?1:E?cb.call(E,a)-cb.call(E,c):0:4&d?-1:1:a.compareDocumentPosition?-1:1}:function(a,c){var d,e=0,f=a.parentNode,g=c.parentNode,i=[a],j=[c];if(a===c)return U=!0,0;if(!f||!g)return a===b?-1:c===b?1:f?-1:g?1:E?cb.call(E,a)-cb.call(E,c):0;if(f===g)return h(a,c);for(d=a;d=d.parentNode;)i.unshift(d);for(d=c;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?h(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},b):G},c.matches=function(a,b){return c(a,null,null,b)},c.matchesSelector=function(a,b){if((a.ownerDocument||a)!==G&&F(a),b=b.replace(ob,"='$1']"),!(!x.matchesSelector||!I||K&&K.test(b)||J&&J.test(b)))try{var d=L.call(a,b);if(d||x.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return c(b,G,null,[a]).length>0},c.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},c.attr=function(a,c){(a.ownerDocument||a)!==G&&F(a);var d=z.attrHandle[c.toLowerCase()],e=d&&Y.call(z.attrHandle,c.toLowerCase())?d(a,c,!I):b;return e===b?x.attributes||!I?a.getAttribute(c):(e=a.getAttributeNode(c))&&e.specified?e.value:null:e},c.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},c.uniqueSort=function(a){var b,c=[],d=0,e=0;if(U=!x.detectDuplicates,E=!x.sortStable&&a.slice(0),a.sort(V),U){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return a},A=c.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=A(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=A(b);return c},z=c.selectors={cacheLength:50,createPseudo:e,match:rb,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(xb,yb),a[3]=(a[4]||a[5]||"").replace(xb,yb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||c.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&c.error(a[0]),a},PSEUDO:function(a){var c,d=!a[5]&&a[2];return rb.CHILD.test(a[0])?null:(a[3]&&a[4]!==b?a[2]=a[4]:d&&pb.test(d)&&(c=m(d,!0))&&(c=d.indexOf(")",d.length-c)-d.length)&&(a[0]=a[0].slice(0,c),a[2]=d.slice(0,c)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(xb,yb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+eb+")"+a+"("+eb+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==W&&a.getAttribute("class")||"")})},ATTR:function(a,b,d){return function(e){var f=c.attr(e,a);return null==f?"!="===b:b?(f+="","="===b?f===d:"!="===b?f!==d:"^="===b?d&&0===f.indexOf(d):"*="===b?d&&f.indexOf(d)>-1:"$="===b?d&&f.slice(-d.length)===d:"~="===b?(" "+f+" ").indexOf(d)>-1:"|="===b?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b)););return m-=e,m===d||0===m%d&&m/d>=0}}},PSEUDO:function(a,b){var d,f=z.pseudos[a]||z.setFilters[a.toLowerCase()]||c.error("unsupported pseudo: "+a);return f[N]?f(b):f.length>1?(d=[a,a,"",b],z.setFilters.hasOwnProperty(a.toLowerCase())?e(function(a,c){for(var d,e=f(a,b),g=e.length;g--;)d=cb.call(a,e[g]),a[d]=!(c[d]=e[g])}):function(a){return f(a,0,d)}):f}},pseudos:{not:e(function(a){var b=[],c=[],d=C(a.replace(kb,"$1"));return d[N]?e(function(a,b,c,e){for(var f,g=d(a,null,e,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:e(function(a){return function(b){return c(a,b).length>0}}),contains:e(function(a){return function(b){return(b.textContent||b.innerText||A(b)).indexOf(a)>-1}}),lang:e(function(a){return qb.test(a||"")||c.error("unsupported lang: "+a),a=a.replace(xb,yb).toLowerCase(),function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!z.pseudos.empty(a)},header:function(a){return vb.test(a.nodeName)},input:function(a){return ub.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:k(function(){return[0]}),last:k(function(a,b){return[b-1]}),eq:k(function(a,b,c){return[0>c?c+b:c]}),even:k(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:k(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:k(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:k(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},z.pseudos.nth=z.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})z.pseudos[w]=i(w); for(w in{submit:!0,reset:!0})z.pseudos[w]=j(w);l.prototype=z.filters=z.pseudos,z.setFilters=new l,C=c.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=m(a)),c=b.length;c--;)f=s(b[c]),f[N]?d.push(f):e.push(f);f=T(a,t(e,d))}return f},x.sortStable=N.split("").sort(V).join("")===N,x.detectDuplicates=U,F(),x.sortDetached=f(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),f(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||g("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),x.attributes&&f(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||g("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),f(function(a){return null==a.getAttribute("disabled")})||g(db,function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&d.specified?d.value:a[b]===!0?b.toLowerCase():null}),fb.find=c,fb.expr=c.selectors,fb.expr[":"]=fb.expr.pseudos,fb.unique=c.uniqueSort,fb.text=c.getText,fb.isXMLDoc=c.isXML,fb.contains=c.contains}(a);var ob={};fb.Callbacks=function(a){a="string"==typeof a?ob[a]||d(a):fb.extend({},a);var c,e,f,g,h,i,j=[],k=!a.once&&[],l=function(b){for(c=a.memory&&b,e=!0,i=g||0,g=0,h=j.length,f=!0;j&&h>i;i++)if(j[i].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}f=!1,j&&(k?k.length&&l(k.shift()):c?j=[]:m.disable())},m={add:function(){if(j){var b=j.length;!function d(b){fb.each(b,function(b,c){var e=fb.type(c);"function"===e?a.unique&&m.has(c)||j.push(c):c&&c.length&&"string"!==e&&d(c)})}(arguments),f?h=j.length:c&&(g=b,l(c))}return this},remove:function(){return j&&fb.each(arguments,function(a,b){for(var c;(c=fb.inArray(b,j,c))>-1;)j.splice(c,1),f&&(h>=c&&h--,i>=c&&i--)}),this},has:function(a){return a?fb.inArray(a,j)>-1:!(!j||!j.length)},empty:function(){return j=[],h=0,this},disable:function(){return j=k=c=b,this},disabled:function(){return!j},lock:function(){return k=b,c||m.disable(),this},locked:function(){return!k},fireWith:function(a,b){return!j||e&&!k||(b=b||[],b=[a,b.slice?b.slice():b],f?k.push(b):l(b)),this},fire:function(){return m.fireWith(this,arguments),this},fired:function(){return!!e}};return m},fb.extend({Deferred:function(a){var b=[["resolve","done",fb.Callbacks("once memory"),"resolved"],["reject","fail",fb.Callbacks("once memory"),"rejected"],["notify","progress",fb.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return fb.Deferred(function(c){fb.each(b,function(b,f){var g=f[0],h=fb.isFunction(a[b])&&a[b];e[f[1]](function(){var a=h&&h.apply(this,arguments);a&&fb.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[g+"With"](this===d?c.promise():this,h?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?fb.extend(a,d):d}},e={};return d.pipe=d.then,fb.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=ab.call(arguments),g=f.length,h=1!==g||a&&fb.isFunction(a.promise)?g:0,i=1===h?a:fb.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?ab.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&fb.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}}),fb.support=function(b){var c=T.createElement("input"),d=T.createDocumentFragment(),e=T.createElement("div"),f=T.createElement("select"),g=f.appendChild(T.createElement("option"));return c.type?(c.type="checkbox",b.checkOn=""!==c.value,b.optSelected=g.selected,b.reliableMarginRight=!0,b.boxSizingReliable=!0,b.pixelPosition=!1,c.checked=!0,b.noCloneChecked=c.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled,c=T.createElement("input"),c.value="t",c.type="radio",b.radioValue="t"===c.value,c.setAttribute("checked","t"),c.setAttribute("name","t"),d.appendChild(c),b.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked,b.focusinBubbles="onfocusin"in a,e.style.backgroundClip="content-box",e.cloneNode(!0).style.backgroundClip="",b.clearCloneStyle="content-box"===e.style.backgroundClip,fb(function(){var c,d,f="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",g=T.getElementsByTagName("body")[0];g&&(c=T.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",g.appendChild(c).appendChild(e),e.innerHTML="",e.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",fb.swap(g,null!=g.style.zoom?{zoom:1}:{},function(){b.boxSizing=4===e.offsetWidth}),a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(e,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(e,null)||{width:"4px"}).width,d=e.appendChild(T.createElement("div")),d.style.cssText=e.style.cssText=f,d.style.marginRight=d.style.width="0",e.style.width="1px",b.reliableMarginRight=!parseFloat((a.getComputedStyle(d,null)||{}).marginRight)),g.removeChild(c))}),b):b}({});var pb,qb,rb=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,sb=/([A-Z])/g;e.uid=1,e.accepts=function(a){return a.nodeType?1===a.nodeType||9===a.nodeType:!0},e.prototype={key:function(a){if(!e.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=e.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,fb.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(fb.isEmptyObject(f))fb.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,c){var d=this.cache[this.key(a)];return c===b?d:d[c]},access:function(a,c,d){var e;return c===b||c&&"string"==typeof c&&d===b?(e=this.get(a,c),e!==b?e:this.get(a,fb.camelCase(c))):(this.set(a,c,d),d!==b?d:c)},remove:function(a,c){var d,e,f,g=this.key(a),h=this.cache[g];if(c===b)this.cache[g]={};else{fb.isArray(c)?e=c.concat(c.map(fb.camelCase)):(f=fb.camelCase(c),c in h?e=[c,f]:(e=f,e=e in h?[e]:e.match(hb)||[])),d=e.length;for(;d--;)delete h[e[d]]}},hasData:function(a){return!fb.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}},pb=new e,qb=new e,fb.extend({acceptData:e.accepts,hasData:function(a){return pb.hasData(a)||qb.hasData(a)},data:function(a,b,c){return pb.access(a,b,c)},removeData:function(a,b){pb.remove(a,b)},_data:function(a,b,c){return qb.access(a,b,c)},_removeData:function(a,b){qb.remove(a,b)}}),fb.fn.extend({data:function(a,c){var d,e,g=this[0],h=0,i=null;if(a===b){if(this.length&&(i=pb.get(g),1===g.nodeType&&!qb.get(g,"hasDataAttrs"))){for(d=g.attributes;h<d.length;h++)e=d[h].name,0===e.indexOf("data-")&&(e=fb.camelCase(e.slice(5)),f(g,e,i[e]));qb.set(g,"hasDataAttrs",!0)}return i}return"object"==typeof a?this.each(function(){pb.set(this,a)}):fb.access(this,function(c){var d,e=fb.camelCase(a);if(g&&c===b){if(d=pb.get(g,a),d!==b)return d;if(d=pb.get(g,e),d!==b)return d;if(d=f(g,e,b),d!==b)return d}else this.each(function(){var d=pb.get(this,e);pb.set(this,e,c),-1!==a.indexOf("-")&&d!==b&&pb.set(this,a,c)})},null,c,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){pb.remove(this,a)})}}),fb.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=qb.get(a,b),c&&(!d||fb.isArray(c)?d=qb.access(a,b,fb.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=fb.queue(a,b),d=c.length,e=c.shift(),f=fb._queueHooks(a,b),g=function(){fb.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return qb.get(a,c)||qb.access(a,c,{empty:fb.Callbacks("once memory").add(function(){qb.remove(a,[b+"queue",c])})})}}),fb.fn.extend({queue:function(a,c){var d=2;return"string"!=typeof a&&(c=a,a="fx",d--),arguments.length<d?fb.queue(this[0],a):c===b?this:this.each(function(){var b=fb.queue(this,a,c);fb._queueHooks(this,a),"fx"===a&&"inprogress"!==b[0]&&fb.dequeue(this,a)})},dequeue:function(a){return this.each(function(){fb.dequeue(this,a)})},delay:function(a,b){return a=fb.fx?fb.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=fb.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};for("string"!=typeof a&&(c=a,a=b),a=a||"fx";h--;)d=qb.get(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var tb,ub,vb=/[\t\r\n\f]/g,wb=/\r/g,xb=/^(?:input|select|textarea|button)$/i;fb.fn.extend({attr:function(a,b){return fb.access(this,fb.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){fb.removeAttr(this,a)})},prop:function(a,b){return fb.access(this,fb.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[fb.propFix[a]||a]})},addClass:function(a){var b,c,d,e,f,g=0,h=this.length,i="string"==typeof a&&a;if(fb.isFunction(a))return this.each(function(b){fb(this).addClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(hb)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vb," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");c.className=fb.trim(d)}return this},removeClass:function(a){var b,c,d,e,f,g=0,h=this.length,i=0===arguments.length||"string"==typeof a&&a;if(fb.isFunction(a))return this.each(function(b){fb(this).removeClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(hb)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vb," "):"")){for(f=0;e=b[f++];)for(;d.indexOf(" "+e+" ")>=0;)d=d.replace(" "+e+" "," ");c.className=a?fb.trim(d):""}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):fb.isFunction(a)?this.each(function(c){fb(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c)for(var b,d=0,e=fb(this),f=a.match(hb)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else(c===R||"boolean"===c)&&(this.className&&qb.set(this,"__className__",this.className),this.className=this.className||a===!1?"":qb.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vb," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];{if(arguments.length)return e=fb.isFunction(a),this.each(function(d){var f;1===this.nodeType&&(f=e?a.call(this,d,fb(this).val()):a,null==f?f="":"number"==typeof f?f+="":fb.isArray(f)&&(f=fb.map(f,function(a){return null==a?"":a+""})),c=fb.valHooks[this.type]||fb.valHooks[this.nodeName.toLowerCase()],c&&"set"in c&&c.set(this,f,"value")!==b||(this.value=f))});if(f)return c=fb.valHooks[f.type]||fb.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,"string"==typeof d?d.replace(wb,""):null==d?"":d)}}}),fb.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(fb.support.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&fb.nodeName(c.parentNode,"optgroup"))){if(b=fb(c).val(),f)return b;g.push(b)}return g},set:function(a,b){for(var c,d,e=a.options,f=fb.makeArray(b),g=e.length;g--;)d=e[g],(d.selected=fb.inArray(fb(d).val(),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}},attr:function(a,c,d){var e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return typeof a.getAttribute===R?fb.prop(a,c,d):(1===g&&fb.isXMLDoc(a)||(c=c.toLowerCase(),e=fb.attrHooks[c]||(fb.expr.match.bool.test(c)?ub:tb)),d===b?e&&"get"in e&&null!==(f=e.get(a,c))?f:(f=fb.find.attr(a,c),null==f?b:f):null!==d?e&&"set"in e&&(f=e.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d):(fb.removeAttr(a,c),void 0))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(hb);if(f&&1===a.nodeType)for(;c=f[e++];)d=fb.propFix[c]||c,fb.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!fb.support.radioValue&&"radio"===b&&fb.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return g=1!==h||!fb.isXMLDoc(a),g&&(c=fb.propFix[c]||c,f=fb.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&null!==(e=f.get(a,c))?e:a[c]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||xb.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),ub={set:function(a,b,c){return b===!1?fb.removeAttr(a,c):a.setAttribute(c,c),c}},fb.each(fb.expr.match.bool.source.match(/\w+/g),function(a,c){var d=fb.expr.attrHandle[c]||fb.find.attr;fb.expr.attrHandle[c]=function(a,c,e){var f=fb.expr.attrHandle[c],g=e?b:(fb.expr.attrHandle[c]=b)!=d(a,c,e)?c.toLowerCase():null;return fb.expr.attrHandle[c]=f,g}}),fb.support.optSelected||(fb.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),fb.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){fb.propFix[this.toLowerCase()]=this}),fb.each(["radio","checkbox"],function(){fb.valHooks[this]={set:function(a,b){return fb.isArray(b)?a.checked=fb.inArray(fb(a).val(),b)>=0:void 0}},fb.support.checkOn||(fb.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var yb=/^key/,zb=/^(?:mouse|contextmenu)|click/,Ab=/^(?:focusinfocus|focusoutblur)$/,Bb=/^([^.]*)(?:\.(.+)|)$/;fb.event={global:{},add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=qb.get(a);if(r){for(d.handler&&(g=d,d=g.handler,f=g.selector),d.guid||(d.guid=fb.guid++),(j=r.events)||(j=r.events={}),(h=r.handle)||(h=r.handle=function(a){return typeof fb===R||a&&fb.event.triggered===a.type?b:fb.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=(c||"").match(hb)||[""],k=c.length;k--;)i=Bb.exec(c[k])||[],o=q=i[1],p=(i[2]||"").split(".").sort(),o&&(m=fb.event.special[o]||{},o=(f?m.delegateType:m.bindType)||o,m=fb.event.special[o]||{},l=fb.extend({type:o,origType:q,data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&fb.expr.match.needsContext.test(f),namespace:p.join(".")},g),(n=j[o])||(n=j[o]=[],n.delegateCount=0,m.setup&&m.setup.call(a,e,p,h)!==!1||a.addEventListener&&a.addEventListener(o,h,!1)),m.add&&(m.add.call(a,l),l.handler.guid||(l.handler.guid=d.guid)),f?n.splice(n.delegateCount++,0,l):n.push(l),fb.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=qb.hasData(a)&&qb.get(a);if(q&&(i=q.events)){for(b=(b||"").match(hb)||[""],j=b.length;j--;)if(h=Bb.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=fb.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;f--;)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||fb.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)fb.event.remove(a,n+b[j],c,d,!0);fb.isEmptyObject(i)&&(delete q.handle,qb.remove(a,"events"))}},trigger:function(c,d,e,f){var g,h,i,j,k,l,m,n=[e||T],o=db.call(c,"type")?c.type:c,p=db.call(c,"namespace")?c.namespace.split("."):[];if(h=i=e=e||T,3!==e.nodeType&&8!==e.nodeType&&!Ab.test(o+fb.event.triggered)&&(o.indexOf(".")>=0&&(p=o.split("."),o=p.shift(),p.sort()),k=o.indexOf(":")<0&&"on"+o,c=c[fb.expando]?c:new fb.Event(o,"object"==typeof c&&c),c.isTrigger=f?2:3,c.namespace=p.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=b,c.target||(c.target=e),d=null==d?[c]:fb.makeArray(d,[c]),m=fb.event.special[o]||{},f||!m.trigger||m.trigger.apply(e,d)!==!1)){if(!f&&!m.noBubble&&!fb.isWindow(e)){for(j=m.delegateType||o,Ab.test(j+o)||(h=h.parentNode);h;h=h.parentNode)n.push(h),i=h;i===(e.ownerDocument||T)&&n.push(i.defaultView||i.parentWindow||a)}for(g=0;(h=n[g++])&&!c.isPropagationStopped();)c.type=g>1?j:m.bindType||o,l=(qb.get(h,"events")||{})[c.type]&&qb.get(h,"handle"),l&&l.apply(h,d),l=k&&h[k],l&&fb.acceptData(h)&&l.apply&&l.apply(h,d)===!1&&c.preventDefault();return c.type=o,f||c.isDefaultPrevented()||m._default&&m._default.apply(n.pop(),d)!==!1||!fb.acceptData(e)||k&&fb.isFunction(e[o])&&!fb.isWindow(e)&&(i=e[k],i&&(e[k]=null),fb.event.triggered=o,e[o](),fb.event.triggered=b,i&&(e[k]=i)),c.result}},dispatch:function(a){a=fb.event.fix(a);var c,d,e,f,g,h=[],i=ab.call(arguments),j=(qb.get(this,"events")||{})[a.type]||[],k=fb.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){for(h=fb.event.handlers.call(this,a,j),c=0;(f=h[c++])&&!a.isPropagationStopped();)for(a.currentTarget=f.elem,d=0;(g=f.handlers[d++])&&!a.isImmediatePropagationStopped();)(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((fb.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),e!==b&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()));return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,c){var d,e,f,g,h=[],i=c.delegateCount,j=a.target;if(i&&j.nodeType&&(!a.button||"click"!==a.type))for(;j!==this;j=j.parentNode||this)if(j.disabled!==!0||"click"!==a.type){for(e=[],d=0;i>d;d++)g=c[d],f=g.selector+" ",e[f]===b&&(e[f]=g.needsContext?fb(f,this).index(j)>=0:fb.find(f,this,null,[j]).length),e[f]&&e.push(g);e.length&&h.push({elem:j,handlers:e})}return i<c.length&&h.push({elem:this,handlers:c.slice(i)}),h},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,f,g=c.button;return null==a.pageX&&null!=c.clientX&&(d=a.target.ownerDocument||T,e=d.documentElement,f=d.body,a.pageX=c.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=c.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||g===b||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[fb.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=zb.test(e)?this.mouseHooks:yb.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new fb.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=T),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==i()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===i()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&fb.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return fb.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){a.result!==b&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=fb.extend(new fb.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?fb.event.trigger(e,null,b):fb.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},fb.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},fb.Event=function(a,b){return this instanceof fb.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.getPreventDefault&&a.getPreventDefault()?g:h):this.type=a,b&&fb.extend(this,b),this.timeStamp=a&&a.timeStamp||fb.now(),this[fb.expando]=!0,void 0):new fb.Event(a,b)},fb.Event.prototype={isDefaultPrevented:h,isPropagationStopped:h,isImmediatePropagationStopped:h,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=g,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=g,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=g,this.stopPropagation()}},fb.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){fb.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!fb.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),fb.support.focusinBubbles||fb.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){fb.event.simulate(b,a.target,fb.event.fix(a),!0)};fb.event.special[b]={setup:function(){0===c++&&T.addEventListener(a,d,!0)},teardown:function(){0===--c&&T.removeEventListener(a,d,!0)}}}),fb.fn.extend({on:function(a,c,d,e,f){var g,i;if("object"==typeof a){"string"!=typeof c&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],f);return this}if(null==d&&null==e?(e=c,d=c=b):null==e&&("string"==typeof c?(e=d,d=b):(e=d,d=c,c=b)),e===!1)e=h;else if(!e)return this;return 1===f&&(g=e,e=function(a){return fb().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=fb.guid++)),this.each(function(){fb.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,fb(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"==typeof a){for(f in a)this.off(f,c,a[f]);return this}return(c===!1||"function"==typeof c)&&(d=c,c=b),d===!1&&(d=h),this.each(function(){fb.event.remove(this,a,d,c)})},trigger:function(a,b){return this.each(function(){fb.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?fb.event.trigger(a,b,c,!0):void 0}});var Cb=/^.[^:#\[\.,]*$/,Db=/^(?:parents|prev(?:Until|All))/,Eb=fb.expr.match.needsContext,Fb={children:!0,contents:!0,next:!0,prev:!0};fb.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(fb(a).filter(function(){for(b=0;e>b;b++)if(fb.contains(d[b],this))return!0}));for(b=0;e>b;b++)fb.find(a,d[b],c);return c=this.pushStack(e>1?fb.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},has:function(a){var b=fb(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(fb.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(k(this,a||[],!0))},filter:function(a){return this.pushStack(k(this,a||[],!1))},is:function(a){return!!k(this,"string"==typeof a&&Eb.test(a)?fb(a):a||[],!1).length},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=Eb.test(a)||"string"!=typeof a?fb(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&fb.find.matchesSelector(c,a))){c=f.push(c);break}return this.pushStack(f.length>1?fb.unique(f):f)},index:function(a){return a?"string"==typeof a?bb.call(fb(a),this[0]):bb.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var c="string"==typeof a?fb(a,b):fb.makeArray(a&&a.nodeType?[a]:a),d=fb.merge(this.get(),c);return this.pushStack(fb.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),fb.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return fb.dir(a,"parentNode")},parentsUntil:function(a,b,c){return fb.dir(a,"parentNode",c)},next:function(a){return j(a,"nextSibling")},prev:function(a){return j(a,"previousSibling")},nextAll:function(a){return fb.dir(a,"nextSibling")},prevAll:function(a){return fb.dir(a,"previousSibling")},nextUntil:function(a,b,c){return fb.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return fb.dir(a,"previousSibling",c)},siblings:function(a){return fb.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return fb.sibling(a.firstChild)},contents:function(a){return a.contentDocument||fb.merge([],a.childNodes)}},function(a,b){fb.fn[a]=function(c,d){var e=fb.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=fb.filter(d,e)),this.length>1&&(Fb[a]||fb.unique(e),Db.test(a)&&e.reverse()),this.pushStack(e)}}),fb.extend({filter:function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?fb.find.matchesSelector(d,a)?[d]:[]:fb.find.matches(a,fb.grep(b,function(a){return 1===a.nodeType}))},dir:function(a,c,d){for(var e=[],f=d!==b;(a=a[c])&&9!==a.nodeType;)if(1===a.nodeType){if(f&&fb(a).is(d))break;e.push(a)}return e},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var Gb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Hb=/<([\w:]+)/,Ib=/<|&#?\w+;/,Jb=/<(?:script|style|link)/i,Kb=/^(?:checkbox|radio)$/i,Lb=/checked\s*(?:[^=]|=\s*.checked.)/i,Mb=/^$|\/(?:java|ecma)script/i,Nb=/^true\/(.*)/,Ob=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Pb={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Pb.optgroup=Pb.option,Pb.tbody=Pb.tfoot=Pb.colgroup=Pb.caption=Pb.thead,Pb.th=Pb.td,fb.fn.extend({text:function(a){return fb.access(this,function(a){return a===b?fb.text(this):this.empty().append((this[0]&&this[0].ownerDocument||T).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=l(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=l(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?fb.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||fb.cleanData(q(c)),c.parentNode&&(b&&fb.contains(c.ownerDocument,c)&&o(q(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(fb.cleanData(q(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return fb.clone(this,a,b)})},html:function(a){return fb.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b&&1===c.nodeType)return c.innerHTML;if("string"==typeof a&&!Jb.test(a)&&!Pb[(Hb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Gb,"<$1></$2>");try{for(;e>d;d++)c=this[d]||{},1===c.nodeType&&(fb.cleanData(q(c,!1)),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=fb.map(this,function(a){return[a.nextSibling,a.parentNode]}),b=0;return this.domManip(arguments,function(c){var d=a[b++],e=a[b++];e&&(d&&d.parentNode!==e&&(d=this.nextSibling),fb(this).remove(),e.insertBefore(c,d))},!0),b?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,c){a=$.apply([],a);var d,e,f,g,h,i,j=0,k=this.length,l=this,o=k-1,p=a[0],r=fb.isFunction(p);if(r||!(1>=k||"string"!=typeof p||fb.support.checkClone)&&Lb.test(p))return this.each(function(d){var e=l.eq(d);r&&(a[0]=p.call(this,d,e.html())),e.domManip(a,b,c)});if(k&&(d=fb.buildFragment(a,this[0].ownerDocument,!1,!c&&this),e=d.firstChild,1===d.childNodes.length&&(d=e),e)){for(f=fb.map(q(d,"script"),m),g=f.length;k>j;j++)h=d,j!==o&&(h=fb.clone(h,!0,!0),g&&fb.merge(f,q(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,fb.map(f,n),j=0;g>j;j++)h=f[j],Mb.test(h.type||"")&&!qb.access(h,"globalEval")&&fb.contains(i,h)&&(h.src?fb._evalUrl(h.src):fb.globalEval(h.textContent.replace(Ob,"")))}return this}}),fb.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){fb.fn[a]=function(a){for(var c,d=[],e=fb(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),fb(e[g])[b](c),_.apply(d,c.get());return this.pushStack(d)}}),fb.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=fb.contains(a.ownerDocument,a);if(!(fb.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||fb.isXMLDoc(a)))for(g=q(h),f=q(a),d=0,e=f.length;e>d;d++)r(f[d],g[d]);if(b)if(c)for(f=f||q(a),g=g||q(h),d=0,e=f.length;e>d;d++)p(f[d],g[d]);else p(a,h);return g=q(h,"script"),g.length>0&&o(g,!i&&q(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=0,l=a.length,m=b.createDocumentFragment(),n=[];l>k;k++)if(e=a[k],e||0===e)if("object"===fb.type(e))fb.merge(n,e.nodeType?[e]:e);else if(Ib.test(e)){for(f=f||m.appendChild(b.createElement("div")),g=(Hb.exec(e)||["",""])[1].toLowerCase(),h=Pb[g]||Pb._default,f.innerHTML=h[1]+e.replace(Gb,"<$1></$2>")+h[2],j=h[0];j--;)f=f.lastChild;fb.merge(n,f.childNodes),f=m.firstChild,f.textContent=""}else n.push(b.createTextNode(e));for(m.textContent="",k=0;e=n[k++];)if((!d||-1===fb.inArray(e,d))&&(i=fb.contains(e.ownerDocument,e),f=q(m.appendChild(e),"script"),i&&o(f),c))for(j=0;e=f[j++];)Mb.test(e.type||"")&&c.push(e);return m},cleanData:function(a){for(var c,d,f,g,h,i,j=fb.event.special,k=0;(d=a[k])!==b;k++){if(e.accepts(d)&&(h=d[qb.expando],h&&(c=qb.cache[h]))){if(f=Object.keys(c.events||{}),f.length)for(i=0;(g=f[i])!==b;i++)j[g]?fb.event.remove(d,g):fb.removeEvent(d,g,c.handle);qb.cache[h]&&delete qb.cache[h]}delete pb.cache[d[pb.expando]]}},_evalUrl:function(a){return fb.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),fb.fn.extend({wrapAll:function(a){var b;return fb.isFunction(a)?this.each(function(b){fb(this).wrapAll(a.call(this,b))}):(this[0]&&(b=fb(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstElementChild;)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return fb.isFunction(a)?this.each(function(b){fb(this).wrapInner(a.call(this,b))}):this.each(function(){var b=fb(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=fb.isFunction(a);return this.each(function(c){fb(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){fb.nodeName(this,"body")||fb(this).replaceWith(this.childNodes)}).end()}});var Qb,Rb,Sb=/^(none|table(?!-c[ea]).+)/,Tb=/^margin/,Ub=new RegExp("^("+gb+")(.*)$","i"),Vb=new RegExp("^("+gb+")(?!px)[a-z%]+$","i"),Wb=new RegExp("^([+-])=("+gb+")","i"),Xb={BODY:"block"},Yb={position:"absolute",visibility:"hidden",display:"block"},Zb={letterSpacing:0,fontWeight:400},$b=["Top","Right","Bottom","Left"],_b=["Webkit","O","Moz","ms"];fb.fn.extend({css:function(a,c){return fb.access(this,function(a,c,d){var e,f,g={},h=0; if(fb.isArray(c)){for(e=u(a),f=c.length;f>h;h++)g[c[h]]=fb.css(a,c[h],!1,e);return g}return d!==b?fb.style(a,c,d):fb.css(a,c)},a,c,arguments.length>1)},show:function(){return v(this,!0)},hide:function(){return v(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){t(this)?fb(this).show():fb(this).hide()})}}),fb.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Qb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,i=fb.camelCase(c),j=a.style;return c=fb.cssProps[i]||(fb.cssProps[i]=s(j,i)),h=fb.cssHooks[c]||fb.cssHooks[i],d===b?h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c]:(g=typeof d,"string"===g&&(f=Wb.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(fb.css(a,c)),g="number"),null==d||"number"===g&&isNaN(d)||("number"!==g||fb.cssNumber[i]||(d+="px"),fb.support.clearCloneStyle||""!==d||0!==c.indexOf("background")||(j[c]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===b||(j[c]=d)),void 0)}},css:function(a,c,d,e){var f,g,h,i=fb.camelCase(c);return c=fb.cssProps[i]||(fb.cssProps[i]=s(a.style,i)),h=fb.cssHooks[c]||fb.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,d)),f===b&&(f=Qb(a,c,e)),"normal"===f&&c in Zb&&(f=Zb[c]),""===d||d?(g=parseFloat(f),d===!0||fb.isNumeric(g)?g||0:f):f}}),Qb=function(a,c,d){var e,f,g,h=d||u(a),i=h?h.getPropertyValue(c)||h[c]:b,j=a.style;return h&&(""!==i||fb.contains(a.ownerDocument,a)||(i=fb.style(a,c)),Vb.test(i)&&Tb.test(c)&&(e=j.width,f=j.minWidth,g=j.maxWidth,j.minWidth=j.maxWidth=j.width=i,i=h.width,j.width=e,j.minWidth=f,j.maxWidth=g)),i},fb.each(["height","width"],function(a,b){fb.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Sb.test(fb.css(a,"display"))?fb.swap(a,Yb,function(){return y(a,b,d)}):y(a,b,d):void 0},set:function(a,c,d){var e=d&&u(a);return w(a,c,d?x(a,b,d,fb.support.boxSizing&&"border-box"===fb.css(a,"boxSizing",!1,e),e):0)}}}),fb(function(){fb.support.reliableMarginRight||(fb.cssHooks.marginRight={get:function(a,b){return b?fb.swap(a,{display:"inline-block"},Qb,[a,"marginRight"]):void 0}}),!fb.support.pixelPosition&&fb.fn.position&&fb.each(["top","left"],function(a,b){fb.cssHooks[b]={get:function(a,c){return c?(c=Qb(a,b),Vb.test(c)?fb(a).position()[b]+"px":c):void 0}}})}),fb.expr&&fb.expr.filters&&(fb.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},fb.expr.filters.visible=function(a){return!fb.expr.filters.hidden(a)}),fb.each({margin:"",padding:"",border:"Width"},function(a,b){fb.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+$b[d]+b]=f[d]||f[d-2]||f[0];return e}},Tb.test(a)||(fb.cssHooks[a+b].set=w)});var ac=/%20/g,bc=/\[\]$/,cc=/\r?\n/g,dc=/^(?:submit|button|image|reset|file)$/i,ec=/^(?:input|select|textarea|keygen)/i;fb.fn.extend({serialize:function(){return fb.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=fb.prop(this,"elements");return a?fb.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!fb(this).is(":disabled")&&ec.test(this.nodeName)&&!dc.test(a)&&(this.checked||!Kb.test(a))}).map(function(a,b){var c=fb(this).val();return null==c?null:fb.isArray(c)?fb.map(c,function(a){return{name:b.name,value:a.replace(cc,"\r\n")}}):{name:b.name,value:c.replace(cc,"\r\n")}}).get()}}),fb.param=function(a,c){var d,e=[],f=function(a,b){b=fb.isFunction(b)?b():null==b?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(c===b&&(c=fb.ajaxSettings&&fb.ajaxSettings.traditional),fb.isArray(a)||a.jquery&&!fb.isPlainObject(a))fb.each(a,function(){f(this.name,this.value)});else for(d in a)B(d,a[d],c,f);return e.join("&").replace(ac,"+")},fb.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){fb.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),fb.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var fc,gc,hc=fb.now(),ic=/\?/,jc=/#.*$/,kc=/([?&])_=[^&]*/,lc=/^(.*?):[ \t]*([^\r\n]*)$/gm,mc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,nc=/^(?:GET|HEAD)$/,oc=/^\/\//,pc=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,qc=fb.fn.load,rc={},sc={},tc="*/".concat("*");try{gc=S.href}catch(uc){gc=T.createElement("a"),gc.href="",gc=gc.href}fc=pc.exec(gc.toLowerCase())||[],fb.fn.load=function(a,c,d){if("string"!=typeof a&&qc)return qc.apply(this,arguments);var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i),a=a.slice(0,i)),fb.isFunction(c)?(d=c,c=b):c&&"object"==typeof c&&(f="POST"),h.length>0&&fb.ajax({url:a,type:f,dataType:"html",data:c}).done(function(a){g=arguments,h.html(e?fb("<div>").append(fb.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,g||[a.responseText,b,a])}),this},fb.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){fb.fn[b]=function(a){return this.on(b,a)}}),fb.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:gc,type:"GET",isLocal:mc.test(fc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":tc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":fb.parseJSON,"text xml":fb.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?E(E(a,fb.ajaxSettings),b):E(fb.ajaxSettings,a)},ajaxPrefilter:C(rc),ajaxTransport:C(sc),ajax:function(a,c){function d(a,c,d,h){var j,l,s,t,v,x=c;2!==u&&(u=2,i&&clearTimeout(i),e=b,g=h||"",w.readyState=a>0?4:0,j=a>=200&&300>a||304===a,d&&(t=F(m,w,d)),t=G(m,t,w,j),j?(m.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(fb.lastModified[f]=v),v=w.getResponseHeader("etag"),v&&(fb.etag[f]=v)),204===a||"HEAD"===m.type?x="nocontent":304===a?x="notmodified":(x=t.state,l=t.data,s=t.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),w.status=a,w.statusText=(c||x)+"",j?p.resolveWith(n,[l,x,w]):p.rejectWith(n,[w,x,s]),w.statusCode(r),r=b,k&&o.trigger(j?"ajaxSuccess":"ajaxError",[w,m,j?l:s]),q.fireWith(n,[w,x]),k&&(o.trigger("ajaxComplete",[w,m]),--fb.active||fb.event.trigger("ajaxStop")))}"object"==typeof a&&(c=a,a=b),c=c||{};var e,f,g,h,i,j,k,l,m=fb.ajaxSetup({},c),n=m.context||m,o=m.context&&(n.nodeType||n.jquery)?fb(n):fb.event,p=fb.Deferred(),q=fb.Callbacks("once memory"),r=m.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!h)for(h={};b=lc.exec(g);)h[b[1].toLowerCase()]=b[2];b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return e&&e.abort(b),d(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,m.url=((a||m.url||gc)+"").replace(jc,"").replace(oc,fc[1]+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=fb.trim(m.dataType||"*").toLowerCase().match(hb)||[""],null==m.crossDomain&&(j=pc.exec(m.url.toLowerCase()),m.crossDomain=!(!j||j[1]===fc[1]&&j[2]===fc[2]&&(j[3]||("http:"===j[1]?"80":"443"))===(fc[3]||("http:"===fc[1]?"80":"443")))),m.data&&m.processData&&"string"!=typeof m.data&&(m.data=fb.param(m.data,m.traditional)),D(rc,m,c,w),2===u)return w;k=m.global,k&&0===fb.active++&&fb.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!nc.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(ic.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=kc.test(f)?f.replace(kc,"$1_="+hc++):f+(ic.test(f)?"&":"?")+"_="+hc++)),m.ifModified&&(fb.lastModified[f]&&w.setRequestHeader("If-Modified-Since",fb.lastModified[f]),fb.etag[f]&&w.setRequestHeader("If-None-Match",fb.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",m.contentType),w.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+tc+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)w.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(n,w,m)===!1||2===u))return w.abort();v="abort";for(l in{success:1,error:1,complete:1})w[l](m[l]);if(e=D(sc,m,c,w)){w.readyState=1,k&&o.trigger("ajaxSend",[w,m]),m.async&&m.timeout>0&&(i=setTimeout(function(){w.abort("timeout")},m.timeout));try{u=1,e.send(s,d)}catch(x){if(!(2>u))throw x;d(-1,x)}}else d(-1,"No Transport");return w},getJSON:function(a,b,c){return fb.get(a,b,c,"json")},getScript:function(a,c){return fb.get(a,b,c,"script")}}),fb.each(["get","post"],function(a,c){fb[c]=function(a,d,e,f){return fb.isFunction(d)&&(f=f||e,e=d,d=b),fb.ajax({url:a,type:c,dataType:f,data:d,success:e})}}),fb.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return fb.globalEval(a),a}}}),fb.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),fb.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=fb("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),T.head.appendChild(b[0])},abort:function(){c&&c()}}}});var vc=[],wc=/(=)\?(?=&|$)|\?\?/;fb.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=vc.pop()||fb.expando+"_"+hc++;return this[a]=!0,a}}),fb.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.jsonp!==!1&&(wc.test(c.url)?"url":"string"==typeof c.data&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&wc.test(c.data)&&"data");return i||"jsonp"===c.dataTypes[0]?(f=c.jsonpCallback=fb.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,i?c[i]=c[i].replace(wc,"$1"+f):c.jsonp!==!1&&(c.url+=(ic.test(c.url)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||fb.error(f+" was not called"),h[0]},c.dataTypes[0]="json",g=a[f],a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,vc.push(f)),h&&fb.isFunction(g)&&g(h[0]),h=g=b}),"script"):void 0}),fb.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var xc=fb.ajaxSettings.xhr(),yc={0:200,1223:204},zc=0,Ac={};a.ActiveXObject&&fb(a).on("unload",function(){for(var a in Ac)Ac[a]();Ac=b}),fb.support.cors=!!xc&&"withCredentials"in xc,fb.support.ajax=xc=!!xc,fb.ajaxTransport(function(a){var c;return fb.support.cors||xc&&!a.crossDomain?{send:function(d,e){var f,g,h=a.xhr();if(h.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(f in a.xhrFields)h[f]=a.xhrFields[f];a.mimeType&&h.overrideMimeType&&h.overrideMimeType(a.mimeType),a.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)h.setRequestHeader(f,d[f]);c=function(a){return function(){c&&(delete Ac[g],c=h.onload=h.onerror=null,"abort"===a?h.abort():"error"===a?e(h.status||404,h.statusText):e(yc[h.status]||h.status,h.statusText,"string"==typeof h.responseText?{text:h.responseText}:b,h.getAllResponseHeaders()))}},h.onload=c(),h.onerror=c("error"),c=Ac[g=zc++]=c("abort"),h.send(a.hasContent&&a.data||null)},abort:function(){c&&c()}}:void 0});var Bc,Cc,Dc=/^(?:toggle|show|hide)$/,Ec=new RegExp("^(?:([+-])=|)("+gb+")([a-z%]*)$","i"),Fc=/queueHooks$/,Gc=[L],Hc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ec.exec(b),f=e&&e[3]||(fb.cssNumber[a]?"":"px"),g=(fb.cssNumber[a]||"px"!==f&&+d)&&Ec.exec(fb.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,fb.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};fb.Animation=fb.extend(J,{tweener:function(a,b){fb.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Hc[c]=Hc[c]||[],Hc[c].unshift(b)},prefilter:function(a,b){b?Gc.unshift(a):Gc.push(a)}}),fb.Tween=M,M.prototype={constructor:M,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(fb.cssNumber[c]?"":"px")},cur:function(){var a=M.propHooks[this.prop];return a&&a.get?a.get(this):M.propHooks._default.get(this)},run:function(a){var b,c=M.propHooks[this.prop];return this.pos=b=this.options.duration?fb.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):M.propHooks._default.set(this),this}},M.prototype.init.prototype=M.prototype,M.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=fb.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){fb.fx.step[a.prop]?fb.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[fb.cssProps[a.prop]]||fb.cssHooks[a.prop])?fb.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},M.propHooks.scrollTop=M.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},fb.each(["toggle","show","hide"],function(a,b){var c=fb.fn[b];fb.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(N(b,!0),a,d,e)}}),fb.fn.extend({fadeTo:function(a,b,c,d){return this.filter(t).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=fb.isEmptyObject(a),f=fb.speed(b,c,d),g=function(){var b=J(this,fb.extend({},a),f);(e||qb.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return"string"!=typeof a&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=null!=a&&a+"queueHooks",f=fb.timers,g=qb.get(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&Fc.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem!==this||null!=a&&f[c].queue!==a||(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&fb.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=qb.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=fb.timers,g=d?d.length:0;for(c.finish=!0,fb.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),fb.each({slideDown:N("show"),slideUp:N("hide"),slideToggle:N("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){fb.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),fb.speed=function(a,b,c){var d=a&&"object"==typeof a?fb.extend({},a):{complete:c||!c&&b||fb.isFunction(a)&&a,duration:a,easing:c&&b||b&&!fb.isFunction(b)&&b};return d.duration=fb.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in fb.fx.speeds?fb.fx.speeds[d.duration]:fb.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){fb.isFunction(d.old)&&d.old.call(this),d.queue&&fb.dequeue(this,d.queue)},d},fb.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},fb.timers=[],fb.fx=M.prototype.init,fb.fx.tick=function(){var a,c=fb.timers,d=0;for(Bc=fb.now();d<c.length;d++)a=c[d],a()||c[d]!==a||c.splice(d--,1);c.length||fb.fx.stop(),Bc=b},fb.fx.timer=function(a){a()&&fb.timers.push(a)&&fb.fx.start()},fb.fx.interval=13,fb.fx.start=function(){Cc||(Cc=setInterval(fb.fx.tick,fb.fx.interval))},fb.fx.stop=function(){clearInterval(Cc),Cc=null},fb.fx.speeds={slow:600,fast:200,_default:400},fb.fx.step={},fb.expr&&fb.expr.filters&&(fb.expr.filters.animated=function(a){return fb.grep(fb.timers,function(b){return a===b.elem}).length}),fb.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){fb.offset.setOffset(this,a,b)});var c,d,e=this[0],f={top:0,left:0},g=e&&e.ownerDocument;if(g)return c=g.documentElement,fb.contains(c,e)?(typeof e.getBoundingClientRect!==R&&(f=e.getBoundingClientRect()),d=O(g),{top:f.top+d.pageYOffset-c.clientTop,left:f.left+d.pageXOffset-c.clientLeft}):f},fb.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=fb.css(a,"position"),l=fb(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=fb.css(a,"top"),i=fb.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),fb.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},fb.fn.extend({position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===fb.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),fb.nodeName(a[0],"html")||(d=a.offset()),d.top+=fb.css(a[0],"borderTopWidth",!0),d.left+=fb.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-fb.css(c,"marginTop",!0),left:b.left-d.left-fb.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||U;a&&!fb.nodeName(a,"html")&&"static"===fb.css(a,"position");)a=a.offsetParent;return a||U})}}),fb.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(c,d){var e="pageYOffset"===d;fb.fn[c]=function(f){return fb.access(this,function(c,f,g){var h=O(c);return g===b?h?h[d]:c[f]:(h?h.scrollTo(e?a.pageXOffset:g,e?g:a.pageYOffset):c[f]=g,void 0)},c,f,arguments.length,null)}}),fb.each({Height:"height",Width:"width"},function(a,c){fb.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){fb.fn[e]=function(e,f){var g=arguments.length&&(d||"boolean"!=typeof e),h=d||(e===!0||f===!0?"margin":"border");return fb.access(this,function(c,d,e){var f;return fb.isWindow(c)?c.document.documentElement["client"+a]:9===c.nodeType?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?fb.css(c,d,h):fb.style(c,d,e,h)},c,g?e:b,g,null)}})}),fb.fn.size=function(){return this.length},fb.fn.andSelf=fb.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=fb:"function"==typeof define&&define.amd&&define("jquery",[],function(){return fb}),"object"==typeof a&&"object"==typeof a.document&&(a.jQuery=a.$=fb)}(window),function(a,b){"function"==typeof define&&define.amd?define([],b):a.Vectorizer=a.V=b()}(this,function(){function a(){var a=++l+"";return"v-"+a}function b(a,b,d){if(!a)return void 0;if("object"==typeof a)return new h(a);if(b=b||{},"svg"===a.toLowerCase())b.xmlns=j.xmlns,b["xmlns:xlink"]=j.xlink,b.version=k;else if("<"===a[0]){var e='<svg xmlns="'+j.xmlns+'" xmlns:xlink="'+j.xlink+'" version="'+k+'">'+a+"</svg>",f=new DOMParser;f.async=!1;var g=f.parseFromString(e,"text/xml").documentElement;if(g.childNodes.length>1){for(var i=[],l=0,m=g.childNodes.length;m>l;l++){var n=g.childNodes[l];i.push(new h(document.importNode(n,!0)))}return i}return new h(document.importNode(g.firstChild,!0))}a=document.createElementNS(j.xmlns,a);for(var o in b)c(a,o,b[o]);"[object Array]"!=Object.prototype.toString.call(d)&&(d=[d]);for(var p,l=0,m=d[0]&&d.length||0;m>l;l++)p=d[l],a.appendChild(p instanceof h?p.node:p);return new h(a)}function c(a,b,c){if(b.indexOf(":")>-1){var d=b.split(":");a.setAttributeNS(j[d[0]],d[1],c)}else"id"===b?a.id=c:a.setAttribute(b,c)}function d(a){var b,c,d;if(a){var e=a.match(/translate\((.*)\)/);e&&(b=e[1].split(","));var f=a.match(/rotate\((.*)\)/);f&&(c=f[1].split(","));var g=a.match(/scale\((.*)\)/);g&&(d=g[1].split(","))}var h=d&&d[0]?parseFloat(d[0]):1;return{translate:{tx:b&&b[0]?parseInt(b[0],10):0,ty:b&&b[1]?parseInt(b[1],10):0},rotate:{angle:c&&c[0]?parseInt(c[0],10):0,cx:c&&c[1]?parseInt(c[1],10):void 0,cy:c&&c[2]?parseInt(c[2],10):void 0},scale:{sx:h,sy:d&&d[1]?parseFloat(d[1]):h}}}function e(a,b){var c=b.x*a.a+b.y*a.c+0,d=b.x*a.b+b.y*a.d+0;return{x:c,y:d}}function f(a){var b=e(a,{x:0,y:1}),c=e(a,{x:1,y:0}),d=180/Math.PI*Math.atan2(b.y,b.x)-90,f=180/Math.PI*Math.atan2(c.y,c.x);return{translateX:a.e,translateY:a.f,scaleX:Math.sqrt(a.a*a.a+a.b*a.b),scaleY:Math.sqrt(a.c*a.c+a.d*a.d),skewX:d,skewY:f,rotation:d}}function h(b){this.node=b,this.node.id||(this.node.id=a())}function i(a){var b=a.rx||a["top-rx"]||0,c=a.rx||a["bottom-rx"]||0,d=a.ry||a["top-ry"]||0,e=a.ry||a["bottom-ry"]||0;return["M",a.x,a.y+d,"v",a.height-d-e,"a",c,e,0,0,0,c,e,"h",a.width-2*c,"a",c,e,0,0,0,c,-e,"v",-(a.height-e-d),"a",b,d,0,0,0,-b,-d,"h",-(a.width-2*b),"a",b,d,0,0,0,-b,d].join(" ")}!(!window.SVGAngle&&!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"));var j={xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"},k="1.1",l=0;h.prototype={translate:function(a,b){b=b||0;var c=this.attr("transform")||"",e=d(c);if("undefined"==typeof a)return e.translate;c=c.replace(/translate\([^\)]*\)/g,"").trim();var f=e.translate.tx+a,g=e.translate.ty+b;return this.attr("transform","translate("+f+","+g+") "+c),this},rotate:function(a,b,c){var e=this.attr("transform")||"",f=d(e);if("undefined"==typeof a)return f.rotate;e=e.replace(/rotate\([^\)]*\)/g,"").trim();var g=f.rotate.angle+a%360,h=void 0!==b&&void 0!==c?","+b+","+c:"";return this.attr("transform",e+" rotate("+g+h+")"),this},scale:function(a,b){b="undefined"==typeof b?a:b;var c=this.attr("transform")||"",e=d(c);return"undefined"==typeof a?e.scale:(c=c.replace(/scale\([^\)]*\)/g,"").trim(),this.attr("transform",c+" scale("+a+","+b+")"),this)},bbox:function(a,b){if(!this.node.ownerSVGElement)return{x:0,y:0,width:0,height:0};var c;try{c=this.node.getBBox(),c={x:0|c.x,y:0|c.y,width:0|c.width,height:0|c.height}}catch(d){c={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}if(a)return c;var e=this.node.getTransformToElement(b||this.node.ownerSVGElement),f=[],g=this.node.ownerSVGElement.createSVGPoint();g.x=c.x,g.y=c.y,f.push(g.matrixTransform(e)),g.x=c.x+c.width,g.y=c.y,f.push(g.matrixTransform(e)),g.x=c.x+c.width,g.y=c.y+c.height,f.push(g.matrixTransform(e)),g.x=c.x,g.y=c.y+c.height,f.push(g.matrixTransform(e));for(var h=f[0].x,i=h,j=f[0].y,k=j,l=1,m=f.length;m>l;l++){var n=f[l].x,o=f[l].y;h>n?h=n:n>i&&(i=n),j>o?j=o:o>k&&(k=o)}return{x:h,y:j,width:i-h,height:k-j}},text:function(a){var b,c=a.split("\n"),d=0;if(this.attr("y","0.8em"),this.attr("display",a?null:"none"),1===c.length)return this.node.textContent=a,this;for(this.node.textContent="";d<c.length;d++)b=m("tspan",{dy:0==d?"0em":"1em",x:this.attr("x")||0}),b.node.textContent=c[d],this.append(b);return this},attr:function(a,b){if("string"==typeof a&&"undefined"==typeof b)return this.node.getAttribute(a);if("object"==typeof a)for(var d in a)a.hasOwnProperty(d)&&c(this.node,d,a[d]);else c(this.node,a,b);return this},remove:function(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)},append:function(a){var b=a;"[object Array]"!==Object.prototype.toString.call(a)&&(b=[a]);for(var c=0,d=b.length;d>c;c++)a=b[c],this.node.appendChild(a instanceof h?a.node:a);return this},prepend:function(a){this.node.insertBefore(a instanceof h?a.node:a,this.node.firstChild)},svg:function(){return this.node instanceof window.SVGSVGElement?this:m(this.node.ownerSVGElement)},defs:function(){var a=this.svg().node.getElementsByTagName("defs");return a&&a.length?m(a[0]):void 0},clone:function(){var b=m(this.node.cloneNode(!0));return b.node.id=a(),b},findOne:function(a){var b=this.node.querySelector(a);return b?m(b):void 0},find:function(a){for(var b=this.node.querySelectorAll(a),c=0,d=b.length;d>c;c++)b[c]=m(b[c]);return b},toLocalPoint:function(a,b){var c=this.svg().node,d=c.createSVGPoint();d.x=a,d.y=b;try{var e=d.matrixTransform(c.getScreenCTM().inverse()),f=this.node.getTransformToElement(c).inverse()}catch(g){return d}return e.matrixTransform(f)},translateCenterToPoint:function(a){var b=this.bbox(),c=g.rect(b).center();this.translate(a.x-c.x,a.y-c.y)},translateAndAutoOrient:function(a,b,c){var d=this.scale();this.attr("transform",""),this.scale(d.sx,d.sy);var e=this.svg().node,h=this.bbox(!1,c),i=e.createSVGTransform();i.setTranslate(-h.x-h.width/2,-h.y-h.height/2);var j=e.createSVGTransform(),k=g.point(a).changeInAngle(a.x-b.x,a.y-b.y,b);j.setRotate(k,0,0);var l=e.createSVGTransform(),m=g.point(a).move(b,h.width/2);l.setTranslate(a.x+(a.x-m.x),a.y+(a.y-m.y));var n=this.node.getTransformToElement(c),o=e.createSVGTransform();o.setMatrix(l.matrix.multiply(j.matrix.multiply(i.matrix.multiply(n))));var p=f(o.matrix);return this.translate(p.translateX,p.translateY),this.rotate(p.rotation),this},animateAlongPath:function(a,b){var c=m("animateMotion",a),d=m("mpath",{"xlink:href":"#"+m(b).node.id});c.append(d),this.append(c);try{c.node.beginElement()}catch(e){if("fake"===document.documentElement.getAttribute("smiling")){var f=c.node;f.animators=[];var g=f.getAttribute("id");g&&(id2anim[g]=f);for(var h=getTargets(f),i=0,j=h.length;j>i;i++){var k=h[i],l=new Animator(f,k,i);animators.push(l),f.animators[i]=l,l.register()}}}},hasClass:function(a){return new RegExp("(\\s|^)"+a+"(\\s|$)").test(this.node.getAttribute("class"))},addClass:function(a){return this.hasClass(a)||this.node.setAttribute("class",this.node.getAttribute("class")+" "+a),this},removeClass:function(a){var b=this.node.getAttribute("class").replace(new RegExp("(\\s|^)"+a+"(\\s|$)","g"),"$2");return this.hasClass(a)&&this.node.setAttribute("class",b),this},toggleClass:function(a,b){var c="undefined"==typeof b?this.hasClass(a):!b;return c?this.removeClass(a):this.addClass(a),this}};var m=b;m.decomposeMatrix=f,m.rectToPath=i;var n=m("svg").node;return m.createSVGMatrix=function(a){var b=n.createSVGMatrix();for(var c in a)b[c]=a[c];return b},m.createSVGTransform=function(){return n.createSVGTransform()},m.createSVGPoint=function(a,b){var c=n.createSVGPoint();return c.x=a,c.y=b,c},m}),function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.g=b()}(this,function(){function a(b,c){if(!(this instanceof a))return new a(b,c);var d;void 0===c&&Object(b)!==b?(d=b.split(-1===b.indexOf("@")?" ":"@"),this.x=parseInt(d[0],10),this.y=parseInt(d[1],10)):Object(b)===b?(this.x=b.x,this.y=b.y):(this.x=b,this.y=c)}function b(c,d){return this instanceof b?(this.start=a(c),this.end=a(d),void 0):new b(c,d)}function c(a,b,d,e){return this instanceof c?(void 0===b&&(b=a.y,d=a.width,e=a.height,a=a.x),this.x=a,this.y=b,this.width=d,this.height=e,void 0):new c(a,b,d,e)}function d(b,c,e){return this instanceof d?(b=a(b),this.x=b.x,this.y=b.y,this.a=c,this.b=e,void 0):new d(b,c,e)}var e=Math,f=e.abs,g=e.cos,h=e.sin,i=e.sqrt,j=e.min,k=e.max;e.atan;var l=e.atan2;e.acos;var m=e.round,n=e.floor,o=e.PI,p=e.random,q=function(a){return 180*a/o%360},r=function(a){return a%360*o/180},s=function(a,b){return b*Math.round(a/b)},t=function(a){return a%360+(0>a?360:0)};a.prototype={toString:function(){return this.x+"@"+this.y},adhereToRect:function(a){return a.containsPoint(this)?this:(this.x=j(k(this.x,a.x),a.x+a.width),this.y=j(k(this.y,a.y),a.y+a.height),this)},theta:function(b){b=a(b);var c=-(b.y-this.y),d=b.x-this.x,e=10,f=0==c.toFixed(e)&&0==d.toFixed(e)?0:l(c,d);return 0>f&&(f=2*o+f),180*f/o},distance:function(a){return b(this,a).length()},manhattanDistance:function(a){return f(a.x-this.x)+f(a.y-this.y)},offset:function(a,b){return this.x+=a||0,this.y+=b||0,this},magnitude:function(){return i(this.x*this.x+this.y*this.y)||.01},update:function(a,b){return this.x=a||0,this.y=b||0,this},round:function(a){return this.x=a?this.x.toFixed(a):m(this.x),this.y=a?this.y.toFixed(a):m(this.y),this},normalize:function(a){var b=(a||1)/this.magnitude();return this.x=b*this.x,this.y=b*this.y,this},difference:function(b){return a(this.x-b.x,this.y-b.y)},bearing:function(a){return b(this,a).bearing()},toPolar:function(b){b=b&&a(b)||a(0,0);var c=this.x,d=this.y;return this.x=i((c-b.x)*(c-b.x)+(d-b.y)*(d-b.y)),this.y=r(b.theta(a(c,d))),this},rotate:function(b,c){c=(c+360)%360,this.toPolar(b),this.y+=r(c);var d=a.fromPolar(this.x,this.y,b);return this.x=d.x,this.y=d.y,this},move:function(b,c){var d=r(a(b).theta(this));return this.offset(g(d)*c,-h(d)*c)},changeInAngle:function(b,c,d){return a(this).offset(-b,-c).theta(d)-this.theta(d)},equals:function(a){return this.x===a.x&&this.y===a.y},snapToGrid:function(a,b){return this.x=s(this.x,a),this.y=s(this.y,b||a),this}},a.fromPolar=function(b,c,d){d=d&&a(d)||a(0,0);var e=f(b*g(c)),i=f(b*h(c)),j=t(q(c));return 90>j?i=-i:180>j?(e=-e,i=-i):270>j&&(e=-e),a(d.x+e,d.y+i)},a.random=function(b,c,d,e){return a(n(p()*(c-b+1)+b),n(p()*(e-d+1)+d))},b.prototype={toString:function(){return this.start.toString()+" "+this.end.toString()},length:function(){return i(this.squaredLength())},squaredLength:function(){var a=this.start.x,b=this.start.y,c=this.end.x,d=this.end.y;return(a-=c)*a+(b-=d)*b},midpoint:function(){return a((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)},intersection:function(b){var c=a(this.end.x-this.start.x,this.end.y-this.start.y),d=a(b.end.x-b.start.x,b.end.y-b.start.y),e=c.x*d.y-c.y*d.x,f=a(b.start.x-this.start.x,b.start.y-this.start.y),g=f.x*d.y-f.y*d.x,h=f.x*c.y-f.y*c.x;if(0===e||0>g*e||0>h*e)return null;if(e>0){if(g>e||h>e)return null}else if(e>g||e>h)return null;return a(this.start.x+g*c.x/e,this.start.y+g*c.y/e)},bearing:function(){var a=r(this.start.y),b=r(this.end.y),c=this.start.x,d=this.end.x,e=r(d-c),f=h(e)*g(b),i=g(a)*h(b)-h(a)*g(b)*g(e),j=q(l(f,i)),k=["NE","E","SE","S","SW","W","NW","N"],m=j-22.5;return 0>m&&(m+=360),m=parseInt(m/45),k[m]}},c.prototype={toString:function(){return this.origin().toString()+" "+this.corner().toString()},origin:function(){return a(this.x,this.y)},corner:function(){return a(this.x+this.width,this.y+this.height)},topRight:function(){return a(this.x+this.width,this.y)},bottomLeft:function(){return a(this.x,this.y+this.height)},center:function(){return a(this.x+this.width/2,this.y+this.height/2)},intersect:function(a){var b=this.origin(),c=this.corner(),d=a.origin(),e=a.corner();return e.x<=b.x||e.y<=b.y||d.x>=c.x||d.y>=c.y?!1:!0},sideNearestToPoint:function(b){b=a(b);var c=b.x-this.x,d=this.x+this.width-b.x,e=b.y-this.y,f=this.y+this.height-b.y,g=c,h="left";return g>d&&(g=d,h="right"),g>e&&(g=e,h="top"),g>f&&(g=f,h="bottom"),h},containsPoint:function(b){return b=a(b),b.x>=this.x&&b.x<=this.x+this.width&&b.y>=this.y&&b.y<=this.y+this.height?!0:!1},containsRect:function(a){var b=c(a).normalize(),d=b.width,e=b.height,f=b.x,g=b.y,h=this.width,i=this.height;if(0>(h|i|d|e))return!1;var j=this.x,k=this.y;if(j>f||k>g)return!1;if(h+=j,d+=f,f>=d){if(h>=j||d>h)return!1}else if(h>=j&&d>h)return!1;if(i+=k,e+=g,g>=e){if(i>=k||e>i)return!1}else if(i>=k&&e>i)return!1;return!0},pointNearestToPoint:function(b){if(b=a(b),this.containsPoint(b)){var c=this.sideNearestToPoint(b);switch(c){case"right":return a(this.x+this.width,b.y);case"left":return a(this.x,b.y);case"bottom":return a(b.x,this.y+this.height);case"top":return a(b.x,this.y)}}return b.adhereToRect(this)},intersectionWithLineFromCenterToPoint:function(c,d){c=a(c); var e,f=a(this.x+this.width/2,this.y+this.height/2);d&&c.rotate(f,d);for(var g=[b(this.origin(),this.topRight()),b(this.topRight(),this.corner()),b(this.corner(),this.bottomLeft()),b(this.bottomLeft(),this.origin())],h=b(f,c),i=g.length-1;i>=0;--i){var j=g[i].intersection(h);if(null!==j){e=j;break}}return e&&d&&e.rotate(f,-d),e},moveAndExpand:function(a){return this.x+=a.x,this.y+=a.y,this.width+=a.width,this.height+=a.height,this},round:function(a){return this.x=a?this.x.toFixed(a):m(this.x),this.y=a?this.y.toFixed(a):m(this.y),this.width=a?this.width.toFixed(a):m(this.width),this.height=a?this.height.toFixed(a):m(this.height),this},normalize:function(){var a=this.x,b=this.y,c=this.width,d=this.height;return this.width<0&&(a=this.x+this.width,c=-this.width),this.height<0&&(b=this.y+this.height,d=-this.height),this.x=a,this.y=b,this.width=c,this.height=d,this}},d.prototype={toString:function(){return a(this.x,this.y).toString()+" "+this.a+" "+this.b},bbox:function(){return c(this.x-this.a,this.y-this.b,2*this.a,2*this.b)},intersectionWithLineFromCenterToPoint:function(b,c){b=a(b),c&&b.rotate(a(this.x,this.y),c);var d,e=b.x-this.x,f=b.y-this.y;if(0===e)return d=this.bbox().pointNearestToPoint(b),c?d.rotate(a(this.x,this.y),-c):d;var g=f/e,h=g*g,j=this.a*this.a,k=this.b*this.b,l=i(1/(1/j+h/k));l=0>e?-l:l;var m=g*l;return d=a(this.x+l,this.y+m),c?d.rotate(a(this.x,this.y),-c):d}};var u={curveThroughPoints:function(a){for(var b=this.getCurveControlPoints(a),c=["M",a[0].x,a[0].y],d=0;d<b[0].length;d++)c.push("C",b[0][d].x,b[0][d].y,b[1][d].x,b[1][d].y,a[d+1].x,a[d+1].y);return c},getCurveControlPoints:function(b){var c,d=[],e=[],f=b.length-1;if(1==f)return d[0]=a((2*b[0].x+b[1].x)/3,(2*b[0].y+b[1].y)/3),e[0]=a(2*d[0].x-b[0].x,2*d[0].y-b[0].y),[d,e];var g=[];for(c=1;f-1>c;c++)g[c]=4*b[c].x+2*b[c+1].x;g[0]=b[0].x+2*b[1].x,g[f-1]=(8*b[f-1].x+b[f].x)/2;var h=this.getFirstControlPoints(g);for(c=1;f-1>c;++c)g[c]=4*b[c].y+2*b[c+1].y;g[0]=b[0].y+2*b[1].y,g[f-1]=(8*b[f-1].y+b[f].y)/2;var i=this.getFirstControlPoints(g);for(c=0;f>c;c++)d.push(a(h[c],i[c])),f-1>c?e.push(a(2*b[c+1].x-h[c+1],2*b[c+1].y-i[c+1])):e.push(a((b[f].x+h[f-1])/2,(b[f].y+i[f-1])/2));return[d,e]},getFirstControlPoints:function(a){var b=a.length,c=[],d=[],e=2;c[0]=a[0]/e;for(var f=1;b>f;f++)d[f]=1/e,e=(b-1>f?4:3.5)-d[f],c[f]=(a[f]-c[f-1])/e;for(f=1;b>f;f++)c[b-f-1]-=d[b-f]*c[b-f];return c}},v={linear:function(a,b,c){var d=a[1]-a[0],e=b[1]-b[0];return(c-a[0])/d*e+b[0]||0}};return{toDeg:q,toRad:r,snapToGrid:s,normalizeAngle:t,point:a,line:b,rect:c,ellipse:d,bezier:u,scale:v}}),"object"==typeof exports)var _=require("lodash");var joint={dia:{},ui:{},layout:{},shapes:{},format:{},connectors:{},routers:{},util:{hashCode:function(a){var b=0;if(0==a.length)return b;for(var c=0;c<a.length;c++){var d=a.charCodeAt(c);b=(b<<5)-b+d,b&=b}return b},getByPath:function(a,b,c){c=c||".";for(var d,e=b.split(c);e.length;){if(d=e.shift(),!(d in a))return void 0;a=a[d]}return a},setByPath:function(a,b,c,d){d=d||".";var e=b.split(d),f=a,g=0;if(b.indexOf(d)>-1){for(var h=e.length;h-1>g;g++)f=f[e[g]]||(f[e[g]]={});f[e[h-1]]=c}else a[b]=c;return a},unsetByPath:function(a,b,c){c=c||".";var d=b.lastIndexOf(c);if(d>-1){var e=joint.util.getByPath(a,b.substr(0,d),c);e&&delete e[b.slice(d+1)]}else delete a[b];return a},flattenObject:function(a,b,c){b=b||".";var d={};for(var e in a)if(a.hasOwnProperty(e)){var f="object"==typeof a[e];if(f&&c&&c(a[e])&&(f=!1),f){var g=this.flattenObject(a[e],b,c);for(var h in g)g.hasOwnProperty(h)&&(d[e+b+h]=g[h])}else d[e]=a[e]}return d},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"==a?b:8|3&b;return c.toString(16)})},guid:function(a){return this.guid.id=this.guid.id||1,a.id=void 0===a.id?"j_"+this.guid.id++:a.id,a.id},mixin:function(){for(var a=arguments[0],b=1,c=arguments.length;c>b;b++){var d=arguments[b];(Object(d)===d||_.isFunction(d)||null!==d&&void 0!==d)&&_.each(d,function(b,c){return this.mixin.deep&&Object(b)===b?(a[c]||(a[c]=_.isArray(b)?[]:{}),this.mixin(a[c],b),void 0):(a[c]!==b&&(this.mixin.supplement&&a.hasOwnProperty(c)||(a[c]=b)),void 0)},this)}return a},supplement:function(){this.mixin.supplement=!0;var a=this.mixin.apply(this,arguments);return this.mixin.supplement=!1,a},deepMixin:function(){this.mixin.deep=!0;var a=this.mixin.apply(this,arguments);return this.mixin.deep=!1,a},deepSupplement:function(){this.mixin.deep=this.mixin.supplement=!0;var a=this.mixin.apply(this,arguments);return this.mixin.deep=this.mixin.supplement=!1,a},normalizeEvent:function(a){return a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches.length?a.originalEvent.changedTouches[0]:a},nextFrame:function(){var a,b="undefined"!=typeof window;if(b&&(a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame),!a){var c=0;a=function(a){var b=(new Date).getTime(),d=Math.max(0,16-(b-c)),e=setTimeout(function(){a(b+d)},d);return c=b+d,e}}return b?_.bind(a,window):a}(),cancelFrame:function(){var a,b="undefined"!=typeof window;return b&&(a=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame),a=a||clearTimeout,b?_.bind(a,window):a}(),breakText:function(a,b,c,d){d=d||{};var e=b.width,f=b.height,g=d.svgDocument||V("svg").node,h=V("<text><tspan></tspan></text>").attr(c||{}).node,i=h.firstChild,j=document.createTextNode("");i.appendChild(j),g.appendChild(h),d.svgDocument||document.body.appendChild(g);for(var k,l=a.split(" "),m=[],n=[],o=0,p=0,q=l.length;q>o;o++){var r=l[o];if(j.data=n[p]?n[p]+" "+r:r,i.getComputedTextLength()<=e)n[p]=j.data,k&&(m[p++]=!0,k=0);else{if(!n[p]||k){var s=!!k;if(k=r.length-1,s||!k){if(!k){if(!n[p]){n=[];break}l.splice(o,2,r+l[o+1]),q--,m[p++]=!0,o--;continue}l[o]=r.substring(0,k),l[o+1]=r.substring(k)+l[o+1]}else l.splice(o,1,r.substring(0,k),r.substring(k)),q++,p&&!m[p-1]&&p--;o--;continue}p++,o--}if("undefined"!=typeof f){var t=t||1.25*h.getBBox().height;if(t*n.length>f){n.splice(Math.floor(f/t));break}}}return d.svgDocument?g.removeChild(h):document.body.removeChild(g),n.join("\n")},timing:{linear:function(a){return a},quad:function(a){return a*a},cubic:function(a){return a*a*a},inout:function(a){if(0>=a)return 0;if(a>=1)return 1;var b=a*a,c=b*a;return 4*(.5>a?c:3*(a-b)+c-.75)},exponential:function(a){return Math.pow(2,10*(a-1))},bounce:function(a){for(var b=0,c=1;1;b+=c,c/=2)if(a>=(7-4*b)/11){var d=(11-6*b-11*a)/4;return-d*d+c*c}},reverse:function(a){return function(b){return 1-a(1-b)}},reflect:function(a){return function(b){return.5*(.5>b?a(2*b):2-a(2-2*b))}},clamp:function(a,b,c){return b=b||0,c=c||1,function(d){var e=a(d);return b>e?b:e>c?c:e}},back:function(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}},elastic:function(a){return a||(a=1.5),function(b){return Math.pow(2,10*(b-1))*Math.cos(20*Math.PI*a/3*b)}}},interpolate:{number:function(a,b){var c=b-a;return function(b){return a+c*b}},object:function(a,b){var c=_.keys(a);return function(d){var e,f,g={};for(e=c.length-1;-1!=e;e--)f=c[e],g[f]=a[f]+(b[f]-a[f])*d;return g}},hexColor:function(a,b){var c=parseInt(a.slice(1),16),d=parseInt(b.slice(1),16),e=255&c,f=(255&d)-e,g=65280&c,h=(65280&d)-g,i=16711680&c,j=(16711680&d)-i;return function(a){var b=255&e+f*a,c=65280&g+h*a,d=16711680&i+j*a;return"#"+(1<<24|b|c|d).toString(16).slice(1)}},unit:function(a,b){var c=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,d=c.exec(a),e=c.exec(b),f=e[1].indexOf("."),g=f>0?e[1].length-f-1:0,a=+d[1],h=+e[1]-a,i=d[2];return function(b){return(a+h*b).toFixed(g)+i}}},filter:{blur:function(a){var b=_.isFinite(a.x)?a.x:2;return _.template('<filter><feGaussianBlur stdDeviation="${stdDeviation}"/></filter>',{stdDeviation:_.isFinite(a.y)?[b,a.y]:b})},dropShadow:function(a){var b="SVGFEDropShadowElement"in window?'<filter><feDropShadow stdDeviation="${blur}" dx="${dx}" dy="${dy}" flood-color="${color}" flood-opacity="${opacity}"/></filter>':'<filter><feGaussianBlur in="SourceAlpha" stdDeviation="${blur}"/><feOffset dx="${dx}" dy="${dy}" result="offsetblur"/><feFlood flood-color="${color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="${opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';return _.template(b,{dx:a.dx||0,dy:a.dy||0,opacity:_.isFinite(a.opacity)?a.opacity:1,color:a.color||"black",blur:_.isFinite(a.blur)?a.blur:4})},grayscale:function(a){var b=_.isFinite(a.amount)?a.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${b} ${h} 0 0 0 0 0 1 0"/></filter>',{a:.2126+.7874*(1-b),b:.7152-.7152*(1-b),c:.0722-.0722*(1-b),d:.2126-.2126*(1-b),e:.7152+.2848*(1-b),f:.0722-.0722*(1-b),g:.2126-.2126*(1-b),h:.0722+.9278*(1-b)})},sepia:function(a){var b=_.isFinite(a.amount)?a.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${h} ${i} 0 0 0 0 0 1 0"/></filter>',{a:.393+.607*(1-b),b:.769-.769*(1-b),c:.189-.189*(1-b),d:.349-.349*(1-b),e:.686+.314*(1-b),f:.168-.168*(1-b),g:.272-.272*(1-b),h:.534-.534*(1-b),i:.131+.869*(1-b)})},saturate:function(a){var b=_.isFinite(a.amount)?a.amount:1;return _.template('<filter><feColorMatrix type="saturate" values="${amount}"/></filter>',{amount:1-b})},hueRotate:function(a){return _.template('<filter><feColorMatrix type="hueRotate" values="${angle}"/></filter>',{angle:a.angle||0})},invert:function(a){var b=_.isFinite(a.amount)?a.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="table" tableValues="${amount} ${amount2}"/><feFuncG type="table" tableValues="${amount} ${amount2}"/><feFuncB type="table" tableValues="${amount} ${amount2}"/></feComponentTransfer></filter>',{amount:b,amount2:1-b})},brightness:function(a){return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}"/><feFuncG type="linear" slope="${amount}"/><feFuncB type="linear" slope="${amount}"/></feComponentTransfer></filter>',{amount:_.isFinite(a.amount)?a.amount:1})},contrast:function(a){var b=_.isFinite(a.amount)?a.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}" intercept="${amount2}"/><feFuncG type="linear" slope="${amount}" intercept="${amount2}"/><feFuncB type="linear" slope="${amount}" intercept="${amount2}"/></feComponentTransfer></filter>',{amount:b,amount2:.5-b/2})}},format:{number:function(a,b,c){function d(a){for(var b=a.length,d=[],e=0,f=c.grouping[0];b>0&&f>0;)d.push(a.substring(b-=f,b+f)),f=c.grouping[e=(e+1)%c.grouping.length];return d.reverse().join(c.thousands)}c=c||{currency:["$",""],decimal:".",thousands:",",grouping:[3]};var e=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,f=e.exec(a),g=f[1]||" ",h=f[2]||">",i=f[3]||"",j=f[4]||"",k=f[5],l=+f[6],m=f[7],n=f[8],o=f[9],p=1,q="",r="",s=!1;switch(n&&(n=+n.substring(1)),(k||"0"===g&&"="===h)&&(k=g="0",h="=",m&&(l-=Math.floor((l-1)/4))),o){case"n":m=!0,o="g";break;case"%":p=100,r="%",o="f";break;case"p":p=100,r="%",o="r";break;case"b":case"o":case"x":case"X":"#"===j&&(q="0"+o.toLowerCase());case"c":case"d":s=!0,n=0;break;case"s":p=-1,o="r"}"$"===j&&(q=c.currency[0],r=c.currency[1]),"r"!=o||n||(o="g"),null!=n&&("g"==o?n=Math.max(1,Math.min(21,n)):("e"==o||"f"==o)&&(n=Math.max(0,Math.min(20,n))));var t=k&&m;if(s&&b%1)return"";var u=0>b||0===b&&0>1/b?(b=-b,"-"):i,v=r;if(0>p){var w=this.prefix(b,n);b=w.scale(b),v=w.symbol+r}else b*=p;b=this.convert(o,b,n);var x=b.lastIndexOf("."),y=0>x?b:b.substring(0,x),z=0>x?"":c.decimal+b.substring(x+1);!k&&m&&c.grouping&&(y=d(y));var A=q.length+y.length+z.length+(t?0:u.length),B=l>A?new Array(A=l-A+1).join(g):"";return t&&(y=d(B+y)),u+=q,b=y+z,("<"===h?u+b+B:">"===h?B+u+b:"^"===h?B.substring(0,A>>=1)+u+b+B.substring(A):u+(t?b:B+b))+v},convert:function(a,b,c){switch(a){case"b":return b.toString(2);case"c":return String.fromCharCode(b);case"o":return b.toString(8);case"x":return b.toString(16);case"X":return b.toString(16).toUpperCase();case"g":return b.toPrecision(c);case"e":return b.toExponential(c);case"f":return b.toFixed(c);case"r":return(b=this.round(b,this.precision(b,c))).toFixed(Math.max(0,Math.min(20,this.precision(b*(1+1e-15),c))));default:return b+""}},round:function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},precision:function(a,b){return b-(a?Math.ceil(Math.log(a)/Math.LN10):1)},prefix:function(a,b){var c=_.map(["y","z","a","f","p","n","Β΅","m","","k","M","G","T","P","E","Z","Y"],function(a,b){var c=Math.pow(10,3*abs(8-b));return{scale:b>8?function(a){return a/c}:function(a){return a*c},symbol:a}}),d=0;return a&&(0>a&&(a*=-1),b&&(a=d3.round(a,this.precision(a,b))),d=1+Math.floor(1e-12+Math.log(a)/Math.LN10),d=Math.max(-24,Math.min(24,3*Math.floor((0>=d?d+1:d-1)/3)))),c[8+d/3]}}}};if("object"==typeof exports&&(module.exports=joint),"object"==typeof exports)var joint={dia:{Link:require("./joint.dia.link").Link,Element:require("./joint.dia.element").Element},shapes:require("../plugins/shapes")},Backbone=require("backbone"),_=require("lodash"),g=require("./geometry");if(joint.dia.GraphCells=Backbone.Collection.extend({initialize:function(){this.on("change:z",this.sort,this)},model:function(a,b){if("link"===a.type)return new joint.dia.Link(a,b);var c=a.type.split(".")[0],d=a.type.split(".")[1];return joint.shapes[c]&&joint.shapes[c][d]?new joint.shapes[c][d](a,b):new joint.dia.Element(a,b)},comparator:function(a){return a.get("z")||0},getConnectedLinks:function(a,b){b=b||{},_.isUndefined(b.inbound)&&_.isUndefined(b.outbound)&&(b.inbound=b.outbound=!0);var c=[];return this.each(function(d){var e=d.get("source"),f=d.get("target");e&&e.id===a.id&&b.outbound&&c.push(d),f&&f.id===a.id&&b.inbound&&c.push(d)}),c}}),joint.dia.Graph=Backbone.Model.extend({initialize:function(){this.set("cells",new joint.dia.GraphCells),this.get("cells").on("all",this.trigger,this),this.get("cells").on("remove",this.removeCell,this)},toJSON:function(){var a=Backbone.Model.prototype.toJSON.apply(this,arguments);return a.cells=this.get("cells").toJSON(),a},fromJSON:function(a){if(!a.cells)throw new Error("Graph JSON must contain cells array.");var b=a,c=a.cells;delete b.cells,this.set(b),this.resetCells(c)},clear:function(){this.trigger("batch:start"),this.get("cells").remove(this.get("cells").models),this.trigger("batch:stop")},_prepareCell:function(a){return a instanceof Backbone.Model&&_.isUndefined(a.get("z"))?a.set("z",this.maxZIndex()+1,{silent:!0}):_.isUndefined(a.z)&&(a.z=this.maxZIndex()+1),a},maxZIndex:function(){var a=this.get("cells").last();return a?a.get("z")||0:0},addCell:function(a,b){return _.isArray(a)?this.addCells(a,b):(this.get("cells").add(this._prepareCell(a),b||{}),this)},addCells:function(a,b){return _.each(a,function(a){this.addCell(a,b)},this),this},resetCells:function(a){return this.get("cells").reset(_.map(a,this._prepareCell,this)),this},removeCell:function(a,b,c){c&&c.disconnectLinks?this.disconnectLinks(a):this.removeLinks(a),this.get("cells").remove(a,{silent:!0})},getCell:function(a){return this.get("cells").get(a)},getElements:function(){return this.get("cells").filter(function(a){return a instanceof joint.dia.Element})},getLinks:function(){return this.get("cells").filter(function(a){return a instanceof joint.dia.Link})},getConnectedLinks:function(a,b){return this.get("cells").getConnectedLinks(a,b)},getNeighbors:function(a){var b=this.getConnectedLinks(a),c=[],d=this.get("cells");return _.each(b,function(b){var e=b.get("source"),f=b.get("target");if(!e.x){var g=d.get(e.id);g!==a&&c.push(g)}if(!f.x){var h=d.get(f.id);h!==a&&c.push(h)}}),c},disconnectLinks:function(a){_.each(this.getConnectedLinks(a),function(b){b.set(b.get("source").id===a.id?"source":"target",g.point(0,0))})},removeLinks:function(a){_.invoke(this.getConnectedLinks(a),"remove")},findModelsFromPoint:function(a){return _.filter(this.getElements(),function(b){return b.getBBox().containsPoint(a)})},findModelsInArea:function(a){return _.filter(this.getElements(),function(b){return b.getBBox().intersect(a)})}}),"object"==typeof exports&&(module.exports.Graph=joint.dia.Graph),"object"==typeof exports)var joint={util:require("./core").util,dia:{Link:require("./joint.dia.link").Link}},Backbone=require("backbone"),_=require("lodash");if(joint.dia.Cell=Backbone.Model.extend({constructor:function(a,b){var c,d=a||{};this.cid=_.uniqueId("c"),this.attributes={},b&&b.collection&&(this.collection=b.collection),b&&b.parse&&(d=this.parse(d,b)||{}),(c=_.result(this,"defaults"))&&(d=_.merge({},c,d)),this.set(d,b),this.changed={},this.initialize.apply(this,arguments)},toJSON:function(){var a=this.constructor.prototype.defaults.attrs||{},b=this.attributes.attrs,c={};_.each(b,function(b,d){var e=a[d];_.each(b,function(a,b){_.isObject(a)&&!_.isArray(a)?_.each(a,function(a,f){e&&e[b]&&_.isEqual(e[b][f],a)||(c[d]=c[d]||{},(c[d][b]||(c[d][b]={}))[f]=a)}):e&&_.isEqual(e[b],a)||(c[d]=c[d]||{},c[d][b]=a)})});var d=_.cloneDeep(_.omit(this.attributes,"attrs"));return d.attrs=c,d},initialize:function(a){a&&a.id||this.set("id",joint.util.uuid(),{silent:!0}),this._transitionIds={},this.processPorts(),this.on("change:attrs",this.processPorts,this)},processPorts:function(){var a=this.ports,b={};_.each(this.get("attrs"),function(a){a&&a.port&&(_.isUndefined(a.port.id)?b[a.port]={id:a.port}:b[a.port.id]=a.port)});var c={};if(_.each(a,function(a,d){b[d]||(c[d]=!0)}),this.collection&&!_.isEmpty(c)){var d=this.collection.getConnectedLinks(this,{inbound:!0});_.each(d,function(a){c[a.get("target").port]&&a.remove()});var e=this.collection.getConnectedLinks(this,{outbound:!0});_.each(e,function(a){c[a.get("source").port]&&a.remove()})}this.ports=b},remove:function(a){var b=this.collection;b&&b.trigger("batch:start");var c=this.get("parent");if(c){var d=this.collection&&this.collection.get(c);d.unembed(this)}_.invoke(this.getEmbeddedCells(),"remove",a),this.trigger("remove",this,this.collection,a),b&&b.trigger("batch:stop")},toFront:function(){this.collection&&this.set("z",(this.collection.last().get("z")||0)+1)},toBack:function(){this.collection&&this.set("z",(this.collection.first().get("z")||0)-1)},embed:function(a){if(this.get("parent")==a.id)throw new Error("Recursive embedding not allowed.");this.trigger("batch:start"),a.set("parent",this.id),this.set("embeds",_.uniq((this.get("embeds")||[]).concat([a.id]))),this.trigger("batch:stop")},unembed:function(a){this.trigger("batch:start");var b=a.id;a.unset("parent"),this.set("embeds",_.without(this.get("embeds"),b)),this.trigger("batch:stop")},getEmbeddedCells:function(){return this.collection?_.map(this.get("embeds")||[],function(a){return this.collection.get(a)},this):[]},clone:function(a){a=a||{};var b=Backbone.Model.prototype.clone.apply(this,arguments);if(b.set("id",joint.util.uuid(),{silent:!0}),b.set("embeds",""),!a.deep)return b;var c=this.getEmbeddedCells(),d=[b],e={};return _.each(c,function(a){var c=a.clone({deep:!0});b.embed(c[0]),_.each(c,function(b){if(d.push(b),!(b instanceof joint.dia.Link)){var c=this.collection.getConnectedLinks(a,{inbound:!0});_.each(c,function(a){var c=e[a.id]||a.clone();e[a.id]=c;var d=_.clone(c.get("target"));d.id=b.id,c.set("target",d)});var f=this.collection.getConnectedLinks(a,{outbound:!0});_.each(f,function(a){var c=e[a.id]||a.clone();e[a.id]=c;var d=_.clone(c.get("source"));d.id=b.id,c.set("source",d)})}},this)},this),d=d.concat(_.values(e))},attr:function(a,b,c){var d=this.get("attrs"),e="/";if(_.isString(a)){if("undefined"!=typeof b){var f={};return joint.util.setByPath(f,a,b,e),this.set("attrs",_.merge({},d,f),c)}return joint.util.getByPath(d,a,e)}return this.set("attrs",_.merge({},d,a),b,c)},removeAttr:function(a,b){if(_.isArray(a))return _.each(a,function(a){this.removeAttr(a,b)},this),this;var c=joint.util.unsetByPath(_.merge({},this.get("attrs")),a,"/");return this.set("attrs",c,_.extend({dirty:!0},b))},transition:function(a,b,c,d){d=d||"/";var e={duration:100,delay:10,timingFunction:joint.util.timing.linear,valueFunction:joint.util.interpolate.number};c=_.extend(e,c);var f,g=a.split(d),h=g[0],i=g.length>1,j=0,k=_.bind(function(b){var e,g,l;if(j=j||b,b-=j,g=b/c.duration,1>g?this._transitionIds[a]=e=joint.util.nextFrame(k):(g=1,delete this._transitionIds[a]),l=f(c.timingFunction(g)),i){var m=joint.util.setByPath({},a,l,d)[h];l=_.merge({},this.get(h),m)}c.transitionId=e,this.set(h,l,c),e||this.trigger("transition:end",this,a)},this),l=_.bind(function(e){this.stopTransitions(a),f=c.valueFunction(joint.util.getByPath(this.attributes,a,d),b),this._transitionIds[a]=joint.util.nextFrame(e),this.trigger("transition:start",this,a)},this);return _.delay(l,c.delay,k)},getTransitions:function(){return _.keys(this._transitionIds)},stopTransitions:function(a,b){b=b||"/";var c=a&&a.split(b);_(this._transitionIds).keys().filter(c&&function(a){return _.isEqual(c,a.split(b).slice(0,c.length))}).each(function(a){joint.util.cancelFrame(this._transitionIds[a]),delete this._transitionIds[a],this.trigger("transition:end",this,a)},this)}}),joint.dia.CellView=Backbone.View.extend({tagName:"g",attributes:function(){return{"model-id":this.model.id}},initialize:function(){_.bindAll(this,"remove","update"),this.$el.data("view",this),this.listenTo(this.model,"remove",this.remove),this.listenTo(this.model,"change:attrs",this.onChangeAttrs)},onChangeAttrs:function(a,b,c){return c.dirty?this.render():this.update()},_configure:function(a){a.id=a.id||joint.util.guid(this),Backbone.View.prototype._configure.apply(this,arguments)},_ensureElement:function(){var a;if(this.el)a=_.result(this,"el");else{var b=_.extend({id:this.id},_.result(this,"attributes"));this.className&&(b["class"]=_.result(this,"className")),a=V(_.result(this,"tagName"),b).node}this.setElement(a,!1)},findBySelector:function(a){var b="."===a?this.$el:this.$el.find(a);return b},notify:function(a){if(this.paper){var b=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[a].concat(b)),this.paper.trigger.apply(this.paper,[a,this].concat(b))}},getStrokeBBox:function(a){var b=!!a;a=a||this.el;var c,d=V(a).bbox(!1,this.paper.viewport);return c=b?V(a).attr("stroke-width"):this.model.attr("rect/stroke-width")||this.model.attr("circle/stroke-width")||this.model.attr("ellipse/stroke-width")||this.model.attr("path/stroke-width"),c=parseFloat(c)||0,g.rect(d).moveAndExpand({x:-c/2,y:-c/2,width:c,height:c})},getBBox:function(){return V(this.el).bbox()},highlight:function(a){a=a?this.$(a)[0]||this.el:this.el,V(a).addClass("highlighted")},unhighlight:function(a){a=a?this.$(a)[0]||this.el:this.el,V(a).removeClass("highlighted")},findMagnet:function(a){var b=this.$(a);if(0===b.length||b[0]===this.el){var c=this.model.get("attrs")||{};return c["."]&&c["."].magnet===!1?void 0:this.el}return b.attr("magnet")?b[0]:this.findMagnet(b.parent())},applyFilter:function(a,b){var c=this.findBySelector(a),d=b.name+this.paper.svg.id+joint.util.hashCode(JSON.stringify(b));if(!this.paper.svg.getElementById(d)){var e=joint.util.filter[b.name]&&joint.util.filter[b.name](b.args||{});if(!e)throw new Error("Non-existing filter "+b.name);var f=V(e);f.attr("filterUnits","userSpaceOnUse"),b.attrs&&f.attr(b.attrs),f.node.id=d,V(this.paper.svg).defs().append(f)}c.each(function(){V(this).attr("filter","url(#"+d+")")})},applyGradient:function(a,b,c){var d=this.findBySelector(a),e=c.type+this.paper.svg.id+joint.util.hashCode(JSON.stringify(c));if(!this.paper.svg.getElementById(e)){var f=["<"+c.type+">",_.map(c.stops,function(a){return'<stop offset="'+a.offset+'" stop-color="'+a.color+'" stop-opacity="'+(_.isFinite(a.opacity)?a.opacity:1)+'" />'}).join(""),"</"+c.type+">"].join(""),g=V(f);c.attrs&&g.attr(c.attrs),g.node.id=e,V(this.paper.svg).defs().append(g)}d.each(function(){V(this).attr(b,"url(#"+e+")")})},getSelector:function(a,b){if(a===this.el)return b;var c=$(a).index();return b=a.tagName+":nth-child("+(c+1)+")"+" "+(b||""),this.getSelector($(a).parent()[0],b+" ")},pointerdblclick:function(a,b,c){this.notify("cell:pointerdblclick",a,b,c)},pointerclick:function(a,b,c){this.notify("cell:pointerclick",a,b,c)},pointerdown:function(a,b,c){this.model.collection&&(this.model.trigger("batch:start"),this._collection=this.model.collection),this.notify("cell:pointerdown",a,b,c)},pointermove:function(a,b,c){this.notify("cell:pointermove",a,b,c)},pointerup:function(a,b,c){this.notify("cell:pointerup",a,b,c),this._collection&&(this._collection.trigger("batch:stop"),delete this._collection)}}),"object"==typeof exports&&(module.exports.Cell=joint.dia.Cell,module.exports.CellView=joint.dia.CellView),"object"==typeof exports)var joint={util:require("./core").util,dia:{Cell:require("./joint.dia.cell").Cell,CellView:require("./joint.dia.cell").CellView}},Backbone=require("backbone"),_=require("lodash");if(joint.dia.Element=joint.dia.Cell.extend({defaults:{position:{x:0,y:0},size:{width:1,height:1},angle:0},position:function(a,b){this.set("position",{x:a,y:b})},translate:function(a,b,c){if(b=b||0,0===a&&0===b)return this;var d=this.get("position")||{x:0,y:0},e={x:d.x+a||0,y:d.y+b||0};return c&&c.transition?(_.isObject(c.transition)||(c.transition={}),this.transition("position",e,_.extend({},c.transition,{valueFunction:joint.util.interpolate.object}))):(this.set("position",e,c),_.invoke(this.getEmbeddedCells(),"translate",a,b,c)),this},resize:function(a,b){return this.trigger("batch:start"),this.set("size",{width:a,height:b}),this.trigger("batch:stop"),this},rotate:function(a,b){return this.set("angle",b?a:((this.get("angle")||0)+a)%360)},getBBox:function(){var a=this.get("position"),b=this.get("size");return g.rect(a.x,a.y,b.width,b.height)}}),joint.dia.ElementView=joint.dia.CellView.extend({className:function(){return"element "+this.model.get("type").split(".").join(" ")},initialize:function(){_.bindAll(this,"translate","resize","rotate"),joint.dia.CellView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:position",this.translate),this.listenTo(this.model,"change:size",this.resize),this.listenTo(this.model,"change:angle",this.rotate)},update:function(a,b){var c=this.model.get("attrs"),d=V(this.$(".rotatable")[0]);if(d){var e=d.attr("transform");d.attr("transform","")}var f=[];_.each(b||c,function(a,b){var c=this.findBySelector(b);if(0!==c.length){var d=["style","text","html","ref-x","ref-y","ref-dx","ref-dy","ref-width","ref-height","ref","x-alignment","y-alignment","port"];_.isObject(a.filter)&&(d.push("filter"),this.applyFilter(b,a.filter)),_.isObject(a.fill)&&(d.push("fill"),this.applyGradient(b,"fill",a.fill)),_.isObject(a.stroke)&&(d.push("stroke"),this.applyGradient(b,"stroke",a.stroke)),_.isUndefined(a.text)||c.each(function(){V(this).text(a.text+"")});var e=_.omit(a,d);c.each(function(){V(this).attr(e)}),a.port&&c.attr("port",_.isUndefined(a.port.id)?a.port:a.port.id),a.style&&c.css(a.style),_.isUndefined(a.html)||c.each(function(){$(this).html(a.html+"")}),_.isUndefined(a["ref-x"])&&_.isUndefined(a["ref-y"])&&_.isUndefined(a["ref-dx"])&&_.isUndefined(a["ref-dy"])&&_.isUndefined(a["x-alignment"])&&_.isUndefined(a["y-alignment"])&&_.isUndefined(a["ref-width"])&&_.isUndefined(a["ref-height"])||_.each(c,function(a,b,c){var d=$(a);d.selector=c.selector,f.push(d)})}},this);var g=this.el.getBBox();b=b||{},_.each(f,function(a){var d=b[a.selector],e=d?_.merge({},c[a.selector],d):c[a.selector];this.positionRelative(a,g,e)},this),d&&d.attr("transform",e||"")},positionRelative:function(a,b,c){function d(a){return _.isNumber(a)&&!_.isNaN(a)}var e=c.ref,f=parseFloat(c["ref-x"]),g=parseFloat(c["ref-y"]),h=parseFloat(c["ref-dx"]),i=parseFloat(c["ref-dy"]),j=c["y-alignment"],k=c["x-alignment"],l=parseFloat(c["ref-width"]),m=parseFloat(c["ref-height"]),n=_.contains(_.pluck(_.pluck(a.parents("g"),"className"),"baseVal"),"scalable");e&&(b=V(this.findBySelector(e)[0]).bbox(!1,this.el));var o=V(a[0]);o.attr("transform")&&o.attr("transform",o.attr("transform").replace(/translate\([^)]*\)/g,"")||"");var p=0,q=0;if(d(l)&&(l>=0&&1>=l?o.attr("width",l*b.width):o.attr("width",Math.max(l+b.width,0))),d(m)&&(m>=0&&1>=m?o.attr("height",m*b.height):o.attr("height",Math.max(m+b.height,0))),d(h))if(n){var r=V(this.$(".scalable")[0]).scale();p=b.x+b.width+h/r.sx}else p=b.x+b.width+h;if(d(i))if(n){var r=V(this.$(".scalable")[0]).scale();q=b.y+b.height+i/r.sy}else q=b.y+b.height+i;if(d(f))if(f>0&&1>f)p=b.x+b.width*f;else if(n){var r=V(this.$(".scalable")[0]).scale();p=b.x+f/r.sx}else p=b.x+f;if(d(g))if(g>0&&1>g)q=b.y+b.height*g;else if(n){var r=V(this.$(".scalable")[0]).scale();q=b.y+g/r.sy}else q=b.y+g;var s=o.bbox(!1,this.paper.viewport);"middle"===j?q-=s.height/2:d(j)&&(q+=j>-1&&1>j?s.height*j:j),"middle"===k?p-=s.width/2:d(k)&&(p+=k>-1&&1>k?s.width*k:k),o.translate(p,q)},renderMarkup:function(){var a=this.model.markup||this.model.get("markup");if(!a)throw new Error("properties.markup is missing while the default render() implementation is used.");var b=V(a);V(this.el).append(b)},render:function(){return this.$el.empty(),this.renderMarkup(),this.update(),this.resize(),this.rotate(),this.translate(),this},scale:function(a,b){V(this.el).scale(a,b)},resize:function(){var a=this.model.get("size")||{width:1,height:1},b=this.model.get("angle")||0,c=V(this.$(".scalable")[0]);if(c){var d=c.bbox(!0);c.attr("transform","scale("+a.width/d.width+","+a.height/d.height+")");var e=V(this.$(".rotatable")[0]),f=e&&e.attr("transform");if(f&&"null"!==f){e.attr("transform",f+" rotate("+-b+","+a.width/2+","+a.height/2+")");var g=c.bbox(!1,this.paper.viewport);this.model.set("position",{x:g.x,y:g.y}),this.rotate()}this.update()}},translate:function(){var a=this.model.get("position")||{x:0,y:0};V(this.el).attr("transform","translate("+a.x+","+a.y+")")},rotate:function(){var a=V(this.$(".rotatable")[0]);if(a){var b=this.model.get("angle")||0,c=this.model.get("size")||{width:1,height:1},d=c.width/2,e=c.height/2;a.attr("transform","rotate("+b+","+d+","+e+")")}},pointerdown:function(a,b,c){if(a.target.getAttribute("magnet")&&this.paper.options.validateMagnet.call(this.paper,this,a.target)){this.model.trigger("batch:start");var d=this.paper.getDefaultLink(this,a.target);d.set({source:{id:this.model.id,selector:this.getSelector(a.target),port:$(a.target).attr("port")},target:{x:b,y:c}}),this.paper.model.addCell(d),this._linkView=this.paper.findViewByModel(d),this._linkView.startArrowheadMove("target")}else this._dx=b,this._dy=c,joint.dia.CellView.prototype.pointerdown.apply(this,arguments)},pointermove:function(a,b,c){if(this._linkView)this._linkView.pointermove(a,b,c);else{var d=this.paper.options.gridSize;if(this.options.interactive!==!1){var e=this.model.get("position");this.model.translate(g.snapToGrid(e.x,d)-e.x+g.snapToGrid(b-this._dx,d),g.snapToGrid(e.y,d)-e.y+g.snapToGrid(c-this._dy,d))}this._dx=g.snapToGrid(b,d),this._dy=g.snapToGrid(c,d),joint.dia.CellView.prototype.pointermove.apply(this,arguments)}},pointerup:function(a,b,c){this._linkView?(this._linkView.pointerup(a,b,c),delete this._linkView,this.model.trigger("batch:stop")):joint.dia.CellView.prototype.pointerup.apply(this,arguments)}}),"object"==typeof exports&&(module.exports.Element=joint.dia.Element,module.exports.ElementView=joint.dia.ElementView),"object"==typeof exports)var joint={dia:{Cell:require("./joint.dia.cell").Cell,CellView:require("./joint.dia.cell").CellView}},Backbone=require("backbone"),_=require("lodash"),g=require("./geometry");if(joint.dia.Link=joint.dia.Cell.extend({markup:['<path class="connection" stroke="black"/>','<path class="marker-source" fill="black" stroke="black" />','<path class="marker-target" fill="black" stroke="black" />','<path class="connection-wrap"/>','<g class="labels"/>','<g class="marker-vertices"/>','<g class="marker-arrowheads"/>','<g class="link-tools"/>'].join(""),labelMarkup:['<g class="label">',"<rect />","<text />","</g>"].join(""),toolMarkup:['<g class="link-tool">','<g class="tool-remove" event="remove">','<circle r="11" />','<path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z"/>',"<title>Remove link.</title>","</g>",'<g class="tool-options" event="link:options">','<circle r="11" transform="translate(25)"/>','<path fill="white" transform="scale(.55) translate(29, -16)" d="M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z"/>',"<title>Link options.</title>","</g>","</g>"].join(""),vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">',"<title>Remove vertex.</title>","</path>","</g>"].join(""),arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<path class="marker-arrowhead" end="<%= end %>" d="M 26 0 L 0 13 L 26 26 z" />',"</g>"].join(""),defaults:{type:"link"},disconnect:function(){return this.set({source:g.point(0,0),target:g.point(0,0)}) },label:function(a,b){a=a||0;var c=this.get("labels")||[];if(0===arguments.length||1===arguments.length)return c[a];var d=_.merge({},c[a],b),e=c.slice();return e[a]=d,this.set({labels:e})}}),joint.dia.LinkView=joint.dia.CellView.extend({className:function(){return _.unique(this.model.get("type").split(".").concat("link")).join(" ")},options:{shortLinkLength:100},initialize:function(){joint.dia.CellView.prototype.initialize.apply(this,arguments),"function"!=typeof this.constructor.prototype.watchSource&&(this.constructor.prototype.watchSource=this._createWatcher("source"),this.constructor.prototype.watchTarget=this._createWatcher("target")),this._labelCache={},this._markerCache={},this.startListening()},startListening:function(){this.listenTo(this.model,"change:markup",this.render),this.listenTo(this.model,"change:smooth change:manhattan change:router change:connector",this.update),this.listenTo(this.model,"change:toolMarkup",function(){this.renderTools().updateToolsPosition()}),this.listenTo(this.model,"change:labels change:labelMarkup",function(){this.renderLabels().updateLabelPositions()}),this.listenTo(this.model,"change:vertices change:vertexMarkup",function(){this.renderVertexMarkers().update()}),this.listenTo(this.model,"change:source",function(a,b){this.watchSource(a,b).update()}),this.listenTo(this.model,"change:target",function(a,b){this.watchTarget(a,b).update()})},render:function(){this.$el.empty();var a=V(this.model.get("markup")||this.model.markup);if(_.isArray(a)||(a=[a]),this._V={},_.each(a,function(a){var b=a.attr("class");b&&(this._V[$.camelCase(b)]=a)},this),!this._V.connection)throw new Error("link: no connection path in the markup");return this.renderTools(),this.renderVertexMarkers(),this.renderArrowheadMarkers(),V(this.el).append(a),this.renderLabels(),this.watchSource(this.model,this.model.get("source")).watchTarget(this.model,this.model.get("target")).update(),this},renderLabels:function(){if(!this._V.labels)return this;this._labelCache={};var a=$(this._V.labels.node).empty(),b=this.model.get("labels")||[];if(!b.length)return this;var c=_.template(this.model.get("labelMarkup")||this.model.labelMarkup),d=V(c());return _.each(b,function(b,c){var e=d.clone().node;this._labelCache[c]=V(e);var f=$(e).find("text"),g=$(e).find("rect"),h=_.extend({"text-anchor":"middle","font-size":14},joint.util.getByPath(b,"attrs/text","/"));f.attr(_.omit(h,"text")),_.isUndefined(h.text)||V(f[0]).text(h.text+""),a.append(e);var i=V(f[0]).bbox(!0,a[0]);V(f[0]).translate(0,-i.height/2);var j=_.extend({fill:"white",rx:3,ry:3},joint.util.getByPath(b,"attrs/rect","/"));g.attr(_.extend(j,{x:i.x,y:i.y-i.height/2,width:i.width,height:i.height}))},this),this},renderTools:function(){if(!this._V.linkTools)return this;var a=$(this._V.linkTools.node).empty(),b=_.template(this.model.get("toolMarkup")||this.model.toolMarkup),c=V(b());return a.append(c.node),this._toolCache=c,this},renderVertexMarkers:function(){if(!this._V.markerVertices)return this;var a=$(this._V.markerVertices.node).empty(),b=_.template(this.model.get("vertexMarkup")||this.model.vertexMarkup);return _.each(this.model.get("vertices"),function(c,d){a.append(V(b(_.extend({idx:d},c))).node)}),this},renderArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;var a=$(this._V.markerArrowheads.node);a.empty();var b=_.template(this.model.get("arrowheadMarkup")||this.model.arrowheadMarkup);return this._V.sourceArrowhead=V(b({end:"source"})),this._V.targetArrowhead=V(b({end:"target"})),a.append(this._V.sourceArrowhead.node,this._V.targetArrowhead.node),this},update:function(){_.each(this.model.get("attrs"),function(a,b){_.isObject(a.filter)?(this.findBySelector(b).attr(_.omit(a,"filter")),this.applyFilter(b,a.filter)):this.findBySelector(b).attr(a)},this);var a=this.route=this.findRoute(this.model.get("vertices")||[]);this._findConnectionPoints(a);var b=this.getPathData(a);return this._V.connection.attr("d",b),this._V.connectionWrap&&this._V.connectionWrap.attr("d",b),this._translateAndAutoOrientArrows(this._V.markerSource,this._V.markerTarget),this.updateLabelPositions(),this.updateToolsPosition(),this.updateArrowheadMarkers(),delete this.options.perpendicular,this},_findConnectionPoints:function(a){var b,c,d,e,f=_.first(a);b=this.getConnectionPoint("source",this.model.get("source"),f||this.model.get("target")).round();var h=_.last(a);c=this.getConnectionPoint("target",this.model.get("target"),h||b).round();var i=this._markerCache;this._V.markerSource&&(i.sourceBBox=i.sourceBBox||this._V.markerSource.bbox(!0),d=g.point(b).move(f||c,-1*i.sourceBBox.width*this._V.markerSource.scale().sx).round()),this._V.markerTarget&&(i.targetBBox=i.targetBBox||this._V.markerTarget.bbox(!0),e=g.point(c).move(h||b,-1*i.targetBBox.width*this._V.markerTarget.scale().sx).round()),i.sourcePoint=d||b,i.targetPoint=e||c,this.sourcePoint=b,this.targetPoint=c},updateLabelPositions:function(){if(!this._V.labels)return this;var a=this.model.get("labels")||[];if(!a.length)return this;var b=this._V.connection.node,c=b.getTotalLength();return _.each(a,function(a,d){var e=a.position;e=e>c?c:e,e=0>e?c+e:e,e=e>1?e:c*e;var f=b.getPointAtLength(e);this._labelCache[d].attr("transform","translate("+f.x+", "+f.y+")")},this),this},updateToolsPosition:function(){if(!this._V.linkTools)return this;var a="",b=40;this.getConnectionLength()<this.options.shortLinkLength&&(a="scale(.5)",b/=2);var c=this.getPointAtLength(b);return this._toolCache.attr("transform","translate("+c.x+", "+c.y+") "+a),this},updateArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;if("none"===$.css(this._V.markerArrowheads.node,"display"))return this;var a=this.getConnectionLength()<this.options.shortLinkLength?.5:1;return this._V.sourceArrowhead.scale(a),this._V.targetArrowhead.scale(a),this._translateAndAutoOrientArrows(this._V.sourceArrowhead,this._V.targetArrowhead),this},_createWatcher:function(a){function b(b,c){c=c||{};var d=b.previous(a)||{},e=this["_"+a+"BBoxUpdate"];return this._isModel(d)&&this.stopListening(this.paper.getModelById(d.id),"change",e),this._isModel(c)&&this.listenTo(this.paper.getModelById(c.id),"change",e),_.bind(e,this)({cacheOnly:!0}),this}return b},_sourceBBoxUpdate:function(a){this.lastEndChange="source",a=a||{};var b=this.model.get("source");if(this._isModel(b)){var c=this._makeSelector(b),d=this.paper.findViewByModel(b.id),e=this.paper.viewport.querySelector(c);this.sourceBBox=d.getStrokeBBox(e)}else this.sourceBBox=g.rect(b.x,b.y,1,1);a.cacheOnly||this.update()},_targetBBoxUpdate:function(a){this.lastEndChange="target",a=a||{};var b=this.model.get("target");if(this._isModel(b)){var c=this._makeSelector(b),d=this.paper.findViewByModel(b.id),e=this.paper.viewport.querySelector(c);this.targetBBox=d.getStrokeBBox(e)}else this.targetBBox=g.rect(b.x,b.y,1,1);a.cacheOnly||this.update()},_translateAndAutoOrientArrows:function(a,b){a&&a.translateAndAutoOrient(this.sourcePoint,_.first(this.route)||this.targetPoint,this.paper.viewport),b&&b.translateAndAutoOrient(this.targetPoint,_.last(this.route)||this.sourcePoint,this.paper.viewport)},removeVertex:function(a){var b=_.clone(this.model.get("vertices"));return b&&b.length&&(b.splice(a,1),this.model.set("vertices",b)),this},addVertex:function(a){this.model.set("attrs",this.model.get("attrs")||{}),this.model.get("attrs");for(var b,c=(this.model.get("vertices")||[]).slice(),d=c.slice(),e=this._V.connection.node.cloneNode(!1),f=e.getTotalLength(),g=20,h=c.length+1;h--&&(c.splice(h,0,a),V(e).attr("d",this.getPathData(this.findRoute(c))),b=e.getTotalLength(),b-f>g);)c=d.slice();return this.model.set("vertices",c),Math.max(h,0)},findRoute:function(a){var b=this.model.get("router");if(!b){if(!this.model.get("manhattan"))return a;b={name:"orthogonal"}}var c=joint.routers[b.name];if(!_.isFunction(c))throw"unknown router: "+b.name;var d=c.call(this,a||[],b.args||{},this);return d},getPathData:function(a){var b=this.model.get("connector");if(b||(b=this.model.get("smooth")?{name:"smooth"}:{name:"normal"}),!_.isFunction(joint.connectors[b.name]))throw"unknown connector: "+b.name;var c=joint.connectors[b.name].call(this,this._markerCache.sourcePoint,this._markerCache.targetPoint,a||this.model.get("vertices")||{},b.args||{},this);return c},getConnectionPoint:function(a,b,c){var d;if(this._isPoint(b))d=g.point(b);else{var e,f="source"===a?this.sourceBBox:this.targetBBox;if(this._isPoint(c))e=g.point(c);else{var h="source"===a?this.targetBBox:this.sourceBBox;e=g.rect(h).intersectionWithLineFromCenterToPoint(g.rect(f).center()),e=e||g.rect(h).center()}if(this.paper.options.perpendicularLinks||this.options.perpendicular){var i,j=g.rect(0,e.y,this.paper.options.width,1),k=g.rect(e.x,0,1,this.paper.options.height);if(j.intersect(g.rect(f)))switch(i=g.rect(f).sideNearestToPoint(e)){case"left":d=g.point(f.x,e.y);break;case"right":d=g.point(f.x+f.width,e.y);break;default:d=g.rect(f).center()}else if(k.intersect(g.rect(f)))switch(i=g.rect(f).sideNearestToPoint(e)){case"top":d=g.point(e.x,f.y);break;case"bottom":d=g.point(e.x,f.y+f.height);break;default:d=g.rect(f).center()}else d=g.rect(f).intersectionWithLineFromCenterToPoint(e),d=d||g.rect(f).center()}else d=g.rect(f).intersectionWithLineFromCenterToPoint(e),d=d||g.rect(f).center()}return d},_isModel:function(a){return a&&a.id},_isPoint:function(a){return!this._isModel(a)},_makeSelector:function(a){var b='[model-id="'+a.id+'"]';return a.port?b+=' [port="'+a.port+'"]':a.selector&&(b+=" "+a.selector),b},getConnectionLength:function(){return this._V.connection.node.getTotalLength()},getPointAtLength:function(a){return this._V.connection.node.getPointAtLength(a)},_beforeArrowheadMove:function(){this.model.trigger("batch:start"),this._z=this.model.get("z"),this.model.set("z",Number.MAX_VALUE),this.el.style.pointerEvents="none"},_afterArrowheadMove:function(){this._z&&(this.model.set("z",this._z),delete this._z),this.el.style.pointerEvents="visiblePainted",this.model.trigger("batch:stop")},_createValidateConnectionArgs:function(a){function b(a,b){return c[f]=a,c[f+1]=a.el===b?void 0:b,c}var c=[];c[4]=a,c[5]=this;var d,e=0,f=0;"source"===a?(e=2,d="target"):(f=2,d="source");var g=this.model.get(d);return g.id&&(c[e]=this.paper.findViewByModel(g.id),c[e+1]=g.selector&&c[e].el.querySelector(g.selector)),b},startArrowheadMove:function(a){this._action="arrowhead-move",this._arrowhead=a,this._beforeArrowheadMove(),this._validateConnectionArgs=this._createValidateConnectionArgs(this._arrowhead)},pointerdown:function(a,b,c){if(joint.dia.CellView.prototype.pointerdown.apply(this,arguments),this._dx=b,this._dy=c,this.options.interactive!==!1){var d=a.target.getAttribute("class");switch(d){case"marker-vertex":this._action="vertex-move",this._vertexIdx=a.target.getAttribute("idx");break;case"marker-vertex-remove":case"marker-vertex-remove-area":this.removeVertex(a.target.getAttribute("idx"));break;case"marker-arrowhead":this.startArrowheadMove(a.target.getAttribute("end"));break;default:var e=a.target.parentNode.getAttribute("event");e?"remove"===e?this.model.remove():this.paper.trigger(e,a,this,b,c):(this._vertexIdx=this.addVertex({x:b,y:c}),this._action="vertex-move")}}},pointermove:function(a,b,c){switch(joint.dia.CellView.prototype.pointermove.apply(this,arguments),this._action){case"vertex-move":var d=_.clone(this.model.get("vertices"));d[this._vertexIdx]={x:b,y:c},this.model.set("vertices",d);break;case"arrowhead-move":if(this.paper.options.snapLinks){var e=this.paper.options.snapLinks.radius||50,f=this.paper.findViewsInArea({x:b-e,y:c-e,width:2*e,height:2*e});this._closestView&&this._closestView.unhighlight(this._closestEnd.selector),this._closestView=this._closestEnd=null;var h,i=g.point(b,c),j=Number.MAX_VALUE;_.each(f,function(a){"false"!==a.el.getAttribute("magnet")&&(h=a.model.getBBox().center().distance(i),e>h&&j>h&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(a,null))&&(j=h,this._closestView=a,this._closestEnd={id:a.model.id})),a.$("[magnet]").each(_.bind(function(b,c){var d=V(c).bbox(!1,this.paper.viewport);h=i.distance({x:d.x+d.width/2,y:d.y+d.height/2}),e>h&&j>h&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(a,c))&&(j=h,this._closestView=a,this._closestEnd={id:a.model.id,selector:a.getSelector(c),port:c.getAttribute("port")})},this))},this),this._closestView&&this._closestView.highlight(this._closestEnd.selector),this.model.set(this._arrowhead,this._closestEnd||{x:b,y:c})}else{var k="mousemove"===a.type?a.target:document.elementFromPoint(a.clientX,a.clientY);this._targetEvent!==k&&(this._magnetUnderPointer&&this._viewUnderPointer.unhighlight(this._magnetUnderPointer),this._viewUnderPointer=this.paper.findView(k),this._viewUnderPointer?(this._magnetUnderPointer=this._viewUnderPointer.findMagnet(k),this._magnetUnderPointer&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(this._viewUnderPointer,this._magnetUnderPointer))?this._magnetUnderPointer&&this._viewUnderPointer.highlight(this._magnetUnderPointer):this._magnetUnderPointer=null):this._magnetUnderPointer=null),this._targetEvent=k,this.model.set(this._arrowhead,{x:b,y:c})}}this._dx=b,this._dy=c},pointerup:function(){joint.dia.CellView.prototype.pointerup.apply(this,arguments),"arrowhead-move"===this._action&&(this.paper.options.snapLinks?(this._closestView&&this._closestView.unhighlight(this._closestEnd.selector),this._closestView=this._closestEnd=null):(this._magnetUnderPointer&&(this._viewUnderPointer.unhighlight(this._magnetUnderPointer),this.model.set(this._arrowhead,{id:this._viewUnderPointer.model.id,selector:this._viewUnderPointer.getSelector(this._magnetUnderPointer),port:$(this._magnetUnderPointer).attr("port")})),delete this._viewUnderPointer,delete this._magnetUnderPointer,delete this._staticView,delete this._staticMagnet),this._afterArrowheadMove()),delete this._action}}),"object"==typeof exports&&(module.exports.Link=joint.dia.Link,module.exports.LinkView=joint.dia.LinkView),joint.dia.Paper=Backbone.View.extend({options:{width:800,height:600,gridSize:50,perpendicularLinks:!1,elementView:joint.dia.ElementView,linkView:joint.dia.LinkView,snapLinks:!1,defaultLink:new joint.dia.Link,validateMagnet:function(a,b){return"passive"!==b.getAttribute("magnet")},validateConnection:function(a,b,c,d,e){return("target"===e?c:a)instanceof joint.dia.ElementView}},events:{mousedown:"pointerdown",dblclick:"mousedblclick",click:"mouseclick",touchstart:"pointerdown",mousemove:"pointermove",touchmove:"pointermove"},initialize:function(){_.bindAll(this,"addCell","sortCells","resetCells","pointerup"),this.svg=V("svg").node,this.viewport=V("g").node,V(this.svg).append(V("defs").node),V(this.viewport).attr({"class":"viewport"}),V(this.svg).append(this.viewport),this.$el.append(this.svg),this.setDimensions(),this.listenTo(this.model,"add",this.addCell),this.listenTo(this.model,"reset",this.resetCells),this.listenTo(this.model,"sort",this.sortCells),$(document).on("mouseup touchend",this.pointerup),this._mousemoved=!1},remove:function(){$(document).off("mouseup touchend",this.pointerup),Backbone.View.prototype.remove.call(this)},setDimensions:function(a,b){a&&(this.options.width=a),b&&(this.options.height=b),V(this.svg).attr("width",this.options.width),V(this.svg).attr("height",this.options.height),this.trigger("resize")},fitToContent:function(a,b,c){a=a||1,b=b||1,c=c||0;var d=V(this.viewport).bbox(!0,this.svg),e=Math.ceil((d.width+d.x)/a)*a,f=Math.ceil((d.height+d.y)/b)*b;e+=c,f+=c,(e!=this.options.width||f!=this.options.height)&&this.setDimensions(e||this.options.width,f||this.options.height)},getContentBBox:function(){var a=this.viewport.getBoundingClientRect(),b=this.viewport.getScreenCTM(),c=g.rect(Math.abs(a.left-b.e),Math.abs(a.top-b.f),a.width,a.height);return c},createViewForModel:function(a){var b,c=a.get("type"),d=c.split(".")[0],e=c.split(".")[1];return b=joint.shapes[d]&&joint.shapes[d][e+"View"]?new joint.shapes[d][e+"View"]({model:a,interactive:this.options.interactive}):a instanceof joint.dia.Element?new this.options.elementView({model:a,interactive:this.options.interactive}):new this.options.linkView({model:a,interactive:this.options.interactive})},addCell:function(a){var b=this.createViewForModel(a);V(this.viewport).append(b.el),b.paper=this,b.render(),$(b.el).find("image").on("dragstart",function(){return!1})},resetCells:function(a){$(this.viewport).empty();var b=a.models.slice();b.sort(function(a){return a instanceof joint.dia.Link?1:-1}),_.each(b,this.addCell,this),this.sortCells()},sortCells:function(){var a=$(this.viewport).children("[model-id]"),b=this.model.get("cells");this.sortElements(a,function(a,c){var d=b.get($(a).attr("model-id")),e=b.get($(c).attr("model-id"));return(d.get("z")||0)>(e.get("z")||0)?1:-1})},sortElements:function(a,b){var c=$(a),d=c.map(function(){var a=this,b=a.parentNode,c=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,c),b.removeChild(c)}});return Array.prototype.sort.call(c,b).each(function(a){d[a].call(this)})},scale:function(a,b,c,d){return c||(c=0,d=0),V(this.viewport).attr("transform",""),(c||d)&&V(this.viewport).translate(-c*(a-1),-d*(b-1)),V(this.viewport).scale(a,b),this.trigger("scale",c,d),this},rotate:function(a,b,c){if(_.isUndefined(b)){var d=this.viewport.getBBox();b=d.width/2,c=d.height/2}V(this.viewport).rotate(a,b,c)},findView:function(a){var b=this.$(a);return 0===b.length||b[0]===this.el?void 0:b.data("view")?b.data("view"):this.findView(b.parent())},findViewByModel:function(a){var b=_.isString(a)?a:a.id,c=this.$('[model-id="'+b+'"]');return c.length?c.data("view"):void 0},findViewsFromPoint:function(a){a=g.point(a);var b=_.map(this.model.getElements(),this.findViewByModel);return _.filter(b,function(b){return g.rect(V(b.el).bbox(!1,this.viewport)).containsPoint(a)},this)},findViewsInArea:function(a){a=g.rect(a);var b=_.map(this.model.getElements(),this.findViewByModel);return _.filter(b,function(b){return a.intersect(g.rect(V(b.el).bbox(!1,this.viewport)))},this)},getModelById:function(a){return this.model.getCell(a)},snapToGrid:function(a){var b=V(this.viewport).toLocalPoint(a.x,a.y);return{x:g.snapToGrid(b.x,this.options.gridSize),y:g.snapToGrid(b.y,this.options.gridSize)}},getDefaultLink:function(a,b){return _.isFunction(this.options.defaultLink)?this.options.defaultLink.call(this,a,b):this.options.defaultLink.clone()},mousedblclick:function(a){a.preventDefault(),a=joint.util.normalizeEvent(a);var b=this.findView(a.target),c=this.snapToGrid({x:a.clientX,y:a.clientY});b?b.pointerdblclick(a,c.x,c.y):this.trigger("blank:pointerdblclick",a,c.x,c.y)},mouseclick:function(a){if(!this._mousemoved){a.preventDefault(),a=joint.util.normalizeEvent(a);var b=this.findView(a.target),c=this.snapToGrid({x:a.clientX,y:a.clientY});b?b.pointerclick(a,c.x,c.y):this.trigger("blank:pointerclick",a,c.x,c.y)}this._mousemoved=!1},pointerdown:function(a){a.preventDefault(),a=joint.util.normalizeEvent(a);var b=this.findView(a.target),c=this.snapToGrid({x:a.clientX,y:a.clientY});b?(this.sourceView=b,b.pointerdown(a,c.x,c.y)):this.trigger("blank:pointerdown",a,c.x,c.y)},pointermove:function(a){if(a.preventDefault(),a=joint.util.normalizeEvent(a),this.sourceView){this._mousemoved=!0;var b=this.snapToGrid({x:a.clientX,y:a.clientY});this.sourceView.pointermove(a,b.x,b.y)}},pointerup:function(a){a=joint.util.normalizeEvent(a);var b=this.snapToGrid({x:a.clientX,y:a.clientY});this.sourceView?(this.sourceView.pointerup(a,b.x,b.y),this.sourceView=null):this.trigger("blank:pointerup",a,b.x,b.y)}}),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element,ElementView:require("../src/joint.dia.element").ElementView}},_=require("lodash");joint.shapes.basic={},joint.shapes.basic.Generic=joint.dia.Element.extend({defaults:joint.util.deepSupplement({type:"basic.Generic",attrs:{".":{fill:"#FFFFFF",stroke:"none"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.basic.Rect=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><rect/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Rect",attrs:{rect:{fill:"#FFFFFF",stroke:"black",width:100,height:60},text:{"font-size":14,text:"","ref-x":.5,"ref-y":.5,ref:"rect","y-alignment":"middle","x-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Text=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><text/></g></g>',defaults:joint.util.deepSupplement({type:"basic.Text",attrs:{text:{"font-size":18,fill:"black"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Circle=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><circle/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Circle",size:{width:60,height:60},attrs:{circle:{fill:"#FFFFFF",stroke:"black",r:30,transform:"translate(30, 30)"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,ref:"circle","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Image=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><image/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Image",attrs:{text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,ref:"image","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Path=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><path/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Path",size:{width:60,height:60},attrs:{path:{fill:"#FFFFFF",stroke:"black"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,ref:"path","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.PortsModelInterface={initialize:function(){this.updatePortsAttrs(),this.on("change:inPorts change:outPorts",this.updatePortsAttrs,this),this.constructor.__super__.constructor.__super__.initialize.apply(this,arguments)},updatePortsAttrs:function(){var a=this.get("attrs");_.each(this._portSelectors,function(b){a[b]&&delete a[b]}),this._portSelectors=[];var b={};_.each(this.get("inPorts"),function(a,c,d){var e=this.getPortAttrs(a,c,d.length,".inPorts","in");this._portSelectors=this._portSelectors.concat(_.keys(e)),_.extend(b,e)},this),_.each(this.get("outPorts"),function(a,c,d){var e=this.getPortAttrs(a,c,d.length,".outPorts","out");this._portSelectors=this._portSelectors.concat(_.keys(e)),_.extend(b,e)},this),this.attr(b,{silent:!0}),this.processPorts(),this.trigger("process:ports")},getPortSelector:function(a){var b=".inPorts",c=this.get("inPorts").indexOf(a);if(0>c&&(b=".outPorts",c=this.get("outPorts").indexOf(a),0>c))throw new Error("getPortSelector(): Port doesn't exist.");return b+">g:nth-child("+(c+1)+")>circle"}},joint.shapes.basic.PortsViewInterface={initialize:function(){this.listenTo(this.model,"process:ports",this.update),joint.dia.ElementView.prototype.initialize.apply(this,arguments)},update:function(){this.renderPorts(),joint.dia.ElementView.prototype.update.apply(this,arguments)},renderPorts:function(){var a=this.$(".inPorts").empty(),b=this.$(".outPorts").empty(),c=_.template(this.model.portMarkup);_.each(_.filter(this.model.ports,function(a){return"in"===a.type}),function(b,d){a.append(V(c({id:d,port:b})).node)}),_.each(_.filter(this.model.ports,function(a){return"out"===a.type}),function(a,d){b.append(V(c({id:d,port:a})).node)})}},joint.shapes.basic.TextBlock=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable"><g class="scalable"><rect/></g><switch>','<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>',"</foreignObject>",'<text class="content"/>',"</switch></g>"].join(""),defaults:joint.util.deepSupplement({type:"basic.TextBlock",attrs:{rect:{fill:"#ffffff",stroke:"#000000",width:80,height:100},text:{fill:"#000000","font-size":14,"font-family":"Arial, helvetica, sans-serif"},".content":{text:"",ref:"rect","ref-x":.5,"ref-y":.5,"y-alignment":"middle","x-alignment":"middle"}},content:""},joint.shapes.basic.Generic.prototype.defaults),initialize:function(){"undefined"!=typeof SVGForeignObjectElement&&(this.setForeignObjectSize(this,this.get("size")),this.setDivContent(this,this.get("content")),this.listenTo(this,"change:size",this.setForeignObjectSize),this.listenTo(this,"change:content",this.setDivContent)),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},setForeignObjectSize:function(a,b){a.attr({".fobj":_.clone(b),div:{style:_.clone(b)}})},setDivContent:function(a,b){a.attr({div:{html:b}})}}),joint.shapes.basic.TextBlockView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),"undefined"==typeof SVGForeignObjectElement&&(this.noSVGForeignObjectElement=!0,this.listenTo(this.model,"change:content",function(a){this.updateContent(a)}))},update:function(a,b){if(this.noSVGForeignObjectElement){var c=this.model,d=_.omit(b||c.get("attrs"),".content");joint.dia.ElementView.prototype.update.call(this,c,d),(!b||_.has(b,".content"))&&this.updateContent(c,b)}else joint.dia.ElementView.prototype.update.call(this,c,b)},updateContent:function(a,b){var c=_.merge({},(b||a.get("attrs"))[".content"]);delete c.text;var d=joint.util.breakText(a.get("content"),a.get("size"),c,{svgDocument:this.paper.svg}),e=joint.util.setByPath({},".content",c,"/");e[".content"].text=d,joint.dia.ElementView.prototype.update.call(this,a,e)}}),"object"==typeof exports&&(module.exports=joint.shapes.basic),joint.routers.orthogonal=function(){function a(a,b){return a.y<b.y&&a.x===b.x?"down":a.y>b.y&&a.x===b.x?"up":a.x<b.x&&a.y===b.y?"right":"left"}function b(a,b,c){var d;if(d=a.x<b.x?a.y>b.y?["up","right"]:a.y<b.y?["down","right"]:["right"]:a.x>b.x?a.y>b.y?["up","left"]:a.y<b.y?["down","left"]:["left"]:a.y>b.y?["up"]:["down"],_.contains(d,c))return c;var e=_.first(d);switch(c){case"down":if("up"===e)return _.last(d);break;case"up":if("down"===e)return _.last(d);break;case"left":if("right"===e)return _.last(d);break;case"right":if("left"===e)return _.last(d)}return e}function c(a,c,d){var e=b(a,c,d);return"down"===e||"up"===e?{x:a.x,y:c.y,d:e}:{x:c.x,y:a.y,d:e}}function d(b){b=(b||[]).slice();var d=[],h=e.center(),i=f.center();b.length||(Math.abs(h.x-i.x)<e.width/2||Math.abs(h.y-i.y)<e.height/2)&&(b=[{x:Math.min(h.x,i.x)+Math.abs(h.x-i.x)/2,y:Math.min(h.y,i.y)+Math.abs(h.y-i.y)/2}]),b.unshift(h),b.push(i);for(var j,k,l,m,n=0;n<b.length-1;n++){l=b[n],m=b[n+1],k=_.last(d),n>0&&(j=l,j.d=k?a(k,l):"top",d.push(j),k=j);var o=k&&k.d;j=c(l,m,o),g.point(j).equals(g.point(l))||g.point(j).equals(g.point(m))||d.push(j)}return d}var e,f;return function(a){return e=this.sourceBBox,f=this.targetBBox,d(a)}}(),joint.routers.manhattan=function(){"use strict";function a(a,b){for(var c,d=[],e={x:0,y:0},f=b;c=a[f];){var g=c.difference(f);g.equals(e)||(d.unshift(f),e=g),f=c}return d.unshift(f),d}function b(a,b,c){var d=c.step,e=a.center(),f=_.chain(c.directionMap).pick(b).map(function(b){var c=b.x*a.width/2,f=b.y*a.height/2,h=g.point(e).offset(c,f).snapToGrid(d);return a.containsPoint(h)&&h.offset(b.x*d,b.y*d),h}).value();return f}function c(a,b,c){var d=360/c,e=Math.floor(a.theta(b)/d);return c-e}function d(d,e,f,h){var i=h.reversed?h.endDirections:h.startDirections,j=h.reversed?h.startDirections:h.endDirections,k=d instanceof g.rect?b(d,i,h):[d],l=e instanceof g.rect?b(e,j,h):[e],m=k.length>1?d.center():k[0],n=l.length>1?e.center():l[0],o=_.filter(l,function(a){var b=g.point(a).snapToGrid(h.mapGridSize).toString(),c=_.every(f[b],function(b){return!b.containsPoint(a)});return c});if(o.length)for(var p=h.step,q=h.penalties,r=_.chain(o).invoke("snapToGrid",p).min(function(a){return h.estimateCost(m,a)}).value(),s={},t={},u={},v=h.directions,w=v.length,x=w/2,y=h.previousDirIndexes||{},z={},A={},B=_.chain(k).invoke("snapToGrid",p).each(function(a){var b=a.toString();t[b]=0,u[b]=h.estimateCost(a,r),y[b]=y[b]||c(m,a,w),A[b]=!0}).map(function(a){return a.toString()}).sortBy(function(a){return u[a]}).value(),C=h.maximumLoops,D=h.maxAllowedDirectionChange;B.length&&C--;){var E=B[0],F=g.point(E);if(r.equals(F))return h.previousDirIndexes=_.pick(y,E),a(s,F);B.splice(0,1),A[M]=null,z[M]=!0;for(var G=y[E],H=t[E],I=0;w>I;I++){var J=Math.abs(I-G);if(J>x&&(J=w-J),!(J>D)){var K=v[I],L=g.point(F).offset(K.offsetX,K.offsetY),M=L.toString();if(!z[M]){var N=g.point(L).snapToGrid(h.mapGridSize).toString(),O=_.every(f[N],function(a){return!a.containsPoint(L)});if(O){var P=_.has(A,M),Q=H+K.cost;if((!P||Q<t[M])&&(s[M]=F,y[M]=I,t[M]=Q,u[M]=Q+h.estimateCost(L,r)+q[J],!P)){var R=_.sortedIndex(B,M,function(a){return u[a]});B.splice(R,0,M),A[M]=!0}}}}}}return h.fallbackRoute(m,n,h)}function e(a,b){b.directions=_.result(b,"directions"),b.penalties=_.result(b,"penalties"),b.paddingBox=_.result(b,"paddingBox"),this.options.perpendicular=!!b.perpendicular;var c=b.reversed="source"===this.lastEndChange,e=c?g.rect(this.targetBBox):g.rect(this.sourceBBox),f=c?g.rect(this.sourceBBox):g.rect(this.targetBBox);e.moveAndExpand(b.paddingBox),f.moveAndExpand(b.paddingBox);for(var h=this.model,i=this.paper.model,j=_.chain(b.excludeEnds).map(h.get,h).pluck("id").map(i.getCell,i).value(),k=b.mapGridSize,l=_.chain(i.getElements()).difference(j).reject(function(a){return _.contains(b.excludeTypes,a.get("type"))}).invoke("getBBox").invoke("moveAndExpand",b.paddingBox).foldl(function(a,b){for(var c=b.origin().snapToGrid(k),d=b.corner().snapToGrid(k),e=c.x;e<=d.x;e+=k)for(var f=c.y;f<=d.y;f+=k){var g=e+"@"+f;a[g]=a[g]||[],a[g].push(b)}return a},{}).value(),m=[],n=_.map(a,g.point),o=e.center(),p=0,q=n.length;q>=p;p++){var r=null,s=t||e,t=n[p];if(!t){t=f;var u=!this.model.get("source").id||!this.model.get("target").id;if(u&&_.isFunction(b.draggingRoute)){var v=s instanceof g.rect?s.center():s;r=b.draggingRoute(v,t.origin(),b)}}r=r||d(s,t,l,b);var w=_.first(r);w&&w.equals(o)&&r.shift(),o=_.last(r)||o,m=m.concat(r)}return c?m.reverse():m}var f={step:10,perpendicular:!0,mapGridSize:100,excludeEnds:[],excludeTypes:["basic.Text"],maximumLoops:500,startDirections:["left","right","top","bottom"],endDirections:["left","right","top","bottom"],directionMap:{right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0},top:{x:0,y:-1}},maxAllowedDirectionChange:1,paddingBox:function(){var a=this.step;return{x:-a,y:-a,width:2*a,height:2*a}},directions:function(){var a=this.step;return[{offsetX:a,offsetY:0,cost:a},{offsetX:0,offsetY:a,cost:a},{offsetX:-a,offsetY:0,cost:a},{offsetX:0,offsetY:-a,cost:a}]},penalties:function(){return[0,this.step/2,this.step]},estimateCost:function(a,b){return a.manhattanDistance(b)},fallbackRoute:function(a,b,c){var d=c.prevDirIndexes||{},e=(d[a]||0)%2?g.point(a.x,b.y):g.point(b.x,a.y);return[e,b]},draggingRoute:null};return function(a,b,c){return e.call(c,a,_.extend({},f,b))}}(),joint.routers.metro=function(){if(!_.isFunction(joint.routers.manhattan))throw"Metro requires the manhattan router.";var a={diagonalCost:null,directions:function(){var a=this.step,b=this.diagonalCost||Math.ceil(Math.sqrt(a*a<<1));return[{offsetX:a,offsetY:0,cost:a},{offsetX:a,offsetY:a,cost:b},{offsetX:0,offsetY:a,cost:a},{offsetX:-a,offsetY:a,cost:b},{offsetX:-a,offsetY:0,cost:a},{offsetX:-a,offsetY:-a,cost:b},{offsetX:0,offsetY:-a,cost:a},{offsetX:a,offsetY:-a,cost:b}]},fallbackRoute:function(a,b){var c=a.theta(b),d={x:b.x,y:a.y},e={x:a.x,y:b.y}; if(c%180>90){var f=d;d=e,e=f}var h=45>c%90?d:e,i=g.line(a,h),j=90*Math.ceil(c/90),k=g.point.fromPolar(i.squaredLength(),g.toRad(j+135),h),l=g.line(b,k),m=i.intersection(l);return m?[m.round(),b]:[b]}};return function(b,c,d){return joint.routers.manhattan(b,_.extend({},a,c),d)}}(),joint.connectors.normal=function(a,b,c){var d=["M",a.x,a.y];return _.each(c,function(a){d.push(a.x,a.y)}),d.push(b.x,b.y),d.join(" ")},joint.connectors.rounded=function(a,b,c,d){var e,f,h,i,j,k,l=d.radius||10,m=["M",a.x,a.y];return _.each(c,function(d,n){j=c[n-1]||a,k=c[n+1]||b,h=i||g.point(d).distance(j)/2,i=g.point(d).distance(k)/2,e=g.point(d).move(j,-Math.min(l,h)).round(),f=g.point(d).move(k,-Math.min(l,i)).round(),m.push(e.x,e.y,"S",d.x,d.y,f.x,f.y,"L")}),m.push(b.x,b.y),m.join(" ")},joint.connectors.smooth=function(a,b,c){var d;if(c.length)d=g.bezier.curveThroughPoints([a].concat(c).concat([b]));else{var e=a.x<b.x?b.x-(b.x-a.x)/2:a.x-(a.x-b.x)/2;d=["M",a.x,a.y,"C",e,a.y,e,b.y,b.x,b.y]}return d.join(" ")};
hare1039/cdnjs
ajax/libs/jointjs/0.9.0/joint.nobackbone.min.js
JavaScript
mit
164,290
YUI.add('node-base', function(Y) { /** * @module node * @submodule node-base */ var methods = [ /** * Determines whether each node has the given className. * @method hasClass * @for Node * @param {String} className the class name to search for * @return {Boolean} Whether or not the element has the specified class */ 'hasClass', /** * Adds a class name to each node. * @method addClass * @param {String} className the class name to add to the node's class attribute * @chainable */ 'addClass', /** * Removes a class name from each node. * @method removeClass * @param {String} className the class name to remove from the node's class attribute * @chainable */ 'removeClass', /** * Replace a class with another class for each node. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name * @chainable */ 'replaceClass', /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @param {String} className the class name to be toggled * @param {Boolean} force Option to force adding or removing the class. * @chainable */ 'toggleClass' ]; Y.Node.importMethod(Y.DOM, methods); /** * Determines whether each node has the given className. * @method hasClass * @see Node.hasClass * @for NodeList * @param {String} className the class name to search for * @return {Array} An array of booleans for each node bound to the NodeList. */ /** * Adds a class name to each node. * @method addClass * @see Node.addClass * @param {String} className the class name to add to the node's class attribute * @chainable */ /** * Removes a class name from each node. * @method removeClass * @see Node.removeClass * @param {String} className the class name to remove from the node's class attribute * @chainable */ /** * Replace a class with another class for each node. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @see Node.replaceClass * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name * @chainable */ /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @see Node.toggleClass * @param {String} className the class name to be toggled * @chainable */ Y.NodeList.importMethod(Y.Node.prototype, methods); /** * @module node * @submodule node-base */ var Y_Node = Y.Node, Y_DOM = Y.DOM; /** * Returns a new dom node using the provided markup string. * @method create * @static * @param {String} html The markup used to create the element * @param {HTMLDocument} doc An optional document context * @return {Node} A Node instance bound to a DOM node or fragment * @for Node */ Y_Node.create = function(html, doc) { if (doc && doc._node) { doc = doc._node; } return Y.one(Y_DOM.create(html, doc)); }; Y.mix(Y_Node.prototype, { /** * Creates a new Node using the provided markup string. * @method create * @param {String} html The markup used to create the element * @param {HTMLDocument} doc An optional document context * @return {Node} A Node instance bound to a DOM node or fragment */ create: Y_Node.create, /** * Inserts the content before the reference node. * @method insert * @param {String | Y.Node | HTMLElement | Y.NodeList | HTMLCollection} content The content to insert * @param {Int | Y.Node | HTMLElement | String} where The position to insert at. * Possible "where" arguments * <dl> * <dt>Y.Node</dt> * <dd>The Node to insert before</dd> * <dt>HTMLElement</dt> * <dd>The element to insert before</dd> * <dt>Int</dt> * <dd>The index of the child element to insert before</dd> * <dt>"replace"</dt> * <dd>Replaces the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts before the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts content before the node</dd> * <dt>"after"</dt> * <dd>Inserts content after the node</dd> * </dl> * @chainable */ insert: function(content, where) { this._insert(content, where); return this; }, _insert: function(content, where) { var node = this._node, ret = null; if (typeof where == 'number') { // allow index where = this._node.childNodes[where]; } else if (where && where._node) { // Node where = where._node; } if (content && typeof content != 'string') { // allow Node or NodeList/Array instances content = content._node || content._nodes || content; } ret = Y_DOM.addHTML(node, content, where); return ret; }, /** * Inserts the content as the firstChild of the node. * @method prepend * @param {String | Y.Node | HTMLElement} content The content to insert * @chainable */ prepend: function(content) { return this.insert(content, 0); }, /** * Inserts the content as the lastChild of the node. * @method append * @param {String | Y.Node | HTMLElement} content The content to insert * @chainable */ append: function(content) { return this.insert(content, null); }, /** * @method appendChild * @param {String | HTMLElement | Node} node Node to be appended * @return {Node} The appended node */ appendChild: function(node) { return Y_Node.scrubVal(this._insert(node)); }, /** * @method insertBefore * @param {String | HTMLElement | Node} newNode Node to be appended * @param {HTMLElement | Node} refNode Node to be inserted before * @return {Node} The inserted node */ insertBefore: function(newNode, refNode) { return Y.Node.scrubVal(this._insert(newNode, refNode)); }, /** * Appends the node to the given node. * @method appendTo * @param {Y.Node | HTMLElement} node The node to append to * @chainable */ appendTo: function(node) { Y.one(node).append(this); return this; }, /** * Replaces the node's current content with the content. * @method setContent * @param {String | Y.Node | HTMLElement | Y.NodeList | HTMLCollection} content The content to insert * @chainable */ setContent: function(content) { this._insert(content, 'replace'); return this; }, /** * Returns the node's current content (e.g. innerHTML) * @method getContent * @return {String} The current content */ getContent: function(content) { return this.get('innerHTML'); } }); Y.NodeList.importMethod(Y.Node.prototype, [ /** * Called on each Node instance * @for NodeList * @method append * @see Node.append */ 'append', /** Called on each Node instance * @method insert * @see Node.insert */ 'insert', /** * Called on each Node instance * @for NodeList * @method appendChild * @see Node.appendChild */ 'appendChild', /** Called on each Node instance * @method insertBefore * @see Node.insertBefore */ 'insertBefore', /** Called on each Node instance * @method prepend * @see Node.prepend */ 'prepend', /** Called on each Node instance * @method setContent * @see Node.setContent */ 'setContent', /** Called on each Node instance * @method getContent * @see Node.getContent */ 'getContent' ]); /** * @module node * @submodule node-base */ var Y_Node = Y.Node, Y_DOM = Y.DOM; /** * Static collection of configuration attributes for special handling * @property ATTRS * @static * @type object */ Y_Node.ATTRS = { /** * Allows for getting and setting the text of an element. * Formatting is preserved and special characters are treated literally. * @config text * @type String */ text: { getter: function() { return Y_DOM.getText(this._node); }, setter: function(content) { Y_DOM.setText(this._node, content); return content; } }, /** * Allows for getting and setting the text of an element. * Formatting is preserved and special characters are treated literally. * @config for * @type String */ 'for': { getter: function() { return Y_DOM.getAttribute(this._node, 'for'); }, setter: function(val) { Y_DOM.setAttribute(this._node, 'for', val); return val; } }, 'options': { getter: function() { return this._node.getElementsByTagName('option'); } }, /** * Returns a NodeList instance of all HTMLElement children. * @readOnly * @config children * @type NodeList */ 'children': { getter: function() { var node = this._node, children = node.children, childNodes, i, len; if (!children) { childNodes = node.childNodes; children = []; for (i = 0, len = childNodes.length; i < len; ++i) { if (childNodes[i][TAG_NAME]) { children[children.length] = childNodes[i]; } } } return Y.all(children); } }, value: { getter: function() { return Y_DOM.getValue(this._node); }, setter: function(val) { Y_DOM.setValue(this._node, val); return val; } } }; Y.Node.importMethod(Y.DOM, [ /** * Allows setting attributes on DOM nodes, normalizing in some cases. * This passes through to the DOM node, allowing for custom attributes. * @method setAttribute * @for Node * @for NodeList * @chainable * @param {string} name The attribute name * @param {string} value The value to set */ 'setAttribute', /** * Allows getting attributes on DOM nodes, normalizing in some cases. * This passes through to the DOM node, allowing for custom attributes. * @method getAttribute * @for Node * @for NodeList * @param {string} name The attribute name * @return {string} The attribute value */ 'getAttribute' ]); /** * @module node * @submodule node-base */ var Y_Node = Y.Node; var Y_NodeList = Y.NodeList; /** * List of events that route to DOM events * @static * @property DOM_EVENTS * @for Node */ Y_Node.DOM_EVENTS = { abort: 1, beforeunload: 1, blur: 1, change: 1, click: 1, close: 1, command: 1, contextmenu: 1, dblclick: 1, DOMMouseScroll: 1, drag: 1, dragstart: 1, dragenter: 1, dragover: 1, dragleave: 1, dragend: 1, drop: 1, error: 1, focus: 1, key: 1, keydown: 1, keypress: 1, keyup: 1, load: 1, message: 1, mousedown: 1, mouseenter: 1, mouseleave: 1, mousemove: 1, mousemultiwheel: 1, mouseout: 1, mouseover: 1, mouseup: 1, mousewheel: 1, orientationchange: 1, reset: 1, resize: 1, select: 1, selectstart: 1, submit: 1, scroll: 1, textInput: 1, unload: 1 }; // Add custom event adaptors to this list. This will make it so // that delegate, key, available, contentready, etc all will // be available through Node.on Y.mix(Y_Node.DOM_EVENTS, Y.Env.evt.plugins); Y.augment(Y_Node, Y.EventTarget); Y.mix(Y_Node.prototype, { /** * Removes event listeners from the node and (optionally) its subtree * @method purge * @param {Boolean} recurse (optional) Whether or not to remove listeners from the * node's subtree * @param {String} type (optional) Only remove listeners of the specified type * @chainable * */ purge: function(recurse, type) { Y.Event.purgeElement(this._node, recurse, type); return this; } }); Y.mix(Y.NodeList.prototype, { _prepEvtArgs: function(type, fn, context) { // map to Y.on/after signature (type, fn, nodes, context, arg1, arg2, etc) var args = Y.Array(arguments, 0, true); if (args.length < 2) { // type only (event hash) just add nodes args[2] = this._nodes; } else { args.splice(2, 0, this._nodes); } args[3] = context || this; // default to NodeList instance as context return args; }, /** * Applies an event listener to each Node bound to the NodeList. * @method on * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @param {Object} context The context to call the handler with. * param {mixed} arg* 0..n additional arguments to supply to the subscriber * when the event fires. * @return {Object} Returns an event handle that can later be use to detach(). * @see Event.on * @for NodeList */ on: function(type, fn, context) { return Y.on.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an one-time event listener to each Node bound to the NodeList. * @method once * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {Object} Returns an event handle that can later be use to detach(). * @see Event.on */ once: function(type, fn, context) { return Y.once.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an event listener to each Node bound to the NodeList. * The handler is called only after all on() handlers are called * and the event is not prevented. * @method after * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {Object} Returns an event handle that can later be use to detach(). * @see Event.on */ after: function(type, fn, context) { return Y.after.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an one-time event listener to each Node bound to the NodeList * that will be called only after all on() handlers are called and the * event is not prevented. * * @method onceAfter * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {Object} Returns an event handle that can later be use to detach(). * @see Event.on */ onceAfter: function(type, fn, context) { return Y.onceAfter.apply(Y, this._prepEvtArgs.apply(this, arguments)); } }); Y_NodeList.importMethod(Y.Node.prototype, [ /** * Called on each Node instance * @method detach * @see Node.detach */ 'detach', /** Called on each Node instance * @method detachAll * @see Node.detachAll */ 'detachAll' ]); Y.mix(Y.Node.ATTRS, { offsetHeight: { setter: function(h) { Y.DOM.setHeight(this._node, h); return h; }, getter: function() { return this._node.offsetHeight; } }, offsetWidth: { setter: function(w) { Y.DOM.setWidth(this._node, w); return w; }, getter: function() { return this._node.offsetWidth; } } }); Y.mix(Y.Node.prototype, { sizeTo: function(w, h) { var node; if (arguments.length < 2) { node = Y.one(w); w = node.get('offsetWidth'); h = node.get('offsetHeight'); } this.setAttrs({ offsetWidth: w, offsetHeight: h }); } }); /** * @module node * @submodule node-base */ var Y_Node = Y.Node; Y.mix(Y_Node.prototype, { /** * Makes the node visible. * If the "transition" module is loaded, show optionally * animates the showing of the node using either the default * transition effect ('fadeIn'), or the given named effect. * @method show * @for Node * @param {String} name A named Transition effect to use as the show effect. * @param {Object} config Options to use with the transition. * @param {Function} callback An optional function to run after the transition completes. * @chainable */ show: function(callback) { callback = arguments[arguments.length - 1]; this.toggleView(true, callback); return this; }, /** * The implementation for showing nodes. * Default is to toggle the style.display property. * @method _show * @protected * @chainable */ _show: function() { this.setStyle('display', ''); }, _isHidden: function() { return Y.DOM.getStyle(this._node, 'display') === 'none'; }, toggleView: function(on, callback) { this._toggleView.apply(this, arguments); }, _toggleView: function(on, callback) { callback = arguments[arguments.length - 1]; // base on current state if not forcing if (typeof on != 'boolean') { on = (this._isHidden()) ? 1 : 0; } if (on) { this._show(); } else { this._hide(); } if (typeof callback == 'function') { callback.call(this); } return this; }, /** * Hides the node. * If the "transition" module is loaded, hide optionally * animates the hiding of the node using either the default * transition effect ('fadeOut'), or the given named effect. * @method hide * @param {String} name A named Transition effect to use as the show effect. * @param {Object} config Options to use with the transition. * @param {Function} callback An optional function to run after the transition completes. * @chainable */ hide: function(callback) { callback = arguments[arguments.length - 1]; this.toggleView(false, callback); return this; }, /** * The implementation for hiding nodes. * Default is to toggle the style.display property. * @method _hide * @protected * @chainable */ _hide: function() { this.setStyle('display', 'none'); } }); Y.NodeList.importMethod(Y.Node.prototype, [ /** * Makes each node visible. * If the "transition" module is loaded, show optionally * animates the showing of the node using either the default * transition effect ('fadeIn'), or the given named effect. * @method show * @param {String} name A named Transition effect to use as the show effect. * @param {Object} config Options to use with the transition. * @param {Function} callback An optional function to run after the transition completes. * @for NodeList * @chainable */ 'show', /** * Hides each node. * If the "transition" module is loaded, hide optionally * animates the hiding of the node using either the default * transition effect ('fadeOut'), or the given named effect. * @method hide * @param {String} name A named Transition effect to use as the show effect. * @param {Object} config Options to use with the transition. * @param {Function} callback An optional function to run after the transition completes. * @chainable */ 'hide', 'toggleView' ]); if (!Y.config.doc.documentElement.hasAttribute) { // IE < 8 Y.Node.prototype.hasAttribute = function(attr) { if (attr === 'value') { if (this.get('value') !== "") { // IE < 8 fails to populate specified when set in HTML return true; } } return !!(this._node.attributes[attr] && this._node.attributes[attr].specified); }; } // IE throws an error when calling focus() on an element that's invisible, not // displayed, or disabled. Y.Node.prototype.focus = function () { try { this._node.focus(); } catch (e) { Y.log('error focusing node: ' + e.toString(), 'error', 'node'); } return this; }; // IE throws error when setting input.type = 'hidden', // input.setAttribute('type', 'hidden') and input.attributes.type.value = 'hidden' Y.Node.ATTRS.type = { setter: function(val) { if (val === 'hidden') { try { this._node.type = 'hidden'; } catch(e) { this.setStyle('display', 'none'); this._inputType = 'hidden'; } } else { try { // IE errors when changing the type from "hidden' this._node.type = val; } catch (e) { Y.log('error setting type: ' + val, 'info', 'node'); } } return val; }, getter: function() { return this._inputType || this._node.type; }, _bypassProxy: true // don't update DOM when using with Attribute }; if (Y.config.doc.createElement('form').elements.nodeType) { // IE: elements collection is also FORM node which trips up scrubVal. Y.Node.ATTRS.elements = { getter: function() { return this.all('input, textarea, button, select'); } }; } }, '@VERSION@' ,{requires:['dom-base', 'node-core', 'event-base']});
jackdoyle/cdnjs
ajax/libs/yui/3.4.0pr3/node-base/node-base-debug.js
JavaScript
mit
22,371
YUI.add("loader-yui3",function(a){YUI.Env[a.version].modules=YUI.Env[a.version].modules||{"anim":{"submodules":{"anim-base":{"requires":["base-base","node-style"]},"anim-color":{"requires":["anim-base"]},"anim-curve":{"requires":["anim-xy"]},"anim-easing":{"requires":["anim-base"]},"anim-node-plugin":{"requires":["node-pluginhost","anim-base"]},"anim-scroll":{"requires":["anim-base"]},"anim-xy":{"requires":["anim-base","node-screen"]}},"use":["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"]},"app":{"submodules":{"controller":{"optional":["querystring-parse"],"requires":["array-extras","base-build","history"]},"model":{"requires":["base-build","escape","json-parse"]},"model-list":{"requires":["array-extras","array-invoke","arraylist","base-build","json-parse","model"]},"view":{"requires":["base-build","node-event-delegate"]}},"use":["controller","model","model-list","view"]},"arraysort":{"requires":["yui-base"]},"async-queue":{"requires":["event-custom"]},"attribute":{"submodules":{"attribute-base":{"requires":["event-custom"]},"attribute-complex":{"requires":["attribute-base"]}},"use":["attribute-base","attribute-complex"]},"autocomplete":{"submodules":{"autocomplete-base":{"optional":["autocomplete-sources"],"plugins":{"autocomplete-filters":{"path":"autocomplete/autocomplete-filters-min.js","requires":["array-extras","text-wordbreak"]},"autocomplete-filters-accentfold":{"path":"autocomplete/autocomplete-filters-accentfold-min.js","requires":["array-extras","text-accentfold","text-wordbreak"]},"autocomplete-highlighters":{"path":"autocomplete/autocomplete-highlighters-min.js","requires":["array-extras","highlight-base"]},"autocomplete-highlighters-accentfold":{"path":"autocomplete/autocomplete-highlighters-accentfold-min.js","requires":["array-extras","highlight-accentfold"]}},"requires":["array-extras","base-build","escape","event-valuechange","node-base"]},"autocomplete-list":{"after":["autocomplete-sources"],"lang":["en"],"plugins":{"autocomplete-list-keys":{"condition":{"name":"autocomplete-list-keys","test":function(b){return !(b.UA.ios||b.UA.android);},"trigger":"autocomplete-list"},"path":"autocomplete/autocomplete-list-keys-min.js","requires":["autocomplete-list","base-build"]},"autocomplete-plugin":{"path":"autocomplete/autocomplete-plugin-min.js","requires":["autocomplete-list","node-pluginhost"]}},"requires":["autocomplete-base","event-resize","selector-css3","shim-plugin","widget","widget-position","widget-position-align"],"skinnable":true},"autocomplete-sources":{"optional":["io-base","json-parse","jsonp","yql"],"requires":["autocomplete-base"]}},"use":["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"]},"base":{"submodules":{"base-base":{"after":["attribute-complex"],"requires":["attribute-base"]},"base-build":{"requires":["base-base"]},"base-pluginhost":{"requires":["base-base","pluginhost"]}},"use":["base-base","base-pluginhost","base-build"]},"cache":{"submodules":{"cache-base":{"requires":["base"]},"cache-offline":{"requires":["cache-base","json"]},"cache-plugin":{"requires":["plugin","cache-base"]}},"use":["cache-base","cache-offline","cache-plugin"]},"charts":{"requires":["dom","datatype","event-custom","event-mouseenter","widget","widget-position","widget-stack"]},"classnamemanager":{"requires":["yui-base"]},"collection":{"submodules":{"array-extras":{},"array-invoke":{},"arraylist":{},"arraylist-add":{"requires":["arraylist"]},"arraylist-filter":{"requires":["arraylist"]}},"use":["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"]},"compat":{"requires":["event-base","dom","dump","substitute"]},"console":{"lang":["en","es"],"plugins":{"console-filters":{"requires":["plugin","console"],"skinnable":true}},"requires":["yui-log","widget","substitute"],"skinnable":true},"cookie":{"requires":["yui-base"]},"cssbase":{"after":["cssreset","cssfonts","cssgrids","cssreset-context","cssfonts-context","cssgrids-context"],"path":"cssbase/base-min.css","type":"css"},"cssbase-context":{"after":["cssreset","cssfonts","cssgrids","cssreset-context","cssfonts-context","cssgrids-context"],"path":"cssbase/base-context-min.css","type":"css"},"cssfonts":{"path":"cssfonts/fonts-min.css","type":"css"},"cssfonts-context":{"path":"cssfonts/fonts-context-min.css","type":"css"},"cssgrids":{"optional":["cssreset","cssfonts"],"path":"cssgrids/grids-min.css","type":"css"},"cssgrids-context-deprecated":{"optional":["cssreset-context"],"path":"cssgrids-deprecated/grids-context-min.css","requires":["cssfonts-context"],"type":"css"},"cssgrids-deprecated":{"optional":["cssreset"],"path":"cssgrids-deprecated/grids-min.css","requires":["cssfonts"],"type":"css"},"cssreset":{"path":"cssreset/reset-min.css","type":"css"},"cssreset-context":{"path":"cssreset/reset-context-min.css","type":"css"},"dataschema":{"submodules":{"dataschema-array":{"requires":["dataschema-base"]},"dataschema-base":{"requires":["base"]},"dataschema-json":{"requires":["dataschema-base","json"]},"dataschema-text":{"requires":["dataschema-base"]},"dataschema-xml":{"requires":["dataschema-base"]}},"use":["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"]},"datasource":{"submodules":{"datasource-arrayschema":{"requires":["datasource-local","plugin","dataschema-array"]},"datasource-cache":{"requires":["datasource-local","plugin","cache-base"]},"datasource-function":{"requires":["datasource-local"]},"datasource-get":{"requires":["datasource-local","get"]},"datasource-io":{"requires":["datasource-local","io-base"]},"datasource-jsonschema":{"requires":["datasource-local","plugin","dataschema-json"]},"datasource-local":{"requires":["base"]},"datasource-polling":{"requires":["datasource-local"]},"datasource-textschema":{"requires":["datasource-local","plugin","dataschema-text"]},"datasource-xmlschema":{"requires":["datasource-local","plugin","dataschema-xml"]}},"use":["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"]},"datatable":{"submodules":{"datatable-base":{"requires":["recordset-base","widget","substitute","event-mouseenter"],"skinnable":true},"datatable-datasource":{"requires":["datatable-base","plugin","datasource-local"]},"datatable-scroll":{"requires":["datatable-base","plugin","stylesheet"]},"datatable-sort":{"lang":["en"],"requires":["datatable-base","plugin","recordset-sort"]}},"use":["datatable-base","datatable-datasource","datatable-sort","datatable-scroll"]},"datatype":{"submodules":{"datatype-date":{"lang":["ar","ar-JO","ca","ca-ES","da","da-DK","de","de-AT","de-DE","el","el-GR","en","en-AU","en-CA","en-GB","en-IE","en-IN","en-JO","en-MY","en-NZ","en-PH","en-SG","en-US","es","es-AR","es-BO","es-CL","es-CO","es-EC","es-ES","es-MX","es-PE","es-PY","es-US","es-UY","es-VE","fi","fi-FI","fr","fr-BE","fr-CA","fr-FR","hi","hi-IN","id","id-ID","it","it-IT","ja","ja-JP","ko","ko-KR","ms","ms-MY","nb","nb-NO","nl","nl-BE","nl-NL","pl","pl-PL","pt","pt-BR","ro","ro-RO","ru","ru-RU","sv","sv-SE","th","th-TH","tr","tr-TR","vi","vi-VN","zh-Hans","zh-Hans-CN","zh-Hant","zh-Hant-HK","zh-Hant-TW"],"submodules":{"datatype-date-format":{"path":"datatype/datatype-date-format-min.js"},"datatype-date-parse":{"path":"datatype/datatype-date-parse-min.js"}},"supersedes":["datatype-date-format"],"use2":["datatype-date-parse","datatype-date-format"]},"datatype-number":{"submodules":{"datatype-number-format":{"path":"datatype/datatype-number-format-min.js"},"datatype-number-parse":{"path":"datatype/datatype-number-parse-min.js"}},"use":["datatype-number-parse","datatype-number-format"]},"datatype-xml":{"submodules":{"datatype-xml-format":{"path":"datatype/datatype-xml-format-min.js"},"datatype-xml-parse":{"path":"datatype/datatype-xml-parse-min.js"}},"use":["datatype-xml-parse","datatype-xml-format"]}},"use":["datatype-number","datatype-date","datatype-xml"]},"dd":{"plugins":{"dd-drop-plugin":{"requires":["dd-drop"]},"dd-gestures":{"condition":{"name":"dd-gestures","test":function(b){return(b.config.win&&("ontouchstart" in b.config.win&&!b.UA.chrome)); },"trigger":"dd-drag"},"requires":["dd-drag","event-synthetic","event-gestures"]},"dd-plugin":{"optional":["dd-constrain","dd-proxy"],"requires":["dd-drag"]}},"submodules":{"dd-constrain":{"requires":["dd-drag"]},"dd-ddm":{"requires":["dd-ddm-base","event-resize"]},"dd-ddm-base":{"requires":["node","base","yui-throttle","classnamemanager"]},"dd-ddm-drop":{"requires":["dd-ddm"]},"dd-delegate":{"requires":["dd-drag","dd-drop-plugin","event-mouseenter"]},"dd-drag":{"requires":["dd-ddm-base"]},"dd-drop":{"requires":["dd-drag","dd-ddm-drop"]},"dd-proxy":{"requires":["dd-drag"]},"dd-scroll":{"requires":["dd-drag"]}},"use":["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"]},"dial":{"lang":["en","es"],"requires":["widget","dd-drag","substitute","event-mouseenter","event-move","event-key","transition","intl"],"skinnable":true},"dom":{"plugins":{"dom-deprecated":{"requires":["dom-core"]},"dom-style-ie":{"condition":{"name":"dom-style-ie","test":function(h){var f=h.Features.test,g=h.Features.add,d=h.config.win,e=h.config.doc,b="documentElement",c=false;g("style","computedStyle",{test:function(){return d&&"getComputedStyle" in d;}});g("style","opacity",{test:function(){return e&&"opacity" in e[b].style;}});c=(!f("style","opacity")&&!f("style","computedStyle"));return c;},"trigger":"dom-style"},"requires":["dom-style"]},"selector-css2":{"condition":{"name":"selector-css2","test":function(d){var c=d.config.doc,b=c&&!("querySelectorAll" in c);return b;},"trigger":"selector"},"requires":["selector-native"]},"selector-css3":{"requires":["selector-native","selector-css2"]}},"submodules":{"dom-attrs":{"requires":["dom-core"]},"dom-base":{"requires":["dom-core","dom-attrs","dom-create","dom-class","dom-size"]},"dom-class":{"requires":["dom-core"]},"dom-core":{"requires":["oop","features"]},"dom-create":{"requires":["dom-core"]},"dom-screen":{"requires":["dom-core","dom-style"]},"dom-size":{"requires":["dom-core"]},"dom-style":{"requires":["dom-core"]},"selector":{"requires":["selector-native"]},"selector-native":{"requires":["dom-core"]}},"use":["dom-core","dom-base","dom-attrs","dom-create","dom-class","dom-size","dom-screen","dom-style","selector-native","selector"]},"dump":{},"editor":{"submodules":{"createlink-base":{"requires":["editor-base"]},"editor-base":{"requires":["base","frame","node","exec-command","selection"]},"editor-bidi":{"requires":["editor-base"]},"editor-br":{"requires":["editor-base"]},"editor-lists":{"requires":["editor-base"]},"editor-para":{"requires":["editor-base"]},"editor-tab":{"requires":["editor-base"]},"exec-command":{"requires":["frame"]},"frame":{"requires":["base","node","selector-css3","substitute","yui-throttle"]},"selection":{"requires":["node"]}},"use":["frame","selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"]},"escape":{},"event":{"after":["node-base"],"plugins":{"event-base-ie":{"after":["event-base"],"condition":{"name":"event-base-ie","test":function(c){var b=c.config.doc&&c.config.doc.implementation;return(b&&(!b.hasFeature("Events","2.0")));},"trigger":"node-base"},"requires":["node-base"]},"event-touch":{"requires":["node-base"]}},"submodules":{"event-base":{"after":["node-base"],"requires":["event-custom-base"]},"event-delegate":{"requires":["node-base"]},"event-focus":{"requires":["event-synthetic"]},"event-hover":{"requires":["event-mouseenter"]},"event-key":{"requires":["event-synthetic"]},"event-mouseenter":{"requires":["event-synthetic"]},"event-mousewheel":{"requires":["node-base"]},"event-resize":{"requires":["node-base"]},"event-synthetic":{"requires":["node-base","event-custom-complex"]}},"use":["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover"]},"event-custom":{"submodules":{"event-custom-base":{"requires":["oop"]},"event-custom-complex":{"requires":["event-custom-base"]}},"use":["event-custom-base","event-custom-complex"]},"event-gestures":{"submodules":{"event-flick":{"requires":["node-base","event-touch","event-synthetic"]},"event-move":{"requires":["node-base","event-touch","event-synthetic"]}},"use":["event-flick","event-move"]},"event-simulate":{"requires":["event-base"]},"event-valuechange":{"requires":["event-focus","event-synthetic"]},"highlight":{"submodules":{"highlight-accentfold":{"requires":["highlight-base","text-accentfold"]},"highlight-base":{"requires":["array-extras","escape","text-wordbreak"]}},"use":["highlight-base","highlight-accentfold"]},"history":{"plugins":{"history-hash-ie":{"condition":{"name":"history-hash-ie","test":function(c){var b=c.config.doc&&c.config.doc.documentMode;return c.UA.ie&&(!("onhashchange" in c.config.win)||!b||b<8);},"trigger":"history-hash"},"requires":["history-hash","node-base"]}},"submodules":{"history-base":{"requires":["event-custom-complex"]},"history-hash":{"after":["history-html5"],"requires":["event-synthetic","history-base","yui-later"]},"history-html5":{"optional":["json"],"requires":["event-base","history-base","node-base"]}},"use":["history-base","history-hash","history-hash-ie","history-html5"]},"imageloader":{"requires":["base-base","node-style","node-screen"]},"intl":{"requires":["intl-base","event-custom"]},"io":{"submodules":{"io-base":{"requires":["event-custom-base","querystring-stringify-simple"]},"io-form":{"requires":["io-base","node-base"]},"io-queue":{"requires":["io-base","queue-promote"]},"io-upload-iframe":{"requires":["io-base","node-base"]},"io-xdr":{"requires":["io-base","datatype-xml"]}},"use":["io-base","io-xdr","io-form","io-upload-iframe","io-queue"]},"json":{"submodules":{"json-parse":{},"json-stringify":{}},"use":["json-parse","json-stringify"]},"jsonp":{"plugins":{"jsonp-url":{"requires":["jsonp"]}},"requires":["get","oop"]},"loader":{"submodules":{"loader-base":{"requires":["get"]},"loader-rollup":{"requires":["loader-base"]},"loader-yui3":{"requires":["loader-base"]}},"use":["loader-base","loader-rollup","loader-yui3"]},"node":{"plugins":{"align-plugin":{"requires":["node-screen","node-pluginhost"]},"node-deprecated":{"requires":["node-base"]},"node-event-simulate":{"requires":["node-base","event-simulate"]},"node-load":{"requires":["node-base","io-base"]},"shim-plugin":{"requires":["node-style","node-pluginhost"]}},"submodules":{"node-base":{"requires":["dom-base","selector-css2","event-base"]},"node-event-delegate":{"requires":["node-base","event-delegate"]},"node-pluginhost":{"requires":["node-base","pluginhost"]},"node-screen":{"requires":["dom-screen","node-base"]},"node-style":{"requires":["dom-style","node-base"]}},"use":["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"]},"node-flick":{"requires":["classnamemanager","transition","event-flick","plugin"],"skinnable":true},"node-focusmanager":{"requires":["attribute","node","plugin","node-event-simulate","event-key","event-focus"]},"node-menunav":{"requires":["node","classnamemanager","plugin","node-focusmanager"],"skinnable":true},"oop":{"requires":["yui-base"]},"overlay":{"requires":["widget","widget-stdmod","widget-position","widget-position-align","widget-stack","widget-position-constrain"],"skinnable":true},"plugin":{"plugins":{"pluginattr":{"path":"plugin/pluginattr-min.js","requires":["plugin"]}},"requires":["base-base"]},"pluginhost":{"submodules":{"pluginhost-base":{"requires":["yui-base"]},"pluginhost-config":{"requires":["pluginhost-base"]}},"use":["pluginhost-base","pluginhost-config"]},"profiler":{"requires":["yui-base"]},"querystring":{"submodules":{"querystring-parse":{"requires":["yui-base","array-extras"]},"querystring-stringify":{"requires":["yui-base"]}},"use":["querystring-parse","querystring-stringify"]},"querystring-parse-simple":{"path":"querystring/querystring-parse-simple-min.js","requires":["yui-base"]},"querystring-stringify-simple":{"path":"querystring/querystring-stringify-simple-min.js","requires":["yui-base"]},"queue-promote":{"requires":["yui-base"]},"recordset":{"submodules":{"recordset-base":{"requires":["base","arraylist"]},"recordset-filter":{"requires":["recordset-base","array-extras","plugin"]},"recordset-indexer":{"requires":["recordset-base","plugin"]},"recordset-sort":{"requires":["arraysort","recordset-base","plugin"]}},"use":["recordset-base","recordset-sort","recordset-filter","recordset-indexer"]},"resize":{"plugins":{"resize-plugin":{"optional":["resize-constrain"],"requires":["resize-base","plugin"]}},"submodules":{"resize-base":{"requires":["base","widget","substitute","event","oop","dd-drag","dd-delegate","dd-drop"],"skinnable":true},"resize-constrain":{"requires":["plugin","resize-base"]},"resize-proxy":{"requires":["plugin","resize-base"]}},"use":["resize-base","resize-proxy","resize-constrain"]},"scrollview":{"plugins":{"scrollview-base":{"path":"scrollview/scrollview-base-min.js","requires":["widget","event-gestures","transition"],"skinnable":true},"scrollview-base-ie":{"condition":{"name":"scrollview-base-ie","trigger":"scrollview-base","ua":"ie"},"requires":["scrollview-base"]},"scrollview-paginator":{"path":"scrollview/scrollview-paginator-min.js","requires":["plugin"]},"scrollview-scrollbars":{"path":"scrollview/scrollview-scrollbars-min.js","requires":["classnamemanager","transition","plugin"],"skinnable":true}},"requires":["scrollview-base","scrollview-scrollbars"]},"slider":{"submodules":{"clickable-rail":{"requires":["slider-base"]},"range-slider":{"requires":["slider-base","slider-value-range","clickable-rail"]},"slider-base":{"requires":["widget","dd-constrain","substitute"],"skinnable":true},"slider-value-range":{"requires":["slider-base"]}},"use":["slider-base","slider-value-range","clickable-rail","range-slider"]},"sortable":{"plugins":{"sortable-scroll":{"requires":["dd-scroll","sortable"]}},"requires":["dd-delegate","dd-drop-plugin","dd-proxy"]},"stylesheet":{},"substitute":{"optional":["dump"]},"swf":{"requires":["event-custom","node","swfdetect"]},"swfdetect":{},"tabview":{"plugins":{"tabview-base":{"requires":["node-event-delegate","classnamemanager","skin-sam-tabview"]},"tabview-plugin":{"requires":["tabview-base"]}},"requires":["widget","widget-parent","widget-child","tabview-base","node-pluginhost","node-focusmanager"],"skinnable":true},"test":{"requires":["event-simulate","event-custom","substitute","json-stringify"],"skinnable":true},"text":{"submodules":{"text-accentfold":{"requires":["array-extras","text-data-accentfold"]},"text-data-accentfold":{},"text-data-wordbreak":{},"text-wordbreak":{"requires":["array-extras","text-data-wordbreak"]}},"use":["text-accentfold","text-wordbreak"]},"transition":{"submodules":{"transition-native":{"requires":["node-base"]},"transition-timer":{"requires":["transition-native","node-style"]}},"use":["transition-native","transition-timer"]},"uploader":{"requires":["event-custom","node","base","swf"]},"widget":{"plugins":{"widget-base-ie":{"condition":{"name":"widget-base-ie","trigger":"widget-base","ua":"ie"},"requires":["widget-base"]},"widget-child":{"requires":["base-build","widget"]},"widget-parent":{"requires":["base-build","arraylist","widget"]},"widget-position":{"requires":["base-build","node-screen","widget"]},"widget-position-align":{"requires":["widget-position"]},"widget-position-constrain":{"requires":["widget-position"]},"widget-stack":{"requires":["base-build","widget"],"skinnable":true},"widget-stdmod":{"requires":["base-build","widget"]}},"skinnable":true,"submodules":{"widget-base":{"requires":["attribute","event-focus","base-base","base-pluginhost","node-base","node-style","classnamemanager"]},"widget-htmlparser":{"requires":["widget-base"]},"widget-skin":{"requires":["widget-base"]},"widget-uievents":{"requires":["widget-base","node-event-delegate"]}},"use":["widget-base","widget-htmlparser","widget-uievents","widget-skin"]},"widget-anim":{"requires":["plugin","anim-base","widget"]},"widget-locale":{"path":"widget/widget-locale-min.js","requires":["widget-base"]},"yql":{"requires":["jsonp","jsonp-url"]},"yui":{"submodules":{"features":{"requires":["yui-base"]},"get":{"requires":["yui-base"]},"intl-base":{"requires":["yui-base"]},"rls":{"requires":["get","features"]},"yui-base":{},"yui-later":{"requires":["yui-base"]},"yui-log":{"requires":["yui-base"]},"yui-rls":{"use":["yui-base","get","features","intl-base","rls","yui-log","yui-later"]}},"use":["yui-base","get","features","intl-base","yui-log","yui-later","loader-base","loader-rollup","loader-yui3"]},"yui-throttle":{"requires":["yui-base"]}}; YUI.Env[a.version].md5="e16caab45651ef582690346921582645";},"@VERSION@",{requires:["loader-base"]});
jackdoyle/cdnjs
ajax/libs/yui/3.4.0pr2/loader/loader-yui3-min.js
JavaScript
mit
20,927
YUI.add("file-html5",function(e,t){var n=e.Lang,r=e.bind,i=e.config.win,s=function(e){var t=null;s.isValidFile(e)?t=e:s.isValidFile(e.file)?t=e.file:t=!1,s.superclass.constructor.apply(this,arguments),t&&s.canUpload()&&(this.get("file")||this._set("file",t),this.get("name")||this._set("name",t.name||t.fileName),this.get("size")!=(t.size||t.fileSize)&&this._set("size",t.size||t.fileSize),this.get("type")||this._set("type",t.type),t.hasOwnProperty("lastModifiedDate")&&!this.get("dateModified")&&this._set("dateModified",t.lastModifiedDate))};e.extend(s,e.Base,{initializer:function(t){this.get("id")||this._set("id",e.guid("file"))},_uploadEventHandler:function(e){var t=this.get("xhr");switch(e.type){case"progress":this.fire("uploadprogress",{originEvent:e,bytesLoaded:e.loaded,bytesTotal:this.get("size"),percentLoaded:Math.min(100,Math.round(1e4*e.loaded/this.get("size"))/100)}),this._set("bytesUploaded",e.loaded);break;case"load":if(t.status>=200&&t.status<=299){this.fire("uploadcomplete",{originEvent:e,data:e.target.responseText});var n=t.upload,r=this.get("boundEventHandler");n.removeEventListener("progress",r),n.removeEventListener("error",r),n.removeEventListener("abort",r),t.removeEventListener("load",r),t.removeEventListener("error",r),t.removeEventListener("readystatechange",r),this._set("xhr",null)}else this.fire("uploaderror",{originEvent:e,status:t.status,statusText:t.statusText,source:"http"});break;case"error":this.fire("uploaderror",{originEvent:e,status:t.status,statusText:t.statusText,source:"io"});break;case"abort":this.fire("uploadcancel",{originEvent:e});break;case"readystatechange":this.fire("readystatechange",{readyState:e.target.readyState,originEvent:e})}},startUpload:function(t,n,i){this._set("bytesUploaded",0),this._set("xhr",new XMLHttpRequest),this._set("boundEventHandler",r(this._uploadEventHandler,this));var s=new FormData,o=i||"Filedata",u=this.get("xhr"),a=this.get("xhr").upload,f=this.get("boundEventHandler");e.each(n,function(e,t){s.append(t,e)}),s.append(o,this.get("file")),u.addEventListener("loadstart",f,!1),a.addEventListener("progress",f,!1),u.addEventListener("load",f,!1),u.addEventListener("error",f,!1),a.addEventListener("error",f,!1),a.addEventListener("abort",f,!1),u.addEventListener("abort",f,!1),u.addEventListener("loadend",f,!1),u.addEventListener("readystatechange",f,!1),u.open("POST",t,!0),u.withCredentials=this.get("xhrWithCredentials"),e.each(this.get("xhrHeaders"),function(e,t){u.setRequestHeader(t,e)}),u.send(s),this.fire("uploadstart",{xhr:u})},cancelUpload:function(){this.get("xhr").abort()}},{NAME:"file",TYPE:"html5",ATTRS:{id:{writeOnce:"initOnly",value:null},size:{writeOnce:"initOnly",value:0},name:{writeOnce:"initOnly",value:null},dateCreated:{writeOnce:"initOnly",value:null},dateModified:{writeOnce:"initOnly",value:null},bytesUploaded:{readOnly:!0,value:0},type:{writeOnce:"initOnly",value:null},file:{writeOnce:"initOnly",value:null},xhr:{readOnly:!0,value:null},xhrHeaders:{value:{}},xhrWithCredentials:{value:!0},boundEventHandler:{readOnly:!0,value:null}},isValidFile:function(e){return i&&i.File&&e instanceof File},canUpload:function(){return i&&i.FormData&&i.XMLHttpRequest}}),e.FileHTML5=s},"@VERSION@",{requires:["base"]})
zhangbg/cdnjs
ajax/libs/yui/3.7.0pr2/file-html5/file-html5-min.js
JavaScript
mit
3,235
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var assert = require("../../test/assertions"); var coffee = require("./coffee"); function assertLocation(e, sl, sc, el, ec) { var l = e.location; assert.equal( l.first_line + ":" + l.first_column + "->" + l.last_line + ":" + l.last_column, sl + ":" + sc + "->" + el + ":" + ec ); } function parse(str) { try { coffee.compile(str); } catch (e) { return e; } } module.exports = { "test parse valid coffee script": function() { coffee.compile("square = (x) -> x * x"); }, "test parse invalid coffee script": function() { var e = parse("a = 12 f"); assert.equal(e.message, "unexpected identifier"); assertLocation(e, 0, 7, 0, 7); }, "test parse missing bracket": function() { var e = parse("a = 12 f {\n\n"); assert.equal(e.message, "missing }"); assertLocation(e, 0, 9, 0, 9); }, "test unexpected indent": function() { var e = parse("a\n a\n"); assert.equal(e.message, "unexpected indentation"); assertLocation(e, 1, 0, 1, 1); }, "test invalid destructuring": function() { var e = parse("\n{b: 5} = {}"); assert.equal(e.message, '"5" cannot be assigned'); assertLocation(e, 1, 4, 1, 4); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); }
IPRIT/acm-2017
app/bower_components/ace/lib/ace/mode/coffee/parser_test.js
JavaScript
mit
3,243
YUI.add('event-custom-complex', function(Y) { /** * Adds event facades, preventable default behavior, and bubbling. * events. * @module event-custom * @submodule event-custom-complex */ var FACADE, FACADE_KEYS, key, EMPTY = {}, CEProto = Y.CustomEvent.prototype, ETProto = Y.EventTarget.prototype, mixFacadeProps = function(facade, payload) { var p; for (p in payload) { if (!(FACADE_KEYS.hasOwnProperty(p))) { facade[p] = payload[p]; } } }; /** * Wraps and protects a custom event for use when emitFacade is set to true. * Requires the event-custom-complex module * @class EventFacade * @param e {Event} the custom event * @param currentTarget {HTMLElement} the element the listener was attached to */ Y.EventFacade = function(e, currentTarget) { e = e || EMPTY; this._event = e; /** * The arguments passed to fire * @property details * @type Array */ this.details = e.details; /** * The event type, this can be overridden by the fire() payload * @property type * @type string */ this.type = e.type; /** * The real event type * @property _type * @type string * @private */ this._type = e.type; ////////////////////////////////////////////////////// /** * Node reference for the targeted eventtarget * @property target * @type Node */ this.target = e.target; /** * Node reference for the element that the listener was attached to. * @property currentTarget * @type Node */ this.currentTarget = currentTarget; /** * Node reference to the relatedTarget * @property relatedTarget * @type Node */ this.relatedTarget = e.relatedTarget; }; Y.mix(Y.EventFacade.prototype, { /** * Stops the propagation to the next bubble target * @method stopPropagation */ stopPropagation: function() { this._event.stopPropagation(); this.stopped = 1; }, /** * Stops the propagation to the next bubble target and * prevents any additional listeners from being exectued * on the current target. * @method stopImmediatePropagation */ stopImmediatePropagation: function() { this._event.stopImmediatePropagation(); this.stopped = 2; }, /** * Prevents the event's default behavior * @method preventDefault */ preventDefault: function() { this._event.preventDefault(); this.prevented = 1; }, /** * Stops the event propagation and prevents the default * event behavior. * @method halt * @param immediate {boolean} if true additional listeners * on the current target will not be executed */ halt: function(immediate) { this._event.halt(immediate); this.prevented = 1; this.stopped = (immediate) ? 2 : 1; } }); CEProto.fireComplex = function(args) { var es, ef, q, queue, ce, ret, events, subs, postponed, self = this, host = self.host || self, next, oldbubble; if (self.stack) { // queue this event if the current item in the queue bubbles if (self.queuable && self.type != self.stack.next.type) { self.log('queue ' + self.type); self.stack.queue.push([self, args]); return true; } } es = self.stack || { // id of the first event in the stack id: self.id, next: self, silent: self.silent, stopped: 0, prevented: 0, bubbling: null, type: self.type, // defaultFnQueue: new Y.Queue(), afterQueue: new Y.Queue(), defaultTargetOnly: self.defaultTargetOnly, queue: [] }; subs = self.getSubs(); self.stopped = (self.type !== es.type) ? 0 : es.stopped; self.prevented = (self.type !== es.type) ? 0 : es.prevented; self.target = self.target || host; if (self.stoppedFn) { events = new Y.EventTarget({ fireOnce: true, context: host }); self.events = events; events.on('stopped', self.stoppedFn); } self.currentTarget = host; self.details = args.slice(); // original arguments in the details // self.log("Firing " + self + ", " + "args: " + args); self.log("Firing " + self.type); self._facade = null; // kill facade to eliminate stale properties ef = self._getFacade(args); if (Y.Lang.isObject(args[0])) { args[0] = ef; } else { args.unshift(ef); } if (subs[0]) { self._procSubs(subs[0], args, ef); } // bubble if this is hosted in an event target and propagation has not been stopped if (self.bubbles && host.bubble && !self.stopped) { oldbubble = es.bubbling; es.bubbling = self.type; if (es.type != self.type) { es.stopped = 0; es.prevented = 0; } ret = host.bubble(self, args, null, es); self.stopped = Math.max(self.stopped, es.stopped); self.prevented = Math.max(self.prevented, es.prevented); es.bubbling = oldbubble; } if (self.prevented) { if (self.preventedFn) { self.preventedFn.apply(host, args); } } else if (self.defaultFn && ((!self.defaultTargetOnly && !es.defaultTargetOnly) || host === ef.target)) { self.defaultFn.apply(host, args); } // broadcast listeners are fired as discreet events on the // YUI instance and potentially the YUI global. self._broadcast(args); // Queue the after if (subs[1] && !self.prevented && self.stopped < 2) { if (es.id === self.id || self.type != host._yuievt.bubbling) { self._procSubs(subs[1], args, ef); while ((next = es.afterQueue.last())) { next(); } } else { postponed = subs[1]; if (es.execDefaultCnt) { postponed = Y.merge(postponed); Y.each(postponed, function(s) { s.postponed = true; }); } es.afterQueue.add(function() { self._procSubs(postponed, args, ef); }); } } self.target = null; if (es.id === self.id) { queue = es.queue; while (queue.length) { q = queue.pop(); ce = q[0]; // set up stack to allow the next item to be processed es.next = ce; ce.fire.apply(ce, q[1]); } self.stack = null; } ret = !(self.stopped); if (self.type != host._yuievt.bubbling) { es.stopped = 0; es.prevented = 0; self.stopped = 0; self.prevented = 0; } // Kill the cached facade to free up memory. // Otherwise we have the facade from the last fire, sitting around forever. self._facade = null; return ret; }; CEProto._getFacade = function() { var ef = this._facade, o, args = this.details; if (!ef) { ef = new Y.EventFacade(this, this.currentTarget); } // if the first argument is an object literal, apply the // properties to the event facade o = args && args[0]; if (Y.Lang.isObject(o, true)) { // protect the event facade properties mixFacadeProps(ef, o); // Allow the event type to be faked // http://yuilibrary.com/projects/yui3/ticket/2528376 ef.type = o.type || ef.type; } // update the details field with the arguments // ef.type = this.type; ef.details = this.details; // use the original target when the event bubbled to this target ef.target = this.originalTarget || this.target; ef.currentTarget = this.currentTarget; ef.stopped = 0; ef.prevented = 0; this._facade = ef; return this._facade; }; /** * Stop propagation to bubble targets * @for CustomEvent * @method stopPropagation */ CEProto.stopPropagation = function() { this.stopped = 1; if (this.stack) { this.stack.stopped = 1; } if (this.events) { this.events.fire('stopped', this); } }; /** * Stops propagation to bubble targets, and prevents any remaining * subscribers on the current target from executing. * @method stopImmediatePropagation */ CEProto.stopImmediatePropagation = function() { this.stopped = 2; if (this.stack) { this.stack.stopped = 2; } if (this.events) { this.events.fire('stopped', this); } }; /** * Prevents the execution of this event's defaultFn * @method preventDefault */ CEProto.preventDefault = function() { if (this.preventable) { this.prevented = 1; if (this.stack) { this.stack.prevented = 1; } } }; /** * Stops the event propagation and prevents the default * event behavior. * @method halt * @param immediate {boolean} if true additional listeners * on the current target will not be executed */ CEProto.halt = function(immediate) { if (immediate) { this.stopImmediatePropagation(); } else { this.stopPropagation(); } this.preventDefault(); }; /** * Registers another EventTarget as a bubble target. Bubble order * is determined by the order registered. Multiple targets can * be specified. * * Events can only bubble if emitFacade is true. * * Included in the event-custom-complex submodule. * * @method addTarget * @param o {EventTarget} the target to add * @for EventTarget */ ETProto.addTarget = function(o) { this._yuievt.targets[Y.stamp(o)] = o; this._yuievt.hasTargets = true; }; /** * Returns an array of bubble targets for this object. * @method getTargets * @return EventTarget[] */ ETProto.getTargets = function() { return Y.Object.values(this._yuievt.targets); }; /** * Removes a bubble target * @method removeTarget * @param o {EventTarget} the target to remove * @for EventTarget */ ETProto.removeTarget = function(o) { delete this._yuievt.targets[Y.stamp(o)]; }; /** * Propagate an event. Requires the event-custom-complex module. * @method bubble * @param evt {CustomEvent} the custom event to propagate * @return {boolean} the aggregated return value from Event.Custom.fire * @for EventTarget */ ETProto.bubble = function(evt, args, target, es) { var targs = this._yuievt.targets, ret = true, t, type = evt && evt.type, ce, i, bc, ce2, originalTarget = target || (evt && evt.target) || this, oldbubble; if (!evt || ((!evt.stopped) && targs)) { // Y.log('Bubbling ' + evt.type); for (i in targs) { if (targs.hasOwnProperty(i)) { t = targs[i]; ce = t.getEvent(type, true); ce2 = t.getSibling(type, ce); if (ce2 && !ce) { ce = t.publish(type); } oldbubble = t._yuievt.bubbling; t._yuievt.bubbling = type; // if this event was not published on the bubble target, // continue propagating the event. if (!ce) { if (t._yuievt.hasTargets) { t.bubble(evt, args, originalTarget, es); } } else { ce.sibling = ce2; // set the original target to that the target payload on the // facade is correct. ce.target = originalTarget; ce.originalTarget = originalTarget; ce.currentTarget = t; bc = ce.broadcast; ce.broadcast = false; // default publish may not have emitFacade true -- that // shouldn't be what the implementer meant to do ce.emitFacade = true; ce.stack = es; ret = ret && ce.fire.apply(ce, args || evt.details || []); ce.broadcast = bc; ce.originalTarget = null; // stopPropagation() was called if (ce.stopped) { break; } } t._yuievt.bubbling = oldbubble; } } } return ret; }; FACADE = new Y.EventFacade(); FACADE_KEYS = {}; // Flatten whitelist for (key in FACADE) { FACADE_KEYS[key] = true; } }, '@VERSION@' ,{requires:['event-custom-base']});
maruilian11/cdnjs
ajax/libs/yui/3.7.0pr1/event-custom-complex/event-custom-complex-debug.js
JavaScript
mit
12,675
YUI.add('autocomplete-base', function(Y) { /** * Provides automatic input completion or suggestions for text input fields and * textareas. * * @module autocomplete * @main autocomplete * @since 3.3.0 */ /** * <code>Y.Base</code> extension that provides core autocomplete logic (but no * UI implementation) for a text input field or textarea. Must be mixed into a * <code>Y.Base</code>-derived class to be useful. * * @submodule autocomplete-base */ /** * <p> * Extension that provides core autocomplete logic (but no UI implementation) * for a text input field or textarea. * </p> * * <p> * The <code>AutoCompleteBase</code> class provides events and attributes that * abstract away core autocomplete logic and configuration, but does not provide * a widget implementation or suggestion UI. For a prepackaged autocomplete * widget, see <code>AutoCompleteList</code>. * </p> * * <p> * This extension cannot be instantiated directly, since it doesn't provide an * actual implementation. It's intended to be mixed into a * <code>Y.Base</code>-based class or widget. * </p> * * <p> * <code>Y.Widget</code>-based example: * </p> * * <pre> * YUI().use('autocomplete-base', 'widget', function (Y) { * &nbsp;&nbsp;var MyAC = Y.Base.create('myAC', Y.Widget, [Y.AutoCompleteBase], { * &nbsp;&nbsp;&nbsp;&nbsp;// Custom prototype methods and properties. * &nbsp;&nbsp;}, { * &nbsp;&nbsp;&nbsp;&nbsp;// Custom static methods and properties. * &nbsp;&nbsp;}); * &nbsp; * &nbsp;&nbsp;// Custom implementation code. * }); * </pre> * * <p> * <code>Y.Base</code>-based example: * </p> * * <pre> * YUI().use('autocomplete-base', function (Y) { * &nbsp;&nbsp;var MyAC = Y.Base.create('myAC', Y.Base, [Y.AutoCompleteBase], { * &nbsp;&nbsp;&nbsp;&nbsp;initializer: function () { * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this._bindUIACBase(); * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this._syncUIACBase(); * &nbsp;&nbsp;&nbsp;&nbsp;}, * &nbsp; * &nbsp;&nbsp;&nbsp;&nbsp;// Custom prototype methods and properties. * &nbsp;&nbsp;}, { * &nbsp;&nbsp;&nbsp;&nbsp;// Custom static methods and properties. * &nbsp;&nbsp;}); * &nbsp; * &nbsp;&nbsp;// Custom implementation code. * }); * </pre> * * @class AutoCompleteBase */ var Escape = Y.Escape, Lang = Y.Lang, YArray = Y.Array, YObject = Y.Object, isFunction = Lang.isFunction, isString = Lang.isString, trim = Lang.trim, INVALID_VALUE = Y.Attribute.INVALID_VALUE, _FUNCTION_VALIDATOR = '_functionValidator', _SOURCE_SUCCESS = '_sourceSuccess', ALLOW_BROWSER_AC = 'allowBrowserAutocomplete', INPUT_NODE = 'inputNode', QUERY = 'query', QUERY_DELIMITER = 'queryDelimiter', REQUEST_TEMPLATE = 'requestTemplate', RESULTS = 'results', RESULT_LIST_LOCATOR = 'resultListLocator', VALUE = 'value', VALUE_CHANGE = 'valueChange', EVT_CLEAR = 'clear', EVT_QUERY = QUERY, EVT_RESULTS = RESULTS; function AutoCompleteBase() { // AOP bindings. Y.before(this._bindUIACBase, this, 'bindUI'); Y.before(this._destructorACBase, this, 'destructor'); Y.before(this._syncUIACBase, this, 'syncUI'); // -- Public Events -------------------------------------------------------- /** * Fires after the query has been completely cleared or no longer meets the * minimum query length requirement. * * @event clear * @param {EventFacade} e Event facade with the following additional * properties: * * <dl> * <dt>prevVal (String)</dt> * <dd> * Value of the query before it was cleared. * </dd> * </dl> * * @preventable _defClearFn */ this.publish(EVT_CLEAR, { defaultFn: this._defClearFn }); /** * Fires when the contents of the input field have changed and the input * value meets the criteria necessary to generate an autocomplete query. * * @event query * @param {EventFacade} e Event facade with the following additional * properties: * * <dl> * <dt>inputValue (String)</dt> * <dd> * Full contents of the text input field or textarea that generated * the query. * </dd> * * <dt>query (String)</dt> * <dd> * Autocomplete query. This is the string that will be used to * request completion results. It may or may not be the same as * <code>inputValue</code>. * </dd> * </dl> * * @preventable _defQueryFn */ this.publish(EVT_QUERY, { defaultFn: this._defQueryFn }); /** * Fires after query results are received from the <code>source</code>. If * no source has been set, this event will not fire. * * @event results * @param {EventFacade} e Event facade with the following additional * properties: * * <dl> * <dt>data (Array|Object)</dt> * <dd> * Raw, unfiltered result data (if available). * </dd> * * <dt>query (String)</dt> * <dd> * Query that generated these results. * </dd> * * <dt>results (Array)</dt> * <dd> * Array of filtered, formatted, and highlighted results. Each item in * the array is an object with the following properties: * * <dl> * <dt>display (Node|HTMLElement|String)</dt> * <dd> * Formatted result HTML suitable for display to the user. If no * custom formatter is set, this will be an HTML-escaped version of * the string in the <code>text</code> property. * </dd> * * <dt>highlighted (String)</dt> * <dd> * Highlighted (but not formatted) result text. This property will * only be set if a highlighter is in use. * </dd> * * <dt>raw (mixed)</dt> * <dd> * Raw, unformatted result in whatever form it was provided by the * <code>source</code>. * </dd> * * <dt>text (String)</dt> * <dd> * Plain text version of the result, suitable for being inserted * into the value of a text input field or textarea when the result * is selected by a user. This value is not HTML-escaped and should * not be inserted into the page using innerHTML. * </dd> * </dl> * </dd> * </dl> * * @preventable _defResultsFn */ this.publish(EVT_RESULTS, { defaultFn: this._defResultsFn }); } // -- Public Static Properties ------------------------------------------------- AutoCompleteBase.ATTRS = { /** * Whether or not to enable the browser's built-in autocomplete * functionality for input fields. * * @attribute allowBrowserAutocomplete * @type Boolean * @default false */ allowBrowserAutocomplete: { value: false }, /** * When a <code>queryDelimiter</code> is set, trailing delimiters will * automatically be stripped from the input value by default when the * input node loses focus. Set this to <code>true</code> to allow trailing * delimiters. * * @attribute allowTrailingDelimiter * @type Boolean * @default false */ allowTrailingDelimiter: { value: false }, /** * Node to monitor for changes, which will generate <code>query</code> * events when appropriate. May be either an input field or a textarea. * * @attribute inputNode * @type Node|HTMLElement|String * @writeonce */ inputNode: { setter: Y.one, writeOnce: 'initOnly' }, /** * Maximum number of results to return. A value of <code>0</code> or less * will allow an unlimited number of results. * * @attribute maxResults * @type Number * @default 0 */ maxResults: { value: 0 }, /** * Minimum number of characters that must be entered before a * <code>query</code> event will be fired. A value of <code>0</code> * allows empty queries; a negative value will effectively disable all * <code>query</code> events. * * @attribute minQueryLength * @type Number * @default 1 */ minQueryLength: { value: 1 }, /** * <p> * Current query, or <code>null</code> if there is no current query. * </p> * * <p> * The query might not be the same as the current value of the input * node, both for timing reasons (due to <code>queryDelay</code>) and * because when one or more <code>queryDelimiter</code> separators are * in use, only the last portion of the delimited input string will be * used as the query value. * </p> * * @attribute query * @type String|null * @default null * @readonly */ query: { readOnly: true, value: null }, /** * <p> * Number of milliseconds to delay after input before triggering a * <code>query</code> event. If new input occurs before this delay is * over, the previous input event will be ignored and a new delay will * begin. * </p> * * <p> * This can be useful both to throttle queries to a remote data source * and to avoid distracting the user by showing them less relevant * results before they've paused their typing. * </p> * * @attribute queryDelay * @type Number * @default 100 */ queryDelay: { value: 100 }, /** * Query delimiter string. When a delimiter is configured, the input value * will be split on the delimiter, and only the last portion will be used in * autocomplete queries and updated when the <code>query</code> attribute is * modified. * * @attribute queryDelimiter * @type String|null * @default null */ queryDelimiter: { value: null }, /** * <p> * Source request template. This can be a function that accepts a query as a * parameter and returns a request string, or it can be a string containing * the placeholder "{query}", which will be replaced with the actual * URI-encoded query. In either case, the resulting string will be appended * to the request URL when the <code>source</code> attribute is set to a * remote DataSource, JSONP URL, or XHR URL (it will not be appended to YQL * URLs). * </p> * * <p> * While <code>requestTemplate</code> may be set to either a function or * a string, it will always be returned as a function that accepts a * query argument and returns a string. * </p> * * @attribute requestTemplate * @type Function|String|null * @default null */ requestTemplate: { setter: '_setRequestTemplate', value: null }, /** * <p> * Array of local result filter functions. If provided, each filter * will be called with two arguments when results are received: the query * and an array of result objects. See the documentation for the * <code>results</code> event for a list of the properties available on each * result object. * </p> * * <p> * Each filter is expected to return a filtered or modified version of the * results array, which will then be passed on to subsequent filters, then * the <code>resultHighlighter</code> function (if set), then the * <code>resultFormatter</code> function (if set), and finally to * subscribers to the <code>results</code> event. * </p> * * <p> * If no <code>source</code> is set, result filters will not be called. * </p> * * <p> * Prepackaged result filters provided by the autocomplete-filters and * autocomplete-filters-accentfold modules can be used by specifying the * filter name as a string, such as <code>'phraseMatch'</code> (assuming * the necessary filters module is loaded). * </p> * * @attribute resultFilters * @type Array * @default [] */ resultFilters: { setter: '_setResultFilters', value: [] }, /** * <p> * Function which will be used to format results. If provided, this function * will be called with two arguments after results have been received and * filtered: the query and an array of result objects. The formatter is * expected to return an array of HTML strings or Node instances containing * the desired HTML for each result. * </p> * * <p> * See the documentation for the <code>results</code> event for a list of * the properties available on each result object. * </p> * * <p> * If no <code>source</code> is set, the formatter will not be called. * </p> * * @attribute resultFormatter * @type Function|null */ resultFormatter: { validator: _FUNCTION_VALIDATOR }, /** * <p> * Function which will be used to highlight results. If provided, this * function will be called with two arguments after results have been * received and filtered: the query and an array of filtered result objects. * The highlighter is expected to return an array of highlighted result * text in the form of HTML strings. * </p> * * <p> * See the documentation for the <code>results</code> event for a list of * the properties available on each result object. * </p> * * <p> * If no <code>source</code> is set, the highlighter will not be called. * </p> * * @attribute resultHighlighter * @type Function|null */ resultHighlighter: { setter: '_setResultHighlighter' }, /** * <p> * Locator that should be used to extract an array of results from a * non-array response. * </p> * * <p> * By default, no locator is applied, and all responses are assumed to be * arrays by default. If all responses are already arrays, you don't need to * define a locator. * </p> * * <p> * The locator may be either a function (which will receive the raw response * as an argument and must return an array) or a string representing an * object path, such as "foo.bar.baz" (which would return the value of * <code>result.foo.bar.baz</code> if the response is an object). * </p> * * <p> * While <code>resultListLocator</code> may be set to either a function or a * string, it will always be returned as a function that accepts a response * argument and returns an array. * </p> * * @attribute resultListLocator * @type Function|String|null */ resultListLocator: { setter: '_setLocator' }, /** * Current results, or an empty array if there are no results. * * @attribute results * @type Array * @default [] * @readonly */ results: { readOnly: true, value: [] }, /** * <p> * Locator that should be used to extract a plain text string from a * non-string result item. The resulting text value will typically be the * value that ends up being inserted into an input field or textarea when * the user of an autocomplete implementation selects a result. * </p> * * <p> * By default, no locator is applied, and all results are assumed to be * plain text strings. If all results are already plain text strings, you * don't need to define a locator. * </p> * * <p> * The locator may be either a function (which will receive the raw result * as an argument and must return a string) or a string representing an * object path, such as "foo.bar.baz" (which would return the value of * <code>result.foo.bar.baz</code> if the result is an object). * </p> * * <p> * While <code>resultTextLocator</code> may be set to either a function or a * string, it will always be returned as a function that accepts a result * argument and returns a string. * </p> * * @attribute resultTextLocator * @type Function|String|null */ resultTextLocator: { setter: '_setLocator' }, /** * <p> * Source for autocomplete results. The following source types are * supported: * </p> * * <dl> * <dt>Array</dt> * <dd> * <p> * <i>Example:</i> <code>['first result', 'second result', 'etc']</code> * </p> * * <p> * The full array will be provided to any configured filters for each * query. This is an easy way to create a fully client-side autocomplete * implementation. * </p> * </dd> * * <dt>DataSource</dt> * <dd> * <p> * A <code>DataSource</code> instance or other object that provides a * DataSource-like <code>sendRequest</code> method. See the * <code>DataSource</code> documentation for details. * </p> * </dd> * * <dt>Function</dt> * <dd> * <p> * <i>Example (synchronous):</i> <code>function (query) { return ['foo', 'bar']; }</code><br> <i>Example (async):</i> <code>function (query, callback) { callback(['foo', 'bar']); }</code> * </p> * * <p> * A function source will be called with the current query and a * callback function as parameters, and should either return an array of * results (for synchronous operation) or return nothing and pass an * array of results to the provided callback (for asynchronous * operation). * </p> * </dd> * * <dt>Object</dt> * <dd> * <p> * <i>Example:</i> <code>{foo: ['foo result 1', 'foo result 2'], bar: ['bar result']}</code> * </p> * * <p> * An object will be treated as a query hashmap. If a property on the * object matches the current query, the value of that property will be * used as the response. * </p> * * <p> * The response is assumed to be an array of results by default. If the * response is not an array, provide a <code>resultListLocator</code> to * process the response and return an array. * </p> * </dd> * </dl> * * <p> * If the optional <code>autocomplete-sources</code> module is loaded, then * the following additional source types will be supported as well: * </p> * * <dl> * <dt>&lt;select&gt; Node</dt> * <dd> * <p> * You may provide a YUI Node instance wrapping a &lt;select&gt; * element, and the options in the list will be used as results. You * will also need to specify a <code>resultTextLocator</code> of 'text' * or 'value', depending on what you want to use as the text of the * result. * </p> * * <p> * Each result will be an object with the following properties: * </p> * * <dl> * <dt>html (String)</dt> * <dd> * <p>HTML content of the &lt;option&gt; element.</p> * </dd> * * <dt>index (Number)</dt> * <dd> * <p>Index of the &lt;option&gt; element in the list.</p> * </dd> * * <dt>node (Y.Node)</dt> * <dd> * <p>Node instance referring to the original &lt;option&gt; element.</p> * </dd> * * <dt>selected (Boolean)</dt> * <dd> * <p>Whether or not this item is currently selected in the * &lt;select&gt; list.</p> * </dd> * * <dt>text (String)</dt> * <dd> * <p>Text content of the &lt;option&gt; element.</p> * </dd> * * <dt>value (String)</dt> * <dd> * <p>Value of the &lt;option&gt; element.</p> * </dd> * </dl> * </dd> * * <dt>String (JSONP URL)</dt> * <dd> * <p> * <i>Example:</i> <code>'http://example.com/search?q={query}&callback={callback}'</code> * </p> * * <p> * If a URL with a <code>{callback}</code> placeholder is provided, it * will be used to make a JSONP request. The <code>{query}</code> * placeholder will be replaced with the current query, and the * <code>{callback}</code> placeholder will be replaced with an * internally-generated JSONP callback name. Both placeholders must * appear in the URL, or the request will fail. An optional * <code>{maxResults}</code> placeholder may also be provided, and will * be replaced with the value of the maxResults attribute (or 1000 if * the maxResults attribute is 0 or less). * </p> * * <p> * The response is assumed to be an array of results by default. If the * response is not an array, provide a <code>resultListLocator</code> to * process the response and return an array. * </p> * * <p> * <strong>The <code>jsonp</code> module must be loaded in order for * JSONP URL sources to work.</strong> If the <code>jsonp</code> module * is not already loaded, it will be loaded on demand if possible. * </p> * </dd> * * <dt>String (XHR URL)</dt> * <dd> * <p> * <i>Example:</i> <code>'http://example.com/search?q={query}'</code> * </p> * * <p> * If a URL without a <code>{callback}</code> placeholder is provided, * it will be used to make a same-origin XHR request. The * <code>{query}</code> placeholder will be replaced with the current * query. An optional <code>{maxResults}</code> placeholder may also be * provided, and will be replaced with the value of the maxResults * attribute (or 1000 if the maxResults attribute is 0 or less). * </p> * * <p> * The response is assumed to be a JSON array of results by default. If * the response is a JSON object and not an array, provide a * <code>resultListLocator</code> to process the response and return an * array. If the response is in some form other than JSON, you will * need to use a custom DataSource instance as the source. * </p> * * <p> * <strong>The <code>io-base</code> and <code>json-parse</code> modules * must be loaded in order for XHR URL sources to work.</strong> If * these modules are not already loaded, they will be loaded on demand * if possible. * </p> * </dd> * * <dt>String (YQL query)</dt> * <dd> * <p> * <i>Example:</i> <code>'select * from search.suggest where query="{query}"'</code> * </p> * * <p> * If a YQL query is provided, it will be used to make a YQL request. * The <code>{query}</code> placeholder will be replaced with the * current autocomplete query. This placeholder must appear in the YQL * query, or the request will fail. An optional * <code>{maxResults}</code> placeholder may also be provided, and will * be replaced with the value of the maxResults attribute (or 1000 if * the maxResults attribute is 0 or less). * </p> * * <p> * <strong>The <code>yql</code> module must be loaded in order for YQL * sources to work.</strong> If the <code>yql</code> module is not * already loaded, it will be loaded on demand if possible. * </p> * </dd> * </dl> * * <p> * As an alternative to providing a source, you could simply listen for * <code>query</code> events and handle them any way you see fit. Providing * a source is optional, but will usually be simpler. * </p> * * @attribute source * @type Array|DataSource|Function|Node|Object|String|null */ source: { setter: '_setSource' }, /** * <p> * May be used to force a specific source type, overriding the automatic * source type detection. It should almost never be necessary to do this, * but as they taught us in the Boy Scouts, one should always be prepared, * so it's here if you need it. Be warned that if you set this attribute and * something breaks, it's your own fault. * </p> * * <p> * Supported <code>sourceType</code> values are: 'array', 'datasource', * 'function', and 'object'. * </p> * * <p> * If the <code>autocomplete-sources</code> module is loaded, the following * additional source types are supported: 'io', 'jsonp', 'select', * 'string', 'yql' * </p> * * @attribute sourceType * @type String */ sourceType: { value: null }, /** * If the <code>inputNode</code> specified at instantiation time has a * <code>node-tokeninput</code> plugin attached to it, this attribute will * be a reference to the <code>Y.Plugin.TokenInput</code> instance. * * @attribute tokenInput * @type Plugin.TokenInput * @readonly */ tokenInput: { readOnly: true }, /** * Current value of the input node. * * @attribute value * @type String * @default '' */ value: { // Why duplicate this._inputNode.get('value')? Because we need a // reliable way to track the source of value changes. We want to perform // completion when the user changes the value, but not when we change // the value. value: '' } }; AutoCompleteBase.CSS_PREFIX = 'ac'; AutoCompleteBase.UI_SRC = (Y.Widget && Y.Widget.UI_SRC) || 'ui'; /** * Mapping of built-in source types to their setter functions. DataSource * instances and DataSource-like objects are handled natively, so are not * mapped here. * * @property SOURCE_TYPES * @type {Object} * @static */ AutoCompleteBase.SOURCE_TYPES = { array : '_createArraySource', 'function': '_createFunctionSource', object : '_createObjectSource' }; AutoCompleteBase.prototype = { // -- Public Prototype Methods --------------------------------------------- /** * <p> * Sends a request to the configured source. If no source is configured, * this method won't do anything. * </p> * * <p> * Usually there's no reason to call this method manually; it will be * called automatically when user input causes a <code>query</code> event to * be fired. The only time you'll need to call this method manually is if * you want to force a request to be sent when no user input has occurred. * </p> * * @method sendRequest * @param {String} query (optional) Query to send. If specified, the * <code>query</code> attribute will be set to this query. If not * specified, the current value of the <code>query</code> attribute will * be used. * @param {Function} requestTemplate (optional) Request template function. * If not specified, the current value of the <code>requestTemplate</code> * attribute will be used. * @chainable */ sendRequest: function (query, requestTemplate) { var request, source = this.get('source'); if (query || query === '') { this._set(QUERY, query); } else { query = this.get(QUERY) || ''; } if (source) { if (!requestTemplate) { requestTemplate = this.get(REQUEST_TEMPLATE); } request = requestTemplate ? requestTemplate.call(this, query) : query; Y.log('sendRequest: ' + request, 'info', 'autocomplete-base'); source.sendRequest({ query : query, request: request, callback: { success: Y.bind(this._onResponse, this, query) } }); } return this; }, // -- Protected Lifecycle Methods ------------------------------------------ /** * Attaches event listeners and behaviors. * * @method _bindUIACBase * @protected */ _bindUIACBase: function () { var inputNode = this.get(INPUT_NODE), tokenInput = inputNode && inputNode.tokenInput; // If the inputNode has a node-tokeninput plugin attached, bind to the // plugin's inputNode instead. if (tokenInput) { inputNode = tokenInput.get(INPUT_NODE); this._set('tokenInput', tokenInput); } if (!inputNode) { Y.error('No inputNode specified.'); return; } this._inputNode = inputNode; this._acBaseEvents = new Y.EventHandle([ // This is the valueChange event on the inputNode, provided by the // event-valuechange module, not our own valueChange. inputNode.on(VALUE_CHANGE, this._onInputValueChange, this), inputNode.on('blur', this._onInputBlur, this), this.after(ALLOW_BROWSER_AC + 'Change', this._syncBrowserAutocomplete), this.after('sourceTypeChange', this._afterSourceTypeChange), this.after(VALUE_CHANGE, this._afterValueChange) ]); }, /** * Detaches AutoCompleteBase event listeners. * * @method _destructorACBase * @protected */ _destructorACBase: function () { this._acBaseEvents.detach(); }, /** * Synchronizes the UI state of the <code>inputNode</code>. * * @method _syncUIACBase * @protected */ _syncUIACBase: function () { this._syncBrowserAutocomplete(); this.set(VALUE, this.get(INPUT_NODE).get(VALUE)); }, // -- Protected Prototype Methods ------------------------------------------ /** * Creates a DataSource-like object that simply returns the specified array * as a response. See the <code>source</code> attribute for more details. * * @method _createArraySource * @param {Array} source * @return {Object} DataSource-like object. * @protected */ _createArraySource: function (source) { var that = this; return { type: 'array', sendRequest: function (request) { that[_SOURCE_SUCCESS](source.concat(), request); } }; }, /** * Creates a DataSource-like object that passes the query to a * custom-defined function, which is expected to call the provided callback * with an array of results. See the <code>source</code> attribute for more * details. * * @method _createFunctionSource * @param {Function} source Function that accepts a query and a callback as * parameters, and calls the callback with an array of results. * @return {Object} DataSource-like object. * @protected */ _createFunctionSource: function (source) { var that = this; return { type: 'function', sendRequest: function (request) { var value; function afterResults(results) { that[_SOURCE_SUCCESS](results || [], request); } // Allow both synchronous and asynchronous functions. If we get // a truthy return value, assume the function is synchronous. if ((value = source(request.query, afterResults))) { afterResults(value); } } }; }, /** * Creates a DataSource-like object that looks up queries as properties on * the specified object, and returns the found value (if any) as a response. * See the <code>source</code> attribute for more details. * * @method _createObjectSource * @param {Object} source * @return {Object} DataSource-like object. * @protected */ _createObjectSource: function (source) { var that = this; return { type: 'object', sendRequest: function (request) { var query = request.query; that[_SOURCE_SUCCESS]( YObject.owns(source, query) ? source[query] : [], request ); } }; }, /** * Returns <code>true</code> if <i>value</i> is either a function or * <code>null</code>. * * @method _functionValidator * @param {Function|null} value Value to validate. * @protected */ _functionValidator: function (value) { return value === null || isFunction(value); }, /** * Faster and safer alternative to Y.Object.getValue(). Doesn't bother * casting the path to an array (since we already know it's an array) and * doesn't throw an error if a value in the middle of the object hierarchy * is neither <code>undefined</code> nor an object. * * @method _getObjectValue * @param {Object} obj * @param {Array} path * @return {mixed} Located value, or <code>undefined</code> if the value was * not found at the specified path. * @protected */ _getObjectValue: function (obj, path) { if (!obj) { return; } for (var i = 0, len = path.length; obj && i < len; i++) { obj = obj[path[i]]; } return obj; }, /** * Parses result responses, performs filtering and highlighting, and fires * the <code>results</code> event. * * @method _parseResponse * @param {String} query Query that generated these results. * @param {Object} response Response containing results. * @param {Object} data Raw response data. * @protected */ _parseResponse: function (query, response, data) { var facade = { data : data, query : query, results: [] }, listLocator = this.get(RESULT_LIST_LOCATOR), results = [], unfiltered = response && response.results, filters, formatted, formatter, highlighted, highlighter, i, len, maxResults, result, text, textLocator; if (unfiltered && listLocator) { unfiltered = listLocator.call(this, unfiltered); } if (unfiltered && unfiltered.length) { filters = this.get('resultFilters'); textLocator = this.get('resultTextLocator'); // Create a lightweight result object for each result to make them // easier to work with. The various properties on the object // represent different formats of the result, and will be populated // as we go. for (i = 0, len = unfiltered.length; i < len; ++i) { result = unfiltered[i]; text = textLocator ? textLocator.call(this, result) : result.toString(); results.push({ display: Escape.html(text), raw : result, text : text }); } // Run the results through all configured result filters. Each // filter returns an array of (potentially fewer) result objects, // which is then passed to the next filter, and so on. for (i = 0, len = filters.length; i < len; ++i) { results = filters[i].call(this, query, results.concat()); if (!results) { Y.log("Filter didn't return anything.", 'warn', 'autocomplete-base'); return; } if (!results.length) { break; } } if (results.length) { formatter = this.get('resultFormatter'); highlighter = this.get('resultHighlighter'); maxResults = this.get('maxResults'); // If maxResults is set and greater than 0, limit the number of // results. if (maxResults && maxResults > 0 && results.length > maxResults) { results.length = maxResults; } // Run the results through the configured highlighter (if any). // The highlighter returns an array of highlighted strings (not // an array of result objects), and these strings are then added // to each result object. if (highlighter) { highlighted = highlighter.call(this, query, results.concat()); if (!highlighted) { Y.log("Highlighter didn't return anything.", 'warn', 'autocomplete-base'); return; } for (i = 0, len = highlighted.length; i < len; ++i) { result = results[i]; result.highlighted = highlighted[i]; result.display = result.highlighted; } } // Run the results through the configured formatter (if any) to // produce the final formatted results. The formatter returns an // array of strings or Node instances (not an array of result // objects), and these strings/Nodes are then added to each // result object. if (formatter) { formatted = formatter.call(this, query, results.concat()); if (!formatted) { Y.log("Formatter didn't return anything.", 'warn', 'autocomplete-base'); return; } for (i = 0, len = formatted.length; i < len; ++i) { results[i].display = formatted[i]; } } } } facade.results = results; this.fire(EVT_RESULTS, facade); }, /** * <p> * Returns the query portion of the specified input value, or * <code>null</code> if there is no suitable query within the input value. * </p> * * <p> * If a query delimiter is defined, the query will be the last delimited * part of of the string. * </p> * * @method _parseValue * @param {String} value Input value from which to extract the query. * @return {String|null} query * @protected */ _parseValue: function (value) { var delim = this.get(QUERY_DELIMITER); if (delim) { value = value.split(delim); value = value[value.length - 1]; } return Lang.trimLeft(value); }, /** * Setter for locator attributes. * * @method _setLocator * @param {Function|String|null} locator * @return {Function|null} * @protected */ _setLocator: function (locator) { if (this[_FUNCTION_VALIDATOR](locator)) { return locator; } var that = this; locator = locator.toString().split('.'); return function (result) { return result && that._getObjectValue(result, locator); }; }, /** * Setter for the <code>requestTemplate</code> attribute. * * @method _setRequestTemplate * @param {Function|String|null} template * @return {Function|null} * @protected */ _setRequestTemplate: function (template) { if (this[_FUNCTION_VALIDATOR](template)) { return template; } template = template.toString(); return function (query) { return Lang.sub(template, {query: encodeURIComponent(query)}); }; }, /** * Setter for the <code>resultFilters</code> attribute. * * @method _setResultFilters * @param {Array|Function|String|null} filters <code>null</code>, a filter * function, an array of filter functions, or a string or array of strings * representing the names of methods on * <code>Y.AutoCompleteFilters</code>. * @return {Array} Array of filter functions (empty if <i>filters</i> is * <code>null</code>). * @protected */ _setResultFilters: function (filters) { var acFilters, getFilterFunction; if (filters === null) { return []; } acFilters = Y.AutoCompleteFilters; getFilterFunction = function (filter) { if (isFunction(filter)) { return filter; } if (isString(filter) && acFilters && isFunction(acFilters[filter])) { return acFilters[filter]; } return false; }; if (Lang.isArray(filters)) { filters = YArray.map(filters, getFilterFunction); return YArray.every(filters, function (f) { return !!f; }) ? filters : INVALID_VALUE; } else { filters = getFilterFunction(filters); return filters ? [filters] : INVALID_VALUE; } }, /** * Setter for the <code>resultHighlighter</code> attribute. * * @method _setResultHighlighter * @param {Function|String|null} highlighter <code>null</code>, a * highlighter function, or a string representing the name of a method on * <code>Y.AutoCompleteHighlighters</code>. * @return {Function|null} * @protected */ _setResultHighlighter: function (highlighter) { var acHighlighters; if (this._functionValidator(highlighter)) { return highlighter; } acHighlighters = Y.AutoCompleteHighlighters; if (isString(highlighter) && acHighlighters && isFunction(acHighlighters[highlighter])) { return acHighlighters[highlighter]; } return INVALID_VALUE; }, /** * Setter for the <code>source</code> attribute. Returns a DataSource or * a DataSource-like object depending on the type of <i>source</i> and/or * the value of the <code>sourceType</code> attribute. * * @method _setSource * @param {mixed} source AutoComplete source. See the <code>source</code> * attribute for details. * @return {DataSource|Object} * @protected */ _setSource: function (source) { var sourceType = this.get('sourceType') || Lang.type(source), sourceSetter; if ((source && isFunction(source.sendRequest)) || source === null || sourceType === 'datasource') { // Quacks like a DataSource instance (or null). Make it so! this._rawSource = source; return source; } // See if there's a registered setter for this source type. if ((sourceSetter = AutoCompleteBase.SOURCE_TYPES[sourceType])) { this._rawSource = source; return Lang.isString(sourceSetter) ? this[sourceSetter](source) : sourceSetter(source); } Y.error("Unsupported source type '" + sourceType + "'. Maybe autocomplete-sources isn't loaded?"); return INVALID_VALUE; }, /** * Shared success callback for non-DataSource sources. * * @method _sourceSuccess * @param {mixed} data Response data. * @param {Object} request Request object. * @protected */ _sourceSuccess: function (data, request) { request.callback.success({ data: data, response: {results: data} }); }, /** * Synchronizes the UI state of the <code>allowBrowserAutocomplete</code> * attribute. * * @method _syncBrowserAutocomplete * @protected */ _syncBrowserAutocomplete: function () { var inputNode = this.get(INPUT_NODE); if (inputNode.get('nodeName').toLowerCase() === 'input') { inputNode.setAttribute('autocomplete', this.get(ALLOW_BROWSER_AC) ? 'on' : 'off'); } }, /** * <p> * Updates the query portion of the <code>value</code> attribute. * </p> * * <p> * If a query delimiter is defined, the last delimited portion of the input * value will be replaced with the specified <i>value</i>. * </p> * * @method _updateValue * @param {String} newVal New value. * @protected */ _updateValue: function (newVal) { var delim = this.get(QUERY_DELIMITER), insertDelim, len, prevVal; newVal = Lang.trimLeft(newVal); if (delim) { insertDelim = trim(delim); // so we don't double up on spaces prevVal = YArray.map(trim(this.get(VALUE)).split(delim), trim); len = prevVal.length; if (len > 1) { prevVal[len - 1] = newVal; newVal = prevVal.join(insertDelim + ' '); } newVal = newVal + insertDelim + ' '; } this.set(VALUE, newVal); }, // -- Protected Event Handlers --------------------------------------------- /** * Updates the current <code>source</code> based on the new * <code>sourceType</code> to ensure that the two attributes don't get out * of sync when they're changed separately. * * @method _afterSourceTypeChange * @param {EventFacade} e * @protected */ _afterSourceTypeChange: function (e) { if (this._rawSource) { this.set('source', this._rawSource); } }, /** * Handles change events for the <code>value</code> attribute. * * @method _afterValueChange * @param {EventFacade} e * @protected */ _afterValueChange: function (e) { var delay, fire, minQueryLength, newVal = e.newVal, query, that; // Don't query on value changes that didn't come from the user. if (e.src !== AutoCompleteBase.UI_SRC) { this._inputNode.set(VALUE, newVal); return; } Y.log('valueChange: new: "' + newVal + '"; old: "' + e.prevVal + '"', 'info', 'autocomplete-base'); minQueryLength = this.get('minQueryLength'); query = this._parseValue(newVal) || ''; if (minQueryLength >= 0 && query.length >= minQueryLength) { delay = this.get('queryDelay'); that = this; fire = function () { that.fire(EVT_QUERY, { inputValue: newVal, query : query }); }; if (delay) { clearTimeout(this._delay); this._delay = setTimeout(fire, delay); } else { fire(); } } else { clearTimeout(this._delay); this.fire(EVT_CLEAR, { prevVal: e.prevVal ? this._parseValue(e.prevVal) : null }); } }, /** * Handles <code>blur</code> events on the input node. * * @method _onInputBlur * @param {EventFacade} e * @protected */ _onInputBlur: function (e) { var delim = this.get(QUERY_DELIMITER), delimPos, newVal, value; // If a query delimiter is set and the input's value contains one or // more trailing delimiters, strip them. if (delim && !this.get('allowTrailingDelimiter')) { delim = Lang.trimRight(delim); value = newVal = this._inputNode.get(VALUE); if (delim) { while ((newVal = Lang.trimRight(newVal)) && (delimPos = newVal.length - delim.length) && newVal.lastIndexOf(delim) === delimPos) { newVal = newVal.substring(0, delimPos); } } else { // Delimiter is one or more space characters, so just trim the // value. newVal = Lang.trimRight(newVal); } if (newVal !== value) { this.set(VALUE, newVal); } } }, /** * Handles <code>valueChange</code> events on the input node and fires a * <code>query</code> event when the input value meets the configured * criteria. * * @method _onInputValueChange * @param {EventFacade} e * @protected */ _onInputValueChange: function (e) { var newVal = e.newVal; // Don't query if the internal value is the same as the new value // reported by valueChange. if (newVal === this.get(VALUE)) { return; } this.set(VALUE, newVal, {src: AutoCompleteBase.UI_SRC}); }, /** * Handles source responses and fires the <code>results</code> event. * * @method _onResponse * @param {EventFacade} e * @protected */ _onResponse: function (query, e) { // Ignore stale responses that aren't for the current query. if (query === (this.get(QUERY) || '')) { this._parseResponse(query || '', e.response, e.data); } }, // -- Protected Default Event Handlers ------------------------------------- /** * Default <code>clear</code> event handler. Sets the <code>results</code> * property to an empty array and <code>query</code> to null. * * @method _defClearFn * @protected */ _defClearFn: function () { this._set(QUERY, null); this._set(RESULTS, []); }, /** * Default <code>query</code> event handler. Sets the <code>query</code> * property and sends a request to the source if one is configured. * * @method _defQueryFn * @param {EventFacade} e * @protected */ _defQueryFn: function (e) { var query = e.query; Y.log('query: "' + query + '"; inputValue: "' + e.inputValue + '"', 'info', 'autocomplete-base'); this.sendRequest(query); // sendRequest will set the 'query' attribute }, /** * Default <code>results</code> event handler. Sets the <code>results</code> * property to the latest results. * * @method _defResultsFn * @param {EventFacade} e * @protected */ _defResultsFn: function (e) { Y.log('results: ' + Y.dump(e.results), 'info', 'autocomplete-base'); this._set(RESULTS, e[RESULTS]); } }; Y.AutoCompleteBase = AutoCompleteBase; }, '@VERSION@' ,{requires:['array-extras', 'base-build', 'escape', 'event-valuechange', 'node-base'], optional:['autocomplete-sources']});
upgle/cdnjs
ajax/libs/yui/3.5.0pr1/autocomplete-base/autocomplete-base-debug.js
JavaScript
mit
51,828
YUI.add('io-base', function (Y, NAME) { /** Base IO functionality. Provides basic XHR transport support. @module io @submodule io-base @for IO **/ var // List of events that comprise the IO event lifecycle. EVENTS = ['start', 'complete', 'end', 'success', 'failure', 'progress'], // Whitelist of used XHR response object properties. XHR_PROPS = ['status', 'statusText', 'responseText', 'responseXML'], win = Y.config.win, uid = 0; /** The IO class is a utility that brokers HTTP requests through a simplified interface. Specifically, it allows JavaScript to make HTTP requests to a resource without a page reload. The underlying transport for making same-domain requests is the XMLHttpRequest object. IO can also use Flash, if specified as a transport, for cross-domain requests. @class IO @constructor @param {Object} config Object of EventTarget's publish method configurations used to configure IO's events. IO can be called statically using {{#crossLink "YUI/io:method"}}YUI.io{{/crossLink}}. **/ function IO (config) { var io = this; io._uid = 'io:' + uid++; io._init(config); Y.io._map[io._uid] = io; } IO.prototype = { //-------------------------------------- // Properties //-------------------------------------- /** * A counter that increments for each transaction. * * @property _id * @private * @type {Number} */ _id: 0, /** * Object of IO HTTP headers sent with each transaction. * * @property _headers * @private * @type {Object} */ _headers: { 'X-Requested-With' : 'XMLHttpRequest' }, /** * Object that stores timeout values for any transaction with a defined * "timeout" configuration property. * * @property _timeout * @private * @type {Object} */ _timeout: {}, //-------------------------------------- // Methods //-------------------------------------- _init: function(config) { var io = this, i, len; io.cfg = config || {}; Y.augment(io, Y.EventTarget); for (i = 0, len = EVENTS.length; i < len; ++i) { // Publish IO global events with configurations, if any. // IO global events are set to broadcast by default. // These events use the "io:" namespace. io.publish('io:' + EVENTS[i], Y.merge({ broadcast: 1 }, config)); // Publish IO transaction events with configurations, if // any. These events use the "io-trn:" namespace. io.publish('io-trn:' + EVENTS[i], config); } }, /** * Method that creates a unique transaction object for each request. * * @method _create * @private * @param {Object} cfg Configuration object subset to determine if * the transaction is an XDR or file upload, * requiring an alternate transport. * @param {Number} id Transaction id * @return {Object} The transaction object */ _create: function(config, id) { var io = this, transaction = { id : Y.Lang.isNumber(id) ? id : io._id++, uid: io._uid }, alt = config.xdr ? config.xdr.use : null, form = config.form && config.form.upload ? 'iframe' : null, use; if (alt === 'native') { // Non-IE and IE >= 10 can use XHR level 2 and not rely on an // external transport. alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null; // Prevent "pre-flight" OPTIONS request by removing the // `X-Requested-With` HTTP header from CORS requests. This header // can be added back on a per-request basis, if desired. io.setHeader('X-Requested-With'); } use = alt || form; transaction = use ? Y.merge(Y.IO.customTransport(use), transaction) : Y.merge(Y.IO.defaultTransport(), transaction); if (transaction.notify) { config.notify = function (e, t, c) { io.notify(e, t, c); }; } if (!use) { if (win && win.FormData && config.data instanceof win.FormData) { transaction.c.upload.onprogress = function (e) { io.progress(transaction, e, config); }; transaction.c.onload = function (e) { io.load(transaction, e, config); }; transaction.c.onerror = function (e) { io.error(transaction, e, config); }; transaction.upload = true; } } return transaction; }, _destroy: function(transaction) { if (win && !transaction.notify && !transaction.xdr) { if (XHR && !transaction.upload) { transaction.c.onreadystatechange = null; } else if (transaction.upload) { transaction.c.upload.onprogress = null; transaction.c.onload = null; transaction.c.onerror = null; } else if (Y.UA.ie && !transaction.e) { // IE, when using XMLHttpRequest as an ActiveX Object, will throw // a "Type Mismatch" error if the event handler is set to "null". transaction.c.abort(); } } transaction = transaction.c = null; }, /** * Method for creating and firing events. * * @method _evt * @private * @param {String} eventName Event to be published. * @param {Object} transaction Transaction object. * @param {Object} config Configuration data subset for event subscription. */ _evt: function(eventName, transaction, config) { var io = this, params, args = config['arguments'], emitFacade = io.cfg.emitFacade, globalEvent = "io:" + eventName, trnEvent = "io-trn:" + eventName; // Workaround for #2532107 this.detach(trnEvent); if (transaction.e) { transaction.c = { status: 0, statusText: transaction.e }; } // Fire event with parameters or an Event Facade. params = [ emitFacade ? { id: transaction.id, data: transaction.c, cfg: config, 'arguments': args } : transaction.id ]; if (!emitFacade) { if (eventName === EVENTS[0] || eventName === EVENTS[2]) { if (args) { params.push(args); } } else { if (transaction.evt) { params.push(transaction.evt); } else { params.push(transaction.c); } if (args) { params.push(args); } } } params.unshift(globalEvent); // Fire global events. io.fire.apply(io, params); // Fire transaction events, if receivers are defined. if (config.on) { params[0] = trnEvent; io.once(trnEvent, config.on[eventName], config.context || Y); io.fire.apply(io, params); } }, /** * Fires event "io:start" and creates, fires a transaction-specific * start event, if `config.on.start` is defined. * * @method start * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ start: function(transaction, config) { /** * Signals the start of an IO request. * @event io:start */ this._evt(EVENTS[0], transaction, config); }, /** * Fires event "io:complete" and creates, fires a * transaction-specific "complete" event, if config.on.complete is * defined. * * @method complete * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ complete: function(transaction, config) { /** * Signals the completion of the request-response phase of a * transaction. Response status and data are accessible, if * available, in this event. * @event io:complete */ this._evt(EVENTS[1], transaction, config); }, /** * Fires event "io:end" and creates, fires a transaction-specific "end" * event, if config.on.end is defined. * * @method end * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ end: function(transaction, config) { /** * Signals the end of the transaction lifecycle. * @event io:end */ this._evt(EVENTS[2], transaction, config); this._destroy(transaction); }, /** * Fires event "io:success" and creates, fires a transaction-specific * "success" event, if config.on.success is defined. * * @method success * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ success: function(transaction, config) { /** * Signals an HTTP response with status in the 2xx range. * Fires after io:complete. * @event io:success */ this._evt(EVENTS[3], transaction, config); this.end(transaction, config); }, /** * Fires event "io:failure" and creates, fires a transaction-specific * "failure" event, if config.on.failure is defined. * * @method failure * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ failure: function(transaction, config) { /** * Signals an HTTP response with status outside of the 2xx range. * Fires after io:complete. * @event io:failure */ this._evt(EVENTS[4], transaction, config); this.end(transaction, config); }, /** * Fires event "io:progress" and creates, fires a transaction-specific * "progress" event -- for XMLHttpRequest file upload -- if * config.on.progress is defined. * * @method progress * @param {Object} transaction Transaction object. * @param {Object} progress event. * @param {Object} config Configuration object for the transaction. */ progress: function(transaction, e, config) { /** * Signals the interactive state during a file upload transaction. * This event fires after io:start and before io:complete. * @event io:progress */ transaction.evt = e; this._evt(EVENTS[5], transaction, config); }, /** * Fires event "io:complete" and creates, fires a transaction-specific * "complete" event -- for XMLHttpRequest file upload -- if * config.on.complete is defined. * * @method load * @param {Object} transaction Transaction object. * @param {Object} load event. * @param {Object} config Configuration object for the transaction. */ load: function (transaction, e, config) { transaction.evt = e.target; this._evt(EVENTS[1], transaction, config); }, /** * Fires event "io:failure" and creates, fires a transaction-specific * "failure" event -- for XMLHttpRequest file upload -- if * config.on.failure is defined. * * @method error * @param {Object} transaction Transaction object. * @param {Object} error event. * @param {Object} config Configuration object for the transaction. */ error: function (transaction, e, config) { transaction.evt = e; this._evt(EVENTS[4], transaction, config); }, /** * Retry an XDR transaction, using the Flash tranport, if the native * transport fails. * * @method _retry * @private * @param {Object} transaction Transaction object. * @param {String} uri Qualified path to transaction resource. * @param {Object} config Configuration object for the transaction. */ _retry: function(transaction, uri, config) { this._destroy(transaction); config.xdr.use = 'flash'; return this.send(uri, config, transaction.id); }, /** * Method that concatenates string data for HTTP GET transactions. * * @method _concat * @private * @param {String} uri URI or root data. * @param {String} data Data to be concatenated onto URI. * @return {String} */ _concat: function(uri, data) { uri += (uri.indexOf('?') === -1 ? '?' : '&') + data; return uri; }, /** * Stores default client headers for all transactions. If a label is * passed with no value argument, the header will be deleted. * * @method setHeader * @param {String} name HTTP header * @param {String} value HTTP header value */ setHeader: function(name, value) { if (value) { this._headers[name] = value; } else { delete this._headers[name]; } }, /** * Method that sets all HTTP headers to be sent in a transaction. * * @method _setHeaders * @private * @param {Object} transaction - XHR instance for the specific transaction. * @param {Object} headers - HTTP headers for the specific transaction, as * defined in the configuration object passed to YUI.io(). */ _setHeaders: function(transaction, headers) { headers = Y.merge(this._headers, headers); Y.Object.each(headers, function(value, name) { if (value !== 'disable') { transaction.setRequestHeader(name, headers[name]); } }); }, /** * Starts timeout count if the configuration object has a defined * timeout property. * * @method _startTimeout * @private * @param {Object} transaction Transaction object generated by _create(). * @param {Object} timeout Timeout in milliseconds. */ _startTimeout: function(transaction, timeout) { var io = this; io._timeout[transaction.id] = setTimeout(function() { io._abort(transaction, 'timeout'); }, timeout); }, /** * Clears the timeout interval started by _startTimeout(). * * @method _clearTimeout * @private * @param {Number} id - Transaction id. */ _clearTimeout: function(id) { clearTimeout(this._timeout[id]); delete this._timeout[id]; }, /** * Method that determines if a transaction response qualifies as success * or failure, based on the response HTTP status code, and fires the * appropriate success or failure events. * * @method _result * @private * @static * @param {Object} transaction Transaction object generated by _create(). * @param {Object} config Configuration object passed to io(). */ _result: function(transaction, config) { var status; // Firefox will throw an exception if attempting to access // an XHR object's status property, after a request is aborted. try { status = transaction.c.status; } catch(e) { status = 0; } // IE reports HTTP 204 as HTTP 1223. if (status >= 200 && status < 300 || status === 304 || status === 1223) { this.success(transaction, config); } else { this.failure(transaction, config); } }, /** * Event handler bound to onreadystatechange. * * @method _rS * @private * @param {Object} transaction Transaction object generated by _create(). * @param {Object} config Configuration object passed to YUI.io(). */ _rS: function(transaction, config) { var io = this; if (transaction.c.readyState === 4) { if (config.timeout) { io._clearTimeout(transaction.id); } // Yield in the event of request timeout or abort. setTimeout(function() { io.complete(transaction, config); io._result(transaction, config); }, 0); } }, /** * Terminates a transaction due to an explicit abort or timeout. * * @method _abort * @private * @param {Object} transaction Transaction object generated by _create(). * @param {String} type Identifies timed out or aborted transaction. */ _abort: function(transaction, type) { if (transaction && transaction.c) { transaction.e = type; transaction.c.abort(); } }, /** * Requests a transaction. `send()` is implemented as `Y.io()`. Each * transaction may include a configuration object. Its properties are: * * <dl> * <dt>method</dt> * <dd>HTTP method verb (e.g., GET or POST). If this property is not * not defined, the default value will be GET.</dd> * * <dt>data</dt> * <dd>This is the name-value string that will be sent as the * transaction data. If the request is HTTP GET, the data become * part of querystring. If HTTP POST, the data are sent in the * message body.</dd> * * <dt>xdr</dt> * <dd>Defines the transport to be used for cross-domain requests. * By setting this property, the transaction will use the specified * transport instead of XMLHttpRequest. The properties of the * transport object are: * <dl> * <dt>use</dt> * <dd>The transport to be used: 'flash' or 'native'</dd> * <dt>dataType</dt> * <dd>Set the value to 'XML' if that is the expected response * content type.</dd> * <dt>credentials</dt> * <dd>Set the value to 'true' to set XHR.withCredentials property to true.</dd> * </dl></dd> * * <dt>form</dt> * <dd>Form serialization configuration object. Its properties are: * <dl> * <dt>id</dt> * <dd>Node object or id of HTML form</dd> * <dt>useDisabled</dt> * <dd>`true` to also serialize disabled form field values * (defaults to `false`)</dd> * </dl></dd> * * <dt>on</dt> * <dd>Assigns transaction event subscriptions. Available events are: * <dl> * <dt>start</dt> * <dd>Fires when a request is sent to a resource.</dd> * <dt>complete</dt> * <dd>Fires when the transaction is complete.</dd> * <dt>success</dt> * <dd>Fires when the HTTP response status is within the 2xx * range.</dd> * <dt>failure</dt> * <dd>Fires when the HTTP response status is outside the 2xx * range, if an exception occurs, if the transation is aborted, * or if the transaction exceeds a configured `timeout`.</dd> * <dt>end</dt> * <dd>Fires at the conclusion of the transaction * lifecycle, after `success` or `failure`.</dd> * </dl> * * <p>Callback functions for `start` and `end` receive the id of the * transaction as a first argument. For `complete`, `success`, and * `failure`, callbacks receive the id and the response object * (usually the XMLHttpRequest instance). If the `arguments` * property was included in the configuration object passed to * `Y.io()`, the configured data will be passed to all callbacks as * the last argument.</p> * </dd> * * <dt>sync</dt> * <dd>Pass `true` to make a same-domain transaction synchronous. * <strong>CAVEAT</strong>: This will negatively impact the user * experience. Have a <em>very</em> good reason if you intend to use * this.</dd> * * <dt>context</dt> * <dd>The "`this'" object for all configured event handlers. If a * specific context is needed for individual callbacks, bind the * callback to a context using `Y.bind()`.</dd> * * <dt>headers</dt> * <dd>Object map of transaction headers to send to the server. The * object keys are the header names and the values are the header * values.</dd> * * <dt>username</dt> * <dd>Username to use in a HTTP authentication.</dd> * * <dt>password</dt> * <dd>Password to use in a HTTP authentication.</dd> * * <dt>timeout</dt> * <dd>Millisecond threshold for the transaction before being * automatically aborted.</dd> * * <dt>arguments</dt> * <dd>User-defined data passed to all registered event handlers. * This value is available as the second argument in the "start" and * "end" event handlers. It is the third argument in the "complete", * "success", and "failure" event handlers. <strong>Be sure to quote * this property name in the transaction configuration as * "arguments" is a reserved word in JavaScript</strong> (e.g. * `Y.io({ ..., "arguments": stuff })`).</dd> * </dl> * * @method send * @public * @param {String} uri Qualified path to transaction resource. * @param {Object} config Configuration object for the transaction. * @param {Number} id Transaction id, if already set. * @return {Object} An object containing: * <dl> * <dt>`id`</dt> * <dd> * The transaction ID for this request. * </dd> * <dt>`abort`</dt> * <dd> * A function to abort the current transaction. * </dd> * <dt>`isInProgress`</dt> * <dd> * A helper to determine whether the current transaction is in progress. * </dd> * <dt>`io`</dt> * <dd> * A reference to the IO object for this transaction. * </dd> * </dl> */ send: function(uri, config, id) { var transaction, method, i, len, sync, data, io = this, u = uri, response = {}; config = config ? Y.Object(config) : {}; transaction = io._create(config, id); method = config.method ? config.method.toUpperCase() : 'GET'; sync = config.sync; data = config.data; // Serialize a map object into a key-value string using // querystring-stringify-simple. if ((Y.Lang.isObject(data) && !data.nodeType) && !transaction.upload) { if (Y.QueryString && Y.QueryString.stringify) { config.data = data = Y.QueryString.stringify(data); } else { } } if (config.form) { if (config.form.upload) { // This is a file upload transaction, calling // upload() in io-upload-iframe. return io.upload(transaction, uri, config); } else { // Serialize HTML form data into a key-value string. data = io._serialize(config.form, data); } } // Convert falsy values to an empty string. This way IE can't be // rediculous and translate `undefined` to "undefined". data || (data = ''); if (data) { switch (method) { case 'GET': case 'HEAD': case 'DELETE': u = io._concat(u, data); data = ''; break; case 'POST': case 'PUT': // If Content-Type is defined in the configuration object, or // or as a default header, it will be used instead of // 'application/x-www-form-urlencoded; charset=UTF-8' config.headers = Y.merge({ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, config.headers); break; } } if (transaction.xdr) { // Route data to io-xdr module for flash and XDomainRequest. return io.xdr(u, transaction, config); } else if (transaction.notify) { // Route data to custom transport return transaction.c.send(transaction, uri, config); } if (!sync && !transaction.upload) { transaction.c.onreadystatechange = function() { io._rS(transaction, config); }; } try { // Determine if request is to be set as // synchronous or asynchronous. transaction.c.open(method, u, !sync, config.username || null, config.password || null); io._setHeaders(transaction.c, config.headers || {}); io.start(transaction, config); // Will work only in browsers that implement the // Cross-Origin Resource Sharing draft. if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) { transaction.c.withCredentials = true; } // Using "null" with HTTP POST will result in a request // with no Content-Length header defined. transaction.c.send(data); if (sync) { // Create a response object for synchronous transactions, // mixing id and arguments properties with the xhr // properties whitelist. for (i = 0, len = XHR_PROPS.length; i < len; ++i) { response[XHR_PROPS[i]] = transaction.c[XHR_PROPS[i]]; } response.getAllResponseHeaders = function() { return transaction.c.getAllResponseHeaders(); }; response.getResponseHeader = function(name) { return transaction.c.getResponseHeader(name); }; io.complete(transaction, config); io._result(transaction, config); return response; } } catch(e) { if (transaction.xdr) { // This exception is usually thrown by browsers // that do not support XMLHttpRequest Level 2. // Retry the request with the XDR transport set // to 'flash'. If the Flash transport is not // initialized or available, the transaction // will resolve to a transport error. return io._retry(transaction, uri, config); } else { io.complete(transaction, config); io._result(transaction, config); } } // If config.timeout is defined, and the request is standard XHR, // initialize timeout polling. if (config.timeout) { io._startTimeout(transaction, config.timeout); } return { id: transaction.id, abort: function() { return transaction.c ? io._abort(transaction, 'abort') : false; }, isInProgress: function() { return transaction.c ? (transaction.c.readyState % 4) : false; }, io: io }; } }; /** Method for initiating an ajax call. The first argument is the url end point for the call. The second argument is an object to configure the transaction and attach event subscriptions. The configuration object supports the following properties: <dl> <dt>method</dt> <dd>HTTP method verb (e.g., GET or POST). If this property is not not defined, the default value will be GET.</dd> <dt>data</dt> <dd>This is the name-value string that will be sent as the transaction data. If the request is HTTP GET, the data become part of querystring. If HTTP POST, the data are sent in the message body.</dd> <dt>xdr</dt> <dd>Defines the transport to be used for cross-domain requests. By setting this property, the transaction will use the specified transport instead of XMLHttpRequest. The properties of the transport object are: <dl> <dt>use</dt> <dd>The transport to be used: 'flash' or 'native'</dd> <dt>dataType</dt> <dd>Set the value to 'XML' if that is the expected response content type.</dd> </dl></dd> <dt>form</dt> <dd>Form serialization configuration object. Its properties are: <dl> <dt>id</dt> <dd>Node object or id of HTML form</dd> <dt>useDisabled</dt> <dd>`true` to also serialize disabled form field values (defaults to `false`)</dd> </dl></dd> <dt>on</dt> <dd>Assigns transaction event subscriptions. Available events are: <dl> <dt>start</dt> <dd>Fires when a request is sent to a resource.</dd> <dt>complete</dt> <dd>Fires when the transaction is complete.</dd> <dt>success</dt> <dd>Fires when the HTTP response status is within the 2xx range.</dd> <dt>failure</dt> <dd>Fires when the HTTP response status is outside the 2xx range, if an exception occurs, if the transation is aborted, or if the transaction exceeds a configured `timeout`.</dd> <dt>end</dt> <dd>Fires at the conclusion of the transaction lifecycle, after `success` or `failure`.</dd> </dl> <p>Callback functions for `start` and `end` receive the id of the transaction as a first argument. For `complete`, `success`, and `failure`, callbacks receive the id and the response object (usually the XMLHttpRequest instance). If the `arguments` property was included in the configuration object passed to `Y.io()`, the configured data will be passed to all callbacks as the last argument.</p> </dd> <dt>sync</dt> <dd>Pass `true` to make a same-domain transaction synchronous. <strong>CAVEAT</strong>: This will negatively impact the user experience. Have a <em>very</em> good reason if you intend to use this.</dd> <dt>context</dt> <dd>The "`this'" object for all configured event handlers. If a specific context is needed for individual callbacks, bind the callback to a context using `Y.bind()`.</dd> <dt>headers</dt> <dd>Object map of transaction headers to send to the server. The object keys are the header names and the values are the header values.</dd> <dt>timeout</dt> <dd>Millisecond threshold for the transaction before being automatically aborted.</dd> <dt>arguments</dt> <dd>User-defined data passed to all registered event handlers. This value is available as the second argument in the "start" and "end" event handlers. It is the third argument in the "complete", "success", and "failure" event handlers. <strong>Be sure to quote this property name in the transaction configuration as "arguments" is a reserved word in JavaScript</strong> (e.g. `Y.io({ ..., "arguments": stuff })`).</dd> </dl> @method io @static @param {String} url qualified path to transaction resource. @param {Object} config configuration object for the transaction. @return {Object} An object containing: <dl> <dt>`id`</dt> <dd> The transaction ID for this request. </dd> <dt>`abort`</dt> <dd> A function to abort the current transaction. </dd> <dt>`isInProgress`</dt> <dd> A helper to determine whether the current transaction is in progress. </dd> <dt>`io`</dt> <dd> A reference to the IO object for this transaction. </dd> </dl> @for YUI **/ Y.io = function(url, config) { // Calling IO through the static interface will use and reuse // an instance of IO. var transaction = Y.io._map['io:0'] || new IO(); return transaction.send.apply(transaction, [url, config]); }; /** Method for setting and deleting IO HTTP headers to be sent with every request. Hosted as a property on the `io` function (e.g. `Y.io.header`). @method header @param {String} name HTTP header @param {String} value HTTP header value @static **/ Y.io.header = function(name, value) { // Calling IO through the static interface will use and reuse // an instance of IO. var transaction = Y.io._map['io:0'] || new IO(); transaction.setHeader(name, value); }; Y.IO = IO; // Map of all IO instances created. Y.io._map = {}; var XHR = win && win.XMLHttpRequest, XDR = win && win.XDomainRequest, AX = win && win.ActiveXObject, // Checks for the presence of the `withCredentials` in an XHR instance // object, which will be present if the environment supports CORS. SUPPORTS_CORS = XHR && 'withCredentials' in (new XMLHttpRequest()); Y.mix(Y.IO, { /** * The ID of the default IO transport, defaults to `xhr` * @property _default * @type {String} * @static */ _default: 'xhr', /** * * @method defaultTransport * @static * @param {String} [id] The transport to set as the default, if empty a new transport is created. * @return {Object} The transport object with a `send` method */ defaultTransport: function(id) { if (id) { Y.IO._default = id; } else { var o = { c: Y.IO.transports[Y.IO._default](), notify: Y.IO._default === 'xhr' ? false : true }; return o; } }, /** * An object hash of custom transports available to IO * @property transports * @type {Object} * @static */ transports: { xhr: function () { return XHR ? new XMLHttpRequest() : AX ? new ActiveXObject('Microsoft.XMLHTTP') : null; }, xdr: function () { return XDR ? new XDomainRequest() : null; }, iframe: function () { return {}; }, flash: null, nodejs: null }, /** * Create a custom transport of type and return it's object * @method customTransport * @param {String} id The id of the transport to create. * @static */ customTransport: function(id) { var o = { c: Y.IO.transports[id]() }; o[(id === 'xdr' || id === 'flash') ? 'xdr' : 'notify'] = true; return o; } }); Y.mix(Y.IO.prototype, { /** * Fired from the notify method of the transport which in turn fires * the event on the IO object. * @method notify * @param {String} event The name of the event * @param {Object} transaction The transaction object * @param {Object} config The configuration object for this transaction */ notify: function(event, transaction, config) { var io = this; switch (event) { case 'timeout': case 'abort': case 'transport error': transaction.c = { status: 0, statusText: event }; event = 'failure'; default: io[event].apply(io, [transaction, config]); } } }); }, '3.18.0', {"requires": ["event-custom-base", "querystring-stringify-simple"]});
svenanders/cdnjs
ajax/libs/yui/3.18.0/io-base/io-base.js
JavaScript
mit
35,235
YUI.add('anim-base', function (Y, NAME) { /** * The Animation Utility provides an API for creating advanced transitions. * @module anim */ /** * Provides the base Anim class, for animating numeric properties. * * @module anim * @submodule anim-base */ /** * A class for constructing animation instances. * @class Anim * @for Anim * @constructor * @extends Base */ var RUNNING = 'running', START_TIME = 'startTime', ELAPSED_TIME = 'elapsedTime', /** * @for Anim * @event start * @description fires when an animation begins. * @param {Event} ev The start event. * @type Event.Custom */ START = 'start', /** * @event tween * @description fires every frame of the animation. * @param {Event} ev The tween event. * @type Event.Custom */ TWEEN = 'tween', /** * @event end * @description fires after the animation completes. * @param {Event} ev The end event. * @type Event.Custom */ END = 'end', NODE = 'node', PAUSED = 'paused', REVERSE = 'reverse', // TODO: cleanup ITERATION_COUNT = 'iterationCount', NUM = Number; var _running = {}, _timer; Y.Anim = function() { Y.Anim.superclass.constructor.apply(this, arguments); Y.Anim._instances[Y.stamp(this)] = this; }; Y.Anim.NAME = 'anim'; Y.Anim._instances = {}; /** * Regex of properties that should use the default unit. * * @property RE_DEFAULT_UNIT * @static */ Y.Anim.RE_DEFAULT_UNIT = /^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i; /** * The default unit to use with properties that pass the RE_DEFAULT_UNIT test. * * @property DEFAULT_UNIT * @static */ Y.Anim.DEFAULT_UNIT = 'px'; Y.Anim.DEFAULT_EASING = function (t, b, c, d) { return c * t / d + b; // linear easing }; /** * Time in milliseconds passed to setInterval for frame processing * * @property intervalTime * @default 20 * @static */ Y.Anim._intervalTime = 20; /** * Bucket for custom getters and setters * * @property behaviors * @static */ Y.Anim.behaviors = { left: { get: function(anim, attr) { return anim._getOffset(attr); } } }; Y.Anim.behaviors.top = Y.Anim.behaviors.left; /** * The default setter to use when setting object properties. * * @property DEFAULT_SETTER * @static */ Y.Anim.DEFAULT_SETTER = function(anim, att, from, to, elapsed, duration, fn, unit) { var node = anim._node, domNode = node._node, val = fn(elapsed, NUM(from), NUM(to) - NUM(from), duration); if (domNode) { if ('style' in domNode && (att in domNode.style || att in Y.DOM.CUSTOM_STYLES)) { unit = unit || ''; node.setStyle(att, val + unit); } else if ('attributes' in domNode && att in domNode.attributes) { node.setAttribute(att, val); } else if (att in domNode) { domNode[att] = val; } } else if (node.set) { node.set(att, val); } else if (att in node) { node[att] = val; } }; /** * The default getter to use when getting object properties. * * @property DEFAULT_GETTER * @static */ Y.Anim.DEFAULT_GETTER = function(anim, att) { var node = anim._node, domNode = node._node, val = ''; if (domNode) { if ('style' in domNode && (att in domNode.style || att in Y.DOM.CUSTOM_STYLES)) { val = node.getComputedStyle(att); } else if ('attributes' in domNode && att in domNode.attributes) { val = node.getAttribute(att); } else if (att in domNode) { val = domNode[att]; } } else if (node.get) { val = node.get(att); } else if (att in node) { val = node[att]; } return val; }; Y.Anim.ATTRS = { /** * The object to be animated. * @attribute node * @type Node */ node: { setter: function(node) { if (node) { if (typeof node === 'string' || node.nodeType) { node = Y.one(node); } } this._node = node; if (!node) { Y.log(node + ' is not a valid node', 'warn', 'Anim'); } return node; } }, /** * The length of the animation. Defaults to "1" (second). * @attribute duration * @type NUM */ duration: { value: 1 }, /** * The method that will provide values to the attribute(s) during the animation. * Defaults to "Easing.easeNone". * @attribute easing * @type Function */ easing: { value: Y.Anim.DEFAULT_EASING, setter: function(val) { if (typeof val === 'string' && Y.Easing) { return Y.Easing[val]; } } }, /** * The starting values for the animated properties. * * Fields may be strings, numbers, or functions. * If a function is used, the return value becomes the from value. * If no from value is specified, the DEFAULT_GETTER will be used. * Supports any unit, provided it matches the "to" (or default) * unit (e.g. `{width: '10em', color: 'rgb(0, 0, 0)', borderColor: '#ccc'}`). * * If using the default ('px' for length-based units), the unit may be omitted * (e.g. `{width: 100}, borderColor: 'ccc'}`, which defaults to pixels * and hex, respectively). * * @attribute from * @type Object */ from: {}, /** * The ending values for the animated properties. * * Fields may be strings, numbers, or functions. * Supports any unit, provided it matches the "from" (or default) * unit (e.g. `{width: '50%', color: 'red', borderColor: '#ccc'}`). * * If using the default ('px' for length-based units), the unit may be omitted * (e.g. `{width: 100, borderColor: 'ccc'}`, which defaults to pixels * and hex, respectively). * * @attribute to * @type Object */ to: {}, /** * Date stamp for the first frame of the animation. * @attribute startTime * @type Int * @default 0 * @readOnly */ startTime: { value: 0, readOnly: true }, /** * Current time the animation has been running. * @attribute elapsedTime * @type Int * @default 0 * @readOnly */ elapsedTime: { value: 0, readOnly: true }, /** * Whether or not the animation is currently running. * @attribute running * @type Boolean * @default false * @readOnly */ running: { getter: function() { return !!_running[Y.stamp(this)]; }, value: false, readOnly: true }, /** * The number of times the animation should run * @attribute iterations * @type Int * @default 1 */ iterations: { value: 1 }, /** * The number of iterations that have occurred. * Resets when an animation ends (reaches iteration count or stop() called). * @attribute iterationCount * @type Int * @default 0 * @readOnly */ iterationCount: { value: 0, readOnly: true }, /** * How iterations of the animation should behave. * Possible values are "normal" and "alternate". * Normal will repeat the animation, alternate will reverse on every other pass. * * @attribute direction * @type String * @default "normal" */ direction: { value: 'normal' // | alternate (fwd on odd, rev on even per spec) }, /** * Whether or not the animation is currently paused. * @attribute paused * @type Boolean * @default false * @readOnly */ paused: { readOnly: true, value: false }, /** * If true, the `from` and `to` attributes are swapped, * and the animation is then run starting from `from`. * @attribute reverse * @type Boolean * @default false */ reverse: { value: false } }; /** * Runs all animation instances. * @method run * @static */ Y.Anim.run = function() { var instances = Y.Anim._instances, i; for (i in instances) { if (instances[i].run) { instances[i].run(); } } }; /** * Pauses all animation instances. * @method pause * @static */ Y.Anim.pause = function() { for (var i in _running) { // stop timer if nothing running if (_running[i].pause) { _running[i].pause(); } } Y.Anim._stopTimer(); }; /** * Stops all animation instances. * @method stop * @static */ Y.Anim.stop = function() { for (var i in _running) { // stop timer if nothing running if (_running[i].stop) { _running[i].stop(); } } Y.Anim._stopTimer(); }; Y.Anim._startTimer = function() { if (!_timer) { _timer = setInterval(Y.Anim._runFrame, Y.Anim._intervalTime); } }; Y.Anim._stopTimer = function() { clearInterval(_timer); _timer = 0; }; /** * Called per Interval to handle each animation frame. * @method _runFrame * @private * @static */ Y.Anim._runFrame = function() { var done = true, anim; for (anim in _running) { if (_running[anim]._runFrame) { done = false; _running[anim]._runFrame(); } } if (done) { Y.Anim._stopTimer(); } }; Y.Anim.RE_UNITS = /^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/; var proto = { /** * Starts or resumes an animation. * @method run * @chainable */ run: function() { if (this.get(PAUSED)) { this._resume(); } else if (!this.get(RUNNING)) { this._start(); } return this; }, /** * Pauses the animation and * freezes it in its current state and time. * Calling run() will continue where it left off. * @method pause * @chainable */ pause: function() { if (this.get(RUNNING)) { this._pause(); } return this; }, /** * Stops the animation and resets its time. * @method stop * @param {Boolean} finish If true, the animation will move to the last frame * @chainable */ stop: function(finish) { if (this.get(RUNNING) || this.get(PAUSED)) { this._end(finish); } return this; }, _added: false, _start: function() { this._set(START_TIME, new Date() - this.get(ELAPSED_TIME)); this._actualFrames = 0; if (!this.get(PAUSED)) { this._initAnimAttr(); } _running[Y.stamp(this)] = this; Y.Anim._startTimer(); this.fire(START); }, _pause: function() { this._set(START_TIME, null); this._set(PAUSED, true); delete _running[Y.stamp(this)]; /** * @event pause * @description fires when an animation is paused. * @param {Event} ev The pause event. * @type Event.Custom */ this.fire('pause'); }, _resume: function() { this._set(PAUSED, false); _running[Y.stamp(this)] = this; this._set(START_TIME, new Date() - this.get(ELAPSED_TIME)); Y.Anim._startTimer(); /** * @event resume * @description fires when an animation is resumed (run from pause). * @param {Event} ev The pause event. * @type Event.Custom */ this.fire('resume'); }, _end: function(finish) { var duration = this.get('duration') * 1000; if (finish) { // jump to last frame this._runAttrs(duration, duration, this.get(REVERSE)); } this._set(START_TIME, null); this._set(ELAPSED_TIME, 0); this._set(PAUSED, false); delete _running[Y.stamp(this)]; this.fire(END, {elapsed: this.get(ELAPSED_TIME)}); }, _runFrame: function() { var d = this._runtimeAttr.duration, t = new Date() - this.get(START_TIME), reverse = this.get(REVERSE), done = (t >= d); this._runAttrs(t, d, reverse); this._actualFrames += 1; this._set(ELAPSED_TIME, t); this.fire(TWEEN); if (done) { this._lastFrame(); } }, _runAttrs: function(t, d, reverse) { var attr = this._runtimeAttr, customAttr = Y.Anim.behaviors, easing = attr.easing, lastFrame = d, done = false, attribute, setter, i; if (t >= d) { done = true; } if (reverse) { t = d - t; lastFrame = 0; } for (i in attr) { if (attr[i].to) { attribute = attr[i]; setter = (i in customAttr && 'set' in customAttr[i]) ? customAttr[i].set : Y.Anim.DEFAULT_SETTER; if (!done) { setter(this, i, attribute.from, attribute.to, t, d, easing, attribute.unit); } else { setter(this, i, attribute.from, attribute.to, lastFrame, d, easing, attribute.unit); } } } }, _lastFrame: function() { var iter = this.get('iterations'), iterCount = this.get(ITERATION_COUNT); iterCount += 1; if (iter === 'infinite' || iterCount < iter) { if (this.get('direction') === 'alternate') { this.set(REVERSE, !this.get(REVERSE)); // flip it } /** * @event iteration * @description fires when an animation begins an iteration. * @param {Event} ev The iteration event. * @type Event.Custom */ this.fire('iteration'); } else { iterCount = 0; this._end(); } this._set(START_TIME, new Date()); this._set(ITERATION_COUNT, iterCount); }, _initAnimAttr: function() { var from = this.get('from') || {}, to = this.get('to') || {}, attr = { duration: this.get('duration') * 1000, easing: this.get('easing') }, customAttr = Y.Anim.behaviors, node = this.get(NODE), // implicit attr init unit, begin, end; Y.each(to, function(val, name) { if (typeof val === 'function') { val = val.call(this, node); } begin = from[name]; if (begin === undefined) { begin = (name in customAttr && 'get' in customAttr[name]) ? customAttr[name].get(this, name) : Y.Anim.DEFAULT_GETTER(this, name); } else if (typeof begin === 'function') { begin = begin.call(this, node); } var mFrom = Y.Anim.RE_UNITS.exec(begin), mTo = Y.Anim.RE_UNITS.exec(val); begin = mFrom ? mFrom[1] : begin; end = mTo ? mTo[1] : val; unit = mTo ? mTo[2] : mFrom ? mFrom[2] : ''; // one might be zero TODO: mixed units if (!unit && Y.Anim.RE_DEFAULT_UNIT.test(name)) { unit = Y.Anim.DEFAULT_UNIT; } if (!begin || !end) { Y.error('invalid "from" or "to" for "' + name + '"', 'Anim'); return; } attr[name] = { from: Y.Lang.isObject(begin) ? Y.clone(begin) : begin, to: end, unit: unit }; }, this); this._runtimeAttr = attr; }, // TODO: move to computedStyle? (browsers dont agree on default computed offsets) _getOffset: function(attr) { var node = this._node, val = node.getComputedStyle(attr), get = (attr === 'left') ? 'getX': 'getY', set = (attr === 'left') ? 'setX': 'setY', position; if (val === 'auto') { position = node.getStyle('position'); if (position === 'absolute' || position === 'fixed') { val = node[get](); node[set](val); } else { val = 0; } } return val; }, destructor: function() { delete Y.Anim._instances[Y.stamp(this)]; } }; Y.extend(Y.Anim, Y.Base, proto); }, '3.18.0', {"requires": ["base-base", "node-style", "color-base"]});
yukinying/cdnjs
ajax/libs/yui/3.18.0/anim-base/anim-base-debug.js
JavaScript
mit
19,020
export default { after: (field, [target]) => `${field} skal vΓ¦re efter ${target}.`, alpha_dash: (field) => `${field} mΓ₯ kun indeholde tal, bogstaver, bindestreger og underscores.`, alpha_num: (field) => `${field} mΓ₯ kun indeholde tal og bogstaver.`, alpha: (field) => `${field} mΓ₯ kun indeholde bogstaver.`, before: (field, [target]) => `${field} skal vΓ¦re fΓΈr ${target}.`, between: (field, [min, max]) => `${field} skal vΓ¦re mellem ${min} og ${max}.`, confirmed: (field, [confirmedField]) => `${field} skal matche ${confirmedField}.`, date_between: (field, [min, max]) => `${field} skal vΓ¦re mellem ${min} og ${max}.`, date_format: (field, [format]) => `${field} skal vΓ¦re i formatet: ${format}.`, decimal: (field, [decimals] = ['*']) => `${field} skal vΓ¦re numerisk og mΓ₯ maksimalt indeholde ${decimals === '*' ? '' : decimals} decimaler.`, digits: (field, [length]) => `${field} skal vΓ¦re et tal pΓ₯ ${length} cifre.`, dimensions: (field, [width, height]) => `${field} skal vΓ¦re ${width} pixels gange ${height} pixels.`, email: (field) => `${field} skal vΓ¦re en gyldig email.`, ext: (field) => `${field} skal vΓ¦re en gyldig filtype.`, image: (field) => `${field} skal vΓ¦re et billede.`, in: (field) => `${field} skal vΓ¦re en gyldig vΓ¦rdi.`, ip: (field) => `${field} skal vΓ¦re en gyldig ip-adresse.`, max: (field, [length]) => `${field} mΓ₯ maksimalt vΓ¦re ${length} karakterer.`, mimes: (field) => `${field} skal vΓ¦re en gyldig filtype.`, min: (field, [length]) => `${field} skal minimum vΓ¦re ${length} karakterer.`, not_in: (field) => `${field} skal vΓ¦re en gyldig vΓ¦rdi.`, numeric: (field) => `${field} skal vΓ¦re numerisk.`, regex: (field) => `${field} skal have et gyldigt format.`, required: (field) => `${field} skal udfyldes.`, size: (field, [size]) => `${field} mΓ₯ maksimalt have en stΓΈrrelse pΓ₯ ${size} KB.`, url: (field) => `${field} skal vΓ¦re en gyldig URL.` };
dakshshah96/cdnjs
ajax/libs/vee-validate/1.0.0-beta.11/locale/da.js
JavaScript
mit
2,006
YUI.add("handlebars-compiler",function(e,t){ /*! Handlebars.js - Copyright (C) 2011 Yehuda Katz https://raw.github.com/wycats/handlebars.js/master/LICENSE */ ;var n=e.Handlebars;n.Helpers={},function(e,t){"use strict";function n(e,t){return{left:e.charAt(2)==="~",right:t.charAt(t.length-3)==="~"}}function r(e,n,r,i,f,l){if(e.sexpr.id.original!==i.path.original)throw new t(e.sexpr.id.original+" doesn't match "+i.path.original,e);var c=r&&r.program,h={left:e.strip.left,right:i.strip.right,openStandalone:o(n.statements),closeStandalone:s((c||n).statements)};e.strip.right&&u(n.statements,null,!0);if(c){var p=r.strip;p.left&&a(n.statements,null,!0),p.right&&u(c.statements,null,!0),i.strip.left&&a(c.statements,null,!0),s(n.statements)&&o(c.statements)&&(a(n.statements),u(c.statements))}else i.strip.left&&a(n.statements,null,!0);return f?new this.BlockNode(e,c,n,h,l):new this.BlockNode(e,n,c,h,l)}function i(e,t){for(var n=0,r=e.length;n<r;n++){var i=e[n],f=i.strip;if(!f)continue;var l=s(e,n,t,i.type==="partial"),c=o(e,n,t),h=f.openStandalone&&l,p=f.closeStandalone&&c,d=f.inlineStandalone&&l&&c;f.right&&u(e,n,!0),f.left&&a(e,n,!0),d&&(u(e,n),a(e,n)&&i.type==="partial"&&(i.indent=/([ \t]+$)/.exec(e[n-1].original)?RegExp.$1:"")),h&&(u((i.program||i.inverse).statements),a(e,n)),p&&(u(e,n),a((i.inverse||i.program).statements))}return e}function s(e,t,n){t===undefined&&(t=e.length);var r=e[t-1],i=e[t-2];if(!r)return n;if(r.type==="content")return(i||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original)}function o(e,t,n){t===undefined&&(t=-1);var r=e[t+1],i=e[t+2];if(!r)return n;if(r.type==="content")return(i||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original)}function u(e,t,n){var r=e[t==null?0:t+1];if(!r||r.type!=="content"||!n&&r.rightStripped)return;var i=r.string;r.string=r.string.replace(n?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.string!==i}function a(e,t,n){var r=e[t==null?e.length-1:t-1];if(!r||r.type!=="content"||!n&&r.leftStripped)return;var i=r.string;return r.string=r.string.replace(n?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.string!==i,r.leftStripped}e.stripFlags=n,e.prepareBlock=r,e.prepareProgram=i}(n.Helpers,n.Exception),n.Parser={},function(e){"use strict";var t=function(){function n(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return i.prepareProgram(o[a-1].statements,!0),o[a-1];case 2:this.$=new i.ProgramNode(i.prepareProgram(o[a]),{},this._$);break;case 3:this.$=o[a];break;case 4:this.$=o[a];break;case 5:this.$=o[a];break;case 6:this.$=o[a];break;case 7:this.$=new i.ContentNode(o[a],this._$);break;case 8:this.$=new i.CommentNode(o[a],this._$);break;case 9:this.$=new i.RawBlockNode(o[a-2],o[a-1],o[a],this._$);break;case 10:this.$=new i.MustacheNode(o[a-1],null,"","",this._$);break;case 11:this.$=i.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 12:this.$=i.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 13:this.$=new i.MustacheNode(o[a-1],null,o[a-2],i.stripFlags(o[a-2],o[a]),this._$);break;case 14:this.$=new i.MustacheNode(o[a-1],null,o[a-2],i.stripFlags(o[a-2],o[a]),this._$);break;case 15:this.$={strip:i.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 16:this.$={path:o[a-1],strip:i.stripFlags(o[a-2],o[a])};break;case 17:this.$=new i.MustacheNode(o[a-1],null,o[a-2],i.stripFlags(o[a-2],o[a]),this._$);break;case 18:this.$=new i.MustacheNode(o[a-1],null,o[a-2],i.stripFlags(o[a-2],o[a]),this._$);break;case 19:this.$=new i.PartialNode(o[a-3],o[a-2],o[a-1],i.stripFlags(o[a-4],o[a]),this._$);break;case 20:this.$=new i.PartialNode(o[a-2],undefined,o[a-1],i.stripFlags(o[a-3],o[a]),this._$);break;case 21:this.$=new i.SexprNode([o[a-2]].concat(o[a-1]),o[a],this._$);break;case 22:this.$=new i.SexprNode([o[a]],null,this._$);break;case 23:this.$=o[a];break;case 24:this.$=new i.StringNode(o[a],this._$);break;case 25:this.$=new i.NumberNode(o[a],this._$);break;case 26:this.$=new i.BooleanNode(o[a],this._$);break;case 27:this.$=o[a];break;case 28:o[a-1].isHelper=!0,this.$=o[a-1];break;case 29:this.$=new i.HashNode(o[a],this._$);break;case 30:this.$=[o[a-2],o[a]];break;case 31:this.$=new i.PartialNameNode(o[a],this._$);break;case 32:this.$=new i.PartialNameNode(new i.StringNode(o[a],this._$),this._$);break;case 33:this.$=new i.PartialNameNode(new i.NumberNode(o[a],this._$));break;case 34:this.$=new i.DataNode(o[a],this._$);break;case 35:this.$=new i.IdNode(o[a],this._$);break;case 36:o[a-2].push({part:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 37:this.$=[{part:o[a]}];break;case 38:this.$=[];break;case 39:o[a-1].push(o[a]) ;break;case 48:this.$=[];break;case 49:o[a-1].push(o[a]);break;case 52:this.$=[o[a]];break;case 53:o[a-1].push(o[a])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy. lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])this.terminals_[T]&&T>2&&k.push("'"+this.terminals_[T]+"'");this.lexer.showPosition?L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'":L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i,s;this._more||(this.yytext="",this.match="");var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n,r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(e)return e;return}return this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.options={},e.performAction=function(t,n,r,i){function s(e,t){return n.yytext=n.yytext.substr(e,n.yyleng-t)}var o=i;switch(r){case 0:n.yytext.slice(-2)==="\\\\"?(s(0,1),this.begin("mu")):n.yytext.slice(-1)==="\\"?(s(0,1),this.begin("emu")):this.begin("mu");if(n.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return n.yytext=n.yytext.substr(5,n.yyleng-9),this.popState(),15;case 4:return 12;case 5:return s(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this .popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState(),this.begin("com");break;case 20:return s(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 26:break;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return n.yytext=s(1,2).replace(/\\"/g,'"'),42;case 30:return n.yytext=s(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return n.yytext=s(1,2),50;case 37:return"INVALID";case 38:return 5}},e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},e}();return e.lexer=t,n.prototype=e,e.Parser=n,new n}();e["default"]=t}(n.Parser),n.Parser=n.Parser["default"],n.AST={},function(e,t){"use strict";function n(e){e=e||{},this.firstLine=e.first_line,this.firstColumn=e.first_column,this.lastColumn=e.last_column,this.lastLine=e.last_line}var r={ProgramNode:function(e,t,r){n.call(this,r),this.type="program",this.statements=e,this.strip=t},MustacheNode:function(e,t,i,s,o){n.call(this,o),this.type="mustache",this.strip=s;if(i!=null&&i.charAt){var u=i.charAt(3)||i.charAt(2);this.escaped=u!=="{"&&u!=="&"}else this.escaped=!!i;e instanceof r.SexprNode?this.sexpr=e:this.sexpr=new r.SexprNode(e,t),this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(e,t,r){n.call(this,r),this.type="sexpr",this.hash=t;var i=this.id=e[0],s=this.params=e.slice(1);this.isHelper=!!s.length||!!t,this.eligibleHelper=this.isHelper||i.isSimple},PartialNode:function(e,t,r,i,s){n.call(this,s),this.type="partial",this.partialName=e,this.context=t,this.hash=r,this.strip=i,this.strip.inlineStandalone=!0},BlockNode:function(e,t,r,i,s){n.call(this,s),this.type="block",this.mustache=e,this.program=t,this.inverse=r,this.strip=i,r&&!t&&(this.isInverse=!0)},RawBlockNode:function(e,i,s,o){n.call(this,o);if(e.sexpr.id.original!==s)throw new t(e.sexpr.id.original+" doesn't match "+s,this);i=new r.ContentNode(i,o),this.type="block",this.mustache=e,this.program=new r.ProgramNode([i],{},o)},ContentNode:function(e,t){n.call(this,t),this.type="content",this.original=this.string=e},HashNode:function(e,t){n.call(this,t),this.type="hash",this.pairs=e},IdNode:function(e,r){n.call(this,r),this.type="ID";var i="",s=[],o=0,u="";for(var a=0,f=e.length;a<f;a++){var l=e[a].part;i+=(e[a].separator||"")+l;if(l===".."||l==="."||l==="this"){if(s.length>0)throw new t("Invalid path: "+i,this);l===".."?(o++,u+="../"):this.isScoped=!0}else s.push(l)}this.original=i,this.parts=s,this.string=s.join("."),this.depth=o,this.idName=u+this.string,this.isSimple=e.length===1&&!this.isScoped&&o===0,this.stringModeValue=this.string},PartialNameNode:function(e,t){n.call(this,t),this.type="PARTIAL_NAME",this.name=e.original},DataNode:function(e,t){n.call(this,t),this.type="DATA",this.id=e,this.stringModeValue=e.stringModeValue,this.idName="@"+e.stringModeValue},StringNode:function(e,t){n.call(this,t),this.type="STRING",this.original=this.string=this.stringModeValue=e},NumberNode:function(e,t){n.call(this,t),this.type="NUMBER",this.original=this.number=e,this.stringModeValue=Number(e)},BooleanNode:function(e,t){n.call(this,t),this.type="BOOLEAN",this.bool=e,this.stringModeValue=e==="true"},CommentNode:function(e,t){n.call(this,t),this.type="comment",this.comment=e,this.strip={inlineStandalone:!0}}};e["default"]=r}(n.AST,n.Exception),n.AST=n.AST["default"],function(e,t,n){"use strict";function i(){}function s(e,t,r){if(e==null||typeof e!="string"&&e.constructor!==r.AST.ProgramNode)throw new n("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=r.parse(e),s=(new r.Compiler).compile(i,t);return(new r.JavaScriptCompiler).compile(s,t)}function o(e,t,r){function s(){var n=r.parse(e),i=(new r.Compiler).compile(n,t),s=(new r.JavaScriptCompiler).compile(i,t,undefined,!0);return r.template(s)}if(e==null||typeof e!="string"&&e.constructor!==r.AST.ProgramNode)throw new n("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i,o=function(e,t){return i||(i=s()),i.call(this,e,t)};return o._setup=function(e){return i||(i=s()),i._setup(e)},o._child=function(e,t,n){return i||(i=s()),i._child(e,t,n)},o}function u(e,n){if(e===n)return!0;if(t(e)&&t(n)&&e.length===n.length){for(var r=0;r<e.length;r++)if(!u(e[r],n[r]))return!1;return!0}}var r=[].slice;e.Compiler=i,i.prototype={compiler:i,equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var n=0;n<t;n++){var r=this.opcodes[n],i=e.opcodes[n];if(r.opcode!==i.opcode||!u(r.args,i.args))return!1}t=this.children .length;for(n=0;n<t;n++)if(!this.children[n].equals(e.children[n]))return!1;return!0},guid:0,compile:function(e,t){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=t,this.stringParams=t.stringParams,this.trackIds=t.trackIds;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0};if(n)for(var r in n)this.options.knownHelpers[r]=n[r];return this.accept(e)},accept:function(e){return this[e.type](e)},program:function(e){var t=e.statements;for(var n=0,r=t.length;n<r;n++)this.accept(t[n]);return this.isSimple=r===1,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++,r;this.usePartial=this.usePartial||t.usePartial,this.children[n]=t;for(var i=0,s=t.depths.list.length;i<s;i++){r=t.depths.list[i];if(r<2)continue;this.addDepth(r-1)}return n},block:function(e){var t=e.mustache,n=e.program,r=e.inverse;n&&(n=this.compileProgram(n)),r&&(r=this.compileProgram(r));var i=t.sexpr,s=this.classifySexpr(i);s==="helper"?this.helperSexpr(i,n,r):s==="simple"?(this.simpleSexpr(i),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("blockValue",i.id.original)):(this.ambiguousSexpr(i,n,r),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("pushHash");for(n=0,r=t.length;n<r;n++)this.pushParam(t[n][1]);while(n--)this.opcode("assignToHash",t[n][0]);this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=!0,e.hash?this.accept(e.hash):this.opcode("push","undefined"),e.context?this.accept(e.context):(this.opcode("getContext",0),this.opcode("pushContext")),this.opcode("invokePartial",t.name,e.indent||""),this.opcode("append")},content:function(e){e.string&&this.opcode("appendContent",e.string)},mustache:function(e){this.sexpr(e.sexpr),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(e,t,n){var r=e.id,i=r.parts[0],s=t!=null||n!=null;this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.ID(r),this.opcode("invokeAmbiguous",i,s)},simpleSexpr:function(e){var t=e.id;t.type==="DATA"?this.DATA(t):t.parts.length?this.ID(t):(this.addDepth(t.depth),this.opcode("getContext",t.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,r){var i=this.setupFullMustacheParams(e,t,r),s=e.id,o=s.parts[0];if(this.options.knownHelpers[o])this.opcode("invokeKnownHelper",i.length,o);else{if(this.options.knownHelpersOnly)throw new n("You specified knownHelpersOnly, but used the unknown helper "+o,e);s.falsy=!0,this.ID(s),this.opcode("invokeHelper",i.length,s.original,s.isSimple)}},sexpr:function(e){var t=this.classifySexpr(e);t==="simple"?this.simpleSexpr(e):t==="helper"?this.helperSexpr(e):this.ambiguousSexpr(e)},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0];t?this.opcode("lookupOnContext",e.parts,e.falsy,e.isScoped):this.opcode("pushContext")},DATA:function(e){this.options.data=!0,this.opcode("lookupData",e.id.depth,e.id.parts)},STRING:function(e){this.opcode("pushString",e.string)},NUMBER:function(e){this.opcode("pushLiteral",e.number)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:r.call(arguments,1)})},addDepth:function(e){if(e===0)return;this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e))},classifySexpr:function(e){var t=e.isHelper,n=e.eligibleHelper,r=this.options;if(n&&!t){var i=e.id.parts[0];r.knownHelpers[i]?t=!0:r.knownHelpersOnly&&(n=!1)}return t?"helper":n?"ambiguous":"simple"},pushParams:function(e){for(var t=0,n=e.length;t<n;t++)this.pushParam(e[t])},pushParam:function(e){this.stringParams?(e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",e.stringModeValue,e.type),e.type==="sexpr"&&this.sexpr(e)):(this.trackIds&&this.opcode("pushId",e.type,e.idName||e.stringModeValue),this.accept(e))},setupFullMustacheParams:function(e,t,n){var r=e.params;return this.pushParams(r),this.opcode("pushProgram",t),this.opcode("pushProgram",n),e.hash?this.hash(e.hash):this.opcode("emptyHash"),r}},e.precompile=s,e.compile=o}(n,n.Utils.isArray,n.Exception),n.JavaScriptCompiler={},function(e,t,n,r,i){"use strict";function s(e){this.value=e}function o(){}o.prototype={nameLookup:function(e,t){return o.isValidJavaScriptVariableName(t)?e+"."+t:e+"['"+t+"']"},depthedLookup:function(e){return this.aliases.lookup="this.lookup",'lookup(depths, "'+e+'")'},compilerInfo:function(){var e=t,r=n[e];return[e,r]},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":{appendToBuffer:!0,content:e,toString:function(){return"buffer += "+e+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e,this.options=t,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(e,t),this.useDepths=this.useDepths||e.depths.list.length||this.options.compat;var s=e.opcodes,o,u,a;for(u=0,a=s.length;u<a;u++)o=s[u],this[o.opcode].apply(this,o.args);this.pushSource("");if(this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i("Compile completed with content left on stack");var f=this.createFunctionContext(r);if(!this.isChild){var l={compiler:this.compilerInfo(),main:f},c=this.context.programs;for(u=0,a=c.length;u<a;u++)c[u]&&(l[u]=c[ u]);return this.environment.usePartial&&(l.usePartial=!0),this.options.data&&(l.useData=!0),this.useDepths&&(l.useDepths=!0),this.options.compat&&(l.compat=!0),r||(l.compiler=JSON.stringify(l.compiler),l=this.objectLiteral(l)),l}return f},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(e){var t="",n=this.stackVars.concat(this.registers.list);n.length>0&&(t+=", "+n.join(", "));for(var r in this.aliases)this.aliases.hasOwnProperty(r)&&(t+=", "+r+"="+this.aliases[r]);var i=["depth0","helpers","partials","data"];this.useDepths&&i.push("depths");var s=this.mergeSource(t);return e?(i.push(s),Function.apply(this,i)):"function("+i.join(",")+") {\n "+s+"}"},mergeSource:function(e){var t="",n,r=!this.forceBuffer,i;for(var s=0,o=this.source.length;s<o;s++){var u=this.source[s];u.appendToBuffer?n?n=n+"\n + "+u.content:n=u.content:(n&&(t?t+="buffer += "+n+";\n ":(i=!0,t=n+";\n "),n=undefined),t+=u+"\n ",this.environment.isSimple||(r=!1))}if(r){if(n||!t)t+="return "+(n||'""')+";\n"}else e+=", buffer = "+(i?"":this.initializeBuffer()),n?t+="return buffer + "+n+";\n":t+="return buffer;\n";return e&&(t="var "+e.substring(2)+(i?"":";\n ")+t),t},blockValue:function(e){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=[this.contextName(0)];this.setupParams(e,0,t);var n=this.popStack();t.splice(1,0,n),this.push("blockHelperMissing.call("+t.join(", ")+")")},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=[this.contextName(0)];this.setupParams("",0,e,!0),this.flushInline();var t=this.topStack();e.splice(1,0,t),this.pushSource("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){this.pendingContent&&(e=this.pendingContent+e),this.pendingContent=e},append:function(){this.flushInline();var e=this.popStack();this.pushSource("if ("+e+" != null) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(e){this.lastContext=e},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(e,t,n){var r=0,i=e.length;!n&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(e[r++])):this.pushContext();for(;r<i;r++)this.replaceStack(function(n){var i=this.nameLookup(n,e[r],"context");return t?" && "+i:" != null ? "+i+" : "+n})},lookupData:function(e,t){e?this.pushStackLiteral("this.data(data, "+e+")"):this.pushStackLiteral("data");var n=t.length;for(var r=0;r<n;r++)this.replaceStack(function(e){return" && "+this.nameLookup(e,t[r],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda",this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(e,t){this.pushContext(),this.pushString(t),t!=="sexpr"&&(typeof e=="string"?this.pushString(e):this.pushStackLiteral(e))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+e.ids.join(",")+"}"),this.stringParams&&(this.push("{"+e.contexts.join(",")+"}"),this.push("{"+e.types.join(",")+"}")),this.push("{\n "+e.values.join(",\n ")+"\n }")},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){return this.inlineStack.push(e),e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){e!=null?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},invokeHelper:function(e,t,n){this.aliases.helperMissing="helpers.helperMissing";var r=this.popStack(),i=this.setupHelper(e,t),s=(n?i.name+" || ":"")+r+" || helperMissing";this.push("(("+s+").call("+i.callParams+"))")},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e,t){this.aliases.functionType='"function"',this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,e,t),i=this.lastHelper=this.nameLookup("helpers",e,"helper");this.push("((helper = (helper = "+i+" || "+n+") != null ? helper : helperMissing"+(r.paramsInit?"),("+r.paramsInit:"")+"),"+"(typeof helper === functionType ? helper.call("+r.callParams+") : helper))")},invokePartial:function(e,t){var n=[this.nameLookup("partials",e,"partial"),"'"+t+"'","'"+e+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?n.push("data"):this.options.compat&&n.push("undefined"),this.options.compat&&n.push("depths"),this.push("this.invokePartial("+n.join(", ")+")")},assignToHash:function(e){var t=this.popStack(),n,r,i;this.trackIds&&(i=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var s=this.hash;n&&s.contexts.push("'"+e+"': "+n),r&&s.types.push("'"+e+"': "+r),i&&s.ids.push("'"+e+"': "+i),s.values.push("'"+e+"': ("+t+")")},pushId:function(e,t){e==="ID"||e==="DATA"?this.pushString(t):e==="sexpr"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:o,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s],i=new this.compiler;var u=this.matchExistingProgram(r);u==null?(this.context.programs.push(""),u=this.context.programs.length,r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,t,this.context,!this.precompile),this.context.environments[u]=r,this.useDepths=this.useDepths||i.useDepths):(r.index=u,r.name="program"+u)}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e))return t }},programExpression:function(e){var t=this.environment.children[e],n=t.depths.list,r=this.useDepths,i,s=[t.index,"data"];return r&&s.push("depths"),"this.program("+s.join(", ")+")"},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},pushStackLiteral:function(e){return this.push(new s(e))},pushSource:function(e){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=undefined),e&&this.source.push(e)},pushStack:function(e){this.flushInline();var t=this.incrStack();return this.pushSource(t+" = "+e+";"),this.compileStack.push(t),t},replaceStack:function(e){var t="",n=this.isInline(),r,o,u;if(!this.isInline())throw new i("replaceStack on non-inline");var a=this.popStack(!0);if(a instanceof s)t=r=a.value,u=!0;else{o=!this.stackSlot;var f=o?this.incrStack():this.topStackName();t="("+this.push(f)+" = "+a+")",r=this.topStack()}var l=e.call(this,r);u||this.popStack(),o&&this.stackSlot--,this.push("("+t+l+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];r instanceof s?this.compileStack.push(r):this.pushStack(r)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();if(!e&&n instanceof s)return n.value;if(!t){if(!this.stackSlot)throw new i("Invalid stack pop");this.stackSlot--}return n},topStack:function(){var e=this.isInline()?this.inlineStack:this.compileStack,t=e[e.length-1];return t instanceof s?t.value:t},contextName:function(e){return this.useDepths&&e?"depths["+e+"]":"depth"+e},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(this.quotedString(n)+":"+e[n]);return"{"+t.join(",")+"}"},setupHelper:function(e,t,n){var r=[],i=this.setupParams(t,e,r,n),s=this.nameLookup("helpers",t,"helper");return{params:r,paramsInit:i,name:s,callParams:[this.contextName(0)].concat(r).join(", ")}},setupOptions:function(e,t,n){var r={},i=[],s=[],o=[],u,a,f;r.name=this.quotedString(e),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack()),a=this.popStack(),f=this.popStack();if(f||a)f||(f="this.noop"),a||(a="this.noop"),r.fn=f,r.inverse=a;var l=t;while(l--)u=this.popStack(),n[l]=u,this.trackIds&&(o[l]=this.popStack()),this.stringParams&&(s[l]=this.popStack(),i[l]=this.popStack());return this.trackIds&&(r.ids="["+o.join(",")+"]"),this.stringParams&&(r.types="["+s.join(",")+"]",r.contexts="["+i.join(",")+"]"),this.options.data&&(r.data="data"),r},setupParams:function(e,t,n,r){var i=this.objectLiteral(this.setupOptions(e,t,n));return r?(this.useRegister("options"),n.push("options"),"options="+i):(n.push(i),"")}};var u="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),a=o.RESERVED_WORDS={};for(var f=0,l=u.length;f<l;f++)a[u[f]]=!0;o.isValidJavaScriptVariableName=function(e){return!o.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)},e["default"]=o}(n.JavaScriptCompiler,n.COMPILER_REVISION,n.REVISION_CHANGES,n.log,n.Exception),n.JavaScriptCompiler=n.JavaScriptCompiler["default"],function(e,t,n,r,i){"use strict";function o(e){return e.constructor===n.ProgramNode?e:(t.yy=s,t.parse(e))}e.parser=t;var s={};r(s,i,n),e.parse=o}(n,n.Parser,n.AST,n.Utils.extend,n.Helpers);var r=["debug","info","warn","error"];n.logger.log=function(e,t){},n.render=function(e,t,n){return this.compile(e)(t,n)},n.Runtime={},function(e,t,n,r,i,s){"use strict";var o=function(){var e=new t.HandlebarsEnvironment;return i.extend(e,t),e.SafeString=n,e.Exception=r,e.Utils=i,e.escapeExpression=i.escapeExpression,e.VM=s,e.template=function(t){return s.template(t,e)},e},u=o();u.create=o,u["default"]=u,e["default"]=u}(n.Runtime,n,n.SafeString,n.Exception,n.Utils,n.VM),n.Runtime=n.Runtime["default"],function(e,t,n,r,i,s,o,u,a){"use strict";var f=t.create,l=function(){var e=f();return e.compile=function(t,n){return o(t,n,e)},e.precompile=function(t,n){return u(t,n,e)},e.AST=n,e.Compiler=s,e.JavaScriptCompiler=a,e.Parser=r,e.parse=i,e};t=l(),t.create=l,t["default"]=t,e["default"]=t}(n,n.Runtime,n.AST,n.Parser,n.parse,n.Compiler,n.compile,n.precompile,n.JavaScriptCompiler),e.Handlebars=n["default"]},"3.18.0",{requires:["handlebars-base"]});
vdurmont/cdnjs
ajax/libs/yui/3.18.0/handlebars-compiler/handlebars-compiler-min.js
JavaScript
mit
41,179
YUI.add('event-move', function (Y, NAME) { /** * Adds lower level support for "gesturemovestart", "gesturemove" and "gesturemoveend" events, which can be used to create drag/drop * interactions which work across touch and mouse input devices. They correspond to "touchstart", "touchmove" and "touchend" on a touch input * device, and "mousedown", "mousemove", "mouseup" on a mouse based input device. * * <p>Documentation for the gesturemove triplet of events can be found on the <a href="../classes/YUI.html#event_gesturemove">YUI</a> global, * along with the other supported events.</p> @example YUI().use('event-move', function (Y) { Y.one('#myNode').on('gesturemovestart', function (e) { }); Y.one('#myNode').on('gesturemove', function (e) { }); Y.one('#myNode').on('gesturemoveend', function (e) { }); }); * @module event-gestures * @submodule event-move */ var GESTURE_MAP = Y.Event._GESTURE_MAP, EVENT = { start: GESTURE_MAP.start, end: GESTURE_MAP.end, move: GESTURE_MAP.move }, START = "start", MOVE = "move", END = "end", GESTURE_MOVE = "gesture" + MOVE, GESTURE_MOVE_END = GESTURE_MOVE + END, GESTURE_MOVE_START = GESTURE_MOVE + START, _MOVE_START_HANDLE = "_msh", _MOVE_HANDLE = "_mh", _MOVE_END_HANDLE = "_meh", _DEL_MOVE_START_HANDLE = "_dmsh", _DEL_MOVE_HANDLE = "_dmh", _DEL_MOVE_END_HANDLE = "_dmeh", _MOVE_START = "_ms", _MOVE = "_m", MIN_TIME = "minTime", MIN_DISTANCE = "minDistance", PREVENT_DEFAULT = "preventDefault", BUTTON = "button", OWNER_DOCUMENT = "ownerDocument", CURRENT_TARGET = "currentTarget", TARGET = "target", NODE_TYPE = "nodeType", _getTouchAction = function(win) { var touchAction; if(win) { if("PointerEvent" in win) { touchAction = "touchAction"; } else if("msPointerEnabled" in win.navigator) { touchAction = "msTouchAction"; } } return touchAction; }, TOUCH_ACTION = _getTouchAction(Y.config.win), SUPPORTS_POINTER = (TOUCH_ACTION === "msTouchAction" || TOUCH_ACTION === "touchAction"), MS_TOUCH_ACTION_COUNT = 'msTouchActionCount', MS_INIT_TOUCH_ACTION = 'msInitTouchAction', _defArgsProcessor = function(se, args, delegate) { var iConfig = (delegate) ? 4 : 3, config = (args.length > iConfig) ? Y.merge(args.splice(iConfig,1)[0]) : {}; if (!(PREVENT_DEFAULT in config)) { config[PREVENT_DEFAULT] = se.PREVENT_DEFAULT; } return config; }, _getRoot = function(node, subscriber) { return subscriber._extra.root || (node.get(NODE_TYPE) === 9) ? node : node.get(OWNER_DOCUMENT); }, //Checks to see if the node is the document, and if it is, returns the documentElement. _checkDocumentElem = function(node) { var elem = node.getDOMNode(); if (node.compareTo(Y.config.doc) && elem.documentElement) { return elem.documentElement; } else { return false; } }, _normTouchFacade = function(touchFacade, touch, params) { touchFacade.pageX = touch.pageX; touchFacade.pageY = touch.pageY; touchFacade.screenX = touch.screenX; touchFacade.screenY = touch.screenY; touchFacade.clientX = touch.clientX; touchFacade.clientY = touch.clientY; touchFacade[TARGET] = touchFacade[TARGET] || touch[TARGET]; touchFacade[CURRENT_TARGET] = touchFacade[CURRENT_TARGET] || touch[CURRENT_TARGET]; touchFacade[BUTTON] = (params && params[BUTTON]) || 1; // default to left (left as per vendors, not W3C which is 0) }, /* In IE10 touch mode, gestures will not work properly unless the -ms-touch-action CSS property is set to something other than 'auto'. Read http://msdn.microsoft.com/en-us/library/windows/apps/hh767313.aspx for more info. To get around this, we set -ms-touch-action: none which is the same as e.preventDefault() on touch environments. This tells the browser to fire DOM events for all touch events, and not perform any default behavior. The user can over-ride this by setting a more lenient -ms-touch-action property on a node (such as pan-x, pan-y, etc.) via CSS when subscribing to the 'gesturemovestart' event. */ _setTouchActions = function (node) { var elem = node.getDOMNode(), num = node.getData(MS_TOUCH_ACTION_COUNT); //Checks to see if msTouchAction is supported. if (SUPPORTS_POINTER) { if (!num) { num = 0; node.setData(MS_INIT_TOUCH_ACTION, elem.style[TOUCH_ACTION]); } elem.style[TOUCH_ACTION] = Y.Event._DEFAULT_TOUCH_ACTION; num++; node.setData(MS_TOUCH_ACTION_COUNT, num); } }, /* Resets the element's -ms-touch-action property back to the original value, This is called on detach() and detachDelegate(). */ _unsetTouchActions = function (node) { var elem = node.getDOMNode(), num = node.getData(MS_TOUCH_ACTION_COUNT), initTouchAction = node.getData(MS_INIT_TOUCH_ACTION); if (SUPPORTS_POINTER) { num--; node.setData(MS_TOUCH_ACTION_COUNT, num); if (num === 0 && elem.style[TOUCH_ACTION] !== initTouchAction) { elem.style[TOUCH_ACTION] = initTouchAction; } } }, _prevent = function(e, preventDefault) { if (preventDefault) { // preventDefault is a boolean or a function if (!preventDefault.call || preventDefault(e)) { e.preventDefault(); } } }, define = Y.Event.define; Y.Event._DEFAULT_TOUCH_ACTION = 'none'; /** * Sets up a "gesturemovestart" event, that is fired on touch devices in response to a single finger "touchstart", * and on mouse based devices in response to a "mousedown". The subscriber can specify the minimum time * and distance thresholds which should be crossed before the "gesturemovestart" is fired and for the mouse, * which button should initiate a "gesturemovestart". This event can also be listened for using node.delegate(). * * <p>It is recommended that you use Y.bind to set up context and additional arguments for your event handler, * however if you want to pass the context and arguments as additional signature arguments to on/delegate, * you need to provide a null value for the configuration object, e.g: <code>node.on("gesturemovestart", fn, null, context, arg1, arg2, arg3)</code></p> * * @event gesturemovestart * @for YUI * @param type {string} "gesturemovestart" * @param fn {function} The method the event invokes. It receives the event facade of the underlying DOM event (mousedown or touchstart.touches[0]) which contains position co-ordinates. * @param cfg {Object} Optional. An object which specifies: * * <dl> * <dt>minDistance (defaults to 0)</dt> * <dd>The minimum distance threshold which should be crossed before the gesturemovestart is fired</dd> * <dt>minTime (defaults to 0)</dt> * <dd>The minimum time threshold for which the finger/mouse should be help down before the gesturemovestart is fired</dd> * <dt>button (no default)</dt> * <dd>In the case of a mouse input device, if the event should only be fired for a specific mouse button.</dd> * <dt>preventDefault (defaults to false)</dt> * <dd>Can be set to true/false to prevent default behavior as soon as the touchstart or mousedown is received (that is before minTime or minDistance thresholds are crossed, and so before the gesturemovestart listener is notified) so that things like text selection and context popups (on touch devices) can be * prevented. This property can also be set to a function, which returns true or false, based on the event facade passed to it (for example, DragDrop can determine if the target is a valid handle or not before preventing default).</dd> * </dl> * * @return {EventHandle} the detach handle */ define(GESTURE_MOVE_START, { on: function (node, subscriber, ce) { //Set -ms-touch-action on IE10 and set preventDefault to true if (!_checkDocumentElem(node)) { _setTouchActions(node); } subscriber[_MOVE_START_HANDLE] = node.on(EVENT[START], this._onStart, this, node, subscriber, ce); }, delegate : function(node, subscriber, ce, filter) { var se = this; subscriber[_DEL_MOVE_START_HANDLE] = node.delegate(EVENT[START], function(e) { se._onStart(e, node, subscriber, ce, true); }, filter); }, detachDelegate : function(node, subscriber, ce, filter) { var handle = subscriber[_DEL_MOVE_START_HANDLE]; if (handle) { handle.detach(); subscriber[_DEL_MOVE_START_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, detach: function (node, subscriber, ce) { var startHandle = subscriber[_MOVE_START_HANDLE]; if (startHandle) { startHandle.detach(); subscriber[_MOVE_START_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, processArgs : function(args, delegate) { var params = _defArgsProcessor(this, args, delegate); if (!(MIN_TIME in params)) { params[MIN_TIME] = this.MIN_TIME; } if (!(MIN_DISTANCE in params)) { params[MIN_DISTANCE] = this.MIN_DISTANCE; } return params; }, _onStart : function(e, node, subscriber, ce, delegate) { if (delegate) { node = e[CURRENT_TARGET]; } var params = subscriber._extra, fireStart = true, minTime = params[MIN_TIME], minDistance = params[MIN_DISTANCE], button = params.button, preventDefault = params[PREVENT_DEFAULT], root = _getRoot(node, subscriber), startXY; if (e.touches) { if (e.touches.length === 1) { _normTouchFacade(e, e.touches[0], params); } else { fireStart = false; } } else { fireStart = (button === undefined) || (button === e.button); } if (fireStart) { _prevent(e, preventDefault); if (minTime === 0 || minDistance === 0) { this._start(e, node, ce, params); } else { startXY = [e.pageX, e.pageY]; if (minTime > 0) { params._ht = Y.later(minTime, this, this._start, [e, node, ce, params]); params._hme = root.on(EVENT[END], Y.bind(function() { this._cancel(params); }, this)); } if (minDistance > 0) { params._hm = root.on(EVENT[MOVE], Y.bind(function(em) { if (Math.abs(em.pageX - startXY[0]) > minDistance || Math.abs(em.pageY - startXY[1]) > minDistance) { this._start(e, node, ce, params); } }, this)); } } } }, _cancel : function(params) { if (params._ht) { params._ht.cancel(); params._ht = null; } if (params._hme) { params._hme.detach(); params._hme = null; } if (params._hm) { params._hm.detach(); params._hm = null; } }, _start : function(e, node, ce, params) { if (params) { this._cancel(params); } e.type = GESTURE_MOVE_START; node.setData(_MOVE_START, e); ce.fire(e); }, MIN_TIME : 0, MIN_DISTANCE : 0, PREVENT_DEFAULT : false }); /** * Sets up a "gesturemove" event, that is fired on touch devices in response to a single finger "touchmove", * and on mouse based devices in response to a "mousemove". * * <p>By default this event is only fired when the same node * has received a "gesturemovestart" event. The subscriber can set standAlone to true, in the configuration properties, * if they want to listen for this event without an initial "gesturemovestart".</p> * * <p>By default this event sets up it's internal "touchmove" and "mousemove" DOM listeners on the document element. The subscriber * can set the root configuration property, to specify which node to attach DOM listeners to, if different from the document.</p> * * <p>This event can also be listened for using node.delegate().</p> * * <p>It is recommended that you use Y.bind to set up context and additional arguments for your event handler, * however if you want to pass the context and arguments as additional signature arguments to on/delegate, * you need to provide a null value for the configuration object, e.g: <code>node.on("gesturemove", fn, null, context, arg1, arg2, arg3)</code></p> * * @event gesturemove * @for YUI * @param type {string} "gesturemove" * @param fn {function} The method the event invokes. It receives the event facade of the underlying DOM event (mousemove or touchmove.touches[0]) which contains position co-ordinates. * @param cfg {Object} Optional. An object which specifies: * <dl> * <dt>standAlone (defaults to false)</dt> * <dd>true, if the subscriber should be notified even if a "gesturemovestart" has not occured on the same node.</dd> * <dt>root (defaults to document)</dt> * <dd>The node to which the internal DOM listeners should be attached.</dd> * <dt>preventDefault (defaults to false)</dt> * <dd>Can be set to true/false to prevent default behavior as soon as the touchmove or mousemove is received. As with gesturemovestart, can also be set to function which returns true/false based on the event facade passed to it.</dd> * </dl> * * @return {EventHandle} the detach handle */ define(GESTURE_MOVE, { on : function (node, subscriber, ce) { var moveHandle, root; // if the passed node is NOT the document itself, modify the ms-pointer // behavior to prevent scrolling, highlighting, etc. if (!_checkDocumentElem(node)) { _setTouchActions(node); } root = _getRoot(node, subscriber, EVENT[MOVE]); moveHandle = root.on(EVENT[MOVE], this._onMove, this, node, subscriber, ce); subscriber[_MOVE_HANDLE] = moveHandle; }, delegate : function(node, subscriber, ce, filter) { var se = this; subscriber[_DEL_MOVE_HANDLE] = node.delegate(EVENT[MOVE], function(e) { se._onMove(e, node, subscriber, ce, true); }, filter); }, detach : function (node, subscriber, ce) { var moveHandle = subscriber[_MOVE_HANDLE]; if (moveHandle) { moveHandle.detach(); subscriber[_MOVE_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, detachDelegate : function(node, subscriber, ce, filter) { var handle = subscriber[_DEL_MOVE_HANDLE]; if (handle) { handle.detach(); subscriber[_DEL_MOVE_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, processArgs : function(args, delegate) { return _defArgsProcessor(this, args, delegate); }, _onMove : function(e, node, subscriber, ce, delegate) { if (delegate) { node = e[CURRENT_TARGET]; } var fireMove = subscriber._extra.standAlone || node.getData(_MOVE_START), preventDefault = subscriber._extra.preventDefault; if (fireMove) { if (e.touches) { if (e.touches.length === 1) { _normTouchFacade(e, e.touches[0]); } else { fireMove = false; } } if (fireMove) { _prevent(e, preventDefault); e.type = GESTURE_MOVE; ce.fire(e); } } }, PREVENT_DEFAULT : false }); /** * Sets up a "gesturemoveend" event, that is fired on touch devices in response to a single finger "touchend", * and on mouse based devices in response to a "mouseup". * * <p>By default this event is only fired when the same node * has received a "gesturemove" or "gesturemovestart" event. The subscriber can set standAlone to true, in the configuration properties, * if they want to listen for this event without a preceding "gesturemovestart" or "gesturemove".</p> * * <p>By default this event sets up it's internal "touchend" and "mouseup" DOM listeners on the document element. The subscriber * can set the root configuration property, to specify which node to attach DOM listeners to, if different from the document.</p> * * <p>This event can also be listened for using node.delegate().</p> * * <p>It is recommended that you use Y.bind to set up context and additional arguments for your event handler, * however if you want to pass the context and arguments as additional signature arguments to on/delegate, * you need to provide a null value for the configuration object, e.g: <code>node.on("gesturemoveend", fn, null, context, arg1, arg2, arg3)</code></p> * * * @event gesturemoveend * @for YUI * @param type {string} "gesturemoveend" * @param fn {function} The method the event invokes. It receives the event facade of the underlying DOM event (mouseup or touchend.changedTouches[0]). * @param cfg {Object} Optional. An object which specifies: * <dl> * <dt>standAlone (defaults to false)</dt> * <dd>true, if the subscriber should be notified even if a "gesturemovestart" or "gesturemove" has not occured on the same node.</dd> * <dt>root (defaults to document)</dt> * <dd>The node to which the internal DOM listeners should be attached.</dd> * <dt>preventDefault (defaults to false)</dt> * <dd>Can be set to true/false to prevent default behavior as soon as the touchend or mouseup is received. As with gesturemovestart, can also be set to function which returns true/false based on the event facade passed to it.</dd> * </dl> * * @return {EventHandle} the detach handle */ define(GESTURE_MOVE_END, { on : function (node, subscriber, ce) { var endHandle, root; if (!_checkDocumentElem(node)) { _setTouchActions(node); } root = _getRoot(node, subscriber); endHandle = root.on(EVENT[END], this._onEnd, this, node, subscriber, ce); subscriber[_MOVE_END_HANDLE] = endHandle; }, delegate : function(node, subscriber, ce, filter) { var se = this; subscriber[_DEL_MOVE_END_HANDLE] = node.delegate(EVENT[END], function(e) { se._onEnd(e, node, subscriber, ce, true); }, filter); }, detachDelegate : function(node, subscriber, ce, filter) { var handle = subscriber[_DEL_MOVE_END_HANDLE]; if (handle) { handle.detach(); subscriber[_DEL_MOVE_END_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, detach : function (node, subscriber, ce) { var endHandle = subscriber[_MOVE_END_HANDLE]; if (endHandle) { endHandle.detach(); subscriber[_MOVE_END_HANDLE] = null; } if (!_checkDocumentElem(node)) { _unsetTouchActions(node); } }, processArgs : function(args, delegate) { return _defArgsProcessor(this, args, delegate); }, _onEnd : function(e, node, subscriber, ce, delegate) { if (delegate) { node = e[CURRENT_TARGET]; } var fireMoveEnd = subscriber._extra.standAlone || node.getData(_MOVE) || node.getData(_MOVE_START), preventDefault = subscriber._extra.preventDefault; if (fireMoveEnd) { if (e.changedTouches) { if (e.changedTouches.length === 1) { _normTouchFacade(e, e.changedTouches[0]); } else { fireMoveEnd = false; } } if (fireMoveEnd) { _prevent(e, preventDefault); e.type = GESTURE_MOVE_END; ce.fire(e); node.clearData(_MOVE_START); node.clearData(_MOVE); } } }, PREVENT_DEFAULT : false }); }, '3.18.0', {"requires": ["node-base", "event-touch", "event-synthetic"]});
ahocevar/cdnjs
ajax/libs/yui/3.18.0/event-move/event-move.js
JavaScript
mit
21,248
(function(a){function b(){}function c(a){return a}function d(a,b){return fb(a,b)}function e(a,b){return a-b}function f(a){throw a}function g(a){return"function"==typeof a.then}function h(){if(this.isDisposed)throw new Error(M)}function i(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function j(a){var b=[];if(!i(a))return b;eb.nonEnumArgs&&a.length&&n(a)&&(a=gb.call(a));var c=eb.enumPrototypes&&"function"==typeof a,d=eb.enumErrorProps&&(a===$||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(eb.nonEnumShadows&&a!==_){var f=a.constructor,g=-1,h=cb.length;if(a===(f&&f.prototype))var j=a===stringProto?W:a===$?R:X.call(a),k=db[j];for(;++g<h;)e=cb[g],k&&k[e]||!Y.call(a,e)||b.push(e)}return b}function k(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function l(a,b){return k(a,b,j)}function m(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function n(a){return a&&"object"==typeof a?X.call(a)==N:!1}function o(a){return"function"==typeof a}function p(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=X.call(a),h=X.call(b);if(g==N&&(g=U),h==N&&(h=U),g!=h)return!1;switch(g){case P:case Q:return+a==+b;case T:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case V:case W:return a==String(b)}var i=g==O;if(!i){if(g!=U||!eb.nodeClass&&(m(a)||m(b)))return!1;var j=!eb.argsObject&&n(a)?Object:a.constructor,k=!eb.argsObject&&n(b)?Object:b.constructor;if(!(j==k||Y.call(a,"constructor")&&Y.call(b,"constructor")||o(j)&&j instanceof j&&o(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),i){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=p(a[r],s,c,d)))break}}else l(b,function(b,e,f){return Y.call(f,e)?(r++,result=Y.call(a,e)&&p(a[e],b,c,d)):void 0}),result&&l(a,function(a,b,c){return Y.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function q(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:gb.call(a)}function r(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function s(a,b){return new gc(function(c){var d=new sb,e=new tb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return c.onError(g),void 0}d=new sb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new gc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return d.onError(i),void 0}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a){return this.select(function(b,c){var d=a(b,c);return g(d)?ac(d):d}).mergeObservable()}function v(a,b,c){return a.addListener?(a.addListener(b,c),pb(function(){a.removeListener(b,c)})):a.addEventListener?(a.addEventListener(b,c,!1),pb(function(){a.removeEventListener(b,c,!1)})):void 0}function w(a,b,c){var d=new mb;if(a&&a.length)for(var e=0,f=a.length;f>e;e++)d.add(w(a[e],b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){var c=xb(a);return new gc(function(a){return b.scheduleWithRelative(c,function(){a.onNext(0),a.onCompleted()})})}function y(a,b,c){return a===b?new gc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Sb(function(){return observableTimerDateAndPeriod(c.now()+a,b,c)})}function z(a,b){return new gc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new mb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function A(a,b,d){return new gc(function(e){function f(a,b){k[b]=a;var f;if(h[b]=!0,i||(i=h.every(c))){try{f=d.apply(null,k)}catch(g){return e.onError(g),void 0}e.onNext(f)}else j&&e.onCompleted()}var g=2,h=[!1,!1],i=!1,j=!1,k=new Array(g);return new mb(a.subscribe(function(a){f(a,0)},e.onError.bind(e),function(){j=!0,e.onCompleted()}),b.subscribe(function(a){f(a,1)},e.onError.bind(e)))})}var B={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},C=B[typeof window]&&window||this,D=B[typeof exports]&&exports&&!exports.nodeType&&exports,E=B[typeof module]&&module&&!module.nodeType&&module,F=E&&E.exports===D&&D,G=B[typeof global]&&global;!G||G.global!==G&&G.window!==G||(C=G);var H,I={internals:{},config:{}},J=Date.now,K="Sequence contains no elements.",L="Argument out of range",M="Object has been disposed",N="[object Arguments]",O="[object Array]",P="[object Boolean]",Q="[object Date]",R="[object Error]",S="[object Function]",T="[object Number]",U="[object Object]",V="[object RegExp]",W="[object String]",X=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,Z=X.call(arguments)==N,$=Error.prototype,_=Object.prototype,ab=_.propertyIsEnumerable;try{H=!(X.call(document)==U&&!({toString:0}+""))}catch(bb){H=!0}var cb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],db={};db[O]=db[Q]=db[T]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},db[P]=db[W]={constructor:!0,toString:!0,valueOf:!0},db[R]=db[S]=db[V]={constructor:!0,toString:!0},db[U]={constructor:!0};var eb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);eb.enumErrorProps=ab.call($,"message")||ab.call($,"name"),eb.enumPrototypes=ab.call(a,"prototype"),eb.nonEnumArgs=0!=c,eb.nonEnumShadows=!/valueOf/.test(b)}(1),Z||(n=function(a){return a&&"object"==typeof a?Y.call(a,"callee"):!1}),o(/x/)&&(o=function(a){return"function"==typeof a&&X.call(a)==S});var fb=I.internals.isEqual=function(a,b){return p(a,b,[],[])},gb=Array.prototype.slice,hb=({}.hasOwnProperty,this.inherits=I.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ib=I.internals.addProperties=function(a){for(var b=gb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},jb=(I.internals.addRef=function(a,b){return new gc(function(c){return new mb(b.getDisposable(),a.subscribe(c))})},function(a,b){this.id=a,this.value=b});jb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var kb=I.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},lb=kb.prototype;lb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},lb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},lb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},lb.peek=function(){return this.items[0].value},lb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},lb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},lb.enqueue=function(a){var b=this.length++;this.items[b]=new jb(kb.count++,a),this.percolate(b)},lb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},kb.count=0;var mb=I.CompositeDisposable=function(){this.disposables=q(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},nb=mb.prototype;nb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},nb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},nb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},nb.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},nb.contains=function(a){return-1!==this.disposables.indexOf(a)},nb.toArray=function(){return this.disposables.slice(0)};var ob=I.Disposable=function(a){this.isDisposed=!1,this.action=a||b};ob.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var pb=ob.create=function(a){return new ob(a)},qb=ob.empty={dispose:b},rb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),sb=I.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return hb(b,a),b}(rb),tb=I.SerialDisposable=function(a){function b(){a.call(this,!1)}return hb(b,a),b}(rb),ub=(I.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?qb:new a(this)},b}(),I.internals.ScheduledItem=function(a,b,c,d,f){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=f||e,this.disposable=new sb});ub.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ub.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},ub.prototype.isCancelled=function(){return this.disposable.isDisposed},ub.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var vb,wb=I.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new mb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),qb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new mb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),qb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),qb}var e=a.prototype;return e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return pb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=J,a.normalize=function(a){return 0>a&&(a=0),a},a}(),xb=wb.normalize,yb=wb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=xb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new wb(J,a,b,c)}(),zb=wb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-wb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+wb.normalize(c),g=new ub(this,b,d,f);if(e)e.enqueue(g);else{e=new kb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new wb(J,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),Ab=(I.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new sb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),b);!function(){function a(){if(!C.postMessage||C.importScripts)return!1;var a=!1,b=C.onmessage;return C.onmessage=function(){a=!0},C.postMessage("","*"),C.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(X).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=G&&F&&G.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=G&&F&&G.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))vb=process.nextTick;else if("function"==typeof d)vb=d,Ab=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;C.addEventListener?C.addEventListener("message",b,!1):C.attachEvent("onmessage",b,!1),vb=function(a){var b=h++;g[b]=a,C.postMessage(f+b,"*")}}else if(C.MessageChannel){var i=new C.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},vb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?vb=function(a){var b=C.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},C.document.documentElement.appendChild(b)}:(vb=function(a){return setTimeout(a,0)},Ab=clearTimeout)}();var Bb=wb.timeout=function(){function a(a,b){var c=this,d=new sb,e=vb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new mb(d,pb(function(){Ab(e)}))}function b(a,b,c){var d=this,e=wb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new sb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new mb(f,pb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new wb(J,a,b,c)}(),Cb=I.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}var b=a.prototype;return b.accept=function(a,b,c){return 1===arguments.length&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},b.toObservable=function(a){var b=this;return a||(a=yb),new gc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Db=Cb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Cb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Eb=Cb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Cb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Fb=Cb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Cb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Gb=I.internals.Enumerator=function(a,b){this.moveNext=a,this.getCurrent=b},Hb=Gb.create=function(a,b){var c=!1;return new Gb(function(){if(c)return!1;var b=a();return b||(c=!0),b},function(){return b()})},Ib=I.internals.Enumerable=function(a){this.getEnumerator=a};Ib.prototype.concat=function(){var a=this;return new gc(function(b){var c,d=a.getEnumerator(),e=new tb,f=yb.scheduleRecursive(function(a){var f,g;if(!c){try{g=d.moveNext(),g&&(f=d.getCurrent())}catch(h){return b.onError(h),void 0}if(!g)return b.onCompleted(),void 0;var i=new sb;e.setDisposable(i),i.setDisposable(f.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new mb(e,f,pb(function(){c=!0}))})},Ib.prototype.catchException=function(){var a=this;return new gc(function(b){var c,d,e=a.getEnumerator(),f=new tb,g=yb.scheduleRecursive(function(a){var g,h;if(!c){try{h=e.moveNext(),h&&(g=e.getCurrent())}catch(i){return b.onError(i),void 0}if(!h)return d?b.onError(d):b.onCompleted(),void 0;var j=new sb;f.setDisposable(j),j.setDisposable(g.subscribe(b.onNext.bind(b),function(b){d=b,a()},b.onCompleted.bind(b)))}});return new mb(f,g,pb(function(){c=!0}))})};var Jb=Ib.repeat=function(a,b){return 1===arguments.length&&(b=-1),new Ib(function(){var c,d=b;return Hb(function(){return 0===d?!1:(d>0&&d--,c=a,!0)},function(){return c})})},Kb=Ib.forEach=function(a,b,d){return b||(b=c),new Ib(function(){var c,e=-1;return Hb(function(){return++e<a.length?(c=b.call(d,a[e],e,a),!0):!1},function(){return c})})},Lb=I.Observer=function(){};Lb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Lb.prototype.asObserver=function(){return new Pb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Mb=Lb.create=function(a,c,d){return a||(a=b),c||(c=f),d||(d=b),new Pb(a,c,d)};Lb.fromNotifier=function(a){return new Pb(function(b){return a(Db(b))},function(b){return a(Eb(b))},function(){return a(Fb())})};var Nb,Ob=I.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return hb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Lb),Pb=I.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return hb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Ob),Qb=I.Observable=function(){function a(a){this._subscribe=a}return Nb=a.prototype,Nb.finalValue=function(){var a=this;return new gc(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(K))})})},Nb.subscribe=Nb.forEach=function(a,b,c){var d;return d="object"==typeof a?a:Mb(a,b,c),this._subscribe(d)},Nb.toArray=function(){function a(a,b){var c=a.slice(0);return c.push(b),c}return this.scan([],a).startWith([]).finalValue()},a}(),Rb=I.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new tb}return hb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return b.isAcquired=!1,void 0;c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Ob);Qb.create=Qb.createWithDisposable=function(a){return new gc(a)};var Sb=Qb.defer=function(a){return new gc(function(b){var c;try{c=a()}catch(d){return Xb(d).subscribe(b)}return c.subscribe(b)})},Tb=Qb.empty=function(a){return a||(a=yb),new gc(function(b){return a.schedule(function(){b.onCompleted()})})},Ub=Qb.fromArray=function(a,b){return b||(b=zb),new gc(function(c){var d=0;return b.scheduleRecursive(function(b){d<a.length?(c.onNext(a[d++]),b()):c.onCompleted()})})};Nb.fromGenerator=function(a,b){return b||(b=zb),new gc(function(c){var d;try{d=a()}catch(e){return c.onError(e),void 0}return b.scheduleRecursive(function(a){var b=d.next();b.done?c.onCompleted():(c.onNext(b.value),a())})})},Qb.generate=function(a,b,c,d,e){return e||(e=zb),new gc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return f.onError(j),void 0}e?(f.onNext(i),a()):f.onCompleted()})})};var Vb=Qb.never=function(){return new gc(function(){return qb})};Qb.range=function(a,b,c){return c||(c=zb),new gc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Qb.repeat=function(a,b,c){return c||(c=zb),null==b&&(b=-1),Wb(a,c).repeat(b)};var Wb=Qb["return"]=Qb.returnValue=function(a,b){return b||(b=yb),new gc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},Xb=Qb["throw"]=Qb.throwException=function(a,b){return b||(b=yb),new gc(function(c){return b.schedule(function(){c.onError(a)})})};Nb["catch"]=Nb.catchException=function(a){return"function"==typeof a?s(this,a):Yb([this,a])};var Yb=Qb.catchException=Qb["catch"]=function(){var a=q(arguments,0);return Kb(a).catchException()};Nb.combineLatest=function(){var a=gb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Zb.apply(this,a)};var Zb=Qb.combineLatest=function(){var a=gb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new gc(function(d){function e(a){var e;if(i[a]=!0,j||(j=i.every(c))){try{e=b.apply(null,l)}catch(f){return d.onError(f),void 0}d.onNext(e)}else k.filter(function(b,c){return c!==a}).every(c)&&d.onCompleted()}function f(a){k[a]=!0,k.every(c)&&d.onCompleted()}for(var g=function(){return!1},h=a.length,i=r(h,g),j=!1,k=r(h,g),l=new Array(h),m=new Array(h),n=0;h>n;n++)!function(b){m[b]=new sb,m[b].setDisposable(a[b].subscribe(function(a){l[b]=a,e(b)},d.onError.bind(d),function(){f(b)}))}(n);return new mb(m)})};Nb.concat=function(){var a=gb.call(arguments,0);return a.unshift(this),$b.apply(this,a)};var $b=Qb.concat=function(){var a=q(arguments,0);return Kb(a).concat()};Nb.concatObservable=Nb.concatAll=function(){return this.merge(1)},Nb.merge=function(a){if("number"!=typeof a)return _b(this,a);var b=this;return new gc(function(c){var d=0,e=new mb,f=!1,h=[],i=function(a){var b=new sb;e.add(b),g(a)&&(a=ac(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),h.length>0?(a=h.shift(),i(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,i(b)):h.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var _b=Qb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=gb.call(arguments,1)):(a=yb,b=gb.call(arguments,0)):(a=yb,b=gb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),Ub(b,a).mergeObservable()};Nb.mergeObservable=Nb.mergeAll=function(){var a=this;return new gc(function(b){var c=new mb,d=!1,e=new sb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new sb;c.add(e),g(a)&&(a=ac(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Nb.skipUntil=function(a){var b=this;return new gc(function(c){var d=!1,e=new mb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()})),f=new sb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Nb["switch"]=Nb.switchLatest=function(){var a=this;return new gc(function(b){var c=!1,d=new tb,e=!1,f=0,h=a.subscribe(function(a){var h=new sb,i=++f;c=!0,d.setDisposable(h),g(a)&&(a=ac(a)),h.setDisposable(a.subscribe(function(a){f===i&&b.onNext(a)},function(a){f===i&&b.onError(a)},function(){f===i&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new mb(h,d)})},Nb.takeUntil=function(a){var c=this;return new gc(function(d){return new mb(c.subscribe(d),a.subscribe(d.onCompleted.bind(d),d.onError.bind(d),b))})},Nb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=gb.call(arguments),d=b.pop();return b.unshift(a),new gc(function(e){function f(a){i[a]=!0,i.every(function(a){return a})&&e.onCompleted()}for(var g=b.length,h=r(g,function(){return[]}),i=r(g,function(){return!1}),j=function(b){var f,g;if(h.every(function(a){return a.length>0})){try{g=h.map(function(a){return a.shift()}),f=d.apply(a,g)}catch(j){return e.onError(j),void 0}e.onNext(f)}else i.filter(function(a,c){return c!==b}).every(c)&&e.onCompleted()},k=new Array(g),l=0;g>l;l++)!function(a){k[a]=new sb,k[a].setDisposable(b[a].subscribe(function(b){h[a].push(b),j(a)},e.onError.bind(e),function(){f(a)}))}(l);return new mb(k)})},Qb.zip=function(){var a=gb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Qb.zipArray=function(){var a=q(arguments,0);return new gc(function(b){function d(a){if(g.every(function(a){return a.length>0})){var d=g.map(function(a){return a.shift()});b.onNext(d)}else if(h.filter(function(b,c){return c!==a}).every(c))return b.onCompleted(),void 0}function e(a){return h[a]=!0,h.every(c)?(b.onCompleted(),void 0):void 0}for(var f=a.length,g=r(f,function(){return[]}),h=r(f,function(){return!1}),i=new Array(f),j=0;f>j;j++)!function(c){i[c]=new sb,i[c].setDisposable(a[c].subscribe(function(a){g[c].push(a),d(c)},b.onError.bind(b),function(){e(c)}))}(j);var k=new mb(i);return k.add(pb(function(){for(var a=0,b=g.length;b>a;a++)g[a]=[]})),k})},Nb.asObservable=function(){var a=this;return new gc(function(b){return a.subscribe(b)})},Nb.dematerialize=function(){var a=this;return new gc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Nb.distinctUntilChanged=function(a,b){var e=this;return a||(a=c),b||(b=d),new gc(function(c){var d,f=!1;return e.subscribe(function(e){var g,h=!1;try{g=a(e)}catch(i){return c.onError(i),void 0}if(f)try{h=b(d,g)}catch(i){return c.onError(i),void 0}f&&h||(f=!0,d=g,c.onNext(e))},c.onError.bind(c),c.onCompleted.bind(c))})},Nb["do"]=Nb.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new gc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Nb["finally"]=Nb.finallyAction=function(a){var b=this;return new gc(function(c){var d=b.subscribe(c);return pb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Nb.ignoreElements=function(){var a=this;return new gc(function(c){return a.subscribe(b,c.onError.bind(c),c.onCompleted.bind(c))})},Nb.materialize=function(){var a=this;return new gc(function(b){return a.subscribe(function(a){b.onNext(Db(a))},function(a){b.onNext(Eb(a)),b.onCompleted()},function(){b.onNext(Fb()),b.onCompleted()})})},Nb.repeat=function(a){return Jb(this,a).concat()},Nb.retry=function(a){return Jb(this,a).catchException()},Nb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new gc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return e.onError(i),void 0}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Nb.skipLast=function(a){var b=this;return new gc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Nb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=yb,a=gb.call(arguments,c),Kb([Ub(a,b),this]).concat()},Nb.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return Ub(a,b)})},Nb.takeLastBuffer=function(a){var b=this;return new gc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Nb.select=Nb.map=function(a,b){var c=this;return new gc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Nb.selectMany=Nb.flatMap=function(a,b){return b?this.selectMany(function(c,d){var e=a(c,d),f=g(e)?ac(e):e;return f.select(function(a){return b(c,a,d)})}):"function"==typeof a?u.call(this,a):u.call(this,function(){return a})},Nb.selectSwitch=Nb.flatMapLatest=function(a,b){return this.select(a,b).switchLatest()},Nb.skip=function(a){if(0>a)throw new Error(L);var b=this;return new gc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Nb.skipWhile=function(a,b){var c=this;return new gc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Nb.take=function(a,b){if(0>a)throw new Error(L);if(0===a)return Tb(b);var c=this;return new gc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Nb.takeWhile=function(a,b){var c=this;return new gc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return d.onError(h),void 0}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Nb.where=Nb.filter=function(a,b){var c=this;return new gc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return d.onError(h),void 0}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Qb.fromCallback=function(a,b,c,d){return b||(b=yb),function(){var e=gb.call(arguments,0);return new gc(function(f){return b.schedule(function(){function b(a){var b=a;if(d)try{b=d(arguments)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Qb.fromNodeCallback=function(a,b,c,d){return b||(b=yb),function(){var e=gb.call(arguments,0);return new gc(function(f){return b.schedule(function(){function b(a){if(a)return f.onError(a),void 0; var b=gb.call(arguments,1);if(d)try{b=d(b)}catch(c){return f.onError(c),void 0}else 1===b.length&&(b=b[0]);f.onNext(b),f.onCompleted()}e.push(b),a.apply(c,e)})})}},Qb.fromEvent=function(a,b,c){return new gc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)})}).publish().refCount()},Qb.fromEventPattern=function(a,b,c){return new gc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e),void 0}d.onNext(b)}var f=a(e);return pb(function(){b&&b(e,f)})}).publish().refCount()};var ac=Qb.fromPromise=function(a){return new gc(function(b){a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)})})};Nb.toPromise=function(a){if(a||(a=I.config.Promise),!a)throw new Error("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Qb.startAsync=function(a){var b;try{b=a()}catch(c){return Xb(c)}return ac(b)},Nb.multicast=function(a,b){var c=this;return"function"==typeof a?new gc(function(d){var e=c.multicast(a());return new mb(b(e).subscribe(d),e.connect())}):new bc(c,a)},Nb.publish=function(a){return a?this.multicast(function(){return new jc},a):this.multicast(new jc)},Nb.share=function(){return this.publish(null).refCount()},Nb.publishLast=function(a){return a?this.multicast(function(){return new kc},a):this.multicast(new kc)},Nb.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new mc(b)},a):this.multicast(new mc(a))},Nb.shareValue=function(a){return this.publishValue(a).refCount()},Nb.replay=function(a,b,c,d){return a?this.multicast(function(){return new nc(b,c,d)},a):this.multicast(new nc(b,c,d))},Nb.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var bc=I.ConnectableObservable=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new mb(e.source.subscribe(e.subject),pb(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return hb(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new gc(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),pb(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(Qb),cc=Qb.interval=function(a,b){return b||(b=Bb),y(a,a,b)},dc=Qb.timer=function(b,c,d){var e;return d||(d=Bb),"number"==typeof c?e=c:"object"==typeof c&&"now"in c&&(d=c),e===a?x(b,d):y(b,e,d)};Nb.delay=function(a,b){b||(b=Bb);var c=this;return new gc(function(d){var e,f=!1,g=new tb,h=null,i=[],j=!1;return e=c.materialize().timestamp(b).subscribe(function(c){var e,k;"E"===c.value.kind?(i=[],i.push(c),h=c.value.exception,k=!j):(i.push({value:c.value,timestamp:c.timestamp+a}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new sb,g.setDisposable(e),e.setDisposable(b.scheduleRecursiveWithRelative(a,function(a){var c,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-b.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-b.now())):f=!1,c=h,j=!1,null!==c?d.onError(c):k&&a(e)}}))))}),new mb(e,g)})},Nb.throttle=function(a,b){b||(b=Bb);return this.throttleWithSelector(function(){return dc(a,b)})},Nb.timeInterval=function(a){var b=this;return a||(a=Bb),Sb(function(){var c=a.now();return b.select(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},Nb.timestamp=function(a){return a||(a=Bb),this.select(function(b){return{value:b,timestamp:a.now()}})},Nb.sample=function(a,b){return b||(b=Bb),"number"==typeof a?z(this,cc(a,b)):z(this,a)},Nb.timeout=function(a,b,c){var d,e=this;return b||(b=Xb(new Error("Timeout"))),c||(c=Bb),d=a instanceof Date?function(a,b){c.scheduleWithAbsolute(a,b)}:function(a,b){c.scheduleWithRelative(a,b)},new gc(function(c){var f,g=0,h=new sb,i=new tb,j=!1,k=new tb;return i.setDisposable(h),f=function(){var e=g;k.setDisposable(d(a,function(){j=g===e;var a=j;a&&i.setDisposable(b.subscribe(c))}))},f(),h.setDisposable(e.subscribe(function(a){var b=!j;b&&(g++,c.onNext(a),f())},function(a){var b=!j;b&&(g++,c.onError(a))},function(){var a=!j;a&&(g++,c.onCompleted())})),new mb(i,k)})},Qb.generateWithTime=function(a,b,c,d,e,f){return f||(f=Bb),new gc(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return g.onError(f),void 0}k?a(i):g.onCompleted()})})},Nb.delaySubscription=function(a,b){return b||(b=Bb),this.delayWithSelector(dc(a,b),function(){return Tb()})},Nb.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new gc(function(a){var b=new mb,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new tb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return a.onError(f),void 0}var h=new sb;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new mb(h,b)})},Nb.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=Vb()}c||(c=Xb(new Error("Timeout")));var d=this;return new gc(function(e){var f=new tb,g=new tb,h=new sb;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new sb;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return e.onError(d),void 0}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new mb(f,g)})},Nb.throttleWithSelector=function(a){var b=this;return new gc(function(c){var d,e=!1,f=new tb,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return c.onError(i),void 0}e=!0,d=b,g++;var j=g,k=new sb;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new mb(h,f)})},Nb.skipLastWithTime=function(a,b){b||(b=Bb);var c=this;return new gc(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Nb.takeLastWithTime=function(a,b,c){return this.takeLastBufferWithTime(a,b).selectMany(function(a){return Ub(a,c)})},Nb.takeLastBufferWithTime=function(a,b){var c=this;return b||(b=Bb),new gc(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})})},Nb.takeWithTime=function(a,b){var c=this;return b||(b=Bb),new gc(function(d){var e=b.scheduleWithRelative(a,function(){d.onCompleted()});return new mb(e,c.subscribe(d))})},Nb.skipWithTime=function(a,b){var c=this;return b||(b=Bb),new gc(function(d){var e=!1,f=b.scheduleWithRelative(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new mb(f,g)})},Nb.skipUntilWithTime=function(a,b){b||(b=Bb);var c=this;return new gc(function(d){var e=!1,f=b.scheduleWithAbsolute(a,function(){e=!0}),g=c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d));return new mb(f,g)})},Nb.takeUntilWithTime=function(a,b){b||(b=Bb);var c=this;return new gc(function(d){return new mb(b.scheduleWithAbsolute(a,function(){d.onCompleted()}),c.subscribe(d))})},Nb.pausable=function(a){var b=this;return new gc(function(c){var d=b.publish(),e=d.subscribe(c),f=qb,g=a.distinctUntilChanged().subscribe(function(a){a?f=d.connect():(f.dispose(),f=qb)});return new mb(e,f,g)})},Nb.pausableBuffered=function(a){var b=this;return new gc(function(c){var d=[],e=!0,f=A(b,a.distinctUntilChanged(),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(a){if(a.shouldFire&&e&&c.onNext(a.data),a.shouldFire&&!e){for(;d.length>0;)c.onNext(d.shift());e=!0}else a.shouldFire||e?!a.shouldFire&&e&&(e=!1):d.push(a.data)},c.onError.bind(c),c.onCompleted.bind(c));return a.onNext(!1),f})},Nb.controlled=function(a){return null==a&&(a=!0),new ec(this,a)};var ec=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new fc(d),this.source=c.multicast(this.subject).refCount()}return hb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(Qb),fc=I.ControlledSubject=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new jc,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=qb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=qb}return hb(c,a),ib(c.prototype,Lb,{onCompleted:function(){h.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){h.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){h.call(this);var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=qb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=qb),{numberOfItems:a,returnValue:!1}},request:function(a){h.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?qb:(this.requestedCount=a,this.requestedDisposable=pb(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=qb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(Qb),gc=I.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=qb:"function"==typeof a&&(a=pb(a)),a}function c(d){function e(a){var c=new hc(a);if(zb.scheduleRequired())zb.schedule(function(){try{c.setDisposable(b(d(c)))}catch(a){if(!c.fail(a))throw a}});else try{c.setDisposable(b(d(c)))}catch(e){if(!c.fail(e))throw e}return c}return this instanceof c?(a.call(this,e),void 0):new c(d)}return hb(c,a),c}(Qb),hc=function(a){function b(b){a.call(this),this.observer=b,this.m=new sb}hb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Ob),ic=function(a,b){this.subject=a,this.observer=b};ic.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var jc=I.Subject=function(a){function b(a){return h.call(this),this.isStopped?this.exception?(a.onError(this.exception),qb):(a.onCompleted(),qb):(this.observers.push(a),new ic(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return hb(c,a),ib(c.prototype,Lb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped)for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new lc(a,b)},c}(Qb),kc=I.AsyncSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),new ic(this,a);var b=this.exception,c=this.hasValue,d=this.value;return b?a.onError(b):c?(a.onNext(d),a.onCompleted()):a.onCompleted(),qb}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return hb(c,a),ib(c.prototype,Lb,{hasObservers:function(){return h.call(this),this.observers.length>0},onCompleted:function(){var a,b,c;if(h.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),e=this.value,f=this.hasValue;if(f)for(b=0,c=d.length;c>b;b++)a=d[b],a.onNext(e),a.onCompleted();else for(b=0,c=d.length;c>b;b++)d[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){h.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(Qb),lc=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return hb(c,a),ib(c.prototype,Lb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Qb),mc=I.BehaviorSubject=function(a){function b(a){if(h.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new ic(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),qb}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return hb(c,a),ib(c.prototype,Lb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(h.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(h.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,d=b.length;d>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(h.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,d=b.length;d>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(Qb),nc=I.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new Rb(this.scheduler,a),d=new b(this,c);h.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=this.q.length,f=0,g=this.q.length;g>f;f++)c.onNext(this.q[f].value);return this.hasError?(e++,c.onError(this.error)):this.isStopped&&(e++,c.onCompleted()),c.ensureActive(e),d}function d(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||zb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},hb(d,a),ib(d.prototype,Lb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var b;if(h.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(h.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)b=d[e],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(h.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)a=c[d],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(Qb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(C.Rx=I,define(function(){return I})):D&&E?F?(E.exports=I).Rx=I:D.Rx=I:C.Rx=I}).call(this);
algolia/jsdelivr
files/rxjs/2.2.15/rx.lite.min.js
JavaScript
mit
49,803
hljs.registerLanguage("vim",function(a){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw d|0 delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu g|0 go gr grepa gu gv ha h|0 helpf helpg helpt hi hid his i|0 ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs n|0 new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf q|0 quita qa r|0 rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv s|0 sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync t|0 tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up v|0 ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"abs acos add and append argc argidx argv asin atan atan2 browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call ceil changenr char2nr cindent clearmatches col complete complete_add complete_check confirm copy cos cosh count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty escape eval eventhandler executable exists exp expand extend feedkeys filereadable filewritable filter finddir findfile float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function garbagecollect get getbufline getbufvar getchar getcharmod getcmdline getcmdpos getcmdtype getcwd getfontname getfperm getfsize getftime getftype getline getloclist getmatches getpid getpos getqflist getreg getregtype gettabvar gettabwinvar getwinposx getwinposy getwinvar glob globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputlist inputrestore inputsave inputsecret insert invert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime log log10 luaeval map maparg mapcheck match matchadd matcharg matchdelete matchend matchlist matchstr max min mkdir mode mzeval nextnonblank nr2char or pathshorten pow prevnonblank printf pumvisible py3eval pyeval range readfile reltime reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse round screenattr screenchar screencol screenrow search searchdecl searchpair searchpairpos searchpos server2client serverlist setbufvar setcmdpos setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar setwinvar sha256 shellescape shiftwidth simplify sin sinh sort soundfold spellbadword spellsuggest split sqrt str2float str2nr strchars strdisplaywidth strftime stridx string strlen strpart strridx strtrans strwidth submatch substitute synconcealed synID synIDattr synIDtrans synstack system tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname tolower toupper tr trunc type undofile undotree values virtcol visualmode wildmenumode winbufnr wincol winheight winline winnr winrestcmd winrestview winsaveview winwidth writefile xor"},i:/[{:]/,c:[a.NM,a.ASM,{cN:"string",b:/"((\\")|[^"\n])*("|\n)/},{cN:"variable",b:/[bwtglsav]:[\w\d_]*/},{cN:"function",bK:"function function!",e:"$",r:0,c:[a.TM,{cN:"params",b:"\\(",e:"\\)"}]}]}});
ahocevar/cdnjs
ajax/libs/highlight.js/8.1/languages/vim.min.js
JavaScript
mit
8,487
hljs.registerLanguage("avrasm",function(a){return{cI:true,l:"\\.?"+a.IR,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",preprocessor:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},c:[a.CBCM,{cN:"comment",b:";",e:"$",r:0},a.CNM,a.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"localvars",b:"@[0-9]+"}]}});
matteofigus/cdnjs
ajax/libs/highlight.js/8.1/languages/avrasm.min.js
JavaScript
mit
1,791
hljs.registerLanguage("glsl",function(a){return{k:{keyword:"atomic_uint attribute bool break bvec2 bvec3 bvec4 case centroid coherent const continue default discard dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 do double dvec2 dvec3 dvec4 else flat float for highp if iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray in inout int invariant isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 layout lowp mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 mediump noperspective out patch precision readonly restrict return sample sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow smooth struct subroutine switch uimage1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint uniform usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D usamplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 varying vec2 vec3 vec4 void volatile while writeonly",built_in:"gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffsetgl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_PerVertex gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicCounter atomicCounterDecrement atomicCounterIncrement barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow gl_TextureMatrix gl_TextureMatrixInverse",literal:"true false"},i:'"',c:[a.CLCM,a.CBCM,a.CNM,{cN:"preprocessor",b:"#",e:"$"}]}});
lobbin/cdnjs
ajax/libs/highlight.js/8.1/languages/glsl.min.js
JavaScript
mit
6,872
var isIndex = require('../internal/isIndex'), isKey = require('../internal/isKey'), isObject = require('../lang/isObject'), toPath = require('../internal/toPath'); /** * Sets the property value of `path` on `object`. If a portion of `path` * does not exist it is created. * * @static * @memberOf _ * @category Object * @param {Object} object The object to augment. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, 'x[0].y.z', 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { if (object == null) { return object; } var pathKey = (path + ''); path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path); var index = -1, length = path.length, endIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = path[index]; if (isObject(nested)) { if (index == endIndex) { nested[key] = value; } else if (nested[key] == null) { nested[key] = isIndex(path[index + 1]) ? [] : {}; } } nested = nested[key]; } return object; } module.exports = set;
TheSegfault/LocalLanding
bower_components/bootstrap/node_modules/jshint/node_modules/lodash/object/set.js
JavaScript
mit
1,396
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/fx/Toggler",["../_base/lang","../_base/declare","../_base/fx","../aspect"],function(_1,_2,_3,_4){ return _2("dojo.fx.Toggler",null,{node:null,showFunc:_3.fadeIn,hideFunc:_3.fadeOut,showDuration:200,hideDuration:200,constructor:function(_5){ var _6=this; _1.mixin(_6,_5); _6.node=_5.node; _6._showArgs=_1.mixin({},_5); _6._showArgs.node=_6.node; _6._showArgs.duration=_6.showDuration; _6.showAnim=_6.showFunc(_6._showArgs); _6._hideArgs=_1.mixin({},_5); _6._hideArgs.node=_6.node; _6._hideArgs.duration=_6.hideDuration; _6.hideAnim=_6.hideFunc(_6._hideArgs); _4.after(_6.showAnim,"beforeBegin",_1.hitch(_6.hideAnim,"stop",true),true); _4.after(_6.hideAnim,"beforeBegin",_1.hitch(_6.showAnim,"stop",true),true); },show:function(_7){ return this.showAnim.play(_7||0); },hide:function(_8){ return this.hideAnim.play(_8||0); }}); });
ripple0328/cdnjs
ajax/libs/dojo/1.10.2/fx/Toggler.js
JavaScript
mit
1,048
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435", "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a", "\u0432\u0442\u043e\u0440\u043d\u0438\u043a", "\u0441\u0440\u0435\u0434\u0430", "\u0447\u0435\u0442\u0432\u0435\u0440\u0433", "\u043f\u044f\u0442\u043d\u0438\u0446\u0430", "\u0441\u0443\u0431\u0431\u043e\u0442\u0430" ], "MONTH": [ "\u044f\u043d\u0432\u0430\u0440\u044f", "\u0444\u0435\u0432\u0440\u0430\u043b\u044f", "\u043c\u0430\u0440\u0442\u0430", "\u0430\u043f\u0440\u0435\u043b\u044f", "\u043c\u0430\u044f", "\u0438\u044e\u043d\u044f", "\u0438\u044e\u043b\u044f", "\u0430\u0432\u0433\u0443\u0441\u0442\u0430", "\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f", "\u043e\u043a\u0442\u044f\u0431\u0440\u044f", "\u043d\u043e\u044f\u0431\u0440\u044f", "\u0434\u0435\u043a\u0430\u0431\u0440\u044f" ], "SHORTDAY": [ "\u0432\u0441", "\u043f\u043d", "\u0432\u0442", "\u0441\u0440", "\u0447\u0442", "\u043f\u0442", "\u0441\u0431" ], "SHORTMONTH": [ "\u044f\u043d\u0432.", "\u0444\u0435\u0432\u0440.", "\u043c\u0430\u0440\u0442\u0430", "\u0430\u043f\u0440.", "\u043c\u0430\u044f", "\u0438\u044e\u043d\u044f", "\u0438\u044e\u043b\u044f", "\u0430\u0432\u0433.", "\u0441\u0435\u043d\u0442.", "\u043e\u043a\u0442.", "\u043d\u043e\u044f\u0431.", "\u0434\u0435\u043a." ], "fullDate": "EEEE, d MMMM y '\u0433'.", "longDate": "d MMMM y '\u0433'.", "medium": "d MMM y '\u0433'. H:mm:ss", "mediumDate": "d MMM y '\u0433'.", "mediumTime": "H:mm:ss", "short": "dd.MM.yy H:mm", "shortDate": "dd.MM.yy", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u0440\u0443\u0431.", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "ru", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { return PLURAL_CATEGORY.FEW; } if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
dannyxx001/cdnjs
ajax/libs/angular-i18n/1.3.14/angular-locale_ru.js
JavaScript
mit
3,560
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "MONTH": [ "Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba" ], "SHORTDAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "SHORTMONTH": [ "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des" ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "TSh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "sw", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
perfect-pixell/cdnjs
ajax/libs/angular-i18n/1.3.4/angular-locale_sw.js
JavaScript
mit
2,311
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "nt\u0254\u0301ng\u0254\u0301", "mp\u00f3kwa" ], "DAY": [ "eyenga", "mok\u0254l\u0254 mwa yambo", "mok\u0254l\u0254 mwa m\u00edbal\u00e9", "mok\u0254l\u0254 mwa m\u00eds\u00e1to", "mok\u0254l\u0254 ya m\u00edn\u00e9i", "mok\u0254l\u0254 ya m\u00edt\u00e1no", "mp\u0254\u0301s\u0254" ], "MONTH": [ "s\u00e1nz\u00e1 ya yambo", "s\u00e1nz\u00e1 ya m\u00edbal\u00e9", "s\u00e1nz\u00e1 ya m\u00eds\u00e1to", "s\u00e1nz\u00e1 ya m\u00ednei", "s\u00e1nz\u00e1 ya m\u00edt\u00e1no", "s\u00e1nz\u00e1 ya mot\u00f3b\u00e1", "s\u00e1nz\u00e1 ya nsambo", "s\u00e1nz\u00e1 ya mwambe", "s\u00e1nz\u00e1 ya libwa", "s\u00e1nz\u00e1 ya z\u00f3mi", "s\u00e1nz\u00e1 ya z\u00f3mi na m\u0254\u030ck\u0254\u0301", "s\u00e1nz\u00e1 ya z\u00f3mi na m\u00edbal\u00e9" ], "SHORTDAY": [ "eye", "ybo", "mbl", "mst", "min", "mtn", "mps" ], "SHORTMONTH": [ "yan", "fbl", "msi", "apl", "mai", "yun", "yul", "agt", "stb", "\u0254tb", "nvb", "dsb" ], "fullDate": "EEEE d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "d/M/y HH:mm", "shortDate": "d/M/y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "FrCD", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "ln", "pluralCat": function(n, opt_precision) { if (n >= 0 && n <= 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
vuonghuuphuc/cdnjs
ajax/libs/angular.js/1.4.0-beta.2/i18n/angular-locale_ln.js
JavaScript
mit
2,412
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u4e0a\u5348", "\u4e0b\u5348" ], "DAY": [ "\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d" ], "MONTH": [ "\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708" ], "SHORTDAY": [ "\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d" ], "SHORTMONTH": [ "1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708" ], "fullDate": "y\u5e74M\u6708d\u65e5EEEE", "longDate": "y\u5e74M\u6708d\u65e5", "medium": "y\u5e74M\u6708d\u65e5 ah:mm:ss", "mediumDate": "y\u5e74M\u6708d\u65e5", "mediumTime": "ah:mm:ss", "short": "yy/M/d ah:mm", "shortDate": "yy/M/d", "shortTime": "ah:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u00a5", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "zh-cn", "pluralCat": function(n, opt_precision) { return PLURAL_CATEGORY.OTHER;} }); }]);
abbychau/cdnjs
ajax/libs/angular.js/1.4.0-beta.4/angular-1.4.0-beta.5/i18n/angular-locale_zh-cn.js
JavaScript
mit
2,190
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "MONTH": [ "Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba" ], "SHORTDAY": [ "Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi" ], "SHORTMONTH": [ "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des" ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "TSh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "sw-tz", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
pazguille/cdnjs
ajax/libs/angular.js/1.3.9/i18n/angular-locale_sw-tz.js
JavaScript
mit
2,314
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js // declare global: coffeelint (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.registerHelper("lint", "coffeescript", function(text) { var found = []; var parseError = function(err) { var loc = err.lineNumber; found.push({from: CodeMirror.Pos(loc-1, 0), to: CodeMirror.Pos(loc, 0), severity: err.level, message: err.message}); }; try { var res = coffeelint.lint(text); for(var i = 0; i < res.length; i++) { parseError(res[i]); } } catch(e) { found.push({from: CodeMirror.Pos(e.location.first_line, 0), to: CodeMirror.Pos(e.location.last_line, e.location.last_column), severity: 'error', message: e.message}); } return found; }); });
LeaYeh/cdnjs
ajax/libs/codemirror/5.6.0/addon/lint/coffeescript-lint.js
JavaScript
mit
1,270
require 'rexml/document' module ActiveMerchant #:nodoc: module Billing #:nodoc: # Initialization Options # :login Your store number # :pem The text of your linkpoint PEM file. Note # this is not the path to file, but its # contents. If you are only using one PEM # file on your site you can declare it # globally and then you won't need to # include this option # # # A valid store number is required. Unfortunately, with LinkPoint # YOU CAN'T JUST USE ANY OLD STORE NUMBER. Also, you can't just # generate your own PEM file. You'll need to use a special PEM file # provided by LinkPoint. # # Go to http://www.linkpoint.com/support/sup_teststore.asp to set up # a test account and obtain your PEM file. # # Declaring PEM file Globally # ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) # # # Valid Order Options # :result => # LIVE Production mode # GOOD Approved response in test mode # DECLINE Declined response in test mode # DUPLICATE Duplicate response in test mode # # :ponumber Order number # # :transactionorigin => Source of the transaction # ECI Email or Internet # MAIL Mail order # MOTO Mail order/Telephone # TELEPHONE Telephone # RETAIL Face-to-face # # :ordertype => # SALE Real live sale # PREAUTH Authorize only # POSTAUTH Forced Ticket or Ticket Only transaction # VOID # CREDIT # CALCSHIPPING For shipping charges calculations # CALCTAX For sales tax calculations # # Recurring Options # :action => # SUBMIT # MODIFY # CANCEL # # :installments Identifies how many recurring payments to charge the customer # :startdate Date to begin charging the recurring payments. Format: YYYYMMDD or "immediate" # :periodicity => # MONTHLY # BIMONTHLY # WEEKLY # BIWEEKLY # YEARLY # DAILY # :threshold Tells how many times to retry the transaction (if it fails) before contacting the merchant. # :comments Uh... comments # # # For reference: # # https://www.linkpointcentral.com/lpc/docs/Help/APIHelp/lpintguide.htm # # Entities = { # :payment => [:subtotal, :tax, :vattax, :shipping, :chargetotal], # :billing => [:name, :address1, :address2, :city, :state, :zip, :country, :email, :phone, :fax, :addrnum], # :shipping => [:name, :address1, :address2, :city, :state, :zip, :country, :weight, :items, :carrier, :total], # :creditcard => [:cardnumber, :cardexpmonth, :cardexpyear, :cvmvalue, :track], # :telecheck => [:routing, :account, :checknumber, :bankname, :bankstate, :dl, :dlstate, :void, :accounttype, :ssn], # :transactiondetails => [:transactionorigin, :oid, :ponumber, :taxexempt, :terminaltype, :ip, :reference_number, :recurring, :tdate], # :periodic => [:action, :installments, :threshold, :startdate, :periodicity, :comments], # :notes => [:comments, :referred] # :items => [:item => [:price, :quantity, :description, :id, :options => [:option => [:name, :value]]]] # } # # # LinkPoint's Items entity is an optional entity that can be attached to orders. # It is entered as :line_items to be consistent with the CyberSource implementation # # The line_item hash goes in the options hash and should look like # # :line_items => [ # { # :id => '123456', # :description => 'Logo T-Shirt', # :price => '12.00', # :quantity => '1', # :options => [ # { # :name => 'Color', # :value => 'Red' # }, # { # :name => 'Size', # :value => 'XL' # } # ] # }, # { # :id => '111', # :description => 'keychain', # :price => '3.00', # :quantity => '1' # } # ] # This functionality is only supported by this particular gateway may # be changed at any time # class LinkpointGateway < Gateway # Your global PEM file. This will be assigned to you by linkpoint # # Example: # # ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) # cattr_accessor :pem_file TEST_URL = 'https://staging.linkpt.net:1129/' LIVE_URL = 'https://secure.linkpt.net:1129/' # We don't have the certificate to verify LinkPoint self.ssl_strict = false self.supported_countries = ['US'] self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club] self.homepage_url = 'http://www.linkpoint.com/' self.display_name = 'LinkPoint' def initialize(options = {}) requires!(options, :login) @options = { :result => 'LIVE', :pem => LinkpointGateway.pem_file }.update(options) raise ArgumentError, "You need to pass in your pem file using the :pem parameter or set it globally using ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) or similar" if @options[:pem].blank? end # Send a purchase request with periodic options # Recurring Options # :action => # SUBMIT # MODIFY # CANCEL # # :installments Identifies how many recurring payments to charge the customer # :startdate Date to begin charging the recurring payments. Format: YYYYMMDD or "immediate" # :periodicity => # :monthly # :bimonthly # :weekly # :biweekly # :yearly # :daily # :threshold Tells how many times to retry the transaction (if it fails) before contacting the merchant. # :comments Uh... comments # def recurring(money, creditcard, options={}) requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily], :installments, :order_id ) options.update( :ordertype => "SALE", :action => options[:action] || "SUBMIT", :installments => options[:installments] || 12, :startdate => options[:startdate] || "immediate", :periodicity => options[:periodicity].to_s || "monthly", :comments => options[:comments] || nil, :threshold => options[:threshold] || 3 ) commit(money, creditcard, options) end # Buy the thing def purchase(money, creditcard, options={}) requires!(options, :order_id) options.update( :ordertype => "SALE" ) commit(money, creditcard, options) end # # Authorize the transaction # # Reserves the funds on the customer's credit card, but does not charge the card. # def authorize(money, creditcard, options = {}) requires!(options, :order_id) options.update( :ordertype => "PREAUTH" ) commit(money, creditcard, options) end # # Post an authorization. # # Captures the funds from an authorized transaction. # Order_id must be a valid order id from a prior authorized transaction. # def capture(money, authorization, options = {}) options.update( :order_id => authorization, :ordertype => "POSTAUTH" ) commit(money, nil, options) end # Void a previous transaction def void(identification, options = {}) options.update( :order_id => identification, :ordertype => "VOID" ) commit(nil, nil, options) end # # Refund an order # # identification must be a valid order id previously submitted by SALE # def credit(money, identification, options = {}) options.update( :ordertype => "CREDIT", :order_id => identification ) commit(money, nil, options) end def test? @options[:test] || super end private # Commit the transaction by posting the XML file to the LinkPoint server def commit(money, creditcard, options = {}) response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, post_data(money, creditcard, options))) Response.new(successful?(response), response[:message], response, :test => test?, :authorization => response[:ordernum], :avs_result => { :code => response[:avs].to_s[2,1] }, :cvv_result => response[:avs].to_s[3,1] ) end def successful?(response) response[:approved] == "APPROVED" end # Build the XML file def post_data(money, creditcard, options) params = parameters(money, creditcard, options) xml = REXML::Document.new order = xml.add_element("order") # Merchant Info merchantinfo = order.add_element("merchantinfo") merchantinfo.add_element("configfile").text = @options[:login] # Loop over the params hash to construct the XML string for key, value in params elem = order.add_element(key.to_s) if key == :items build_items(elem, value) else for k, v in params[key] elem.add_element(k.to_s).text = params[key][k].to_s if params[key][k] end end # Linkpoint doesn't understand empty elements: order.delete(elem) if elem.size == 0 end return xml.to_s end # adds LinkPoint's Items entity to the XML. Called from post_data def build_items(element, items) for item in items item_element = element.add_element("item") for key, value in item if key == :options options_element = item_element.add_element("options") for option in value opt_element = options_element.add_element("option") opt_element.add_element("name").text = option[:name] unless option[:name].blank? opt_element.add_element("value").text = option[:value] unless option[:value].blank? end else item_element.add_element(key.to_s).text = item[key].to_s unless item[key].blank? end end end end # Set up the parameters hash just once so we don't have to do it # for every action. def parameters(money, creditcard, options = {}) params = { :payment => { :subtotal => amount(options[:subtotal]), :tax => amount(options[:tax]), :vattax => amount(options[:vattax]), :shipping => amount(options[:shipping]), :chargetotal => amount(money) }, :transactiondetails => { :transactionorigin => options[:transactionorigin] || "ECI", :oid => options[:order_id], :ponumber => options[:ponumber], :taxexempt => options[:taxexempt], :terminaltype => options[:terminaltype], :ip => options[:ip], :reference_number => options[:reference_number], :recurring => options[:recurring] || "NO", #DO NOT USE if you are using the periodic billing option. :tdate => options[:tdate] }, :orderoptions => { :ordertype => options[:ordertype], :result => @options[:result] }, :periodic => { :action => options[:action], :installments => options[:installments], :threshold => options[:threshold], :startdate => options[:startdate], :periodicity => options[:periodicity], :comments => options[:comments] }, :telecheck => { :routing => options[:telecheck_routing], :account => options[:telecheck_account], :checknumber => options[:telecheck_checknumber], :bankname => options[:telecheck_bankname], :dl => options[:telecheck_dl], :dlstate => options[:telecheck_dlstate], :void => options[:telecheck_void], :accounttype => options[:telecheck_accounttype], :ssn => options[:telecheck_ssn], } } if creditcard params[:creditcard] = { :cardnumber => creditcard.number, :cardexpmonth => creditcard.month, :cardexpyear => format_creditcard_expiry_year(creditcard.year), :track => nil } if creditcard.verification_value? params[:creditcard][:cvmvalue] = creditcard.verification_value params[:creditcard][:cvmindicator] = 'provided' else params[:creditcard][:cvmindicator] = 'not_provided' end end if billing_address = options[:billing_address] || options[:address] params[:billing] = {} params[:billing][:name] = billing_address[:name] || (creditcard ? creditcard.name : nil) params[:billing][:address1] = billing_address[:address1] unless billing_address[:address1].blank? params[:billing][:address2] = billing_address[:address2] unless billing_address[:address2].blank? params[:billing][:city] = billing_address[:city] unless billing_address[:city].blank? params[:billing][:state] = billing_address[:state] unless billing_address[:state].blank? params[:billing][:zip] = billing_address[:zip] unless billing_address[:zip].blank? params[:billing][:country] = billing_address[:country] unless billing_address[:country].blank? params[:billing][:company] = billing_address[:company] unless billing_address[:company].blank? params[:billing][:phone] = billing_address[:phone] unless billing_address[:phone].blank? params[:billing][:email] = options[:email] unless options[:email].blank? end if shipping_address = options[:shipping_address] params[:shipping] = {} params[:shipping][:name] = shipping_address[:name] || creditcard ? creditcard.name : nil params[:shipping][:address1] = shipping_address[:address1] unless shipping_address[:address1].blank? params[:shipping][:address2] = shipping_address[:address2] unless shipping_address[:address2].blank? params[:shipping][:city] = shipping_address[:city] unless shipping_address[:city].blank? params[:shipping][:state] = shipping_address[:state] unless shipping_address[:state].blank? params[:shipping][:zip] = shipping_address[:zip] unless shipping_address[:zip].blank? params[:shipping][:country] = shipping_address[:country] unless shipping_address[:country].blank? end params[:items] = options[:line_items] if options[:line_items] return params end def parse(xml) # For reference, a typical response... # <r_csp></r_csp> # <r_time></r_time> # <r_ref></r_ref> # <r_error></r_error> # <r_ordernum></r_ordernum> # <r_message>This is a test transaction and will not show up in the Reports</r_message> # <r_code></r_code> # <r_tdate>Thu Feb 2 15:40:21 2006</r_tdate> # <r_score></r_score> # <r_authresponse></r_authresponse> # <r_approved>APPROVED</r_approved> # <r_avs></r_avs> response = {:message => "Global Error Receipt", :complete => false} xml = REXML::Document.new("<response>#{xml}</response>") xml.root.elements.each do |node| response[node.name.downcase.sub(/^r_/, '').to_sym] = normalize(node.text) end unless xml.root.nil? response end # Make a ruby type out of the response string def normalize(field) case field when "true" then true when "false" then false when "" then nil when "null" then nil else field end end def format_creditcard_expiry_year(year) sprintf("%.4i", year)[-2..-1] end end end end
simplecircle/active_merchant
lib/active_merchant/billing/gateways/linkpoint.rb
Ruby
mit
17,797
/*! X-editable - v1.5.0 * In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery * http://github.com/vitalets/x-editable * Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */ /** Form with single input element, two buttons and two states: normal/loading. Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown. Editableform is linked with one of input types, e.g. 'text', 'select' etc. @class editableform @uses text @uses textarea **/ (function ($) { "use strict"; var EditableForm = function (div, options) { this.options = $.extend({}, $.fn.editableform.defaults, options); this.$div = $(div); //div, containing form. Not form tag. Not editable-element. if(!this.options.scope) { this.options.scope = this; } //nothing shown after init }; EditableForm.prototype = { constructor: EditableForm, initInput: function() { //called once //take input from options (as it is created in editable-element) this.input = this.options.input; //set initial value //todo: may be add check: typeof str === 'string' ? this.value = this.input.str2value(this.options.value); //prerender: get input.$input this.input.prerender(); }, initTemplate: function() { this.$form = $($.fn.editableform.template); }, initButtons: function() { var $btn = this.$form.find('.editable-buttons'); $btn.append($.fn.editableform.buttons); if(this.options.showbuttons === 'bottom') { $btn.addClass('editable-buttons-bottom'); } }, /** Renders editableform @method render **/ render: function() { //init loader this.$loading = $($.fn.editableform.loading); this.$div.empty().append(this.$loading); //init form template and buttons this.initTemplate(); if(this.options.showbuttons) { this.initButtons(); } else { this.$form.find('.editable-buttons').remove(); } //show loading state this.showLoading(); //flag showing is form now saving value to server. //It is needed to wait when closing form. this.isSaving = false; /** Fired when rendering starts @event rendering @param {Object} event event object **/ this.$div.triggerHandler('rendering'); //init input this.initInput(); //append input to form this.$form.find('div.editable-input').append(this.input.$tpl); //append form to container this.$div.append(this.$form); //render input $.when(this.input.render()) .then($.proxy(function () { //setup input to submit automatically when no buttons shown if(!this.options.showbuttons) { this.input.autosubmit(); } //attach 'cancel' handler this.$form.find('.editable-cancel').click($.proxy(this.cancel, this)); if(this.input.error) { this.error(this.input.error); this.$form.find('.editable-submit').attr('disabled', true); this.input.$input.attr('disabled', true); //prevent form from submitting this.$form.submit(function(e){ e.preventDefault(); }); } else { this.error(false); this.input.$input.removeAttr('disabled'); this.$form.find('.editable-submit').removeAttr('disabled'); var value = (this.value === null || this.value === undefined || this.value === '') ? this.options.defaultValue : this.value; this.input.value2input(value); //attach submit handler this.$form.submit($.proxy(this.submit, this)); } /** Fired when form is rendered @event rendered @param {Object} event event object **/ this.$div.triggerHandler('rendered'); this.showForm(); //call postrender method to perform actions required visibility of form if(this.input.postrender) { this.input.postrender(); } }, this)); }, cancel: function() { /** Fired when form was cancelled by user @event cancel @param {Object} event event object **/ this.$div.triggerHandler('cancel'); }, showLoading: function() { var w, h; if(this.$form) { //set loading size equal to form w = this.$form.outerWidth(); h = this.$form.outerHeight(); if(w) { this.$loading.width(w); } if(h) { this.$loading.height(h); } this.$form.hide(); } else { //stretch loading to fill container width w = this.$loading.parent().width(); if(w) { this.$loading.width(w); } } this.$loading.show(); }, showForm: function(activate) { this.$loading.hide(); this.$form.show(); if(activate !== false) { this.input.activate(); } /** Fired when form is shown @event show @param {Object} event event object **/ this.$div.triggerHandler('show'); }, error: function(msg) { var $group = this.$form.find('.control-group'), $block = this.$form.find('.editable-error-block'), lines; if(msg === false) { $group.removeClass($.fn.editableform.errorGroupClass); $block.removeClass($.fn.editableform.errorBlockClass).empty().hide(); } else { //convert newline to <br> for more pretty error display if(msg) { lines = msg.split("\n"); for (var i = 0; i < lines.length; i++) { lines[i] = $('<div>').text(lines[i]).html(); } msg = lines.join('<br>'); } $group.addClass($.fn.editableform.errorGroupClass); $block.addClass($.fn.editableform.errorBlockClass).html(msg).show(); } }, submit: function(e) { e.stopPropagation(); e.preventDefault(); var error, newValue = this.input.input2value(); //get new value from input //validation if (error = this.validate(newValue)) { this.error(error); this.showForm(); return; } //if value not changed --> trigger 'nochange' event and return /*jslint eqeq: true*/ if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) { /*jslint eqeq: false*/ /** Fired when value not changed but form is submitted. Requires savenochange = false. @event nochange @param {Object} event event object **/ this.$div.triggerHandler('nochange'); return; } //convert value for submitting to server var submitValue = this.input.value2submit(newValue); this.isSaving = true; //sending data to server $.when(this.save(submitValue)) .done($.proxy(function(response) { this.isSaving = false; //run success callback var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null; //if success callback returns false --> keep form open and do not activate input if(res === false) { this.error(false); this.showForm(false); return; } //if success callback returns string --> keep form open, show error and activate input if(typeof res === 'string') { this.error(res); this.showForm(); return; } //if success callback returns object like {newValue: <something>} --> use that value instead of submitted //it is usefull if you want to chnage value in url-function if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) { newValue = res.newValue; } //clear error message this.error(false); this.value = newValue; /** Fired when form is submitted @event save @param {Object} event event object @param {Object} params additional params @param {mixed} params.newValue raw new value @param {mixed} params.submitValue submitted value as string @param {Object} params.response ajax response @example $('#form-div').on('save'), function(e, params){ if(params.newValue === 'username') {...} }); **/ this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response}); }, this)) .fail($.proxy(function(xhr) { this.isSaving = false; var msg; if(typeof this.options.error === 'function') { msg = this.options.error.call(this.options.scope, xhr, newValue); } else { msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!'; } this.error(msg); this.showForm(); }, this)); }, save: function(submitValue) { //try parse composite pk defined as json string in data-pk this.options.pk = $.fn.editableutils.tryParseJson(this.options.pk, true); var pk = (typeof this.options.pk === 'function') ? this.options.pk.call(this.options.scope) : this.options.pk, /* send on server in following cases: 1. url is function 2. url is string AND (pk defined OR send option = always) */ send = !!(typeof this.options.url === 'function' || (this.options.url && ((this.options.send === 'always') || (this.options.send === 'auto' && pk !== null && pk !== undefined)))), params; if (send) { //send to server this.showLoading(); //standard params params = { name: this.options.name || '', value: submitValue, pk: pk }; //additional params if(typeof this.options.params === 'function') { params = this.options.params.call(this.options.scope, params); } else { //try parse json in single quotes (from data-params attribute) this.options.params = $.fn.editableutils.tryParseJson(this.options.params, true); $.extend(params, this.options.params); } if(typeof this.options.url === 'function') { //user's function return this.options.url.call(this.options.scope, params); } else { //send ajax to server and return deferred object return $.ajax($.extend({ url : this.options.url, data : params, type : 'POST' }, this.options.ajaxOptions)); } } }, validate: function (value) { if (value === undefined) { value = this.value; } if (typeof this.options.validate === 'function') { return this.options.validate.call(this.options.scope, value); } }, option: function(key, value) { if(key in this.options) { this.options[key] = value; } if(key === 'value') { this.setValue(value); } //do not pass option to input as it is passed in editable-element }, setValue: function(value, convertStr) { if(convertStr) { this.value = this.input.str2value(value); } else { this.value = value; } //if form is visible, update input if(this.$form && this.$form.is(':visible')) { this.input.value2input(this.value); } } }; /* Initialize editableform. Applied to jQuery object. @method $().editableform(options) @params {Object} options @example var $form = $('&lt;div&gt;').editableform({ type: 'text', name: 'username', url: '/post', value: 'vitaliy' }); //to display form you should call 'render' method $form.editableform('render'); */ $.fn.editableform = function (option) { var args = arguments; return this.each(function () { var $this = $(this), data = $this.data('editableform'), options = typeof option === 'object' && option; if (!data) { $this.data('editableform', (data = new EditableForm(this, options))); } if (typeof option === 'string') { //call method data[option].apply(data, Array.prototype.slice.call(args, 1)); } }); }; //keep link to constructor to allow inheritance $.fn.editableform.Constructor = EditableForm; //defaults $.fn.editableform.defaults = { /* see also defaults for input */ /** Type of input. Can be <code>text|textarea|select|date|checklist</code> @property type @type string @default 'text' **/ type: 'text', /** Url for submit, e.g. <code>'/post'</code> If function - it will be called instead of ajax. Function should return deferred object to run fail/done callbacks. @property url @type string|function @default null @example url: function(params) { var d = new $.Deferred; if(params.value === 'abc') { return d.reject('error message'); //returning error via deferred object } else { //async saving data in js model someModel.asyncSaveMethod({ ..., success: function(){ d.resolve(); } }); return d.promise(); } } **/ url:null, /** Additional params for submit. If defined as <code>object</code> - it is **appended** to original ajax data (pk, name and value). If defined as <code>function</code> - returned object **overwrites** original ajax data. @example params: function(params) { //originally params contain pk, name and value params.a = 1; return params; } @property params @type object|function @default null **/ params:null, /** Name of field. Will be submitted on server. Can be taken from <code>id</code> attribute @property name @type string @default null **/ name: null, /** Primary key of editable object (e.g. record id in database). For composite keys use object, e.g. <code>{id: 1, lang: 'en'}</code>. Can be calculated dynamically via function. @property pk @type string|object|function @default null **/ pk: null, /** Initial value. If not defined - will be taken from element's content. For __select__ type should be defined (as it is ID of shown text). @property value @type string|object @default null **/ value: null, /** Value that will be displayed in input if original field value is empty (`null|undefined|''`). @property defaultValue @type string|object @default null @since 1.4.6 **/ defaultValue: null, /** Strategy for sending data on server. Can be `auto|always|never`. When 'auto' data will be sent on server **only if pk and url defined**, otherwise new value will be stored locally. @property send @type string @default 'auto' **/ send: 'auto', /** Function for client-side validation. If returns string - means validation not passed and string showed as error. @property validate @type function @default null @example validate: function(value) { if($.trim(value) == '') { return 'This field is required'; } } **/ validate: null, /** Success callback. Called when value successfully sent on server and **response status = 200**. Usefull to work with json response. For example, if your backend response can be <code>{success: true}</code> or <code>{success: false, msg: "server error"}</code> you can check it inside this callback. If it returns **string** - means error occured and string is shown as error message. If it returns **object like** <code>{newValue: &lt;something&gt;}</code> - it overwrites value, submitted by user. Otherwise newValue simply rendered into element. @property success @type function @default null @example success: function(response, newValue) { if(!response.success) return response.msg; } **/ success: null, /** Error callback. Called when request failed (response status != 200). Usefull when you want to parse error response and display a custom message. Must return **string** - the message to be displayed in the error block. @property error @type function @default null @since 1.4.4 @example error: function(response, newValue) { if(response.status === 500) { return 'Service unavailable. Please try later.'; } else { return response.responseText; } } **/ error: null, /** Additional options for submit ajax request. List of values: http://api.jquery.com/jQuery.ajax @property ajaxOptions @type object @default null @since 1.1.1 @example ajaxOptions: { type: 'put', dataType: 'json' } **/ ajaxOptions: null, /** Where to show buttons: left(true)|bottom|false Form without buttons is auto-submitted. @property showbuttons @type boolean|string @default true @since 1.1.1 **/ showbuttons: true, /** Scope for callback methods (success, validate). If <code>null</code> means editableform instance itself. @property scope @type DOMElement|object @default null @since 1.2.0 @private **/ scope: null, /** Whether to save or cancel value when it was not changed but form was submitted @property savenochange @type boolean @default false @since 1.2.0 **/ savenochange: false }; /* Note: following params could redefined in engine: bootstrap or jqueryui: Classes 'control-group' and 'editable-error-block' must always present! */ $.fn.editableform.template = '<form class="form-inline editableform">'+ '<div class="control-group">' + '<div><div class="editable-input"></div><div class="editable-buttons"></div></div>'+ '<div class="editable-error-block"></div>' + '</div>' + '</form>'; //loading div $.fn.editableform.loading = '<div class="editableform-loading"></div>'; //buttons $.fn.editableform.buttons = '<button type="submit" class="editable-submit">ok</button>'+ '<button type="button" class="editable-cancel">cancel</button>'; //error class attached to control-group $.fn.editableform.errorGroupClass = null; //error class attached to editable-error-block $.fn.editableform.errorBlockClass = 'editable-error'; //engine $.fn.editableform.engine = 'jquery'; }(window.jQuery)); /** * EditableForm utilites */ (function ($) { "use strict"; //utils $.fn.editableutils = { /** * classic JS inheritance function */ inherit: function (Child, Parent) { var F = function() { }; F.prototype = Parent.prototype; Child.prototype = new F(); Child.prototype.constructor = Child; Child.superclass = Parent.prototype; }, /** * set caret position in input * see http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area */ setCursorPosition: function(elem, pos) { if (elem.setSelectionRange) { elem.setSelectionRange(pos, pos); } else if (elem.createTextRange) { var range = elem.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } }, /** * function to parse JSON in *single* quotes. (jquery automatically parse only double quotes) * That allows such code as: <a data-source="{'a': 'b', 'c': 'd'}"> * safe = true --> means no exception will be thrown * for details see http://stackoverflow.com/questions/7410348/how-to-set-json-format-to-html5-data-attributes-in-the-jquery */ tryParseJson: function(s, safe) { if (typeof s === 'string' && s.length && s.match(/^[\{\[].*[\}\]]$/)) { if (safe) { try { /*jslint evil: true*/ s = (new Function('return ' + s))(); /*jslint evil: false*/ } catch (e) {} finally { return s; } } else { /*jslint evil: true*/ s = (new Function('return ' + s))(); /*jslint evil: false*/ } } return s; }, /** * slice object by specified keys */ sliceObj: function(obj, keys, caseSensitive /* default: false */) { var key, keyLower, newObj = {}; if (!$.isArray(keys) || !keys.length) { return newObj; } for (var i = 0; i < keys.length; i++) { key = keys[i]; if (obj.hasOwnProperty(key)) { newObj[key] = obj[key]; } if(caseSensitive === true) { continue; } //when getting data-* attributes via $.data() it's converted to lowercase. //details: http://stackoverflow.com/questions/7602565/using-data-attributes-with-jquery //workaround is code below. keyLower = key.toLowerCase(); if (obj.hasOwnProperty(keyLower)) { newObj[key] = obj[keyLower]; } } return newObj; }, /* exclude complex objects from $.data() before pass to config */ getConfigData: function($element) { var data = {}; $.each($element.data(), function(k, v) { if(typeof v !== 'object' || (v && typeof v === 'object' && (v.constructor === Object || v.constructor === Array))) { data[k] = v; } }); return data; }, /* returns keys of object */ objectKeys: function(o) { if (Object.keys) { return Object.keys(o); } else { if (o !== Object(o)) { throw new TypeError('Object.keys called on a non-object'); } var k=[], p; for (p in o) { if (Object.prototype.hasOwnProperty.call(o,p)) { k.push(p); } } return k; } }, /** method to escape html. **/ escape: function(str) { return $('<div>').text(str).html(); }, /* returns array items from sourceData having value property equal or inArray of 'value' */ itemsByValue: function(value, sourceData, valueProp) { if(!sourceData || value === null) { return []; } if (typeof(valueProp) !== "function") { var idKey = valueProp || 'value'; valueProp = function (e) { return e[idKey]; }; } var isValArray = $.isArray(value), result = [], that = this; $.each(sourceData, function(i, o) { if(o.children) { result = result.concat(that.itemsByValue(value, o.children, valueProp)); } else { /*jslint eqeq: true*/ if(isValArray) { if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) { result.push(o); } } else { var itemValue = (o && (typeof o === 'object')) ? valueProp(o) : o; if(value == itemValue) { result.push(o); } } /*jslint eqeq: false*/ } }); return result; }, /* Returns input by options: type, mode. */ createInput: function(options) { var TypeConstructor, typeOptions, input, type = options.type; //`date` is some kind of virtual type that is transformed to one of exact types //depending on mode and core lib if(type === 'date') { //inline if(options.mode === 'inline') { if($.fn.editabletypes.datefield) { type = 'datefield'; } else if($.fn.editabletypes.dateuifield) { type = 'dateuifield'; } //popup } else { if($.fn.editabletypes.date) { type = 'date'; } else if($.fn.editabletypes.dateui) { type = 'dateui'; } } //if type still `date` and not exist in types, replace with `combodate` that is base input if(type === 'date' && !$.fn.editabletypes.date) { type = 'combodate'; } } //`datetime` should be datetimefield in 'inline' mode if(type === 'datetime' && options.mode === 'inline') { type = 'datetimefield'; } //change wysihtml5 to textarea for jquery UI and plain versions if(type === 'wysihtml5' && !$.fn.editabletypes[type]) { type = 'textarea'; } //create input of specified type. Input will be used for converting value, not in form if(typeof $.fn.editabletypes[type] === 'function') { TypeConstructor = $.fn.editabletypes[type]; typeOptions = this.sliceObj(options, this.objectKeys(TypeConstructor.defaults)); input = new TypeConstructor(typeOptions); return input; } else { $.error('Unknown type: '+ type); return false; } }, //see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr supportsTransitions: function () { var b = document.body || document.documentElement, s = b.style, p = 'transition', v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms']; if(typeof s[p] === 'string') { return true; } // Tests for vendor specific prop p = p.charAt(0).toUpperCase() + p.substr(1); for(var i=0; i<v.length; i++) { if(typeof s[v[i] + p] === 'string') { return true; } } return false; } }; }(window.jQuery)); /** Attaches stand-alone container with editable-form to HTML element. Element is used only for positioning, value is not stored anywhere.<br> This method applied internally in <code>$().editable()</code>. You should subscribe on it's events (save / cancel) to get profit of it.<br> Final realization can be different: bootstrap-popover, jqueryui-tooltip, poshytip, inline-div. It depends on which js file you include.<br> Applied as jQuery method. @class editableContainer @uses editableform **/ (function ($) { "use strict"; var Popup = function (element, options) { this.init(element, options); }; var Inline = function (element, options) { this.init(element, options); }; //methods Popup.prototype = { containerName: null, //method to call container on element containerDataName: null, //object name in element's .data() innerCss: null, //tbd in child class containerClass: 'editable-container editable-popup', //css class applied to container element defaults: {}, //container itself defaults init: function(element, options) { this.$element = $(element); //since 1.4.1 container do not use data-* directly as they already merged into options. this.options = $.extend({}, $.fn.editableContainer.defaults, options); this.splitOptions(); //set scope of form callbacks to element this.formOptions.scope = this.$element[0]; this.initContainer(); //flag to hide container, when saving value will finish this.delayedHide = false; //bind 'destroyed' listener to destroy container when element is removed from dom this.$element.on('destroyed', $.proxy(function(){ this.destroy(); }, this)); //attach document handler to close containers on click / escape if(!$(document).data('editable-handlers-attached')) { //close all on escape $(document).on('keyup.editable', function (e) { if (e.which === 27) { $('.editable-open').editableContainer('hide'); //todo: return focus on element } }); //close containers when click outside //(mousedown could be better than click, it closes everything also on drag drop) $(document).on('click.editable', function(e) { var $target = $(e.target), i, exclude_classes = ['.editable-container', '.ui-datepicker-header', '.datepicker', //in inline mode datepicker is rendered into body '.modal-backdrop', '.bootstrap-wysihtml5-insert-image-modal', '.bootstrap-wysihtml5-insert-link-modal' ]; //check if element is detached. It occurs when clicking in bootstrap datepicker if (!$.contains(document.documentElement, e.target)) { return; } //for some reason FF 20 generates extra event (click) in select2 widget with e.target = document //we need to filter it via construction below. See https://github.com/vitalets/x-editable/issues/199 //Possibly related to http://stackoverflow.com/questions/10119793/why-does-firefox-react-differently-from-webkit-and-ie-to-click-event-on-selec if($target.is(document)) { return; } //if click inside one of exclude classes --> no nothing for(i=0; i<exclude_classes.length; i++) { if($target.is(exclude_classes[i]) || $target.parents(exclude_classes[i]).length) { return; } } //close all open containers (except one - target) Popup.prototype.closeOthers(e.target); }); $(document).data('editable-handlers-attached', true); } }, //split options on containerOptions and formOptions splitOptions: function() { this.containerOptions = {}; this.formOptions = {}; if(!$.fn[this.containerName]) { throw new Error(this.containerName + ' not found. Have you included corresponding js file?'); } //keys defined in container defaults go to container, others go to form for(var k in this.options) { if(k in this.defaults) { this.containerOptions[k] = this.options[k]; } else { this.formOptions[k] = this.options[k]; } } }, /* Returns jquery object of container @method tip() */ tip: function() { return this.container() ? this.container().$tip : null; }, /* returns container object */ container: function() { var container; //first, try get it by `containerDataName` if(this.containerDataName) { if(container = this.$element.data(this.containerDataName)) { return container; } } //second, try `containerName` container = this.$element.data(this.containerName); return container; }, /* call native method of underlying container, e.g. this.$element.popover('method') */ call: function() { this.$element[this.containerName].apply(this.$element, arguments); }, initContainer: function(){ this.call(this.containerOptions); }, renderForm: function() { this.$form .editableform(this.formOptions) .on({ save: $.proxy(this.save, this), //click on submit button (value changed) nochange: $.proxy(function(){ this.hide('nochange'); }, this), //click on submit button (value NOT changed) cancel: $.proxy(function(){ this.hide('cancel'); }, this), //click on calcel button show: $.proxy(function() { if(this.delayedHide) { this.hide(this.delayedHide.reason); this.delayedHide = false; } else { this.setPosition(); } }, this), //re-position container every time form is shown (occurs each time after loading state) rendering: $.proxy(this.setPosition, this), //this allows to place container correctly when loading shown resize: $.proxy(this.setPosition, this), //this allows to re-position container when form size is changed rendered: $.proxy(function(){ /** Fired when container is shown and form is rendered (for select will wait for loading dropdown options). **Note:** Bootstrap popover has own `shown` event that now cannot be separated from x-editable's one. The workaround is to check `arguments.length` that is always `2` for x-editable. @event shown @param {Object} event event object @example $('#username').on('shown', function(e, editable) { editable.input.$input.val('overwriting value of input..'); }); **/ /* TODO: added second param mainly to distinguish from bootstrap's shown event. It's a hotfix that will be solved in future versions via namespaced events. */ this.$element.triggerHandler('shown', $(this.options.scope).data('editable')); }, this) }) .editableform('render'); }, /** Shows container with form @method show() @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true. **/ /* Note: poshytip owerwrites this method totally! */ show: function (closeAll) { this.$element.addClass('editable-open'); if(closeAll !== false) { //close all open containers (except this) this.closeOthers(this.$element[0]); } //show container itself this.innerShow(); this.tip().addClass(this.containerClass); /* Currently, form is re-rendered on every show. The main reason is that we dont know, what will container do with content when closed: remove(), detach() or just hide() - it depends on container. Detaching form itself before hide and re-insert before show is good solution, but visually it looks ugly --> container changes size before hide. */ //if form already exist - delete previous data if(this.$form) { //todo: destroy prev data! //this.$form.destroy(); } this.$form = $('<div>'); //insert form into container body if(this.tip().is(this.innerCss)) { //for inline container this.tip().append(this.$form); } else { this.tip().find(this.innerCss).append(this.$form); } //render form this.renderForm(); }, /** Hides container with form @method hide() @param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|undefined (=manual)</code> **/ hide: function(reason) { if(!this.tip() || !this.tip().is(':visible') || !this.$element.hasClass('editable-open')) { return; } //if form is saving value, schedule hide if(this.$form.data('editableform').isSaving) { this.delayedHide = {reason: reason}; return; } else { this.delayedHide = false; } this.$element.removeClass('editable-open'); this.innerHide(); /** Fired when container was hidden. It occurs on both save or cancel. **Note:** Bootstrap popover has own `hidden` event that now cannot be separated from x-editable's one. The workaround is to check `arguments.length` that is always `2` for x-editable. @event hidden @param {object} event event object @param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|manual</code> @example $('#username').on('hidden', function(e, reason) { if(reason === 'save' || reason === 'cancel') { //auto-open next editable $(this).closest('tr').next().find('.editable').editable('show'); } }); **/ this.$element.triggerHandler('hidden', reason || 'manual'); }, /* internal show method. To be overwritten in child classes */ innerShow: function () { }, /* internal hide method. To be overwritten in child classes */ innerHide: function () { }, /** Toggles container visibility (show / hide) @method toggle() @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true. **/ toggle: function(closeAll) { if(this.container() && this.tip() && this.tip().is(':visible')) { this.hide(); } else { this.show(closeAll); } }, /* Updates the position of container when content changed. @method setPosition() */ setPosition: function() { //tbd in child class }, save: function(e, params) { /** Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance @event save @param {Object} event event object @param {Object} params additional params @param {mixed} params.newValue submitted value @param {Object} params.response ajax response @example $('#username').on('save', function(e, params) { //assuming server response: '{success: true}' var pk = $(this).data('editableContainer').options.pk; if(params.response && params.response.success) { alert('value: ' + params.newValue + ' with pk: ' + pk + ' saved!'); } else { alert('error!'); } }); **/ this.$element.triggerHandler('save', params); //hide must be after trigger, as saving value may require methods of plugin, applied to input this.hide('save'); }, /** Sets new option @method option(key, value) @param {string} key @param {mixed} value **/ option: function(key, value) { this.options[key] = value; if(key in this.containerOptions) { this.containerOptions[key] = value; this.setContainerOption(key, value); } else { this.formOptions[key] = value; if(this.$form) { this.$form.editableform('option', key, value); } } }, setContainerOption: function(key, value) { this.call('option', key, value); }, /** Destroys the container instance @method destroy() **/ destroy: function() { this.hide(); this.innerDestroy(); this.$element.off('destroyed'); this.$element.removeData('editableContainer'); }, /* to be overwritten in child classes */ innerDestroy: function() { }, /* Closes other containers except one related to passed element. Other containers can be cancelled or submitted (depends on onblur option) */ closeOthers: function(element) { $('.editable-open').each(function(i, el){ //do nothing with passed element and it's children if(el === element || $(el).find(element).length) { return; } //otherwise cancel or submit all open containers var $el = $(el), ec = $el.data('editableContainer'); if(!ec) { return; } if(ec.options.onblur === 'cancel') { $el.data('editableContainer').hide('onblur'); } else if(ec.options.onblur === 'submit') { $el.data('editableContainer').tip().find('form').submit(); } }); }, /** Activates input of visible container (e.g. set focus) @method activate() **/ activate: function() { if(this.tip && this.tip().is(':visible') && this.$form) { this.$form.data('editableform').input.activate(); } } }; /** jQuery method to initialize editableContainer. @method $().editableContainer(options) @params {Object} options @example $('#edit').editableContainer({ type: 'text', url: '/post', pk: 1, value: 'hello' }); **/ $.fn.editableContainer = function (option) { var args = arguments; return this.each(function () { var $this = $(this), dataKey = 'editableContainer', data = $this.data(dataKey), options = typeof option === 'object' && option, Constructor = (options.mode === 'inline') ? Inline : Popup; if (!data) { $this.data(dataKey, (data = new Constructor(this, options))); } if (typeof option === 'string') { //call method data[option].apply(data, Array.prototype.slice.call(args, 1)); } }); }; //store constructors $.fn.editableContainer.Popup = Popup; $.fn.editableContainer.Inline = Inline; //defaults $.fn.editableContainer.defaults = { /** Initial value of form input @property value @type mixed @default null @private **/ value: null, /** Placement of container relative to element. Can be <code>top|right|bottom|left</code>. Not used for inline container. @property placement @type string @default 'top' **/ placement: 'top', /** Whether to hide container on save/cancel. @property autohide @type boolean @default true @private **/ autohide: true, /** Action when user clicks outside the container. Can be <code>cancel|submit|ignore</code>. Setting <code>ignore</code> allows to have several containers open. @property onblur @type string @default 'cancel' @since 1.1.1 **/ onblur: 'cancel', /** Animation speed (inline mode only) @property anim @type string @default false **/ anim: false, /** Mode of editable, can be `popup` or `inline` @property mode @type string @default 'popup' @since 1.4.0 **/ mode: 'popup' }; /* * workaround to have 'destroyed' event to destroy popover when element is destroyed * see http://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom */ jQuery.event.special.destroyed = { remove: function(o) { if (o.handler) { o.handler(); } } }; }(window.jQuery)); /** * Editable Inline * --------------------- */ (function ($) { "use strict"; //copy prototype from EditableContainer //extend methods $.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, { containerName: 'editableform', innerCss: '.editable-inline', containerClass: 'editable-container editable-inline', //css class applied to container element initContainer: function(){ //container is <span> element this.$tip = $('<span></span>'); //convert anim to miliseconds (int) if(!this.options.anim) { this.options.anim = 0; } }, splitOptions: function() { //all options are passed to form this.containerOptions = {}; this.formOptions = this.options; }, tip: function() { return this.$tip; }, innerShow: function () { this.$element.hide(); this.tip().insertAfter(this.$element).show(); }, innerHide: function () { this.$tip.hide(this.options.anim, $.proxy(function() { this.$element.show(); this.innerDestroy(); }, this)); }, innerDestroy: function() { if(this.tip()) { this.tip().empty().remove(); } } }); }(window.jQuery)); /** Makes editable any HTML element on the page. Applied as jQuery method. @class editable @uses editableContainer **/ (function ($) { "use strict"; var Editable = function (element, options) { this.$element = $(element); //data-* has more priority over js options: because dynamically created elements may change data-* this.options = $.extend({}, $.fn.editable.defaults, options, $.fn.editableutils.getConfigData(this.$element)); if(this.options.selector) { this.initLive(); } else { this.init(); } //check for transition support if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) { this.options.highlight = false; } }; Editable.prototype = { constructor: Editable, init: function () { var isValueByText = false, doAutotext, finalize; //name this.options.name = this.options.name || this.$element.attr('id'); //create input of specified type. Input needed already here to convert value for initial display (e.g. show text by id for select) //also we set scope option to have access to element inside input specific callbacks (e. g. source as function) this.options.scope = this.$element[0]; this.input = $.fn.editableutils.createInput(this.options); if(!this.input) { return; } //set value from settings or by element's text if (this.options.value === undefined || this.options.value === null) { this.value = this.input.html2value($.trim(this.$element.html())); isValueByText = true; } else { /* value can be string when received from 'data-value' attribute for complext objects value can be set as json string in data-value attribute, e.g. data-value="{city: 'Moscow', street: 'Lenina'}" */ this.options.value = $.fn.editableutils.tryParseJson(this.options.value, true); if(typeof this.options.value === 'string') { this.value = this.input.str2value(this.options.value); } else { this.value = this.options.value; } } //add 'editable' class to every editable element this.$element.addClass('editable'); //specifically for "textarea" add class .editable-pre-wrapped to keep linebreaks if(this.input.type === 'textarea') { this.$element.addClass('editable-pre-wrapped'); } //attach handler activating editable. In disabled mode it just prevent default action (useful for links) if(this.options.toggle !== 'manual') { this.$element.addClass('editable-click'); this.$element.on(this.options.toggle + '.editable', $.proxy(function(e){ //prevent following link if editable enabled if(!this.options.disabled) { e.preventDefault(); } //stop propagation not required because in document click handler it checks event target //e.stopPropagation(); if(this.options.toggle === 'mouseenter') { //for hover only show container this.show(); } else { //when toggle='click' we should not close all other containers as they will be closed automatically in document click listener var closeAll = (this.options.toggle !== 'click'); this.toggle(closeAll); } }, this)); } else { this.$element.attr('tabindex', -1); //do not stop focus on element when toggled manually } //if display is function it's far more convinient to have autotext = always to render correctly on init //see https://github.com/vitalets/x-editable-yii/issues/34 if(typeof this.options.display === 'function') { this.options.autotext = 'always'; } //check conditions for autotext: switch(this.options.autotext) { case 'always': doAutotext = true; break; case 'auto': //if element text is empty and value is defined and value not generated by text --> run autotext doAutotext = !$.trim(this.$element.text()).length && this.value !== null && this.value !== undefined && !isValueByText; break; default: doAutotext = false; } //depending on autotext run render() or just finilize init $.when(doAutotext ? this.render() : true).then($.proxy(function() { if(this.options.disabled) { this.disable(); } else { this.enable(); } /** Fired when element was initialized by `$().editable()` method. Please note that you should setup `init` handler **before** applying `editable`. @event init @param {Object} event event object @param {Object} editable editable instance (as here it cannot accessed via data('editable')) @since 1.2.0 @example $('#username').on('init', function(e, editable) { alert('initialized ' + editable.options.name); }); $('#username').editable(); **/ this.$element.triggerHandler('init', this); }, this)); }, /* Initializes parent element for live editables */ initLive: function() { //store selector var selector = this.options.selector; //modify options for child elements this.options.selector = false; this.options.autotext = 'never'; //listen toggle events this.$element.on(this.options.toggle + '.editable', selector, $.proxy(function(e){ var $target = $(e.target); if(!$target.data('editable')) { //if delegated element initially empty, we need to clear it's text (that was manually set to `empty` by user) //see https://github.com/vitalets/x-editable/issues/137 if($target.hasClass(this.options.emptyclass)) { $target.empty(); } $target.editable(this.options).trigger(e); } }, this)); }, /* Renders value into element's text. Can call custom display method from options. Can return deferred object. @method render() @param {mixed} response server response (if exist) to pass into display function */ render: function(response) { //do not display anything if(this.options.display === false) { return; } //if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded if(this.input.value2htmlFinal) { return this.input.value2html(this.value, this.$element[0], this.options.display, response); //if display method defined --> use it } else if(typeof this.options.display === 'function') { return this.options.display.call(this.$element[0], this.value, response); //else use input's original value2html() method } else { return this.input.value2html(this.value, this.$element[0]); } }, /** Enables editable @method enable() **/ enable: function() { this.options.disabled = false; this.$element.removeClass('editable-disabled'); this.handleEmpty(this.isEmpty); if(this.options.toggle !== 'manual') { if(this.$element.attr('tabindex') === '-1') { this.$element.removeAttr('tabindex'); } } }, /** Disables editable @method disable() **/ disable: function() { this.options.disabled = true; this.hide(); this.$element.addClass('editable-disabled'); this.handleEmpty(this.isEmpty); //do not stop focus on this element this.$element.attr('tabindex', -1); }, /** Toggles enabled / disabled state of editable element @method toggleDisabled() **/ toggleDisabled: function() { if(this.options.disabled) { this.enable(); } else { this.disable(); } }, /** Sets new option @method option(key, value) @param {string|object} key option name or object with several options @param {mixed} value option new value @example $('.editable').editable('option', 'pk', 2); **/ option: function(key, value) { //set option(s) by object if(key && typeof key === 'object') { $.each(key, $.proxy(function(k, v){ this.option($.trim(k), v); }, this)); return; } //set option by string this.options[key] = value; //disabled if(key === 'disabled') { return value ? this.disable() : this.enable(); } //value if(key === 'value') { this.setValue(value); } //transfer new option to container! if(this.container) { this.container.option(key, value); } //pass option to input directly (as it points to the same in form) if(this.input.option) { this.input.option(key, value); } }, /* * set emptytext if element is empty */ handleEmpty: function (isEmpty) { //do not handle empty if we do not display anything if(this.options.display === false) { return; } /* isEmpty may be set directly as param of method. It is required when we enable/disable field and can't rely on content as node content is text: "Empty" that is not empty %) */ if(isEmpty !== undefined) { this.isEmpty = isEmpty; } else { //detect empty //for some inputs we need more smart check //e.g. wysihtml5 may have <br>, <p></p>, <img> if(typeof(this.input.isEmpty) === 'function') { this.isEmpty = this.input.isEmpty(this.$element); } else { this.isEmpty = $.trim(this.$element.html()) === ''; } } //emptytext shown only for enabled if(!this.options.disabled) { if (this.isEmpty) { this.$element.html(this.options.emptytext); if(this.options.emptyclass) { this.$element.addClass(this.options.emptyclass); } } else if(this.options.emptyclass) { this.$element.removeClass(this.options.emptyclass); } } else { //below required if element disable property was changed if(this.isEmpty) { this.$element.empty(); if(this.options.emptyclass) { this.$element.removeClass(this.options.emptyclass); } } } }, /** Shows container with form @method show() @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true. **/ show: function (closeAll) { if(this.options.disabled) { return; } //init editableContainer: popover, tooltip, inline, etc.. if(!this.container) { var containerOptions = $.extend({}, this.options, { value: this.value, input: this.input //pass input to form (as it is already created) }); this.$element.editableContainer(containerOptions); //listen `save` event this.$element.on("save.internal", $.proxy(this.save, this)); this.container = this.$element.data('editableContainer'); } else if(this.container.tip().is(':visible')) { return; } //show container this.container.show(closeAll); }, /** Hides container with form @method hide() **/ hide: function () { if(this.container) { this.container.hide(); } }, /** Toggles container visibility (show / hide) @method toggle() @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true. **/ toggle: function(closeAll) { if(this.container && this.container.tip().is(':visible')) { this.hide(); } else { this.show(closeAll); } }, /* * called when form was submitted */ save: function(e, params) { //mark element with unsaved class if needed if(this.options.unsavedclass) { /* Add unsaved css to element if: - url is not user's function - value was not sent to server - params.response === undefined, that means data was not sent - value changed */ var sent = false; sent = sent || typeof this.options.url === 'function'; sent = sent || this.options.display === false; sent = sent || params.response !== undefined; sent = sent || (this.options.savenochange && this.input.value2str(this.value) !== this.input.value2str(params.newValue)); if(sent) { this.$element.removeClass(this.options.unsavedclass); } else { this.$element.addClass(this.options.unsavedclass); } } //highlight when saving if(this.options.highlight) { var $e = this.$element, bgColor = $e.css('background-color'); $e.css('background-color', this.options.highlight); setTimeout(function(){ if(bgColor === 'transparent') { bgColor = ''; } $e.css('background-color', bgColor); $e.addClass('editable-bg-transition'); setTimeout(function(){ $e.removeClass('editable-bg-transition'); }, 1700); }, 10); } //set new value this.setValue(params.newValue, false, params.response); /** Fired when new value was submitted. You can use <code>$(this).data('editable')</code> to access to editable instance @event save @param {Object} event event object @param {Object} params additional params @param {mixed} params.newValue submitted value @param {Object} params.response ajax response @example $('#username').on('save', function(e, params) { alert('Saved value: ' + params.newValue); }); **/ //event itself is triggered by editableContainer. Description here is only for documentation }, validate: function () { if (typeof this.options.validate === 'function') { return this.options.validate.call(this, this.value); } }, /** Sets new value of editable @method setValue(value, convertStr) @param {mixed} value new value @param {boolean} convertStr whether to convert value from string to internal format **/ setValue: function(value, convertStr, response) { if(convertStr) { this.value = this.input.str2value(value); } else { this.value = value; } if(this.container) { this.container.option('value', this.value); } $.when(this.render(response)) .then($.proxy(function() { this.handleEmpty(); }, this)); }, /** Activates input of visible container (e.g. set focus) @method activate() **/ activate: function() { if(this.container) { this.container.activate(); } }, /** Removes editable feature from element @method destroy() **/ destroy: function() { this.disable(); if(this.container) { this.container.destroy(); } this.input.destroy(); if(this.options.toggle !== 'manual') { this.$element.removeClass('editable-click'); this.$element.off(this.options.toggle + '.editable'); } this.$element.off("save.internal"); this.$element.removeClass('editable editable-open editable-disabled'); this.$element.removeData('editable'); } }; /* EDITABLE PLUGIN DEFINITION * ======================= */ /** jQuery method to initialize editable element. @method $().editable(options) @params {Object} options @example $('#username').editable({ type: 'text', url: '/post', pk: 1 }); **/ $.fn.editable = function (option) { //special API methods returning non-jquery object var result = {}, args = arguments, datakey = 'editable'; switch (option) { /** Runs client-side validation for all matched editables @method validate() @returns {Object} validation errors map @example $('#username, #fullname').editable('validate'); // possible result: { username: "username is required", fullname: "fullname should be minimum 3 letters length" } **/ case 'validate': this.each(function () { var $this = $(this), data = $this.data(datakey), error; if (data && (error = data.validate())) { result[data.options.name] = error; } }); return result; /** Returns current values of editable elements. Note that it returns an **object** with name-value pairs, not a value itself. It allows to get data from several elements. If value of some editable is `null` or `undefined` it is excluded from result object. When param `isSingle` is set to **true** - it is supposed you have single element and will return value of editable instead of object. @method getValue() @param {bool} isSingle whether to return just value of single element @returns {Object} object of element names and values @example $('#username, #fullname').editable('getValue'); //result: { username: "superuser", fullname: "John" } //isSingle = true $('#username').editable('getValue', true); //result "superuser" **/ case 'getValue': if(arguments.length === 2 && arguments[1] === true) { //isSingle = true result = this.eq(0).data(datakey).value; } else { this.each(function () { var $this = $(this), data = $this.data(datakey); if (data && data.value !== undefined && data.value !== null) { result[data.options.name] = data.input.value2submit(data.value); } }); } return result; /** This method collects values from several editable elements and submit them all to server. Internally it runs client-side validation for all fields and submits only in case of success. See <a href="#newrecord">creating new records</a> for details. @method submit(options) @param {object} options @param {object} options.url url to submit data @param {object} options.data additional data to submit @param {object} options.ajaxOptions additional ajax options @param {function} options.error(obj) error handler @param {function} options.success(obj,config) success handler @returns {Object} jQuery object **/ case 'submit': //collects value, validate and submit to server for creating new record var config = arguments[1] || {}, $elems = this, errors = this.editable('validate'), values; if($.isEmptyObject(errors)) { values = this.editable('getValue'); if(config.data) { $.extend(values, config.data); } $.ajax($.extend({ url: config.url, data: values, type: 'POST' }, config.ajaxOptions)) .success(function(response) { //successful response 200 OK if(typeof config.success === 'function') { config.success.call($elems, response, config); } }) .error(function(){ //ajax error if(typeof config.error === 'function') { config.error.apply($elems, arguments); } }); } else { //client-side validation error if(typeof config.error === 'function') { config.error.call($elems, errors); } } return this; } //return jquery object return this.each(function () { var $this = $(this), data = $this.data(datakey), options = typeof option === 'object' && option; //for delegated targets do not store `editable` object for element //it's allows several different selectors. //see: https://github.com/vitalets/x-editable/issues/312 if(options && options.selector) { data = new Editable(this, options); return; } if (!data) { $this.data(datakey, (data = new Editable(this, options))); } if (typeof option === 'string') { //call method data[option].apply(data, Array.prototype.slice.call(args, 1)); } }); }; $.fn.editable.defaults = { /** Type of input. Can be <code>text|textarea|select|date|checklist</code> and more @property type @type string @default 'text' **/ type: 'text', /** Sets disabled state of editable @property disabled @type boolean @default false **/ disabled: false, /** How to toggle editable. Can be <code>click|dblclick|mouseenter|manual</code>. When set to <code>manual</code> you should manually call <code>show/hide</code> methods of editable. **Note**: if you call <code>show</code> or <code>toggle</code> inside **click** handler of some DOM element, you need to apply <code>e.stopPropagation()</code> because containers are being closed on any click on document. @example $('#edit-button').click(function(e) { e.stopPropagation(); $('#username').editable('toggle'); }); @property toggle @type string @default 'click' **/ toggle: 'click', /** Text shown when element is empty. @property emptytext @type string @default 'Empty' **/ emptytext: 'Empty', /** Allows to automatically set element's text based on it's value. Can be <code>auto|always|never</code>. Useful for select and date. For example, if dropdown list is <code>{1: 'a', 2: 'b'}</code> and element's value set to <code>1</code>, it's html will be automatically set to <code>'a'</code>. <code>auto</code> - text will be automatically set only if element is empty. <code>always|never</code> - always(never) try to set element's text. @property autotext @type string @default 'auto' **/ autotext: 'auto', /** Initial value of input. If not set, taken from element's text. Note, that if element's text is empty - text is automatically generated from value and can be customized (see `autotext` option). For example, to display currency sign: @example <a id="price" data-type="text" data-value="100"></a> <script> $('#price').editable({ ... display: function(value) { $(this).text(value + '$'); } }) </script> @property value @type mixed @default element's text **/ value: null, /** Callback to perform custom displaying of value in element's text. If `null`, default input's display used. If `false`, no displaying methods will be called, element's text will never change. Runs under element's scope. _**Parameters:**_ * `value` current value to be displayed * `response` server response (if display called after ajax submit), since 1.4.0 For _inputs with source_ (select, checklist) parameters are different: * `value` current value to be displayed * `sourceData` array of items for current input (e.g. dropdown items) * `response` server response (if display called after ajax submit), since 1.4.0 To get currently selected items use `$.fn.editableutils.itemsByValue(value, sourceData)`. @property display @type function|boolean @default null @since 1.2.0 @example display: function(value, sourceData) { //display checklist as comma-separated values var html = [], checked = $.fn.editableutils.itemsByValue(value, sourceData); if(checked.length) { $.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); }); $(this).html(html.join(', ')); } else { $(this).empty(); } } **/ display: null, /** Css class applied when editable text is empty. @property emptyclass @type string @since 1.4.1 @default editable-empty **/ emptyclass: 'editable-empty', /** Css class applied when value was stored but not sent to server (`pk` is empty or `send = 'never'`). You may set it to `null` if you work with editables locally and submit them together. @property unsavedclass @type string @since 1.4.1 @default editable-unsaved **/ unsavedclass: 'editable-unsaved', /** If selector is provided, editable will be delegated to the specified targets. Usefull for dynamically generated DOM elements. **Please note**, that delegated targets can't be initialized with `emptytext` and `autotext` options, as they actually become editable only after first click. You should manually set class `editable-click` to these elements. Also, if element originally empty you should add class `editable-empty`, set `data-value=""` and write emptytext into element: @property selector @type string @since 1.4.1 @default null @example <div id="user"> <!-- empty --> <a href="#" data-name="username" data-type="text" class="editable-click editable-empty" data-value="" title="Username">Empty</a> <!-- non-empty --> <a href="#" data-name="group" data-type="select" data-source="/groups" data-value="1" class="editable-click" title="Group">Operator</a> </div> <script> $('#user').editable({ selector: 'a', url: '/post', pk: 1 }); </script> **/ selector: null, /** Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers. @property highlight @type string|boolean @since 1.4.5 @default #FFFF80 **/ highlight: '#FFFF80' }; }(window.jQuery)); /** AbstractInput - base class for all editable inputs. It defines interface to be implemented by any input type. To create your own input you can inherit from this class. @class abstractinput **/ (function ($) { "use strict"; //types $.fn.editabletypes = {}; var AbstractInput = function () { }; AbstractInput.prototype = { /** Initializes input @method init() **/ init: function(type, options, defaults) { this.type = type; this.options = $.extend({}, defaults, options); }, /* this method called before render to init $tpl that is inserted in DOM */ prerender: function() { this.$tpl = $(this.options.tpl); //whole tpl as jquery object this.$input = this.$tpl; //control itself, can be changed in render method this.$clear = null; //clear button this.error = null; //error message, if input cannot be rendered }, /** Renders input from tpl. Can return jQuery deferred object. Can be overwritten in child objects @method render() **/ render: function() { }, /** Sets element's html by value. @method value2html(value, element) @param {mixed} value @param {DOMElement} element **/ value2html: function(value, element) { $(element)[this.options.escape ? 'text' : 'html']($.trim(value)); }, /** Converts element's html to value @method html2value(html) @param {string} html @returns {mixed} **/ html2value: function(html) { return $('<div>').html(html).text(); }, /** Converts value to string (for internal compare). For submitting to server used value2submit(). @method value2str(value) @param {mixed} value @returns {string} **/ value2str: function(value) { return value; }, /** Converts string received from server into value. Usually from `data-value` attribute. @method str2value(str) @param {string} str @returns {mixed} **/ str2value: function(str) { return str; }, /** Converts value for submitting to server. Result can be string or object. @method value2submit(value) @param {mixed} value @returns {mixed} **/ value2submit: function(value) { return value; }, /** Sets value of input. @method value2input(value) @param {mixed} value **/ value2input: function(value) { this.$input.val(value); }, /** Returns value of input. Value can be object (e.g. datepicker) @method input2value() **/ input2value: function() { return this.$input.val(); }, /** Activates input. For text it sets focus. @method activate() **/ activate: function() { if(this.$input.is(':visible')) { this.$input.focus(); } }, /** Creates input. @method clear() **/ clear: function() { this.$input.val(null); }, /** method to escape html. **/ escape: function(str) { return $('<div>').text(str).html(); }, /** attach handler to automatically submit form when value changed (useful when buttons not shown) **/ autosubmit: function() { }, /** Additional actions when destroying element **/ destroy: function() { }, // -------- helper functions -------- setClass: function() { if(this.options.inputclass) { this.$input.addClass(this.options.inputclass); } }, setAttr: function(attr) { if (this.options[attr] !== undefined && this.options[attr] !== null) { this.$input.attr(attr, this.options[attr]); } }, option: function(key, value) { this.options[key] = value; } }; AbstractInput.defaults = { /** HTML template of input. Normally you should not change it. @property tpl @type string @default '' **/ tpl: '', /** CSS class automatically applied to input @property inputclass @type string @default null **/ inputclass: null, /** If `true` - html will be escaped in content of element via $.text() method. If `false` - html will not be escaped, $.html() used. When you use own `display` function, this option obviosly has no effect. @property escape @type boolean @since 1.5.0 @default true **/ escape: true, //scope for external methods (e.g. source defined as function) //for internal use only scope: null, //need to re-declare showbuttons here to get it's value from common config (passed only options existing in defaults) showbuttons: true }; $.extend($.fn.editabletypes, {abstractinput: AbstractInput}); }(window.jQuery)); /** List - abstract class for inputs that have source option loaded from js array or via ajax @class list @extends abstractinput **/ (function ($) { "use strict"; var List = function (options) { }; $.fn.editableutils.inherit(List, $.fn.editabletypes.abstractinput); $.extend(List.prototype, { render: function () { var deferred = $.Deferred(); this.error = null; this.onSourceReady(function () { this.renderList(); deferred.resolve(); }, function () { this.error = this.options.sourceError; deferred.resolve(); }); return deferred.promise(); }, html2value: function (html) { return null; //can't set value by text }, value2html: function (value, element, display, response) { var deferred = $.Deferred(), success = function () { if(typeof display === 'function') { //custom display method display.call(element, value, this.sourceData, response); } else { this.value2htmlFinal(value, element); } deferred.resolve(); }; //for null value just call success without loading source if(value === null) { success.call(this); } else { this.onSourceReady(success, function () { deferred.resolve(); }); } return deferred.promise(); }, // ------------- additional functions ------------ onSourceReady: function (success, error) { //run source if it function var source; if ($.isFunction(this.options.source)) { source = this.options.source.call(this.options.scope); this.sourceData = null; //note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed } else { source = this.options.source; } //if allready loaded just call success if(this.options.sourceCache && $.isArray(this.sourceData)) { success.call(this); return; } //try parse json in single quotes (for double quotes jquery does automatically) try { source = $.fn.editableutils.tryParseJson(source, false); } catch (e) { error.call(this); return; } //loading from url if (typeof source === 'string') { //try to get sourceData from cache if(this.options.sourceCache) { var cacheID = source, cache; if (!$(document).data(cacheID)) { $(document).data(cacheID, {}); } cache = $(document).data(cacheID); //check for cached data if (cache.loading === false && cache.sourceData) { //take source from cache this.sourceData = cache.sourceData; this.doPrepend(); success.call(this); return; } else if (cache.loading === true) { //cache is loading, put callback in stack to be called later cache.callbacks.push($.proxy(function () { this.sourceData = cache.sourceData; this.doPrepend(); success.call(this); }, this)); //also collecting error callbacks cache.err_callbacks.push($.proxy(error, this)); return; } else { //no cache yet, activate it cache.loading = true; cache.callbacks = []; cache.err_callbacks = []; } } //ajaxOptions for source. Can be overwritten bt options.sourceOptions var ajaxOptions = $.extend({ url: source, type: 'get', cache: false, dataType: 'json', success: $.proxy(function (data) { if(cache) { cache.loading = false; } this.sourceData = this.makeArray(data); if($.isArray(this.sourceData)) { if(cache) { //store result in cache cache.sourceData = this.sourceData; //run success callbacks for other fields waiting for this source $.each(cache.callbacks, function () { this.call(); }); } this.doPrepend(); success.call(this); } else { error.call(this); if(cache) { //run error callbacks for other fields waiting for this source $.each(cache.err_callbacks, function () { this.call(); }); } } }, this), error: $.proxy(function () { error.call(this); if(cache) { cache.loading = false; //run error callbacks for other fields $.each(cache.err_callbacks, function () { this.call(); }); } }, this) }, this.options.sourceOptions); //loading sourceData from server $.ajax(ajaxOptions); } else { //options as json/array this.sourceData = this.makeArray(source); if($.isArray(this.sourceData)) { this.doPrepend(); success.call(this); } else { error.call(this); } } }, doPrepend: function () { if(this.options.prepend === null || this.options.prepend === undefined) { return; } if(!$.isArray(this.prependData)) { //run prepend if it is function (once) if ($.isFunction(this.options.prepend)) { this.options.prepend = this.options.prepend.call(this.options.scope); } //try parse json in single quotes this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true); //convert prepend from string to object if (typeof this.options.prepend === 'string') { this.options.prepend = {'': this.options.prepend}; } this.prependData = this.makeArray(this.options.prepend); } if($.isArray(this.prependData) && $.isArray(this.sourceData)) { this.sourceData = this.prependData.concat(this.sourceData); } }, /* renders input list */ renderList: function() { // this method should be overwritten in child class }, /* set element's html by value */ value2htmlFinal: function(value, element) { // this method should be overwritten in child class }, /** * convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}] */ makeArray: function(data) { var count, obj, result = [], item, iterateItem; if(!data || typeof data === 'string') { return null; } if($.isArray(data)) { //array /* function to iterate inside item of array if item is object. Caclulates count of keys in item and store in obj. */ iterateItem = function (k, v) { obj = {value: k, text: v}; if(count++ >= 2) { return false;// exit from `each` if item has more than one key. } }; for(var i = 0; i < data.length; i++) { item = data[i]; if(typeof item === 'object') { count = 0; //count of keys inside item $.each(item, iterateItem); //case: [{val1: 'text1'}, {val2: 'text2} ...] if(count === 1) { result.push(obj); //case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...] } else if(count > 1) { //removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text') if(item.children) { item.children = this.makeArray(item.children); } result.push(item); } } else { //case: ['text1', 'text2' ...] result.push({value: item, text: item}); } } } else { //case: {val1: 'text1', val2: 'text2, ...} $.each(data, function (k, v) { result.push({value: k, text: v}); }); } return result; }, option: function(key, value) { this.options[key] = value; if(key === 'source') { this.sourceData = null; } if(key === 'prepend') { this.prependData = null; } } }); List.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** Source data for list. If **array** - it should be in format: `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]` For compability, object format is also supported: `{"1": "text1", "2": "text2" ...}` but it does not guarantee elements order. If **string** - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also `sourceCache` option. If **function**, it should return data in format above (since 1.4.0). Since 1.4.1 key `children` supported to render OPTGROUP (for **select** input only). `[{text: "group1", children: [{value: 1, text: "text1"}, {value: 2, text: "text2"}]}, ...]` @property source @type string | array | object | function @default null **/ source: null, /** Data automatically prepended to the beginning of dropdown list. @property prepend @type string | array | object | function @default false **/ prepend: false, /** Error message when list cannot be loaded (e.g. ajax error) @property sourceError @type string @default Error when loading list **/ sourceError: 'Error when loading list', /** if <code>true</code> and source is **string url** - results will be cached for fields with the same source. Usefull for editable column in grid to prevent extra requests. @property sourceCache @type boolean @default true @since 1.2.0 **/ sourceCache: true, /** Additional ajax options to be used in $.ajax() when loading list from server. Useful to send extra parameters (`data` key) or change request method (`type` key). @property sourceOptions @type object|function @default null @since 1.5.0 **/ sourceOptions: null }); $.fn.editabletypes.list = List; }(window.jQuery)); /** Text input @class text @extends abstractinput @final @example <a href="#" id="username" data-type="text" data-pk="1">awesome</a> <script> $(function(){ $('#username').editable({ url: '/post', title: 'Enter username' }); }); </script> **/ (function ($) { "use strict"; var Text = function (options) { this.init('text', options, Text.defaults); }; $.fn.editableutils.inherit(Text, $.fn.editabletypes.abstractinput); $.extend(Text.prototype, { render: function() { this.renderClear(); this.setClass(); this.setAttr('placeholder'); }, activate: function() { if(this.$input.is(':visible')) { this.$input.focus(); $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length); if(this.toggleClear) { this.toggleClear(); } } }, //render clear button renderClear: function() { if (this.options.clear) { this.$clear = $('<span class="editable-clear-x"></span>'); this.$input.after(this.$clear) .css('padding-right', 24) .keyup($.proxy(function(e) { //arrows, enter, tab, etc if(~$.inArray(e.keyCode, [40,38,9,13,27])) { return; } clearTimeout(this.t); var that = this; this.t = setTimeout(function() { that.toggleClear(e); }, 100); }, this)) .parent().css('position', 'relative'); this.$clear.click($.proxy(this.clear, this)); } }, postrender: function() { /* //now `clear` is positioned via css if(this.$clear) { //can position clear button only here, when form is shown and height can be calculated // var h = this.$input.outerHeight(true) || 20, var h = this.$clear.parent().height(), delta = (h - this.$clear.height()) / 2; //this.$clear.css({bottom: delta, right: delta}); } */ }, //show / hide clear button toggleClear: function(e) { if(!this.$clear) { return; } var len = this.$input.val().length, visible = this.$clear.is(':visible'); if(len && !visible) { this.$clear.show(); } if(!len && visible) { this.$clear.hide(); } }, clear: function() { this.$clear.hide(); this.$input.val('').focus(); } }); Text.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** @property tpl @default <input type="text"> **/ tpl: '<input type="text">', /** Placeholder attribute of input. Shown when input is empty. @property placeholder @type string @default null **/ placeholder: null, /** Whether to show `clear` button @property clear @type boolean @default true **/ clear: true }); $.fn.editabletypes.text = Text; }(window.jQuery)); /** Textarea input @class textarea @extends abstractinput @final @example <a href="#" id="comments" data-type="textarea" data-pk="1">awesome comment!</a> <script> $(function(){ $('#comments').editable({ url: '/post', title: 'Enter comments', rows: 10 }); }); </script> **/ (function ($) { "use strict"; var Textarea = function (options) { this.init('textarea', options, Textarea.defaults); }; $.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstractinput); $.extend(Textarea.prototype, { render: function () { this.setClass(); this.setAttr('placeholder'); this.setAttr('rows'); //ctrl + enter this.$input.keydown(function (e) { if (e.ctrlKey && e.which === 13) { $(this).closest('form').submit(); } }); }, //using `white-space: pre-wrap` solves \n <--> BR conversion very elegant! /* value2html: function(value, element) { var html = '', lines; if(value) { lines = value.split("\n"); for (var i = 0; i < lines.length; i++) { lines[i] = $('<div>').text(lines[i]).html(); } html = lines.join('<br>'); } $(element).html(html); }, html2value: function(html) { if(!html) { return ''; } var regex = new RegExp(String.fromCharCode(10), 'g'); var lines = html.split(/<br\s*\/?>/i); for (var i = 0; i < lines.length; i++) { var text = $('<div>').html(lines[i]).text(); // Remove newline characters (\n) to avoid them being converted by value2html() method // thus adding extra <br> tags text = text.replace(regex, ''); lines[i] = text; } return lines.join("\n"); }, */ activate: function() { $.fn.editabletypes.text.prototype.activate.call(this); } }); Textarea.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** @property tpl @default <textarea></textarea> **/ tpl:'<textarea></textarea>', /** @property inputclass @default input-large **/ inputclass: 'input-large', /** Placeholder attribute of input. Shown when input is empty. @property placeholder @type string @default null **/ placeholder: null, /** Number of rows in textarea @property rows @type integer @default 7 **/ rows: 7 }); $.fn.editabletypes.textarea = Textarea; }(window.jQuery)); /** Select (dropdown) @class select @extends list @final @example <a href="#" id="status" data-type="select" data-pk="1" data-url="/post" data-title="Select status"></a> <script> $(function(){ $('#status').editable({ value: 2, source: [ {value: 1, text: 'Active'}, {value: 2, text: 'Blocked'}, {value: 3, text: 'Deleted'} ] }); }); </script> **/ (function ($) { "use strict"; var Select = function (options) { this.init('select', options, Select.defaults); }; $.fn.editableutils.inherit(Select, $.fn.editabletypes.list); $.extend(Select.prototype, { renderList: function() { this.$input.empty(); var fillItems = function($el, data) { var attr; if($.isArray(data)) { for(var i=0; i<data.length; i++) { attr = {}; if(data[i].children) { attr.label = data[i].text; $el.append(fillItems($('<optgroup>', attr), data[i].children)); } else { attr.value = data[i].value; if(data[i].disabled) { attr.disabled = true; } $el.append($('<option>', attr).text(data[i].text)); } } } return $el; }; fillItems(this.$input, this.sourceData); this.setClass(); //enter submit this.$input.on('keydown.editable', function (e) { if (e.which === 13) { $(this).closest('form').submit(); } }); }, value2htmlFinal: function(value, element) { var text = '', items = $.fn.editableutils.itemsByValue(value, this.sourceData); if(items.length) { text = items[0].text; } //$(element).text(text); $.fn.editabletypes.abstractinput.prototype.value2html.call(this, text, element); }, autosubmit: function() { this.$input.off('keydown.editable').on('change.editable', function(){ $(this).closest('form').submit(); }); } }); Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, { /** @property tpl @default <select></select> **/ tpl:'<select></select>' }); $.fn.editabletypes.select = Select; }(window.jQuery)); /** List of checkboxes. Internally value stored as javascript array of values. @class checklist @extends list @final @example <a href="#" id="options" data-type="checklist" data-pk="1" data-url="/post" data-title="Select options"></a> <script> $(function(){ $('#options').editable({ value: [2, 3], source: [ {value: 1, text: 'option1'}, {value: 2, text: 'option2'}, {value: 3, text: 'option3'} ] }); }); </script> **/ (function ($) { "use strict"; var Checklist = function (options) { this.init('checklist', options, Checklist.defaults); }; $.fn.editableutils.inherit(Checklist, $.fn.editabletypes.list); $.extend(Checklist.prototype, { renderList: function() { var $label, $div; this.$tpl.empty(); if(!$.isArray(this.sourceData)) { return; } for(var i=0; i<this.sourceData.length; i++) { $label = $('<label>').append($('<input>', { type: 'checkbox', value: this.sourceData[i].value })) .append($('<span>').text(' '+this.sourceData[i].text)); $('<div>').append($label).appendTo(this.$tpl); } this.$input = this.$tpl.find('input[type="checkbox"]'); this.setClass(); }, value2str: function(value) { return $.isArray(value) ? value.sort().join($.trim(this.options.separator)) : ''; }, //parse separated string str2value: function(str) { var reg, value = null; if(typeof str === 'string' && str.length) { reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*'); value = str.split(reg); } else if($.isArray(str)) { value = str; } else { value = [str]; } return value; }, //set checked on required checkboxes value2input: function(value) { this.$input.prop('checked', false); if($.isArray(value) && value.length) { this.$input.each(function(i, el) { var $el = $(el); // cannot use $.inArray as it performs strict comparison $.each(value, function(j, val){ /*jslint eqeq: true*/ if($el.val() == val) { /*jslint eqeq: false*/ $el.prop('checked', true); } }); }); } }, input2value: function() { var checked = []; this.$input.filter(':checked').each(function(i, el) { checked.push($(el).val()); }); return checked; }, //collect text of checked boxes value2htmlFinal: function(value, element) { var html = [], checked = $.fn.editableutils.itemsByValue(value, this.sourceData), escape = this.options.escape; if(checked.length) { $.each(checked, function(i, v) { var text = escape ? $.fn.editableutils.escape(v.text) : v.text; html.push(text); }); $(element).html(html.join('<br>')); } else { $(element).empty(); } }, activate: function() { this.$input.first().focus(); }, autosubmit: function() { this.$input.on('keydown', function(e){ if (e.which === 13) { $(this).closest('form').submit(); } }); } }); Checklist.defaults = $.extend({}, $.fn.editabletypes.list.defaults, { /** @property tpl @default <div></div> **/ tpl:'<div class="editable-checklist"></div>', /** @property inputclass @type string @default null **/ inputclass: null, /** Separator of values when reading from `data-value` attribute @property separator @type string @default ',' **/ separator: ',' }); $.fn.editabletypes.checklist = Checklist; }(window.jQuery)); /** HTML5 input types. Following types are supported: * password * email * url * tel * number * range * time Learn more about html5 inputs: http://www.w3.org/wiki/HTML5_form_additions To check browser compatibility please see: https://developer.mozilla.org/en-US/docs/HTML/Element/Input @class html5types @extends text @final @since 1.3.0 @example <a href="#" id="email" data-type="email" data-pk="1">admin@example.com</a> <script> $(function(){ $('#email').editable({ url: '/post', title: 'Enter email' }); }); </script> **/ /** @property tpl @default depends on type **/ /* Password */ (function ($) { "use strict"; var Password = function (options) { this.init('password', options, Password.defaults); }; $.fn.editableutils.inherit(Password, $.fn.editabletypes.text); $.extend(Password.prototype, { //do not display password, show '[hidden]' instead value2html: function(value, element) { if(value) { $(element).text('[hidden]'); } else { $(element).empty(); } }, //as password not displayed, should not set value by html html2value: function(html) { return null; } }); Password.defaults = $.extend({}, $.fn.editabletypes.text.defaults, { tpl: '<input type="password">' }); $.fn.editabletypes.password = Password; }(window.jQuery)); /* Email */ (function ($) { "use strict"; var Email = function (options) { this.init('email', options, Email.defaults); }; $.fn.editableutils.inherit(Email, $.fn.editabletypes.text); Email.defaults = $.extend({}, $.fn.editabletypes.text.defaults, { tpl: '<input type="email">' }); $.fn.editabletypes.email = Email; }(window.jQuery)); /* Url */ (function ($) { "use strict"; var Url = function (options) { this.init('url', options, Url.defaults); }; $.fn.editableutils.inherit(Url, $.fn.editabletypes.text); Url.defaults = $.extend({}, $.fn.editabletypes.text.defaults, { tpl: '<input type="url">' }); $.fn.editabletypes.url = Url; }(window.jQuery)); /* Tel */ (function ($) { "use strict"; var Tel = function (options) { this.init('tel', options, Tel.defaults); }; $.fn.editableutils.inherit(Tel, $.fn.editabletypes.text); Tel.defaults = $.extend({}, $.fn.editabletypes.text.defaults, { tpl: '<input type="tel">' }); $.fn.editabletypes.tel = Tel; }(window.jQuery)); /* Number */ (function ($) { "use strict"; var NumberInput = function (options) { this.init('number', options, NumberInput.defaults); }; $.fn.editableutils.inherit(NumberInput, $.fn.editabletypes.text); $.extend(NumberInput.prototype, { render: function () { NumberInput.superclass.render.call(this); this.setAttr('min'); this.setAttr('max'); this.setAttr('step'); }, postrender: function() { if(this.$clear) { //increase right ffset for up/down arrows this.$clear.css({right: 24}); /* //can position clear button only here, when form is shown and height can be calculated var h = this.$input.outerHeight(true) || 20, delta = (h - this.$clear.height()) / 2; //add 12px to offset right for up/down arrows this.$clear.css({top: delta, right: delta + 16}); */ } } }); NumberInput.defaults = $.extend({}, $.fn.editabletypes.text.defaults, { tpl: '<input type="number">', inputclass: 'input-mini', min: null, max: null, step: null }); $.fn.editabletypes.number = NumberInput; }(window.jQuery)); /* Range (inherit from number) */ (function ($) { "use strict"; var Range = function (options) { this.init('range', options, Range.defaults); }; $.fn.editableutils.inherit(Range, $.fn.editabletypes.number); $.extend(Range.prototype, { render: function () { this.$input = this.$tpl.filter('input'); this.setClass(); this.setAttr('min'); this.setAttr('max'); this.setAttr('step'); this.$input.on('input', function(){ $(this).siblings('output').text($(this).val()); }); }, activate: function() { this.$input.focus(); } }); Range.defaults = $.extend({}, $.fn.editabletypes.number.defaults, { tpl: '<input type="range"><output style="width: 30px; display: inline-block"></output>', inputclass: 'input-medium' }); $.fn.editabletypes.range = Range; }(window.jQuery)); /* Time */ (function ($) { "use strict"; var Time = function (options) { this.init('time', options, Time.defaults); }; //inherit from abstract, as inheritance from text gives selection error. $.fn.editableutils.inherit(Time, $.fn.editabletypes.abstractinput); $.extend(Time.prototype, { render: function() { this.setClass(); } }); Time.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { tpl: '<input type="time">' }); $.fn.editabletypes.time = Time; }(window.jQuery)); /** Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2. Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options. You should manually download and include select2 distributive: <link href="select2/select2.css" rel="stylesheet" type="text/css"></link> <script src="select2/select2.js"></script> To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css): <link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link> **Note:** currently `autotext` feature does not work for select2 with `ajax` remote source. You need initially put both `data-value` and element's text youself: <a href="#" data-type="select2" data-value="1">Text1</a> @class select2 @extends abstractinput @since 1.4.1 @final @example <a href="#" id="country" data-type="select2" data-pk="1" data-value="ru" data-url="/post" data-title="Select country"></a> <script> $(function(){ //local source $('#country').editable({ source: [ {id: 'gb', text: 'Great Britain'}, {id: 'us', text: 'United States'}, {id: 'ru', text: 'Russia'} ], select2: { multiple: true } }); //remote source (simple) $('#country').editable({ source: '/getCountries' }); //remote source (advanced) $('#country').editable({ select2: { placeholder: 'Select Country', allowClear: true, minimumInputLength: 3, id: function (item) { return item.CountryId; }, ajax: { url: '/getCountries', dataType: 'json', data: function (term, page) { return { query: term }; }, results: function (data, page) { return { results: data }; } }, formatResult: function (item) { return item.CountryName; }, formatSelection: function (item) { return item.CountryName; }, initSelection: function (element, callback) { return $.get('/getCountryById', { query: element.val() }, function (data) { callback(data); }); } } }); }); </script> **/ (function ($) { "use strict"; var Constructor = function (options) { this.init('select2', options, Constructor.defaults); options.select2 = options.select2 || {}; this.sourceData = null; //placeholder if(options.placeholder) { options.select2.placeholder = options.placeholder; } //if not `tags` mode, use source if(!options.select2.tags && options.source) { var source = options.source; //if source is function, call it (once!) if ($.isFunction(options.source)) { source = options.source.call(options.scope); } if (typeof source === 'string') { options.select2.ajax = options.select2.ajax || {}; //some default ajax params if(!options.select2.ajax.data) { options.select2.ajax.data = function(term) {return { query:term };}; } if(!options.select2.ajax.results) { options.select2.ajax.results = function(data) { return {results:data };}; } options.select2.ajax.url = source; } else { //check format and convert x-editable format to select2 format (if needed) this.sourceData = this.convertSource(source); options.select2.data = this.sourceData; } } //overriding objects in config (as by default jQuery extend() is not recursive) this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2); //detect whether it is multi-valued this.isMultiple = this.options.select2.tags || this.options.select2.multiple; this.isRemote = ('ajax' in this.options.select2); //store function returning ID of item //should be here as used inautotext for local source this.idFunc = this.options.select2.id; if (typeof(this.idFunc) !== "function") { var idKey = this.idFunc || 'id'; this.idFunc = function (e) { return e[idKey]; }; } //store function that renders text in select2 this.formatSelection = this.options.select2.formatSelection; if (typeof(this.formatSelection) !== "function") { this.formatSelection = function (e) { return e.text; }; } }; $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput); $.extend(Constructor.prototype, { render: function() { this.setClass(); //can not apply select2 here as it calls initSelection //over input that does not have correct value yet. //apply select2 only in value2input //this.$input.select2(this.options.select2); //when data is loaded via ajax, we need to know when it's done to populate listData if(this.isRemote) { //listen to loaded event to populate data this.$input.on('select2-loaded', $.proxy(function(e) { this.sourceData = e.items.results; }, this)); } //trigger resize of editableform to re-position container in multi-valued mode if(this.isMultiple) { this.$input.on('change', function() { $(this).closest('form').parent().triggerHandler('resize'); }); } }, value2html: function(value, element) { var text = '', data, that = this; if(this.options.select2.tags) { //in tags mode just assign value data = value; //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc); } else if(this.sourceData) { data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc); } else { //can not get list of possible values //(e.g. autotext for select2 with ajax source) } //data may be array (when multiple values allowed) if($.isArray(data)) { //collect selected data and show with separator text = []; $.each(data, function(k, v){ text.push(v && typeof v === 'object' ? that.formatSelection(v) : v); }); } else if(data) { text = that.formatSelection(data); } text = $.isArray(text) ? text.join(this.options.viewseparator) : text; //$(element).text(text); Constructor.superclass.value2html.call(this, text, element); }, html2value: function(html) { return this.options.select2.tags ? this.str2value(html, this.options.viewseparator) : null; }, value2input: function(value) { //for local source use data directly from source (to allow autotext) /* if(!this.isRemote && !this.isMultiple) { var items = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc); if(items.length) { this.$input.select2('data', items[0]); return; } } */ //for remote source just set value, text is updated by initSelection if(!this.$input.data('select2')) { this.$input.val(value); this.$input.select2(this.options.select2); } else { //second argument needed to separate initial change from user's click (for autosubmit) this.$input.val(value).trigger('change', true); } //if remote source AND no user's initSelection provided --> try to use element's text if(this.isRemote && !this.isMultiple && !this.options.select2.initSelection) { var customId = this.options.select2.id, customText = this.options.select2.formatSelection; if(!customId && !customText) { var data = {id: value, text: $(this.options.scope).text()}; this.$input.select2('data', data); } } }, input2value: function() { return this.$input.select2('val'); }, str2value: function(str, separator) { if(typeof str !== 'string' || !this.isMultiple) { return str; } separator = separator || this.options.select2.separator || $.fn.select2.defaults.separator; var val, i, l; if (str === null || str.length < 1) { return null; } val = str.split(separator); for (i = 0, l = val.length; i < l; i = i + 1) { val[i] = $.trim(val[i]); } return val; }, autosubmit: function() { this.$input.on('change', function(e, isInitial){ if(!isInitial) { $(this).closest('form').submit(); } }); }, /* Converts source from x-editable format: {value: 1, text: "1"} to select2 format: {id: 1, text: "1"} */ convertSource: function(source) { if($.isArray(source) && source.length && source[0].value !== undefined) { for(var i = 0; i<source.length; i++) { if(source[i].value !== undefined) { source[i].id = source[i].value; delete source[i].value; } } } return source; }, destroy: function() { if(this.$input.data('select2')) { this.$input.select2('destroy'); } } }); Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** @property tpl @default <input type="hidden"> **/ tpl:'<input type="hidden">', /** Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2). @property select2 @type object @default null **/ select2: null, /** Placeholder attribute of select @property placeholder @type string @default null **/ placeholder: null, /** Source data for select. It will be assigned to select2 `data` property and kept here just for convenience. Please note, that format is different from simple `select` input: use 'id' instead of 'value'. E.g. `[{id: 1, text: "text1"}, {id: 2, text: "text2"}, ...]`. @property source @type array|string|function @default null **/ source: null, /** Separator used to display tags. @property viewseparator @type string @default ', ' **/ viewseparator: ', ' }); $.fn.editabletypes.select2 = Constructor; }(window.jQuery)); /** * Combodate - 1.0.4 * Dropdown date and time picker. * Converts text input into dropdowns to pick day, month, year, hour, minute and second. * Uses momentjs as datetime library http://momentjs.com. * For internalization include corresponding file from https://github.com/timrwood/moment/tree/master/lang * * Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight * In combodate: * 12:00 pm --> 12:00 (24-h format, midday) * 12:00 am --> 00:00 (24-h format, midnight, start of day) * * Differs from momentjs parse rules: * 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change) * 00:00 am, 12:00 am --> 00:00 (24-h format, day not change) * * * Author: Vitaliy Potapov * Project page: http://github.com/vitalets/combodate * Copyright (c) 2012 Vitaliy Potapov. Released under MIT License. **/ (function ($) { var Combodate = function (element, options) { this.$element = $(element); if(!this.$element.is('input')) { $.error('Combodate should be applied to INPUT element'); return; } this.options = $.extend({}, $.fn.combodate.defaults, options, this.$element.data()); this.init(); }; Combodate.prototype = { constructor: Combodate, init: function () { this.map = { //key regexp moment.method day: ['D', 'date'], month: ['M', 'month'], year: ['Y', 'year'], hour: ['[Hh]', 'hours'], minute: ['m', 'minutes'], second: ['s', 'seconds'], ampm: ['[Aa]', ''] }; this.$widget = $('<span class="combodate"></span>').html(this.getTemplate()); this.initCombos(); //update original input on change this.$widget.on('change', 'select', $.proxy(function(){ this.$element.val(this.getValue()); }, this)); this.$widget.find('select').css('width', 'auto'); //hide original input and insert widget this.$element.hide().after(this.$widget); //set initial value this.setValue(this.$element.val() || this.options.value); }, /* Replace tokens in template with <select> elements */ getTemplate: function() { var tpl = this.options.template; //first pass $.each(this.map, function(k, v) { v = v[0]; var r = new RegExp(v+'+'), token = v.length > 1 ? v.substring(1, 2) : v; tpl = tpl.replace(r, '{'+token+'}'); }); //replace spaces with &nbsp; tpl = tpl.replace(/ /g, '&nbsp;'); //second pass $.each(this.map, function(k, v) { v = v[0]; var token = v.length > 1 ? v.substring(1, 2) : v; tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>'); }); return tpl; }, /* Initialize combos that presents in template */ initCombos: function() { var that = this; $.each(this.map, function(k, v) { var $c = that.$widget.find('.'+k), f, items; if($c.length) { that['$'+k] = $c; //set properties like this.$day, this.$month etc. f = 'fill' + k.charAt(0).toUpperCase() + k.slice(1); //define method name to fill items, e.g `fillDays` items = that[f](); that['$'+k].html(that.renderItems(items)); } }); }, /* Initialize items of combos. Handles `firstItem` option */ initItems: function(key) { var values = [], relTime; if(this.options.firstItem === 'name') { //need both to support moment ver < 2 and >= 2 relTime = moment.relativeTime || moment.langData()._relativeTime; var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key]; //take last entry (see momentjs lang files structure) header = header.split(' ').reverse()[0]; values.push(['', header]); } else if(this.options.firstItem === 'empty') { values.push(['', '']); } return values; }, /* render items to string of <option> tags */ renderItems: function(items) { var str = []; for(var i=0; i<items.length; i++) { str.push('<option value="'+items[i][0]+'">'+items[i][1]+'</option>'); } return str.join("\n"); }, /* fill day */ fillDay: function() { var items = this.initItems('d'), name, i, twoDigit = this.options.template.indexOf('DD') !== -1; for(i=1; i<=31; i++) { name = twoDigit ? this.leadZero(i) : i; items.push([i, name]); } return items; }, /* fill month */ fillMonth: function() { var items = this.initItems('M'), name, i, longNames = this.options.template.indexOf('MMMM') !== -1, shortNames = this.options.template.indexOf('MMM') !== -1, twoDigit = this.options.template.indexOf('MM') !== -1; for(i=0; i<=11; i++) { if(longNames) { //see https://github.com/timrwood/momentjs.com/pull/36 name = moment().date(1).month(i).format('MMMM'); } else if(shortNames) { name = moment().date(1).month(i).format('MMM'); } else if(twoDigit) { name = this.leadZero(i+1); } else { name = i+1; } items.push([i, name]); } return items; }, /* fill year */ fillYear: function() { var items = [], name, i, longNames = this.options.template.indexOf('YYYY') !== -1; for(i=this.options.maxYear; i>=this.options.minYear; i--) { name = longNames ? i : (i+'').substring(2); items[this.options.yearDescending ? 'push' : 'unshift']([i, name]); } items = this.initItems('y').concat(items); return items; }, /* fill hour */ fillHour: function() { var items = this.initItems('h'), name, i, h12 = this.options.template.indexOf('h') !== -1, h24 = this.options.template.indexOf('H') !== -1, twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1, min = h12 ? 1 : 0, max = h12 ? 12 : 23; for(i=min; i<=max; i++) { name = twoDigit ? this.leadZero(i) : i; items.push([i, name]); } return items; }, /* fill minute */ fillMinute: function() { var items = this.initItems('m'), name, i, twoDigit = this.options.template.indexOf('mm') !== -1; for(i=0; i<=59; i+= this.options.minuteStep) { name = twoDigit ? this.leadZero(i) : i; items.push([i, name]); } return items; }, /* fill second */ fillSecond: function() { var items = this.initItems('s'), name, i, twoDigit = this.options.template.indexOf('ss') !== -1; for(i=0; i<=59; i+= this.options.secondStep) { name = twoDigit ? this.leadZero(i) : i; items.push([i, name]); } return items; }, /* fill ampm */ fillAmpm: function() { var ampmL = this.options.template.indexOf('a') !== -1, ampmU = this.options.template.indexOf('A') !== -1, items = [ ['am', ampmL ? 'am' : 'AM'], ['pm', ampmL ? 'pm' : 'PM'] ]; return items; }, /* Returns current date value from combos. If format not specified - `options.format` used. If format = `null` - Moment object returned. */ getValue: function(format) { var dt, values = {}, that = this, notSelected = false; //getting selected values $.each(this.map, function(k, v) { if(k === 'ampm') { return; } var def = k === 'day' ? 1 : 0; values[k] = that['$'+k] ? parseInt(that['$'+k].val(), 10) : def; if(isNaN(values[k])) { notSelected = true; return false; } }); //if at least one visible combo not selected - return empty string if(notSelected) { return ''; } //convert hours 12h --> 24h if(this.$ampm) { //12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day) if(values.hour === 12) { values.hour = this.$ampm.val() === 'am' ? 0 : 12; } else { values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12; } } dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]); //highlight invalid date this.highlight(dt); format = format === undefined ? this.options.format : format; if(format === null) { return dt.isValid() ? dt : null; } else { return dt.isValid() ? dt.format(format) : ''; } }, setValue: function(value) { if(!value) { return; } var dt = typeof value === 'string' ? moment(value, this.options.format) : moment(value), that = this, values = {}; //function to find nearest value in select options function getNearest($select, value) { var delta = {}; $select.children('option').each(function(i, opt){ var optValue = $(opt).attr('value'), distance; if(optValue === '') return; distance = Math.abs(optValue - value); if(typeof delta.distance === 'undefined' || distance < delta.distance) { delta = {value: optValue, distance: distance}; } }); return delta.value; } if(dt.isValid()) { //read values from date object $.each(this.map, function(k, v) { if(k === 'ampm') { return; } values[k] = dt[v[1]](); }); if(this.$ampm) { //12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day) if(values.hour >= 12) { values.ampm = 'pm'; if(values.hour > 12) { values.hour -= 12; } } else { values.ampm = 'am'; if(values.hour === 0) { values.hour = 12; } } } $.each(values, function(k, v) { //call val() for each existing combo, e.g. this.$hour.val() if(that['$'+k]) { if(k === 'minute' && that.options.minuteStep > 1 && that.options.roundTime) { v = getNearest(that['$'+k], v); } if(k === 'second' && that.options.secondStep > 1 && that.options.roundTime) { v = getNearest(that['$'+k], v); } that['$'+k].val(v); } }); this.$element.val(dt.format(this.options.format)); } }, /* highlight combos if date is invalid */ highlight: function(dt) { if(!dt.isValid()) { if(this.options.errorClass) { this.$widget.addClass(this.options.errorClass); } else { //store original border color if(!this.borderColor) { this.borderColor = this.$widget.find('select').css('border-color'); } this.$widget.find('select').css('border-color', 'red'); } } else { if(this.options.errorClass) { this.$widget.removeClass(this.options.errorClass); } else { this.$widget.find('select').css('border-color', this.borderColor); } } }, leadZero: function(v) { return v <= 9 ? '0' + v : v; }, destroy: function() { this.$widget.remove(); this.$element.removeData('combodate').show(); } //todo: clear method }; $.fn.combodate = function ( option ) { var d, args = Array.apply(null, arguments); args.shift(); //getValue returns date as string / object (not jQuery object) if(option === 'getValue' && this.length && (d = this.eq(0).data('combodate'))) { return d.getValue.apply(d, args); } return this.each(function () { var $this = $(this), data = $this.data('combodate'), options = typeof option == 'object' && option; if (!data) { $this.data('combodate', (data = new Combodate(this, options))); } if (typeof option == 'string' && typeof data[option] == 'function') { data[option].apply(data, args); } }); }; $.fn.combodate.defaults = { //in this format value stored in original input format: 'DD-MM-YYYY HH:mm', //in this format items in dropdowns are displayed template: 'D / MMM / YYYY H : mm', //initial value, can be `new Date()` value: null, minYear: 1970, maxYear: 2015, yearDescending: true, minuteStep: 5, secondStep: 1, firstItem: 'empty', //'name', 'empty', 'none' errorClass: null, roundTime: true //whether to round minutes and seconds if step > 1 }; }(window.jQuery)); /** Combodate input - dropdown date and time picker. Based on [combodate](http://vitalets.github.com/combodate) plugin (included). To use it you should manually include [momentjs](http://momentjs.com). <script src="js/moment.min.js"></script> Allows to input: * only date * only time * both date and time Please note, that format is taken from momentjs and **not compatible** with bootstrap-datepicker / jquery UI datepicker. Internally value stored as `momentjs` object. @class combodate @extends abstractinput @final @since 1.4.0 @example <a href="#" id="dob" data-type="combodate" data-pk="1" data-url="/post" data-value="1984-05-15" data-title="Select date"></a> <script> $(function(){ $('#dob').editable({ format: 'YYYY-MM-DD', viewformat: 'DD.MM.YYYY', template: 'D / MMMM / YYYY', combodate: { minYear: 2000, maxYear: 2015, minuteStep: 1 } } }); }); </script> **/ /*global moment*/ (function ($) { "use strict"; var Constructor = function (options) { this.init('combodate', options, Constructor.defaults); //by default viewformat equals to format if(!this.options.viewformat) { this.options.viewformat = this.options.format; } //try parse combodate config defined as json string in data-combodate options.combodate = $.fn.editableutils.tryParseJson(options.combodate, true); //overriding combodate config (as by default jQuery extend() is not recursive) this.options.combodate = $.extend({}, Constructor.defaults.combodate, options.combodate, { format: this.options.format, template: this.options.template }); }; $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput); $.extend(Constructor.prototype, { render: function () { this.$input.combodate(this.options.combodate); if($.fn.editableform.engine === 'bs3') { this.$input.siblings().find('select').addClass('form-control'); } if(this.options.inputclass) { this.$input.siblings().find('select').addClass(this.options.inputclass); } //"clear" link /* if(this.options.clear) { this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){ e.preventDefault(); e.stopPropagation(); this.clear(); }, this)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); } */ }, value2html: function(value, element) { var text = value ? value.format(this.options.viewformat) : ''; //$(element).text(text); Constructor.superclass.value2html.call(this, text, element); }, html2value: function(html) { return html ? moment(html, this.options.viewformat) : null; }, value2str: function(value) { return value ? value.format(this.options.format) : ''; }, str2value: function(str) { return str ? moment(str, this.options.format) : null; }, value2submit: function(value) { return this.value2str(value); }, value2input: function(value) { this.$input.combodate('setValue', value); }, input2value: function() { return this.$input.combodate('getValue', null); }, activate: function() { this.$input.siblings('.combodate').find('select').eq(0).focus(); }, /* clear: function() { this.$input.data('datepicker').date = null; this.$input.find('.active').removeClass('active'); }, */ autosubmit: function() { } }); Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** @property tpl @default <input type="text"> **/ tpl:'<input type="text">', /** @property inputclass @default null **/ inputclass: null, /** Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br> See list of tokens in [momentjs docs](http://momentjs.com/docs/#/parsing/string-format) @property format @type string @default YYYY-MM-DD **/ format:'YYYY-MM-DD', /** Format used for displaying date. Also applied when converting date from element's text on init. If not specified equals to `format`. @property viewformat @type string @default null **/ viewformat: null, /** Template used for displaying dropdowns. @property template @type string @default D / MMM / YYYY **/ template: 'D / MMM / YYYY', /** Configuration of combodate. Full list of options: http://vitalets.github.com/combodate/#docs @property combodate @type object @default null **/ combodate: null /* (not implemented yet) Text shown as clear date button. If <code>false</code> clear button will not be rendered. @property clear @type boolean|string @default 'x clear' */ //clear: '&times; clear' }); $.fn.editabletypes.combodate = Constructor; }(window.jQuery)); /** * Editable Poshytip * --------------------- * requires jquery.poshytip.js */ (function ($) { "use strict"; //extend methods $.extend($.fn.editableContainer.Popup.prototype, { containerName: 'poshytip', innerCss: 'div.tip-inner', defaults: $.fn.poshytip.defaults, initContainer: function(){ this.handlePlacement(); $.extend(this.containerOptions, { showOn: 'none', content: '', alignTo: 'target' }); this.call(this.containerOptions); }, /* Overwrite totally show() method as poshytip requires content is set before show */ show: function (closeAll) { this.$element.addClass('editable-open'); if(closeAll !== false) { //close all open containers (except this) this.closeOthers(this.$element[0]); } //render form this.$form = $('<div>'); this.renderForm(); var $label = $('<label>').text(this.options.title || this.$element.data( "title") || this.$element.data( "originalTitle")), $content = $('<div>').append($label).append(this.$form); this.call('update', $content); this.call('show'); this.tip().addClass(this.containerClass); this.$form.data('editableform').input.activate(); }, /* hide */ innerHide: function () { this.call('hide'); }, /* destroy */ innerDestroy: function() { this.call('destroy'); }, setPosition: function() { this.container().refresh(false); }, handlePlacement: function() { var x, y, ox = 0, oy = 0; switch(this.options.placement) { case 'top': x = 'center'; y = 'top'; oy = 5; break; case 'right': x = 'right'; y = 'center'; ox = 10; break; case 'bottom': x = 'center'; y = 'bottom'; oy = 5; break; case 'left': x = 'left'; y = 'center'; ox = 10; break; } $.extend(this.containerOptions, { alignX: x, offsetX: ox, alignY: y, offsetY:oy }); } }); //defaults $.fn.editableContainer.defaults = $.extend({}, $.fn.editableContainer.defaults, { className: 'tip-yellowsimple' }); /** * Poshytip fix: disable incorrect table display * see https://github.com/vadikom/poshytip/issues/7 */ /*jshint eqeqeq:false, curly: false*/ if($.Poshytip) { //need this check, because in inline mode poshytip may not be loaded! var tips = [], reBgImage = /^url\(["']?([^"'\)]*)["']?\);?$/i, rePNG = /\.png$/i, ie6 = !!window.createPopup && document.documentElement.currentStyle.minWidth == 'undefined'; $.Poshytip.prototype.refresh = function(async) { if (this.disabled) return; var currPos; if (async) { if (!this.$tip.data('active')) return; // save current position as we will need to animate currPos = {left: this.$tip.css('left'), top: this.$tip.css('top')}; } // reset position to avoid text wrapping, etc. this.$tip.css({left: 0, top: 0}).appendTo(document.body); // save default opacity if (this.opacity === undefined) this.opacity = this.$tip.css('opacity'); // check for images - this code is here (i.e. executed each time we show the tip and not on init) due to some browser inconsistencies var bgImage = this.$tip.css('background-image').match(reBgImage), arrow = this.$arrow.css('background-image').match(reBgImage); if (bgImage) { var bgImagePNG = rePNG.test(bgImage[1]); // fallback to background-color/padding/border in IE6 if a PNG is used if (ie6 && bgImagePNG) { this.$tip.css('background-image', 'none'); this.$inner.css({margin: 0, border: 0, padding: 0}); bgImage = bgImagePNG = false; } else { this.$tip.prepend('<table class="fallback" border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>') .css({border: 0, padding: 0, 'background-image': 'none', 'background-color': 'transparent'}) .find('.tip-bg-image').css('background-image', 'url("' + bgImage[1] +'")').end() .find('td').eq(3).append(this.$inner); } // disable fade effect in IE due to Alpha filter + translucent PNG issue if (bgImagePNG && !$.support.opacity) this.opts.fade = false; } // IE arrow fixes if (arrow && !$.support.opacity) { // disable arrow in IE6 if using a PNG if (ie6 && rePNG.test(arrow[1])) { arrow = false; this.$arrow.css('background-image', 'none'); } // disable fade effect in IE due to Alpha filter + translucent PNG issue this.opts.fade = false; } var $table = this.$tip.find('table.fallback'); if (ie6) { // fix min/max-width in IE6 this.$tip[0].style.width = ''; $table.width('auto').find('td').eq(3).width('auto'); var tipW = this.$tip.width(), minW = parseInt(this.$tip.css('min-width'), 10), maxW = parseInt(this.$tip.css('max-width'), 10); if (!isNaN(minW) && tipW < minW) tipW = minW; else if (!isNaN(maxW) && tipW > maxW) tipW = maxW; this.$tip.add($table).width(tipW).eq(0).find('td').eq(3).width('100%'); } else if ($table[0]) { // fix the table width if we are using a background image // IE9, FF4 use float numbers for width/height so use getComputedStyle for them to avoid text wrapping // for details look at: http://vadikom.com/dailies/offsetwidth-offsetheight-useless-in-ie9-firefox4/ $table.width('auto').find('td').eq(3).width('auto').end().end().width(document.defaultView && document.defaultView.getComputedStyle && parseFloat(document.defaultView.getComputedStyle(this.$tip[0], null).width) || this.$tip.width()).find('td').eq(3).width('100%'); } this.tipOuterW = this.$tip.outerWidth(); this.tipOuterH = this.$tip.outerHeight(); this.calcPos(); // position and show the arrow image if (arrow && this.pos.arrow) { this.$arrow[0].className = 'tip-arrow tip-arrow-' + this.pos.arrow; this.$arrow.css('visibility', 'inherit'); } if (async) { this.asyncAnimating = true; var self = this; this.$tip.css(currPos).animate({left: this.pos.l, top: this.pos.t}, 200, function() { self.asyncAnimating = false; }); } else { this.$tip.css({left: this.pos.l, top: this.pos.t}); } }; } /*jshinteqeqeq: true, curly: true*/ }(window.jQuery)); /** jQuery UI Datepicker. Description and examples: http://jqueryui.com/datepicker. This input is also accessible as **date** type. Do not use it together with __bootstrap-datepicker__ as both apply <code>$().datepicker()</code> method. For **i18n** you should include js file from here: https://github.com/jquery/jquery-ui/tree/master/ui/i18n. @class dateui @extends abstractinput @final @example <a href="#" id="dob" data-type="date" data-pk="1" data-url="/post" data-title="Select date">15/05/1984</a> <script> $(function(){ $('#dob').editable({ format: 'yyyy-mm-dd', viewformat: 'dd/mm/yyyy', datepicker: { firstDay: 1 } } }); }); </script> **/ (function ($) { "use strict"; var DateUI = function (options) { this.init('dateui', options, DateUI.defaults); this.initPicker(options, DateUI.defaults); }; $.fn.editableutils.inherit(DateUI, $.fn.editabletypes.abstractinput); $.extend(DateUI.prototype, { initPicker: function(options, defaults) { //by default viewformat equals to format if(!this.options.viewformat) { this.options.viewformat = this.options.format; } //correct formats: replace yyyy with yy (for compatibility with bootstrap datepicker) this.options.viewformat = this.options.viewformat.replace('yyyy', 'yy'); this.options.format = this.options.format.replace('yyyy', 'yy'); //overriding datepicker config (as by default jQuery extend() is not recursive) //since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, { dateFormat: this.options.viewformat }); }, render: function () { this.$input.datepicker(this.options.datepicker); //"clear" link if(this.options.clear) { this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){ e.preventDefault(); e.stopPropagation(); this.clear(); }, this)); this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear)); } }, value2html: function(value, element) { var text = $.datepicker.formatDate(this.options.viewformat, value); DateUI.superclass.value2html.call(this, text, element); }, html2value: function(html) { if(typeof html !== 'string') { return html; } //if string does not match format, UI datepicker throws exception var d; try { d = $.datepicker.parseDate(this.options.viewformat, html); } catch(e) {} return d; }, value2str: function(value) { return $.datepicker.formatDate(this.options.format, value); }, str2value: function(str) { if(typeof str !== 'string') { return str; } //if string does not match format, UI datepicker throws exception var d; try { d = $.datepicker.parseDate(this.options.format, str); } catch(e) {} return d; }, value2submit: function(value) { return this.value2str(value); }, value2input: function(value) { this.$input.datepicker('setDate', value); }, input2value: function() { return this.$input.datepicker('getDate'); }, activate: function() { }, clear: function() { this.$input.datepicker('setDate', null); }, autosubmit: function() { this.$input.on('mouseup', 'table.ui-datepicker-calendar a.ui-state-default', function(e){ var $form = $(this).closest('form'); setTimeout(function() { $form.submit(); }, 200); }); } }); DateUI.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, { /** @property tpl @default <div></div> **/ tpl:'<div class="editable-date"></div>', /** @property inputclass @default null **/ inputclass: null, /** Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br> Full list of tokens: http://docs.jquery.com/UI/Datepicker/formatDate @property format @type string @default yyyy-mm-dd **/ format:'yyyy-mm-dd', /** Format used for displaying date. Also applied when converting date from element's text on init. If not specified equals to <code>format</code> @property viewformat @type string @default null **/ viewformat: null, /** Configuration of datepicker. Full list of options: http://api.jqueryui.com/datepicker @property datepicker @type object @default { firstDay: 0, changeYear: true, changeMonth: true } **/ datepicker: { firstDay: 0, changeYear: true, changeMonth: true, showOtherMonths: true }, /** Text shown as clear date button. If <code>false</code> clear button will not be rendered. @property clear @type boolean|string @default 'x clear' **/ clear: '&times; clear' }); $.fn.editabletypes.dateui = DateUI; }(window.jQuery)); /** jQuery UI datefield input - modification for inline mode. Shows normal <input type="text"> and binds popup datepicker. Automatically shown in inline mode. @class dateuifield @extends dateui @since 1.4.0 **/ (function ($) { "use strict"; var DateUIField = function (options) { this.init('dateuifield', options, DateUIField.defaults); this.initPicker(options, DateUIField.defaults); }; $.fn.editableutils.inherit(DateUIField, $.fn.editabletypes.dateui); $.extend(DateUIField.prototype, { render: function () { // this.$input = this.$tpl.find('input'); this.$input.datepicker(this.options.datepicker); $.fn.editabletypes.text.prototype.renderClear.call(this); }, value2input: function(value) { this.$input.val($.datepicker.formatDate(this.options.viewformat, value)); }, input2value: function() { return this.html2value(this.$input.val()); }, activate: function() { $.fn.editabletypes.text.prototype.activate.call(this); }, toggleClear: function() { $.fn.editabletypes.text.prototype.toggleClear.call(this); }, autosubmit: function() { //reset autosubmit to empty } }); DateUIField.defaults = $.extend({}, $.fn.editabletypes.dateui.defaults, { /** @property tpl @default <input type="text"> **/ tpl: '<input type="text"/>', /** @property inputclass @default null **/ inputclass: null, /* datepicker config */ datepicker: { showOn: "button", buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif", buttonImageOnly: true, firstDay: 0, changeYear: true, changeMonth: true, showOtherMonths: true }, /* disable clear link */ clear: false }); $.fn.editabletypes.dateuifield = DateUIField; }(window.jQuery));
barkinet/cdnjs
ajax/libs/x-editable/1.5.0/jquery-editable/js/jquery-editable-poshytip.js
JavaScript
mit
173,699
/* * # Semantic UI * https://github.com/Semantic-Org/Semantic-UI * http://www.semantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(e,t,n,r){"use strict";e.fn.progress=function(t){var a,o=e(this),s=o.selector||"",c=("ontouchstart"in n.documentElement,(new Date).getTime()),i=[],l=arguments[0],u="string"==typeof l,g=[].slice.call(arguments,1);return o.each(function(){var n,o=e.isPlainObject(t)?e.extend(!0,{},e.fn.progress.settings,t):e.extend({},e.fn.progress.settings),p=o.className,m=o.metadata,v=o.namespace,d=o.selector,b=o.error,f="module-"+v,h=e(this),x=e(this).find(d.bar),y=e(this).find(d.progress),w=e(this).find(d.label),C=this,A=h.data(f);n={initialize:function(){n.debug("Initializing progress",o),n.read.metadata(),n.set.initials(),n.instantiate()},instantiate:function(){n.verbose("Storing instance of progress",n),A=n,h.data(f,n)},destroy:function(){n.verbose("Destroying previous dropdown for",h),h.removeData(f),A=r},reset:function(){n.set.percent(0)},complete:function(){(n.percent===r||n.percent<100)&&n.set.percent(100)},read:{metadata:function(){h.data(m.percent)&&(n.verbose("Current percent value set from metadata"),n.percent=h.data(m.percent)),h.data(m.total)&&(n.verbose("Total value set from metadata"),n.total=h.data(m.total)),h.data(m.value)&&(n.verbose("Current value set from metadata"),n.value=h.data(m.value))},currentValue:function(){return n.value!==r?n.value:!1}},increment:function(e){var t,r,a,o=n.total||!1;o?(r=n.value||0,e=e||1,a=r+e,t=n.total,n.debug("Incrementing value by",e,r,t),a>t&&(n.debug("Value cannot increment above total",t),a=t),n.set.progress(a)):(r=n.percent||0,e=e||n.get.randomValue(),a=r+e,t=100,n.debug("Incrementing percentage by",e,r),a>t&&(n.debug("Value cannot increment above 100 percent"),a=t),n.set.progress(a))},decrement:function(e){var t,r,a=n.total||!1,o=0;a?(t=n.value||0,e=e||1,r=t-e,n.debug("Decrementing value by",e,t)):(t=n.percent||0,e=e||n.get.randomValue(),r=t-e,n.debug("Decrementing percentage by",e,t)),o>r&&(n.debug("Value cannot decrement below 0"),r=0),n.set.progress(r)},get:{text:function(e){var t=n.value||0,r=n.total||0,a=n.percent||0;return e=e||"",e=e.replace("{value}",t).replace("{total}",r).replace("{percent}",a),n.debug("Adding variables to progress bar text",e),e},randomValue:function(){return n.debug("Generating random increment percentage"),Math.floor(Math.random()*o.random.max+o.random.min)},percent:function(){return n.percent||0},value:function(){return n.value||!1},total:function(){return n.total||!1}},is:{success:function(){return h.hasClass(p.success)},warning:function(){return h.hasClass(p.warning)},error:function(){return h.hasClass(p.error)}},remove:{active:function(){n.verbose("Removing active state"),h.removeClass(p.active)},success:function(){n.verbose("Removing success state"),h.removeClass(p.success)},warning:function(){n.verbose("Removing warning state"),h.removeClass(p.warning)},error:function(){n.verbose("Removing error state"),h.removeClass(p.error)}},set:{barWidth:function(e){e>100&&n.error(b.tooHigh,e),x.css("width",e+"%")},initials:function(){o.value&&(n.verbose("Current value set in settings",o.value),n.value=o.value),o.total&&(n.verbose("Current total set in settings",o.total),n.total=o.total),o.percent&&(n.verbose("Current percent set in settings",o.percent),n.percent=o.percent),n.percent?n.set.percent(n.percent):n.value&&n.set.progress(n.value)},percent:function(t){t="string"==typeof t?+t.replace("%",""):t,t>0&&1>t&&(n.verbose("Module percentage passed as decimal, converting"),t=100*t),t=Math.round(0===o.precision?t:10*t*o.precision/(10*o.precision)),n.percent=t,n.total&&(n.value=Math.round(t/100*n.total)),n.set.barWidth(t),n.set.barLabel(),100===t?!o.autoSuccess||n.is.warning()||n.is.error()?n.remove.active():(n.set.success(),n.debug("Automatically triggering success at 100%")):n.set.active(),e.proxy(o.onChange,C)(t,n.value,n.total)},label:function(e){e=e||"",e&&(e=n.get.text(e),n.debug("Setting label to text",e),w.text(e))},barLabel:function(e){e!==r?y.text(n.get.text(e)):"ratio"==o.label&&n.total?(n.debug("Adding ratio to bar label"),y.text(n.get.text(o.text.ratio))):"percent"==o.label&&(n.debug("Adding percentage to bar label"),y.text(n.get.text(o.text.percent)))},active:function(t){t=t||o.text.active,n.debug("Setting active state"),o.showActivity&&h.addClass(p.active),n.remove.warning(),n.remove.error(),n.remove.success(),t&&n.set.label(t),e.proxy(o.onActive,C)(n.value,n.total)},success:function(t){t=t||o.text.success,n.debug("Setting success state"),h.addClass(p.success),n.remove.active(),n.remove.warning(),n.remove.error(),n.complete(),t&&n.set.label(t),e.proxy(o.onSuccess,C)(n.total)},warning:function(t){t=t||o.text.warning,n.debug("Setting warning state"),h.addClass(p.warning),n.remove.active(),n.remove.success(),n.remove.error(),n.complete(),t&&n.set.label(t),e.proxy(o.onWarning,C)(n.value,n.total)},error:function(t){t=t||o.text.error,n.debug("Setting error state"),h.addClass(p.error),n.remove.active(),n.remove.success(),n.remove.warning(),n.complete(),t&&n.set.label(t),e.proxy(o.onError,C)(n.value,n.total)},total:function(e){n.total=e},progress:function(e){var t,r="string"==typeof e?""!==e.replace(/[^\d.]/g,"")?+e.replace(/[^\d.]/g,""):!1:e;r||n.error(b.nonNumeric),n.total?(n.value=r,t=r/n.total*100,n.debug("Calculating percent complete from total",t),n.set.percent(t)):(t=r,n.debug("Setting value to exact percentage value",t),n.set.percent(t))}},setting:function(t,a){if(n.debug("Changing setting",t,a),e.isPlainObject(t))e.extend(!0,o,t);else{if(a===r)return o[t];o[t]=a}},internal:function(t,a){if(e.isPlainObject(t))e.extend(!0,n,t);else{if(a===r)return n[t];n[t]=a}},debug:function(){o.debug&&(o.performance?n.performance.log(arguments):(n.debug=Function.prototype.bind.call(console.info,console,o.name+":"),n.debug.apply(console,arguments)))},verbose:function(){o.verbose&&o.debug&&(o.performance?n.performance.log(arguments):(n.verbose=Function.prototype.bind.call(console.info,console,o.name+":"),n.verbose.apply(console,arguments)))},error:function(){n.error=Function.prototype.bind.call(console.error,console,o.name+":"),n.error.apply(console,arguments)},performance:{log:function(e){var t,r,a;o.performance&&(t=(new Date).getTime(),a=c||t,r=t-a,c=t,i.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:C,"Execution Time":r})),clearTimeout(n.performance.timer),n.performance.timer=setTimeout(n.performance.display,100)},display:function(){var t=o.name+":",a=0;c=!1,clearTimeout(n.performance.timer),e.each(i,function(e,t){a+=t["Execution Time"]}),t+=" "+a+"ms",s&&(t+=" '"+s+"'"),(console.group!==r||console.table!==r)&&i.length>0&&(console.groupCollapsed(t),console.table?console.table(i):e.each(i,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(t,o,s){var c,i,l,u=A;return o=o||g,s=C||s,"string"==typeof t&&u!==r&&(t=t.split(/[\. ]/),c=t.length-1,e.each(t,function(a,o){var s=a!=c?o+t[a+1].charAt(0).toUpperCase()+t[a+1].slice(1):t;if(e.isPlainObject(u[s])&&a!=c)u=u[s];else{if(u[s]!==r)return i=u[s],!1;if(!e.isPlainObject(u[o])||a==c)return u[o]!==r?(i=u[o],!1):(n.error(b.method,t),!1);u=u[o]}})),e.isFunction(i)?l=i.apply(s,o):i!==r&&(l=i),e.isArray(a)?a.push(l):a!==r?a=[a,l]:l!==r&&(a=l),i}},u?(A===r&&n.initialize(),n.invoke(l)):(A!==r&&n.destroy(),n.initialize())}),a!==r?a:this},e.fn.progress.settings={name:"Progress",namespace:"progress",debug:!1,verbose:!0,performance:!0,random:{min:2,max:5},autoSuccess:!0,showActivity:!0,label:"percent",precision:1,percent:!1,total:!1,value:!1,onChange:function(){},onSuccess:function(){},onActive:function(){},onError:function(){},onWarning:function(){},error:{method:"The method you called is not defined.",nonNumeric:"Progress value is non numeric"},regExp:{variable:/\{\$*[A-z0-9]+\}/g},metadata:{percent:"percent",total:"total",value:"value"},selector:{bar:"> .bar",label:"> .label",progress:".bar > .progress"},text:{active:!1,error:!1,success:!1,warning:!1,percent:"{percent}%",ratio:"{value} of {total}"},className:{active:"active",error:"error",success:"success",warning:"warning"}}}(jQuery,window,document);
alexmojaki/jsdelivr
files/semantic-ui/1.0.1/components/progress.min.js
JavaScript
mit
8,232
var assert = require('assert'), colors = require('../lib/index'); var s = 'string'; function a(s, code) { return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m'; } function aE(s, color, code) { assert.equal(s[color], a(s, code)); assert.equal(colors[color](s), a(s, code)); assert.equal(s[color], colors[color](s)); assert.equal(s[color].strip, s); assert.equal(s[color].strip, colors.strip(s)); } function h(s, color) { return '<span style="color:' + color + ';">' + s + '</span>'; } var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow']; var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']); colors.mode = 'console'; assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m'); assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m'); assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m'); assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m'); assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m'); assert.ok(s.rainbow); aE(s, 'white', 37); aE(s, 'grey', 90); aE(s, 'black', 30); aE(s, 'blue', 34); aE(s, 'cyan', 36); aE(s, 'green', 32); aE(s, 'magenta', 35); aE(s, 'red', 31); aE(s, 'yellow', 33); assert.equal(s, 'string'); colors.setTheme({error:'red'}); assert.equal(typeof("astring".red),'string'); assert.equal(typeof("astring".error),'string');
tvaisanen/embeddedGraphWidget
production_v0.01/node_modules/colors/tests/basic-test.js
JavaScript
mit
1,347
@import url(../../lib/font/league-gothic/league-gothic.css); @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); /** * Beige theme for reveal.js. * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ /********************************************* * GLOBAL STYLES *********************************************/ body { background: #f7f2d3; background: -moz-radial-gradient(center, circle cover, #ffffff 0%, #f7f2d3 100%); background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #ffffff), color-stop(100%, #f7f2d3)); background: -webkit-radial-gradient(center, circle cover, #ffffff 0%, #f7f2d3 100%); background: -o-radial-gradient(center, circle cover, #ffffff 0%, #f7f2d3 100%); background: -ms-radial-gradient(center, circle cover, #ffffff 0%, #f7f2d3 100%); background: radial-gradient(center, circle cover, #ffffff 0%, #f7f2d3 100%); background-color: #f7f3de; } .reveal { font-family: 'Lato', sans-serif; font-size: 36px; font-weight: normal; color: #333; } ::selection { color: #fff; background: rgba(79, 64, 28, 0.99); text-shadow: none; } .reveal .slides > section, .reveal .slides > section > section { line-height: 1.3; font-weight: inherit; } /********************************************* * HEADERS *********************************************/ .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 { margin: 0 0 20px 0; color: #333; font-family: 'League Gothic', Impact, sans-serif; font-weight: normal; line-height: 1.2; letter-spacing: normal; text-transform: uppercase; text-shadow: none; word-wrap: break-word; } .reveal h1 { font-size: 3.77em; } .reveal h2 { font-size: 2.11em; } .reveal h3 { font-size: 1.55em; } .reveal h4 { font-size: 1em; } .reveal h1 { text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); } /********************************************* * OTHER *********************************************/ .reveal p { margin: 20px 0; line-height: 1.3; } /* Ensure certain elements are never larger than the slide itself */ .reveal img, .reveal video, .reveal iframe { max-width: 95%; max-height: 95%; } .reveal strong, .reveal b { font-weight: bold; } .reveal em { font-style: italic; } .reveal ol, .reveal dl, .reveal ul { display: inline-block; text-align: left; margin: 0 0 0 1em; } .reveal ol { list-style-type: decimal; } .reveal ul { list-style-type: disc; } .reveal ul ul { list-style-type: square; } .reveal ul ul ul { list-style-type: circle; } .reveal ul ul, .reveal ul ol, .reveal ol ol, .reveal ol ul { display: block; margin-left: 40px; } .reveal dt { font-weight: bold; } .reveal dd { margin-left: 40px; } .reveal q, .reveal blockquote { quotes: none; } .reveal blockquote { display: block; position: relative; width: 70%; margin: 20px auto; padding: 5px; font-style: italic; background: rgba(255, 255, 255, 0.05); box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2); } .reveal blockquote p:first-child, .reveal blockquote p:last-child { display: inline-block; } .reveal q { font-style: italic; } .reveal pre { display: block; position: relative; width: 90%; margin: 20px auto; text-align: left; font-size: 0.55em; font-family: monospace; line-height: 1.2em; word-wrap: break-word; box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { font-family: monospace; } .reveal pre code { display: block; padding: 5px; overflow: auto; max-height: 400px; word-wrap: normal; background: #3F3F3F; color: #DCDCDC; } .reveal table { margin: auto; border-collapse: collapse; border-spacing: 0; } .reveal table th { font-weight: bold; } .reveal table th, .reveal table td { text-align: left; padding: 0.2em 0.5em 0.2em 0.5em; border-bottom: 1px solid; } .reveal table th[align="center"], .reveal table td[align="center"] { text-align: center; } .reveal table th[align="right"], .reveal table td[align="right"] { text-align: right; } .reveal table tr:last-child td { border-bottom: none; } .reveal sup { vertical-align: super; } .reveal sub { vertical-align: sub; } .reveal small { display: inline-block; font-size: 0.6em; line-height: 1.2em; vertical-align: top; } .reveal small * { vertical-align: top; } /********************************************* * LINKS *********************************************/ .reveal a { color: #8b743d; text-decoration: none; -webkit-transition: color 0.15s ease; -moz-transition: color 0.15s ease; transition: color 0.15s ease; } .reveal a:hover { color: #c0a76e; text-shadow: none; border: none; } .reveal .roll span:after { color: #fff; background: #564726; } /********************************************* * IMAGES *********************************************/ .reveal section img { margin: 15px 0px; background: rgba(255, 255, 255, 0.12); border: 4px solid #333; box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); } .reveal a img { -webkit-transition: all 0.15s linear; -moz-transition: all 0.15s linear; transition: all 0.15s linear; } .reveal a:hover img { background: rgba(255, 255, 255, 0.2); border-color: #8b743d; box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); } /********************************************* * NAVIGATION CONTROLS *********************************************/ .reveal .controls div.navigate-left, .reveal .controls div.navigate-left.enabled { border-right-color: #8b743d; } .reveal .controls div.navigate-right, .reveal .controls div.navigate-right.enabled { border-left-color: #8b743d; } .reveal .controls div.navigate-up, .reveal .controls div.navigate-up.enabled { border-bottom-color: #8b743d; } .reveal .controls div.navigate-down, .reveal .controls div.navigate-down.enabled { border-top-color: #8b743d; } .reveal .controls div.navigate-left.enabled:hover { border-right-color: #c0a76e; } .reveal .controls div.navigate-right.enabled:hover { border-left-color: #c0a76e; } .reveal .controls div.navigate-up.enabled:hover { border-bottom-color: #c0a76e; } .reveal .controls div.navigate-down.enabled:hover { border-top-color: #c0a76e; } /********************************************* * PROGRESS BAR *********************************************/ .reveal .progress { background: rgba(0, 0, 0, 0.2); } .reveal .progress span { background: #8b743d; -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } /********************************************* * SLIDE NUMBER *********************************************/ .reveal .slide-number { color: #8b743d; }
helgalivsalinas/migrahack-colorado-2016
css/theme/beige.css
CSS
mit
7,028
CKEDITOR.plugins.setLang("specialchar","eo",{euro:"EΕ­rosigno",lsquo:"Supra 6-citilo",rsquo:"Supra 9-citilo",ldquo:"Supra 66-citilo",rdquo:"Supra 99-citilo",ndash:"Streketo",mdash:"Substreko",iexcl:"Renversita krisigno",cent:"Cendosigno",pound:"Pundosigno",curren:"Monersigno",yen:"Enosigno",brvbar:"Rompita vertikala streko",sect:"Kurba paragrafo",uml:"Tremao",copy:"Kopirajtosigno",ordf:"Adjektiva numerfinaΔ΅o",laquo:"Duobla malplio-citilo",not:"Negohoko",reg:"Registrita marko",macr:"Superstreko",deg:"Gradosigno",sup2:"Supra indico 2",sup3:"Supra indico 3",acute:"Dekstra korno",micro:"Mikrosigno",para:"Rekta paragrafo",middot:"Meza punkto",cedil:"Zoeto",sup1:"Supra indico 1",ordm:"Substantiva numerfinaΔ΅o",raquo:"Duobla plio-citilo",frac14:"Kvaronosigno",frac12:"Duonosigno",frac34:"Trikvaronosigno",iquest:"renversita demandosigno",Agrave:"Latina Δ‰eflitero A kun liva korno",Aacute:"Latina Δ‰eflitero A kun dekstra korno",Acirc:"Latina Δ‰eflitero A kun Δ‰apelo",Atilde:"Latina Δ‰eflitero A kun tildo",Auml:"Latina Δ‰eflitero A kun tremao",Aring:"Latina Δ‰eflitero A kun superringo",AElig:"Latina Δ‰eflitera ligaturo Γ†",Ccedil:"Latina Δ‰eflitero C kun zoeto",Egrave:"Latina Δ‰eflitero E kun liva korno",Eacute:"Latina Δ‰eflitero E kun dekstra korno",Ecirc:"Latina Δ‰eflitero E kun Δ‰apelo",Euml:"Latina Δ‰eflitero E kun tremao",Igrave:"Latina Δ‰eflitero I kun liva korno",Iacute:"Latina Δ‰eflitero I kun dekstra korno",Icirc:"Latina Δ‰eflitero I kun Δ‰apelo",Iuml:"Latina Δ‰eflitero I kun tremao",ETH:"Latina Δ‰eflitero islanda edo",Ntilde:"Latina Δ‰eflitero N kun tildo",Ograve:"Latina Δ‰eflitero O kun liva korno",Oacute:"Latina Δ‰eflitero O kun dekstra korno",Ocirc:"Latina Δ‰eflitero O kun Δ‰apelo",Otilde:"Latina Δ‰eflitero O kun tildo",Ouml:"Latina Δ‰eflitero O kun tremao",times:"Multipliko",Oslash:"Latina Δ‰eflitero O trastrekita",Ugrave:"Latina Δ‰eflitero U kun liva korno",Uacute:"Latina Δ‰eflitero U kun dekstra korno",Ucirc:"Latina Δ‰eflitero U kun Δ‰apelo",Uuml:"Latina Δ‰eflitero U kun tremao",Yacute:"Latina Δ‰eflitero Y kun dekstra korno",THORN:"Latina Δ‰eflitero islanda dorno",szlig:"Latina etlitero germana sozo (akra s)",agrave:"Latina etlitero a kun liva korno",aacute:"Latina etlitero a kun dekstra korno",acirc:"Latina etlitero a kun Δ‰apelo",atilde:"Latina etlitero a kun tildo",auml:"Latina etlitero a kun tremao",aring:"Latina etlitero a kun superringo",aelig:"Latina etlitera ligaturo Γ¦",ccedil:"Latina etlitero c kun zoeto",egrave:"Latina etlitero e kun liva korno",eacute:"Latina etlitero e kun dekstra korno",ecirc:"Latina etlitero e kun Δ‰apelo",euml:"Latina etlitero e kun tremao",igrave:"Latina etlitero i kun liva korno",iacute:"Latina etlitero i kun dekstra korno",icirc:"Latina etlitero i kun Δ‰apelo",iuml:"Latina etlitero i kun tremao",eth:"Latina etlitero islanda edo",ntilde:"Latina etlitero n kun tildo",ograve:"Latina etlitero o kun liva korno",oacute:"Latina etlitero o kun dekstra korno",ocirc:"Latina etlitero o kun Δ‰apelo",otilde:"Latina etlitero o kun tildo",ouml:"Latina etlitero o kun tremao",divide:"Dividosigno",oslash:"Latina etlitero o trastrekita",ugrave:"Latina etlitero u kun liva korno",uacute:"Latina etlitero u kun dekstra korno",ucirc:"Latina etlitero u kun Δ‰apelo",uuml:"Latina etlitero u kun tremao",yacute:"Latina etlitero y kun dekstra korno",thorn:"Latina etlitero islanda dorno",yuml:"Latina etlitero y kun tremao",OElig:"Latina Δ‰eflitera ligaturo Ε’",oelig:"Latina etlitera ligaturo Ε“",372:"Latina Δ‰eflitero W kun Δ‰apelo",374:"Latina Δ‰eflitero Y kun Δ‰apelo",373:"Latina etlitero w kun Δ‰apelo",375:"Latina etlitero y kun Δ‰apelo",sbquo:"Suba 9-citilo",8219:"Supra renversita 9-citilo",bdquo:"Suba 99-citilo",hellip:"Tripunkto",trade:"Varmarka signo",9658:"Nigra sago dekstren",bull:"Bulmarko",rarr:"Sago dekstren",rArr:"Duobla sago dekstren",hArr:"Duobla sago maldekstren",diams:"Nigra kvadrato",asymp:"PreskaΕ­ egala"});
zhaozhiming/cdnjs
ajax/libs/ckeditor/4.0.1/plugins/specialchar/dialogs/lang/eo.min.js
JavaScript
mit
3,909
"use strict"; module.exports = exports = _package; exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball'; var fs = require('fs'); var path = require('path'); var log = require('npmlog'); var versioning = require('./util/versioning.js'); var write = require('fs').createWriteStream; var existsAsync = fs.exists || path.exists; var mkdirp = require('mkdirp'); function _package(gyp, argv, callback) { var pack = require('tar-pack').pack; var package_json = JSON.parse(fs.readFileSync('./package.json')); var opts = versioning.evaluate(package_json, gyp.opts); var from = opts.module_path; var binary_module = path.join(from,opts.module_name + '.node'); existsAsync(binary_module,function(found) { if (!found) { return callback(new Error("Cannot package because " + binary_module + " missing: run `node-pre-gyp rebuild` first")); } var tarball = opts.staged_tarball; var filter_func = function(entry) { // ensure directories are +x // https://github.com/mapnik/node-mapnik/issues/262 log.info('package','packing ' + entry.path); return true; }; mkdirp(path.dirname(tarball),function(err) { if (err) throw err; pack(from, { filter: filter_func }) .pipe(write(tarball)) .on('error', function(err) { if (err) console.error('['+package_json.name+'] ' + err.message); return callback(err); }) .on('close', function() { log.info('package','Binary staged at "' + tarball + '"'); return callback(); }); }); }); }
joydesigner/MovieService
node_modules/fsevents/node_modules/node-pre-gyp/lib/package.js
JavaScript
mit
1,735
YUI.add('querystring-parse-simple', function (Y, NAME) { // @TODO this looks like we are requiring the user to extract the querystring // portion of the url, which isn't good. The majority use case will be to // extract querystring from the document configured for this YUI instance. // This should be the default if qs is not supplied. /*global Y */ /** * <p>Provides Y.QueryString.stringify method for converting objects to Query Strings. * This is a simpler implementation than the full querystring-stringify.</p> * <p>Because some things may require basic query string escaping functionality, * this module provides the bare minimum functionality (decoding a hash of simple values), * without the additional support for arrays, objects, and so on.</p> * <p>This provides a friendly way to deserialize basic query strings, without necessitating * a lot of code for simple use-cases.</p> * * @module querystring * @submodule querystring-parse-simple * @for QueryString * @static */ var QueryString = Y.namespace("QueryString"); /** * Provides Y.QueryString.parse method to accept Query Strings and return native * JavaScript objects. * * @module querystring * @submodule querystring-parse * @for QueryString * @method parse * @param qs {String} Querystring to be parsed into an object. * @param sep {String} (optional) Character that should join param k=v pairs together. Default: "&" * @param eq {String} (optional) Character that should join keys to their values. Default: "=" * @public * @static */ QueryString.parse = function (qs, sep, eq) { sep = sep || "&"; eq = eq || "="; for ( var obj = {}, i = 0, pieces = qs.split(sep), l = pieces.length, tuple; i < l; i ++ ) { tuple = pieces[i].split(eq); if (tuple.length > 0) { obj[QueryString.unescape(tuple.shift())] = QueryString.unescape(tuple.join(eq)); } } return obj; }; /** * Provides Y.QueryString.unescape method to be able to override default decoding * method. This is important in cases where non-standard delimiters are used, if * the delimiters would not normally be handled properly by the builtin * (en|de)codeURIComponent functions. * Default: replace "+" with " ", and then decodeURIComponent behavior. * @module querystring * @submodule querystring-parse * @for QueryString * @method unescape * @param s {String} String to be decoded. * @public * @static **/ QueryString.unescape = function (s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }; }, '@VERSION@', {"requires": ["yui-base"]});
pwnall/cdnjs
ajax/libs/yui/3.7.3/querystring-parse-simple/querystring-parse-simple.js
JavaScript
mit
2,651
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/Stateful",["./_base/declare","./_base/lang","./_base/array","./when"],function(_1,_2,_3,_4){ return _1("dojo.Stateful",null,{_attrPairNames:{},_getAttrNames:function(_5){ var _6=this._attrPairNames; if(_6[_5]){ return _6[_5]; } return (_6[_5]={s:"_"+_5+"Setter",g:"_"+_5+"Getter"}); },postscript:function(_7){ if(_7){ this.set(_7); } },_get:function(_8,_9){ return typeof this[_9.g]==="function"?this[_9.g]():this[_8]; },get:function(_a){ return this._get(_a,this._getAttrNames(_a)); },set:function(_b,_c){ if(typeof _b==="object"){ for(var x in _b){ if(_b.hasOwnProperty(x)&&x!="_watchCallbacks"){ this.set(x,_b[x]); } } return this; } var _d=this._getAttrNames(_b),_e=this._get(_b,_d),_f=this[_d.s],_10; if(typeof _f==="function"){ _10=_f.apply(this,Array.prototype.slice.call(arguments,1)); }else{ this[_b]=_c; } if(this._watchCallbacks){ var _11=this; _4(_10,function(){ _11._watchCallbacks(_b,_e,_c); }); } return this; },_changeAttrValue:function(_12,_13){ var _14=this.get(_12); this[_12]=_13; if(this._watchCallbacks){ this._watchCallbacks(_12,_14,_13); } return this; },watch:function(_15,_16){ var _17=this._watchCallbacks; if(!_17){ var _18=this; _17=this._watchCallbacks=function(_19,_1a,_1b,_1c){ var _1d=function(_1e){ if(_1e){ _1e=_1e.slice(); for(var i=0,l=_1e.length;i<l;i++){ _1e[i].call(_18,_19,_1a,_1b); } } }; _1d(_17["_"+_19]); if(!_1c){ _1d(_17["*"]); } }; } if(!_16&&typeof _15==="function"){ _16=_15; _15="*"; }else{ _15="_"+_15; } var _1f=_17[_15]; if(typeof _1f!=="object"){ _1f=_17[_15]=[]; } _1f.push(_16); var _20={}; _20.unwatch=_20.remove=function(){ var _21=_3.indexOf(_1f,_16); if(_21>-1){ _1f.splice(_21,1); } }; return _20; }}); });
dbeckwith/cdnjs
ajax/libs/dojo/1.9.3/Stateful.js
JavaScript
mit
1,888
YUI.add('charts-legend', function (Y, NAME) { /** * Adds legend functionality to charts. * * @module charts * @submodule charts-legend */ var DOCUMENT = Y.config.doc, TOP = "top", RIGHT = "right", BOTTOM = "bottom", LEFT = "left", EXTERNAL = "external", HORIZONTAL = "horizontal", VERTICAL = "vertical", WIDTH = "width", HEIGHT = "height", POSITION = "position", _X = "x", _Y = "y", PX = "px", LEGEND = { setter: function(val) { var legend = this.get("legend"); if(legend) { legend.destroy(true); } if(val instanceof Y.ChartLegend) { legend = val; legend.set("chart", this); } else { val.chart = this; if(!val.hasOwnProperty("render")) { val.render = this.get("contentBox"); val.includeInChartLayout = true; } legend = new Y.ChartLegend(val); } return legend; } }, /** * Contains methods for displaying items horizontally in a legend. * * @module charts * @submodule charts-legend * @class HorizontalLegendLayout */ HorizontalLegendLayout = { /** * Displays items horizontally in a legend. * * @method _positionLegendItems * @param {Array} items Array of items to display in the legend. * @param {Number} maxWidth The width of the largest item in the legend. * @param {Number} maxHeight The height of the largest item in the legend. * @param {Number} totalWidth The total width of all items in a legend. * @param {Number} totalHeight The total height of all items in a legend. * @param {Number} padding The left, top, right and bottom padding properties for the legend. * @param {Number} horizontalGap The horizontal distance between items in a legend. * @param {Number} verticalGap The vertical distance between items in a legend. * @param {String} hAlign The horizontal alignment of the legend. * @param {String} vAlign The vertical alignment of the legend. * @protected */ _positionLegendItems: function(items, maxWidth, maxHeight, totalWidth, totalHeight, padding, horizontalGap, verticalGap, hAlign, vAlign) { var i = 0, rowIterator = 0, item, node, itemWidth, itemHeight, len, width = this.get("width"), rows, rowsLen, row, totalWidthArray, legendWidth, topHeight = padding.top - verticalGap, limit = width - (padding.left + padding.right), left, top, right, bottom; HorizontalLegendLayout._setRowArrays(items, limit, horizontalGap); rows = HorizontalLegendLayout.rowArray; totalWidthArray = HorizontalLegendLayout.totalWidthArray; rowsLen = rows.length; for(; rowIterator < rowsLen; ++ rowIterator) { topHeight += verticalGap; row = rows[rowIterator]; len = row.length; legendWidth = HorizontalLegendLayout.getStartPoint(width, totalWidthArray[rowIterator], hAlign, padding); for(i = 0; i < len; ++i) { item = row[i]; node = item.node; itemWidth = item.width; itemHeight = item.height; item.x = legendWidth; item.y = 0; left = !isNaN(left) ? Math.min(left, legendWidth) : legendWidth; top = !isNaN(top) ? Math.min(top, topHeight) : topHeight; right = !isNaN(right) ? Math.max(legendWidth + itemWidth, right) : legendWidth + itemWidth; bottom = !isNaN(bottom) ? Math.max(topHeight + itemHeight, bottom) : topHeight + itemHeight; node.setStyle("left", legendWidth + PX); node.setStyle("top", topHeight + PX); legendWidth += itemWidth + horizontalGap; } topHeight += item.height; } this._contentRect = { left: left, top: top, right: right, bottom: bottom }; if(this.get("includeInChartLayout")) { this.set("height", topHeight + padding.bottom); } }, /** * Creates row and total width arrays used for displaying multiple rows of * legend items based on the items, available width and horizontalGap for the legend. * * @method _setRowArrays * @param {Array} items Array of legend items to display in a legend. * @param {Number} limit Total available width for displaying items in a legend. * @param {Number} horizontalGap Horizontal distance between items in a legend. * @protected */ _setRowArrays: function(items, limit, horizontalGap) { var item = items[0], rowArray = [[item]], i = 1, rowIterator = 0, len = items.length, totalWidth = item.width, itemWidth, totalWidthArray = [[totalWidth]]; for(; i < len; ++i) { item = items[i]; itemWidth = item.width; if((totalWidth + horizontalGap + itemWidth) <= limit) { totalWidth += horizontalGap + itemWidth; rowArray[rowIterator].push(item); } else { totalWidth = horizontalGap + itemWidth; if(rowArray[rowIterator]) { rowIterator += 1; } rowArray[rowIterator] = [item]; } totalWidthArray[rowIterator] = totalWidth; } HorizontalLegendLayout.rowArray = rowArray; HorizontalLegendLayout.totalWidthArray = totalWidthArray; }, /** * Returns the starting x-coordinate for a row of legend items. * * @method getStartPoint * @param {Number} w Width of the legend. * @param {Number} totalWidth Total width of all labels in the row. * @param {String} align Horizontal alignment of items for the legend. * @param {Object} padding Object contain left, top, right and bottom padding properties. * @return Number * @protected */ getStartPoint: function(w, totalWidth, align, padding) { var startPoint; switch(align) { case LEFT : startPoint = padding.left; break; case "center" : startPoint = (w - totalWidth) * 0.5; break; case RIGHT : startPoint = w - totalWidth - padding.right; break; } return startPoint; } }, /** * Contains methods for displaying items vertically in a legend. * * @module charts * @submodule charts-legend * @class VerticalLegendLayout */ VerticalLegendLayout = { /** * Displays items vertically in a legend. * * @method _positionLegendItems * @param {Array} items Array of items to display in the legend. * @param {Number} maxWidth The width of the largest item in the legend. * @param {Number} maxHeight The height of the largest item in the legend. * @param {Number} totalWidth The total width of all items in a legend. * @param {Number} totalHeight The total height of all items in a legend. * @param {Number} padding The left, top, right and bottom padding properties for the legend. * @param {Number} horizontalGap The horizontal distance between items in a legend. * @param {Number} verticalGap The vertical distance between items in a legend. * @param {String} hAlign The horizontal alignment of the legend. * @param {String} vAlign The vertical alignment of the legend. * @protected */ _positionLegendItems: function(items, maxWidth, maxHeight, totalWidth, totalHeight, padding, horizontalGap, verticalGap, hAlign, vAlign) { var i = 0, columnIterator = 0, item, node, itemHeight, itemWidth, len, height = this.get("height"), columns, columnsLen, column, totalHeightArray, legendHeight, leftWidth = padding.left - horizontalGap, legendWidth, limit = height - (padding.top + padding.bottom), left, top, right, bottom; VerticalLegendLayout._setColumnArrays(items, limit, verticalGap); columns = VerticalLegendLayout.columnArray; totalHeightArray = VerticalLegendLayout.totalHeightArray; columnsLen = columns.length; for(; columnIterator < columnsLen; ++ columnIterator) { leftWidth += horizontalGap; column = columns[columnIterator]; len = column.length; legendHeight = VerticalLegendLayout.getStartPoint(height, totalHeightArray[columnIterator], vAlign, padding); legendWidth = 0; for(i = 0; i < len; ++i) { item = column[i]; node = item.node; itemHeight = item.height; itemWidth = item.width; item.y = legendHeight; item.x = leftWidth; left = !isNaN(left) ? Math.min(left, leftWidth) : leftWidth; top = !isNaN(top) ? Math.min(top, legendHeight) : legendHeight; right = !isNaN(right) ? Math.max(leftWidth + itemWidth, right) : leftWidth + itemWidth; bottom = !isNaN(bottom) ? Math.max(legendHeight + itemHeight, bottom) : legendHeight + itemHeight; node.setStyle("left", leftWidth + PX); node.setStyle("top", legendHeight + PX); legendHeight += itemHeight + verticalGap; legendWidth = Math.max(legendWidth, item.width); } leftWidth += legendWidth; } this._contentRect = { left: left, top: top, right: right, bottom: bottom }; if(this.get("includeInChartLayout")) { this.set("width", leftWidth + padding.right); } }, /** * Creates column and total height arrays used for displaying multiple columns of * legend items based on the items, available height and verticalGap for the legend. * * @method _setColumnArrays * @param {Array} items Array of legend items to display in a legend. * @param {Number} limit Total available height for displaying items in a legend. * @param {Number} verticalGap Vertical distance between items in a legend. * @protected */ _setColumnArrays: function(items, limit, verticalGap) { var item = items[0], columnArray = [[item]], i = 1, columnIterator = 0, len = items.length, totalHeight = item.height, itemHeight, totalHeightArray = [[totalHeight]]; for(; i < len; ++i) { item = items[i]; itemHeight = item.height; if((totalHeight + verticalGap + itemHeight) <= limit) { totalHeight += verticalGap + itemHeight; columnArray[columnIterator].push(item); } else { totalHeight = verticalGap + itemHeight; if(columnArray[columnIterator]) { columnIterator += 1; } columnArray[columnIterator] = [item]; } totalHeightArray[columnIterator] = totalHeight; } VerticalLegendLayout.columnArray = columnArray; VerticalLegendLayout.totalHeightArray = totalHeightArray; }, /** * Returns the starting y-coordinate for a column of legend items. * * @method getStartPoint * @param {Number} h Height of the legend. * @param {Number} totalHeight Total height of all labels in the column. * @param {String} align Vertical alignment of items for the legend. * @param {Object} padding Object contain left, top, right and bottom padding properties. * @return Number * @protected */ getStartPoint: function(h, totalHeight, align, padding) { var startPoint; switch(align) { case TOP : startPoint = padding.top; break; case "middle" : startPoint = (h - totalHeight) * 0.5; break; case BOTTOM : startPoint = h - totalHeight - padding.bottom; break; } return startPoint; } }, CartesianChartLegend = Y.Base.create("cartesianChartLegend", Y.CartesianChart, [], { /** * Redraws and position all the components of the chart instance. * * @method _redraw * @private */ _redraw: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; var w = this.get("width"), h = this.get("height"), layoutBoxDimensions = this._getLayoutBoxDimensions(), leftPaneWidth = layoutBoxDimensions.left, rightPaneWidth = layoutBoxDimensions.right, topPaneHeight = layoutBoxDimensions.top, bottomPaneHeight = layoutBoxDimensions.bottom, leftAxesCollection = this.get("leftAxesCollection"), rightAxesCollection = this.get("rightAxesCollection"), topAxesCollection = this.get("topAxesCollection"), bottomAxesCollection = this.get("bottomAxesCollection"), i = 0, l, axis, graphOverflow = "visible", graph = this.get("graph"), topOverflow, bottomOverflow, leftOverflow, rightOverflow, graphWidth, graphHeight, graphX, graphY, allowContentOverflow = this.get("allowContentOverflow"), diff, rightAxesXCoords, leftAxesXCoords, topAxesYCoords, bottomAxesYCoords, legend = this.get("legend"), graphRect = {}; if(leftAxesCollection) { leftAxesXCoords = []; l = leftAxesCollection.length; for(i = l - 1; i > -1; --i) { leftAxesXCoords.unshift(leftPaneWidth); leftPaneWidth += leftAxesCollection[i].get("width"); } } if(rightAxesCollection) { rightAxesXCoords = []; l = rightAxesCollection.length; i = 0; for(i = l - 1; i > -1; --i) { rightPaneWidth += rightAxesCollection[i].get("width"); rightAxesXCoords.unshift(w - rightPaneWidth); } } if(topAxesCollection) { topAxesYCoords = []; l = topAxesCollection.length; for(i = l - 1; i > -1; --i) { topAxesYCoords.unshift(topPaneHeight); topPaneHeight += topAxesCollection[i].get("height"); } } if(bottomAxesCollection) { bottomAxesYCoords = []; l = bottomAxesCollection.length; for(i = l - 1; i > -1; --i) { bottomPaneHeight += bottomAxesCollection[i].get("height"); bottomAxesYCoords.unshift(h - bottomPaneHeight); } } graphWidth = w - (leftPaneWidth + rightPaneWidth); graphHeight = h - (bottomPaneHeight + topPaneHeight); graphRect.left = leftPaneWidth; graphRect.top = topPaneHeight; graphRect.bottom = h - bottomPaneHeight; graphRect.right = w - rightPaneWidth; if(!allowContentOverflow) { topOverflow = this._getTopOverflow(leftAxesCollection, rightAxesCollection); bottomOverflow = this._getBottomOverflow(leftAxesCollection, rightAxesCollection); leftOverflow = this._getLeftOverflow(bottomAxesCollection, topAxesCollection); rightOverflow = this._getRightOverflow(bottomAxesCollection, topAxesCollection); diff = topOverflow - topPaneHeight; if(diff > 0) { graphRect.top = topOverflow; if(topAxesYCoords) { i = 0; l = topAxesYCoords.length; for(; i < l; ++i) { topAxesYCoords[i] += diff; } } } diff = bottomOverflow - bottomPaneHeight; if(diff > 0) { graphRect.bottom = h - bottomOverflow; if(bottomAxesYCoords) { i = 0; l = bottomAxesYCoords.length; for(; i < l; ++i) { bottomAxesYCoords[i] -= diff; } } } diff = leftOverflow - leftPaneWidth; if(diff > 0) { graphRect.left = leftOverflow; if(leftAxesXCoords) { i = 0; l = leftAxesXCoords.length; for(; i < l; ++i) { leftAxesXCoords[i] += diff; } } } diff = rightOverflow - rightPaneWidth; if(diff > 0) { graphRect.right = w - rightOverflow; if(rightAxesXCoords) { i = 0; l = rightAxesXCoords.length; for(; i < l; ++i) { rightAxesXCoords[i] -= diff; } } } } graphWidth = graphRect.right - graphRect.left; graphHeight = graphRect.bottom - graphRect.top; graphX = graphRect.left; graphY = graphRect.top; if(legend) { if(legend.get("includeInChartLayout")) { switch(legend.get("position")) { case "left" : legend.set("y", graphY); legend.set("height", graphHeight); break; case "top" : legend.set("x", graphX); legend.set("width", graphWidth); break; case "bottom" : legend.set("x", graphX); legend.set("width", graphWidth); break; case "right" : legend.set("y", graphY); legend.set("height", graphHeight); break; } } } if(topAxesCollection) { l = topAxesCollection.length; i = 0; for(; i < l; i++) { axis = topAxesCollection[i]; if(axis.get("width") !== graphWidth) { axis.set("width", graphWidth); } axis.get("boundingBox").setStyle("left", graphX + PX); axis.get("boundingBox").setStyle("top", topAxesYCoords[i] + PX); } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(bottomAxesCollection) { l = bottomAxesCollection.length; i = 0; for(; i < l; i++) { axis = bottomAxesCollection[i]; if(axis.get("width") !== graphWidth) { axis.set("width", graphWidth); } axis.get("boundingBox").setStyle("left", graphX + PX); axis.get("boundingBox").setStyle("top", bottomAxesYCoords[i] + PX); } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(leftAxesCollection) { l = leftAxesCollection.length; i = 0; for(; i < l; ++i) { axis = leftAxesCollection[i]; axis.get("boundingBox").setStyle("top", graphY + PX); axis.get("boundingBox").setStyle("left", leftAxesXCoords[i] + PX); if(axis.get("height") !== graphHeight) { axis.set("height", graphHeight); } } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(rightAxesCollection) { l = rightAxesCollection.length; i = 0; for(; i < l; ++i) { axis = rightAxesCollection[i]; axis.get("boundingBox").setStyle("top", graphY + PX); axis.get("boundingBox").setStyle("left", rightAxesXCoords[i] + PX); if(axis.get("height") !== graphHeight) { axis.set("height", graphHeight); } } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } this._drawing = false; if(this._callLater) { this._redraw(); return; } if(graph) { graph.get("boundingBox").setStyle("left", graphX + PX); graph.get("boundingBox").setStyle("top", graphY + PX); graph.set("width", graphWidth); graph.set("height", graphHeight); graph.get("boundingBox").setStyle("overflow", graphOverflow); } if(this._overlay) { this._overlay.setStyle("left", graphX + PX); this._overlay.setStyle("top", graphY + PX); this._overlay.setStyle("width", graphWidth + PX); this._overlay.setStyle("height", graphHeight + PX); } }, /** * Positions the legend in a chart and returns the properties of the legend to be used in the * chart's layout algorithm. * * @method _getLayoutDimensions * @return {Object} The left, top, right and bottom values for the legend. * @protected */ _getLayoutBoxDimensions: function() { var box = { top: 0, right: 0, bottom: 0, left: 0 }, legend = this.get("legend"), position, direction, dimension, size, w = this.get(WIDTH), h = this.get(HEIGHT), gap; if(legend && legend.get("includeInChartLayout")) { gap = legend.get("styles").gap; position = legend.get(POSITION); if(position != EXTERNAL) { direction = legend.get("direction"); dimension = direction == HORIZONTAL ? HEIGHT : WIDTH; size = legend.get(dimension); box[position] = size + gap; switch(position) { case TOP : legend.set(_Y, 0); break; case BOTTOM : legend.set(_Y, h - size); break; case RIGHT : legend.set(_X, w - size); break; case LEFT: legend.set(_X, 0); break; } } } return box; }, /** * Destructor implementation for the CartesianChart class. Calls destroy on all axes, series, legend (if available) and the Graph instance. * Removes the tooltip and overlay HTML elements. * * @method destructor * @protected */ destructor: function() { var legend = this.get("legend"); if(legend) { legend.destroy(true); } } }, { ATTRS: { legend: LEGEND } }); Y.CartesianChart = CartesianChartLegend; var PieChartLegend = Y.Base.create("pieChartLegend", Y.PieChart, [], { /** * Redraws the chart instance. * * @method _redraw * @private */ _redraw: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; var graph = this.get("graph"), w = this.get("width"), h = this.get("height"), graphWidth, graphHeight, legend = this.get("legend"), x = 0, y = 0, legendX = 0, legendY = 0, legendWidth, legendHeight, dimension, gap, position, direction; if(graph) { if(legend) { position = legend.get("position"); direction = legend.get("direction"); graphWidth = graph.get("width"); graphHeight = graph.get("height"); legendWidth = legend.get("width"); legendHeight = legend.get("height"); gap = legend.get("styles").gap; if((direction == "vertical" && (graphWidth + legendWidth + gap !== w)) || (direction == "horizontal" && (graphHeight + legendHeight + gap !== h))) { switch(legend.get("position")) { case LEFT : dimension = Math.min(w - (legendWidth + gap), h); legendHeight = h; x = legendWidth + gap; legend.set(HEIGHT, legendHeight); break; case TOP : dimension = Math.min(h - (legendHeight + gap), w); legendWidth = w; y = legendHeight + gap; legend.set(WIDTH, legendWidth); break; case RIGHT : dimension = Math.min(w - (legendWidth + gap), h); legendHeight = h; legendX = dimension + gap; legend.set(HEIGHT, legendHeight); break; case BOTTOM : dimension = Math.min(h - (legendHeight + gap), w); legendWidth = w; legendY = dimension + gap; legend.set(WIDTH, legendWidth); break; } graph.set(WIDTH, dimension); graph.set(HEIGHT, dimension); } else { switch(legend.get("position")) { case LEFT : x = legendWidth + gap; break; case TOP : y = legendHeight + gap; break; case RIGHT : legendX = graphWidth + gap; break; case BOTTOM : legendY = graphHeight + gap; break; } } } else { graph.set(_X, 0); graph.set(_Y, 0); graph.set(WIDTH, w); graph.set(HEIGHT, h); } } this._drawing = false; if(this._callLater) { this._redraw(); return; } if(graph) { graph.set(_X, x); graph.set(_Y, y); } if(legend) { legend.set(_X, legendX); legend.set(_Y, legendY); } } }, { ATTRS: { /** * The legend for the chart. * * @attribute * @type Legend */ legend: LEGEND } }); Y.PieChart = PieChartLegend; /** * ChartLegend provides a legend for a chart. * * @class ChartLegend * @module charts * @submodule charts-legend * @extends Widget */ Y.ChartLegend = Y.Base.create("chartlegend", Y.Widget, [Y.Renderer], { /** * Initializes the chart. * * @method initializer * @private */ initializer: function() { this._items = []; }, /** * @method renderUI * @private */ renderUI: function() { var bb = this.get("boundingBox"), cb = this.get("contentBox"), styles = this.get("styles").background, background = new Y.Rect({ graphic: cb, fill: styles.fill, stroke: styles.border }); bb.setStyle("display", "block"); bb.setStyle("position", "absolute"); this.set("background", background); }, /** * @method bindUI * @private */ bindUI: function() { this.get("chart").after("seriesCollectionChange", Y.bind(this._updateHandler, this)); this.after("stylesChange", this._updateHandler); this.after("positionChange", this._positionChangeHandler); this.after("widthChange", this._handleSizeChange); this.after("heightChange", this._handleSizeChange); }, /** * @method syncUI * @private */ syncUI: function() { var w = this.get("width"), h = this.get("height"); if(isFinite(w) && isFinite(h) && w > 0 && h > 0) { this._drawLegend(); } }, /** * Handles changes to legend. * * @method _updateHandler * @param {Object} e Event object * @private */ _updateHandler: function(e) { if(this.get("rendered")) { this._drawLegend(); } }, /** * Handles position changes. * * @method _positionChangeHandler * @param {Object} e Event object * @private */ _positionChangeHandler: function(e) { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode && ((chart && this.get("includeInChartLayout")))) { this.fire("legendRendered"); } else if(this.get("rendered")) { this._drawLegend(); } }, /** * Updates the legend when the size changes. * * @method _handleSizeChange * @param {Object} e Event object. * @private */ _handleSizeChange: function(e) { var attrName = e.attrName, pos = this.get(POSITION), vert = pos == LEFT || pos == RIGHT, hor = pos == BOTTOM || pos == TOP; if((hor && attrName == WIDTH) || (vert && attrName == HEIGHT)) { this._drawLegend(); } }, /** * Draws the legend * * @method _drawLegend * @private */ _drawLegend: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; if(this.get("includeInChartLayout")) { this.get("chart")._itemRenderQueue.unshift(this); } var chart = this.get("chart"), node = this.get("contentBox"), seriesCollection = chart.get("seriesCollection"), series, styles = this.get("styles"), padding = styles.padding, itemStyles = styles.item, seriesStyles, hSpacing = itemStyles.hSpacing, vSpacing = itemStyles.vSpacing, hAlign = styles.hAlign, vAlign = styles.vAlign, marker = styles.marker, labelStyles = itemStyles.label, displayName, layout = this._layout[this.get("direction")], i, len, isArray, shape, shapeClass, item, fill, border, fillColors, borderColors, borderWeight, items = [], markerWidth = marker.width, markerHeight = marker.height, totalWidth = 0 - hSpacing, totalHeight = 0 - vSpacing, maxWidth = 0, maxHeight = 0, itemWidth, itemHeight; if(marker && marker.shape) { shape = marker.shape; } this._destroyLegendItems(); if(chart instanceof Y.PieChart) { series = seriesCollection[0]; displayName = series.get("categoryAxis").getDataByKey(series.get("categoryKey")); seriesStyles = series.get("styles").marker; fillColors = seriesStyles.fill.colors; borderColors = seriesStyles.border.colors; borderWeight = seriesStyles.border.weight; i = 0; len = displayName.length; shape = shape || Y.Circle; isArray = Y.Lang.isArray(shape); for(; i < len; ++i) { shape = isArray ? shape[i] : shape; fill = { color: fillColors[i] }; border = { colors: borderColors[i], weight: borderWeight }; displayName = chart.getSeriesItems(series, i).category.value; item = this._getLegendItem(node, this._getShapeClass(shape), fill, border, labelStyles, markerWidth, markerHeight, displayName); itemWidth = item.width; itemHeight = item.height; maxWidth = Math.max(maxWidth, itemWidth); maxHeight = Math.max(maxHeight, itemHeight); totalWidth += itemWidth + hSpacing; totalHeight += itemHeight + vSpacing; items.push(item); } } else { i = 0; len = seriesCollection.length; for(; i < len; ++i) { series = seriesCollection[i]; seriesStyles = this._getStylesBySeriesType(series, shape); if(!shape) { shape = seriesStyles.shape; if(!shape) { shape = Y.Circle; } } shapeClass = Y.Lang.isArray(shape) ? shape[i] : shape; item = this._getLegendItem(node, this._getShapeClass(shape), seriesStyles.fill, seriesStyles.border, labelStyles, markerWidth, markerHeight, series.get("valueDisplayName")); itemWidth = item.width; itemHeight = item.height; maxWidth = Math.max(maxWidth, itemWidth); maxHeight = Math.max(maxHeight, itemHeight); totalWidth += itemWidth + hSpacing; totalHeight += itemHeight + vSpacing; items.push(item); } } this._drawing = false; if(this._callLater) { this._drawLegend(); } else { layout._positionLegendItems.apply(this, [items, maxWidth, maxHeight, totalWidth, totalHeight, padding, hSpacing, vSpacing, hAlign, vAlign]); this._updateBackground(styles); this.fire("legendRendered"); } }, /** * Updates the background for the legend. * * @method _updateBackground * @param {Object} styles Reference to the legend's styles attribute * @private */ _updateBackground: function(styles) { var backgroundStyles = styles.background, contentRect = this._contentRect, padding = styles.padding, x = contentRect.left - padding.left, y = contentRect.top - padding.top, w = contentRect.right - x + padding.right, h = contentRect.bottom - y + padding.bottom; this.get("background").set({ fill: backgroundStyles.fill, stroke: backgroundStyles.border, width: w, height: h, x: x, y: y }); }, /** * Retrieves the marker styles based on the type of series. For series that contain a marker, the marker styles are returned. * * @method _getStylesBySeriesType * @param {CartesianSeries | PieSeries} The series in which the style properties will be received. * @return Object An object containing fill, border and shape information. * @private */ _getStylesBySeriesType: function(series) { var styles = series.get("styles"), color; if(series instanceof Y.LineSeries || series instanceof Y.StackedLineSeries) { styles = series.get("styles").line; color = styles.color || series._getDefaultColor(series.get("graphOrder"), "line"); return { border: { weight: 1, color: color }, fill: { color: color } }; } else if(series instanceof Y.AreaSeries || series instanceof Y.StackedAreaSeries) { styles = series.get("styles").area; color = styles.color || series._getDefaultColor(series.get("graphOrder"), "slice"); return { border: { weight: 1, color: color }, fill: { color: color } }; } else { styles = series.get("styles").marker; return { fill: styles.fill, border: { weight: styles.border.weight, color: styles.border.color, shape: styles.shape }, shape: styles.shape }; } }, /** * Returns a legend item consisting of the following properties: * <dl> * <dt>node</dt><dd>The `Node` containing the legend item elements.</dd> * <dt>shape</dt><dd>The `Shape` element for the legend item.</dd> * <dt>textNode</dt><dd>The `Node` containing the text></dd> * <dt>text</dt><dd></dd> * </dl> * * @method _getLegendItem * @param {Node} shapeProps Reference to the `node` attribute. * @param {String | Class} shapeClass The type of shape * @param {Object} fill Properties for the shape's fill * @param {Object} border Properties for the shape's border * @param {String} text String to be rendered as the legend's text * @param {Number} width Total width of the legend item * @param {Number} height Total height of the legend item * @param {HTML | String} text Text for the legendItem * @return Object * @private */ _getLegendItem: function(node, shapeClass, fill, border, labelStyles, w, h, text) { var containerNode = Y.one(DOCUMENT.createElement("div")), textField = Y.one(DOCUMENT.createElement("span")), shape, dimension, padding, left, item; containerNode.setStyle(POSITION, "absolute"); textField.setStyle(POSITION, "absolute"); textField.setStyles(labelStyles); textField.appendChild(DOCUMENT.createTextNode(text)); containerNode.appendChild(textField); node.appendChild(containerNode); dimension = textField.get("offsetHeight"); padding = dimension - h; left = w + padding + 2; textField.setStyle("left", left + PX); containerNode.setStyle("height", dimension + PX); containerNode.setStyle("width", (left + textField.get("offsetWidth")) + PX); shape = new shapeClass({ fill: fill, stroke: border, width: w, height: h, x: padding * 0.5, y: padding * 0.5, w: w, h: h, graphic: containerNode }); textField.setStyle("left", dimension + PX); item = { node: containerNode, width: containerNode.get("offsetWidth"), height: containerNode.get("offsetHeight"), shape: shape, textNode: textField, text: text }; this._items.push(item); return item; }, /** * Evaluates and returns correct class for drawing a shape. * * @method _getShapeClass * @return Shape * @private */ _getShapeClass: function() { var graphic = this.get("background").get("graphic"); return graphic._getShapeClass.apply(graphic, arguments); }, /** * Returns the default hash for the `styles` attribute. * * @method _getDefaultStyles * @return Object * @protected */ _getDefaultStyles: function() { var styles = { padding: { top: 8, right: 8, bottom: 8, left: 9 }, gap: 10, hAlign: "center", vAlign: "top", marker: this._getPlotDefaults(), item: { hSpacing: 10, vSpacing: 5, label: { color:"#808080", fontSize:"85%", whiteSpace: "nowrap" } }, background: { shape: "rect", fill:{ color:"#faf9f2" }, border: { color:"#dad8c9", weight: 1 } } }; return styles; }, /** * Gets the default values for series that use the utility. This method is used by * the class' `styles` attribute's getter to get build default values. * * @method _getPlotDefaults * @return Object * @protected */ _getPlotDefaults: function() { var defs = { width: 10, height: 10 }; return defs; }, /** * Destroys legend items. * * @method _destroyLegendItems * @private */ _destroyLegendItems: function() { var item; if(this._items) { while(this._items.length > 0) { item = this._items.shift(); item.shape.get("graphic").destroy(); item.node.empty(); item.node.destroy(true); item.node = null; item = null; } } this._items = []; }, /** * Maps layout classes. * * @property _layout * @private */ _layout: { vertical: VerticalLegendLayout, horizontal: HorizontalLegendLayout }, /** * Destructor implementation ChartLegend class. Removes all items and the Graphic instance from the widget. * * @method destructor * @protected */ destructor: function() { var background = this.get("background"), backgroundGraphic; this._destroyLegendItems(); if(background) { backgroundGraphic = background.get("graphic"); if(backgroundGraphic) { backgroundGraphic.destroy(); } else { background.destroy(); } } } }, { ATTRS: { /** * Indicates whether the chart's contentBox is the parentNode for the legend. * * @attribute includeInChartLayout * @type Boolean * @private */ includeInChartLayout: { value: false }, /** * Reference to the `Chart` instance. * * @attribute chart * @type Chart */ chart: { setter: function(val) { this.after("legendRendered", Y.bind(val._itemRendered, val)); return val; } }, /** * Indicates the direction in relation of the legend's layout. The `direction` of the legend is determined by its * `position` value. * * @attribute direction * @type String */ direction: { value: "vertical" }, /** * Indicates the position and direction of the legend. Possible values are `left`, `top`, `right` and `bottom`. Values of `left` and * `right` values have a `direction` of `vertical`. Values of `top` and `bottom` values have a `direction` of `horizontal`. * * @attribute position * @type String */ position: { lazyAdd: false, value: "right", setter: function(val) { if(val == TOP || val == BOTTOM) { this.set("direction", HORIZONTAL); } else if(val == LEFT || val == RIGHT) { this.set("direction", VERTICAL); } return val; } }, /** * The width of the legend. Depending on the implementation of the ChartLegend, this value is `readOnly`. By default, the legend is included in the layout of the `Chart` that * it references. Under this circumstance, `width` is always `readOnly`. When the legend is rendered in its own dom element, the `readOnly` status is determined by the * direction of the legend. If the `position` is `left` or `right` or the `direction` is `vertical`, width is `readOnly`. If the position is `top` or `bottom` or the `direction` * is `horizontal`, width can be explicitly set. If width is not explicitly set, the width will be determined by the width of the legend's parent element. * * @attribute width * @type Number */ width: { getter: function() { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode) { if((chart && this.get("includeInChartLayout")) || this._width) { if(!this._width) { this._width = 0; } return this._width; } else { return parentNode.get("offsetWidth"); } } return ""; }, setter: function(val) { this._width = val; return val; } }, /** * The height of the legend. Depending on the implementation of the ChartLegend, this value is `readOnly`. By default, the legend is included in the layout of the `Chart` that * it references. Under this circumstance, `height` is always `readOnly`. When the legend is rendered in its own dom element, the `readOnly` status is determined by the * direction of the legend. If the `position` is `top` or `bottom` or the `direction` is `horizontal`, height is `readOnly`. If the position is `left` or `right` or the `direction` * is `vertical`, height can be explicitly set. If height is not explicitly set, the height will be determined by the width of the legend's parent element. * * @attribute height * @type Number */ height: { valueFn: "_heightGetter", getter: function() { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode) { if((chart && this.get("includeInChartLayout")) || this._height) { if(!this._height) { this._height = 0; } return this._height; } else { return parentNode.get("offsetHeight"); } } return ""; }, setter: function(val) { this._height = val; return val; } }, /** * Indicates the x position of legend. * * @attribute x * @type Number * @readOnly */ x: { lazyAdd: false, value: 0, setter: function(val) { var node = this.get("boundingBox"); if(node) { node.setStyle(LEFT, val + PX); } return val; } }, /** * Indicates the y position of legend. * * @attribute y * @type Number * @readOnly */ y: { lazyAdd: false, value: 0, setter: function(val) { var node = this.get("boundingBox"); if(node) { node.setStyle(TOP, val + PX); } return val; } }, /** * Array of items contained in the legend. Each item is an object containing the following properties: * * <dl> * <dt>node</dt><dd>Node containing text for the legend item.</dd> * <dt>marker</dt><dd>Shape for the legend item.</dd> * </dl> * * @attribute items * @type Array * @readOnly */ items: { getter: function() { return this._items; } }, /** * Background for the legend. * * @attribute background * @type Rect */ background: {} /** * Properties used to display and style the ChartLegend. This attribute is inherited from `Renderer`. Below are the default values: * * <dl> * <dt>gap</dt><dd>Distance, in pixels, between the `ChartLegend` instance and the chart's content. When `ChartLegend` is rendered within a `Chart` instance this value is applied.</dd> * <dt>hAlign</dt><dd>Defines the horizontal alignment of the `items` in a `ChartLegend` rendered in a horizontal direction. This value is applied when the instance's `position` is set to top or bottom. This attribute can be set to left, center or right. The default value is center.</dd> * <dt>vAlign</dt><dd>Defines the vertical alignment of the `items` in a `ChartLegend` rendered in vertical direction. This value is applied when the instance's `position` is set to left or right. The attribute can be set to top, middle or bottom. The default value is middle.</dd> * <dt>item</dt><dd>Set of style properties applied to the `items` of the `ChartLegend`. * <dl> * <dt>hSpacing</dt><dd>Horizontal distance, in pixels, between legend `items`.</dd> * <dt>vSpacing</dt><dd>Vertical distance, in pixels, between legend `items`.</dd> * <dt>label</dt><dd>Properties for the text of an `item`. * <dl> * <dt>color</dt><dd>Color of the text. The default values is "#808080".</dd> * <dt>fontSize</dt><dd>Font size for the text. The default value is "85%".</dd> * </dl> * </dd> * <dt>marker</dt><dd>Properties for the `item` markers. * <dl> * <dt>width</dt><dd>Specifies the width of the markers.</dd> * <dt>height</dt><dd>Specifies the height of the markers.</dd> * </dl> * </dd> * </dl> * </dd> * <dt>background</dt><dd>Properties for the `ChartLegend` background. * <dl> * <dt>fill</dt><dd>Properties for the background fill. * <dl> * <dt>color</dt><dd>Color for the fill. The default value is "#faf9f2".</dd> * </dl> * </dd> * <dt>border</dt><dd>Properties for the background border. * <dl> * <dt>color</dt><dd>Color for the border. The default value is "#dad8c9".</dd> * <dt>weight</dt><dd>Weight of the border. The default values is 1.</dd> * </dl> * </dd> * </dl> * </dd> * </dl> * * @attribute styles * @type Object */ } }); /** * The Chart class is the basic application used to create a chart. * * @module charts * @class Chart * @constructor */ function Chart(cfg) { if(cfg.type != "pie") { return new Y.CartesianChart(cfg); } else { return new Y.PieChart(cfg); } } Y.Chart = Chart; }, '@VERSION@', {"requires": ["charts-base"]});
SirenHound/cdnjs
ajax/libs/yui/3.7.3/charts-legend/charts-legend-debug.js
JavaScript
mit
55,043
YUI.add('charts-legend', function (Y, NAME) { /** * Adds legend functionality to charts. * * @module charts * @submodule charts-legend */ var DOCUMENT = Y.config.doc, TOP = "top", RIGHT = "right", BOTTOM = "bottom", LEFT = "left", EXTERNAL = "external", HORIZONTAL = "horizontal", VERTICAL = "vertical", WIDTH = "width", HEIGHT = "height", POSITION = "position", _X = "x", _Y = "y", PX = "px", LEGEND = { setter: function(val) { var legend = this.get("legend"); if(legend) { legend.destroy(true); } if(val instanceof Y.ChartLegend) { legend = val; legend.set("chart", this); } else { val.chart = this; if(!val.hasOwnProperty("render")) { val.render = this.get("contentBox"); val.includeInChartLayout = true; } legend = new Y.ChartLegend(val); } return legend; } }, /** * Contains methods for displaying items horizontally in a legend. * * @module charts * @submodule charts-legend * @class HorizontalLegendLayout */ HorizontalLegendLayout = { /** * Displays items horizontally in a legend. * * @method _positionLegendItems * @param {Array} items Array of items to display in the legend. * @param {Number} maxWidth The width of the largest item in the legend. * @param {Number} maxHeight The height of the largest item in the legend. * @param {Number} totalWidth The total width of all items in a legend. * @param {Number} totalHeight The total height of all items in a legend. * @param {Number} padding The left, top, right and bottom padding properties for the legend. * @param {Number} horizontalGap The horizontal distance between items in a legend. * @param {Number} verticalGap The vertical distance between items in a legend. * @param {String} hAlign The horizontal alignment of the legend. * @param {String} vAlign The vertical alignment of the legend. * @protected */ _positionLegendItems: function(items, maxWidth, maxHeight, totalWidth, totalHeight, padding, horizontalGap, verticalGap, hAlign, vAlign) { var i = 0, rowIterator = 0, item, node, itemWidth, itemHeight, len, width = this.get("width"), rows, rowsLen, row, totalWidthArray, legendWidth, topHeight = padding.top - verticalGap, limit = width - (padding.left + padding.right), left, top, right, bottom; HorizontalLegendLayout._setRowArrays(items, limit, horizontalGap); rows = HorizontalLegendLayout.rowArray; totalWidthArray = HorizontalLegendLayout.totalWidthArray; rowsLen = rows.length; for(; rowIterator < rowsLen; ++ rowIterator) { topHeight += verticalGap; row = rows[rowIterator]; len = row.length; legendWidth = HorizontalLegendLayout.getStartPoint(width, totalWidthArray[rowIterator], hAlign, padding); for(i = 0; i < len; ++i) { item = row[i]; node = item.node; itemWidth = item.width; itemHeight = item.height; item.x = legendWidth; item.y = 0; left = !isNaN(left) ? Math.min(left, legendWidth) : legendWidth; top = !isNaN(top) ? Math.min(top, topHeight) : topHeight; right = !isNaN(right) ? Math.max(legendWidth + itemWidth, right) : legendWidth + itemWidth; bottom = !isNaN(bottom) ? Math.max(topHeight + itemHeight, bottom) : topHeight + itemHeight; node.setStyle("left", legendWidth + PX); node.setStyle("top", topHeight + PX); legendWidth += itemWidth + horizontalGap; } topHeight += item.height; } this._contentRect = { left: left, top: top, right: right, bottom: bottom }; if(this.get("includeInChartLayout")) { this.set("height", topHeight + padding.bottom); } }, /** * Creates row and total width arrays used for displaying multiple rows of * legend items based on the items, available width and horizontalGap for the legend. * * @method _setRowArrays * @param {Array} items Array of legend items to display in a legend. * @param {Number} limit Total available width for displaying items in a legend. * @param {Number} horizontalGap Horizontal distance between items in a legend. * @protected */ _setRowArrays: function(items, limit, horizontalGap) { var item = items[0], rowArray = [[item]], i = 1, rowIterator = 0, len = items.length, totalWidth = item.width, itemWidth, totalWidthArray = [[totalWidth]]; for(; i < len; ++i) { item = items[i]; itemWidth = item.width; if((totalWidth + horizontalGap + itemWidth) <= limit) { totalWidth += horizontalGap + itemWidth; rowArray[rowIterator].push(item); } else { totalWidth = horizontalGap + itemWidth; if(rowArray[rowIterator]) { rowIterator += 1; } rowArray[rowIterator] = [item]; } totalWidthArray[rowIterator] = totalWidth; } HorizontalLegendLayout.rowArray = rowArray; HorizontalLegendLayout.totalWidthArray = totalWidthArray; }, /** * Returns the starting x-coordinate for a row of legend items. * * @method getStartPoint * @param {Number} w Width of the legend. * @param {Number} totalWidth Total width of all labels in the row. * @param {String} align Horizontal alignment of items for the legend. * @param {Object} padding Object contain left, top, right and bottom padding properties. * @return Number * @protected */ getStartPoint: function(w, totalWidth, align, padding) { var startPoint; switch(align) { case LEFT : startPoint = padding.left; break; case "center" : startPoint = (w - totalWidth) * 0.5; break; case RIGHT : startPoint = w - totalWidth - padding.right; break; } return startPoint; } }, /** * Contains methods for displaying items vertically in a legend. * * @module charts * @submodule charts-legend * @class VerticalLegendLayout */ VerticalLegendLayout = { /** * Displays items vertically in a legend. * * @method _positionLegendItems * @param {Array} items Array of items to display in the legend. * @param {Number} maxWidth The width of the largest item in the legend. * @param {Number} maxHeight The height of the largest item in the legend. * @param {Number} totalWidth The total width of all items in a legend. * @param {Number} totalHeight The total height of all items in a legend. * @param {Number} padding The left, top, right and bottom padding properties for the legend. * @param {Number} horizontalGap The horizontal distance between items in a legend. * @param {Number} verticalGap The vertical distance between items in a legend. * @param {String} hAlign The horizontal alignment of the legend. * @param {String} vAlign The vertical alignment of the legend. * @protected */ _positionLegendItems: function(items, maxWidth, maxHeight, totalWidth, totalHeight, padding, horizontalGap, verticalGap, hAlign, vAlign) { var i = 0, columnIterator = 0, item, node, itemHeight, itemWidth, len, height = this.get("height"), columns, columnsLen, column, totalHeightArray, legendHeight, leftWidth = padding.left - horizontalGap, legendWidth, limit = height - (padding.top + padding.bottom), left, top, right, bottom; VerticalLegendLayout._setColumnArrays(items, limit, verticalGap); columns = VerticalLegendLayout.columnArray; totalHeightArray = VerticalLegendLayout.totalHeightArray; columnsLen = columns.length; for(; columnIterator < columnsLen; ++ columnIterator) { leftWidth += horizontalGap; column = columns[columnIterator]; len = column.length; legendHeight = VerticalLegendLayout.getStartPoint(height, totalHeightArray[columnIterator], vAlign, padding); legendWidth = 0; for(i = 0; i < len; ++i) { item = column[i]; node = item.node; itemHeight = item.height; itemWidth = item.width; item.y = legendHeight; item.x = leftWidth; left = !isNaN(left) ? Math.min(left, leftWidth) : leftWidth; top = !isNaN(top) ? Math.min(top, legendHeight) : legendHeight; right = !isNaN(right) ? Math.max(leftWidth + itemWidth, right) : leftWidth + itemWidth; bottom = !isNaN(bottom) ? Math.max(legendHeight + itemHeight, bottom) : legendHeight + itemHeight; node.setStyle("left", leftWidth + PX); node.setStyle("top", legendHeight + PX); legendHeight += itemHeight + verticalGap; legendWidth = Math.max(legendWidth, item.width); } leftWidth += legendWidth; } this._contentRect = { left: left, top: top, right: right, bottom: bottom }; if(this.get("includeInChartLayout")) { this.set("width", leftWidth + padding.right); } }, /** * Creates column and total height arrays used for displaying multiple columns of * legend items based on the items, available height and verticalGap for the legend. * * @method _setColumnArrays * @param {Array} items Array of legend items to display in a legend. * @param {Number} limit Total available height for displaying items in a legend. * @param {Number} verticalGap Vertical distance between items in a legend. * @protected */ _setColumnArrays: function(items, limit, verticalGap) { var item = items[0], columnArray = [[item]], i = 1, columnIterator = 0, len = items.length, totalHeight = item.height, itemHeight, totalHeightArray = [[totalHeight]]; for(; i < len; ++i) { item = items[i]; itemHeight = item.height; if((totalHeight + verticalGap + itemHeight) <= limit) { totalHeight += verticalGap + itemHeight; columnArray[columnIterator].push(item); } else { totalHeight = verticalGap + itemHeight; if(columnArray[columnIterator]) { columnIterator += 1; } columnArray[columnIterator] = [item]; } totalHeightArray[columnIterator] = totalHeight; } VerticalLegendLayout.columnArray = columnArray; VerticalLegendLayout.totalHeightArray = totalHeightArray; }, /** * Returns the starting y-coordinate for a column of legend items. * * @method getStartPoint * @param {Number} h Height of the legend. * @param {Number} totalHeight Total height of all labels in the column. * @param {String} align Vertical alignment of items for the legend. * @param {Object} padding Object contain left, top, right and bottom padding properties. * @return Number * @protected */ getStartPoint: function(h, totalHeight, align, padding) { var startPoint; switch(align) { case TOP : startPoint = padding.top; break; case "middle" : startPoint = (h - totalHeight) * 0.5; break; case BOTTOM : startPoint = h - totalHeight - padding.bottom; break; } return startPoint; } }, CartesianChartLegend = Y.Base.create("cartesianChartLegend", Y.CartesianChart, [], { /** * Redraws and position all the components of the chart instance. * * @method _redraw * @private */ _redraw: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; var w = this.get("width"), h = this.get("height"), layoutBoxDimensions = this._getLayoutBoxDimensions(), leftPaneWidth = layoutBoxDimensions.left, rightPaneWidth = layoutBoxDimensions.right, topPaneHeight = layoutBoxDimensions.top, bottomPaneHeight = layoutBoxDimensions.bottom, leftAxesCollection = this.get("leftAxesCollection"), rightAxesCollection = this.get("rightAxesCollection"), topAxesCollection = this.get("topAxesCollection"), bottomAxesCollection = this.get("bottomAxesCollection"), i = 0, l, axis, graphOverflow = "visible", graph = this.get("graph"), topOverflow, bottomOverflow, leftOverflow, rightOverflow, graphWidth, graphHeight, graphX, graphY, allowContentOverflow = this.get("allowContentOverflow"), diff, rightAxesXCoords, leftAxesXCoords, topAxesYCoords, bottomAxesYCoords, legend = this.get("legend"), graphRect = {}; if(leftAxesCollection) { leftAxesXCoords = []; l = leftAxesCollection.length; for(i = l - 1; i > -1; --i) { leftAxesXCoords.unshift(leftPaneWidth); leftPaneWidth += leftAxesCollection[i].get("width"); } } if(rightAxesCollection) { rightAxesXCoords = []; l = rightAxesCollection.length; i = 0; for(i = l - 1; i > -1; --i) { rightPaneWidth += rightAxesCollection[i].get("width"); rightAxesXCoords.unshift(w - rightPaneWidth); } } if(topAxesCollection) { topAxesYCoords = []; l = topAxesCollection.length; for(i = l - 1; i > -1; --i) { topAxesYCoords.unshift(topPaneHeight); topPaneHeight += topAxesCollection[i].get("height"); } } if(bottomAxesCollection) { bottomAxesYCoords = []; l = bottomAxesCollection.length; for(i = l - 1; i > -1; --i) { bottomPaneHeight += bottomAxesCollection[i].get("height"); bottomAxesYCoords.unshift(h - bottomPaneHeight); } } graphWidth = w - (leftPaneWidth + rightPaneWidth); graphHeight = h - (bottomPaneHeight + topPaneHeight); graphRect.left = leftPaneWidth; graphRect.top = topPaneHeight; graphRect.bottom = h - bottomPaneHeight; graphRect.right = w - rightPaneWidth; if(!allowContentOverflow) { topOverflow = this._getTopOverflow(leftAxesCollection, rightAxesCollection); bottomOverflow = this._getBottomOverflow(leftAxesCollection, rightAxesCollection); leftOverflow = this._getLeftOverflow(bottomAxesCollection, topAxesCollection); rightOverflow = this._getRightOverflow(bottomAxesCollection, topAxesCollection); diff = topOverflow - topPaneHeight; if(diff > 0) { graphRect.top = topOverflow; if(topAxesYCoords) { i = 0; l = topAxesYCoords.length; for(; i < l; ++i) { topAxesYCoords[i] += diff; } } } diff = bottomOverflow - bottomPaneHeight; if(diff > 0) { graphRect.bottom = h - bottomOverflow; if(bottomAxesYCoords) { i = 0; l = bottomAxesYCoords.length; for(; i < l; ++i) { bottomAxesYCoords[i] -= diff; } } } diff = leftOverflow - leftPaneWidth; if(diff > 0) { graphRect.left = leftOverflow; if(leftAxesXCoords) { i = 0; l = leftAxesXCoords.length; for(; i < l; ++i) { leftAxesXCoords[i] += diff; } } } diff = rightOverflow - rightPaneWidth; if(diff > 0) { graphRect.right = w - rightOverflow; if(rightAxesXCoords) { i = 0; l = rightAxesXCoords.length; for(; i < l; ++i) { rightAxesXCoords[i] -= diff; } } } } graphWidth = graphRect.right - graphRect.left; graphHeight = graphRect.bottom - graphRect.top; graphX = graphRect.left; graphY = graphRect.top; if(legend) { if(legend.get("includeInChartLayout")) { switch(legend.get("position")) { case "left" : legend.set("y", graphY); legend.set("height", graphHeight); break; case "top" : legend.set("x", graphX); legend.set("width", graphWidth); break; case "bottom" : legend.set("x", graphX); legend.set("width", graphWidth); break; case "right" : legend.set("y", graphY); legend.set("height", graphHeight); break; } } } if(topAxesCollection) { l = topAxesCollection.length; i = 0; for(; i < l; i++) { axis = topAxesCollection[i]; if(axis.get("width") !== graphWidth) { axis.set("width", graphWidth); } axis.get("boundingBox").setStyle("left", graphX + PX); axis.get("boundingBox").setStyle("top", topAxesYCoords[i] + PX); } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(bottomAxesCollection) { l = bottomAxesCollection.length; i = 0; for(; i < l; i++) { axis = bottomAxesCollection[i]; if(axis.get("width") !== graphWidth) { axis.set("width", graphWidth); } axis.get("boundingBox").setStyle("left", graphX + PX); axis.get("boundingBox").setStyle("top", bottomAxesYCoords[i] + PX); } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(leftAxesCollection) { l = leftAxesCollection.length; i = 0; for(; i < l; ++i) { axis = leftAxesCollection[i]; axis.get("boundingBox").setStyle("top", graphY + PX); axis.get("boundingBox").setStyle("left", leftAxesXCoords[i] + PX); if(axis.get("height") !== graphHeight) { axis.set("height", graphHeight); } } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } if(rightAxesCollection) { l = rightAxesCollection.length; i = 0; for(; i < l; ++i) { axis = rightAxesCollection[i]; axis.get("boundingBox").setStyle("top", graphY + PX); axis.get("boundingBox").setStyle("left", rightAxesXCoords[i] + PX); if(axis.get("height") !== graphHeight) { axis.set("height", graphHeight); } } if(axis._hasDataOverflow()) { graphOverflow = "hidden"; } } this._drawing = false; if(this._callLater) { this._redraw(); return; } if(graph) { graph.get("boundingBox").setStyle("left", graphX + PX); graph.get("boundingBox").setStyle("top", graphY + PX); graph.set("width", graphWidth); graph.set("height", graphHeight); graph.get("boundingBox").setStyle("overflow", graphOverflow); } if(this._overlay) { this._overlay.setStyle("left", graphX + PX); this._overlay.setStyle("top", graphY + PX); this._overlay.setStyle("width", graphWidth + PX); this._overlay.setStyle("height", graphHeight + PX); } }, /** * Positions the legend in a chart and returns the properties of the legend to be used in the * chart's layout algorithm. * * @method _getLayoutDimensions * @return {Object} The left, top, right and bottom values for the legend. * @protected */ _getLayoutBoxDimensions: function() { var box = { top: 0, right: 0, bottom: 0, left: 0 }, legend = this.get("legend"), position, direction, dimension, size, w = this.get(WIDTH), h = this.get(HEIGHT), gap; if(legend && legend.get("includeInChartLayout")) { gap = legend.get("styles").gap; position = legend.get(POSITION); if(position != EXTERNAL) { direction = legend.get("direction"); dimension = direction == HORIZONTAL ? HEIGHT : WIDTH; size = legend.get(dimension); box[position] = size + gap; switch(position) { case TOP : legend.set(_Y, 0); break; case BOTTOM : legend.set(_Y, h - size); break; case RIGHT : legend.set(_X, w - size); break; case LEFT: legend.set(_X, 0); break; } } } return box; }, /** * Destructor implementation for the CartesianChart class. Calls destroy on all axes, series, legend (if available) and the Graph instance. * Removes the tooltip and overlay HTML elements. * * @method destructor * @protected */ destructor: function() { var legend = this.get("legend"); if(legend) { legend.destroy(true); } } }, { ATTRS: { legend: LEGEND } }); Y.CartesianChart = CartesianChartLegend; var PieChartLegend = Y.Base.create("pieChartLegend", Y.PieChart, [], { /** * Redraws the chart instance. * * @method _redraw * @private */ _redraw: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; var graph = this.get("graph"), w = this.get("width"), h = this.get("height"), graphWidth, graphHeight, legend = this.get("legend"), x = 0, y = 0, legendX = 0, legendY = 0, legendWidth, legendHeight, dimension, gap, position, direction; if(graph) { if(legend) { position = legend.get("position"); direction = legend.get("direction"); graphWidth = graph.get("width"); graphHeight = graph.get("height"); legendWidth = legend.get("width"); legendHeight = legend.get("height"); gap = legend.get("styles").gap; if((direction == "vertical" && (graphWidth + legendWidth + gap !== w)) || (direction == "horizontal" && (graphHeight + legendHeight + gap !== h))) { switch(legend.get("position")) { case LEFT : dimension = Math.min(w - (legendWidth + gap), h); legendHeight = h; x = legendWidth + gap; legend.set(HEIGHT, legendHeight); break; case TOP : dimension = Math.min(h - (legendHeight + gap), w); legendWidth = w; y = legendHeight + gap; legend.set(WIDTH, legendWidth); break; case RIGHT : dimension = Math.min(w - (legendWidth + gap), h); legendHeight = h; legendX = dimension + gap; legend.set(HEIGHT, legendHeight); break; case BOTTOM : dimension = Math.min(h - (legendHeight + gap), w); legendWidth = w; legendY = dimension + gap; legend.set(WIDTH, legendWidth); break; } graph.set(WIDTH, dimension); graph.set(HEIGHT, dimension); } else { switch(legend.get("position")) { case LEFT : x = legendWidth + gap; break; case TOP : y = legendHeight + gap; break; case RIGHT : legendX = graphWidth + gap; break; case BOTTOM : legendY = graphHeight + gap; break; } } } else { graph.set(_X, 0); graph.set(_Y, 0); graph.set(WIDTH, w); graph.set(HEIGHT, h); } } this._drawing = false; if(this._callLater) { this._redraw(); return; } if(graph) { graph.set(_X, x); graph.set(_Y, y); } if(legend) { legend.set(_X, legendX); legend.set(_Y, legendY); } } }, { ATTRS: { /** * The legend for the chart. * * @attribute * @type Legend */ legend: LEGEND } }); Y.PieChart = PieChartLegend; /** * ChartLegend provides a legend for a chart. * * @class ChartLegend * @module charts * @submodule charts-legend * @extends Widget */ Y.ChartLegend = Y.Base.create("chartlegend", Y.Widget, [Y.Renderer], { /** * Initializes the chart. * * @method initializer * @private */ initializer: function() { this._items = []; }, /** * @method renderUI * @private */ renderUI: function() { var bb = this.get("boundingBox"), cb = this.get("contentBox"), styles = this.get("styles").background, background = new Y.Rect({ graphic: cb, fill: styles.fill, stroke: styles.border }); bb.setStyle("display", "block"); bb.setStyle("position", "absolute"); this.set("background", background); }, /** * @method bindUI * @private */ bindUI: function() { this.get("chart").after("seriesCollectionChange", Y.bind(this._updateHandler, this)); this.after("stylesChange", this._updateHandler); this.after("positionChange", this._positionChangeHandler); this.after("widthChange", this._handleSizeChange); this.after("heightChange", this._handleSizeChange); }, /** * @method syncUI * @private */ syncUI: function() { var w = this.get("width"), h = this.get("height"); if(isFinite(w) && isFinite(h) && w > 0 && h > 0) { this._drawLegend(); } }, /** * Handles changes to legend. * * @method _updateHandler * @param {Object} e Event object * @private */ _updateHandler: function(e) { if(this.get("rendered")) { this._drawLegend(); } }, /** * Handles position changes. * * @method _positionChangeHandler * @param {Object} e Event object * @private */ _positionChangeHandler: function(e) { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode && ((chart && this.get("includeInChartLayout")))) { this.fire("legendRendered"); } else if(this.get("rendered")) { this._drawLegend(); } }, /** * Updates the legend when the size changes. * * @method _handleSizeChange * @param {Object} e Event object. * @private */ _handleSizeChange: function(e) { var attrName = e.attrName, pos = this.get(POSITION), vert = pos == LEFT || pos == RIGHT, hor = pos == BOTTOM || pos == TOP; if((hor && attrName == WIDTH) || (vert && attrName == HEIGHT)) { this._drawLegend(); } }, /** * Draws the legend * * @method _drawLegend * @private */ _drawLegend: function() { if(this._drawing) { this._callLater = true; return; } this._drawing = true; this._callLater = false; if(this.get("includeInChartLayout")) { this.get("chart")._itemRenderQueue.unshift(this); } var chart = this.get("chart"), node = this.get("contentBox"), seriesCollection = chart.get("seriesCollection"), series, styles = this.get("styles"), padding = styles.padding, itemStyles = styles.item, seriesStyles, hSpacing = itemStyles.hSpacing, vSpacing = itemStyles.vSpacing, hAlign = styles.hAlign, vAlign = styles.vAlign, marker = styles.marker, labelStyles = itemStyles.label, displayName, layout = this._layout[this.get("direction")], i, len, isArray, shape, shapeClass, item, fill, border, fillColors, borderColors, borderWeight, items = [], markerWidth = marker.width, markerHeight = marker.height, totalWidth = 0 - hSpacing, totalHeight = 0 - vSpacing, maxWidth = 0, maxHeight = 0, itemWidth, itemHeight; if(marker && marker.shape) { shape = marker.shape; } this._destroyLegendItems(); if(chart instanceof Y.PieChart) { series = seriesCollection[0]; displayName = series.get("categoryAxis").getDataByKey(series.get("categoryKey")); seriesStyles = series.get("styles").marker; fillColors = seriesStyles.fill.colors; borderColors = seriesStyles.border.colors; borderWeight = seriesStyles.border.weight; i = 0; len = displayName.length; shape = shape || Y.Circle; isArray = Y.Lang.isArray(shape); for(; i < len; ++i) { shape = isArray ? shape[i] : shape; fill = { color: fillColors[i] }; border = { colors: borderColors[i], weight: borderWeight }; displayName = chart.getSeriesItems(series, i).category.value; item = this._getLegendItem(node, this._getShapeClass(shape), fill, border, labelStyles, markerWidth, markerHeight, displayName); itemWidth = item.width; itemHeight = item.height; maxWidth = Math.max(maxWidth, itemWidth); maxHeight = Math.max(maxHeight, itemHeight); totalWidth += itemWidth + hSpacing; totalHeight += itemHeight + vSpacing; items.push(item); } } else { i = 0; len = seriesCollection.length; for(; i < len; ++i) { series = seriesCollection[i]; seriesStyles = this._getStylesBySeriesType(series, shape); if(!shape) { shape = seriesStyles.shape; if(!shape) { shape = Y.Circle; } } shapeClass = Y.Lang.isArray(shape) ? shape[i] : shape; item = this._getLegendItem(node, this._getShapeClass(shape), seriesStyles.fill, seriesStyles.border, labelStyles, markerWidth, markerHeight, series.get("valueDisplayName")); itemWidth = item.width; itemHeight = item.height; maxWidth = Math.max(maxWidth, itemWidth); maxHeight = Math.max(maxHeight, itemHeight); totalWidth += itemWidth + hSpacing; totalHeight += itemHeight + vSpacing; items.push(item); } } this._drawing = false; if(this._callLater) { this._drawLegend(); } else { layout._positionLegendItems.apply(this, [items, maxWidth, maxHeight, totalWidth, totalHeight, padding, hSpacing, vSpacing, hAlign, vAlign]); this._updateBackground(styles); this.fire("legendRendered"); } }, /** * Updates the background for the legend. * * @method _updateBackground * @param {Object} styles Reference to the legend's styles attribute * @private */ _updateBackground: function(styles) { var backgroundStyles = styles.background, contentRect = this._contentRect, padding = styles.padding, x = contentRect.left - padding.left, y = contentRect.top - padding.top, w = contentRect.right - x + padding.right, h = contentRect.bottom - y + padding.bottom; this.get("background").set({ fill: backgroundStyles.fill, stroke: backgroundStyles.border, width: w, height: h, x: x, y: y }); }, /** * Retrieves the marker styles based on the type of series. For series that contain a marker, the marker styles are returned. * * @method _getStylesBySeriesType * @param {CartesianSeries | PieSeries} The series in which the style properties will be received. * @return Object An object containing fill, border and shape information. * @private */ _getStylesBySeriesType: function(series) { var styles = series.get("styles"), color; if(series instanceof Y.LineSeries || series instanceof Y.StackedLineSeries) { styles = series.get("styles").line; color = styles.color || series._getDefaultColor(series.get("graphOrder"), "line"); return { border: { weight: 1, color: color }, fill: { color: color } }; } else if(series instanceof Y.AreaSeries || series instanceof Y.StackedAreaSeries) { styles = series.get("styles").area; color = styles.color || series._getDefaultColor(series.get("graphOrder"), "slice"); return { border: { weight: 1, color: color }, fill: { color: color } }; } else { styles = series.get("styles").marker; return { fill: styles.fill, border: { weight: styles.border.weight, color: styles.border.color, shape: styles.shape }, shape: styles.shape }; } }, /** * Returns a legend item consisting of the following properties: * <dl> * <dt>node</dt><dd>The `Node` containing the legend item elements.</dd> * <dt>shape</dt><dd>The `Shape` element for the legend item.</dd> * <dt>textNode</dt><dd>The `Node` containing the text></dd> * <dt>text</dt><dd></dd> * </dl> * * @method _getLegendItem * @param {Node} shapeProps Reference to the `node` attribute. * @param {String | Class} shapeClass The type of shape * @param {Object} fill Properties for the shape's fill * @param {Object} border Properties for the shape's border * @param {String} text String to be rendered as the legend's text * @param {Number} width Total width of the legend item * @param {Number} height Total height of the legend item * @param {HTML | String} text Text for the legendItem * @return Object * @private */ _getLegendItem: function(node, shapeClass, fill, border, labelStyles, w, h, text) { var containerNode = Y.one(DOCUMENT.createElement("div")), textField = Y.one(DOCUMENT.createElement("span")), shape, dimension, padding, left, item; containerNode.setStyle(POSITION, "absolute"); textField.setStyle(POSITION, "absolute"); textField.setStyles(labelStyles); textField.appendChild(DOCUMENT.createTextNode(text)); containerNode.appendChild(textField); node.appendChild(containerNode); dimension = textField.get("offsetHeight"); padding = dimension - h; left = w + padding + 2; textField.setStyle("left", left + PX); containerNode.setStyle("height", dimension + PX); containerNode.setStyle("width", (left + textField.get("offsetWidth")) + PX); shape = new shapeClass({ fill: fill, stroke: border, width: w, height: h, x: padding * 0.5, y: padding * 0.5, w: w, h: h, graphic: containerNode }); textField.setStyle("left", dimension + PX); item = { node: containerNode, width: containerNode.get("offsetWidth"), height: containerNode.get("offsetHeight"), shape: shape, textNode: textField, text: text }; this._items.push(item); return item; }, /** * Evaluates and returns correct class for drawing a shape. * * @method _getShapeClass * @return Shape * @private */ _getShapeClass: function() { var graphic = this.get("background").get("graphic"); return graphic._getShapeClass.apply(graphic, arguments); }, /** * Returns the default hash for the `styles` attribute. * * @method _getDefaultStyles * @return Object * @protected */ _getDefaultStyles: function() { var styles = { padding: { top: 8, right: 8, bottom: 8, left: 9 }, gap: 10, hAlign: "center", vAlign: "top", marker: this._getPlotDefaults(), item: { hSpacing: 10, vSpacing: 5, label: { color:"#808080", fontSize:"85%", whiteSpace: "nowrap" } }, background: { shape: "rect", fill:{ color:"#faf9f2" }, border: { color:"#dad8c9", weight: 1 } } }; return styles; }, /** * Gets the default values for series that use the utility. This method is used by * the class' `styles` attribute's getter to get build default values. * * @method _getPlotDefaults * @return Object * @protected */ _getPlotDefaults: function() { var defs = { width: 10, height: 10 }; return defs; }, /** * Destroys legend items. * * @method _destroyLegendItems * @private */ _destroyLegendItems: function() { var item; if(this._items) { while(this._items.length > 0) { item = this._items.shift(); item.shape.get("graphic").destroy(); item.node.empty(); item.node.destroy(true); item.node = null; item = null; } } this._items = []; }, /** * Maps layout classes. * * @property _layout * @private */ _layout: { vertical: VerticalLegendLayout, horizontal: HorizontalLegendLayout }, /** * Destructor implementation ChartLegend class. Removes all items and the Graphic instance from the widget. * * @method destructor * @protected */ destructor: function() { var background = this.get("background"), backgroundGraphic; this._destroyLegendItems(); if(background) { backgroundGraphic = background.get("graphic"); if(backgroundGraphic) { backgroundGraphic.destroy(); } else { background.destroy(); } } } }, { ATTRS: { /** * Indicates whether the chart's contentBox is the parentNode for the legend. * * @attribute includeInChartLayout * @type Boolean * @private */ includeInChartLayout: { value: false }, /** * Reference to the `Chart` instance. * * @attribute chart * @type Chart */ chart: { setter: function(val) { this.after("legendRendered", Y.bind(val._itemRendered, val)); return val; } }, /** * Indicates the direction in relation of the legend's layout. The `direction` of the legend is determined by its * `position` value. * * @attribute direction * @type String */ direction: { value: "vertical" }, /** * Indicates the position and direction of the legend. Possible values are `left`, `top`, `right` and `bottom`. Values of `left` and * `right` values have a `direction` of `vertical`. Values of `top` and `bottom` values have a `direction` of `horizontal`. * * @attribute position * @type String */ position: { lazyAdd: false, value: "right", setter: function(val) { if(val == TOP || val == BOTTOM) { this.set("direction", HORIZONTAL); } else if(val == LEFT || val == RIGHT) { this.set("direction", VERTICAL); } return val; } }, /** * The width of the legend. Depending on the implementation of the ChartLegend, this value is `readOnly`. By default, the legend is included in the layout of the `Chart` that * it references. Under this circumstance, `width` is always `readOnly`. When the legend is rendered in its own dom element, the `readOnly` status is determined by the * direction of the legend. If the `position` is `left` or `right` or the `direction` is `vertical`, width is `readOnly`. If the position is `top` or `bottom` or the `direction` * is `horizontal`, width can be explicitly set. If width is not explicitly set, the width will be determined by the width of the legend's parent element. * * @attribute width * @type Number */ width: { getter: function() { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode) { if((chart && this.get("includeInChartLayout")) || this._width) { if(!this._width) { this._width = 0; } return this._width; } else { return parentNode.get("offsetWidth"); } } return ""; }, setter: function(val) { this._width = val; return val; } }, /** * The height of the legend. Depending on the implementation of the ChartLegend, this value is `readOnly`. By default, the legend is included in the layout of the `Chart` that * it references. Under this circumstance, `height` is always `readOnly`. When the legend is rendered in its own dom element, the `readOnly` status is determined by the * direction of the legend. If the `position` is `top` or `bottom` or the `direction` is `horizontal`, height is `readOnly`. If the position is `left` or `right` or the `direction` * is `vertical`, height can be explicitly set. If height is not explicitly set, the height will be determined by the width of the legend's parent element. * * @attribute height * @type Number */ height: { valueFn: "_heightGetter", getter: function() { var chart = this.get("chart"), parentNode = this._parentNode; if(parentNode) { if((chart && this.get("includeInChartLayout")) || this._height) { if(!this._height) { this._height = 0; } return this._height; } else { return parentNode.get("offsetHeight"); } } return ""; }, setter: function(val) { this._height = val; return val; } }, /** * Indicates the x position of legend. * * @attribute x * @type Number * @readOnly */ x: { lazyAdd: false, value: 0, setter: function(val) { var node = this.get("boundingBox"); if(node) { node.setStyle(LEFT, val + PX); } return val; } }, /** * Indicates the y position of legend. * * @attribute y * @type Number * @readOnly */ y: { lazyAdd: false, value: 0, setter: function(val) { var node = this.get("boundingBox"); if(node) { node.setStyle(TOP, val + PX); } return val; } }, /** * Array of items contained in the legend. Each item is an object containing the following properties: * * <dl> * <dt>node</dt><dd>Node containing text for the legend item.</dd> * <dt>marker</dt><dd>Shape for the legend item.</dd> * </dl> * * @attribute items * @type Array * @readOnly */ items: { getter: function() { return this._items; } }, /** * Background for the legend. * * @attribute background * @type Rect */ background: {} /** * Properties used to display and style the ChartLegend. This attribute is inherited from `Renderer`. Below are the default values: * * <dl> * <dt>gap</dt><dd>Distance, in pixels, between the `ChartLegend` instance and the chart's content. When `ChartLegend` is rendered within a `Chart` instance this value is applied.</dd> * <dt>hAlign</dt><dd>Defines the horizontal alignment of the `items` in a `ChartLegend` rendered in a horizontal direction. This value is applied when the instance's `position` is set to top or bottom. This attribute can be set to left, center or right. The default value is center.</dd> * <dt>vAlign</dt><dd>Defines the vertical alignment of the `items` in a `ChartLegend` rendered in vertical direction. This value is applied when the instance's `position` is set to left or right. The attribute can be set to top, middle or bottom. The default value is middle.</dd> * <dt>item</dt><dd>Set of style properties applied to the `items` of the `ChartLegend`. * <dl> * <dt>hSpacing</dt><dd>Horizontal distance, in pixels, between legend `items`.</dd> * <dt>vSpacing</dt><dd>Vertical distance, in pixels, between legend `items`.</dd> * <dt>label</dt><dd>Properties for the text of an `item`. * <dl> * <dt>color</dt><dd>Color of the text. The default values is "#808080".</dd> * <dt>fontSize</dt><dd>Font size for the text. The default value is "85%".</dd> * </dl> * </dd> * <dt>marker</dt><dd>Properties for the `item` markers. * <dl> * <dt>width</dt><dd>Specifies the width of the markers.</dd> * <dt>height</dt><dd>Specifies the height of the markers.</dd> * </dl> * </dd> * </dl> * </dd> * <dt>background</dt><dd>Properties for the `ChartLegend` background. * <dl> * <dt>fill</dt><dd>Properties for the background fill. * <dl> * <dt>color</dt><dd>Color for the fill. The default value is "#faf9f2".</dd> * </dl> * </dd> * <dt>border</dt><dd>Properties for the background border. * <dl> * <dt>color</dt><dd>Color for the border. The default value is "#dad8c9".</dd> * <dt>weight</dt><dd>Weight of the border. The default values is 1.</dd> * </dl> * </dd> * </dl> * </dd> * </dl> * * @attribute styles * @type Object */ } }); /** * The Chart class is the basic application used to create a chart. * * @module charts * @class Chart * @constructor */ function Chart(cfg) { if(cfg.type != "pie") { return new Y.CartesianChart(cfg); } else { return new Y.PieChart(cfg); } } Y.Chart = Chart; }, '@VERSION@', {"requires": ["charts-base"]});
stefanneculai/cdnjs
ajax/libs/yui/3.7.2/charts-legend/charts-legend.js
JavaScript
mit
55,043
var fs = require('fs'); var path = require('path'); var common = require('./common'); //@ //@ ### mv(source [, source ...], dest') //@ ### mv(source_array, dest') //@ Available options: //@ //@ + `f`: force //@ //@ Examples: //@ //@ ```javascript //@ mv('-f', 'file', 'dir/'); //@ mv('file1', 'file2', 'dir/'); //@ mv(['file1', 'file2'], 'dir/'); // same as above //@ ``` //@ //@ Moves files. The wildcard `*` is accepted. function _mv(options, sources, dest) { options = common.parseOptions(options, { 'f': 'force' }); // Get sources, dest if (arguments.length < 3) { common.error('missing <source> and/or <dest>'); } else if (arguments.length > 3) { sources = [].slice.call(arguments, 1, arguments.length - 1); dest = arguments[arguments.length - 1]; } else if (typeof sources === 'string') { sources = [sources]; } else if ('length' in sources) { sources = sources; // no-op for array } else { common.error('invalid arguments'); } sources = common.expand(sources); var exists = fs.existsSync(dest), stats = exists && fs.statSync(dest); // Dest is not existing dir, but multiple sources given if ((!exists || !stats.isDirectory()) && sources.length > 1) common.error('dest is not a directory (too many sources)'); // Dest is an existing file, but no -f given if (exists && stats.isFile() && !options.force) common.error('dest file already exists: ' + dest); sources.forEach(function(src) { if (!fs.existsSync(src)) { common.error('no such file or directory: '+src, true); return; // skip file } // If here, src exists // When copying to '/path/dir': // thisDest = '/path/dir/file1' var thisDest = dest; if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) thisDest = path.normalize(dest + '/' + path.basename(src)); if (fs.existsSync(thisDest) && !options.force) { common.error('dest file already exists: ' + thisDest, true); return; // skip file } if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { common.error('cannot move to self: '+src, true); return; // skip file } fs.renameSync(src, thisDest); }); // forEach(src) } // mv module.exports = _mv;
etienne212/attendance-app
node_modules/jshint/node_modules/shelljs/src/mv.js
JavaScript
mit
2,257
YUI.add('widget-htmlparser', function (Y, NAME) { /** * Adds HTML Parser support to the base Widget class * * @module widget * @submodule widget-htmlparser * @for Widget */ var Widget = Y.Widget, Node = Y.Node, Lang = Y.Lang, SRC_NODE = "srcNode", CONTENT_BOX = "contentBox"; /** * Object hash, defining how attribute values are to be parsed from * markup contained in the widget's content box. e.g.: * <pre> * { * // Set single Node references using selector syntax * // (selector is run through node.one) * titleNode: "span.yui-title", * // Set NodeList references using selector syntax * // (array indicates selector is to be run through node.all) * listNodes: ["li.yui-item"], * // Set other attribute types, using a parse function. * // Context is set to the widget instance. * label: function(contentBox) { * return contentBox.one("span.title").get("innerHTML"); * } * } * </pre> * * @property HTML_PARSER * @type Object * @static */ Widget.HTML_PARSER = {}; /** * The build configuration for the Widget class. * <p> * Defines the static fields which need to be aggregated, * when this class is used as the main class passed to * the <a href="Base.html#method_build">Base.build</a> method. * </p> * @property _buildCfg * @type Object * @static * @final * @private */ Widget._buildCfg = { aggregates : ["HTML_PARSER"] }; /** * The DOM node to parse for configuration values, passed to the Widget's HTML_PARSER definition * * @attribute srcNode * @type String | Node * @writeOnce */ Widget.ATTRS[SRC_NODE] = { value: null, setter: Node.one, getter: "_getSrcNode", writeOnce: true }; Y.mix(Widget.prototype, { /** * @method _getSrcNode * @protected * @return {Node} The Node to apply HTML_PARSER to */ _getSrcNode : function(val) { return val || this.get(CONTENT_BOX); }, /** * Implement the BaseCore _preAddAttrs method hook, to add * the srcNode and related attributes, so that HTML_PARSER * (which relies on `this.get("srcNode")`) can merge in it's * results before the rest of the attributes are added. * * @method _preAddAttrs * @protected * * @param attrs {Object} The full hash of statically defined ATTRS * attributes being added for this instance * * @param userVals {Object} The hash of user values passed to * the constructor * * @param lazy {boolean} Whether or not to add the attributes lazily */ _preAddAttrs : function(attrs, userVals, lazy) { var preAttrs = { id : attrs.id, boundingBox : attrs.boundingBox, contentBox : attrs.contentBox, srcNode : attrs.srcNode }; this.addAttrs(preAttrs, userVals, lazy); delete attrs.boundingBox; delete attrs.contentBox; delete attrs.srcNode; delete attrs.id; if (this._applyParser) { this._applyParser(userVals); } }, /** * @method _applyParsedConfig * @protected * @return {Object} The merged configuration literal */ _applyParsedConfig : function(node, cfg, parsedCfg) { return (parsedCfg) ? Y.mix(cfg, parsedCfg, false) : cfg; }, /** * Utility method used to apply the <code>HTML_PARSER</code> configuration for the * instance, to retrieve config data values. * * @method _applyParser * @protected * @param config {Object} User configuration object (will be populated with values from Node) */ _applyParser : function(config) { var widget = this, srcNode = this._getNodeToParse(), schema = widget._getHtmlParser(), parsedConfig, val; if (schema && srcNode) { Y.Object.each(schema, function(v, k, o) { val = null; if (Lang.isFunction(v)) { val = v.call(widget, srcNode); } else { if (Lang.isArray(v)) { val = srcNode.all(v[0]); if (val.isEmpty()) { val = null; } } else { val = srcNode.one(v); } } if (val !== null && val !== undefined) { parsedConfig = parsedConfig || {}; parsedConfig[k] = val; } }); } config = widget._applyParsedConfig(srcNode, config, parsedConfig); }, /** * Determines whether we have a node reference which we should try and parse. * * The current implementation does not parse nodes generated from CONTENT_TEMPLATE, * only explicitly set srcNode, or contentBox attributes. * * @method _getNodeToParse * @return {Node} The node reference to apply HTML_PARSER to. * @private */ _getNodeToParse : function() { var srcNode = this.get("srcNode"); return (!this._cbFromTemplate) ? srcNode : null; }, /** * Gets the HTML_PARSER definition for this instance, by merging HTML_PARSER * definitions across the class hierarchy. * * @private * @method _getHtmlParser * @return {Object} HTML_PARSER definition for this instance */ _getHtmlParser : function() { // Removed caching for kweight. This is a private method // and only called once so don't need to cache HTML_PARSER var classes = this._getClasses(), parser = {}, i, p; for (i = classes.length - 1; i >= 0; i--) { p = classes[i].HTML_PARSER; if (p) { Y.mix(parser, p, true); } } return parser; } }); }, '@VERSION@', {"requires": ["widget-base"]});
mxgit1090/cdnjs
ajax/libs/yui/3.13.0/widget-htmlparser/widget-htmlparser-debug.js
JavaScript
mit
5,997
(function () { var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "); var targets = ["_blank", "_self", "_top", "_parent"]; var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"]; var methods = ["get", "post", "put", "delete"]; var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]; var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech", "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait", "orientation:landscape", "device-height: [X]", "device-width: [X]"]; var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags var data = { a: { attrs: { href: null, ping: null, type: null, media: media, target: targets, hreflang: langs } }, abbr: s, acronym: s, address: s, applet: s, area: { attrs: { alt: null, coords: null, href: null, target: null, ping: null, media: media, hreflang: langs, type: null, shape: ["default", "rect", "circle", "poly"] } }, article: s, aside: s, audio: { attrs: { src: null, mediagroup: null, crossorigin: ["anonymous", "use-credentials"], preload: ["none", "metadata", "auto"], autoplay: ["", "autoplay"], loop: ["", "loop"], controls: ["", "controls"] } }, b: s, base: { attrs: { href: null, target: targets } }, basefont: s, bdi: s, bdo: s, big: s, blockquote: { attrs: { cite: null } }, body: s, br: s, button: { attrs: { form: null, formaction: null, name: null, value: null, autofocus: ["", "autofocus"], disabled: ["", "autofocus"], formenctype: encs, formmethod: methods, formnovalidate: ["", "novalidate"], formtarget: targets, type: ["submit", "reset", "button"] } }, canvas: { attrs: { width: null, height: null } }, caption: s, center: s, cite: s, code: s, col: { attrs: { span: null } }, colgroup: { attrs: { span: null } }, command: { attrs: { type: ["command", "checkbox", "radio"], label: null, icon: null, radiogroup: null, command: null, title: null, disabled: ["", "disabled"], checked: ["", "checked"] } }, data: { attrs: { value: null } }, datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } }, datalist: { attrs: { data: null } }, dd: s, del: { attrs: { cite: null, datetime: null } }, details: { attrs: { open: ["", "open"] } }, dfn: s, dir: s, div: s, dl: s, dt: s, em: s, embed: { attrs: { src: null, type: null, width: null, height: null } }, eventsource: { attrs: { src: null } }, fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } }, figcaption: s, figure: s, font: s, footer: s, form: { attrs: { action: null, name: null, "accept-charset": charsets, autocomplete: ["on", "off"], enctype: encs, method: methods, novalidate: ["", "novalidate"], target: targets } }, frame: s, frameset: s, h1: s, h2: s, h3: s, h4: s, h5: s, h6: s, head: { attrs: {}, children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"] }, header: s, hgroup: s, hr: s, html: { attrs: { manifest: null }, children: ["head", "body"] }, i: s, iframe: { attrs: { src: null, srcdoc: null, name: null, width: null, height: null, sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"], seamless: ["", "seamless"] } }, img: { attrs: { alt: null, src: null, ismap: null, usemap: null, width: null, height: null, crossorigin: ["anonymous", "use-credentials"] } }, input: { attrs: { alt: null, dirname: null, form: null, formaction: null, height: null, list: null, max: null, maxlength: null, min: null, name: null, pattern: null, placeholder: null, size: null, src: null, step: null, value: null, width: null, accept: ["audio/*", "video/*", "image/*"], autocomplete: ["on", "off"], autofocus: ["", "autofocus"], checked: ["", "checked"], disabled: ["", "disabled"], formenctype: encs, formmethod: methods, formnovalidate: ["", "novalidate"], formtarget: targets, multiple: ["", "multiple"], readonly: ["", "readonly"], required: ["", "required"], type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"] } }, ins: { attrs: { cite: null, datetime: null } }, kbd: s, keygen: { attrs: { challenge: null, form: null, name: null, autofocus: ["", "autofocus"], disabled: ["", "disabled"], keytype: ["RSA"] } }, label: { attrs: { "for": null, form: null } }, legend: s, li: { attrs: { value: null } }, link: { attrs: { href: null, type: null, hreflang: langs, media: media, sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"] } }, map: { attrs: { name: null } }, mark: s, menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } }, meta: { attrs: { content: null, charset: charsets, name: ["viewport", "application-name", "author", "description", "generator", "keywords"], "http-equiv": ["content-language", "content-type", "default-style", "refresh"] } }, meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } }, nav: s, noframes: s, noscript: s, object: { attrs: { data: null, type: null, name: null, usemap: null, form: null, width: null, height: null, typemustmatch: ["", "typemustmatch"] } }, ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } }, optgroup: { attrs: { disabled: ["", "disabled"], label: null } }, option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } }, output: { attrs: { "for": null, form: null, name: null } }, p: s, param: { attrs: { name: null, value: null } }, pre: s, progress: { attrs: { value: null, max: null } }, q: { attrs: { cite: null } }, rp: s, rt: s, ruby: s, s: s, samp: s, script: { attrs: { type: ["text/javascript"], src: null, async: ["", "async"], defer: ["", "defer"], charset: charsets } }, section: s, select: { attrs: { form: null, name: null, size: null, autofocus: ["", "autofocus"], disabled: ["", "disabled"], multiple: ["", "multiple"] } }, small: s, source: { attrs: { src: null, type: null, media: null } }, span: s, strike: s, strong: s, style: { attrs: { type: ["text/css"], media: media, scoped: null } }, sub: s, summary: s, sup: s, table: s, tbody: s, td: { attrs: { colspan: null, rowspan: null, headers: null } }, textarea: { attrs: { dirname: null, form: null, maxlength: null, name: null, placeholder: null, rows: null, cols: null, autofocus: ["", "autofocus"], disabled: ["", "disabled"], readonly: ["", "readonly"], required: ["", "required"], wrap: ["soft", "hard"] } }, tfoot: s, th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } }, thead: s, time: { attrs: { datetime: null } }, title: s, tr: s, track: { attrs: { src: null, label: null, "default": null, kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"], srclang: langs } }, tt: s, u: s, ul: s, "var": s, video: { attrs: { src: null, poster: null, width: null, height: null, crossorigin: ["anonymous", "use-credentials"], preload: ["auto", "metadata", "none"], autoplay: ["", "autoplay"], mediagroup: ["movie"], muted: ["", "muted"], controls: ["", "controls"] } }, wbr: s }; var globalAttrs = { accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "class": null, contenteditable: ["true", "false"], contextmenu: null, dir: ["ltr", "rtl", "auto"], draggable: ["true", "false", "auto"], dropzone: ["copy", "move", "link", "string:", "file:"], hidden: ["hidden"], id: null, inert: ["inert"], itemid: null, itemprop: null, itemref: null, itemscope: ["itemscope"], itemtype: null, lang: ["en", "es"], spellcheck: ["true", "false"], style: null, tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"], title: null, translate: ["yes", "no"], onclick: null, rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"] }; function populate(obj) { for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr)) obj.attrs[attr] = globalAttrs[attr]; } populate(s); for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s) populate(data[tag]); CodeMirror.htmlSchema = data; function htmlHint(cm, options) { var local = {schemaInfo: data}; if (options) for (var opt in options) local[opt] = options[opt]; return CodeMirror.hint.xml(cm, local); } CodeMirror.htmlHint = htmlHint; // deprecated CodeMirror.registerHelper("hint", "html", htmlHint); })();
MaxMillion/jsdelivr
files/codemirror/3.22.0/addon/hint/html-hint.js
JavaScript
mit
10,911
YUI.add('classnamemanager', function(Y) { /** * Contains a singleton (ClassNameManager) that enables easy creation and caching of * prefixed class names. * @module classnamemanager */ /** * A singleton class providing: * * <ul> * <li>Easy creation of prefixed class names</li> * <li>Caching of previously created class names for improved performance.</li> * </ul> * * @class ClassNameManager * @static */ // String constants var CLASS_NAME_PREFIX = 'classNamePrefix', CLASS_NAME_DELIMITER = 'classNameDelimiter', CONFIG = Y.config; // Global config /** * Configuration property indicating the prefix for all CSS class names in this YUI instance. * * @property classNamePrefix * @type {String} * @default "yui" * @static */ CONFIG[CLASS_NAME_PREFIX] = CONFIG[CLASS_NAME_PREFIX] || 'yui3'; /** * Configuration property indicating the delimiter used to compose all CSS class names in * this YUI instance. * * @property classNameDelimiter * @type {String} * @default "-" * @static */ CONFIG[CLASS_NAME_DELIMITER] = CONFIG[CLASS_NAME_DELIMITER] || '-'; Y.ClassNameManager = function () { var sPrefix = CONFIG[CLASS_NAME_PREFIX], sDelimiter = CONFIG[CLASS_NAME_DELIMITER]; return { /** * Returns a class name prefixed with the the value of the * <code>Y.config.classNamePrefix</code> attribute + the provided strings. * Uses the <code>Y.config.classNameDelimiter</code> attribute to delimit the * provided strings. E.g. Y.ClassNameManager.getClassName('foo','bar'); // yui-foo-bar * * @method getClassName * @param {String}+ classnameSection one or more classname sections to be joined * @param {Boolean} skipPrefix If set to true, the classname will not be prefixed with the default Y.config.classNameDelimiter value. */ getClassName: Y.cached(function () { var args = Y.Array(arguments); if (args[args.length-1] !== true) { args.unshift(sPrefix); } else { args.pop(); } return args.join(sDelimiter); }) }; }(); }, '@VERSION@' ,{requires:['yui-base']});
eduardo-costa/cdnjs
ajax/libs/yui/3.5.1/classnamemanager/classnamemanager.js
JavaScript
mit
2,135
YUI.add('shim-plugin', function(Y) { /** * Provides shimming support for Node via a Plugin. * This fixes SELECT bleedthrough for IE6 & Mac scrollbars * @module shim-plugin */ /** * Node plugin which can be used to add shim support. * * @class Plugin.Shim * @param {Object} User configuration object */ function Shim(config) { this.init(config); } /** * Default class used to mark the shim element * * @property CLASS_NAME * @type String * @static * @default "yui-node-shim" */ // TODO: use ClassNameManager Shim.CLASS_NAME = 'yui-node-shim'; /** * Default markup template used to generate the shim element. * * @property TEMPLATE * @type String * @static */ Shim.TEMPLATE = '<iframe class="' + Shim.CLASS_NAME + '" frameborder="0" title="Node Stacking Shim"' + 'src="javascript:false" tabindex="-1" role="presentation"' + 'style="position:absolute; z-index:-1;"></iframe>'; Shim.prototype = { init: function(config) { this._host = config.host; this.initEvents(); this.insert(); this.sync(); }, initEvents: function() { this._resizeHandle = this._host.on('resize', this.sync, this); }, getShim: function() { return this._shim || ( this._shim = Y.Node.create( Shim.TEMPLATE, this._host.get('ownerDocument') ) ); }, insert: function() { var node = this._host; this._shim = node.insertBefore( this.getShim(), node.get('firstChild')); }, /** * Updates the size of the shim to fill its container * @method sync */ sync: function() { var shim = this._shim, node = this._host; if (shim) { shim.setAttrs({ width: node.getStyle('width'), height: node.getStyle('height') }); } }, /** * Removes the shim and destroys the plugin * @method destroy */ destroy: function() { var shim = this._shim; if (shim) { shim.remove(true); } this._resizeHandle.detach(); } }; Shim.NAME = 'Shim'; Shim.NS = 'shim'; Y.namespace('Plugin'); Y.Plugin.Shim = Shim; }, '@VERSION@' ,{requires:['node-style', 'node-pluginhost']});
amoyeh/cdnjs
ajax/libs/yui/3.5.0pr2/shim-plugin/shim-plugin-debug.js
JavaScript
mit
2,688
YUI.add('widget-anim', function(Y) { /** * Provides a plugin which can be used to animate widget visibility changes. * * @module widget-anim */ var BOUNDING_BOX = "boundingBox", HOST = "host", NODE = "node", OPACITY = "opacity", EMPTY_STR = "", VISIBLE = "visible", DESTROY = "destroy", HIDDEN = "hidden", RENDERED = "rendered", START = "start", END = "end", DURATION = "duration", ANIM_SHOW = "animShow", ANIM_HIDE = "animHide", _UI_SET_VISIBLE = "_uiSetVisible", ANIM_SHOW_CHANGE = "animShowChange", ANIM_HIDE_CHANGE = "animHideChange"; /** * A plugin class which can be used to animate widget visibility changes. * * @class WidgetAnim * @extends Plugin.Base * @namespace Plugin */ function WidgetAnim(config) { WidgetAnim.superclass.constructor.apply(this, arguments); } /** * The namespace for the plugin. This will be the property on the widget, which will * reference the plugin instance, when it's plugged in. * * @property NS * @static * @type String * @default "anim" */ WidgetAnim.NS = "anim"; /** * The NAME of the WidgetAnim class. Used to prefix events generated * by the plugin class. * * @property NAME * @static * @type String * @default "pluginWidgetAnim" */ WidgetAnim.NAME = "pluginWidgetAnim"; /** * Pre-Packaged Animation implementations, which can be used for animShow and animHide attribute * values. * * @property ANIMATIONS * @static * @type Object * @default "pluginWidgetAnim" */ WidgetAnim.ANIMATIONS = { fadeIn : function() { var widget = this.get(HOST), boundingBox = widget.get(BOUNDING_BOX), anim = new Y.Anim({ node: boundingBox, to: { opacity: 1 }, duration: this.get(DURATION) }); // Set initial opacity, to avoid initial flicker if (!widget.get(VISIBLE)) { boundingBox.setStyle(OPACITY, 0); } // Clean up, on destroy. Where supported, remove // opacity set using style. Else make 100% opaque anim.on(DESTROY, function() { this.get(NODE).setStyle(OPACITY, (Y.UA.ie) ? 1 : EMPTY_STR); }); return anim; }, fadeOut : function() { return new Y.Anim({ node: this.get(HOST).get(BOUNDING_BOX), to: { opacity: 0 }, duration: this.get(DURATION) }); } }; /** * Static property used to define the default attribute * configuration for the plugin. * * @property ATTRS * @type Object * @static */ WidgetAnim.ATTRS = { /** * Default duration in seconds. Used as the default duration for the default animation implementations * * @attribute duration * @type Number * @default 0.2 (seconds */ duration : { value: 0.2 }, /** * Default animation instance used for showing the widget (opacity fade-in) * * @attribute animShow * @type Anim * @default WidgetAnim.ANIMATIONS.fadeIn */ animShow : { valueFn: WidgetAnim.ANIMATIONS.fadeIn }, /** * Default animation instance used for hiding the widget (opacity fade-out) * * @attribute animHide * @type Anim * @default WidgetAnim.ANIMATIONS.fadeOut */ animHide : { valueFn: WidgetAnim.ANIMATIONS.fadeOut } }; Y.extend(WidgetAnim, Y.Plugin.Base, { /** * The initializer lifecycle implementation. Modifies the host widget's * visibililty implementation to add animation. * * @method initializer * @param {Object} config The user configuration for the plugin */ initializer : function(config) { this._bindAnimShow(); this._bindAnimHide(); this.after(ANIM_SHOW_CHANGE, this._bindAnimShow); this.after(ANIM_HIDE_CHANGE, this._bindAnimHide); // Override default _uiSetVisible method, with custom animated method this.beforeHostMethod(_UI_SET_VISIBLE, this._uiAnimSetVisible); }, /** * The initializer destructor implementation. Responsible for destroying the configured * animation instances. * * @method destructor */ destructor : function() { this.get(ANIM_SHOW).destroy(); this.get(ANIM_HIDE).destroy(); }, /** * The injected method used to override the host widget's _uiSetVisible implementation with * an animated version of the same. * * <p>This method replaces the default _uiSetVisible handler * Widget provides, by injecting itself before _uiSetVisible, * and preventing the default behavior. </p> * * @method _uiAnimSetVisible * @protected * @param {boolean} val true, if making the widget visible. false, if hiding it. */ _uiAnimSetVisible : function(val) { if (this.get(HOST).get(RENDERED)) { if (val) { this.get(ANIM_HIDE).stop(); this.get(ANIM_SHOW).run(); } else { this.get(ANIM_SHOW).stop(); this.get(ANIM_HIDE).run(); } return new Y.Do.Prevent(); } }, /** * The original Widget _uiSetVisible implementation. This currently needs to be replicated, * so it can be invoked before or after the animation starts or stops, since the original * methods is not available to the AOP implementation. * * @method _uiSetVisible * @param {boolean} val true, if making the widget visible. false, if hiding it. * @private */ _uiSetVisible : function(val) { var host = this.get(HOST), hiddenClass = host.getClassName(HIDDEN); host.get(BOUNDING_BOX).toggleClass(hiddenClass, !val); }, /** * Binds a listener to invoke the original visibility handling when the animShow animation is started * * @method _bindAnimShow * @private */ _bindAnimShow : function() { // Setup original visibility handling (for show) before starting to animate this.get(ANIM_SHOW).on(START, Y.bind(function() { this._uiSetVisible(true); }, this)); }, /** * Binds a listener to invoke the original visibility handling when the animHide animation is complete * * @method _bindAnimHide * @private */ _bindAnimHide : function() { // Setup original visibility handling (for hide) after completing animation this.get(ANIM_HIDE).after(END, Y.bind(function() { this._uiSetVisible(false); }, this)); } }); Y.namespace("Plugin").WidgetAnim = WidgetAnim; }, '@VERSION@' ,{requires:['plugin', 'anim-base', 'widget']});
enricodeleo/cdnjs
ajax/libs/yui/3.5.1/widget-anim/widget-anim.js
JavaScript
mit
6,811
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], "MONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "SHORTDAY": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], "fullDate": "EEEE, MMMM d, y", "longDate": "MMMM d, y", "medium": "MMM d, y h:mm:ss a", "mediumDate": "MMM d, y", "mediumTime": "h:mm:ss a", "short": "M/d/yy h:mm a", "shortDate": "M/d/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "en-pn", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
thisispiers/cdnjs
ajax/libs/angular.js/1.3.1/i18n/angular-locale_en-pn.js
JavaScript
mit
2,281
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0635", "\u0645" ], "DAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "MONTH": [ "\u062c\u0627\u0646\u0641\u064a", "\u0641\u064a\u0641\u0631\u064a", "\u0645\u0627\u0631\u0633", "\u0623\u0641\u0631\u064a\u0644", "\u0645\u0627\u064a", "\u062c\u0648\u0627\u0646", "\u062c\u0648\u064a\u0644\u064a\u0629", "\u0623\u0648\u062a", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "SHORTDAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "SHORTMONTH": [ "\u062c\u0627\u0646\u0641\u064a", "\u0641\u064a\u0641\u0631\u064a", "\u0645\u0627\u0631\u0633", "\u0623\u0641\u0631\u064a\u0644", "\u0645\u0627\u064a", "\u062c\u0648\u0627\u0646", "\u062c\u0648\u064a\u0644\u064a\u0629", "\u0623\u0648\u062a", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "fullDate": "EEEE\u060c d MMMM\u060c y", "longDate": "d MMMM\u060c y", "medium": "y/MM/dd h:mm:ss a", "mediumDate": "y/MM/dd", "mediumTime": "h:mm:ss a", "short": "y/M/d h:mm a", "shortDate": "y/M/d", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "din", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ar-dz", "pluralCat": function(n, opt_precision) { if (n == 0) { return PLURAL_CATEGORY.ZERO; } if (n == 1) { return PLURAL_CATEGORY.ONE; } if (n == 2) { return PLURAL_CATEGORY.TWO; } if (n % 100 >= 3 && n % 100 <= 10) { return PLURAL_CATEGORY.FEW; } if (n % 100 >= 11 && n % 100 <= 99) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
AMoo-Miki/cdnjs
ajax/libs/angular.js/1.3.10/i18n/angular-locale_ar-dz.js
JavaScript
mit
3,231
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } function getWT(v, f) { if (f === 0) { return {w: 0, t: 0}; } while ((f % 10) === 0) { f /= 10; v--; } return {w: v, t: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "f.h.", "e.h." ], "DAY": [ "sunnudagur", "m\u00e1nudagur", "\u00feri\u00f0judagur", "mi\u00f0vikudagur", "fimmtudagur", "f\u00f6studagur", "laugardagur" ], "MONTH": [ "jan\u00faar", "febr\u00faar", "mars", "apr\u00edl", "ma\u00ed", "j\u00fan\u00ed", "j\u00fal\u00ed", "\u00e1g\u00fast", "september", "okt\u00f3ber", "n\u00f3vember", "desember" ], "SHORTDAY": [ "sun.", "m\u00e1n.", "\u00feri.", "mi\u00f0.", "fim.", "f\u00f6s.", "lau." ], "SHORTMONTH": [ "jan.", "feb.", "mar.", "apr.", "ma\u00ed", "j\u00fan.", "j\u00fal.", "\u00e1g\u00fa.", "sep.", "okt.", "n\u00f3v.", "des." ], "fullDate": "EEEE, d. MMMM y", "longDate": "d. MMMM y", "medium": "d. MMM y HH:mm:ss", "mediumDate": "d. MMM y", "mediumTime": "HH:mm:ss", "short": "d.M.y HH:mm", "shortDate": "d.M.y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "kr", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "is-is", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); var wt = getWT(vf.v, vf.f); if (wt.t == 0 && i % 10 == 1 && i % 100 != 11 || wt.t != 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
freak3dot/cdnjs
ajax/libs/angular.js/1.3.5/i18n/angular-locale_is-is.js
JavaScript
mit
2,679
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0642\u0628\u0644\u200c\u0627\u0632\u0638\u0647\u0631", "\u0628\u0639\u062f\u0627\u0632\u0638\u0647\u0631" ], "DAY": [ "\u06cc\u06a9\u0634\u0646\u0628\u0647", "\u062f\u0648\u0634\u0646\u0628\u0647", "\u0633\u0647\u200c\u0634\u0646\u0628\u0647", "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647", "\u067e\u0646\u062c\u0634\u0646\u0628\u0647", "\u062c\u0645\u0639\u0647", "\u0634\u0646\u0628\u0647" ], "MONTH": [ "\u0698\u0627\u0646\u0648\u06cc\u0647\u0654", "\u0641\u0648\u0631\u06cc\u0647\u0654", "\u0645\u0627\u0631\u0633", "\u0622\u0648\u0631\u06cc\u0644", "\u0645\u0647\u0654", "\u0698\u0648\u0626\u0646", "\u0698\u0648\u0626\u06cc\u0647\u0654", "\u0627\u0648\u062a", "\u0633\u067e\u062a\u0627\u0645\u0628\u0631", "\u0627\u06a9\u062a\u0628\u0631", "\u0646\u0648\u0627\u0645\u0628\u0631", "\u062f\u0633\u0627\u0645\u0628\u0631" ], "SHORTDAY": [ "\u06cc\u06a9\u0634\u0646\u0628\u0647", "\u062f\u0648\u0634\u0646\u0628\u0647", "\u0633\u0647\u200c\u0634\u0646\u0628\u0647", "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647", "\u067e\u0646\u062c\u0634\u0646\u0628\u0647", "\u062c\u0645\u0639\u0647", "\u0634\u0646\u0628\u0647" ], "SHORTMONTH": [ "\u0698\u0627\u0646\u0648\u06cc\u0647\u0654", "\u0641\u0648\u0631\u06cc\u0647\u0654", "\u0645\u0627\u0631\u0633", "\u0622\u0648\u0631\u06cc\u0644", "\u0645\u0647\u0654", "\u0698\u0648\u0626\u0646", "\u0698\u0648\u0626\u06cc\u0647\u0654", "\u0627\u0648\u062a", "\u0633\u067e\u062a\u0627\u0645\u0628\u0631", "\u0627\u06a9\u062a\u0628\u0631", "\u0646\u0648\u0627\u0645\u0628\u0631", "\u062f\u0633\u0627\u0645\u0628\u0631" ], "fullDate": "EEEE d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y H:mm:ss", "mediumDate": "d MMM y", "mediumTime": "H:mm:ss", "short": "y/M/d H:mm", "shortDate": "y/M/d", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Rial", "DECIMAL_SEP": "\u066b", "GROUP_SEP": "\u066c", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u200e\u00a4-", "negSuf": "", "posPre": "\u200e\u00a4", "posSuf": "" } ] }, "id": "fa", "pluralCat": function(n, opt_precision) { var i = n | 0; if (i == 0 || n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
pzp1997/cdnjs
ajax/libs/angular.js/1.3.9/i18n/angular-locale_fa.js
JavaScript
mit
3,084
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0635", "\u0645" ], "DAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "MONTH": [ "\u064a\u0646\u0627\u064a\u0631", "\u0641\u0628\u0631\u0627\u064a\u0631", "\u0645\u0627\u0631\u0633", "\u0623\u0628\u0631\u064a\u0644", "\u0645\u0627\u064a\u0648", "\u064a\u0648\u0646\u064a\u0648", "\u064a\u0648\u0644\u064a\u0648", "\u0623\u063a\u0633\u0637\u0633", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "SHORTDAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "SHORTMONTH": [ "\u064a\u0646\u0627\u064a\u0631", "\u0641\u0628\u0631\u0627\u064a\u0631", "\u0645\u0627\u0631\u0633", "\u0623\u0628\u0631\u064a\u0644", "\u0645\u0627\u064a\u0648", "\u064a\u0648\u0646\u064a\u0648", "\u064a\u0648\u0644\u064a\u0648", "\u0623\u063a\u0633\u0637\u0633", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "fullDate": "EEEE\u060c d MMMM\u060c y", "longDate": "d MMMM\u060c y", "medium": "dd\u200f/MM\u200f/y h:mm:ss a", "mediumDate": "dd\u200f/MM\u200f/y", "mediumTime": "h:mm:ss a", "short": "d\u200f/M\u200f/y h:mm a", "shortDate": "d\u200f/M\u200f/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "din", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ar-ly", "pluralCat": function(n, opt_precision) { if (n == 0) { return PLURAL_CATEGORY.ZERO; } if (n == 1) { return PLURAL_CATEGORY.ONE; } if (n == 2) { return PLURAL_CATEGORY.TWO; } if (n % 100 >= 3 && n % 100 <= 10) { return PLURAL_CATEGORY.FEW; } if (n % 100 >= 11 && n % 100 <= 99) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
tonytlwu/cdnjs
ajax/libs/angular.js/1.3.14/i18n/angular-locale_ar-ly.js
JavaScript
mit
3,327
#!/usr/bin/env node /* Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*jslint sloppy:true plusplus:true node:true rhino:true */ var fs, esprima, options, fnames, count; if (typeof require === 'function') { fs = require('fs'); esprima = require('esprima'); } else if (typeof load === 'function') { try { load('esprima.js'); } catch (e) { load('../esprima.js'); } } // Shims to Node.js objects when running under Rhino. if (typeof console === 'undefined' && typeof process === 'undefined') { console = { log: print }; fs = { readFileSync: readFile }; process = { argv: arguments, exit: quit }; process.argv.unshift('esvalidate.js'); process.argv.unshift('rhino'); } function showUsage() { console.log('Usage:'); console.log(' esvalidate [options] file.js'); console.log(); console.log('Available options:'); console.log(); console.log(' --format=type Set the report format, plain (default) or junit'); console.log(' -v, --version Print program version'); console.log(); process.exit(1); } if (process.argv.length <= 2) { showUsage(); } options = { format: 'plain' }; fnames = []; process.argv.splice(2).forEach(function (entry) { if (entry === '-h' || entry === '--help') { showUsage(); } else if (entry === '-v' || entry === '--version') { console.log('ECMAScript Validator (using Esprima version', esprima.version, ')'); console.log(); process.exit(0); } else if (entry.slice(0, 9) === '--format=') { options.format = entry.slice(9); if (options.format !== 'plain' && options.format !== 'junit') { console.log('Error: unknown report format ' + options.format + '.'); process.exit(1); } } else if (entry.slice(0, 2) === '--') { console.log('Error: unknown option ' + entry + '.'); process.exit(1); } else { fnames.push(entry); } }); if (fnames.length === 0) { console.log('Error: no input file.'); process.exit(1); } if (options.format === 'junit') { console.log('<?xml version="1.0" encoding="UTF-8"?>'); console.log('<testsuites>'); } count = 0; fnames.forEach(function (fname) { var content, timestamp, syntax, name; try { content = fs.readFileSync(fname, 'utf-8'); if (content[0] === '#' && content[1] === '!') { content = '//' + content.substr(2, content.length); } timestamp = Date.now(); syntax = esprima.parse(content, { tolerant: true }); if (options.format === 'junit') { name = fname; if (name.lastIndexOf('/') >= 0) { name = name.slice(name.lastIndexOf('/') + 1); } console.log('<testsuite name="' + fname + '" errors="0" ' + ' failures="' + syntax.errors.length + '" ' + ' tests="' + syntax.errors.length + '" ' + ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">'); syntax.errors.forEach(function (error) { var msg = error.message; msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' + ' time="0">'); console.log(' <error type="SyntaxError" message="' + error.message + '">' + error.message + '(' + name + ':' + error.lineNumber + ')' + '</error>'); console.log(' </testcase>'); }); console.log('</testsuite>'); } else if (options.format === 'plain') { syntax.errors.forEach(function (error) { var msg = error.message; msg = msg.replace(/^Line\ [0-9]*\:\ /, ''); msg = fname + ':' + error.lineNumber + ': ' + msg; console.log(msg); ++count; }); } } catch (e) { ++count; if (options.format === 'junit') { console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' + ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">'); console.log(' <testcase name="' + e.message + '" ' + ' time="0">'); console.log(' <error type="ParseError" message="' + e.message + '">' + e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') + ')</error>'); console.log(' </testcase>'); console.log('</testsuite>'); } else { console.log('Error: ' + e.message); } } }); if (options.format === 'junit') { console.log('</testsuites>'); } if (count > 0) { process.exit(1); }
guillaumfloki/bodytracker
node_modules/bower/lib/node_modules/esprima/bin/esvalidate.js
JavaScript
mit
6,106
// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred // Project: http://amplifyjs.com/ // Definitions by: Jonas Eriksson <https://github.com/joeriks/>, Laurentiu Stamate <https://github.com/laurentiustamate94> // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../jquery/jquery.d.ts" /> interface amplifyRequestSettings { resourceId: string; data?: any; success?: (...args: any[]) => void; error?: (...args: any[]) => void; } interface amplifyDecoder { ( data?: any, status?: string, xhr?: JQueryXHR, success?: (...args: any[]) => void, error?: (...args: any[]) => void ): void } interface amplifyDecoders { [decoderName: string]: amplifyDecoder; jsSend: amplifyDecoder; } interface amplifyAjaxSettings extends JQueryAjaxSettings { cache?: any; dataMap?: {} | ((data: any) => {}); decoder?: any /* string or amplifyDecoder */; } interface amplifyRequest { /*** * Request a resource. * resourceId: Identifier string for the resource. * data: A set of key/value pairs of data to be sent to the resource. * callback: A function to invoke if the resource is retrieved successfully. */ (resourceId: string, hash?: any, callback?: Function): JQueryPromise<any>; /*** * Request a resource. * settings: A set of key/value pairs of settings for the request. * resourceId: Identifier string for the resource. * data (optional): Data associated with the request. * success (optional): Function to invoke on success. * error (optional): Function to invoke on error. */ (settings: amplifyRequestSettings): JQueryPromise<any>; /*** * Define a resource. * resourceId: Identifier string for the resource. * requestType: The type of data retrieval method from the server. See the request types sections for more information. * settings: A set of key/value pairs that relate to the server communication technology. The following settings are available: * Any settings found in jQuery.ajax(). * cache: See the cache section for more details. * decoder: See the decoder section for more details. */ define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; /*** * Define a custom request. * resourceId: Identifier string for the resource. * resource: Function to handle requests. Receives a hash with the following properties: * resourceId: Identifier string for the resource. * data: Data provided by the user. * success: Callback to invoke on success. * error: Callback to invoke on error. */ define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; decoders: amplifyDecoders; cache: any; } interface amplifySubscribe { /*** * Subscribe to a message. * topic: Name of the message to subscribe to. * callback: Function to invoke when the message is published. */ (topic: string, callback: Function): void; /*** * Subscribe to a message. * topic: Name of the message to subscribe to. * context: What this will be when the callback is invoked. * callback: Function to invoke when the message is published. * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. */ (topic: string, context: any, callback: Function, priority?: number): void; /*** * Subscribe to a message. * topic: Name of the message to subscribe to. * callback: Function to invoke when the message is published. * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. */ (topic: string, callback: Function, priority?: number): void; } interface amplifyStorageTypeStore { /*** * Stores a value for a given key using the default storage type. * * key: Identifier for the value being stored. * value: The value to store. The value can be anything that can be serialized as JSON. * [options]: A set of key/value pairs that relate to settings for storing the value. */ (key: string, value: any, options?: any): void; /*** * Gets a stored value based on the key. */ (key: string): any; /*** * Gets a hash of all stored values. */ (): any; } interface amplifyStore extends amplifyStorageTypeStore { /*** * IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ */ localStorage: amplifyStorageTypeStore; /*** * IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ */ sessionStorage: amplifyStorageTypeStore; /*** * Firefox 2+ */ globalStorage: amplifyStorageTypeStore; /*** * IE 5 - 7 */ userData: amplifyStorageTypeStore; /*** * An in-memory store is provided as a fallback if none of the other storage types are available. */ memory: amplifyStorageTypeStore; } interface amplifyStatic { subscribe: amplifySubscribe; /*** * Remove a subscription. * topic: The topic being unsubscribed from. * callback: The callback that was originally subscribed. */ unsubscribe(topic: string, callback: Function): void; /*** * Publish a message. * topic: The name of the message to publish. * Any additional parameters will be passed to the subscriptions. * amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked. */ publish(topic: string, ...args: any[]): boolean; store: amplifyStore; request: amplifyRequest; } declare var amplify: amplifyStatic;
esperco/DefinitelyTyped
amplify-deferred/amplify-deferred.d.ts
TypeScript
mit
5,997
'use strict'; var _ = require('lodash'); var MuteStream = require('mute-stream'); var readline = require('readline'); /** * Base interface class other can inherits from */ var UI = module.exports = function (opt) { // Instantiate the Readline interface // @Note: Don't reassign if already present (allow test to override the Stream) if (!this.rl) { this.rl = readline.createInterface(setupReadlineOptions(opt)); } this.rl.resume(); this.onForceClose = this.onForceClose.bind(this); // Make sure new prompt start on a newline when closing process.on('exit', this.onForceClose); // Terminate process on SIGINT (which will call process.on('exit') in return) this.rl.on('SIGINT', this.onForceClose); }; /** * Handle the ^C exit * @return {null} */ UI.prototype.onForceClose = function () { this.close(); process.kill(process.pid, 'SIGINT'); console.log(''); }; /** * Close the interface and cleanup listeners */ UI.prototype.close = function () { // Remove events listeners this.rl.removeListener('SIGINT', this.onForceClose); process.removeListener('exit', this.onForceClose); this.rl.output.unmute(); if (this.activePrompt && typeof this.activePrompt.close === 'function') { this.activePrompt.close(); } // Close the readline this.rl.output.end(); this.rl.pause(); this.rl.close(); }; function setupReadlineOptions(opt) { opt = opt || {}; // Default `input` to stdin var input = opt.input || process.stdin; // Add mute capabilities to the output var ms = new MuteStream(); ms.pipe(opt.output || process.stdout); var output = ms; return _.extend({ terminal: true, input: input, output: output }, _.omit(opt, ['input', 'output'])); }
Dagers/React-Native-Differential-Updater
App/node_modules/inquirer/lib/ui/baseUI.js
JavaScript
mit
1,737
YUI.add('datatype-number-parse', function (Y, NAME) { /** * Parse number submodule. * * @module datatype-number * @submodule datatype-number-parse * @for Number */ var safe = Y.Escape.regex, SPACES = '\\s*'; Y.mix(Y.namespace("Number"), { /** * Returns a parsing function for the given configuration. * It uses `Y.cached` so it expects the format spec separated into * individual values. * The method further uses closure to put together and save the * regular expresssion just once in the outer function. * * @method _buildParser * @param [prefix] {String} Prefix string to be stripped out. * @param [suffix] {String} Suffix string to be stripped out. * @param [separator] {String} Thousands separator to be stripped out. * @param [decimal] {String} Decimal separator to be replaced by a dot. * @return {Function} Parsing function. * @private */ _buildParser: Y.cached(function (prefix, suffix, separator, decimal) { var regexBits = [], regex; if (prefix) { regexBits.push('^' + SPACES + safe(prefix) + SPACES); } if (suffix) { regexBits.push(SPACES + safe(suffix) + SPACES + '$'); } if (separator) { regexBits.push(safe(separator) + '(?=\\d)'); } regex = new RegExp('(?:' + regexBits.join('|') + ')', 'g'); if (decimal === '.') { decimal = null; } return function (val) { val = val.replace(regex, ''); return decimal ? val.replace(decimal, '.') : val; }; }), /** * Converts data to type Number. * If a `config` argument is used, it will strip the `data` of the prefix, * the suffix and the thousands separator, if any of them are found, * replace the decimal separator by a dot and parse the resulting string. * Extra whitespace around the prefix and suffix will be ignored. * * @method parse * @param data {String | Number | Boolean} Data to convert. The following * values return as null: null, undefined, NaN, "". * @param [config] {Object} Optional configuration values, same as for [Y.Date.format](#method_format). * @param [config.prefix] {String} String to be removed from the start, like a currency designator "$" * @param [config.decimalPlaces] {Number} Ignored, it is accepted only for compatibility with [Y.Date.format](#method_format). * @param [config.decimalSeparator] {String} Decimal separator. * @param [config.thousandsSeparator] {String} Thousands separator. * @param [config.suffix] {String} String to be removed from the end of the number, like " items". * @return {Number} A number, or null. */ parse: function(data, config) { var parser; if (config && typeof data === 'string') { parser = this._buildParser(config.prefix, config.suffix, config.thousandsSeparator, config.decimalSeparator); data = parser(data); } if (typeof data === 'string' && Y.Lang.trim(data) !== '') { data = +data; } // catch NaN and Β±Infinity if (typeof data !== 'number' || !isFinite(data)) { data = null; } // on the same line to get stripped for raw/min.js by build system return data; } }); // Add Parsers shortcut Y.namespace("Parsers").number = Y.Number.parse; Y.namespace("DataType"); Y.DataType.Number = Y.Number; }, '@VERSION@', {"requires": ["escape"]});
GaryChamberlain/cdnjs
ajax/libs/yui/3.17.1-rc-1/datatype-number-parse/datatype-number-parse.js
JavaScript
mit
3,586
/*! hellojs v1.7.5 | (c) 2012-2015 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */ // ES5 Object.create if (!Object.create) { // Shim, Object create // A shim for Object.create(), it adds a prototype to a new object Object.create = (function() { function F() {} return function(o) { if (arguments.length != 1) { throw new Error('Object.create implementation only accepts one parameter.'); } F.prototype = o; return new F(); }; })(); } // ES5 Object.keys if (!Object.keys) { Object.keys = function(o, k, r) { r = []; for (k in o) { if (r.hasOwnProperty.call(o, k)) r.push(k); } return r; }; } // ES5 [].indexOf if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(s) { for (var j = 0; j < this.length; j++) { if (this[j] === s) { return j; } } return -1; }; } // ES5 [].forEach if (!Array.prototype.forEach) { Array.prototype.forEach = function(fun/*, thisArg*/) { if (this === void 0 || this === null) { throw new TypeError(); } var t = Object(this); var len = t.length >>> 0; if (typeof fun !== 'function') { throw new TypeError(); } var thisArg = arguments.length >= 2 ? arguments[1] : void 0; for (var i = 0; i < len; i++) { if (i in t) { fun.call(thisArg, t[i], i, t); } } return this; }; } // ES5 [].filter if (!Array.prototype.filter) { Array.prototype.filter = function(fun, thisArg) { var a = []; this.forEach(function(val, i, t) { if (fun.call(thisArg || void 0, val, i, t)) { a.push(val); } }); return a; }; } // Production steps of ECMA-262, Edition 5, 15.4.4.19 // Reference: http://es5.github.io/#x15.4.4.19 if (!Array.prototype.map) { Array.prototype.map = function(fun, thisArg) { var a = []; this.forEach(function(val, i, t) { a.push(fun.call(thisArg || void 0, val, i, t)); }); return a; }; } // ES5 isArray if (!Array.isArray) { // Function Array.isArray Array.isArray = function(o) { return Object.prototype.toString.call(o) === '[object Array]'; }; } // Test for location.assign if (typeof window === 'object' && typeof window.location === 'object' && !window.location.assign) { window.location.assign = function(url) { window.location = url; }; } // Test for Function.bind if (!Function.prototype.bind) { // MDN // Polyfill IE8, does not support native Function.bind Function.prototype.bind = function(b) { if (typeof this !== 'function') { throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } function C() {} var a = [].slice; var f = a.call(arguments, 1); var _this = this; var D = function() { return _this.apply(this instanceof C ? this : b || window, f.concat(a.call(arguments))); }; C.prototype = this.prototype; D.prototype = new C(); return D; }; } /** * @hello.js * * HelloJS is a client side Javascript SDK for making OAuth2 logins and subsequent REST calls. * * @author Andrew Dodson * @website https://adodson.com/hello.js/ * * @copyright Andrew Dodson, 2012 - 2015 * @license MIT: You are free to use and modify this code for any use, on the condition that this copyright notice remains. */ var hello = function(name) { return hello.use(name); }; hello.utils = { // Extend the first object with the properties and methods of the second extend: function(r /*, a[, b[, ...]] */) { // Get the arguments as an array but ommit the initial item Array.prototype.slice.call(arguments, 1).forEach(function(a) { if (r instanceof Object && a instanceof Object && r !== a) { for (var x in a) { r[x] = hello.utils.extend(r[x], a[x]); } } else { r = a; } }); return r; } }; // Core library hello.utils.extend(hello, { settings: { // OAuth2 authentication defaults redirect_uri: window.location.href.split('#')[0], response_type: 'token', display: 'popup', state: '', // OAuth1 shim // The path to the OAuth1 server for signing user requests // Want to recreate your own? Checkout https://github.com/MrSwitch/node-oauth-shim oauth_proxy: 'https://auth-server.herokuapp.com/proxy', // API timeout in milliseconds timeout: 20000, // Popup Options popup: { resizable: 1, scrollbars: 1, width: 500, height: 550 }, // Default service / network default_service: null, // Force authentication // When hello.login is fired. // (null): ignore current session expiry and continue with login // (true): ignore current session expiry and continue with login, ask for user to reauthenticate // (false): if the current session looks good for the request scopes return the current session. force: null, // Page URL // When 'display=page' this property defines where the users page should end up after redirect_uri // Ths could be problematic if the redirect_uri is indeed the final place, // Typically this circumvents the problem of the redirect_url being a dumb relay page. page_uri: window.location.href }, // Service configuration objects services: {}, // Use // Define a new instance of the HelloJS library with a default service use: function(service) { // Create self, which inherits from its parent var self = Object.create(this); // Inherit the prototype from its parent self.settings = Object.create(this.settings); // Define the default service if (service) { self.settings.default_service = service; } // Create an instance of Events self.utils.Event.call(self); return self; }, // Initialize // Define the client_ids for the endpoint services // @param object o, contains a key value pair, service => clientId // @param object opts, contains a key value pair of options used for defining the authentication defaults // @param number timeout, timeout in seconds init: function(services, options) { var utils = this.utils; if (!services) { return this.services; } // Define provider credentials // Reformat the ID field for (var x in services) {if (services.hasOwnProperty(x)) { if (typeof (services[x]) !== 'object') { services[x] = {id: services[x]}; } }} // Merge services if there already exists some utils.extend(this.services, services); // Format the incoming for (x in this.services) { if (this.services.hasOwnProperty(x)) { this.services[x].scope = this.services[x].scope || {}; } } // // Update the default settings with this one. if (options) { utils.extend(this.settings, options); // Do this immediatly incase the browser changes the current path. if ('redirect_uri' in options) { this.settings.redirect_uri = utils.url(options.redirect_uri).href; } } return this; }, // Login // Using the endpoint // @param network stringify name to connect to // @param options object (optional) {display mode, is either none|popup(default)|page, scope: email,birthday,publish, .. } // @param callback function (optional) fired on signin login: function() { // Create an object which inherits its parent as the prototype and constructs a new event chain. var _this = this; var utils = _this.utils; var error = utils.error; var promise = utils.Promise(); // Get parameters var p = utils.args({network: 's', options: 'o', callback: 'f'}, arguments); // Local vars var url; // Merge/override options with app defaults var opts = p.options = utils.merge(_this.settings, p.options || {}); // Merge/override options with app defaults opts.popup = utils.merge(_this.settings.popup, p.options.popup || {}); // Network p.network = p.network || _this.settings.default_service; // Bind callback to both reject and fulfill states promise.proxy.then(p.callback, p.callback); // Trigger an event on the global listener function emit(s, value) { hello.emit(s, value); } promise.proxy.then(emit.bind(this, 'auth.login auth'), emit.bind(this, 'auth.failed auth')); // Is our service valid? if (typeof (p.network) !== 'string' || !(p.network in _this.services)) { // Trigger the default login. // Ahh we dont have one. return promise.reject(error('invalid_network', 'The provided network was not recognized')); } var provider = _this.services[p.network]; // Create a global listener to capture events triggered out of scope var callbackId = utils.globalEvent(function(str) { // The responseHandler returns a string, lets save this locally var obj; if (str) { obj = JSON.parse(str); } else { obj = error('cancelled', 'The authentication was not completed'); } // Handle these response using the local // Trigger on the parent if (!obj.error) { // Save on the parent window the new credentials // This fixes an IE10 bug i think... atleast it does for me. utils.store(obj.network, obj); // Fulfill a successful login promise.fulfill({ network: obj.network, authResponse: obj }); } else { // Reject a successful login promise.reject(obj); } }); var redirectUri = utils.url(opts.redirect_uri).href; // May be a space-delimited list of multiple, complementary types var responseType = provider.oauth.response_type || opts.response_type; // Fallback to token if the module hasn't defined a grant url if (/\bcode\b/.test(responseType) && !provider.oauth.grant) { responseType = responseType.replace(/\bcode\b/, 'token'); } // Query string parameters, we may pass our own arguments to form the querystring p.qs = { client_id: encodeURIComponent(provider.id), response_type: encodeURIComponent(responseType), redirect_uri: encodeURIComponent(redirectUri), display: opts.display, scope: 'basic', state: { client_id: provider.id, network: p.network, display: opts.display, callback: callbackId, state: opts.state, redirect_uri: redirectUri } }; // Get current session for merging scopes, and for quick auth response var session = utils.store(p.network); // Scopes (authentication permisions) // Ensure this is a string - IE has a problem moving Arrays between windows // Append the setup scope var SCOPE_SPLIT = /[,\s]+/; var scope = (opts.scope || '').toString() + ',' + p.qs.scope; // Append scopes from a previous session. // This helps keep app credentials constant, // Avoiding having to keep tabs on what scopes are authorized if (session && 'scope' in session && session.scope instanceof String) { scope += ',' + session.scope; } // Convert scope to an Array // - easier to manipulate scope = scope.split(SCOPE_SPLIT); // Format remove duplicates and empty values scope = utils.unique(scope).filter(filterEmpty); // Save the the scopes to the state with the names that they were requested with. p.qs.state.scope = scope.join(','); // Map scopes to the providers naming convention scope = scope.map(function(item) { // Does this have a mapping? if (item in provider.scope) { return provider.scope[item]; } else { // Loop through all services and determine whether the scope is generic for (var x in _this.services) { var serviceScopes = _this.services[x].scope; if (serviceScopes && item in serviceScopes) { // Found an instance of this scope, so lets not assume its special return ''; } } // This is a unique scope to this service so lets in it. return item; } }); // Stringify and Arrayify so that double mapped scopes are given the chance to be formatted scope = scope.join(',').split(SCOPE_SPLIT); // Again... // Format remove duplicates and empty values scope = utils.unique(scope).filter(filterEmpty); // Join with the expected scope delimiter into a string p.qs.scope = scope.join(provider.scope_delim || ','); // Is the user already signed in with the appropriate scopes, valid access_token? if (opts.force === false) { if (session && 'access_token' in session && session.access_token && 'expires' in session && session.expires > ((new Date()).getTime() / 1e3)) { // What is different about the scopes in the session vs the scopes in the new login? var diff = utils.diff((session.scope || '').split(SCOPE_SPLIT), (p.qs.state.scope || '').split(SCOPE_SPLIT)); if (diff.length === 0) { // OK trigger the callback promise.fulfill({ unchanged: true, network: p.network, authResponse: session }); // Nothing has changed return promise; } } } // Page URL if (opts.display === 'page' && opts.page_uri) { // Add a page location, place to endup after session has authenticated p.qs.state.page_uri = utils.url(opts.page_uri).href; } // Bespoke // Override login querystrings from auth_options if ('login' in provider && typeof (provider.login) === 'function') { // Format the paramaters according to the providers formatting function provider.login(p); } // Add OAuth to state // Where the service is going to take advantage of the oauth_proxy if (!/\btoken\b/.test(responseType) || parseInt(provider.oauth.version, 10) < 2 || (opts.display === 'none' && provider.oauth.grant && session && session.refresh_token)) { // Add the oauth endpoints p.qs.state.oauth = provider.oauth; // Add the proxy url p.qs.state.oauth_proxy = opts.oauth_proxy; } // Convert state to a string p.qs.state = encodeURIComponent(JSON.stringify(p.qs.state)); // URL if (parseInt(provider.oauth.version, 10) === 1) { // Turn the request to the OAuth Proxy for 3-legged auth url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction); } // Refresh token else if (opts.display === 'none' && provider.oauth.grant && session && session.refresh_token) { // Add the refresh_token to the request p.qs.refresh_token = session.refresh_token; // Define the request path url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction); } else { url = utils.qs(provider.oauth.auth, p.qs, encodeFunction); } // Execute // Trigger how we want self displayed if (opts.display === 'none') { // Sign-in in the background, iframe utils.iframe(url); } // Triggering popup? else if (opts.display === 'popup') { var popup = utils.popup(url, redirectUri, opts.popup); var timer = setInterval(function() { if (!popup || popup.closed) { clearInterval(timer); if (!promise.state) { var response = error('cancelled', 'Login has been cancelled'); if (!popup) { response = error('blocked', 'Popup was blocked'); } response.network = p.network; promise.reject(response); } } }, 100); } else { window.location = url; } return promise.proxy; function encodeFunction(s) {return s;} function filterEmpty(s) {return !!s;} }, // Remove any data associated with a given service // @param string name of the service // @param function callback logout: function() { var _this = this; var utils = _this.utils; var error = utils.error; // Create a new promise var promise = utils.Promise(); var p = utils.args({name:'s', options: 'o', callback: 'f'}, arguments); p.options = p.options || {}; // Add callback to events promise.proxy.then(p.callback, p.callback); // Trigger an event on the global listener function emit(s, value) { hello.emit(s, value); } promise.proxy.then(emit.bind(this, 'auth.logout auth'), emit.bind(this, 'error')); // Network p.name = p.name || this.settings.default_service; if (p.name && !(p.name in _this.services)) { promise.reject(error('invalid_network', 'The network was unrecognized')); } else if (p.name && utils.store(p.name)) { // Define the callback var callback = function(opts) { // Remove from the store utils.store(p.name, ''); // Emit events by default promise.fulfill(hello.utils.merge({network:p.name}, opts || {})); }; // Run an async operation to remove the users session var _opts = {}; if (p.options.force) { var logout = _this.services[p.name].logout; if (logout) { // Convert logout to URL string, // If no string is returned, then this function will handle the logout async style if (typeof (logout) === 'function') { logout = logout(callback); } // If logout is a string then assume URL and open in iframe. if (typeof (logout) === 'string') { utils.iframe(logout); _opts.force = null; _opts.message = 'Logout success on providers site was indeterminate'; } else if (logout === undefined) { // The callback function will handle the response. return promise.proxy; } } } // Remove local credentials callback(_opts); } else { promise.reject(error('invalid_session', 'There was no session to remove')); } return promise.proxy; }, // Returns all the sessions that are subscribed too // @param string optional, name of the service to get information about. getAuthResponse: function(service) { // If the service doesn't exist service = service || this.settings.default_service; if (!service || !(service in this.services)) { return null; } return this.utils.store(service) || null; }, // Events: placeholder for the events events: {} }); // Core utilities hello.utils.extend(hello.utils, { // Error error: function(code, message) { return { error: { code: code, message: message } }; }, // Append the querystring to a url // @param string url // @param object parameters qs: function(url, params, formatFunction) { if (params) { // Set default formatting function formatFunction = formatFunction || encodeURIComponent; // Override the items in the URL which already exist for (var x in params) { var str = '([\\?\\&])' + x + '=[^\\&]*'; reg = new RegExp(str); if (url.match(x)) { url = url.replace(reg, '$1' + x + '=' + formatFunction(params[x])); delete params[x]; } } } if (!this.isEmpty(params)) { return url + (url.indexOf('?') > -1 ? '&' : '?') + this.param(params, formatFunction); } return url; }, // Param // Explode/encode the parameters of an URL string/object // @param string s, string to decode param: function(s, formatFunction) { var b; var a = {}; var m; if (typeof (s) === 'string') { formatFunction = formatFunction || decodeURIComponent; m = s.replace(/^[\#\?]/, '').match(/([^=\/\&]+)=([^\&]+)/g); if (m) { for (var i = 0; i < m.length; i++) { b = m[i].match(/([^=]+)=(.*)/); a[b[1]] = formatFunction(b[2]); } } return a; } else { formatFunction = formatFunction || encodeURIComponent; var o = s; a = []; for (var x in o) {if (o.hasOwnProperty(x)) { if (o.hasOwnProperty(x)) { a.push([x, o[x] === '?' ? '?' : formatFunction(o[x])].join('=')); } }} return a.join('&'); } }, // Local storage facade store: (function() { var a = ['localStorage', 'sessionStorage']; var i = 0; var prefix = 'test'; // Set LocalStorage var localStorage; while (a[i++]) { try { // In Chrome with cookies blocked, calling localStorage throws an error localStorage = window[a[i]]; localStorage.setItem(prefix + i, i); localStorage.removeItem(prefix + i); break; } catch (e) { localStorage = null; } } if (!localStorage) { var cache = null; localStorage = { getItem: function(prop) { prop = prop + '='; var m = document.cookie.split(';'); for (var i = 0; i < m.length; i++) { var _m = m[i].replace(/(^\s+|\s+$)/, ''); if (_m && _m.indexOf(prop) === 0) { return _m.substr(prop.length); } } return cache; }, setItem: function(prop, value) { cache = value; document.cookie = prop + '=' + value; } }; // Fill the cache up cache = localStorage.getItem('hello'); } function get() { var json = {}; try { json = JSON.parse(localStorage.getItem('hello')) || {}; } catch (e) {} return json; } function set(json) { localStorage.setItem('hello', JSON.stringify(json)); } // Check if the browser support local storage return function(name, value, days) { // Local storage var json = get(); if (name && value === undefined) { return json[name] || null; } else if (name && value === null) { try { delete json[name]; } catch (e) { json[name] = null; } } else if (name) { json[name] = value; } else { return json; } set(json); return json || null; }; })(), // Create and Append new DOM elements // @param node string // @param attr object literal // @param dom/string append: function(node, attr, target) { var n = typeof (node) === 'string' ? document.createElement(node) : node; if (typeof (attr) === 'object') { if ('tagName' in attr) { target = attr; } else { for (var x in attr) {if (attr.hasOwnProperty(x)) { if (typeof (attr[x]) === 'object') { for (var y in attr[x]) {if (attr[x].hasOwnProperty(y)) { n[x][y] = attr[x][y]; }} } else if (x === 'html') { n.innerHTML = attr[x]; } // IE doesn't like us setting methods with setAttribute else if (!/^on/.test(x)) { n.setAttribute(x, attr[x]); } else { n[x] = attr[x]; } }} } } if (target === 'body') { (function self() { if (document.body) { document.body.appendChild(n); } else { setTimeout(self, 16); } })(); } else if (typeof (target) === 'object') { target.appendChild(n); } else if (typeof (target) === 'string') { document.getElementsByTagName(target)[0].appendChild(n); } return n; }, // An easy way to create a hidden iframe // @param string src iframe: function(src) { this.append('iframe', {src: src, style: {position:'absolute', left: '-1000px', bottom: 0, height: '1px', width: '1px'}}, 'body'); }, // Recursive merge two objects into one, second parameter overides the first // @param a array merge: function(/* Args: a, b, c, .. n */) { var args = Array.prototype.slice.call(arguments); args.unshift({}); return this.extend.apply(null, args); }, // Makes it easier to assign parameters, where some are optional // @param o object // @param a arguments args: function(o, args) { var p = {}; var i = 0; var t = null; var x = null; // 'x' is the first key in the list of object parameters for (x in o) {if (o.hasOwnProperty(x)) { break; }} // Passing in hash object of arguments? // Where the first argument can't be an object if ((args.length === 1) && (typeof (args[0]) === 'object') && o[x] != 'o!') { // Could this object still belong to a property? // Check the object keys if they match any of the property keys for (x in args[0]) {if (o.hasOwnProperty(x)) { // Does this key exist in the property list? if (x in o) { // Yes this key does exist so its most likely this function has been invoked with an object parameter // Return first argument as the hash of all arguments return args[0]; } }} } // Else loop through and account for the missing ones. for (x in o) {if (o.hasOwnProperty(x)) { t = typeof (args[i]); if ((typeof (o[x]) === 'function' && o[x].test(args[i])) || (typeof (o[x]) === 'string' && ( (o[x].indexOf('s') > -1 && t === 'string') || (o[x].indexOf('o') > -1 && t === 'object') || (o[x].indexOf('i') > -1 && t === 'number') || (o[x].indexOf('a') > -1 && t === 'object') || (o[x].indexOf('f') > -1 && t === 'function') )) ) { p[x] = args[i++]; } else if (typeof (o[x]) === 'string' && o[x].indexOf('!') > -1) { return false; } }} return p; }, // Returns a URL instance url: function(path) { // If the path is empty if (!path) { return window.location; } // Chrome and FireFox support new URL() to extract URL objects else if (window.URL && URL instanceof Function && URL.length !== 0) { return new URL(path, window.location); } // Ugly shim, it works! else { var a = document.createElement('a'); a.href = path; return a; } }, diff: function(a, b) { return b.filter(function(item) { return a.indexOf(item) === -1; }); }, // Unique // Remove duplicate and null values from an array // @param a array unique: function(a) { if (!Array.isArray(a)) { return []; } return a.filter(function(item, index) { // Is this the first location of item return a.indexOf(item) === index; }); }, isEmpty: function(obj) { // Scalar if (!obj) return true; // Array if (Array.isArray(obj)) { return !obj.length; } else if (typeof (obj) === 'object') { // Object for (var key in obj) { if (obj.hasOwnProperty(key)) { return false; } } } return true; }, //jscs:disable /*! ** Thenable -- Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable ** Copyright (c) 2013-2014 Ralf S. Engelschall <http://engelschall.com> ** Licensed under The MIT License <http://opensource.org/licenses/MIT> ** Source-Code distributed on <http://github.com/rse/thenable> */ Promise: (function(){ /* promise states [Promises/A+ 2.1] */ var STATE_PENDING = 0; /* [Promises/A+ 2.1.1] */ var STATE_FULFILLED = 1; /* [Promises/A+ 2.1.2] */ var STATE_REJECTED = 2; /* [Promises/A+ 2.1.3] */ /* promise object constructor */ var api = function (executor) { /* optionally support non-constructor/plain-function call */ if (!(this instanceof api)) return new api(executor); /* initialize object */ this.id = "Thenable/1.0.6"; this.state = STATE_PENDING; /* initial state */ this.fulfillValue = undefined; /* initial value */ /* [Promises/A+ 1.3, 2.1.2.2] */ this.rejectReason = undefined; /* initial reason */ /* [Promises/A+ 1.5, 2.1.3.2] */ this.onFulfilled = []; /* initial handlers */ this.onRejected = []; /* initial handlers */ /* provide optional information-hiding proxy */ this.proxy = { then: this.then.bind(this) }; /* support optional executor function */ if (typeof executor === "function") executor.call(this, this.fulfill.bind(this), this.reject.bind(this)); }; /* promise API methods */ api.prototype = { /* promise resolving methods */ fulfill: function (value) { return deliver(this, STATE_FULFILLED, "fulfillValue", value); }, reject: function (value) { return deliver(this, STATE_REJECTED, "rejectReason", value); }, /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ then: function (onFulfilled, onRejected) { var curr = this; var next = new api(); /* [Promises/A+ 2.2.7] */ curr.onFulfilled.push( resolver(onFulfilled, next, "fulfill")); /* [Promises/A+ 2.2.2/2.2.6] */ curr.onRejected.push( resolver(onRejected, next, "reject" )); /* [Promises/A+ 2.2.3/2.2.6] */ execute(curr); return next.proxy; /* [Promises/A+ 2.2.7, 3.3] */ } }; /* deliver an action */ var deliver = function (curr, state, name, value) { if (curr.state === STATE_PENDING) { curr.state = state; /* [Promises/A+ 2.1.2.1, 2.1.3.1] */ curr[name] = value; /* [Promises/A+ 2.1.2.2, 2.1.3.2] */ execute(curr); } return curr; }; /* execute all handlers */ var execute = function (curr) { if (curr.state === STATE_FULFILLED) execute_handlers(curr, "onFulfilled", curr.fulfillValue); else if (curr.state === STATE_REJECTED) execute_handlers(curr, "onRejected", curr.rejectReason); }; /* execute particular set of handlers */ var execute_handlers = function (curr, name, value) { /* global process: true */ /* global setImmediate: true */ /* global setTimeout: true */ /* short-circuit processing */ if (curr[name].length === 0) return; /* iterate over all handlers, exactly once */ var handlers = curr[name]; curr[name] = []; /* [Promises/A+ 2.2.2.3, 2.2.3.3] */ var func = function () { for (var i = 0; i < handlers.length; i++) handlers[i](value); /* [Promises/A+ 2.2.5] */ }; /* execute procedure asynchronously */ /* [Promises/A+ 2.2.4, 3.1] */ if (typeof process === "object" && typeof process.nextTick === "function") process.nextTick(func); else if (typeof setImmediate === "function") setImmediate(func); else setTimeout(func, 0); }; /* generate a resolver function */ var resolver = function (cb, next, method) { return function (value) { if (typeof cb !== "function") /* [Promises/A+ 2.2.1, 2.2.7.3, 2.2.7.4] */ next[method].call(next, value); /* [Promises/A+ 2.2.7.3, 2.2.7.4] */ else { var result; try { result = cb(value); } /* [Promises/A+ 2.2.2.1, 2.2.3.1, 2.2.5, 3.2] */ catch (e) { next.reject(e); /* [Promises/A+ 2.2.7.2] */ return; } resolve(next, result); /* [Promises/A+ 2.2.7.1] */ } }; }; /* "Promise Resolution Procedure" */ /* [Promises/A+ 2.3] */ var resolve = function (promise, x) { /* sanity check arguments */ /* [Promises/A+ 2.3.1] */ if (promise === x || promise.proxy === x) { promise.reject(new TypeError("cannot resolve promise with itself")); return; } /* surgically check for a "then" method (mainly to just call the "getter" of "then" only once) */ var then; if ((typeof x === "object" && x !== null) || typeof x === "function") { try { then = x.then; } /* [Promises/A+ 2.3.3.1, 3.5] */ catch (e) { promise.reject(e); /* [Promises/A+ 2.3.3.2] */ return; } } /* handle own Thenables [Promises/A+ 2.3.2] and similar "thenables" [Promises/A+ 2.3.3] */ if (typeof then === "function") { var resolved = false; try { /* call retrieved "then" method */ /* [Promises/A+ 2.3.3.3] */ then.call(x, /* resolvePromise */ /* [Promises/A+ 2.3.3.3.1] */ function (y) { if (resolved) return; resolved = true; /* [Promises/A+ 2.3.3.3.3] */ if (y === x) /* [Promises/A+ 3.6] */ promise.reject(new TypeError("circular thenable chain")); else resolve(promise, y); }, /* rejectPromise */ /* [Promises/A+ 2.3.3.3.2] */ function (r) { if (resolved) return; resolved = true; /* [Promises/A+ 2.3.3.3.3] */ promise.reject(r); } ); } catch (e) { if (!resolved) /* [Promises/A+ 2.3.3.3.3] */ promise.reject(e); /* [Promises/A+ 2.3.3.3.4] */ } return; } /* handle other values */ promise.fulfill(x); /* [Promises/A+ 2.3.4, 2.3.3.4] */ }; /* export API */ return api; })(), //jscs:enable // Event // A contructor superclass for adding event menthods, on, off, emit. Event: function() { var separator = /[\s\,]+/; // If this doesn't support getPrototype then we can't get prototype.events of the parent // So lets get the current instance events, and add those to a parent property this.parent = { events: this.events, findEvents: this.findEvents, parent: this.parent, utils: this.utils }; this.events = {}; // On, subscribe to events // @param evt string // @param callback function this.on = function(evt, callback) { if (callback && typeof (callback) === 'function') { var a = evt.split(separator); for (var i = 0; i < a.length; i++) { // Has this event already been fired on this instance? this.events[a[i]] = [callback].concat(this.events[a[i]] || []); } } return this; }; // Off, unsubscribe to events // @param evt string // @param callback function this.off = function(evt, callback) { this.findEvents(evt, function(name, index) { if (!callback || this.events[name][index] === callback) { this.events[name][index] = null; } }); return this; }; // Emit // Triggers any subscribed events this.emit = function(evt /*, data, ... */) { // Get arguments as an Array, knock off the first one var args = Array.prototype.slice.call(arguments, 1); args.push(evt); // Handler var handler = function(name, index) { // Replace the last property with the event name args[args.length - 1] = (name === '*' ? evt : name); // Trigger this.events[name][index].apply(this, args); }; // Find the callbacks which match the condition and call var _this = this; while (_this && _this.findEvents) { // Find events which match _this.findEvents(evt + ',*', handler); _this = _this.parent; } return this; }; // // Easy functions this.emitAfter = function() { var _this = this; var args = arguments; setTimeout(function() { _this.emit.apply(_this, args); }, 0); return this; }; this.findEvents = function(evt, callback) { var a = evt.split(separator); for (var name in this.events) {if (this.events.hasOwnProperty(name)) { if (a.indexOf(name) > -1) { for (var i = 0; i < this.events[name].length; i++) { // Does the event handler exist? if (this.events[name][i]) { // Emit on the local instance of this callback.call(this, name, i); } } } }} }; return this; }, // Global Events // Attach the callback to the window object // Return its unique reference globalEvent: function(callback, guid) { // If the guid has not been supplied then create a new one. guid = guid || '_hellojs_' + parseInt(Math.random() * 1e12, 10).toString(36); // Define the callback function window[guid] = function() { // Trigger the callback try { bool = callback.apply(this, arguments); } catch (e) { console.error(e); } if (bool) { // Remove this handler reference try { delete window[guid]; } catch (e) {} } }; return guid; }, // Trigger a clientside popup // This has been augmented to support PhoneGap popup: function(url, redirectUri, options) { var documentElement = document.documentElement; // Multi Screen Popup Positioning (http://stackoverflow.com/a/16861050) // Credit: http://www.xtf.dk/2011/08/center-new-popup-window-even-on.html // Fixes dual-screen position Most browsers Firefox if (options.height) { var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var height = screen.height || window.innerHeight || documentElement.clientHeight; options.top = parseInt((height - options.height) / 2, 10) + dualScreenTop; } if (options.width) { var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var width = screen.width || window.innerWidth || documentElement.clientWidth; options.left = parseInt((width - options.width) / 2, 10) + dualScreenLeft; } // Convert options into an array var optionsArray = []; Object.keys(options).forEach(function(name) { var value = options[name]; optionsArray.push(name + (value !== null ? '=' + value : '')); }); // Create a function for reopening the popup, and assigning events to the new popup object // This is a fix whereby triggering the var open = function(url) { // Trigger callback var popup = window.open( url, '_blank', optionsArray.join(',') ); // PhoneGap support // Add an event listener to listen to the change in the popup windows URL // This must appear before popup.focus(); if (popup && popup.addEventListener) { // Get the origin of the redirect URI var a = hello.utils.url(redirectUri); var redirectUriOrigin = a.origin || (a.protocol + '//' + a.hostname); // Listen to changes in the InAppBrowser window popup.addEventListener('loadstart', function(e) { var url = e.url; // Is this the path, as given by the redirectUri? // Check the new URL agains the redirectUriOrigin. // According to #63 a user could click 'cancel' in some dialog boxes .... // The popup redirects to another page with the same origin, yet we still wish it to close. if (url.indexOf(redirectUriOrigin) !== 0) { return; } // Split appart the URL var a = hello.utils.url(url); // We dont have window operations on the popup so lets create some // The location can be augmented in to a location object like so... var _popup = { location: { // Change the location of the popup assign: function(location) { // Unfourtunatly an app is may not change the location of a InAppBrowser window. // So to shim this, just open a new one. popup.addEventListener('exit', function() { // For some reason its failing to close the window if a new window opens too soon. setTimeout(function() { open(location); }, 1000); }); }, search: a.search, hash: a.hash, href: a.href }, close: function() { if (popup.close) { popup.close(); } } }; // Then this URL contains information which HelloJS must process // URL string // Window - any action such as window relocation goes here // Opener - the parent window which opened this, aka this script hello.utils.responseHandler(_popup, window); // Always close the popup regardless of whether the hello.utils.responseHandler detects a state parameter or not in the querystring. // Such situations might arise such as those in #63 _popup.close(); }); } if (popup && popup.focus) { popup.focus(); } return popup; }; // Call the open() function with the initial path // // OAuth redirect, fixes URI fragments from being lost in Safari // (URI Fragments within 302 Location URI are lost over HTTPS) // Loading the redirect.html before triggering the OAuth Flow seems to fix it. // // Firefox decodes URL fragments when calling location.hash. // - This is bad if the value contains break points which are escaped // - Hence the url must be encoded twice as it contains breakpoints. if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) { url = redirectUri + '#oauth_redirect=' + encodeURIComponent(encodeURIComponent(url)); } return open(url); }, // OAuth and API response handler responseHandler: function(window, parent) { var _this = this; var p; var location = window.location; // Is this an auth relay message which needs to call the proxy? p = _this.param(location.search); // OAuth2 or OAuth1 server response? if (p && p.state && (p.code || p.oauth_token)) { var state = JSON.parse(p.state); // Add this path as the redirect_uri p.redirect_uri = state.redirect_uri || location.href.replace(/[\?\#].*$/, ''); // Redirect to the host var path = state.oauth_proxy + '?' + _this.param(p); location.assign(path); return; } // Save session, from redirected authentication // #access_token has come in? // // FACEBOOK is returning auth errors within as a query_string... thats a stickler for consistency. // SoundCloud is the state in the querystring and the token in the hashtag, so we'll mix the two together p = _this.merge(_this.param(location.search || ''), _this.param(location.hash || '')); // If p.state if (p && 'state' in p) { // Remove any addition information // E.g. p.state = 'facebook.page'; try { var a = JSON.parse(p.state); _this.extend(p, a); } catch (e) { console.error('Could not decode state parameter'); } // Access_token? if (('access_token' in p && p.access_token) && p.network) { if (!p.expires_in || parseInt(p.expires_in, 10) === 0) { // If p.expires_in is unset, set to 0 p.expires_in = 0; } p.expires_in = parseInt(p.expires_in, 10); p.expires = ((new Date()).getTime() / 1e3) + (p.expires_in || (60 * 60 * 24 * 365)); // Lets use the "state" to assign it to one of our networks authCallback(p, window, parent); } // Error=? // &error_description=? // &state=? else if (('error' in p && p.error) && p.network) { p.error = { code: p.error, message: p.error_message || p.error_description }; // Let the state handler handle it authCallback(p, window, parent); } // API call, or a cancelled login // Result is serialized JSON string else if (p.callback && p.callback in parent) { // Trigger a function in the parent var res = 'result' in p && p.result ? JSON.parse(p.result) : false; // Trigger the callback on the parent parent[p.callback](res); closeWindow(); } // If this page is still open if (p.page_uri) { location.assign(p.page_uri); } } // OAuth redirect, fixes URI fragments from being lost in Safari // (URI Fragments within 302 Location URI are lost over HTTPS) // Loading the redirect.html before triggering the OAuth Flow seems to fix it. else if ('oauth_redirect' in p) { location.assign(decodeURIComponent(p.oauth_redirect)); return; } // Trigger a callback to authenticate function authCallback(obj, window, parent) { // Trigger the callback on the parent _this.store(obj.network, obj); // If this is a page request it has no parent or opener window to handle callbacks if (('display' in obj) && obj.display === 'page') { return; } if (parent) { // Call the generic listeners // Win.hello.emit(network+":auth."+(obj.error?'failed':'login'), obj); // TODO: remove from session object var cb = obj.callback; try { delete obj.callback; } catch (e) {} // Update store _this.store(obj.network, obj); // Call the globalEvent function on the parent if (cb in parent) { // It's safer to pass back a string to the parent, // Rather than an object/array (better for IE8) var str = JSON.stringify(obj); try { parent[cb](str); } catch (e) { // Error thrown whilst executing parent callback } } } closeWindow(); } function closeWindow() { // Close this current window try { window.close(); } catch (e) {} // IOS bug wont let us close a popup if still loading if (window.addEventListener) { window.addEventListener('load', function() { window.close(); }); } } } }); // Events // Extend the hello object with its own event instance hello.utils.Event.call(hello); ///////////////////////////////////// // // Save any access token that is in the current page URL // Handle any response solicited through iframe hash tag following an API request // ///////////////////////////////////// hello.utils.responseHandler(window, window.opener || window.parent); /////////////////////////////////// // Monitoring session state // Check for session changes /////////////////////////////////// (function(hello) { // Monitor for a change in state and fire var oldSessions = {}; // Hash of expired tokens var expired = {}; // Listen to other triggers to Auth events, use these to update this hello.on('auth.login, auth.logout', function(auth) { if (auth && typeof (auth) === 'object' && auth.network) { oldSessions[auth.network] = hello.utils.store(auth.network) || {}; } }); (function self() { var CURRENT_TIME = ((new Date()).getTime() / 1e3); var emit = function(eventName) { hello.emit('auth.' + eventName, { network: name, authResponse: session }); }; // Loop through the services for (var name in hello.services) {if (hello.services.hasOwnProperty(name)) { if (!hello.services[name].id) { // We haven't attached an ID so dont listen. continue; } // Get session var session = hello.utils.store(name) || {}; var provider = hello.services[name]; var oldSess = oldSessions[name] || {}; // Listen for globalEvents that did not get triggered from the child if (session && 'callback' in session) { // To do remove from session object... var cb = session.callback; try { delete session.callback; } catch (e) {} // Update store // Removing the callback hello.utils.store(name, session); // Emit global events try { window[cb](session); } catch (e) {} } // Refresh token if (session && ('expires' in session) && session.expires < CURRENT_TIME) { // If auto refresh is possible // Either the browser supports var refresh = provider.refresh || session.refresh_token; // Has the refresh been run recently? if (refresh && (!(name in expired) || expired[name] < CURRENT_TIME)) { // Try to resignin hello.emit('notice', name + ' has expired trying to resignin'); hello.login(name, {display: 'none', force: false}); // Update expired, every 10 minutes expired[name] = CURRENT_TIME + 600; } // Does this provider not support refresh else if (!refresh && !(name in expired)) { // Label the event emit('expired'); expired[name] = true; } // If session has expired then we dont want to store its value until it can be established that its been updated continue; } // Has session changed? else if (oldSess.access_token === session.access_token && oldSess.expires === session.expires) { continue; } // Access_token has been removed else if (!session.access_token && oldSess.access_token) { emit('logout'); } // Access_token has been created else if (session.access_token && !oldSess.access_token) { emit('login'); } // Access_token has been updated else if (session.expires !== oldSess.expires) { emit('update'); } // Updated stored session oldSessions[name] = session; // Remove the expired flags if (name in expired) { delete expired[name]; } }} // Check error events setTimeout(self, 1000); })(); })(hello); // EOF CORE lib ////////////////////////////////// ///////////////////////////////////////// // API // @param path string // @param query object (optional) // @param method string (optional) // @param data object (optional) // @param timeout integer (optional) // @param callback function (optional) hello.api = function() { // Shorthand var _this = this; var utils = _this.utils; var error = utils.error; // Construct a new Promise object var promise = utils.Promise(); // Arguments var p = utils.args({path: 's!', query: 'o', method: 's', data: 'o', timeout: 'i', callback: 'f'}, arguments); // Method p.method = (p.method || 'get').toLowerCase(); // Headers p.headers = p.headers || {}; // Query p.query = p.query || {}; // If get, put all parameters into query if (p.method === 'get' || p.method === 'delete') { utils.extend(p.query, p.data); p.data = {}; } var data = p.data = p.data || {}; // Completed event callback promise.then(p.callback, p.callback); // Remove the network from path, e.g. facebook:/me/friends // Results in { network : facebook, path : me/friends } if (!p.path) { return promise.reject(error('invalid_path', 'Missing the path parameter from the request')); } p.path = p.path.replace(/^\/+/, ''); var a = (p.path.split(/[\/\:]/, 2) || [])[0].toLowerCase(); if (a in _this.services) { p.network = a; var reg = new RegExp('^' + a + ':?\/?'); p.path = p.path.replace(reg, ''); } // Network & Provider // Define the network that this request is made for p.network = _this.settings.default_service = p.network || _this.settings.default_service; var o = _this.services[p.network]; // INVALID // Is there no service by the given network name? if (!o) { return promise.reject(error('invalid_network', 'Could not match the service requested: ' + p.network)); } // PATH // As long as the path isn't flagged as unavaiable, e.g. path == false if (!(!(p.method in o) || !(p.path in o[p.method]) || o[p.method][p.path] !== false)) { return promise.reject(error('invalid_path', 'The provided path is not available on the selected network')); } // PROXY // OAuth1 calls always need a proxy if (!p.oauth_proxy) { p.oauth_proxy = _this.settings.oauth_proxy; } if (!('proxy' in p)) { p.proxy = p.oauth_proxy && o.oauth && parseInt(o.oauth.version, 10) === 1; } // TIMEOUT // Adopt timeout from global settings by default if (!('timeout' in p)) { p.timeout = _this.settings.timeout; } // // Get the current session // Append the access_token to the query var session = _this.getAuthResponse(p.network); if (session && session.access_token) { p.query.access_token = session.access_token; } var url = p.path; var m; // Store the query as options // This is used to populate the request object before the data is augmented by the prewrap handlers. p.options = utils.clone(p.query); // Clone the data object // Prevent this script overwriting the data of the incoming object. // Ensure that everytime we run an iteration the callbacks haven't removed some data p.data = utils.clone(data); // URL Mapping // Is there a map for the given URL? var actions = o[{'delete': 'del'}[p.method] || p.method] || {}; // Extrapolate the QueryString // Provide a clean path // Move the querystring into the data if (p.method === 'get') { var query = url.split(/[\?#]/)[1]; if (query) { utils.extend(p.query, utils.param(query)); // Remove the query part from the URL url = url.replace(/\?.*?(#|$)/, '$1'); } } // Is the hash fragment defined if ((m = url.match(/#(.+)/, ''))) { url = url.split('#')[0]; p.path = m[1]; } else if (url in actions) { p.path = url; url = actions[url]; } else if ('default' in actions) { url = actions['default']; } // Redirect Handler // This defines for the Form+Iframe+Hash hack where to return the results too. p.redirect_uri = _this.settings.redirect_uri; // Set OAuth settings p.oauth = o.oauth; // Define FormatHandler // The request can be procesed in a multitude of ways // Here's the options - depending on the browser and endpoint p.xhr = o.xhr; p.jsonp = o.jsonp; p.form = o.form; // Make request if (typeof (url) === 'function') { // Does self have its own callback? url(p, getPath); } else { // Else the URL is a string getPath(url); } return promise.proxy; // If url needs a base // Wrap everything in function getPath(url) { // Format the string if it needs it url = url.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi, function(m, key, defaults) { var val = defaults ? defaults.replace(/^\|/, '') : ''; if (key in p.query) { val = p.query[key]; delete p.query[key]; } else if (!defaults) { promise.reject(error('missing_attribute', 'The attribute ' + key + ' is missing from the request')); } return val; }); // Add base if (!url.match(/^https?:\/\//)) { url = o.base + url; } // Define the request URL p.url = url; // Make the HTTP request with the curated request object // CALLBACK HANDLER // @ response object // @ statusCode integer if available utils.request(p, function(r, headers) { // Should this be an object if (r === true) { r = {success:true}; } else if (!r) { r = {}; } // The delete callback needs a better response if (p.method === 'delete') { r = (!r || utils.isEmpty(r)) ? {success:true} : r; } // FORMAT RESPONSE? // Does self request have a corresponding formatter if (o.wrap && ((p.path in o.wrap) || ('default' in o.wrap))) { var wrap = (p.path in o.wrap ? p.path : 'default'); var time = (new Date()).getTime(); // FORMAT RESPONSE var b = o.wrap[wrap](r, headers, p); // Has the response been utterly overwritten? // Typically self augments the existing object.. but for those rare occassions if (b) { r = b; } } // Is there a next_page defined in the response? if (r && 'paging' in r && r.paging.next) { // Add the relative path if it is missing from the paging/next path if (r.paging.next[0] === '?') { r.paging.next = p.path + r.paging.next; } // The relative path has been defined, lets markup the handler in the HashFragment else { r.paging.next += '#' + p.path; } } // Dispatch to listeners // Emit events which pertain to the formatted response if (!r || 'error' in r) { promise.reject(r); } else { promise.fulfill(r); } }); } }; // API utilities hello.utils.extend(hello.utils, { // Make an HTTP request request: function(p, callback) { var _this = this; var error = _this.error; // This has to go through a POST request if (!_this.isEmpty(p.data) && !('FileList' in window) && _this.hasBinary(p.data)) { // Disable XHR and JSONP p.xhr = false; p.jsonp = false; } // Check if the browser and service support CORS if ( 'withCredentials' in new XMLHttpRequest() && (!('xhr' in p) || (p.xhr && (typeof (p.xhr) !== 'function' || p.xhr(p, p.query)))) ) { formatUrl(p, function(url) { var x = _this.xhr(p.method, url, p.headers, p.data, callback); x.onprogress = p.onprogress || null; // Windows Phone does not support xhr.upload, see #74 // Feature detect if (x.upload && p.onuploadprogress) { x.upload.onprogress = p.onuploadprogress; } }); return; } // Clone the query object // Each request modifies the query object and needs to be tared after each one. var _query = p.query; p.query = _this.clone(p.query); // Assign a new callbackID p.callbackID = _this.globalEvent(); // JSONP if (p.jsonp !== false) { // Clone the query object p.query.callback = p.callbackID; // If the JSONP is a function then run it if (typeof (p.jsonp) === 'function') { p.jsonp(p, p.query); } // Lets use JSONP if the method is 'get' if (p.method === 'get') { formatUrl(p, function(url) { _this.jsonp(url, callback, p.callbackID, p.timeout); }); return; } else { // It's not compatible reset query p.query = _query; } } // Otherwise we're on to the old school, iframe hacks and JSONP if (p.form !== false) { // Add some additional query parameters to the URL // We're pretty stuffed if the endpoint doesn't like these p.query.redirect_uri = p.redirect_uri; p.query.state = JSON.stringify({callback:p.callbackID}); var opts; if (typeof (p.form) === 'function') { // Format the request opts = p.form(p, p.query); } if (p.method === 'post' && opts !== false) { formatUrl(p, function(url) { _this.post(url, p.data, opts, callback, p.callbackID, p.timeout); }); return; } } // None of the methods were successful throw an error callback(error('invalid_request', 'There was no mechanism for handling this request')); return; // Format URL // Constructs the request URL, optionally wraps the URL through a call to a proxy server // Returns the formatted URL function formatUrl(p, callback) { // Are we signing the request? var sign; // OAuth1 // Remove the token from the query before signing if (p.oauth && parseInt(p.oauth.version, 10) === 1) { // OAUTH SIGNING PROXY sign = p.query.access_token; // Remove the access_token delete p.query.access_token; // Enfore use of Proxy p.proxy = true; } // POST body to querystring if (p.data && (p.method === 'get' || p.method === 'delete')) { // Attach the p.data to the querystring. _this.extend(p.query, p.data); p.data = null; } // Construct the path var path = _this.qs(p.url, p.query); // Proxy the request through a server // Used for signing OAuth1 // And circumventing services without Access-Control Headers if (p.proxy) { // Use the proxy as a path path = _this.qs(p.oauth_proxy, { path: path, access_token: sign || '', // This will prompt the request to be signed as though it is OAuth1 then: p.proxy_response_type || (p.method.toLowerCase() === 'get' ? 'redirect' : 'proxy'), method: p.method.toLowerCase(), suppress_response_codes: true }); } callback(path); } }, // Return the type of DOM object domInstance: function(type, data) { var test = 'HTML' + (type || '').replace( /^[a-z]/, function(m) { return m.toUpperCase(); } ) + 'Element'; if (!data) { return false; } if (window[test]) { return data instanceof window[test]; } else if (window.Element) { return data instanceof window.Element && (!type || (data.tagName && data.tagName.toLowerCase() === type)); } else { return (!(data instanceof Object || data instanceof Array || data instanceof String || data instanceof Number) && data.tagName && data.tagName.toLowerCase() === type); } }, // Create a clone of an object clone: function(obj) { // Does not clone DOM elements, nor Binary data, e.g. Blobs, Filelists if (obj === null || typeof (obj) !== 'object' || obj instanceof Date || 'nodeName' in obj || this.isBinary(obj)) { return obj; } if (Array.isArray(obj)) { // Clone each item in the array return obj.map(this.clone.bind(this)); } // But does clone everything else. var clone = {}; for (var x in obj) { clone[x] = this.clone(obj[x]); } return clone; }, // XHR: uses CORS to make requests xhr: function(method, url, headers, data, callback) { var r = new XMLHttpRequest(); var error = this.error; // Binary? var binary = false; if (method === 'blob') { binary = method; method = 'GET'; } method = method.toUpperCase(); // Xhr.responseType 'json' is not supported in any of the vendors yet. r.onload = function(e) { var json = r.response; try { json = JSON.parse(r.responseText); } catch (_e) { if (r.status === 401) { json = error('access_denied', r.statusText); } } var headers = headersToJSON(r.getAllResponseHeaders()); headers.statusCode = r.status; callback(json || (method === 'GET' ? error('empty_response', 'Could not get resource') : {}), headers); }; r.onerror = function(e) { var json = r.responseText; try { json = JSON.parse(r.responseText); } catch (_e) {} callback(json || error('access_denied', 'Could not get resource')); }; var x; // Should we add the query to the URL? if (method === 'GET' || method === 'DELETE') { data = null; } else if (data && typeof (data) !== 'string' && !(data instanceof FormData) && !(data instanceof File) && !(data instanceof Blob)) { // Loop through and add formData var f = new FormData(); for (x in data) if (data.hasOwnProperty(x)) { if (data[x] instanceof HTMLInputElement) { if ('files' in data[x] && data[x].files.length > 0) { f.append(x, data[x].files[0]); } } else if (data[x] instanceof Blob) { f.append(x, data[x], data.name); } else { f.append(x, data[x]); } } data = f; } // Open the path, async r.open(method, url, true); if (binary) { if ('responseType' in r) { r.responseType = binary; } else { r.overrideMimeType('text/plain; charset=x-user-defined'); } } // Set any bespoke headers if (headers) { for (x in headers) { r.setRequestHeader(x, headers[x]); } } r.send(data); return r; // Headers are returned as a string function headersToJSON(s) { var r = {}; var reg = /([a-z\-]+):\s?(.*);?/gi; var m; while ((m = reg.exec(s))) { r[m[1]] = m[2]; } return r; } }, // JSONP // Injects a script tag into the DOM to be executed and appends a callback function to the window object // @param string/function pathFunc either a string of the URL or a callback function pathFunc(querystringhash, continueFunc); // @param function callback a function to call on completion; jsonp: function(url, callback, callbackID, timeout) { var _this = this; var error = _this.error; // Change the name of the callback var bool = 0; var head = document.getElementsByTagName('head')[0]; var operaFix; var result = error('server_error', 'server_error'); var cb = function() { if (!(bool++)) { window.setTimeout(function() { callback(result); head.removeChild(script); }, 0); } }; // Add callback to the window object callbackID = _this.globalEvent(function(json) { result = json; return true; // Mark callback as done }, callbackID); // The URL is a function for some cases and as such // Determine its value with a callback containing the new parameters of this function. url = url.replace(new RegExp('=\\?(&|$)'), '=' + callbackID + '$1'); // Build script tag var script = _this.append('script', { id: callbackID, name: callbackID, src: url, async: true, onload: cb, onerror: cb, onreadystatechange: function() { if (/loaded|complete/i.test(this.readyState)) { cb(); } } }); // Opera fix error // Problem: If an error occurs with script loading Opera fails to trigger the script.onerror handler we specified // // Fix: // By setting the request to synchronous we can trigger the error handler when all else fails. // This action will be ignored if we've already called the callback handler "cb" with a successful onload event if (window.navigator.userAgent.toLowerCase().indexOf('opera') > -1) { operaFix = _this.append('script', { text: 'document.getElementById(\'' + callbackId + '\').onerror();' }); script.async = false; } // Add timeout if (timeout) { window.setTimeout(function() { result = error('timeout', 'timeout'); cb(); }, timeout); } // TODO: add fix for IE, // However: unable recreate the bug of firing off the onreadystatechange before the script content has been executed and the value of "result" has been defined. // Inject script tag into the head element head.appendChild(script); // Append Opera Fix to run after our script if (operaFix) { head.appendChild(operaFix); } }, // Post // Send information to a remote location using the post mechanism // @param string uri path // @param object data, key value data to send // @param function callback, function to execute in response post: function(url, data, options, callback, callbackID, timeout) { var _this = this; var error = _this.error; var doc = document; // This hack needs a form var form = null; var reenableAfterSubmit = []; var newform; var i = 0; var x = null; var bool = 0; var cb = function(r) { if (!(bool++)) { callback(r); } }; // What is the name of the callback to contain // We'll also use this to name the iframe _this.globalEvent(cb, callbackID); // Build the iframe window var win; try { // IE7 hack, only lets us define the name here, not later. win = doc.createElement('<iframe name="' + callbackID + '">'); } catch (e) { win = doc.createElement('iframe'); } win.name = callbackID; win.id = callbackID; win.style.display = 'none'; // Override callback mechanism. Triggger a response onload/onerror if (options && options.callbackonload) { // Onload is being fired twice win.onload = function() { cb({ response: 'posted', message: 'Content was posted' }); }; } if (timeout) { setTimeout(function() { cb(error('timeout', 'The post operation timed out')); }, timeout); } doc.body.appendChild(win); // If we are just posting a single item if (_this.domInstance('form', data)) { // Get the parent form form = data.form; // Loop through and disable all of its siblings for (i = 0; i < form.elements.length; i++) { if (form.elements[i] !== data) { form.elements[i].setAttribute('disabled', true); } } // Move the focus to the form data = form; } // Posting a form if (_this.domInstance('form', data)) { // This is a form element form = data; // Does this form need to be a multipart form? for (i = 0; i < form.elements.length; i++) { if (!form.elements[i].disabled && form.elements[i].type === 'file') { form.encoding = form.enctype = 'multipart/form-data'; form.elements[i].setAttribute('name', 'file'); } } } else { // Its not a form element, // Therefore it must be a JSON object of Key=>Value or Key=>Element // If anyone of those values are a input type=file we shall shall insert its siblings into the form for which it belongs. for (x in data) if (data.hasOwnProperty(x)) { // Is this an input Element? if (_this.domInstance('input', data[x]) && data[x].type === 'file') { form = data[x].form; form.encoding = form.enctype = 'multipart/form-data'; } } // Do If there is no defined form element, lets create one. if (!form) { // Build form form = doc.createElement('form'); doc.body.appendChild(form); newform = form; } var input; // Add elements to the form if they dont exist for (x in data) if (data.hasOwnProperty(x)) { // Is this an element? var el = (_this.domInstance('input', data[x]) || _this.domInstance('textArea', data[x]) || _this.domInstance('select', data[x])); // Is this not an input element, or one that exists outside the form. if (!el || data[x].form !== form) { // Does an element have the same name? var inputs = form.elements[x]; if (input) { // Remove it. if (!(inputs instanceof NodeList)) { inputs = [inputs]; } for (i = 0; i < inputs.length; i++) { inputs[i].parentNode.removeChild(inputs[i]); } } // Create an input element input = doc.createElement('input'); input.setAttribute('type', 'hidden'); input.setAttribute('name', x); // Does it have a value attribute? if (el) { input.value = data[x].value; } else if (_this.domInstance(null, data[x])) { input.value = data[x].innerHTML || data[x].innerText; } else { input.value = data[x]; } form.appendChild(input); } // It is an element, which exists within the form, but the name is wrong else if (el && data[x].name !== x) { data[x].setAttribute('name', x); data[x].name = x; } } // Disable elements from within the form if they weren't specified for (i = 0; i < form.elements.length; i++) { input = form.elements[i]; // Does the same name and value exist in the parent if (!(input.name in data) && input.getAttribute('disabled') !== true) { // Disable input.setAttribute('disabled', true); // Add re-enable to callback reenableAfterSubmit.push(input); } } } // Set the target of the form form.setAttribute('method', 'POST'); form.setAttribute('target', callbackID); form.target = callbackID; // Update the form URL form.setAttribute('action', url); // Submit the form // Some reason this needs to be offset from the current window execution setTimeout(function() { form.submit(); setTimeout(function() { try { // Remove the iframe from the page. //win.parentNode.removeChild(win); // Remove the form if (newform) { newform.parentNode.removeChild(newform); } } catch (e) { try { console.error('HelloJS: could not remove iframe'); } catch (ee) {} } // Reenable the disabled form for (var i = 0; i < reenableAfterSubmit.length; i++) { if (reenableAfterSubmit[i]) { reenableAfterSubmit[i].setAttribute('disabled', false); reenableAfterSubmit[i].disabled = false; } } }, 0); }, 100); }, // Some of the providers require that only multipart is used with non-binary forms. // This function checks whether the form contains binary data hasBinary: function(data) { for (var x in data) if (data.hasOwnProperty(x)) { if (this.isBinary(data[x])) { return true; } } return false; }, // Determines if a variable Either Is or like a FormInput has the value of a Blob isBinary: function(data) { return data instanceof Object && ( (this.domInstance('input', data) && data.type === 'file') || ('FileList' in window && data instanceof window.FileList) || ('File' in window && data instanceof window.File) || ('Blob' in window && data instanceof window.Blob)); }, // Convert Data-URI to Blob string toBlob: function(dataURI) { var reg = /^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i; var m = dataURI.match(reg); if (!m) { return dataURI; } var binary = atob(dataURI.replace(reg, '')); var array = []; for (var i = 0; i < binary.length; i++) { array.push(binary.charCodeAt(i)); } return new Blob([new Uint8Array(array)], {type: m[1]}); } }); // EXTRA: Convert FormElement to JSON for POSTing // Wrappers to add additional functionality to existing functions (function(hello) { // Copy original function var api = hello.api; var utils = hello.utils; utils.extend(utils, { // DataToJSON // This takes a FormElement|NodeList|InputElement|MixedObjects and convers the data object to JSON. dataToJSON: function(p) { var _this = this; var w = window; var data = p.data; // Is data a form object if (_this.domInstance('form', data)) { data = _this.nodeListToJSON(data.elements); } else if ('NodeList' in w && data instanceof NodeList) { data = _this.nodeListToJSON(data); } else if (_this.domInstance('input', data)) { data = _this.nodeListToJSON([data]); } // Is data a blob, File, FileList? if (('File' in w && data instanceof w.File) || ('Blob' in w && data instanceof w.Blob) || ('FileList' in w && data instanceof w.FileList)) { data = {file: data}; } // Loop through data if it's not form data it must now be a JSON object if (!('FormData' in w && data instanceof w.FormData)) { for (var x in data) if (data.hasOwnProperty(x)) { if ('FileList' in w && data[x] instanceof w.FileList) { if (data[x].length === 1) { data[x] = data[x][0]; } } else if (_this.domInstance('input', data[x]) && data[x].type === 'file') { continue; } else if (_this.domInstance('input', data[x]) || _this.domInstance('select', data[x]) || _this.domInstance('textArea', data[x])) { data[x] = data[x].value; } else if (_this.domInstance(null, data[x])) { data[x] = data[x].innerHTML || data[x].innerText; } } } p.data = data; return data; }, // NodeListToJSON // Given a list of elements extrapolate their values and return as a json object nodeListToJSON: function(nodelist) { var json = {}; // Create a data string for (var i = 0; i < nodelist.length; i++) { var input = nodelist[i]; // If the name of the input is empty or diabled, dont add it. if (input.disabled || !input.name) { continue; } // Is this a file, does the browser not support 'files' and 'FormData'? if (input.type === 'file') { json[input.name] = input; } else { json[input.name] = input.value || input.innerHTML; } } return json; } }); // Replace it hello.api = function() { // Get arguments var p = utils.args({path: 's!', method: 's', data:'o', timeout: 'i', callback: 'f'}, arguments); // Change for into a data object if (p.data) { utils.dataToJSON(p); } return api.call(this, p); }; })(hello); (function(hello) { hello.init({ dropbox: { name: 'Dropbox', oauth: { version: '1.0', auth: 'https://www.dropbox.com/1/oauth/authorize', request: 'https://api.dropbox.com/1/oauth/request_token', token: 'https://api.dropbox.com/1/oauth/access_token' }, login: function(p) { // The dropbox login window is a different size p.options.popup.width = 1000; p.options.popup.height = 1000; }, /* Dropbox does not allow insecure HTTP URI's in the redirect_uri field ...otherwise I'd love to use OAuth2 Follow request https://forums.dropbox.com/topic.php?id=106505 p.qs.response_type = 'code'; oauth: { version: 2, auth: 'https://www.dropbox.com/1/oauth2/authorize', grant: 'https://api.dropbox.com/1/oauth2/token' } */ // API Base URL base: 'https://api.dropbox.com/1/', // Bespoke setting: this is states whether to use the custom environment of Dropbox or to use their own environment // Because it's notoriously difficult for Dropbox too provide access from other webservices, this defaults to Sandbox root: 'sandbox', // Map GET requests get: { me: 'account/info', // Https://www.dropbox.com/developers/core/docs#metadata 'me/files': req('metadata/auto/@{parent|}'), 'me/folder': req('metadata/auto/@{id}'), 'me/folders': req('metadata/auto/'), 'default': function(p, callback) { if (p.path.match('https://api-content.dropbox.com/1/files/')) { // This is a file, return binary data p.method = 'blob'; } callback(p.path); } }, post: { 'me/files': function(p, callback) { var path = p.data.parent; var fileName = p.data.name; p.data = { file: p.data.file }; // Does this have a data-uri to upload as a file? if (typeof (p.data.file) === 'string') { p.data.file = hello.utils.toBlob(p.data.file); } callback('https://api-content.dropbox.com/1/files_put/auto/' + path + '/' + fileName); }, 'me/folders': function(p, callback) { var name = p.data.name; p.data = {}; callback('fileops/create_folder?root=@{root|sandbox}&' + hello.utils.param({ path: name })); } }, // Map DELETE requests del: { 'me/files': 'fileops/delete?root=@{root|sandbox}&path=@{id}', 'me/folder': 'fileops/delete?root=@{root|sandbox}&path=@{id}' }, wrap: { me: function(o) { formatError(o); if (!o.uid) { return o; } o.name = o.display_name; var m = o.name.split(' '); o.first_name = m.shift(); o.last_name = m.join(' '); o.id = o.uid; delete o.uid; delete o.display_name; return o; }, 'default': function(o, headers, req) { formatError(o); if (o.is_dir && o.contents) { o.data = o.contents; delete o.contents; o.data.forEach(function(item) { item.root = o.root; formatFile(item, headers, req); }); } formatFile(o, headers, req); if (o.is_deleted) { o.success = true; } return o; } }, // Doesn't return the CORS headers xhr: function(p) { // The proxy supports allow-cross-origin-resource // Alas that's the only thing we're using. if (p.data && p.data.file) { var file = p.data.file; if (file) { if (file.files) { p.data = file.files[0]; } else { p.data = file; } } } if (p.method === 'delete') { p.method = 'post'; } return true; }, form: function(p, qs) { delete qs.state; delete qs.redirect_uri; } } }); function formatError(o) { if (o && 'error' in o) { o.error = { code: 'server_error', message: o.error.message || o.error }; } } function formatFile(o, headers, req) { if (typeof o !== 'object' || (typeof Blob !== 'undefined' && o instanceof Blob) || (typeof ArrayBuffer !== 'undefined' && o instanceof ArrayBuffer)) { // This is a file, let it through unformatted return; } if ('error' in o) { return; } var path = (o.root !== 'app_folder' ? o.root : '') + o.path.replace(/\&/g, '%26'); path = path.replace(/^\//, ''); if (o.thumb_exists) { o.thumbnail = req.oauth_proxy + '?path=' + encodeURIComponent('https://api-content.dropbox.com/1/thumbnails/auto/' + path + '?format=jpeg&size=m') + '&access_token=' + req.options.access_token; } o.type = (o.is_dir ? 'folder' : o.mime_type); o.name = o.path.replace(/.*\//g, ''); if (o.is_dir) { o.files = path.replace(/^\//, ''); } else { o.downloadLink = hello.settings.oauth_proxy + '?path=' + encodeURIComponent('https://api-content.dropbox.com/1/files/auto/' + path) + '&access_token=' + req.options.access_token; o.file = 'https://api-content.dropbox.com/1/files/auto/' + path; } if (!o.id) { o.id = o.path.replace(/^\//, ''); } // O.media = 'https://api-content.dropbox.com/1/files/' + path; } function req(str) { return function(p, cb) { delete p.query.limit; cb(str); }; } })(hello); (function(hello) { hello.init({ facebook: { name: 'Facebook', // SEE https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.1 oauth: { version: 2, auth: 'https://www.facebook.com/dialog/oauth/', grant: 'https://graph.facebook.com/oauth/access_token' }, // Authorization scopes scope: { basic: 'public_profile', email: 'email', birthday: 'user_birthday', events: 'user_events', photos: 'user_photos,user_videos', videos: 'user_photos,user_videos', friends: 'user_friends', files: 'user_photos,user_videos', publish_files: 'user_photos,user_videos,publish_actions', publish: 'publish_actions', // Deprecated in v2.0 // Create_event : 'create_event', offline_access: 'offline_access' }, // Refresh the access_token refresh: true, login: function(p) { // Reauthenticate // https://developers.facebook.com/docs/facebook-login/reauthentication if (p.options.force) { p.qs.auth_type = 'reauthenticate'; } // Support Facebook's unique auth_type parameter if (p.options.auth_type) { p.qs.auth_type = p.options.auth_type; } // The facebook login window is a different size. p.options.popup.width = 580; p.options.popup.height = 400; }, logout: function(callback) { // Assign callback to a global handler var callbackID = hello.utils.globalEvent(callback); var redirect = encodeURIComponent(hello.settings.redirect_uri + '?' + hello.utils.param({callback:callbackID, result: JSON.stringify({force:true}), state: '{}'})); var token = (hello.utils.store('facebook') || {}).access_token; hello.utils.iframe('https://www.facebook.com/logout.php?next=' + redirect + '&access_token=' + token); // Possible responses: // String URL - hello.logout should handle the logout // Undefined - this function will handle the callback // True - throw a success, this callback isn't handling the callback // False - throw a error if (!token) { // If there isn't a token, the above wont return a response, so lets trigger a response return false; } }, // API Base URL base: 'https://graph.facebook.com/', // Map GET requests get: { me: 'me', 'me/friends': 'me/friends', 'me/following': 'me/friends', 'me/followers': 'me/friends', 'me/share': 'me/feed', 'me/like': 'me/likes', 'me/files': 'me/albums', 'me/albums': 'me/albums', 'me/album': '@{id}/photos', 'me/photos': 'me/photos', 'me/photo': '@{id}', 'friend/albums': '@{id}/albums', 'friend/photos': '@{id}/photos' // Pagination // Https://developers.facebook.com/docs/reference/api/pagination/ }, // Map POST requests post: { 'me/share': 'me/feed', 'me/photo': '@{id}' // Https://developers.facebook.com/docs/graph-api/reference/v2.2/object/likes/ }, wrap: { me: formatUser, 'me/friends': formatFriends, 'me/following': formatFriends, 'me/followers': formatFriends, 'me/albums': format, 'me/photos': format, 'me/files': format, 'default': format }, // Special requirements for handling XHR xhr: function(p, qs) { if (p.method === 'get' || p.method === 'post') { qs.suppress_response_codes = true; } // Is this a post with a data-uri? if (p.method === 'post' && p.data && typeof (p.data.file) === 'string') { // Convert the Data-URI to a Blob p.data.file = hello.utils.toBlob(p.data.file); } return true; }, // Special requirements for handling JSONP fallback jsonp: function(p, qs) { var m = p.method; if (m !== 'get' && !hello.utils.hasBinary(p.data)) { p.data.method = m; p.method = 'get'; } else if (p.method === 'delete') { qs.method = 'delete'; p.method = 'post'; } }, // Special requirements for iframe form hack form: function(p) { return { // Fire the callback onload callbackonload: true }; } } }); var base = 'https://graph.facebook.com/'; function formatUser(o) { if (o.id) { o.thumbnail = o.picture = 'https://graph.facebook.com/' + o.id + '/picture'; } return o; } function formatFriends(o) { if ('data' in o) { o.data.forEach(formatUser); } return o; } function format(o, headers, req) { if (typeof o === 'boolean') { o = {success: o}; } if (o && 'data' in o) { var token = req.query.access_token; o.data.forEach(function(d) { if (d.picture) { d.thumbnail = d.picture; } d.pictures = (d.images || []) .sort(function(a, b) { return a.width - b.width; }); if (d.cover_photo) { d.thumbnail = base + d.cover_photo + '/picture?access_token=' + token; } if (d.type === 'album') { d.files = d.photos = base + d.id + '/photos'; } if (d.can_upload) { d.upload_location = base + d.id + '/photos'; } }); } return o; } })(hello); (function(hello) { hello.init({ flickr: { name: 'Flickr', // Ensure that you define an oauth_proxy oauth: { version: '1.0a', auth: 'https://www.flickr.com/services/oauth/authorize?perms=read', request: 'https://www.flickr.com/services/oauth/request_token', token: 'https://www.flickr.com/services/oauth/access_token' }, // API base URL base: 'https://api.flickr.com/services/rest', // Map GET resquests get: { me: sign('flickr.people.getInfo'), 'me/friends': sign('flickr.contacts.getList', {per_page:'@{limit|50}'}), 'me/following': sign('flickr.contacts.getList', {per_page:'@{limit|50}'}), 'me/followers': sign('flickr.contacts.getList', {per_page:'@{limit|50}'}), 'me/albums': sign('flickr.photosets.getList', {per_page:'@{limit|50}'}), 'me/album': sign('flickr.photosets.getPhotos', {photoset_id: '@{id}'}), 'me/photos': sign('flickr.people.getPhotos', {per_page:'@{limit|50}'}) }, wrap: { me: function(o) { formatError(o); o = checkResponse(o, 'person'); if (o.id) { if (o.realname) { o.name = o.realname._content; var m = o.name.split(' '); o.first_name = m.shift(); o.last_name = m.join(' '); } o.thumbnail = getBuddyIcon(o, 'l'); o.picture = getBuddyIcon(o, 'l'); } return o; }, 'me/friends': formatFriends, 'me/followers': formatFriends, 'me/following': formatFriends, 'me/albums': function(o) { formatError(o); o = checkResponse(o, 'photosets'); paging(o); if (o.photoset) { o.data = o.photoset; o.data.forEach(function(item) { item.name = item.title._content; item.photos = 'https://api.flickr.com/services/rest' + getApiUrl('flickr.photosets.getPhotos', {photoset_id: item.id}, true); }); delete o.photoset; } return o; }, 'me/photos': function(o) { formatError(o); return formatPhotos(o); }, 'default': function(o) { formatError(o); return formatPhotos(o); } }, xhr: false, jsonp: function(p, qs) { if (p.method == 'get') { delete qs.callback; qs.jsoncallback = p.callbackID; } } } }); function getApiUrl(method, extraParams, skipNetwork) { var url = ((skipNetwork) ? '' : 'flickr:') + '?method=' + method + '&api_key=' + hello.services.flickr.id + '&format=json'; for (var param in extraParams) { if (extraParams.hasOwnProperty(param)) { url += '&' + param + '=' + extraParams[param]; } } return url; } // This is not exactly neat but avoid to call // The method 'flickr.test.login' for each api call function withUser(cb) { var auth = hello.getAuthResponse('flickr'); cb(auth && auth.user_nsid ? auth.user_nsid : null); } function sign(url, params) { if (!params) { params = {}; } return function(p, callback) { withUser(function(userId) { params.user_id = userId; callback(getApiUrl(url, params, true)); }); }; } function getBuddyIcon(profile, size) { var url = 'https://www.flickr.com/images/buddyicon.gif'; if (profile.nsid && profile.iconserver && profile.iconfarm) { url = 'https://farm' + profile.iconfarm + '.staticflickr.com/' + profile.iconserver + '/' + 'buddyicons/' + profile.nsid + ((size) ? '_' + size : '') + '.jpg'; } return url; } // See: https://www.flickr.com/services/api/misc.urls.html function createPhotoUrl(id, farm, server, secret, size) { size = (size) ? '_' + size : ''; return 'https://farm' + farm + '.staticflickr.com/' + server + '/' + id + '_' + secret + size + '.jpg'; } function formatUser(o) { } function formatError(o) { if (o && o.stat && o.stat.toLowerCase() != 'ok') { o.error = { code: 'invalid_request', message: o.message }; } } function formatPhotos(o) { if (o.photoset || o.photos) { var set = ('photoset' in o) ? 'photoset' : 'photos'; o = checkResponse(o, set); paging(o); o.data = o.photo; delete o.photo; for (var i = 0; i < o.data.length; i++) { var photo = o.data[i]; photo.name = photo.title; photo.picture = createPhotoUrl(photo.id, photo.farm, photo.server, photo.secret, ''); photo.pictures = createPictures(photo.id, photo.farm, photo.server, photo.secret); photo.source = createPhotoUrl(photo.id, photo.farm, photo.server, photo.secret, 'b'); photo.thumbnail = createPhotoUrl(photo.id, photo.farm, photo.server, photo.secret, 'm'); } } return o; } // See: https://www.flickr.com/services/api/misc.urls.html function createPictures(id, farm, server, secret) { var NO_LIMIT = 2048; var sizes = [ {id: 't', max: 100}, {id: 'm', max: 240}, {id: 'n', max: 320}, {id: '', max: 500}, {id: 'z', max: 640}, {id: 'c', max: 800}, {id: 'b', max: 1024}, {id: 'h', max: 1600}, {id: 'k', max: 2048}, {id: 'o', max: NO_LIMIT} ]; return sizes.map(function(size) { return { source: createPhotoUrl(id, farm, server, secret, size.id), // Note: this is a guess that's almost certain to be wrong (unless square source) width: size.max, height: size.max }; }); } function checkResponse(o, key) { if (key in o) { o = o[key]; } else if (!('error' in o)) { o.error = { code: 'invalid_request', message: o.message || 'Failed to get data from Flickr' }; } return o; } function formatFriends(o) { formatError(o); if (o.contacts) { o = checkResponse(o, 'contacts'); paging(o); o.data = o.contact; delete o.contact; for (var i = 0; i < o.data.length; i++) { var item = o.data[i]; item.id = item.nsid; item.name = item.realname || item.username; item.thumbnail = getBuddyIcon(item, 'm'); } } return o; } function paging(res) { if (res.page && res.pages && res.page !== res.pages) { res.paging = { next: '?page=' + (++res.page) }; } } })(hello); (function(hello) { hello.init({ foursquare: { name: 'Foursquare', oauth: { // See: https://developer.foursquare.com/overview/auth version: 2, auth: 'https://foursquare.com/oauth2/authenticate', grant: 'https://foursquare.com/oauth2/access_token' }, // Refresh the access_token once expired refresh: true, base: 'https://api.foursquare.com/v2/', get: { me: 'users/self', 'me/friends': 'users/self/friends', 'me/followers': 'users/self/friends', 'me/following': 'users/self/friends' }, wrap: { me: function(o) { formatError(o); if (o && o.response) { o = o.response.user; formatUser(o); } return o; }, 'default': function(o) { formatError(o); // Format friends if (o && 'response' in o && 'friends' in o.response && 'items' in o.response.friends) { o.data = o.response.friends.items; o.data.forEach(formatUser); delete o.response; } return o; } }, xhr: formatRequest, jsonp: formatRequest } }); function formatError(o) { if (o.meta && (o.meta.code === 400 || o.meta.code === 401)) { o.error = { code: 'access_denied', message: o.meta.errorDetail }; } } function formatUser(o) { if (o && o.id) { o.thumbnail = o.photo.prefix + '100x100' + o.photo.suffix; o.name = o.firstName + ' ' + o.lastName; o.first_name = o.firstName; o.last_name = o.lastName; if (o.contact) { if (o.contact.email) { o.email = o.contact.email; } } } } function formatRequest(p, qs) { var token = qs.access_token; delete qs.access_token; qs.oauth_token = token; qs.v = 20121125; return true; } })(hello); (function(hello) { hello.init({ github: { name: 'GitHub', oauth: { version: 2, auth: 'https://github.com/login/oauth/authorize', grant: 'https://github.com/login/oauth/access_token', response_type: 'code' }, scope: { basic: '', email: 'user:email' }, base: 'https://api.github.com/', get: { me: 'user', 'me/friends': 'user/following?per_page=@{limit|100}', 'me/following': 'user/following?per_page=@{limit|100}', 'me/followers': 'user/followers?per_page=@{limit|100}', 'me/like': 'user/starred?per_page=@{limit|100}' }, wrap: { me: function(o, headers) { formatError(o, headers); formatUser(o); return o; }, 'default': function(o, headers, req) { formatError(o, headers); if (Array.isArray(o)) { o = {data:o}; } if (o.data) { paging(o, headers, req); o.data.forEach(formatUser); } return o; } }, xhr: function(p) { if (p.method !== 'get' && p.data) { // Serialize payload as JSON p.headers = p.headers || {}; p.headers['Content-Type'] = 'application/json'; if (typeof (p.data) === 'object') { p.data = JSON.stringify(p.data); } } return true; } } }); function formatError(o, headers) { var code = headers ? headers.statusCode : (o && 'meta' in o && 'status' in o.meta && o.meta.status); if ((code === 401 || code === 403)) { o.error = { code: 'access_denied', message: o.message || (o.data ? o.data.message : 'Could not get response') }; delete o.message; } } function formatUser(o) { if (o.id) { o.thumbnail = o.picture = o.avatar_url; o.name = o.login; } } function paging(res, headers, req) { if (res.data && res.data.length && headers && headers.Link) { var next = headers.Link.match(/<(.*?)>;\s*rel=\"next\"/); if (next) { res.paging = { next: next[1] }; } } } })(hello); (function(hello) { var contactsUrl = 'https://www.google.com/m8/feeds/contacts/default/full?v=3.0&alt=json&max-results=@{limit|1000}&start-index=@{start|1}'; hello.init({ google: { name: 'Google Plus', // See: http://code.google.com/apis/accounts/docs/OAuth2UserAgent.html oauth: { version: 2, auth: 'https://accounts.google.com/o/oauth2/auth', grant: 'https://accounts.google.com/o/oauth2/token' }, // Authorization scopes scope: { basic: 'https://www.googleapis.com/auth/plus.me profile', email: 'email', birthday: '', events: '', photos: 'https://picasaweb.google.com/data/', videos: 'http://gdata.youtube.com', friends: 'https://www.google.com/m8/feeds, https://www.googleapis.com/auth/plus.login', files: 'https://www.googleapis.com/auth/drive.readonly', publish: '', publish_files: 'https://www.googleapis.com/auth/drive', create_event: '', offline_access: '' }, scope_delim: ' ', login: function(p) { if (p.qs.display === 'none') { // Google doesn't like display=none p.qs.display = ''; } if (p.qs.response_type === 'code') { // Let's set this to an offline access to return a refresh_token p.qs.access_type = 'offline'; } // Reauthenticate // https://developers.google.com/identity/protocols/ if (p.options.force) { p.qs.approval_prompt = 'force'; } }, // API base URI base: 'https://www.googleapis.com/', // Map GET requests get: { me: 'plus/v1/people/me', // Deprecated Sept 1, 2014 //'me': 'oauth2/v1/userinfo?alt=json', // See: https://developers.google.com/+/api/latest/people/list 'me/friends': 'plus/v1/people/me/people/visible?maxResults=@{limit|100}', 'me/following': contactsUrl, 'me/followers': contactsUrl, 'me/contacts': contactsUrl, 'me/share': 'plus/v1/people/me/activities/public?maxResults=@{limit|100}', 'me/feed': 'plus/v1/people/me/activities/public?maxResults=@{limit|100}', 'me/albums': 'https://picasaweb.google.com/data/feed/api/user/default?alt=json&max-results=@{limit|100}&start-index=@{start|1}', 'me/album': function(p, callback) { var key = p.query.id; delete p.query.id; callback(key.replace('/entry/', '/feed/')); }, 'me/photos': 'https://picasaweb.google.com/data/feed/api/user/default?alt=json&kind=photo&max-results=@{limit|100}&start-index=@{start|1}', // See: https://developers.google.com/drive/v2/reference/files/list 'me/files': 'drive/v2/files?q=%22@{parent|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}', // See: https://developers.google.com/drive/v2/reference/files/list 'me/folders': 'drive/v2/files?q=%22@{id|root}%22+in+parents+and+mimeType+=+%22application/vnd.google-apps.folder%22+and+trashed=false&maxResults=@{limit|100}', // See: https://developers.google.com/drive/v2/reference/files/list 'me/folder': 'drive/v2/files?q=%22@{id|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}' }, // Map POST requests post: { // Google Drive 'me/files': uploadDrive, 'me/folders': function(p, callback) { p.data = { title: p.data.name, parents: [{id: p.data.parent || 'root'}], mimeType: 'application/vnd.google-apps.folder' }; callback('drive/v2/files'); } }, // Map PUT requests put: { 'me/files': uploadDrive }, // Map DELETE requests del: { 'me/files': 'drive/v2/files/@{id}', 'me/folder': 'drive/v2/files/@{id}' }, wrap: { me: function(o) { if (o.id) { o.last_name = o.family_name || (o.name ? o.name.familyName : null); o.first_name = o.given_name || (o.name ? o.name.givenName : null); if (o.emails && o.emails.length) { o.email = o.emails[0].value; } formatPerson(o); } return o; }, 'me/friends': function(o) { if (o.items) { paging(o); o.data = o.items; o.data.forEach(formatPerson); delete o.items; } return o; }, 'me/contacts': formatFriends, 'me/followers': formatFriends, 'me/following': formatFriends, 'me/share': formatFeed, 'me/feed': formatFeed, 'me/albums': gEntry, 'me/photos': formatPhotos, 'default': gEntry }, xhr: function(p) { if (p.method === 'post' || p.method === 'put') { toJSON(p); } return true; }, // Don't even try submitting via form. // This means no POST operations in <=IE9 form: false } }); function toInt(s) { return parseInt(s, 10); } function formatFeed(o) { paging(o); o.data = o.items; delete o.items; return o; } // Format: ensure each record contains a name, id etc. function formatItem(o) { if (o.error) { return; } if (!o.name) { o.name = o.title || o.message; } if (!o.picture) { o.picture = o.thumbnailLink; } if (!o.thumbnail) { o.thumbnail = o.thumbnailLink; } if (o.mimeType === 'application/vnd.google-apps.folder') { o.type = 'folder'; o.files = 'https://www.googleapis.com/drive/v2/files?q=%22' + o.id + '%22+in+parents'; } return o; } function formatImage(image) { return { source: image.url, width: image.width, height: image.height }; } function formatPhotos(o) { o.data = o.feed.entry.map(formatEntry); delete o.feed; } // Google has a horrible JSON API function gEntry(o) { paging(o); if ('feed' in o && 'entry' in o.feed) { o.data = o.feed.entry.map(formatEntry); delete o.feed; } // Old style: Picasa, etc. else if ('entry' in o) { return formatEntry(o.entry); } // New style: Google Drive & Plus else if ('items' in o) { o.data = o.items.map(formatItem); delete o.items; } else { formatItem(o); } return o; } function formatPerson(o) { o.name = o.displayName || o.name; o.picture = o.picture || (o.image ? o.image.url : null); o.thumbnail = o.picture; } function formatFriends(o, headers, req) { paging(o); var r = []; if ('feed' in o && 'entry' in o.feed) { var token = req.query.access_token; for (var i = 0; i < o.feed.entry.length; i++) { var a = o.feed.entry[i]; a.id = a.id.$t; a.name = a.title.$t; delete a.title; if (a.gd$email) { a.email = (a.gd$email && a.gd$email.length > 0) ? a.gd$email[0].address : null; a.emails = a.gd$email; delete a.gd$email; } if (a.updated) { a.updated = a.updated.$t; } if (a.link) { var pic = (a.link.length > 0) ? a.link[0].href : null; if (pic && a.link[0].gd$etag) { pic += (pic.indexOf('?') > -1 ? '&' : '?') + 'access_token=' + token; a.picture = pic; a.thumbnail = pic; } delete a.link; } if (a.category) { delete a.category; } } o.data = o.feed.entry; delete o.feed; } return o; } function formatEntry(a) { var group = a.media$group; var photo = group.media$content.length ? group.media$content[0] : {}; var mediaContent = group.media$content || []; var mediaThumbnail = group.media$thumbnail || []; var pictures = mediaContent .concat(mediaThumbnail) .map(formatImage) .sort(function(a, b) { return a.width - b.width; }); var i = 0; var _a; var p = { id: a.id.$t, name: a.title.$t, description: a.summary.$t, updated_time: a.updated.$t, created_time: a.published.$t, picture: photo ? photo.url : null, pictures: pictures, images: [], thumbnail: photo ? photo.url : null, width: photo.width, height: photo.height }; // Get feed/children if ('link' in a) { for (i = 0; i < a.link.length; i++) { var d = a.link[i]; if (d.rel.match(/\#feed$/)) { p.upload_location = p.files = p.photos = d.href; break; } } } // Get images of different scales if ('category' in a && a.category.length) { _a = a.category; for (i = 0; i < _a.length; i++) { if (_a[i].scheme && _a[i].scheme.match(/\#kind$/)) { p.type = _a[i].term.replace(/^.*?\#/, ''); } } } // Get images of different scales if ('media$thumbnail' in group && group.media$thumbnail.length) { _a = group.media$thumbnail; p.thumbnail = _a[0].url; p.images = _a.map(formatImage); } _a = group.media$content; if (_a && _a.length) { p.images.push(formatImage(_a[0])); } return p; } function paging(res) { // Contacts V2 if ('feed' in res && res.feed.openSearch$itemsPerPage) { var limit = toInt(res.feed.openSearch$itemsPerPage.$t); var start = toInt(res.feed.openSearch$startIndex.$t); var total = toInt(res.feed.openSearch$totalResults.$t); if ((start + limit) < total) { res.paging = { next: '?start=' + (start + limit) }; } } else if ('nextPageToken' in res) { res.paging = { next: '?pageToken=' + res.nextPageToken }; } } // Construct a multipart message function Multipart() { // Internal body var body = []; var boundary = (Math.random() * 1e10).toString(32); var counter = 0; var lineBreak = '\r\n'; var delim = lineBreak + '--' + boundary; var ready = function() {}; var dataUri = /^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i; // Add file function addFile(item) { var fr = new FileReader(); fr.onload = function(e) { addContent(btoa(e.target.result), item.type + lineBreak + 'Content-Transfer-Encoding: base64'); }; fr.readAsBinaryString(item); } // Add content function addContent(content, type) { body.push(lineBreak + 'Content-Type: ' + type + lineBreak + lineBreak + content); counter--; ready(); } // Add new things to the object this.append = function(content, type) { // Does the content have an array if (typeof (content) === 'string' || !('length' in Object(content))) { // Converti to multiples content = [content]; } for (var i = 0; i < content.length; i++) { counter++; var item = content[i]; // Is this a file? // Files can be either Blobs or File types if ( (typeof (File) !== 'undefined' && item instanceof File) || (typeof (Blob) !== 'undefined' && item instanceof Blob) ) { // Read the file in addFile(item); } // Data-URI? // Data:[<mime type>][;charset=<charset>][;base64],<encoded data> // /^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i else if (typeof (item) === 'string' && item.match(dataUri)) { var m = item.match(dataUri); addContent(item.replace(dataUri, ''), m[1] + lineBreak + 'Content-Transfer-Encoding: base64'); } // Regular string else { addContent(item, type); } } }; this.onready = function(fn) { ready = function() { if (counter === 0) { // Trigger ready body.unshift(''); body.push('--'); fn(body.join(delim), boundary); body = []; } }; ready(); }; } // Upload to Drive // If this is PUT then only augment the file uploaded // PUT https://developers.google.com/drive/v2/reference/files/update // POST https://developers.google.com/drive/manage-uploads function uploadDrive(p, callback) { var data = {}; // Test for DOM element if (p.data && (typeof (HTMLInputElement) !== 'undefined' && p.data instanceof HTMLInputElement) ) { p.data = {file: p.data}; } if (!p.data.name && Object(Object(p.data.file).files).length && p.method === 'post') { p.data.name = p.data.file.files[0].name; } if (p.method === 'post') { p.data = { title: p.data.name, parents: [{id: p.data.parent || 'root'}], file: p.data.file }; } else { // Make a reference data = p.data; p.data = {}; // Add the parts to change as required if (data.parent) { p.data.parents = [{id: p.data.parent || 'root'}]; } if (data.file) { p.data.file = data.file; } if (data.name) { p.data.title = data.name; } } // Extract the file, if it exists from the data object // If the File is an INPUT element lets just concern ourselves with the NodeList var file; if ('file' in p.data) { file = p.data.file; delete p.data.file; if (typeof (file) === 'object' && 'files' in file) { // Assign the NodeList file = file.files; } if (!file || !file.length) { callback({ error: { code: 'request_invalid', message: 'There were no files attached with this request to upload' } }); return; } } // Set type p.data.mimeType = Object(file[0]).type || 'application/octet-stream'; // Construct a multipart message var parts = new Multipart(); parts.append(JSON.stringify(p.data), 'application/json'); // Read the file into a base64 string... yep a hassle, i know // FormData doesn't let us assign our own Multipart headers and HTTP Content-Type // Alas GoogleApi need these in a particular format if (file) { parts.append(file); } parts.onready(function(body, boundary) { p.headers['content-type'] = 'multipart/related; boundary="' + boundary + '"'; p.data = body; callback('upload/drive/v2/files' + (data.id ? '/' + data.id : '') + '?uploadType=multipart'); }); } function toJSON(p) { if (typeof (p.data) === 'object') { // Convert the POST into a javascript object try { p.data = JSON.stringify(p.data); p.headers['content-type'] = 'application/json'; } catch (e) {} } } })(hello); (function(hello) { hello.init({ instagram: { name: 'Instagram', oauth: { // See: http://instagram.com/developer/authentication/ version: 2, auth: 'https://instagram.com/oauth/authorize/', grant: 'https://api.instagram.com/oauth/access_token' }, // Refresh the access_token once expired refresh: true, scope: { basic: 'basic', friends: 'relationships', publish: 'likes comments' }, scope_delim: ' ', login: function(p) { // Instagram throws errors like 'JavaScript API is unsupported' if the display is 'popup'. // Make the display anything but 'popup' p.qs.display = ''; }, base: 'https://api.instagram.com/v1/', get: { me: 'users/self', 'me/feed': 'users/self/feed?count=@{limit|100}', 'me/photos': 'users/self/media/recent?min_id=0&count=@{limit|100}', 'me/friends': 'users/self/follows?count=@{limit|100}', 'me/following': 'users/self/follows?count=@{limit|100}', 'me/followers': 'users/self/followed-by?count=@{limit|100}', 'friend/photos': 'users/@{id}/media/recent?min_id=0&count=@{limit|100}' }, post: { 'me/like': function(p, callback) { var id = p.data.id; p.data = {}; callback('media/' + id + '/likes'); } }, del: { 'me/like': 'media/@{id}/likes' }, wrap: { me: function(o) { formatError(o); if ('data' in o) { o.id = o.data.id; o.thumbnail = o.data.profile_picture; o.name = o.data.full_name || o.data.username; } return o; }, 'me/friends': formatFriends, 'me/following': formatFriends, 'me/followers': formatFriends, 'me/photos': function(o) { formatError(o); paging(o); if ('data' in o) { o.data = o.data.filter(function(d) { return d.type === 'image'; }); o.data.forEach(function(d) { d.name = d.caption ? d.caption.text : null; d.thumbnail = d.images.thumbnail.url; d.picture = d.images.standard_resolution.url; d.pictures = Object.keys(d.images) .map(function(key) { var image = d.images[key]; return formatImage(image); }) .sort(function(a, b) { return a.width - b.width; }); }); } return o; }, 'default': function(o) { paging(o); return o; } }, // Instagram does not return any CORS Headers // So besides JSONP we're stuck with proxy xhr: function(p, qs) { var method = p.method; var proxy = method !== 'get'; if (proxy) { if ((method === 'post' || method === 'put') && p.query.access_token) { p.data.access_token = p.query.access_token; delete p.query.access_token; } // No access control headers // Use the proxy instead p.proxy = proxy; } return proxy; }, // No form form: false } }); function formatImage(image) { return { source: image.url, width: image.width, height: image.height }; } function formatError(o) { if (o && 'meta' in o && 'error_type' in o.meta) { o.error = { code: o.meta.error_type, message: o.meta.error_message }; } } function formatFriends(o) { paging(o); if (o && 'data' in o) { o.data.forEach(formatFriend); } return o; } function formatFriend(o) { if (o.id) { o.thumbnail = o.profile_picture; o.name = o.full_name || o.username; } } // See: http://instagram.com/developer/endpoints/ function paging(res) { if ('pagination' in res) { res.paging = { next: res.pagination.next_url }; delete res.pagination; } } })(hello); (function(hello) { hello.init({ linkedin: { oauth: { version: 2, response_type: 'code', auth: 'https://www.linkedin.com/uas/oauth2/authorization', grant: 'https://www.linkedin.com/uas/oauth2/accessToken' }, // Refresh the access_token once expired refresh: true, scope: { basic: 'r_basicprofile', email: 'r_emailaddress', friends: '', publish: 'w_share' }, scope_delim: ' ', base: 'https://api.linkedin.com/v1/', get: { me: 'people/~:(picture-url,first-name,last-name,id,formatted-name,email-address)', 'me/friends': 'people/~/connections?count=@{limit|500}', 'me/followers': 'people/~/connections?count=@{limit|500}', 'me/following': 'people/~/connections?count=@{limit|500}', // See: http://developer.linkedin.com/documents/get-network-updates-and-statistics-api 'me/share': 'people/~/network/updates?count=@{limit|250}' }, post: { // See: https://developer.linkedin.com/documents/api-requests-json 'me/share': function(p, callback) { var data = { visibility: { code: 'anyone' } }; if (p.data.id) { data.attribution = { share: { id: p.data.id } }; } else { data.comment = p.data.message; if (p.data.picture && p.data.link) { data.content = { 'submitted-url': p.data.link, 'submitted-image-url': p.data.picture }; } } p.data = JSON.stringify(data); callback('people/~/shares?format=json'); }, 'me/like': like }, del:{ 'me/like': like }, wrap: { me: function(o) { formatError(o); formatUser(o); return o; }, 'me/friends': formatFriends, 'me/following': formatFriends, 'me/followers': formatFriends, 'me/share': function(o) { formatError(o); paging(o); if (o.values) { o.data = o.values.map(formatUser); o.data.forEach(function(item) { item.message = item.headline; }); delete o.values; } return o; }, 'default': function(o, headers) { formatError(o); empty(o, headers); paging(o); } }, jsonp: function(p, qs) { formatQuery(qs); if (p.method === 'get') { qs.format = 'jsonp'; qs['error-callback'] = p.callbackID; } }, xhr: function(p, qs) { if (p.method !== 'get') { formatQuery(qs); p.headers['Content-Type'] = 'application/json'; // Note: x-li-format ensures error responses are not returned in XML p.headers['x-li-format'] = 'json'; p.proxy = true; return true; } return false; } } }); function formatError(o) { if (o && 'errorCode' in o) { o.error = { code: o.status, message: o.message }; } } function formatUser(o) { if (o.error) { return; } o.first_name = o.firstName; o.last_name = o.lastName; o.name = o.formattedName || (o.first_name + ' ' + o.last_name); o.thumbnail = o.pictureUrl; o.email = o.emailAddress; return o; } function formatFriends(o) { formatError(o); paging(o); if (o.values) { o.data = o.values.map(formatUser); delete o.values; } return o; } function paging(res) { if ('_count' in res && '_start' in res && (res._count + res._start) < res._total) { res.paging = { next: '?start=' + (res._start + res._count) + '&count=' + res._count }; } } function empty(o, headers) { if (JSON.stringify(o) === '{}' && headers.statusCode === 200) { o.success = true; } } function formatQuery(qs) { // LinkedIn signs requests with the parameter 'oauth2_access_token' // ... yeah another one who thinks they should be different! if (qs.access_token) { qs.oauth2_access_token = qs.access_token; delete qs.access_token; } } function like(p, callback) { p.headers['x-li-format'] = 'json'; var id = p.data.id; p.data = (p.method !== 'delete').toString(); p.method = 'put'; callback('people/~/network/updates/key=' + id + '/is-liked'); } })(hello); // See: https://developers.soundcloud.com/docs/api/reference (function(hello) { hello.init({ soundcloud: { name: 'SoundCloud', oauth: { version: 2, auth: 'https://soundcloud.com/connect', grant: 'https://soundcloud.com/oauth2/token' }, // Request path translated base: 'https://api.soundcloud.com/', get: { me: 'me.json', // Http://developers.soundcloud.com/docs/api/reference#me 'me/friends': 'me/followings.json', 'me/followers': 'me/followers.json', 'me/following': 'me/followings.json', // See: http://developers.soundcloud.com/docs/api/reference#activities 'default': function(p, callback) { // Include '.json at the end of each request' callback(p.path + '.json'); } }, // Response handlers wrap: { me: function(o) { formatUser(o); return o; }, 'default': function(o) { if (Array.isArray(o)) { o = { data: o.map(formatUser) }; } paging(o); return o; } }, xhr: formatRequest, jsonp: formatRequest } }); function formatRequest(p, qs) { // Alter the querystring var token = qs.access_token; delete qs.access_token; qs.oauth_token = token; qs['_status_code_map[302]'] = 200; return true; } function formatUser(o) { if (o.id) { o.picture = o.avatar_url; o.thumbnail = o.avatar_url; o.name = o.username || o.full_name; } return o; } // See: http://developers.soundcloud.com/docs/api/reference#activities function paging(res) { if ('next_href' in res) { res.paging = { next: res.next_href }; } } })(hello); (function(hello) { var base = 'https://api.twitter.com/'; hello.init({ twitter: { // Ensure that you define an oauth_proxy oauth: { version: '1.0a', auth: base + 'oauth/authenticate', request: base + 'oauth/request_token', token: base + 'oauth/access_token' }, login: function(p) { // Reauthenticate // https://dev.twitter.com/oauth/reference/get/oauth/authenticate var prefix = '?force_login=true'; this.oauth.auth = this.oauth.auth.replace(prefix, '') + (p.options.force ? prefix : ''); }, base: base + '1.1/', get: { me: 'account/verify_credentials.json', 'me/friends': 'friends/list.json?count=@{limit|200}', 'me/following': 'friends/list.json?count=@{limit|200}', 'me/followers': 'followers/list.json?count=@{limit|200}', // Https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline 'me/share': 'statuses/user_timeline.json?count=@{limit|200}', // Https://dev.twitter.com/rest/reference/get/favorites/list 'me/like': 'favorites/list.json?count=@{limit|200}' }, post: { 'me/share': function(p, callback) { var data = p.data; p.data = null; // Tweet media if (data.file) { p.data = { status: data.message, 'media[]': data.file }; callback('statuses/update_with_media.json'); } // Retweet? else if (data.id) { callback('statuses/retweet/' + data.id + '.json'); } // Tweet else { callback('statuses/update.json?include_entities=1&status=' + encodeURIComponent(data.message)); } }, // See: https://dev.twitter.com/rest/reference/post/favorites/create 'me/like': function(p, callback) { var id = p.data.id; p.data = null; callback('favorites/create.json?id=' + id); } }, del: { // See: https://dev.twitter.com/rest/reference/post/favorites/destroy 'me/like': function() { p.method = 'post'; var id = p.data.id; p.data = null; callback('favorites/destroy.json?id=' + id); } }, wrap: { me: function(res) { formatError(res); formatUser(res); return res; }, 'me/friends': formatFriends, 'me/followers': formatFriends, 'me/following': formatFriends, 'me/share': function(res) { formatError(res); paging(res); if (!res.error && 'length' in res) { return {data: res}; } return res; }, 'default': function(res) { res = arrayToDataResponse(res); paging(res); return res; } }, xhr: function(p) { // Rely on the proxy for non-GET requests. return (p.method !== 'get'); } } }); function formatUser(o) { if (o.id) { if (o.name) { var m = o.name.split(' '); o.first_name = m.shift(); o.last_name = m.join(' '); } // See: https://dev.twitter.com/overview/general/user-profile-images-and-banners o.thumbnail = o.profile_image_url_https || o.profile_image_url; } return o; } function formatFriends(o) { formatError(o); paging(o); if (o.users) { o.data = o.users.map(formatUser); delete o.users; } return o; } function formatError(o) { if (o.errors) { var e = o.errors[0]; o.error = { code: 'request_failed', message: e.message }; } } // Take a cursor and add it to the path function paging(res) { // Does the response include a 'next_cursor_string' if ('next_cursor_str' in res) { // See: https://dev.twitter.com/docs/misc/cursoring res.paging = { next: '?cursor=' + res.next_cursor_str }; } } function arrayToDataResponse(res) { return Array.isArray(res) ? {data: res} : res; } /** // The documentation says to define user in the request // Although its not actually required. var user_id; function withUserId(callback){ if(user_id){ callback(user_id); } else{ hello.api('twitter:/me', function(o){ user_id = o.id; callback(o.id); }); } } function sign(url){ return function(p, callback){ withUserId(function(user_id){ callback(url+'?user_id='+user_id); }); }; } */ })(hello); (function(hello) { hello.init({ windows: { name: 'Windows live', // REF: http://msdn.microsoft.com/en-us/library/hh243641.aspx oauth: { version: 2, auth: 'https://login.live.com/oauth20_authorize.srf', grant: 'https://login.live.com/oauth20_token.srf' }, // Refresh the access_token once expired refresh: true, logout: function() { return 'http://login.live.com/oauth20_logout.srf?ts=' + (new Date()).getTime(); }, // Authorization scopes scope: { basic: 'wl.signin,wl.basic', email: 'wl.emails', birthday: 'wl.birthday', events: 'wl.calendars', photos: 'wl.photos', videos: 'wl.photos', friends: 'wl.contacts_emails', files: 'wl.skydrive', publish: 'wl.share', publish_files: 'wl.skydrive_update', create_event: 'wl.calendars_update,wl.events_create', offline_access: 'wl.offline_access' }, // API base URL base: 'https://apis.live.net/v5.0/', // Map GET requests get: { // Friends me: 'me', 'me/friends': 'me/friends', 'me/following': 'me/contacts', 'me/followers': 'me/friends', 'me/contacts': 'me/contacts', 'me/albums': 'me/albums', // Include the data[id] in the path 'me/album': '@{id}/files', 'me/photo': '@{id}', // Files 'me/files': '@{parent|me/skydrive}/files', 'me/folders': '@{id|me/skydrive}/files', 'me/folder': '@{id|me/skydrive}/files' }, // Map POST requests post: { 'me/albums': 'me/albums', 'me/album': '@{id}/files/', 'me/folders': '@{id|me/skydrive/}', 'me/files': '@{parent|me/skydrive/}/files' }, // Map DELETE requests del: { // Include the data[id] in the path 'me/album': '@{id}', 'me/photo': '@{id}', 'me/folder': '@{id}', 'me/files': '@{id}' }, wrap: { me: formatUser, 'me/friends': formatFriends, 'me/contacts': formatFriends, 'me/followers': formatFriends, 'me/following': formatFriends, 'me/albums': formatAlbums, 'me/photos': formatDefault, 'default': formatDefault }, xhr: function(p) { if (p.method !== 'get' && p.method !== 'delete' && !hello.utils.hasBinary(p.data)) { // Does this have a data-uri to upload as a file? if (typeof (p.data.file) === 'string') { p.data.file = hello.utils.toBlob(p.data.file); } else { p.data = JSON.stringify(p.data); p.headers = { 'Content-Type': 'application/json' }; } } return true; }, jsonp: function(p) { if (p.method !== 'get' && !hello.utils.hasBinary(p.data)) { p.data.method = p.method; p.method = 'get'; } } } }); function formatDefault(o) { if ('data' in o) { o.data.forEach(function(d) { if (d.picture) { d.thumbnail = d.picture; } if (d.images) { d.pictures = d.images .map(formatImage) .sort(function(a, b) { return a.width - b.width; }); } }); } return o; } function formatImage(image) { return { width: image.width, height: image.height, source: image.source }; } function formatAlbums(o) { if ('data' in o) { o.data.forEach(function(d) { d.photos = d.files = 'https://apis.live.net/v5.0/' + d.id + '/photos'; }); } return o; } function formatUser(o, headers, req) { if (o.id) { var token = req.query.access_token; if (o.emails) { o.email = o.emails.preferred; } // If this is not an non-network friend if (o.is_friend !== false) { // Use the id of the user_id if available var id = (o.user_id || o.id); o.thumbnail = o.picture = 'https://apis.live.net/v5.0/' + id + '/picture?access_token=' + token; } } return o; } function formatFriends(o, headers, req) { if ('data' in o) { o.data.forEach(function(d) { formatUser(d, headers, req); }); } return o; } })(hello); (function(hello) { hello.init({ yahoo: { // Ensure that you define an oauth_proxy oauth: { version: '1.0a', auth: 'https://api.login.yahoo.com/oauth/v2/request_auth', request: 'https://api.login.yahoo.com/oauth/v2/get_request_token', token: 'https://api.login.yahoo.com/oauth/v2/get_token' }, // Login handler login: function(p) { // Change the default popup window to be at least 560 // Yahoo does dynamically change it on the fly for the signin screen (only, what if your already signed in) p.options.popup.width = 560; // Yahoo throws an parameter error if for whatever reason the state.scope contains a comma, so lets remove scope try {delete p.qs.state.scope;} catch (e) {} }, base: 'https://social.yahooapis.com/v1/', get: { me: yql('select * from social.profile(0) where guid=me'), 'me/friends': yql('select * from social.contacts(0) where guid=me'), 'me/following': yql('select * from social.contacts(0) where guid=me') }, wrap: { me: formatUser, // Can't get IDs // It might be better to loop through the social.relationship table with has unique IDs of users. 'me/friends': formatFriends, 'me/following': formatFriends, 'default': function(res) { paging(res); return res; } } } }); /* // Auto-refresh fix: bug in Yahoo can't get this to work with node-oauth-shim login : function(o){ // Is the user already logged in var auth = hello('yahoo').getAuthResponse(); // Is this a refresh token? if(o.options.display==='none'&&auth&&auth.access_token&&auth.refresh_token){ // Add the old token and the refresh token, including path to the query // See http://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html o.qs.access_token = auth.access_token; o.qs.refresh_token = auth.refresh_token; o.qs.token_url = 'https://api.login.yahoo.com/oauth/v2/get_token'; } }, */ function formatError(o) { if (o && 'meta' in o && 'error_type' in o.meta) { o.error = { code: o.meta.error_type, message: o.meta.error_message }; } } function formatUser(o) { formatError(o); if (o.query && o.query.results && o.query.results.profile) { o = o.query.results.profile; o.id = o.guid; o.last_name = o.familyName; o.first_name = o.givenName || o.nickname; var a = []; if (o.first_name) { a.push(o.first_name); } if (o.last_name) { a.push(o.last_name); } o.name = a.join(' '); o.email = (o.emails && o.emails[0]) ? o.emails[0].handle : null; o.thumbnail = o.image ? o.image.imageUrl : null; } return o; } function formatFriends(o, headers, request) { formatError(o); paging(o, headers, request); var contact; var field; if (o.query && o.query.results && o.query.results.contact) { o.data = o.query.results.contact; delete o.query; if (!Array.isArray(o.data)) { o.data = [o.data]; } o.data.forEach(formatFriend); } return o; } function formatFriend(contact) { contact.id = null; contact.fields.forEach(function(field) { if (field.type === 'email') { contact.email = field.value; } if (field.type === 'name') { contact.first_name = field.value.givenName; contact.last_name = field.value.familyName; contact.name = field.value.givenName + ' ' + field.value.familyName; } if (field.type === 'yahooid') { contact.id = field.value; } }); } function paging(res, headers, request) { // See: http://developer.yahoo.com/yql/guide/paging.html#local_limits if (res.query && res.query.count && request.options) { res.paging = { next: '?start=' + (res.query.count + (+request.options.start || 1)) }; } } function yql(q) { return 'https://query.yahooapis.com/v1/yql?q=' + (q + ' limit @{limit|100} offset @{start|0}').replace(/\s/g, '%20') + '&format=json'; } })(hello); // Register as anonymous AMD module if (typeof define === 'function' && define.amd) { define(function() { return hello; }); } // CommonJS module for browserify if (typeof module === 'object' && module.exports) { module.exports = hello; }
lobbin/cdnjs
ajax/libs/hellojs/1.7.5/hello.all.js
JavaScript
mit
127,573
/*! jQuery UI context menu plugin - v1.8.2 - 2015-02-08 | https://github.com/mar10/jquery-ui-contextmenu | Copyright (c) 2015 Martin Wendt; Licensed MIT */ !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery-ui/menu"],a):a(jQuery)}(function(a){"use strict";var b="onselectstart"in document.createElement("div"),c=a.ui.menu.version.match(/^(\d)\.(\d+)/),d={major:parseInt(c[1],10),minor:parseInt(c[2],10)},e=d.major<2&&d.minor<11;a.widget("moogle.contextmenu",{version:"@VERSION",options:{addClass:"ui-contextmenu",autoTrigger:!0,delegate:null,hide:{effect:"fadeOut",duration:"fast"},ignoreParentSelect:!0,menu:null,position:null,preventContextMenuForPopup:!1,preventSelect:!1,show:{effect:"slideDown",duration:"fast"},taphold:!1,uiMenuOptions:{},beforeOpen:a.noop,blur:a.noop,close:a.noop,create:a.noop,createMenu:a.noop,focus:a.noop,open:a.noop,select:a.noop},_create:function(){var c,d,e,f=this.options;if(this.$headStyle=null,this.$menu=null,this.menuIsTemp=!1,this.currentTarget=null,f.preventSelect){e=(a(this.element).is(document)?a("body"):this.element).uniqueId().attr("id"),c="#"+e+" "+f.delegate+" { -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }",this.$headStyle=a("<style class='moogle-contextmenu-style' />").prop("type","text/css").appendTo("head");try{this.$headStyle.html(c)}catch(g){this.$headStyle[0].styleSheet.cssText=c}b&&this.element.delegate(f.delegate,"selectstart"+this.eventNamespace,function(a){a.preventDefault()})}this._createUiMenu(f.menu),d="contextmenu"+this.eventNamespace,f.taphold&&(d+=" taphold"+this.eventNamespace),this.element.delegate(f.delegate,d,a.proxy(this._openMenu,this))},_destroy:function(){this.element.undelegate(this.eventNamespace),this._createUiMenu(null),this.$headStyle&&(this.$headStyle.remove(),this.$headStyle=null)},_createUiMenu:function(b){var c,d=this.options;this.isOpen()&&(c=this.currentTarget,this._closeMenu(!0),this.currentTarget=c),this.menuIsTemp?this.$menu.remove():this.$menu&&this.$menu.menu("destroy").removeClass(this.options.addClass).hide(),this.$menu=null,this.menuIsTemp=!1,b&&(a.isArray(b)?(this.$menu=a.moogle.contextmenu.createMenuMarkup(b),this.menuIsTemp=!0):this.$menu="string"==typeof b?a(b):b,this.$menu.hide().addClass(d.addClass).menu(a.extend(!0,{},d.uiMenuOptions,{blur:a.proxy(d.blur,this),create:a.proxy(d.createMenu,this),focus:a.proxy(d.focus,this),select:a.proxy(function(b,c){var e,f=a.moogle.contextmenu.isMenu(c.item),g=c.item.data("actionHandler");c.cmd=c.item.attr("data-command"),c.target=a(this.currentTarget),f&&d.ignoreParentSelect||(e=this._trigger.call(this,"select",b,c),g&&(e=g.call(this,b,c)),e!==!1&&this._closeMenu.call(this),b.preventDefault())},this)})))},_openMenu:function(b,c){var d,e,f=this.options,g=f.position,h=this,i=!!b.isTrigger,j={menu:this.$menu,target:a(b.target),extraData:b.extraData,originalEvent:b,result:null};if(f.autoTrigger||i){if(b.preventDefault(),this.currentTarget=b.target,!c){if(d=this._trigger("beforeOpen",b,j),e=j.result&&a.isFunction(j.result.promise)?j.result:null,j.result=null,d===!1)return this.currentTarget=null,!1;if(e)return e.done(function(){h._openMenu(b,!0)}),this.currentTarget=null,!1;j.menu=this.$menu}a(document).bind("keydown"+this.eventNamespace,function(b){b.which===a.ui.keyCode.ESCAPE&&h._closeMenu()}).bind("mousedown"+this.eventNamespace+" touchstart"+this.eventNamespace,function(b){a(b.target).closest(".ui-menu-item").length||h._closeMenu()}),a.isFunction(g)&&(g=g(b,j)),g=a.extend({my:"left top",at:"left bottom",of:void 0===b.pageX?b.target:b,collision:"fit"},g),this.$menu.show().css({position:"absolute",left:0,top:0}).position(g).hide(),f.preventContextMenuForPopup&&this.$menu.bind("contextmenu"+this.eventNamespace,function(a){a.preventDefault()}),this._show(this.$menu,this.options.show,function(){h._trigger.call(h,"open",b,j)})}},_closeMenu:function(b){var c=this,d=b?!1:this.options.hide;a(document).unbind("mousedown"+this.eventNamespace).unbind("touchstart"+this.eventNamespace).unbind("keydown"+this.eventNamespace),c.currentTarget=null,this.$menu?(this.$menu.unbind("contextmenu"+this.eventNamespace),this._hide(this.$menu,d,function(){c._trigger("close")})):c._trigger("close")},_setOption:function(b,c){switch(b){case"menu":this.replaceMenu(c)}a.Widget.prototype._setOption.apply(this,arguments)},_getMenuEntry:function(a){return this.$menu.find("li[data-command="+a+"]")},close:function(){this.isOpen()&&this._closeMenu()},enableEntry:function(a,b){this._getMenuEntry(a).toggleClass("ui-state-disabled",b===!1)},getMenu:function(){return this.$menu},isOpen:function(){return!!this.$menu&&!!this.currentTarget},open:function(a,b){b=b||{};var c=jQuery.Event("contextmenu",{target:a.get(0),extraData:b});return this.element.trigger(c)},replaceMenu:function(a){this._createUiMenu(a)},setEntry:function(b,c){var d,e=this._getMenuEntry(b);"string"==typeof c?a.moogle.contextmenu.updateTitle(e,c):(e.empty(),c.cmd=c.cmd||b,a.moogle.contextmenu.createEntryMarkup(c,e),a.isArray(c.children)&&(d=a("<ul/>").appendTo(e),a.moogle.contextmenu.createMenuMarkup(c.children,d)),this.getMenu().menu("refresh"))},showEntry:function(a,b){this._getMenuEntry(a).toggle(b!==!1)}}),a.extend(a.moogle.contextmenu,{createEntryMarkup:function(b,c){var d=null;/[^\-\u2014\u2013\s]/.test(b.title)?(e?(c.attr("data-command",b.cmd),d=a("<a/>",{html:""+b.title,href:"#"}).appendTo(c),b.uiIcon&&d.append(a("<span class='ui-icon' />").addClass(b.uiIcon))):(c.attr("data-command",b.cmd).html(""+b.title),a.isFunction(b.action)&&c.data("actionHandler",b.action),b.uiIcon&&c.append(a("<span class='ui-icon' />").addClass(b.uiIcon))),a.isFunction(b.action)&&c.data("actionHandler",b.action),b.disabled&&c.addClass("ui-state-disabled"),b.addClass&&c.addClass(b.addClass),a.isPlainObject(b.data)&&c.data(b.data)):c.text(b.title)},createMenuMarkup:function(b,c){var d,e,f,g;for(null==c&&(c=a("<ul class='ui-helper-hidden' />").appendTo("body")),d=0;d<b.length;d++)e=b[d],g=a("<li/>").appendTo(c),a.moogle.contextmenu.createEntryMarkup(e,g),a.isArray(e.children)&&(f=a("<ul/>").appendTo(g),a.moogle.contextmenu.createMenuMarkup(e.children,f));return c},isMenu:function(a){return e?a.has(">a[aria-haspopup='true']").length>0:a.is("[aria-haspopup='true']")},replaceFirstTextNodeChild:function(a,b){a.contents().filter(function(){return 3===this.nodeType}).first().replaceWith(b)},updateTitle:function(b,c){e?a.moogle.contextmenu.replaceFirstTextNodeChild(a("a",b),c):a.moogle.contextmenu.replaceFirstTextNodeChild(b,c)}})}); //# sourceMappingURL=jquery.ui-contextmenu.min.js.map
vdurmont/cdnjs
ajax/libs/jquery.ui-contextmenu/1.8.2/jquery.ui-contextmenu.min.js
JavaScript
mit
6,628
module.exports = rimraf rimraf.sync = rimrafSync var path = require("path") , fs try { // optional dependency fs = require("../../graceful-fs/graceful-fs.js") } catch (er) { fs = require("fs") } var lstat = "lstat" if (process.platform === "win32") { // not reliable on windows prior to 0.7.9 var v = process.version.replace(/^v/, '').split(/\.|-/).map(Number) if (v[0] === 0 && (v[1] < 7 || v[1] == 7 && v[2] < 9)) { lstat = "stat" } } if (!fs[lstat]) lstat = "stat" var lstatSync = lstat + "Sync" // for EMFILE handling var timeout = 0 exports.EMFILE_MAX = 1000 exports.BUSYTRIES_MAX = 3 function rimraf (p, cb) { if (!cb) throw new Error("No callback passed to rimraf()") var busyTries = 0 rimraf_(p, function CB (er) { if (er) { if (er.code === "EBUSY" && busyTries < exports.BUSYTRIES_MAX) { busyTries ++ var time = busyTries * 100 // try again, with the same exact callback as this one. return setTimeout(function () { rimraf_(p, CB) }, time) } // this one won't happen if graceful-fs is used. if (er.code === "EMFILE" && timeout < exports.EMFILE_MAX) { return setTimeout(function () { rimraf_(p, CB) }, timeout ++) } // already gone if (er.code === "ENOENT") er = null } timeout = 0 cb(er) }) } function rimraf_ (p, cb) { fs[lstat](p, function (er, s) { if (er) { // already gone if (er.code === "ENOENT") return cb() // some other kind of error, permissions, etc. return cb(er) } return rm_(p, s, false, cb) }) } var myGid = function myGid () { var g = process.getuid && process.getgid() myGid = function myGid () { return g } return g } var myUid = function myUid () { var u = process.getuid && process.getuid() myUid = function myUid () { return u } return u } function writable (s) { var mode = s.mode || 0777 , uid = myUid() , gid = myGid() return (mode & 0002) || (gid === s.gid && (mode & 0020)) || (uid === s.uid && (mode & 0200)) } function rm_ (p, s, didWritableCheck, cb) { if (!didWritableCheck && !writable(s)) { // make file writable // user/group/world, doesn't matter at this point // since it's about to get nuked. return fs.chmod(p, s.mode | 0222, function (er) { if (er) return cb(er) rm_(p, s, true, cb) }) } if (!s.isDirectory()) { return fs.unlink(p, cb) } // directory fs.readdir(p, function (er, files) { if (er) return cb(er) asyncForEach(files.map(function (f) { return path.join(p, f) }), function (file, cb) { rimraf(file, cb) }, function (er) { if (er) return cb(er) fs.rmdir(p, cb) }) }) } function asyncForEach (list, fn, cb) { if (!list.length) cb() var c = list.length , errState = null list.forEach(function (item, i, list) { fn(item, function (er) { if (errState) return if (er) return cb(errState = er) if (-- c === 0) return cb() }) }) } // this looks simpler, but it will fail with big directory trees, // or on slow stupid awful cygwin filesystems function rimrafSync (p) { try { var s = fs[lstatSync](p) } catch (er) { if (er.code === "ENOENT") return throw er } if (!writable(s)) { fs.chmodSync(p, s.mode | 0222) } if (!s.isDirectory()) return fs.unlinkSync(p) fs.readdirSync(p).forEach(function (f) { rimrafSync(path.join(p, f)) }) fs.rmdirSync(p) }
jdsimcoe/nightwind
node_modules/grunt-contrib-watch/node_modules/gaze/node_modules/globule/node_modules/lodash/vendor/tar/vendor/rimraf/rimraf.js
JavaScript
mit
3,533
/* AngularJS v1.2.18 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(u,f,P){'use strict';f.module("ngAnimate",["ng"]).factory("$$animateReflow",["$$rAF","$document",function(f,u){return function(e){return f(function(){e()})}}]).config(["$provide","$animateProvider",function(W,H){function e(f){for(var e=0;e<f.length;e++){var h=f[e];if(h.nodeType==aa)return h}}function C(h){return f.element(e(h))}var n=f.noop,h=f.forEach,Q=H.$$selectors,aa=1,k="$$ngAnimateState",K="ng-animate",g={running:!0};W.decorator("$animate",["$delegate","$injector","$sniffer","$rootElement", "$$asyncCallback","$rootScope","$document",function(y,u,$,L,F,I,P){function R(a){if(a){var b=[],c={};a=a.substr(1).split(".");($.transitions||$.animations)&&b.push(u.get(Q[""]));for(var d=0;d<a.length;d++){var f=a[d],e=Q[f];e&&!c[f]&&(b.push(u.get(e)),c[f]=!0)}return b}}function M(a,b,c){function d(a,b){var c=a[b],d=a["before"+b.charAt(0).toUpperCase()+b.substr(1)];if(c||d)return"leave"==b&&(d=c,c=null),t.push({event:b,fn:c}),l.push({event:b,fn:d}),!0}function e(b,d,f){var q=[];h(b,function(a){a.fn&& q.push(a)});var m=0;h(q,function(b,e){var h=function(){a:{if(d){(d[e]||n)();if(++m<q.length)break a;d=null}f()}};switch(b.event){case "setClass":d.push(b.fn(a,p,A,h));break;case "addClass":d.push(b.fn(a,p||c,h));break;case "removeClass":d.push(b.fn(a,A||c,h));break;default:d.push(b.fn(a,h))}});d&&0===d.length&&f()}var w=a[0];if(w){var k="setClass"==b,g=k||"addClass"==b||"removeClass"==b,p,A;f.isArray(c)&&(p=c[0],A=c[1],c=p+" "+A);var B=a.attr("class")+" "+c;if(T(B)){var r=n,v=[],l=[],x=n,m=[],t=[], B=(" "+B).replace(/\s+/g,".");h(R(B),function(a){!d(a,b)&&k&&(d(a,"addClass"),d(a,"removeClass"))});return{node:w,event:b,className:c,isClassBased:g,isSetClassOperation:k,before:function(a){r=a;e(l,v,function(){r=n;a()})},after:function(a){x=a;e(t,m,function(){x=n;a()})},cancel:function(){v&&(h(v,function(a){(a||n)(!0)}),r(!0));m&&(h(m,function(a){(a||n)(!0)}),x(!0))}}}}}function z(a,b,c,d,e,w,g){function n(d){var e="$animate:"+d;x&&(x[e]&&0<x[e].length)&&F(function(){c.triggerHandler(e,{event:a, className:b})})}function p(){n("before")}function A(){n("after")}function B(){n("close");g&&F(function(){g()})}function r(){r.hasBeenRun||(r.hasBeenRun=!0,w())}function v(){if(!v.hasBeenRun){v.hasBeenRun=!0;var d=c.data(k);d&&(l&&l.isClassBased?D(c,b):(F(function(){var d=c.data(k)||{};z==d.index&&D(c,b,a)}),c.data(k,d)));B()}}var l=M(c,a,b);if(l){b=l.className;var x=f.element._data(l.node),x=x&&x.events;d||(d=e?e.parent():c.parent());var m=c.data(k)||{};e=m.active||{};var t=m.totalActive||0,u=m.last; if(l.isClassBased&&(m.disabled||u&&!u.isClassBased)||N(c,d))r(),p(),A(),v();else{d=!1;if(0<t){m=[];if(l.isClassBased)"setClass"==u.event?(m.push(u),D(c,b)):e[b]&&(y=e[b],y.event==a?d=!0:(m.push(y),D(c,b)));else if("leave"==a&&e["ng-leave"])d=!0;else{for(var y in e)m.push(e[y]),D(c,y);e={};t=0}0<m.length&&h(m,function(a){a.cancel()})}!l.isClassBased||(l.isSetClassOperation||d)||(d="addClass"==a==c.hasClass(b));if(d)r(),p(),A(),B();else{if("leave"==a)c.one("$destroy",function(a){a=f.element(this);var b= a.data(k);b&&(b=b.active["ng-leave"])&&(b.cancel(),D(a,"ng-leave"))});c.addClass(K);var z=O++;t++;e[b]=l;c.data(k,{last:l,active:e,index:z,totalActive:t});p();l.before(function(d){var e=c.data(k);d=d||!e||!e.active[b]||l.isClassBased&&e.active[b].event!=a;r();!0===d?v():(A(),l.after(v))})}}}else r(),p(),A(),v()}function U(a){if(a=e(a))a=f.isFunction(a.getElementsByClassName)?a.getElementsByClassName(K):a.querySelectorAll("."+K),h(a,function(a){a=f.element(a);(a=a.data(k))&&a.active&&h(a.active,function(a){a.cancel()})})} function D(a,b){if(e(a)==e(L))g.disabled||(g.running=!1,g.structural=!1);else if(b){var c=a.data(k)||{},d=!0===b;!d&&(c.active&&c.active[b])&&(c.totalActive--,delete c.active[b]);if(d||!c.totalActive)a.removeClass(K),a.removeData(k)}}function N(a,b){if(g.disabled)return!0;if(e(a)==e(L))return g.disabled||g.running;do{if(0===b.length)break;var c=e(b)==e(L),d=c?g:b.data(k),d=d&&(!!d.disabled||d.running||0<d.totalActive);if(c||d)return d;if(c)break}while(b=b.parent());return!0}var O=0;L.data(k,g);I.$$postDigest(function(){I.$$postDigest(function(){g.running= !1})});var V=H.classNameFilter(),T=V?function(a){return V.test(a)}:function(){return!0};return{enter:function(a,b,c,d){a=f.element(a);b=b&&f.element(b);c=c&&f.element(c);this.enabled(!1,a);y.enter(a,b,c);I.$$postDigest(function(){a=C(a);z("enter","ng-enter",a,b,c,n,d)})},leave:function(a,b){a=f.element(a);U(a);this.enabled(!1,a);I.$$postDigest(function(){z("leave","ng-leave",C(a),null,null,function(){y.leave(a)},b)})},move:function(a,b,c,d){a=f.element(a);b=b&&f.element(b);c=c&&f.element(c);U(a); this.enabled(!1,a);y.move(a,b,c);I.$$postDigest(function(){a=C(a);z("move","ng-move",a,b,c,n,d)})},addClass:function(a,b,c){a=f.element(a);a=C(a);z("addClass",b,a,null,null,function(){y.addClass(a,b)},c)},removeClass:function(a,b,c){a=f.element(a);a=C(a);z("removeClass",b,a,null,null,function(){y.removeClass(a,b)},c)},setClass:function(a,b,c,d){a=f.element(a);a=C(a);z("setClass",[b,c],a,null,null,function(){y.setClass(a,b,c)},d)},enabled:function(a,b){switch(arguments.length){case 2:if(a)D(b);else{var c= b.data(k)||{};c.disabled=!0;b.data(k,c)}break;case 1:g.disabled=!a;break;default:a=!g.disabled}return!!a}}}]);H.register("",["$window","$sniffer","$timeout","$$animateReflow",function(k,g,C,L){function F(a,E){S&&S();X.push(E);S=L(function(){h(X,function(a){a()});X=[];S=null;q={}})}function I(a,E){var b=e(a);a=f.element(b);Y.push(a);b=Date.now()+E;b<=ea||(C.cancel(da),ea=b,da=C(function(){K(Y);Y=[]},E,!1))}function K(a){h(a,function(a){(a=a.data(m))&&(a.closeAnimationFn||n)()})}function R(a,E){var b= E?q[E]:null;if(!b){var c=0,d=0,e=0,f=0,m,Z,s,g;h(a,function(a){if(a.nodeType==aa){a=k.getComputedStyle(a)||{};s=a[J+B];c=Math.max(M(s),c);g=a[J+r];m=a[J+v];d=Math.max(M(m),d);Z=a[p+v];f=Math.max(M(Z),f);var b=M(a[p+B]);0<b&&(b*=parseInt(a[p+l],10)||1);e=Math.max(b,e)}});b={total:0,transitionPropertyStyle:g,transitionDurationStyle:s,transitionDelayStyle:m,transitionDelay:d,transitionDuration:c,animationDelayStyle:Z,animationDelay:f,animationDuration:e};E&&(q[E]=b)}return b}function M(a){var b=0;a= f.isString(a)?a.split(/\s*,\s*/):[];h(a,function(a){b=Math.max(parseFloat(a)||0,b)});return b}function z(a){var b=a.parent(),c=b.data(x);c||(b.data(x,++ca),c=ca);return c+"-"+e(a).getAttribute("class")}function U(a,b,c,d){var f=z(b),h=f+" "+c,k=q[h]?++q[h].total:0,g={};if(0<k){var l=c+"-stagger",g=f+" "+l;(f=!q[g])&&b.addClass(l);g=R(b,g);f&&b.removeClass(l)}d=d||function(a){return a()};b.addClass(c);var l=b.data(m)||{},s=d(function(){return R(b,h)});d=s.transitionDuration;f=s.animationDuration;if(0=== d&&0===f)return b.removeClass(c),!1;b.data(m,{running:l.running||0,itemIndex:k,stagger:g,timings:s,closeAnimationFn:n});a=0<l.running||"setClass"==a;0<d&&D(b,c,a);0<f&&(0<g.animationDelay&&0===g.animationDuration)&&(e(b).style[p]="none 0s");return!0}function D(a,b,c){"ng-enter"!=b&&("ng-move"!=b&&"ng-leave"!=b)&&c?a.addClass(t):e(a).style[J+r]="none"}function N(a,b){var c=J+r,d=e(a);d.style[c]&&0<d.style[c].length&&(d.style[c]="");a.removeClass(t)}function O(a){var b=p;a=e(a);a.style[b]&&0<a.style[b].length&& (a.style[b]="")}function V(a,b,c,f){function g(a){b.off(z,l);b.removeClass(p);d(b,c);a=e(b);for(var fa in t)a.style.removeProperty(t[fa])}function l(a){a.stopPropagation();var b=a.originalEvent||a;a=b.$manualTimeStamp||b.timeStamp||Date.now();b=parseFloat(b.elapsedTime.toFixed(Q));Math.max(a-y,0)>=x&&b>=u&&f()}var k=e(b);a=b.data(m);if(-1!=k.getAttribute("class").indexOf(c)&&a){var p="";h(c.split(" "),function(a,b){p+=(0<b?" ":"")+a+"-active"});var n=a.stagger,s=a.timings,r=a.itemIndex,u=Math.max(s.transitionDuration, s.animationDuration),v=Math.max(s.transitionDelay,s.animationDelay),x=v*ba,y=Date.now(),z=A+" "+H,q="",t=[];if(0<s.transitionDuration){var B=s.transitionPropertyStyle;-1==B.indexOf("all")&&(q+=w+"transition-property: "+B+";",q+=w+"transition-duration: "+s.transitionDurationStyle+";",t.push(w+"transition-property"),t.push(w+"transition-duration"))}0<r&&(0<n.transitionDelay&&0===n.transitionDuration&&(q+=w+"transition-delay: "+T(s.transitionDelayStyle,n.transitionDelay,r)+"; ",t.push(w+"transition-delay")), 0<n.animationDelay&&0===n.animationDuration&&(q+=w+"animation-delay: "+T(s.animationDelayStyle,n.animationDelay,r)+"; ",t.push(w+"animation-delay")));0<t.length&&(s=k.getAttribute("style")||"",k.setAttribute("style",s+"; "+q));b.on(z,l);b.addClass(p);a.closeAnimationFn=function(){g();f()};k=(r*(Math.max(n.animationDelay,n.transitionDelay)||0)+(v+u)*W)*ba;a.running++;I(b,k);return g}f()}function T(a,b,c){var d="";h(a.split(","),function(a,e){d+=(0<e?",":"")+(c*b+parseInt(a,10))+"s"});return d}function a(a, b,c,e){if(U(a,b,c,e))return function(a){a&&d(b,c)}}function b(a,b,c,e){if(b.data(m))return V(a,b,c,e);d(b,c);e()}function c(c,d,e,f){var g=a(c,d,e);if(g){var h=g;F(d,function(){N(d,e);O(d);h=b(c,d,e,f)});return function(a){(h||n)(a)}}f()}function d(a,b){a.removeClass(b);var c=a.data(m);c&&(c.running&&c.running--,c.running&&0!==c.running||a.removeData(m))}function G(a,b){var c="";a=f.isArray(a)?a:a.split(/\s+/);h(a,function(a,d){a&&0<a.length&&(c+=(0<d?" ":"")+a+b)});return c}var w="",J,H,p,A;u.ontransitionend=== P&&u.onwebkittransitionend!==P?(w="-webkit-",J="WebkitTransition",H="webkitTransitionEnd transitionend"):(J="transition",H="transitionend");u.onanimationend===P&&u.onwebkitanimationend!==P?(w="-webkit-",p="WebkitAnimation",A="webkitAnimationEnd animationend"):(p="animation",A="animationend");var B="Duration",r="Property",v="Delay",l="IterationCount",x="$$ngAnimateKey",m="$$ngAnimateCSS3Data",t="ng-animate-block-transitions",Q=3,W=1.5,ba=1E3,q={},ca=0,X=[],S,da=null,ea=0,Y=[];return{enter:function(a, b){return c("enter",a,"ng-enter",b)},leave:function(a,b){return c("leave",a,"ng-leave",b)},move:function(a,b){return c("move",a,"ng-move",b)},beforeSetClass:function(b,c,d,e){var f=G(d,"-remove")+" "+G(c,"-add"),g=a("setClass",b,f,function(a){var e=b.attr("class");b.removeClass(d);b.addClass(c);a=a();b.attr("class",e);return a});if(g)return F(b,function(){N(b,f);O(b);e()}),g;e()},beforeAddClass:function(b,c,d){var e=a("addClass",b,G(c,"-add"),function(a){b.addClass(c);a=a();b.removeClass(c);return a}); if(e)return F(b,function(){N(b,c);O(b);d()}),e;d()},setClass:function(a,c,d,e){d=G(d,"-remove");c=G(c,"-add");return b("setClass",a,d+" "+c,e)},addClass:function(a,c,d){return b("addClass",a,G(c,"-add"),d)},beforeRemoveClass:function(b,c,d){var e=a("removeClass",b,G(c,"-remove"),function(a){var d=b.attr("class");b.removeClass(c);a=a();b.attr("class",d);return a});if(e)return F(b,function(){N(b,c);O(b);d()}),e;d()},removeClass:function(a,c,d){return b("removeClass",a,G(c,"-remove"),d)}}}])}])})(window, window.angular); //# sourceMappingURL=angular-animate.min.js.map
likang/cdnjs
ajax/libs/angular.js/1.2.18/angular-animate.min.js
JavaScript
mit
10,904
ο»Ώ/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add('checkbox',function(a){return{title:a.lang.checkboxAndRadio.checkboxTitle,minWidth:350,minHeight:140,onShow:function(){var c=this;delete c.checkbox;var b=c.getParentEditor().getSelection().getSelectedElement();if(b&&b.getAttribute('type')=='checkbox'){c.checkbox=b;c.setupContent(b);}},onOk:function(){var b,c=this.checkbox,d=!c;if(d){b=this.getParentEditor();c=b.document.createElement('input');c.setAttribute('type','checkbox');b.insertElement(c);}this.commitContent({element:c});},contents:[{id:'info',label:a.lang.checkboxAndRadio.checkboxTitle,title:a.lang.checkboxAndRadio.checkboxTitle,startupFocus:'txtName',elements:[{id:'txtName',type:'text',label:a.lang.common.name,'default':'',accessKey:'N',setup:function(b){this.setValue(b.data('cke-saved-name')||b.getAttribute('name')||'');},commit:function(b){var c=b.element;if(this.getValue())c.data('cke-saved-name',this.getValue());else{c.data('cke-saved-name',false);c.removeAttribute('name');}}},{id:'txtValue',type:'text',label:a.lang.checkboxAndRadio.value,'default':'',accessKey:'V',setup:function(b){var c=b.getAttribute('value');this.setValue(CKEDITOR.env.ie&&c=='on'?'':c);},commit:function(b){var c=b.element,d=this.getValue();if(d&&!(CKEDITOR.env.ie&&d=='on'))c.setAttribute('value',d);else if(CKEDITOR.env.ie){var e=new CKEDITOR.dom.element('input',c.getDocument());c.copyAttributes(e,{value:1});e.replace(c);a.getSelection().selectElement(e);b.element=e;}else c.removeAttribute('value');}},{id:'cmbSelected',type:'checkbox',label:a.lang.checkboxAndRadio.selected,'default':'',accessKey:'S',value:'checked',setup:function(b){this.setValue(b.getAttribute('checked'));},commit:function(b){var c=b.element;if(CKEDITOR.env.ie){var d=!!c.getAttribute('checked'),e=!!this.getValue();if(d!=e){var f=CKEDITOR.dom.element.createFromHtml('<input type="checkbox"'+(e?' checked="checked"':'')+'/>',a.document);c.copyAttributes(f,{type:1,checked:1});f.replace(c);a.getSelection().selectElement(f);b.element=f;}}else{var g=this.getValue();if(g)c.setAttribute('checked','checked');else c.removeAttribute('checked');}}}]}]};});
shrayus/hw-refactoring-legecy-code
public/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js
JavaScript
mit
2,253
/*global jQuery */ /*! * Kerning.js * Version: 0.2 * Copyright 2011 Joshua Gross * MIT license * * Usage: * Include this file anywhere in your HTML * <script src="kerning.js"></script> * * Then, add any of the attributes following to your CSS, under any * selectors you want modified: * -letter-kern, -letter-size, -letter-weight, -letter-color, -letter-transform * -word-kern, -word-size, -word-weight, -word-color, -word-transform * * To use pairings (e.g., modify 'a' if 'ab' is paired): * -letter-pairs('xy': [value], …) * -word-pairs('cat mouse': [value], …) * * To use multiple transforms, you need to use transform "groups": * -transform-group([transform] [transform] …) * * Sometimes you need to want to use a different size or weight, depending on what * font has loaded: * font-size: [default size]; * font-size: if-font('font name': [size], 'font name': [size], …); * (The first line is a fallback should Kerning.js not load. This is recommended.) * * That's it! Attributes will be applied automagically. * * Examples: * Alter first 3 letters: * -letter-size: 100px 20px 30px; * * Modify letter pairs: * -letter-kern: -letter-pairs('ab': 1px, * 'bc': 300px, * 's ': 100px); * * Transform the first two letters: * -letter-transform: -transform-group(rotate3d(0,0,1,10deg) translate3d(0,10px,0)) * -transform-group(translate3d(0,-10px,0) rotate3d(0,0,1,-10deg)); * * Modify word pairs: * -word-size: -word-pairs('this is': 10em); * * Modify the first 3 words: * -word-size: 10em 0.1em 0.2em; * * Using repeat rules: * -letter-color: -letter-repeat(even: #f0f0f0, odd: #cccccc); * -letter-color: -letter-repeat(2n+1: #f0f0f0); * * Using conditionals: * -letter-kern: if-font('Helvetica Neue': 0 1px 1px, 'Helvetica': 0 -1px 0); * * Using conditionals on existing properties for weight or size: * font-size: 9.5em; * font-size: if-font('Helvetica Neue': 10em, 'Helvetica': 9em); */ (function($){(function(){function styleAttributes(a,b){var c="",d,e={};a=a.replace(RESGMLcomment,"").replace(REnotATag,"$1"),munge(a).replace(REtag,function(a,b,f){b=b.toLowerCase(),e[b]?++e[b]:e[b]=1;if(d=/\bstyle\s*=\s*(%s`\d+`s%)/i.exec(f)){var g=/\bid\s*=\s*(\S+)/i.exec(f);g?g="#"+restore(g[1]).replace(/^['"]|['"]$/g,""):g=b+":eq("+(e[b]-1)+")",c+=[g,"{",restore(d[1]).replace(/^['"]|['"]$/g,""),"}"].join("")}}),$.parsecss(c,b)}function processAtRule(a,b){var c=a.split(/\s+/),d=c.shift();if(d=="media"){var e=restore(c.pop()).slice(1,-1);$.parsecss.mediumApplies(c.join(" "))&&$.parsecss(e,b)}else if(d="import"){var f=restore(c.shift());$.parsecss.mediumApplies(c.join(" "))&&(f=f.replace(/^url\(|\)$/gi,"").replace(/^["']|["']$/g,""),$.get(f,function(a){$.parsecss(a,b)}))}}function restore(a){if(a===undefined)return a;while(match=REmunged.exec(a))a=a.replace(REmunged,munged[match[1]]);return $.trim(a)}function munge(a,b){a=a.replace(REatcomment,"$1").replace(REcomment_string,function(a,b){if(!b)return"";var c="%s`"+ ++uid+"`s%";munged[uid]=b.replace(/^\\/,"");return c});var c=b?REfull:REbraces;while(match=c.exec(a))replacement="%b`"+ ++uid+"`b%",munged[uid]=match[0],a=a.replace(c,replacement);return a}function parsedeclarations(a){var b=munged[a].replace(/^{|}$/g,"");b=munge(b);var c={};$.each(b.split(";"),function(a,b){b=b.split(":");b.length<2||(c[restore(b[0])]=restore(b.slice(1).join(":")))});return c}$.fn.findandfilter=function(a){var b=this.filter(a).add(this.find(a));b.prevObject=b.prevObject.prevObject;return b},$.fn.parsecss=function(a,b){var c=function(b){$.parsecss(b,a)};this.findandfilter("style").each(function(){c(this.innerHTML)}).end().findandfilter('link[type="text/css"],link[rel="stylesheet"]').each(function(){!this.disabled&&!/^\w+:/.test($(this).attr("href"))&&$.parsecss.mediumApplies(this.media)&&$.get(this.href,c)}).end(),b&&$.get(location.pathname+location.search,"text",function(b){styleAttributes(b,a)});return this},$.parsecss=function(a,b){var c={};a=munge(a).replace(/@(([^;`]|`[^b]|`b[^%])*(`b%)?);?/g,function(a,c){processAtRule($.trim(c),b);return""}),$.each(a.split("`b%"),function(a,b){b=b.split("%b`");b.length<2||(b[0]=restore(b[0]),c[b[0]]=$.extend(c[b[0]]||{},parsedeclarations(b[1])))}),b(c)},$.parsecss.mediumApplies=window.media&&window.media.query||function(a){if(!a)return!0;if(a in media)return media[a];var b=$('<style media="'+a+'">body {position: relative; z-index: 1;}</style>').appendTo("head");return media[a]=[$("body").css("z-index")==1,b.remove()][0]},$.parsecss.isValidSelector=function(a){var b=$("<style>"+a+"{}</style>").appendTo("head")[0];return[b.styleSheet?!/UNKNOWN/i.test(b.styleSheet.cssText):!!b.sheet.cssRules.length,$(b).remove()][0]},$.parsecss.parseArguments=function(str){if(!str)return[];var ret=[],mungedArguments=munge(str,!0).split(/\s+/);for(var i=0;i<mungedArguments.length;++i){var a=restore(mungedArguments[i]);try{ret.push(eval("("+a+")"))}catch(err){ret.push(a)}}return ret},$.parsecss.styleAttributes=styleAttributes;var media={},munged={},REbraces=/{[^{}]*}/,REfull=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/,REatcomment=/\/\*@((?:[^\*]|\*[^\/])*)\*\//g,REcomment_string=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g,REmunged=/%\w`(\d+)`\w%/,uid=0,_show={show:$.fn.show,hide:$.fn.hide};$.each(["show","hide"],function(){var a=this,b=_show[a],c=a+"Default";$.fn[a]=function(){if(arguments.length>0)return b.apply(this,arguments);return this.each(function(){var a=$.data(this,c),d=$(this);a?($.removeData(this,c),a.call(d),d.queue(function(){d.data(c,a).dequeue()})):b.call(d)})},$.fn[c]=function(){var b=$.makeArray(arguments),d=b[0];if($.fn[d]){b.shift();var e=$.fn[d]}else $.effects&&$.effects[d]?(typeof b[1]!="object"&&b.splice(1,0,{}),e=_show[a]):e=_show[a];return this.data(c,function(){e.apply(this,b)})}});var RESGMLcomment=/<!--([^-]|-[^-])*-->/g,REnotATag=/(>)[^<]*/g,REtag=/<(\w+)([^>]*)>/g})(),function(){function a(a,b,c,d){var e=a.text().split(b),f="";e.length&&($(e).each(function(a,b){f+='<span class="'+c+(a+1)+'">'+b+"</span>"+d}),a.empty().append(f))}var b={init:function(){return this.each(function(){a($(this),"","char","")})},words:function(){return this.each(function(){a($(this)," ","word"," ")})},lines:function(){return this.each(function(){var b="eefec303079ad17405c889e092e105b0";a($(this).children("br").replaceWith(b).end(),b,"line","")})}};$.fn.lettering=function(a){if(a&&b[a])return b[a].apply(this,[].slice.call(arguments,1));if(a==="letters"||!a)return b.init.apply(this,[].slice.call(arguments,0));$.error("Method "+a+" does not exist on jQuery.lettering");return this}}();var unstack=function(){var a={init:function(a){var b=$(a).css("font-family").match(/[^'",;\s][^'",;]*/g)||[];return this.analyzeStack(b,a)},analyzeStack:function(b,c){var d=["monospace","sans-serif","serif","cursive","fantasy"],e=d[0],f=b.length,g=b[f-1];$.inArray(g,d)&&(b.push(e),f++),g==e&&(e=d[1]);for(var h=0;h<f-1;h++){font=b[h];if(a.testFont(font,e))return font}},testFont:function(a,b){var c=$('<span id="font_tester" style="font-family:'+b+'; font-size:144px;position:absolute;left:-10000px;top:-10000px;visibility:hidden;">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmml</span>');$("body").prepend(c);var d=c.width();c.css("font-family",a+","+b);var e=c.width();c.remove();return e!=d}};return function(b){return a.init(b)}}();window.Kerning=new function(){var a=this,b=navigator.platform,c=["webkitTransform"in document.documentElement.style&&"webkit",$.browser.msie&&"ms","MozTransform"in document.documentElement.style&&"moz",window.opera&&"o"].reduce(function(a,b){return a+(b||"")}),d=[b.match(/Mac/)&&"mac",b.match(/Win/)&&"win",b.match(/Linux/)&&"linux"].reduce(function(a,b){return a+(b||"")}),e={_pairs:function(a,b,c){var d=c.match(/^-(letter|word)-pairs\(([\s\S]+)\)$/i);if(!d||d[1]!==a)return!1;var e=a==="word"?b.children("span"):b.find("span > span"),f=c.match(/translate|rotate|skew|perspective/i),g=$.trim(d[2].replace(/,\s+?'/g,",'").replace(/:\s+?(\d)/g,":$1")).split(f?"),":","),h,i,j,k=[];if(!!g){$.each(g,function(b,c){h=c.split(":"),h[0]=h[0].replace(/^['"](.+)['"]$/g,"$1"),a==="word"?i=h[0].split(" "):i=h[0],j=function(b){var c=$(this).text().match(new RegExp(i[0])),d,e;i[1]!==" "?e=($(this).next().html()||"").match(new RegExp(i[1])):(d=a=="word"?$(this).next('[class^="word"]'):$(this).parent().next('[class^="word"]'),e=!$(this).next().length&&d.length);return c&&e},k.push([h[1],e.filter(j)])});return k}},_repeats:function(a,b,c){var d=c.match(/^-(letter|word)-repeats\(([\s\S]+)\)$/i);if(!d||d[1]!==a)return!1;var e=a==="word"?b.children("span"):b.find("span > span"),f=c.match(/translate|rotate|skew|perspective/i),g=$.trim(d[2].replace(/,\s+?'/g,",'").replace(/:\s+?(\d)/g,":$1")).split(f?"),":","),h,i,j,k=[];if(!!g){$.each(g,function(a,b){h=b.split(":"),f&&h[1].substring(h[1].length-1)!==")"&&(h[1]+=")"),k.push([$.trim(h[1]),e.filter(":nth-child("+$.trim(h[0])+")")])});return k}},_conditional:function(a,b,c){var d=c.match(/^(?:-(letter|word)-)?if-font\(([\s\S]+)\)$/i);if(!!d){var e=a==="all"?b:a==="word"?b.children("span"):b.find("span > span"),f=c.match(/translate|rotate|skew|perspective/i),g=d[2].replace(/\n/g,"").match(/['"][^'"]+['"]:\s*.+?(\)|(?=\w),\s['"]|$)/g),h,i={},j=[];if(!g)return;b.each(function(a,b){var c=unstack(b).replace(/^['"](.+)['"]$/g,"$1");i[c]?i[c].push(b):i[c]=[b]}),$.each(g,function(a,b){h=b.match(/['"]([^'"]+)['"]:\s*(.+)$/);if(!h)return!0;h=h.splice(1),h[0]in i&&j.push([$.trim(h[1]),$(i[h[0]])])});return j}},_applyAttribute:function(a,b,c,d){var f=e._conditional(a,b,d);if(!f||!f.length)f=[[d,b]];$.each(f,function(b,d){var f=d[0],g=d[1],h=e._pairs(a,g,f)||e._repeats(a,g,f);if(h)$.each(h,function(a,b){if(typeof c!="string"){var d={};$.each(c,function(a,c){d[c]=b[0]}),b[1].css(d)}else b[1].css(c,b[0])});else{var i,j,k;(k=f.match(/-transform-group\(([\s\S]+?\([^)]+\))*?\)/g))?i=$.map(k,function(a,b){return a.replace(/-transform-group\(([\s\S]+)\)$/,"$1")}):i=f.replace(/[\n\s]+/g," ").split(" "),g.each(function(b,d){j=a==="all"?$(d):a==="word"?$(d).children("span"):$(d).find("span > span"),$.each(i,function(a,b){if(typeof c!="string"){var d={};$.each(c,function(a,c){d[c]=b}),j.eq(a).css(d)}else j.eq(a).css(c,b)})})}})},kern:function(a,b,c){e._applyAttribute(a,b,"margin-right",c)},size:function(a,b,c){e._applyAttribute(a,b,"font-size",c)},weight:function(a,b,c){e._applyAttribute(a,b,"font-weight",c)},color:function(a,b,c){e._applyAttribute(a,b,"color",c)},transform:function(a,b,c){var d=["-webkit-transform","-moz-transform","-ms-transform","-o-transform","transform"];e._applyAttribute(a,b,d,c)}};this._parse=function(b,f){a._parsedCSS||(a._parsedCSS=b);for(var g in b)for(var h in b[g]){var i,j,k=b[g][h];if(i=h.match(new RegExp("^(-"+c+"|-"+d+")?-(letter|word)-(kern|transform|size|color|weight)","i"))){var l=i[2].toLowerCase(),m=i[3].toLowerCase();j=$(g),f&&(j=j.not(".kerningjs")),j.not(".kerningjs").addClass("kerningjs").css("visibility","inherit").lettering("words").children("span").css("display","inline-block").lettering().children("span").css("display","inline-block"),e[m]&&e[m].call(this,l,j,k)}else if((i=h.match(/font-(size|weight)/i))&&k.match(/if-font/i)){var m=i[1].toLowerCase();j=$(g),f&&(j=j.not(".kerningjs")),j.not(".kerningjs").addClass("kerningjs").css("visibility","inherit"),e[m]&&e[m].call(this,"all",j,k)}}},this.live=function(){$(document).bind("DOMNodeInserted",function(b){b.target&&a.refresh(!0)})},this.refresh=function(b){a._parsedCSS&&a._parse(a._parsedCSS,b)},$(function(){$(document).parsecss(a._parse,!0)})}})(jQuery)
hare1039/cdnjs
ajax/libs/kerning.js/0.2/kerning.min.js
JavaScript
mit
11,755
+function(b){var c=function(e,d){this.$element=b(e);this.options=b.extend({},c.DEFAULTS,d);this.transitioning=null;if(this.options.parent){this.$parent=b(this.options.parent)}if(this.options.toggle){this.toggle()}};c.DEFAULTS={toggle:true};c.prototype.dimension=function(){var d=this.$element.hasClass("width");return d?"width":"height"};c.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in")){return}var e=b.Event("show.bs.collapse");this.$element.trigger(e);if(e.isDefaultPrevented()){return}var h=this.$parent&&this.$parent.find("> .panel > .in");if(h&&h.length){var f=h.data("bs.collapse");if(f&&f.transitioning){return}h.collapse("hide");f||h.data("bs.collapse",null)}var i=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[i](0);this.transitioning=1;var d=function(){this.$element.removeClass("collapsing").addClass("in")[i]("auto");this.transitioning=0;this.$element.trigger("shown.bs.collapse")};if(!b.support.transition){return d.call(this)}var g=b.camelCase(["scroll",i].join("-"));this.$element.one(b.support.transition.end,b.proxy(d,this)).emulateTransitionEnd(350)[i](this.$element[0][g])};c.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in")){return}var e=b.Event("hide.bs.collapse");this.$element.trigger(e);if(e.isDefaultPrevented()){return}var f=this.dimension();this.$element[f](this.$element[f]())[0].offsetHeight;this.$element.addClass("collapsing").removeClass("collapse").removeClass("in");this.transitioning=1;var d=function(){this.transitioning=0;this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!b.support.transition){return d.call(this)}this.$element[f](0).one(b.support.transition.end,b.proxy(d,this)).emulateTransitionEnd(350)};c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var a=b.fn.collapse;b.fn.collapse=function(d){return this.each(function(){var g=b(this);var f=g.data("bs.collapse");var e=b.extend({},c.DEFAULTS,g.data(),typeof d=="object"&&d);if(!f){g.data("bs.collapse",(f=new c(this,e)))}if(typeof d=="string"){f[d]()}})};b.fn.collapse.Constructor=c;b.fn.collapse.noConflict=function(){b.fn.collapse=a;return this};b(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(j){var l=b(this),d;var k=l.attr("data-target")||j.preventDefault()||(d=l.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"");var f=b(k);var h=f.data("bs.collapse");var i=h?"toggle":l.data();var m=l.attr("data-parent");var g=m&&b(m);if(!h||!h.transitioning){if(g){g.find('[data-toggle=collapse][data-parent="'+m+'"]').not(l).addClass("collapsed")}l[f.hasClass("in")?"addClass":"removeClass"]("collapsed")}f.collapse(i)})}(window.jQuery);
CrossEye/cdnjs
ajax/libs/twitter-bootstrap/3.0.0-rc2/js/collapse.min.js
JavaScript
mit
2,724
(function () { var lang = { months : "Januar_Februar_Marts_April_Maj_Juni_Juli_August_September_Oktober_November_December".split("_"), monthsShort : "Jan_Feb_Mar_Apr_Maj_Jun_Jul_Aug_Sep_Okt_Nov_Dec".split("_"), weekdays : "SΓΈndag_Mandag_Tirsdag_Onsdag_Torsdag_Fredag_LΓΈrdag".split("_"), weekdaysShort : "SΓΈn_Man_Tir_Ons_Tor_Fre_LΓΈr".split("_"), longDateFormat : { LT : "h:mm A", L : "DD/MM/YYYY", LL : "D MMMM YYYY", LLL : "D MMMM YYYY h:mm A", LLLL : "dddd D. MMMM, YYYY h:mm A" }, calendar : { sameDay : '[I dag kl.] LT', nextDay : '[I morgen kl.] LT', nextWeek : 'dddd [kl.] LT', lastDay : '[I gΓ₯r kl.] LT', lastWeek : '[sidste] dddd [kl] LT', sameElse : 'L' }, relativeTime : { future : "om %s", past : "%s siden", s : "fΓ₯ sekunder", m : "minut", mm : "%d minutter", h : "time", hh : "%d timer", d : "dag", dd : "%d dage", M : "mΓ₯nede", MM : "%d mΓ₯neder", y : "Γ₯r", yy : "%d Γ₯r" }, ordinal : function (number) { return '.'; } }; // Node if (typeof module !== 'undefined') { module.exports = lang; } // Browser if (typeof window !== 'undefined' && this.moment && this.moment.lang) { this.moment.lang('da', lang); } }());
barkinet/cdnjs
ajax/libs/moment.js/1.6.2/lang/da.js
JavaScript
mit
1,735
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "vorm.", "nachm." ], "DAY": [ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ], "MONTH": [ "Januar", "Februar", "M\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ], "SHORTDAY": [ "So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa." ], "SHORTMONTH": [ "Jan.", "Feb.", "M\u00e4rz", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez." ], "fullDate": "EEEE, d. MMMM y", "longDate": "d. MMMM y", "medium": "dd.MM.y HH:mm:ss", "mediumDate": "dd.MM.y", "mediumTime": "HH:mm:ss", "short": "dd.MM.yy HH:mm", "shortDate": "dd.MM.yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "de-lu", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
ramda/cdnjs
ajax/libs/angular.js/1.3.13/i18n/angular-locale_de-lu.js
JavaScript
mit
2,324
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "ned\u011ble", "pond\u011bl\u00ed", "\u00fater\u00fd", "st\u0159eda", "\u010dtvrtek", "p\u00e1tek", "sobota" ], "MONTH": [ "ledna", "\u00fanora", "b\u0159ezna", "dubna", "kv\u011btna", "\u010dervna", "\u010dervence", "srpna", "z\u00e1\u0159\u00ed", "\u0159\u00edjna", "listopadu", "prosince" ], "SHORTDAY": [ "ne", "po", "\u00fat", "st", "\u010dt", "p\u00e1", "so" ], "SHORTMONTH": [ "led", "\u00fano", "b\u0159e", "dub", "kv\u011b", "\u010dvn", "\u010dvc", "srp", "z\u00e1\u0159", "\u0159\u00edj", "lis", "pro" ], "fullDate": "EEEE d. MMMM y", "longDate": "d. MMMM y", "medium": "d. M. y H:mm:ss", "mediumDate": "d. M. y", "mediumTime": "H:mm:ss", "short": "dd.MM.yy H:mm", "shortDate": "dd.MM.yy", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "K\u010d", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "cs-cz", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } if (i >= 2 && i <= 4 && vf.v == 0) { return PLURAL_CATEGORY.FEW; } if (vf.v != 0) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
cloudrifles/cdnjs
ajax/libs/angular.js/1.3.5/i18n/angular-locale_cs-cz.js
JavaScript
mit
2,555
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "vorm.", "nachm." ], "DAY": [ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ], "MONTH": [ "Januar", "Februar", "M\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ], "SHORTDAY": [ "So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa." ], "SHORTMONTH": [ "Jan.", "Feb.", "M\u00e4rz", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez." ], "fullDate": "EEEE, d. MMMM y", "longDate": "d. MMMM y", "medium": "dd.MM.y HH:mm:ss", "mediumDate": "dd.MM.y", "mediumTime": "HH:mm:ss", "short": "dd.MM.yy HH:mm", "shortDate": "dd.MM.yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "de", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
Olical/cdnjs
ajax/libs/angular-i18n/1.4.0-beta.3/angular-locale_de.js
JavaScript
mit
2,321
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0635", "\u0645" ], "DAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "MONTH": [ "\u064a\u0646\u0627\u064a\u0631", "\u0641\u0628\u0631\u0627\u064a\u0631", "\u0645\u0627\u0631\u0633", "\u0623\u0628\u0631\u064a\u0644", "\u0645\u0627\u064a\u0648", "\u064a\u0648\u0646\u064a\u0648", "\u064a\u0648\u0644\u064a\u0648", "\u0623\u063a\u0633\u0637\u0633", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "SHORTDAY": [ "\u0627\u0644\u0623\u062d\u062f", "\u0627\u0644\u0627\u062b\u0646\u064a\u0646", "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062e\u0645\u064a\u0633", "\u0627\u0644\u062c\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062a" ], "SHORTMONTH": [ "\u064a\u0646\u0627\u064a\u0631", "\u0641\u0628\u0631\u0627\u064a\u0631", "\u0645\u0627\u0631\u0633", "\u0623\u0628\u0631\u064a\u0644", "\u0645\u0627\u064a\u0648", "\u064a\u0648\u0646\u064a\u0648", "\u064a\u0648\u0644\u064a\u0648", "\u0623\u063a\u0633\u0637\u0633", "\u0633\u0628\u062a\u0645\u0628\u0631", "\u0623\u0643\u062a\u0648\u0628\u0631", "\u0646\u0648\u0641\u0645\u0628\u0631", "\u062f\u064a\u0633\u0645\u0628\u0631" ], "fullDate": "EEEE\u060c d MMMM\u060c y", "longDate": "d MMMM\u060c y", "medium": "dd\u200f/MM\u200f/y h:mm:ss a", "mediumDate": "dd\u200f/MM\u200f/y", "mediumTime": "h:mm:ss a", "short": "d\u200f/M\u200f/y h:mm a", "shortDate": "d\u200f/M\u200f/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u00a3", "DECIMAL_SEP": "\u066b", "GROUP_SEP": "\u066c", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4\u00a0-", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ar", "pluralCat": function(n, opt_precision) { if (n == 0) { return PLURAL_CATEGORY.ZERO; } if (n == 1) { return PLURAL_CATEGORY.ONE; } if (n == 2) { return PLURAL_CATEGORY.TWO; } if (n % 100 >= 3 && n % 100 <= 10) { return PLURAL_CATEGORY.FEW; } if (n % 100 >= 11 && n % 100 <= 99) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
iros/cdnjs
ajax/libs/angular-i18n/1.3.10/angular-locale_ar.js
JavaScript
mit
3,337
"use strict";angular.module("ngLocale",[],["$provide",function(e){function a(e){e+="";var a=e.indexOf(".");return-1==a?0:e.length-a-1}function o(e,o){var M=o;void 0===M&&(M=Math.min(a(e),3));var n=Math.pow(10,M),t=(e*n|0)%n;return{v:M,f:t}}var M={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Tshipi","Mosopulogo","Labobedi","Laboraro","Labone","Labotlhano","Matlhatso"],ERANAMES:["BCE","CE"],ERAS:["BCE","CE"],FIRSTDAYOFWEEK:6,MONTH:["Ferikgong","Tlhakole","Mopitlo","Moranang","Motsheganang","Seetebosigo","Phukwi","Phatwe","Lwetse","Diphalane","Ngwanatsele","Sedimonthole"],SHORTDAY:["Tsh","Mos","Bed","Rar","Ne","Tla","Mat"],SHORTMONTH:["Fer","Tlh","Mop","Mor","Mot","See","Phu","Pha","Lwe","Dip","Ngw","Sed"],WEEKENDRANGE:[5,6],fullDate:"y MMMM d, EEEE",longDate:"y MMMM d",medium:"y MMM d HH:mm:ss",mediumDate:"y MMM d",mediumTime:"HH:mm:ss","short":"y-MM-dd HH:mm",shortDate:"y-MM-dd",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"R",DECIMAL_SEP:".",GROUP_SEP:"Β ",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"Β€-",negSuf:"",posPre:"Β€",posSuf:""}]},id:"tn",pluralCat:function(e,a){var n=0|e,t=o(e,a);return 1==n&&0==t.v?M.ONE:M.OTHER}})}]); //# sourceMappingURL=./angular-locale_tn.min.js.map
nolsherry/cdnjs
ajax/libs/angular-i18n/1.5.5/angular-locale_tn.min.js
JavaScript
mit
1,396
/*! * Qoopido.js library v3.2.7, 2014-5-19 * https://github.com/dlueth/qoopido.js * (c) 2014 Dirk Lueth * Dual licensed under MIT and GPL */ !function(e){window.qoopido.register("pool",e,["./base","./function/merge","./function/unique/uuid"])}(function(e){"use strict";function t(){var e,t,i,n=this,o=n.metrics,u=n._settings,r=n._queue,s=n._variables,a=1;if(r.length>0&&(s.durationAverage>0&&(a=~~((a=u.frameBudget/s.durationAverage)<1?1:a)),(e=Math.min(r.length,(t=r.splice(0,a)).length))>0))if(o.inPool+e<=u.maxPoolsize){i=(new Date).getTime();for(var l=0;e>l;l++){var c=t[l],d=c._quid,_=c.dispose;c=n._dispose(c),c._quid=d,c.dispose=_,n._getPool.call(n,c).push(c)}o.inPool+=e,o.inQueue-=e,s.durationSamples+=e,s.durationTotal+=(new Date).getTime()-i,s.durationAverage=s.durationTotal/s.durationSamples}else{if("function"==typeof n._destroy)for(var p=0;e>p;p++)n._destroy(t[p]);t.length=0,o.inQueue-=e,o.destroyed+=e}}var i,n={interval:1e3/60,frameBudget:.5,maxPoolsize:1e3};return i=e.base.extend({metrics:null,_settings:null,_pool:null,_queue:null,_variables:null,_constructor:function(i){var o=this;o.metrics={total:0,inPool:0,inUse:0,inQueue:0,recycled:0,destroyed:0},o._settings=e["function/merge"]({},n,i),o._pool=o._initPool(),o._queue=[],o._variables={durationSamples:0,durationTotal:0,durationAverage:0},setInterval(function(){t.call(o)},o._settings.interval)},_initPool:function(){return[]},_initElement:function(t){var i=this;return t._quid=e["function/unique/uuid"](),t.dispose=function(){i.dispose(t)},i.metrics.total++,t},_getPool:function(){return this._pool},obtain:function(){var e=this,t=e._getPool.apply(e,arguments).pop();return t?(e.metrics.inPool--,e.metrics.recycled++):t=e._initElement(e._obtain.apply(e,arguments)),"function"==typeof t._obtain&&t._obtain.apply(t,arguments),e.metrics.inUse++,t},dispose:function(e){var t=this,i=t._queue;return e._quid||(e=t._initElement(e),t.metrics.inUse++),"function"==typeof e._dispose&&e._dispose(),i.push(e),t.metrics.inUse--,t.metrics.inQueue++,null}})});
pc035860/cdnjs
ajax/libs/qoopido.js/3.2.7/pool.js
JavaScript
mit
2,023
/*! * Qoopido.js library v3.2.8, 2014-5-23 * https://github.com/dlueth/qoopido.js * (c) 2014 Dirk Lueth * Dual licensed under MIT and GPL */ !function(e){window.qoopido.register("pool",e,["./base","./function/merge","./function/unique/uuid"])}(function(e){"use strict";function t(){var e,t,i,n=this,o=n.metrics,u=n._settings,r=n._queue,s=n._variables,a=1;if(r.length>0&&(s.durationAverage>0&&(a=~~((a=u.frameBudget/s.durationAverage)<1?1:a)),(e=Math.min(r.length,(t=r.splice(0,a)).length))>0))if(o.inPool+e<=u.maxPoolsize){i=(new Date).getTime();for(var l=0;e>l;l++){var c=t[l],d=c._quid,_=c.dispose;c=n._dispose(c),c._quid=d,c.dispose=_,n._getPool.call(n,c).push(c)}o.inPool+=e,o.inQueue-=e,s.durationSamples+=e,s.durationTotal+=(new Date).getTime()-i,s.durationAverage=s.durationTotal/s.durationSamples}else{if("function"==typeof n._destroy)for(var p=0;e>p;p++)n._destroy(t[p]);t.length=0,o.inQueue-=e,o.destroyed+=e}}var i,n={interval:1e3/60,frameBudget:.5,maxPoolsize:1e3};return i=e.base.extend({metrics:null,_settings:null,_pool:null,_queue:null,_variables:null,_constructor:function(i){var o=this;o.metrics={total:0,inPool:0,inUse:0,inQueue:0,recycled:0,destroyed:0},o._settings=e["function/merge"]({},n,i),o._pool=o._initPool(),o._queue=[],o._variables={durationSamples:0,durationTotal:0,durationAverage:0},setInterval(function(){t.call(o)},o._settings.interval)},_initPool:function(){return[]},_initElement:function(t){var i=this;return t._quid=e["function/unique/uuid"](),t.dispose=function(){i.dispose(t)},i.metrics.total++,t},_getPool:function(){return this._pool},obtain:function(){var e=this,t=e._getPool.apply(e,arguments).pop();return t?(e.metrics.inPool--,e.metrics.recycled++):t=e._initElement(e._obtain.apply(e,arguments)),"function"==typeof t._obtain&&t._obtain.apply(t,arguments),e.metrics.inUse++,t},dispose:function(e){var t=this,i=t._queue;return e._quid||(e=t._initElement(e),t.metrics.inUse++),"function"==typeof e._dispose&&e._dispose(),i.push(e),t.metrics.inUse--,t.metrics.inQueue++,null}})});
humbletim/cdnjs
ajax/libs/qoopido.js/3.2.8/pool.js
JavaScript
mit
2,023
ο»Ώ/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ (function(){CKEDITOR.plugins.add("placeholder",{requires:"widget,dialog",lang:"af,ar,bg,ca,cs,cy,da,de,de-ch,el,en,en-gb,eo,es,et,eu,fa,fi,fr,fr-ca,gl,he,hr,hu,id,it,ja,km,ko,ku,lv,nb,nl,no,pl,pt,pt-br,ru,si,sk,sl,sq,sv,th,tr,tt,ug,uk,vi,zh,zh-cn",icons:"placeholder",hidpi:!0,onLoad:function(){CKEDITOR.addCss(".cke_placeholder{background-color:#ff0}")},init:function(a){var b=a.lang.placeholder;CKEDITOR.dialog.add("placeholder",this.path+"dialogs/placeholder.js");a.widgets.add("placeholder",{dialog:"placeholder", pathName:b.pathName,template:'\x3cspan class\x3d"cke_placeholder"\x3e[[]]\x3c/span\x3e',downcast:function(){return new CKEDITOR.htmlParser.text("[["+this.data.name+"]]")},init:function(){this.setData("name",this.element.getText().slice(2,-2))},data:function(){this.element.setText("[["+this.data.name+"]]")},getLabel:function(){return this.editor.lang.widget.label.replace(/%1/,this.data.name+" "+this.pathName)}});a.ui.addButton&&a.ui.addButton("CreatePlaceholder",{label:b.toolbar,command:"placeholder", toolbar:"insert,5",icon:"placeholder"})},afterInit:function(a){var b=/\[\[([^\[\]])+\]\]/g;a.dataProcessor.dataFilter.addRules({text:function(f,d){var e=d.parent&&CKEDITOR.dtd[d.parent.name];if(!e||e.span)return f.replace(b,function(b){var c=null,c=new CKEDITOR.htmlParser.element("span",{"class":"cke_placeholder"});c.add(new CKEDITOR.htmlParser.text(b));c=a.widgets.wrapElement(c,"placeholder");return c.getOuterHtml()})}})}})})();
AdiechaHK/alex-app
assets/bower_components/ckeditor/plugins/placeholder/plugin.js
JavaScript
mit
1,605
/* big.js v2.5.0 https://github.com/MikeMcl/big.js/LICENCE */ ;(function ( global ) { 'use strict'; /* big.js v2.5.0 A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic. https://github.com/MikeMcl/big.js/ Copyright (c) 2012 Michael Mclaughlin <M8ch88l@gmail.com> MIT Expat Licence */ /****************************** EDITABLE DEFAULTS **********************************/ // The default values below must be integers within the stated ranges (inclusive). /* * The maximum number of decimal places of the results of methods involving * division, i.e. 'div' and 'sqrt', and 'pow' with negative exponents. */ Big['DP'] = 20; // 0 to MAX_DP /* * The rounding mode used when rounding to the above decimal places. * * 0 Round towards zero (i.e. truncate, no rounding). (ROUND_DOWN) * 1 Round to nearest neighbour. If equidistant, round up. (ROUND_HALF_UP) * 2 Round to nearest neighbour. If equidistant, to even neighbour. (ROUND_HALF_EVEN) * 3 Round away from zero. (ROUND_UP) */ Big['RM'] = 1; // 0, 1, 2 or 3 // The maximum value of 'Big.DP'. var MAX_DP = 1E6, // 0 to 1e+6 // The maximum magnitude of the exponent argument to the 'pow' method. MAX_POWER = 1E6, // 1 to 1e+6 /* * The exponent value at and beneath which 'toString' returns exponential notation. * Javascript's Number type: -7 * -1e+6 is the minimum recommended exponent value of a Big. */ TO_EXP_NEG = -7, // 0 to -1e+6 /* * The exponent value at and above which 'toString' returns exponential notation. * Javascript's Number type: 21 * 1e+6 is the maximum recommended exponent value of a Big, though there is no * enforcing or checking of a limit. */ TO_EXP_POS = 21, // 0 to 1e+6 /***********************************************************************************/ P = Big.prototype, isValid = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ONE = new Big(1); // CONSTRUCTOR /* * The exported function. * Create and return a new instance of a Big object. * * n {number|string|Big} A numeric value. */ function Big( n ) { var i, j, nL, x = this; // Enable constructor usage without new. if ( !(x instanceof Big) ) { return new Big( n ) } // Duplicate. if ( n instanceof Big ) { x['s'] = n['s']; x['e'] = n['e']; x['c'] = n['c'].slice(); return } // Minus zero? if ( n === 0 && 1 / n < 0 ) { n = '-0' // Ensure 'n' is string and check validity. } else if ( !isValid.test(n += '') ) { throwErr( NaN ) } // Determine sign. x['s'] = n.charAt(0) == '-' ? ( n = n.slice(1), -1 ) : 1; // Decimal point? if ( ( i = n.indexOf('.') ) > -1 ) { n = n.replace( '.', '' ) } // Exponential form? if ( ( j = n.search(/e/i) ) > 0 ) { // Determine exponent. if ( i < 0 ) { i = j } i += +n.slice( j + 1 ); n = n.substring( 0, j ) } else if ( i < 0 ) { // Integer. i = n.length } // Determine leading zeros. for ( j = 0; n.charAt(j) == '0'; j++ ) { } if ( j == ( nL = n.length ) ) { // Zero. x['c'] = [ x['e'] = 0 ] } else { // Determine trailing zeros. for ( ; n.charAt(--nL) == '0'; ) { } x['e'] = i - j - 1; x['c'] = []; // Convert string to array of digits (without leading and trailing zeros). for ( i = 0; j <= nL; x['c'][i++] = +n.charAt(j++) ) { } } } // PRIVATE FUNCTIONS /* * Round Big 'x' to a maximum of 'dp' decimal places using rounding mode * 'rm'. (Called by 'div', 'sqrt' and 'round'.) * * x {Big} The Big to round. * dp {number} Integer, 0 to MAX_DP inclusive. * rm {number} 0, 1, 2 or 3 ( ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP ) * [more] {boolean} Whether the result of division was truncated. */ function rnd( x, dp, rm, more ) { var xc = x['c'], i = x['e'] + dp + 1; if ( rm === 1 ) { // 'xc[i]' is the digit after the digit that may be rounded up. more = xc[i] >= 5 } else if ( rm === 2 ) { more = xc[i] > 5 || xc[i] == 5 && ( more || i < 0 || xc[i + 1] != null || xc[i - 1] & 1 ) } else if ( rm === 3 ) { more = more || xc[i] != null || i < 0 } else if ( more = false, rm !== 0 ) { throwErr( '!Big.RM!' ) } if ( i < 1 || !xc[0] ) { x['c'] = more // 1, 0.1, 0.01, 0.001, 0.0001 etc. ? ( x['e'] = -dp, [1] ) // Zero. : [ x['e'] = 0 ]; } else { // Remove any digits after the required decimal places. xc.length = i--; // Round up? if ( more ) { // Rounding up may mean the previous digit has to be rounded up and so on. for ( ; ++xc[i] > 9; ) { xc[i] = 0; if ( !i-- ) { ++x['e']; xc.unshift(1) } } } // Remove trailing zeros. for ( i = xc.length; !xc[--i]; xc.pop() ) { } } return x } /* * Throw a BigError. * * message {string} The error message. */ function throwErr( message ) { var err = new Error( message ); err['name'] = 'BigError'; throw err } // PROTOTYPE/INSTANCE METHODS /* * Return a new Big whose value is the absolute value of this Big. */ P['abs'] = function () { var x = new Big(this); x['s'] = 1; return x }; /* * Return * 1 if the value of this 'Big' is greater than the value of 'Big' 'y', * -1 if the value of this 'Big' is less than the value of 'Big' 'y', or * 0 if they have the same value. */ P['cmp'] = function ( y ) { var xNeg, x = this, xc = x['c'], yc = ( y = new Big( y ) )['c'], i = x['s'], j = y['s'], k = x['e'], l = y['e']; // Either zero? if ( !xc[0] || !yc[0] ) { return !xc[0] ? !yc[0] ? 0 : -j : i } // Signs differ? if ( i != j ) { return i } xNeg = i < 0; // Compare exponents. if ( k != l ) { return k > l ^ xNeg ? 1 : -1 } // Compare digit by digit. for ( i = -1, j = ( k = xc.length ) < ( l = yc.length ) ? k : l; ++i < j; ) { if ( xc[i] != yc[i] ) { return xc[i] > yc[i] ^ xNeg ? 1 : -1 } } // Compare lengths. return k == l ? 0 : k > l ^ xNeg ? 1 : -1 }; /* * Return a new Big whose value is the value of this Big divided by the * value of Big 'y', rounded, if necessary, to a maximum of 'Big.DP' * decimal places using rounding mode 'Big.RM'. */ P['div'] = function ( y ) { var x = this, dvd = x['c'], dvs = ( y = new Big(y) )['c'], s = x['s'] == y['s'] ? 1 : -1, dp = Big['DP']; if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) { throwErr( '!Big.DP!' ) } // Either 0? if ( !dvd[0] || !dvs[0] ) { // Both 0? if ( dvd[0] == dvs[0] ) { throwErr( NaN ) } // 'dvs' is 0? if ( !dvs[0] ) { // Throw +-Infinity. throwErr( s / 0 ) } // 'dvd' is 0. Return +-0. return new Big( s * 0 ) } var dvsL, dvsT, next, cmp, remI, dvsZ = dvs.slice(), dvdI = dvsL = dvs.length, dvdL = dvd.length, rem = dvd.slice( 0, dvsL ), remL = rem.length, quo = new Big(ONE), qc = quo['c'] = [], qi = 0, digits = dp + ( quo['e'] = x['e'] - y['e'] ) + 1; quo['s'] = s; s = digits < 0 ? 0 : digits; // Create version of divisor with leading zero. dvsZ.unshift(0); // Add zeros to make remainder as long as divisor. for ( ; remL++ < dvsL; rem.push(0) ) { } do { // 'next' is how many times the divisor goes into the current remainder. for ( next = 0; next < 10; next++ ) { // Compare divisor and remainder. if ( dvsL != ( remL = rem.length ) ) { cmp = dvsL > remL ? 1 : -1 } else { for ( remI = -1, cmp = 0; ++remI < dvsL; ) { if ( dvs[remI] != rem[remI] ) { cmp = dvs[remI] > rem[remI] ? 1 : -1; break } } } // Subtract divisor from remainder (if divisor < remainder). if ( cmp < 0 ) { // Remainder cannot be more than one digit longer than divisor. // Equalise lengths using divisor with extra leading zero? for ( dvsT = remL == dvsL ? dvs : dvsZ; remL; ) { if ( rem[--remL] < dvsT[remL] ) { for ( remI = remL; remI && !rem[--remI]; rem[remI] = 9 ) { } --rem[remI]; rem[remL] += 10 } rem[remL] -= dvsT[remL] } for ( ; !rem[0]; rem.shift() ) { } } else { break } } // Add the 'next' digit to the result array. qc[qi++] = cmp ? next : ++next; // Update the remainder. rem[0] && cmp ? ( rem[remL] = dvd[dvdI] || 0 ) : ( rem = [ dvd[dvdI] ] ) } while ( ( dvdI++ < dvdL || rem[0] != null ) && s-- ); // Leading zero? Do not remove if result is simply zero (qi == 1). if ( !qc[0] && qi != 1) { // There can't be more than one zero. qc.shift(); quo['e']--; } // Round? if ( qi > digits ) { rnd( quo, dp, Big['RM'], rem[0] != null ) } return quo } /* * Return true if the value of this Big is equal to the value of Big 'y', * otherwise returns false. */ P['eq'] = function ( y ) { return !this.cmp( y ) }; /* * Return true if the value of this Big is greater than the value of Big 'y', * otherwise returns false. */ P['gt'] = function ( y ) { return this.cmp( y ) > 0 }; /* * Return true if the value of this Big is greater than or equal to the * value of Big 'y', otherwise returns false. */ P['gte'] = function ( y ) { return this.cmp( y ) > -1 }; /* * Return true if the value of this Big is less than the value of Big 'y', * otherwise returns false. */ P['lt'] = function ( y ) { return this.cmp( y ) < 0 }; /* * Return true if the value of this Big is less than or equal to the value * of Big 'y', otherwise returns false. */ P['lte'] = function ( y ) { return this.cmp( y ) < 1 }; /* * Return a new Big whose value is the value of this Big minus the value * of Big 'y'. */ P['minus'] = function ( y ) { var d, i, j, xLTy, x = this, a = x['s'], b = ( y = new Big( y ) )['s']; // Signs differ? if ( a != b ) { return y['s'] = -b, x['plus'](y) } var xc = x['c'].slice(), xe = x['e'], yc = y['c'], ye = y['e']; // Either zero? if ( !xc[0] || !yc[0] ) { // 'y' is non-zero? return yc[0] ? ( y['s'] = -b, y ) // 'x' is non-zero? : new Big( xc[0] ? x // Both are zero. : 0 ) } // Determine which is the bigger number. // Prepend zeros to equalise exponents. if ( a = xe - ye ) { d = ( xLTy = a < 0 ) ? ( a = -a, xc ) : ( ye = xe, yc ); for ( d.reverse(), b = a; b--; d.push(0) ) { } d.reverse() } else { // Exponents equal. Check digit by digit. j = ( ( xLTy = xc.length < yc.length ) ? xc : yc ).length; for ( a = b = 0; b < j; b++ ) { if ( xc[b] != yc[b] ) { xLTy = xc[b] < yc[b]; break } } } // 'x' < 'y'? Point 'xc' to the array of the bigger number. if ( xLTy ) { d = xc, xc = yc, yc = d; y['s'] = -y['s'] } /* * Append zeros to 'xc' if shorter. No need to add zeros to 'yc' if shorter * as subtraction only needs to start at 'yc.length'. */ if ( ( b = -( ( j = xc.length ) - yc.length ) ) > 0 ) { for ( ; b--; xc[j++] = 0 ) { } } // Subtract 'yc' from 'xc'. for ( b = yc.length; b > a; ){ if ( xc[--b] < yc[b] ) { for ( i = b; i && !xc[--i]; xc[i] = 9 ) { } --xc[i]; xc[b] += 10 } xc[b] -= yc[b] } // Remove trailing zeros. for ( ; xc[--j] == 0; xc.pop() ) { } // Remove leading zeros and adjust exponent accordingly. for ( ; xc[0] == 0; xc.shift(), --ye ) { } if ( !xc[0] ) { // n - n = +0 y['s'] = 1; // Result must be zero. xc = [ye = 0] } return y['c'] = xc, y['e'] = ye, y }; /* * Return a new Big whose value is the value of this Big modulo the * value of Big 'y'. */ P['mod'] = function ( y ) { y = new Big( y ); var c, x = this, i = x['s'], j = y['s']; if ( !y['c'][0] ) { throwErr( NaN ) } x['s'] = y['s'] = 1; c = y.cmp( x ) == 1; x['s'] = i, y['s'] = j; return c ? new Big(x) : ( i = Big['DP'], j = Big['RM'], Big['DP'] = Big['RM'] = 0, x = x['div'](y), Big['DP'] = i, Big['RM'] = j, this['minus']( x['times'](y) ) ) }; /* * Return a new Big whose value is the value of this Big plus the value * of Big 'y'. */ P['plus'] = function ( y ) { var d, x = this, a = x['s'], b = ( y = new Big( y ) )['s']; // Signs differ? if ( a != b ) { return y['s'] = -b, x['minus'](y) } var xe = x['e'], xc = x['c'], ye = y['e'], yc = y['c']; // Either zero? if ( !xc[0] || !yc[0] ) { // 'y' is non-zero? return yc[0] ? y : new Big( xc[0] // 'x' is non-zero? ? x // Both are zero. Return zero. : a * 0 ) } // Prepend zeros to equalise exponents. // Note: Faster to use reverse then do unshifts. if ( xc = xc.slice(), a = xe - ye ) { d = a > 0 ? ( ye = xe, yc ) : ( a = -a, xc ); for ( d.reverse(); a--; d.push(0) ) { } d.reverse() } // Point 'xc' to the longer array. if ( xc.length - yc.length < 0 ) { d = yc, yc = xc, xc = d } /* * Only start adding at 'yc.length - 1' as the * further digits of 'xc' can be left as they are. */ for ( a = yc.length, b = 0; a; b = ( xc[--a] = xc[a] + yc[a] + b ) / 10 ^ 0, xc[a] %= 10 ) { } // No need to check for zero, as +x + +y != 0 && -x + -y != 0 if ( b ) { xc.unshift(b); ++ye } // Remove trailing zeros. for ( a = xc.length; xc[--a] == 0; xc.pop() ) { } return y['c'] = xc, y['e'] = ye, y }; /* * Return a Big whose value is the value of this Big raised to the power * 'e'. If 'e' is negative, round, if necessary, to a maximum of 'Big.DP' * decimal places using rounding mode 'Big.RM'. * * e {number} Integer, -MAX_POWER to MAX_POWER inclusive. */ P['pow'] = function ( e ) { var isNeg = e < 0, x = new Big(this), y = ONE; if ( e !== ~~e || e < -MAX_POWER || e > MAX_POWER ) { throwErr( '!pow!' ) } for ( e = isNeg ? -e : e; ; ) { if ( e & 1 ) { y = y['times'](x) } e >>= 1; if ( !e ) { break } x = x['times'](x) } return isNeg ? ONE['div'](y) : y }; /* * Return a new Big whose value is the value of this Big rounded, if * necessary, to a maximum of 'dp' decimal places using rounding mode 'rm'. * If 'dp' is not specified, round to 0 decimal places. * If 'rm' is not specified, use 'Big.RM'. * * [dp] {number} Integer, 0 to MAX_DP inclusive. * [rm] 0, 1, 2 or 3 ( ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP ) */ P['round'] = function ( dp, rm ) { var x = new Big(this); if ( dp == null ) { dp = 0 } else if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) { throwErr( '!round!' ) } rnd( x, dp, rm == null ? Big['RM'] : rm ); return x }; /* * Return a new Big whose value is the square root of the value of this * Big, rounded, if necessary, to a maximum of 'Big.DP' decimal places * using rounding mode 'Big.RM'. */ P['sqrt'] = function () { var estimate, r, approx, x = this, xc = x['c'], i = x['s'], e = x['e'], half = new Big('0.5'); // Zero? if ( !xc[0] ) { return new Big(x) } // Negative? if ( i < 0 ) { throwErr( NaN ) } // Estimate. i = Math.sqrt( x.toString() ); // Math.sqrt underflow/overflow? // Pass 'x' to Math.sqrt as integer, then adjust the exponent of the result. if ( i == 0 || i == 1 / 0 ) { estimate = xc.join(''); if ( !( estimate.length + e & 1 ) ) { estimate += '0' } r = new Big( Math.sqrt(estimate).toString() ); r['e'] = ( ( ( e + 1 ) / 2 ) | 0 ) - ( e < 0 || e & 1 ) } else { r = new Big( i.toString() ) } i = r['e'] + ( Big['DP'] += 4 ); // Newton-Raphson loop. do { approx = r; r = half['times']( approx['plus']( x['div'](approx) ) ) } while ( approx['c'].slice( 0, i ).join('') !== r['c'].slice( 0, i ).join('') ); rnd( r, Big['DP'] -= 4, Big['RM'] ); return r }; /* * Return a new Big whose value is the value of this Big times the value * of Big 'y'. */ P['times'] = function ( y ) { var c, x = this, xc = x['c'], yc = ( y = new Big( y ) )['c'], a = xc.length, b = yc.length, i = x['e'], j = y['e']; y['s'] = x['s'] == y['s'] ? 1 : -1; // Either 0? if ( !xc[0] || !yc[0] ) { return new Big( y['s'] * 0 ) } y['e'] = i + j; if ( a < b ) { c = xc, xc = yc, yc = c, j = a, a = b, b = j } for ( j = a + b, c = []; j--; c.push(0) ) { } // Multiply! for ( i = b - 1; i > -1; i-- ) { for ( b = 0, j = a + i; j > i; b = c[j] + yc[i] * xc[j - i - 1] + b, c[j--] = b % 10 | 0, b = b / 10 | 0 ) { } if ( b ) { c[j] = ( c[j] + b ) % 10 } } b && ++y['e']; // Remove any leading zero. !c[0] && c.shift(); // Remove trailing zeros. for ( j = c.length; !c[--j]; c.pop() ) { } return y['c'] = c, y }; /* * Return a string representing the value of this Big. * Return exponential notation if this Big has a positive exponent equal * to or greater than 'TO_EXP_POS', or a negative exponent equal to or less * than 'TO_EXP_NEG'. */ P['toString'] = P['valueOf'] = P['toJSON'] = function () { var x = this, e = x['e'], str = x['c'].join(''), strL = str.length; // Exponential notation? if ( e <= TO_EXP_NEG || e >= TO_EXP_POS ) { str = str.charAt(0) + ( strL > 1 ? '.' + str.slice(1) : '' ) + ( e < 0 ? 'e' : 'e+' ) + e // Negative exponent? } else if ( e < 0 ) { // Prepend zeros. for ( ; ++e; str = '0' + str ) { } str = '0.' + str // Positive exponent? } else if ( e > 0 ) { if ( ++e > strL ) { // Append zeros. for ( e -= strL; e-- ; str += '0' ) { } } else if ( e < strL ) { str = str.slice( 0, e ) + '.' + str.slice(e) } // Exponent zero. } else if ( strL > 1 ) { str = str.charAt(0) + '.' + str.slice(1) } // Avoid '-0' return x['s'] < 0 && x['c'][0] ? '-' + str : str }; /* *************************************************************************** * If 'toExponential', 'toFixed', 'toPrecision' and 'format' are not * required they can safely be commented-out or deleted. No redundant code * will be left. 'format' is used only by 'toExponential', 'toFixed' and * 'toPrecision'. *************************************************************************** */ /* * PRIVATE FUNCTION * * Return a string representing the value of Big 'x' in normal or * exponential notation to a fixed number of decimal places or significant * digits 'dp'. * (Called by toString, toExponential, toFixed and toPrecision.) * * x {Big} The Big to format. * dp {number} Integer, 0 to MAX_DP inclusive. * toE {number} undefined (toFixed), 1 (toExponential) or 2 (toPrecision). */ function format( x, dp, toE ) { // The index (in normal notation) of the digit that may be rounded up. var i = dp - ( x = new Big(x) )['e'], c = x['c']; // Round? if ( c.length > ++dp ) { rnd( x, i, Big['RM'] ) } // Recalculate 'i' if toFixed as 'x.e' may have changed if value rounded up. i = !c[0] ? i + 1 : toE ? dp : ( c = x['c'], x['e'] + i + 1 ); // Append zeros? for ( ; c.length < i; c.push(0) ) { } i = x['e']; /* * 'toPrecision' returns exponential notation if the number of * significant digits specified is less than the number of digits * necessary to represent the integer part of the value in normal * notation. */ return toE == 1 || toE == 2 && ( dp <= i || i <= TO_EXP_NEG ) // Exponential notation. ? ( x['s'] < 0 && c[0] ? '-' : '' ) + ( c.length > 1 ? ( c.splice( 1, 0, '.' ), c.join('') ) : c[0] ) + ( i < 0 ? 'e' : 'e+' ) + i // Normal notation. : x.toString() } /* * Return a string representing the value of this Big in exponential * notation to 'dp' fixed decimal places and rounded, if necessary, using * 'Big.RM'. * * [dp] {number} Integer, 0 to MAX_DP inclusive. */ P['toExponential'] = function ( dp ) { if ( dp == null ) { dp = this['c'].length - 1 } else if ( dp !== ~~dp || dp < 0 || dp > MAX_DP ) { throwErr( '!toExp!' ) } return format( this, dp, 1 ) }; /* * Return a string representing the value of this Big in normal notation * to 'dp' fixed decimal places and rounded, if necessary, using 'Big.RM'. * * [dp] {number} Integer, 0 to MAX_DP inclusive. */ P['toFixed'] = function ( dp ) { var str, x = this, neg = TO_EXP_NEG, pos = TO_EXP_POS; TO_EXP_NEG = -( TO_EXP_POS = 1 / 0 ); if ( dp == null ) { str = x.toString() } else if ( dp === ~~dp && dp >= 0 && dp <= MAX_DP ) { str = format( x, x['e'] + dp ); // (-0).toFixed() is '0', but (-0.1).toFixed() is '-0'. // (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. if ( x['s'] < 0 && x['c'][0] && str.indexOf('-') < 0 ) { // As e.g. -0.5 if rounded to -0 will cause toString to omit the minus sign. str = '-' + str } } TO_EXP_NEG = neg, TO_EXP_POS = pos; if ( !str ) { throwErr( '!toFix!' ) } return str }; /* * Return a string representing the value of this Big to 'sd' significant * digits and rounded, if necessary, using 'Big.RM'. If 'sd' is less than * the number of digits necessary to represent the integer part of the value * in normal notation, then use exponential notation. * * sd {number} Integer, 1 to MAX_DP inclusive. */ P['toPrecision'] = function ( sd ) { if ( sd == null ) { return this.toString() } else if ( sd !== ~~sd || sd < 1 || sd > MAX_DP ) { throwErr( '!toPre!' ) } return format( this, sd - 1, 2 ) }; // EXPORT // Node and other CommonJS-like environments that support module.exports. if ( typeof module !== 'undefined' && module.exports ) { module.exports = Big //AMD. } else if ( typeof define == 'function' && define.amd ) { define( function () { return Big }) //Browser. } else { global['Big'] = Big } })( this );
ManrajGrover/jsdelivr
files/big.js/2.5.0/big.js
JavaScript
mit
27,703
/* AnythingSlider v1.8+ Metallic theme By Rob Garrison */ /***************************** SET DEFAULT DIMENSIONS HERE *****************************/ /* change the ID & dimensions to match your slider */ #slider { width: 700px; height: 390px; list-style: none; /* Prevent FOUC (see FAQ page) and keep things readable if javascript is disabled */ overflow-y: auto; overflow-x: hidden; } /****************** SET STYLING HERE ****************** ================================= Default state (no keyboard focus) ==================================*/ /* Overall Wrapper */ .anythingSlider-metallic { margin: 0 auto; /* 23px right & left padding for the navigation arrows */ padding: 0 23px; } /* slider window - top & bottom borders, default state */ .anythingSlider-metallic .anythingWindow { border-top: 3px solid #333; border-bottom: 3px solid #333; } /* Navigation buttons + start/stop button, default state */ .anythingSlider-metallic .anythingControls a { background: transparent url(../images/arrows-metallic.png) -68px -40px repeat-x; color: #000; border: #000 1px solid; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } /* Navigation current button, default state */ .anythingSlider-metallic .anythingControls a.cur, .anythingSlider-metallic .anythingControls a:hover { background-position: -70px -137px; background-color: #888; color: #000; } /* start-stop button, stopped, default state */ .anythingSlider-metallic .anythingControls a.start-stop { background: #040; color: #ddd; /* top shadow */ -moz-box-shadow: inset 1px 2px 5px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 1px 2px 5px rgba(0, 0, 0, 0.5); box-shadow: inset 1px 2px 5px rgba(0, 0, 0, 0.5); } /* start-stop button, playing, default state */ .anythingSlider-metallic .anythingControls a.start-stop.playing { background-color: #800; } /* start-stop button, default hovered text color (when visible) */ /* hide nav/start-stop background image shadow on hover - makes the button appear to come forward */ .anythingSlider-metallic .anythingControls a.start-stop:hover, .anythingSlider-metallic .anythingControls a.start-stop.hover, .anythingSlider-metallic .anythingControls a.start-stop .anythingControls ul a:hover { color: #fff; /* clear top shadow */ -moz-box-shadow: inset 0 0 0 #000000; -webkit-box-shadow: inset 0 0 0 #000000; box-shadow: inset 0 0 0 #000000; } /* ================================= Active State (has keyboard focus) ================================= */ /* slider window - top & bottom borders, active state */ .anythingSlider-metallic.activeSlider .anythingWindow { border-color: #0355a3; } /* Navigation buttons, active state */ .anythingSlider-metallic.activeSlider .anythingControls a { background-color: transparent; } /* Navigation current button, active state */ .anythingSlider-metallic.activeSlider .anythingControls a.cur, .anythingSlider-metallic.activeSlider .anythingControls a:hover { background-position: -76px -57px; background-color: #ccc; } /* start-stop button, stopped, active state */ .anythingSlider-metallic.activeSlider .anythingControls a.start-stop { background: #080; color: #fff; } /* start-stop button, playing, active state */ .anythingSlider-metallic.activeSlider .anythingControls a.start-stop.playing { color: #fff; background: #d00; } /* start-stop button, active slider hovered text color (when visible) */ .anythingSlider-metallic.activeSlider .start-stop:hover, .anythingSlider-metallic.activeSlider .start-stop.hover { color: #fff; } /************************ NAVIGATION POSITIONING ************************/ /* Navigation Arrows */ .anythingSlider-metallic .arrow { top: 50%; position: absolute; display: block; z-index: 100; } .anythingSlider-metallic .arrow a { display: block; width: 45px; height: 95px; margin: -47.5px 0 0 0; /* half height of image */ text-align: center; outline: 0; background: url(../images/arrows-metallic.png) no-repeat; } /* back arrow */ .anythingSlider-metallic .back { left: 0; } .anythingSlider-metallic .back a { background-position: left bottom; } .anythingSlider-metallic .back a:hover, .anythingSlider-metallic .back a.hover { background-position: left top; } /* forward arrow */ .anythingSlider-metallic .forward { right: 0; } .anythingSlider-metallic .forward a { background-position: right bottom; } .anythingSlider-metallic .forward a:hover, .anythingSlider-metallic .forward a.hover { background-position: right top; } /* Navigation Links */ .anythingSlider-metallic .anythingControls { height: 15px; /* limit height, needed for IE9 of all things */ outline: 0; display: none; float: right; position: absolute; bottom: 5px; right: 20px; margin: 0 45px; z-index: 100; opacity: 0.90; filter: alpha(opacity=90); } .anythingSlider-metallic .anythingControls ul { margin: 0; padding: 0; float: left; } .anythingSlider-metallic .anythingControls ul li { list-style: none; float: left; margin: 0; padding: 0; } .anythingSlider-metallic .anythingControls ul a { display: inline-block; width: 10px; height: 10px; margin: 3px; padding: 0; text-decoration: none; text-align: center; outline: 0; } .anythingSlider-metallic .anythingControls span { display: block; visibility: hidden; } /* navigationSize window */ .anythingSlider-metallic .anythingControls .anythingNavWindow { overflow: hidden; float: left; } /* navigationSize nav arrow positioning */ .anythingSlider-metallic .anythingControls li.prev a span, .anythingSlider-metallic .anythingControls li.next a span { visibility: visible; position: relative; top: -6px; /* bring navigationSize text arrows into view */ color: #fff; } /* Autoplay Start/Stop button */ .anythingSlider-metallic .anythingControls .start-stop { display: inline-block; width: 10px; height: 10px; margin: 3px; padding: 0; text-align: center; text-decoration: none; z-index: 100; outline: 0; } /*********************** IE8 AND OLDER STYLING ***********************/ /* Navigation Arrows */ .as-oldie .anythingSlider-metallic .arrow { top: 40%; } .as-oldie .anythingSlider-metallic .arrow a { margin: 0; } /*********************** COMMON SLIDER STYLING ***********************/ /* Overall Wrapper */ .anythingSlider { display: block; overflow: visible !important; position: relative; } /* anythingSlider viewport window */ .anythingSlider .anythingWindow { overflow: hidden; position: relative; width: 100%; height: 100%; } /* anythingSlider base (original element) */ .anythingSlider .anythingBase { background: transparent; list-style: none; position: absolute; overflow: visible !important; top: 0; left: 0; margin: 0; padding: 0; } /* Navigation arrow text; indent moved to span inside "a", for IE7; apparently, a negative text-indent on an "a" link moves the link as well as the text */ .anythingSlider .arrow span { display: block; visibility: hidden; } /* disabled arrows, hide or reduce opacity: opacity: .5; filter: alpha(opacity=50); */ .anythingSlider .arrow.disabled { display: none; } /* all panels inside the slider; horizontal mode */ .anythingSlider .panel { background: transparent; display: block; overflow: hidden; float: left; padding: 0; margin: 0; } /* vertical mode */ .anythingSlider .vertical .panel { float: none; } /* fade mode */ .anythingSlider .fade .panel { float: none; opacity: 0; filter: alpha(opacity=0); position: absolute; top: 0; left: 0; } .anythingSlider .fade .activePage, .anythingSlider .fade .visiblePage { opacity: 1; filter: alpha(opacity=100); z-index: 2; } /*********************** RTL STYLING ***********************/ /* slider autoplay right-to-left, reverse order of nav links to look better */ .anythingSlider.rtl .anythingWindow { direction: ltr; unicode-bidi: bidi-override; } .anythingSlider.rtl .anythingControls ul { float: left; } /* move nav link group to left */ .anythingSlider.rtl .anythingControls ul a { float: right; } /* reverse order of nav links */ .anythingSlider.rtl .start-stop { /* float: right; */ } /* move start/stop button - in case you want to switch sides */ /* probably not necessary, but added just in case */ .anythingSlider .anythingWindow, .anythingSlider .anythingControls ul a, .anythingSlider .arrow a, .anythingSlider .start-stop { transition-duration: 0; -o-transition-duration: 0; -moz-transition-duration: 0; -webkit-transition-duration: 0; }
algolia/cdnjs
ajax/libs/anythingslider/1.8/css/theme-metallic.css
CSS
mit
8,428
/*! formstone v0.7.4 [touch.js] 2015-07-17 | MIT License | formstone.it */ !function(a,b){"use strict";function c(a){a.touches=[],a.touching=!1,this.on(r.dragStart,s.killEvent),a.tap?(a.pan=!1,a.scale=!1,a.swipe=!1,b.support.touch?this.on([r.touchStart,r.pointerDown].join(" "),a,f):this.on(r.click,a,k)):(a.pan||a.swipe||a.scale)&&(a.tap=!1,a.swipe&&(a.pan=!0),a.scale&&(a.axis=!1),a.axis?(a.axisX="x"===a.axis,a.axisY="y"===a.axis):o(this,"none"),this.on([r.touchStart,r.pointerDown].join(" "),a,e),a.pan&&!b.support.touch&&this.on(r.mouseDown,a,f))}function d(){this.off(r.namespace),o(this,"")}function e(a){a.preventManipulation&&a.preventManipulation();var b=a.data,c=a.originalEvent;if(c.type.match(/(up|end)$/i))return void j(a);if(c.pointerId){var d=!1;for(var e in b.touches)b.touches[e].id===c.pointerId&&(d=!0,b.touches[e].pageX=c.clientX,b.touches[e].pageY=c.clientY);d||b.touches.push({id:c.pointerId,pageX:c.clientX,pageY:c.clientY})}else b.touches=c.touches;c.type.match(/(down|start)$/i)?f(a):c.type.match(/move$/i)&&g(a)}function f(b){var c=b.data,d="undefined"!==a.type(c.touches)?c.touches[0]:null;if(c.touching||(c.startE=b.originalEvent,c.startX=d?d.pageX:b.pageX,c.startY=d?d.pageY:b.pageY,c.startT=(new Date).getTime(),c.scaleD=1,c.passed=!1),c.tap)c.clicked=!1,c.$el.on([r.touchMove,r.pointerMove].join(" "),c,e).on([r.touchEnd,r.touchCancel,r.pointerUp,r.pointerCancel].join(" "),c,e);else if(c.pan||c.scale){c.$links&&c.$links.off(r.click);var f=l(c.scale?r.scaleStart:r.panStart,b,c.startX,c.startY,c.scaleD,0,0,"","");if(c.scale&&c.touches&&c.touches.length>=2){var h=c.touches;c.pinch={startX:m(h[0].pageX,h[1].pageX),startY:m(h[0].pageY,h[1].pageY),startD:n(h[1].pageX-h[0].pageX,h[1].pageY-h[0].pageY)},f.pageX=c.startX=c.pinch.startX,f.pageY=c.startY=c.pinch.startY}c.touching||(c.touching=!0,c.pan&&t.on(r.mouseMove,c,g).on(r.mouseUp,c,j),t.on([r.touchMove,r.touchEnd,r.touchCancel,r.pointerMove,r.pointerUp,r.pointerCancel].join(" "),c,e),c.$el.trigger(f))}}function g(b){var c=b.data,d="undefined"!==a.type(c.touches)?c.touches[0]:null,e=d?d.pageX:b.pageX,f=d?d.pageY:b.pageY,g=e-c.startX,h=f-c.startY,i=g>0?"right":"left",k=h>0?"down":"up",o=Math.abs(g)>u,p=Math.abs(h)>u;if(c.tap)(o||p)&&c.$el.off([r.touchMove,r.touchEnd,r.touchCancel,r.pointerMove,r.pointerUp,r.pointerCancel].join(" "));else if(c.pan||c.scale)if(!c.passed&&c.axis&&(c.axisX&&p||c.axisY&&o))j(b);else{!c.passed&&(!c.axis||c.axis&&c.axisX&&o||c.axisY&&p)&&(c.passed=!0),c.passed&&(s.killEvent(b),s.killEvent(c.startE));var q=!0,t=l(c.scale?r.scale:r.pan,b,e,f,c.scaleD,g,h,i,k);if(c.scale)if(c.touches&&c.touches.length>=2){var v=c.touches;c.pinch.endX=m(v[0].pageX,v[1].pageX),c.pinch.endY=m(v[0].pageY,v[1].pageY),c.pinch.endD=n(v[1].pageX-v[0].pageX,v[1].pageY-v[0].pageY),c.scaleD=c.pinch.endD/c.pinch.startD,t.pageX=c.pinch.endX,t.pageY=c.pinch.endY,t.scale=c.scaleD,t.deltaX=c.pinch.endX-c.pinch.startX,t.deltaY=c.pinch.endY-c.pinch.startY}else c.pan||(q=!1);q&&c.$el.trigger(t)}}function h(b,c){b.on(r.click,c,i);var d=a._data(b[0],"events").click;d.unshift(d.pop())}function i(a){s.killEvent(a,!0),a.data.$links.off(r.click)}function j(b){var c=b.data;if(c.tap)c.$el.off([r.touchMove,r.touchEnd,r.touchCancel,r.pointerMove,r.pointerUp,r.pointerCancel,r.mouseMove,r.mouseUp].join(" ")),c.startE.preventDefault(),k(b);else if(c.pan||c.scale){var d="undefined"!==a.type(c.touches)?c.touches[0]:null,e=d?d.pageX:b.pageX,f=d?d.pageY:b.pageY,g=e-c.startX,i=f-c.startY,j=(new Date).getTime(),m=c.scale?r.scaleEnd:r.panEnd,n=g>0?"right":"left",o=i>0?"down":"up",p=Math.abs(g)>1,q=Math.abs(i)>1;if(c.swipe&&Math.abs(g)>u&&j-c.startT<v&&(m=r.swipe),c.axis&&(c.axisX&&q||c.axisY&&p)||p||q){c.$links=c.$el.find("a");for(var s=0,w=c.$links.length;w>s;s++)h(c.$links.eq(s),c)}var x=l(m,b,e,f,c.scaleD,g,i,n,o);t.off([r.touchMove,r.touchEnd,r.touchCancel,r.mouseMove,r.mouseUp,r.pointerMove,r.pointerUp,r.pointerCancel].join(" ")),c.$el.trigger(x),c.touches=[],c.scale}c.touching=!1}function k(a){s.killEvent(a);var b=a.data;if(!b.clicked){"click"!==a.type&&(b.clicked=!0);var c=b.startE?b.startX:a.pageX,d=b.startE?b.startY:a.pageY,e=l(r.tap,a.originalEvent,c,d,1,0,0);b.$el.trigger(e)}}function l(b,c,d,e,f,g,h,i,j){return a.Event(b,{originalEvent:c,bubbles:!0,pageX:d,pageY:e,scale:f,deltaX:g,deltaY:h,directionX:i,directionY:j})}function m(a,b){return(a+b)/2}function n(a,b){return Math.sqrt(a*a+b*b)}function o(a,b){a.css({"-ms-touch-action":b,"touch-action":b})}var p=!b.window.PointerEvent,q=b.Plugin("touch",{widget:!0,defaults:{axis:!1,pan:!1,scale:!1,swipe:!1,tap:!1},methods:{_construct:c,_destruct:d},events:{pointerDown:p?"MSPointerDown":"pointerdown",pointerUp:p?"MSPointerUp":"pointerup",pointerMove:p?"MSPointerMove":"pointermove",pointerCancel:p?"MSPointerCancel":"pointercancel"}}),r=q.events,s=q.functions,t=b.$window,u=10,v=50;r.tap="tap",r.pan="pan",r.panStart="panstart",r.panEnd="panend",r.scale="scale",r.scaleStart="scalestart",r.scaleEnd="scaleend",r.swipe="swipe"}(jQuery,Formstone);
dc-js/cdnjs
ajax/libs/formstone/0.7.4/js/touch.js
JavaScript
mit
5,010
/** * @license AngularJS v1.3.0-beta.2 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; /** * @ngdoc module * @name ngRoute * @description * * # ngRoute * * The `ngRoute` module provides routing and deeplinking services and directives for angular apps. * * ## Example * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`. * * * <div doc-module-components="ngRoute"></div> */ /* global -ngRouteModule */ var ngRouteModule = angular.module('ngRoute', ['ng']). provider('$route', $RouteProvider); /** * @ngdoc provider * @name $routeProvider * @function * * @description * * Used for configuring routes. * * ## Example * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`. * * ## Dependencies * Requires the {@link ngRoute `ngRoute`} module to be installed. */ function $RouteProvider(){ function inherit(parent, extra) { return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra); } var routes = {}; /** * @ngdoc method * @name $routeProvider#when * * @param {string} path Route path (matched against `$location.path`). If `$location.path` * contains redundant trailing slash or is missing one, the route will still match and the * `$location.path` will be updated to add or drop the trailing slash to exactly match the * route definition. * * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up * to the next slash are matched and stored in `$routeParams` under the given `name` * when the route matches. * * `path` can contain named groups starting with a colon and ending with a star: * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name` * when the route matches. * * `path` can contain optional named groups with a question mark: e.g.`:name?`. * * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match * `/color/brown/largecode/code/with/slashes/edit` and extract: * * * `color: brown` * * `largecode: code/with/slashes`. * * * @param {Object} route Mapping information to be assigned to `$route.current` on route * match. * * Object properties: * * - `controller` – `{(string|function()=}` – Controller fn that should be associated with * newly created scope or the name of a {@link angular.Module#controller registered * controller} if passed as a string. * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be * published to scope under the `controllerAs` name. * - `template` – `{string=|function()=}` – html template as a string or a function that * returns an html template as a string which should be used by {@link * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives. * This property takes precedence over `templateUrl`. * * If `template` is a function, it will be called with the following parameters: * * - `{Array.<Object>}` - route parameters extracted from the current * `$location.path()` by applying the current route * * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html * template that should be used by {@link ngRoute.directive:ngView ngView}. * * If `templateUrl` is a function, it will be called with the following parameters: * * - `{Array.<Object>}` - route parameters extracted from the current * `$location.path()` by applying the current route * * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should * be injected into the controller. If any of these dependencies are promises, the router * will wait for them all to be resolved or one to be rejected before the controller is * instantiated. * If all the promises are resolved successfully, the values of the resolved promises are * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is * fired. If any of the promises are rejected the * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object * is: * * - `key` – `{string}`: a name of a dependency to be injected into the controller. * - `factory` - `{string|function}`: If `string` then it is an alias for a service. * Otherwise if function, then it is {@link auto.$injector#invoke injected} * and the return value is treated as the dependency. If the result is a promise, it is * resolved before its value is injected into the controller. Be aware that * `ngRoute.$routeParams` will still refer to the previous route within these resolve * functions. Use `$route.current.params` to access the new route parameters, instead. * * - `redirectTo` – {(string|function())=} – value to update * {@link ng.$location $location} path with and trigger route redirection. * * If `redirectTo` is a function, it will be called with the following parameters: * * - `{Object.<string>}` - route parameters extracted from the current * `$location.path()` by applying the current route templateUrl. * - `{string}` - current `$location.path()` * - `{Object}` - current `$location.search()` * * The custom `redirectTo` function is expected to return a string which will be used * to update `$location.path()` and `$location.search()`. * * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()` * or `$location.hash()` changes. * * If the option is set to `false` and url in the browser changes, then * `$routeUpdate` event is broadcasted on the root scope. * * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive * * If the option is set to `true`, then the particular route can be matched without being * case sensitive * * @returns {Object} self * * @description * Adds a new route definition to the `$route` service. */ this.when = function(path, route) { routes[path] = angular.extend( {reloadOnSearch: true}, route, path && pathRegExp(path, route) ); // create redirection for trailing slashes if (path) { var redirectPath = (path[path.length-1] == '/') ? path.substr(0, path.length-1) : path +'/'; routes[redirectPath] = angular.extend( {redirectTo: path}, pathRegExp(redirectPath, route) ); } return this; }; /** * @param path {string} path * @param opts {Object} options * @return {?Object} * * @description * Normalizes the given path, returning a regular expression * and the original path. * * Inspired by pathRexp in visionmedia/express/lib/utils.js. */ function pathRegExp(path, opts) { var insensitive = opts.caseInsensitiveMatch, ret = { originalPath: path, regexp: path }, keys = ret.keys = []; path = path .replace(/([().])/g, '\\$1') .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){ var optional = option === '?' ? option : null; var star = option === '*' ? option : null; keys.push({ name: key, optional: !!optional }); slash = slash || ''; return '' + (optional ? '' : slash) + '(?:' + (optional ? slash : '') + (star && '(.+?)' || '([^/]+)') + (optional || '') + ')' + (optional || ''); }) .replace(/([\/$\*])/g, '\\$1'); ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : ''); return ret; } /** * @ngdoc method * @name $routeProvider#otherwise * * @description * Sets route definition that will be used on route change when no other route definition * is matched. * * @param {Object} params Mapping information to be assigned to `$route.current`. * @returns {Object} self */ this.otherwise = function(params) { this.when(null, params); return this; }; this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache', '$sce', function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) { /** * @ngdoc service * @name $route * @requires $location * @requires $routeParams * * @property {Object} current Reference to the current route definition. * The route definition contains: * * - `controller`: The controller constructor as define in route definition. * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for * controller instantiation. The `locals` contain * the resolved values of the `resolve` map. Additionally the `locals` also contain: * * - `$scope` - The current route scope. * - `$template` - The current route template HTML. * * @property {Object} routes Object with all route configuration Objects as its properties. * * @description * `$route` is used for deep-linking URLs to controllers and views (HTML partials). * It watches `$location.url()` and tries to map the path to an existing route definition. * * Requires the {@link ngRoute `ngRoute`} module to be installed. * * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API. * * The `$route` service is typically used in conjunction with the * {@link ngRoute.directive:ngView `ngView`} directive and the * {@link ngRoute.$routeParams `$routeParams`} service. * * @example * This example shows how changing the URL hash causes the `$route` to match a route against the * URL, and the `ngView` pulls in the partial. * * Note that this example is using {@link ng.directive:script inlined templates} * to get it working on jsfiddle as well. * * <example name="$route-service" module="ngRouteExample" * deps="angular-route.js" fixBase="true"> * <file name="index.html"> * <div ng-controller="MainCntl"> * Choose: * <a href="Book/Moby">Moby</a> | * <a href="Book/Moby/ch/1">Moby: Ch1</a> | * <a href="Book/Gatsby">Gatsby</a> | * <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | * <a href="Book/Scarlet">Scarlet Letter</a><br/> * * <div ng-view></div> * <hr /> * * <pre>$location.path() = {{$location.path()}}</pre> * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre> * <pre>$route.current.params = {{$route.current.params}}</pre> * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre> * <pre>$routeParams = {{$routeParams}}</pre> * </div> * </file> * * <file name="book.html"> * controller: {{name}}<br /> * Book Id: {{params.bookId}}<br /> * </file> * * <file name="chapter.html"> * controller: {{name}}<br /> * Book Id: {{params.bookId}}<br /> * Chapter Id: {{params.chapterId}} * </file> * * <file name="script.js"> * angular.module('ngRouteExample', ['ngRoute']) * * .config(function($routeProvider, $locationProvider) { * $routeProvider.when('/Book/:bookId', { * templateUrl: 'book.html', * controller: BookCntl, * resolve: { * // I will cause a 1 second delay * delay: function($q, $timeout) { * var delay = $q.defer(); * $timeout(delay.resolve, 1000); * return delay.promise; * } * } * }); * $routeProvider.when('/Book/:bookId/ch/:chapterId', { * templateUrl: 'chapter.html', * controller: ChapterCntl * }); * * // configure html5 to get links working on jsfiddle * $locationProvider.html5Mode(true); * }); * * function MainCntl($scope, $route, $routeParams, $location) { * $scope.$route = $route; * $scope.$location = $location; * $scope.$routeParams = $routeParams; * } * * function BookCntl($scope, $routeParams) { * $scope.name = "BookCntl"; * $scope.params = $routeParams; * } * * function ChapterCntl($scope, $routeParams) { * $scope.name = "ChapterCntl"; * $scope.params = $routeParams; * } * </file> * * <file name="protractor.js" type="protractor"> * it('should load and compile correct template', function() { * element(by.linkText('Moby: Ch1')).click(); * var content = element(by.css('[ng-view]')).getText(); * expect(content).toMatch(/controller\: ChapterCntl/); * expect(content).toMatch(/Book Id\: Moby/); * expect(content).toMatch(/Chapter Id\: 1/); * * element(by.partialLinkText('Scarlet')).click(); * * content = element(by.css('[ng-view]')).getText(); * expect(content).toMatch(/controller\: BookCntl/); * expect(content).toMatch(/Book Id\: Scarlet/); * }); * </file> * </example> */ /** * @ngdoc event * @name $route#$routeChangeStart * @eventType broadcast on root scope * @description * Broadcasted before a route change. At this point the route services starts * resolving all of the dependencies needed for the route change to occur. * Typically this involves fetching the view template as well as any dependencies * defined in `resolve` route property. Once all of the dependencies are resolved * `$routeChangeSuccess` is fired. * * @param {Object} angularEvent Synthetic event object. * @param {Route} next Future route information. * @param {Route} current Current route information. */ /** * @ngdoc event * @name $route#$routeChangeSuccess * @eventType broadcast on root scope * @description * Broadcasted after a route dependencies are resolved. * {@link ngRoute.directive:ngView ngView} listens for the directive * to instantiate the controller and render the view. * * @param {Object} angularEvent Synthetic event object. * @param {Route} current Current route information. * @param {Route|Undefined} previous Previous route information, or undefined if current is * first route entered. */ /** * @ngdoc event * @name $route#$routeChangeError * @eventType broadcast on root scope * @description * Broadcasted if any of the resolve promises are rejected. * * @param {Object} angularEvent Synthetic event object * @param {Route} current Current route information. * @param {Route} previous Previous route information. * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise. */ /** * @ngdoc event * @name $route#$routeUpdate * @eventType broadcast on root scope * @description * * The `reloadOnSearch` property has been set to false, and we are reusing the same * instance of the Controller. */ var forceReload = false, $route = { routes: routes, /** * @ngdoc method * @name $route#reload * * @description * Causes `$route` service to reload the current route even if * {@link ng.$location $location} hasn't changed. * * As a result of that, {@link ngRoute.directive:ngView ngView} * creates new scope, reinstantiates the controller. */ reload: function() { forceReload = true; $rootScope.$evalAsync(updateRoute); } }; $rootScope.$on('$locationChangeSuccess', updateRoute); return $route; ///////////////////////////////////////////////////// /** * @param on {string} current url * @param route {Object} route regexp to match the url against * @return {?Object} * * @description * Check if the route matches the current url. * * Inspired by match in * visionmedia/express/lib/router/router.js. */ function switchRouteMatcher(on, route) { var keys = route.keys, params = {}; if (!route.regexp) return null; var m = route.regexp.exec(on); if (!m) return null; for (var i = 1, len = m.length; i < len; ++i) { var key = keys[i - 1]; var val = 'string' == typeof m[i] ? decodeURIComponent(m[i]) : m[i]; if (key && val) { params[key.name] = val; } } return params; } function updateRoute() { var next = parseRoute(), last = $route.current; if (next && last && next.$$route === last.$$route && angular.equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) { last.params = next.params; angular.copy(last.params, $routeParams); $rootScope.$broadcast('$routeUpdate', last); } else if (next || last) { forceReload = false; $rootScope.$broadcast('$routeChangeStart', next, last); $route.current = next; if (next) { if (next.redirectTo) { if (angular.isString(next.redirectTo)) { $location.path(interpolate(next.redirectTo, next.params)).search(next.params) .replace(); } else { $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) .replace(); } } } $q.when(next). then(function() { if (next) { var locals = angular.extend({}, next.resolve), template, templateUrl; angular.forEach(locals, function(value, key) { locals[key] = angular.isString(value) ? $injector.get(value) : $injector.invoke(value); }); if (angular.isDefined(template = next.template)) { if (angular.isFunction(template)) { template = template(next.params); } } else if (angular.isDefined(templateUrl = next.templateUrl)) { if (angular.isFunction(templateUrl)) { templateUrl = templateUrl(next.params); } templateUrl = $sce.getTrustedResourceUrl(templateUrl); if (angular.isDefined(templateUrl)) { next.loadedTemplateUrl = templateUrl; template = $http.get(templateUrl, {cache: $templateCache}). then(function(response) { return response.data; }); } } if (angular.isDefined(template)) { locals['$template'] = template; } return $q.all(locals); } }). // after route change then(function(locals) { if (next == $route.current) { if (next) { next.locals = locals; angular.copy(next.params, $routeParams); } $rootScope.$broadcast('$routeChangeSuccess', next, last); } }, function(error) { if (next == $route.current) { $rootScope.$broadcast('$routeChangeError', next, last, error); } }); } } /** * @returns {Object} the current active route, by matching it against the URL */ function parseRoute() { // Match a route var params, match; angular.forEach(routes, function(route, path) { if (!match && (params = switchRouteMatcher($location.path(), route))) { match = inherit(route, { params: angular.extend({}, $location.search(), params), pathParams: params}); match.$$route = route; } }); // No route matched; fallback to "otherwise" route return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); } /** * @returns {string} interpolation of the redirect path with the parameters */ function interpolate(string, params) { var result = []; angular.forEach((string||'').split(':'), function(segment, i) { if (i === 0) { result.push(segment); } else { var segmentMatch = segment.match(/(\w+)(.*)/); var key = segmentMatch[1]; result.push(params[key]); result.push(segmentMatch[2] || ''); delete params[key]; } }); return result.join(''); } }]; } ngRouteModule.provider('$routeParams', $RouteParamsProvider); /** * @ngdoc service * @name $routeParams * @requires $route * * @description * The `$routeParams` service allows you to retrieve the current set of route parameters. * * Requires the {@link ngRoute `ngRoute`} module to be installed. * * The route parameters are a combination of {@link ng.$location `$location`}'s * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}. * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched. * * In case of parameter name collision, `path` params take precedence over `search` params. * * The service guarantees that the identity of the `$routeParams` object will remain unchanged * (but its properties will likely change) even when a route change occurs. * * Note that the `$routeParams` are only updated *after* a route change completes successfully. * This means that you cannot rely on `$routeParams` being correct in route resolve functions. * Instead you can use `$route.current.params` to access the new route's parameters. * * @example * ```js * // Given: * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby * // Route: /Chapter/:chapterId/Section/:sectionId * // * // Then * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'} * ``` */ function $RouteParamsProvider() { this.$get = function() { return {}; }; } ngRouteModule.directive('ngView', ngViewFactory); ngRouteModule.directive('ngView', ngViewFillContentFactory); /** * @ngdoc directive * @name ngView * @restrict ECA * * @description * # Overview * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by * including the rendered template of the current route into the main layout (`index.html`) file. * Every time the current route changes, the included view changes with it according to the * configuration of the `$route` service. * * Requires the {@link ngRoute `ngRoute`} module to be installed. * * @animations * enter - animation is used to bring new content into the browser. * leave - animation is used to animate existing content away. * * The enter and leave animation occur concurrently. * * @scope * @priority 400 * @param {string=} onload Expression to evaluate whenever the view updates. * * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll * $anchorScroll} to scroll the viewport after the view is updated. * * - If the attribute is not set, disable scrolling. * - If the attribute is set without value, enable scrolling. * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated * as an expression yields a truthy value. * @example <example name="ngView-directive" module="ngViewExample" deps="angular-route.js;angular-animate.js" animations="true" fixBase="true"> <file name="index.html"> <div ng-controller="MainCtrl as main"> Choose: <a href="Book/Moby">Moby</a> | <a href="Book/Moby/ch/1">Moby: Ch1</a> | <a href="Book/Gatsby">Gatsby</a> | <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | <a href="Book/Scarlet">Scarlet Letter</a><br/> <div class="view-animate-container"> <div ng-view class="view-animate"></div> </div> <hr /> <pre>$location.path() = {{main.$location.path()}}</pre> <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre> <pre>$route.current.params = {{main.$route.current.params}}</pre> <pre>$route.current.scope.name = {{main.$route.current.scope.name}}</pre> <pre>$routeParams = {{main.$routeParams}}</pre> </div> </file> <file name="book.html"> <div> controller: {{book.name}}<br /> Book Id: {{book.params.bookId}}<br /> </div> </file> <file name="chapter.html"> <div> controller: {{chapter.name}}<br /> Book Id: {{chapter.params.bookId}}<br /> Chapter Id: {{chapter.params.chapterId}} </div> </file> <file name="animations.css"> .view-animate-container { position:relative; height:100px!important; position:relative; background:white; border:1px solid black; height:40px; overflow:hidden; } .view-animate { padding:10px; } .view-animate.ng-enter, .view-animate.ng-leave { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; display:block; width:100%; border-left:1px solid black; position:absolute; top:0; left:0; right:0; bottom:0; padding:10px; } .view-animate.ng-enter { left:100%; } .view-animate.ng-enter.ng-enter-active { left:0; } .view-animate.ng-leave.ng-leave-active { left:-100%; } </file> <file name="script.js"> angular.module('ngViewExample', ['ngRoute', 'ngAnimate'], function($routeProvider, $locationProvider) { $routeProvider.when('/Book/:bookId', { templateUrl: 'book.html', controller: BookCtrl, controllerAs: 'book' }); $routeProvider.when('/Book/:bookId/ch/:chapterId', { templateUrl: 'chapter.html', controller: ChapterCtrl, controllerAs: 'chapter' }); // configure html5 to get links working on jsfiddle $locationProvider.html5Mode(true); }); function MainCtrl($route, $routeParams, $location) { this.$route = $route; this.$location = $location; this.$routeParams = $routeParams; } function BookCtrl($routeParams) { this.name = "BookCtrl"; this.params = $routeParams; } function ChapterCtrl($routeParams) { this.name = "ChapterCtrl"; this.params = $routeParams; } </file> <file name="protractor.js" type="protractor"> it('should load and compile correct template', function() { element(by.linkText('Moby: Ch1')).click(); var content = element(by.css('[ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCtrl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); element(by.partialLinkText('Scarlet')).click(); content = element(by.css('[ng-view]')).getText(); expect(content).toMatch(/controller\: BookCtrl/); expect(content).toMatch(/Book Id\: Scarlet/); }); </file> </example> */ /** * @ngdoc event * @name ngView#$viewContentLoaded * @eventType emit on the current ngView scope * @description * Emitted every time the ngView content is reloaded. */ ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate']; function ngViewFactory( $route, $anchorScroll, $animate) { return { restrict: 'ECA', terminal: true, priority: 400, transclude: 'element', link: function(scope, $element, attr, ctrl, $transclude) { var currentScope, currentElement, previousElement, autoScrollExp = attr.autoscroll, onloadExp = attr.onload || ''; scope.$on('$routeChangeSuccess', update); update(); function cleanupLastView() { if(previousElement) { previousElement.remove(); previousElement = null; } if(currentScope) { currentScope.$destroy(); currentScope = null; } if(currentElement) { $animate.leave(currentElement, function() { previousElement = null; }); previousElement = currentElement; currentElement = null; } } function update() { var locals = $route.current && $route.current.locals, template = locals && locals.$template; if (angular.isDefined(template)) { var newScope = scope.$new(); var current = $route.current; // Note: This will also link all children of ng-view that were contained in the original // html. If that content contains controllers, ... they could pollute/change the scope. // However, using ng-view on an element with additional content does not make sense... // Note: We can't remove them in the cloneAttchFn of $transclude as that // function is called before linking the content, which would apply child // directives to non existing elements. var clone = $transclude(newScope, function(clone) { $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () { if (angular.isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { $anchorScroll(); } }); cleanupLastView(); }); currentElement = clone; currentScope = current.scope = newScope; currentScope.$emit('$viewContentLoaded'); currentScope.$eval(onloadExp); } else { cleanupLastView(); } } } }; } // This directive is called during the $transclude call of the first `ngView` directive. // It will replace and compile the content of the element with the loaded template. // We need this directive so that the element content is already filled when // the link function of another directive on the same element as ngView // is called. ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route']; function ngViewFillContentFactory($compile, $controller, $route) { return { restrict: 'ECA', priority: -400, link: function(scope, $element) { var current = $route.current, locals = current.locals; $element.html(locals.$template); var link = $compile($element.contents()); if (current.controller) { locals.$scope = scope; var controller = $controller(current.controller, locals); if (current.controllerAs) { scope[current.controllerAs] = controller; } $element.data('$ngControllerController', controller); $element.children().data('$ngControllerController', controller); } link(scope); } }; } })(window, window.angular);
caitp/cdnjs
ajax/libs/angular.js/1.3.0-beta.2/angular-route.js
JavaScript
mit
32,701
tinyMCE.addI18n('te.advanced_dlg',{"link_list":"Link list","link_is_external":"The URL you entered seems to external link, do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open link in a new window","link_target_same":"Open link in the same window","link_target":"Target","link_url":"Link URL","link_title":"Insert/edit link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text bottom","image_align_texttop":"Text top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal space","image_vspace":"Vertical space","image_dimensions":"Dimensions","image_alt":"Image description","image_list":"Image list","image_border":"Border","image_src":"Image URL","image_title":"Insert/edit image","charmap_title":"Select custom character","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a color","code_wordwrap":"Word wrap","code_title":"HTML Source Editor","anchor_name":"Anchor name","anchor_title":"Insert/edit anchor","about_loaded":"Loaded plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage"});
lhorie/cdnjs
ajax/libs/tinymce/3.5.8/themes/advanced/langs/te_dlg.js
JavaScript
mit
1,863