hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
277abecb20ccad89f3167fce380f6d971d22ef7b
2,095
js
JavaScript
Web Design & Development/0. Exams/Telerik 2013-2014 - JavaScript End-to-End Exam/JavaScript End-to-End - 13 Oct 2014/Academy Events/server/data/events.js
elena-andonova/telerik-academy
1dc9daf75c06694b887253d52492d0df1a5bdbe3
[ "MIT" ]
2
2019-04-14T21:04:43.000Z
2019-07-10T05:04:44.000Z
Web Design & Development/0. Exams/Telerik 2013-2014 - JavaScript End-to-End Exam/JavaScript End-to-End - 13 Oct 2014/Academy Events/server/data/events.js
elena-andonova/telerik-academy
1dc9daf75c06694b887253d52492d0df1a5bdbe3
[ "MIT" ]
null
null
null
Web Design & Development/0. Exams/Telerik 2013-2014 - JavaScript End-to-End Exam/JavaScript End-to-End - 13 Oct 2014/Academy Events/server/data/events.js
elena-andonova/telerik-academy
1dc9daf75c06694b887253d52492d0df1a5bdbe3
[ "MIT" ]
3
2015-05-11T06:50:35.000Z
2016-12-05T12:07:09.000Z
var Event = require('mongoose').model('Event'); module.exports = { create: function (event, callback) { Event.create(event, callback); }, getAllActiveEvents: function (callback) { Event.find({ eventDate: { $gte: Date.now() }}, null, { sort: { eventDate: -1 } }, function (error, events) { callback(events); }) }, getAllPassedEvents: function (callback) { Event.find({ eventDate: { $lt: Date.now() }}, null, { sort: { eventDate: -1 } }, function (error, events) { callback(events); }) }, getCategories: function () { return Event.schema.path('category').enumValues; }, getEventDetails: function (eventId, callback) { Event.findOne({ _id: eventId }, function (error, event) { callback(event); }) }, getAllEventsByUsername: function (username, callback) { Event.find({ creatorName: username }, null, { sort: { eventDate: -1 } }, function (error, events) { callback(events); }) }, getSortedJoinedEventsById: function (userId, callback) { Event.find({}, function (error, events) { var matched = []; for (var i = 0; i < events.length; i++) { for (var j = 0; j < events[i].joinedInUsers.length; j++) { if (events[i].joinedInUsers[j].userId === userId) { matched.push(events[i]); break; } } } callback(matched); }) }, getSortedPassedEventsByUsername: function (username, callback) { Event.find({ creatorName: username, eventDate: { $lt: Date.now() }}, null, { sort: { eventDate: -1 } }, function (error, events) { callback(events); }) }, getSortedActiveEventsByUsername: function (username, callback) { Event.find({ creatorName: username, eventDate: { $gte: Date.now() }}, null, { sort: { eventDate: -1 } }, function (error, events) { callback(events); }) } };
37.410714
139
0.534129
277b42d62ad30b052f22621f0f07d890c3f3be5a
766
js
JavaScript
users/models/users.model.js
privatedumbo/nodejs-onboarding
26e25301179cae54a072e6faa6ec4f4c22672d65
[ "MIT" ]
null
null
null
users/models/users.model.js
privatedumbo/nodejs-onboarding
26e25301179cae54a072e6faa6ec4f4c22672d65
[ "MIT" ]
null
null
null
users/models/users.model.js
privatedumbo/nodejs-onboarding
26e25301179cae54a072e6faa6ec4f4c22672d65
[ "MIT" ]
null
null
null
const { Sequelize, Model, DataTypes } = require('sequelize'); const sequelize = new Sequelize('sqlite::memory:'); class User extends Model {} User.init({ id: {type: DataTypes.UUID, defaultValue: Sequelize.UUIDV4, primaryKey: true}, username: DataTypes.STRING, age: DataTypes.INTEGER, }, { sequelize, modelName: 'user' }); sequelize.sync(); console.log("The table for the User model was just (re)created!"); async function createUser(userData) { const user = await User.create(userData); return user; }; async function list() { const users = await User.findAll(); return users; } async function findByID(userID) { const user = await User.findByPk(userID); return user; } module.exports = { createUser, list, findByID, };
21.885714
66
0.689295
277b912a34dd8b95623fb1224e949d39ea7504f1
5,426
js
JavaScript
src/md5.js
cyper8/seamless
eca5ae9cf23a7d2f02d50f2ad1c25a1f33959636
[ "MIT" ]
null
null
null
src/md5.js
cyper8/seamless
eca5ae9cf23a7d2f02d50f2ad1c25a1f33959636
[ "MIT" ]
5
2016-11-04T08:41:48.000Z
2017-06-23T13:44:47.000Z
src/md5.js
cyper8/seamless
eca5ae9cf23a7d2f02d50f2ad1c25a1f33959636
[ "MIT" ]
null
null
null
export function md5() { function t(e, t) { var n = (e & 65535) + (t & 65535), r = (e >> 16) + (t >> 16) + (n >> 16); return r << 16 | n & 65535; } function n(e, t) { return e << t | e >>> 32 - t; } function r(e, r, i, s, o, u) { return t(n(t(t(r, e), t(s, u)), o), i); } function i(e, t, n, i, s, o, u) { return r(t & n | ~t & i, e, t, s, o, u); } function s(e, t, n, i, s, o, u) { return r(t & i | n & ~i, e, t, s, o, u); } function o(e, t, n, i, s, o, u) { return r(t ^ n ^ i, e, t, s, o, u); } function u(e, t, n, i, s, o, u) { return r(n ^ (t | ~i), e, t, s, o, u); } function a(e, n) { e[n >> 5] |= 128 << n % 32, e[(n + 64 >>> 9 << 4) + 14] = n; var r, a, f, l, c, h = 1732584193, p = -271733879, d = -1732584194, v = 271733878; for (r = 0; r < e.length; r += 16) a = h, f = p, l = d, c = v, h = i(h, p, d, v, e[r], 7, -680876936), v = i(v, h, p, d, e[r + 1], 12, -389564586), d = i(d, v, h, p, e[r + 2], 17, 606105819), p = i(p, d, v, h, e[r + 3], 22, -1044525330), h = i(h, p, d, v, e[r + 4], 7, -176418897), v = i(v, h, p, d, e[r + 5], 12, 1200080426), d = i(d, v, h, p, e[r + 6], 17, -1473231341), p = i(p, d, v, h, e[r + 7], 22, -45705983), h = i(h, p, d, v, e[r + 8], 7, 1770035416), v = i(v, h, p, d, e[r + 9], 12, -1958414417), d = i(d, v, h, p, e[r + 10], 17, -42063), p = i(p, d, v, h, e[r + 11], 22, -1990404162), h = i(h, p, d, v, e[r + 12], 7, 1804603682), v = i(v, h, p, d, e[r + 13], 12, -40341101), d = i(d, v, h, p, e[r + 14], 17, -1502002290), p = i(p, d, v, h, e[r + 15], 22, 1236535329), h = s(h, p, d, v, e[r + 1], 5, -165796510), v = s(v, h, p, d, e[r + 6], 9, -1069501632), d = s(d, v, h, p, e[r + 11], 14, 643717713), p = s(p, d, v, h, e[r], 20, -373897302), h = s(h, p, d, v, e[r + 5], 5, -701558691), v = s(v, h, p, d, e[r + 10], 9, 38016083), d = s(d, v, h, p, e[r + 15], 14, -660478335), p = s(p, d, v, h, e[r + 4], 20, -405537848), h = s(h, p, d, v, e[r + 9], 5, 568446438), v = s(v, h, p, d, e[r + 14], 9, -1019803690), d = s(d, v, h, p, e[r + 3], 14, -187363961), p = s(p, d, v, h, e[r + 8], 20, 1163531501), h = s(h, p, d, v, e[r + 13], 5, -1444681467), v = s(v, h, p, d, e[r + 2], 9, -51403784), d = s(d, v, h, p, e[r + 7], 14, 1735328473), p = s(p, d, v, h, e[r + 12], 20, -1926607734), h = o(h, p, d, v, e[r + 5], 4, -378558), v = o(v, h, p, d, e[r + 8], 11, -2022574463), d = o(d, v, h, p, e[r + 11], 16, 1839030562), p = o(p, d, v, h, e[r + 14], 23, -35309556), h = o(h, p, d, v, e[r + 1], 4, -1530992060), v = o(v, h, p, d, e[r + 4], 11, 1272893353), d = o(d, v, h, p, e[r + 7], 16, -155497632), p = o(p, d, v, h, e[r + 10], 23, -1094730640), h = o(h, p, d, v, e[r + 13], 4, 681279174), v = o(v, h, p, d, e[r], 11, -358537222), d = o(d, v, h, p, e[r + 3], 16, -722521979), p = o(p, d, v, h, e[r + 6], 23, 76029189), h = o(h, p, d, v, e[r + 9], 4, -640364487), v = o(v, h, p, d, e[r + 12], 11, -421815835), d = o(d, v, h, p, e[r + 15], 16, 530742520), p = o(p, d, v, h, e[r + 2], 23, -995338651), h = u(h, p, d, v, e[r], 6, -198630844), v = u(v, h, p, d, e[r + 7], 10, 1126891415), d = u(d, v, h, p, e[r + 14], 15, -1416354905), p = u(p, d, v, h, e[r + 5], 21, -57434055), h = u(h, p, d, v, e[r + 12], 6, 1700485571), v = u(v, h, p, d, e[r + 3], 10, -1894986606), d = u(d, v, h, p, e[r + 10], 15, -1051523), p = u(p, d, v, h, e[r + 1], 21, -2054922799), h = u(h, p, d, v, e[r + 8], 6, 1873313359), v = u(v, h, p, d, e[r + 15], 10, -30611744), d = u(d, v, h, p, e[r + 6], 15, -1560198380), p = u(p, d, v, h, e[r + 13], 21, 1309151649), h = u(h, p, d, v, e[r + 4], 6, -145523070), v = u(v, h, p, d, e[r + 11], 10, -1120210379), d = u(d, v, h, p, e[r + 2], 15, 718787259), p = u(p, d, v, h, e[r + 9], 21, -343485551), h = t(h, a), p = t(p, f), d = t(d, l), v = t(v, c); return [h, p, d, v]; } function f(e) { var t, n = ""; for (t = 0; t < e.length * 32; t += 8) n += String.fromCharCode(e[t >> 5] >>> t % 32 & 255); return n; } function l(e) { var t, n = []; n[(e.length >> 2) - 1] = undefined; for (t = 0; t < n.length; t += 1) n[t] = 0; for (t = 0; t < e.length * 8; t += 8) n[t >> 5] |= (e.charCodeAt(t / 8) & 255) << t % 32; return n; } function c(e) { return f(a(l(e), e.length * 8)); } function h(e, t) { var n, r = l(e), i = [], s = [], o; i[15] = s[15] = undefined, r.length > 16 && (r = a(r, e.length * 8)); for (n = 0; n < 16; n += 1) i[n] = r[n] ^ 909522486, s[n] = r[n] ^ 1549556828; return o = a(i.concat(l(t)), 512 + t.length * 8), f(a(s.concat(o), 640)) } function p(e) { var t = "0123456789abcdef", n = "", r, i; for (i = 0; i < e.length; i += 1) r = e.charCodeAt(i), n += t.charAt(r >>> 4 & 15) + t.charAt(r & 15); return n; } function d(e) { return unescape(encodeURIComponent(e)); } function v(e) { return c(d(e)); } function m(e) { return p(v(e)); } function g(e, t) { return h(d(e), d(t)); } function y(e, t) { return p(g(e, t)); } return function(e, t, n) { return t ? n ? g(t, e) : y(t, e) : n ? v(e) : m(e); } }
53.722772
2,982
0.414117
277ba770631077e2a5a05dd5be84834c25f36058
140,388
js
JavaScript
2067/file/comic.js
zjn0505/xkcd-undressed
f8b6c255cc61f302b5c620367f71db57fbe052dc
[ "MIT" ]
null
null
null
2067/file/comic.js
zjn0505/xkcd-undressed
f8b6c255cc61f302b5c620367f71db57fbe052dc
[ "MIT" ]
2
2019-09-15T00:51:28.000Z
2019-11-07T13:41:21.000Z
2067/file/comic.js
zjn0505/xkcd-undressed
f8b6c255cc61f302b5c620367f71db57fbe052dc
[ "MIT" ]
null
null
null
"use strict"; function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /*! * map layout and renderer by chromako.de * shape data crunching by @seakelps * thanks to @mbostock for d3, topojson, and us-atlas. */ !function (t) { var n = {}; function e(r) { if (n[r]) return n[r].exports; var i = n[r] = { i: r, l: !1, exports: {} }; return t[r].call(i.exports, i, i.exports, e), i.l = !0, i.exports; } e.m = t, e.c = n, e.d = function (t, n, r) { e.o(t, n) || Object.defineProperty(t, n, { enumerable: !0, get: r }); }, e.r = function (t) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }); }, e.t = function (t, n) { if (1 & n && (t = e(t)), 8 & n) return t; if (4 & n && "object" == _typeof(t) && t && t.__esModule) return t; var r = Object.create(null); if (e.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: t }), 2 & n && "string" != typeof t) for (var i in t) { e.d(r, i, function (n) { return t[n]; }.bind(null, i)); } return r; }, 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, n) { return Object.prototype.hasOwnProperty.call(t, n); }, e.p = "", e(e.s = 26); }([function (t, n) { t.exports = function (t, n, e) { return n in t ? Object.defineProperty(t, n, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = e, t; }; }, function (t, n, e) { t.exports = e(9); }, function (t, n, e) { var r = e(0); t.exports = function (t) { for (var n = 1; n < arguments.length; n++) { var e = null != arguments[n] ? arguments[n] : {}, i = Object.keys(e); "function" == typeof Object.getOwnPropertySymbols && (i = i.concat(Object.getOwnPropertySymbols(e).filter(function (t) { return Object.getOwnPropertyDescriptor(e, t).enumerable; }))), i.forEach(function (n) { r(t, n, e[n]); }); } return t; }; }, function (t, n) { function e(t, n, e, r, i, o, a) { try { var u = t[o](a), s = u.value; } catch (t) { return void e(t); } u.done ? n(s) : Promise.resolve(s).then(r, i); } t.exports = function (t) { return function () { var n = this, r = arguments; return new Promise(function (i, o) { var a = t.apply(n, r); function u(t) { e(a, i, o, u, s, "next", t); } function s(t) { e(a, i, o, u, s, "throw", t); } u(void 0); }); }; }; }, function (t, n, e) { "use strict"; var r = function r() { return new i(); }; function i() { this.reset(); } i.prototype = { constructor: i, reset: function reset() { this.s = this.t = 0; }, add: function add(t) { a(o, t, this.t), a(this, o.s, this.s), this.s ? this.t += o.t : this.s = o.t; }, valueOf: function valueOf() { return this.s; } }; var o = new i(); function a(t, n, e) { var r = t.s = n + e, i = r - n, o = r - i; t.t = n - o + (e - i); } var u = 1e-6, s = Math.PI, c = s / 2, h = s / 4, l = 2 * s, f = s / 180, p = Math.abs, d = Math.atan, v = Math.atan2, y = Math.cos, g = (Math.ceil, Math.exp), m = (Math.floor, Math.log), _ = (Math.pow, Math.sin), w = (Math.sign, Math.sqrt), x = Math.tan; function b(t) { return t > 1 ? 0 : t < -1 ? s : Math.acos(t); } function E(t) { return t > 1 ? c : t < -1 ? -c : Math.asin(t); } function M() {} function k(t, n) { t && N.hasOwnProperty(t.type) && N[t.type](t, n); } var S = { Feature: function Feature(t, n) { k(t.geometry, n); }, FeatureCollection: function FeatureCollection(t, n) { for (var e = t.features, r = -1, i = e.length; ++r < i;) { k(e[r].geometry, n); } } }, N = { Sphere: function Sphere(t, n) { n.sphere(); }, Point: function Point(t, n) { t = t.coordinates, n.point(t[0], t[1], t[2]); }, MultiPoint: function MultiPoint(t, n) { for (var e = t.coordinates, r = -1, i = e.length; ++r < i;) { t = e[r], n.point(t[0], t[1], t[2]); } }, LineString: function LineString(t, n) { A(t.coordinates, n, 0); }, MultiLineString: function MultiLineString(t, n) { for (var e = t.coordinates, r = -1, i = e.length; ++r < i;) { A(e[r], n, 0); } }, Polygon: function Polygon(t, n) { P(t.coordinates, n); }, MultiPolygon: function MultiPolygon(t, n) { for (var e = t.coordinates, r = -1, i = e.length; ++r < i;) { P(e[r], n); } }, GeometryCollection: function GeometryCollection(t, n) { for (var e = t.geometries, r = -1, i = e.length; ++r < i;) { k(e[r], n); } } }; function A(t, n, e) { var r, i = -1, o = t.length - e; for (n.lineStart(); ++i < o;) { r = t[i], n.point(r[0], r[1], r[2]); } n.lineEnd(); } function P(t, n) { var e = -1, r = t.length; for (n.polygonStart(); ++e < r;) { A(t[e], n, 1); } n.polygonEnd(); } var z = function z(t, n) { t && S.hasOwnProperty(t.type) ? S[t.type](t, n) : k(t, n); }; r(), r(); function T(t) { var n = t[0], e = t[1], r = y(e); return [r * y(n), r * _(n), _(e)]; } function L(t, n) { return [t[1] * n[2] - t[2] * n[1], t[2] * n[0] - t[0] * n[2], t[0] * n[1] - t[1] * n[0]]; } function I(t) { var n = w(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]); t[0] /= n, t[1] /= n, t[2] /= n; } r(); function j(t, n) { return [t > s ? t - l : t < -s ? t + l : t, n]; } j.invert = j; var O = function O() { var t, n = []; return { point: function point(n, e) { t.push([n, e]); }, lineStart: function lineStart() { n.push(t = []); }, lineEnd: M, rejoin: function rejoin() { n.length > 1 && n.push(n.pop().concat(n.shift())); }, result: function result() { var e = n; return n = [], t = null, e; } }; }, C = function C(t, n) { return p(t[0] - n[0]) < u && p(t[1] - n[1]) < u; }; function R(t, n, e, r) { this.x = t, this.z = n, this.o = e, this.e = r, this.v = !1, this.n = this.p = null; } var X = function X(t, n, e, r, i) { var o, a, u = [], s = []; if (t.forEach(function (t) { if (!((n = t.length - 1) <= 0)) { var n, e, r = t[0], a = t[n]; if (C(r, a)) { for (i.lineStart(), o = 0; o < n; ++o) { i.point((r = t[o])[0], r[1]); } i.lineEnd(); } else u.push(e = new R(r, t, null, !0)), s.push(e.o = new R(r, null, e, !1)), u.push(e = new R(a, t, null, !1)), s.push(e.o = new R(a, null, e, !0)); } }), u.length) { for (s.sort(n), Y(u), Y(s), o = 0, a = s.length; o < a; ++o) { s[o].e = e = !e; } for (var c, h, l = u[0];;) { for (var f = l, p = !0; f.v;) { if ((f = f.n) === l) return; } c = f.z, i.lineStart(); do { if (f.v = f.o.v = !0, f.e) { if (p) for (o = 0, a = c.length; o < a; ++o) { i.point((h = c[o])[0], h[1]); } else r(f.x, f.n.x, 1, i); f = f.n; } else { if (p) for (c = f.p.z, o = c.length - 1; o >= 0; --o) { i.point((h = c[o])[0], h[1]); } else r(f.x, f.p.x, -1, i); f = f.p; } c = (f = f.o).z, p = !p; } while (!f.v); i.lineEnd(); } } }; function Y(t) { if (n = t.length) { for (var n, e, r = 0, i = t[0]; ++r < n;) { i.n = e = t[r], e.p = i, i = e; } i.n = e = t[0], e.p = i; } } var q = r(), U = function U(t, n) { var e = n[0], r = n[1], i = _(r), o = [_(e), -y(e), 0], a = 0, f = 0; q.reset(), 1 === i ? r = c + u : -1 === i && (r = -c - u); for (var p = 0, d = t.length; p < d; ++p) { if (m = (g = t[p]).length) for (var g, m, w = g[m - 1], x = w[0], b = w[1] / 2 + h, M = _(b), k = y(b), S = 0; S < m; ++S, x = A, M = z, k = j, w = N) { var N = g[S], A = N[0], P = N[1] / 2 + h, z = _(P), j = y(P), O = A - x, C = O >= 0 ? 1 : -1, R = C * O, X = R > s, Y = M * z; if (q.add(v(Y * C * _(R), k * j + Y * y(R))), a += X ? O + C * l : O, X ^ x >= e ^ A >= e) { var U = L(T(w), T(N)); I(U); var B = L(o, U); I(B); var F = (X ^ O >= 0 ? -1 : 1) * E(B[2]); (r > F || r === F && (U[0] || U[1])) && (f += X ^ O >= 0 ? 1 : -1); } } } return (a < -u || a < u && q < -u) ^ 1 & f; }, B = function B(t, n) { return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; }; var F = function (t) { return 1 === t.length && (t = function (t) { return function (n, e) { return B(t(n), e); }; }(t)), { left: function left(n, e, r, i) { for (null == r && (r = 0), null == i && (i = n.length); r < i;) { var o = r + i >>> 1; t(n[o], e) < 0 ? r = o + 1 : i = o; } return r; }, right: function right(n, e, r, i) { for (null == r && (r = 0), null == i && (i = n.length); r < i;) { var o = r + i >>> 1; t(n[o], e) > 0 ? i = o : r = o + 1; } return r; } }; }(B); F.right, F.left; var G = Array.prototype; G.slice, G.map, Math.sqrt(50), Math.sqrt(10), Math.sqrt(2); var D = function D(t) { for (var n, e, r, i = t.length, o = -1, a = 0; ++o < i;) { a += t[o].length; } for (e = new Array(a); --i >= 0;) { for (n = (r = t[i]).length; --n >= 0;) { e[--a] = r[n]; } } return e; }; var V = function V(t, n, e, r) { return function (i) { var o, a, u, s = n(i), c = O(), h = n(c), l = !1, f = { point: p, lineStart: v, lineEnd: y, polygonStart: function polygonStart() { f.point = g, f.lineStart = m, f.lineEnd = _, a = [], o = []; }, polygonEnd: function polygonEnd() { f.point = p, f.lineStart = v, f.lineEnd = y, a = D(a); var t = U(o, r); a.length ? (l || (i.polygonStart(), l = !0), X(a, H, t, e, i)) : t && (l || (i.polygonStart(), l = !0), i.lineStart(), e(null, null, 1, i), i.lineEnd()), l && (i.polygonEnd(), l = !1), a = o = null; }, sphere: function sphere() { i.polygonStart(), i.lineStart(), e(null, null, 1, i), i.lineEnd(), i.polygonEnd(); } }; function p(n, e) { t(n, e) && i.point(n, e); } function d(t, n) { s.point(t, n); } function v() { f.point = d, s.lineStart(); } function y() { f.point = p, s.lineEnd(); } function g(t, n) { u.push([t, n]), h.point(t, n); } function m() { h.lineStart(), u = []; } function _() { g(u[0][0], u[0][1]), h.lineEnd(); var t, n, e, r, s = h.clean(), f = c.result(), p = f.length; if (u.pop(), o.push(u), u = null, p) if (1 & s) { if ((n = (e = f[0]).length - 1) > 0) { for (l || (i.polygonStart(), l = !0), i.lineStart(), t = 0; t < n; ++t) { i.point((r = e[t])[0], r[1]); } i.lineEnd(); } } else p > 1 && 2 & s && f.push(f.pop().concat(f.shift())), a.push(f.filter($)); } return f; }; }; function $(t) { return t.length > 1; } function H(t, n) { return ((t = t.x)[0] < 0 ? t[1] - c - u : c - t[1]) - ((n = n.x)[0] < 0 ? n[1] - c - u : c - n[1]); } V(function () { return !0; }, function (t) { var n, e = NaN, r = NaN, i = NaN; return { lineStart: function lineStart() { t.lineStart(), n = 1; }, point: function point(o, a) { var h = o > 0 ? s : -s, l = p(o - e); p(l - s) < u ? (t.point(e, r = (r + a) / 2 > 0 ? c : -c), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(h, r), t.point(o, r), n = 0) : i !== h && l >= s && (p(e - i) < u && (e -= i * u), p(o - h) < u && (o -= h * u), r = function (t, n, e, r) { var i, o, a = _(t - e); return p(a) > u ? d((_(n) * (o = y(r)) * _(e) - _(r) * (i = y(n)) * _(t)) / (i * o * a)) : (n + r) / 2; }(e, r, o, a), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(h, r), n = 0), t.point(e = o, r = a), i = h; }, lineEnd: function lineEnd() { t.lineEnd(), e = r = NaN; }, clean: function clean() { return 2 - n; } }; }, function (t, n, e, r) { var i; if (null == t) i = e * c, r.point(-s, i), r.point(0, i), r.point(s, i), r.point(s, 0), r.point(s, -i), r.point(0, -i), r.point(-s, -i), r.point(-s, 0), r.point(-s, i);else if (p(t[0] - n[0]) > u) { var o = t[0] < n[0] ? s : -s; i = e * o / 2, r.point(-o, i), r.point(0, i), r.point(o, i); } else r.point(n[0], n[1]); }, [-s, -c]); r(); var Z, W, J, K, Q = function Q(t) { return t; }, tt = r(), nt = r(), et = { point: M, lineStart: M, lineEnd: M, polygonStart: function polygonStart() { et.lineStart = rt, et.lineEnd = at; }, polygonEnd: function polygonEnd() { et.lineStart = et.lineEnd = et.point = M, tt.add(p(nt)), nt.reset(); }, result: function result() { var t = tt / 2; return tt.reset(), t; } }; function rt() { et.point = it; } function it(t, n) { et.point = ot, Z = J = t, W = K = n; } function ot(t, n) { nt.add(K * t - J * n), J = t, K = n; } function at() { ot(Z, W); } var ut = et, st = 1 / 0, ct = st, ht = -st, lt = ht; var ft, pt, dt, vt, yt = { point: function point(t, n) { t < st && (st = t); t > ht && (ht = t); n < ct && (ct = n); n > lt && (lt = n); }, lineStart: M, lineEnd: M, polygonStart: M, polygonEnd: M, result: function result() { var t = [[st, ct], [ht, lt]]; return ht = lt = -(ct = st = 1 / 0), t; } }, gt = 0, mt = 0, _t = 0, wt = 0, xt = 0, bt = 0, Et = 0, Mt = 0, kt = 0, St = { point: Nt, lineStart: At, lineEnd: Tt, polygonStart: function polygonStart() { St.lineStart = Lt, St.lineEnd = It; }, polygonEnd: function polygonEnd() { St.point = Nt, St.lineStart = At, St.lineEnd = Tt; }, result: function result() { var t = kt ? [Et / kt, Mt / kt] : bt ? [wt / bt, xt / bt] : _t ? [gt / _t, mt / _t] : [NaN, NaN]; return gt = mt = _t = wt = xt = bt = Et = Mt = kt = 0, t; } }; function Nt(t, n) { gt += t, mt += n, ++_t; } function At() { St.point = Pt; } function Pt(t, n) { St.point = zt, Nt(dt = t, vt = n); } function zt(t, n) { var e = t - dt, r = n - vt, i = w(e * e + r * r); wt += i * (dt + t) / 2, xt += i * (vt + n) / 2, bt += i, Nt(dt = t, vt = n); } function Tt() { St.point = Nt; } function Lt() { St.point = jt; } function It() { Ot(ft, pt); } function jt(t, n) { St.point = Ot, Nt(ft = dt = t, pt = vt = n); } function Ot(t, n) { var e = t - dt, r = n - vt, i = w(e * e + r * r); wt += i * (dt + t) / 2, xt += i * (vt + n) / 2, bt += i, Et += (i = vt * t - dt * n) * (dt + t), Mt += i * (vt + n), kt += 3 * i, Nt(dt = t, vt = n); } var Ct = St; function Rt(t) { this._context = t; } Rt.prototype = { _radius: 4.5, pointRadius: function pointRadius(t) { return this._radius = t, this; }, polygonStart: function polygonStart() { this._line = 0; }, polygonEnd: function polygonEnd() { this._line = NaN; }, lineStart: function lineStart() { this._point = 0; }, lineEnd: function lineEnd() { 0 === this._line && this._context.closePath(), this._point = NaN; }, point: function point(t, n) { switch (this._point) { case 0: this._context.moveTo(t, n), this._point = 1; break; case 1: this._context.lineTo(t, n); break; default: this._context.moveTo(t + this._radius, n), this._context.arc(t, n, this._radius, 0, l); } }, result: M }; var Xt, Yt, qt, Ut, Bt, Ft = r(), Gt = { point: M, lineStart: function lineStart() { Gt.point = Dt; }, lineEnd: function lineEnd() { Xt && Vt(Yt, qt), Gt.point = M; }, polygonStart: function polygonStart() { Xt = !0; }, polygonEnd: function polygonEnd() { Xt = null; }, result: function result() { var t = +Ft; return Ft.reset(), t; } }; function Dt(t, n) { Gt.point = Vt, Yt = Ut = t, qt = Bt = n; } function Vt(t, n) { Ut -= t, Bt -= n, Ft.add(w(Ut * Ut + Bt * Bt)), Ut = t, Bt = n; } var $t = Gt; function Ht() { this._string = []; } function Zt(t) { return "m0," + t + "a" + t + "," + t + " 0 1,1 0," + -2 * t + "a" + t + "," + t + " 0 1,1 0," + 2 * t + "z"; } Ht.prototype = { _radius: 4.5, _circle: Zt(4.5), pointRadius: function pointRadius(t) { return (t = +t) !== this._radius && (this._radius = t, this._circle = null), this; }, polygonStart: function polygonStart() { this._line = 0; }, polygonEnd: function polygonEnd() { this._line = NaN; }, lineStart: function lineStart() { this._point = 0; }, lineEnd: function lineEnd() { 0 === this._line && this._string.push("Z"), this._point = NaN; }, point: function point(t, n) { switch (this._point) { case 0: this._string.push("M", t, ",", n), this._point = 1; break; case 1: this._string.push("L", t, ",", n); break; default: null == this._circle && (this._circle = Zt(this._radius)), this._string.push("M", t, ",", n, this._circle); } }, result: function result() { if (this._string.length) { var t = this._string.join(""); return this._string = [], t; } return null; } }; var Wt = function Wt(t, n) { var e, r, i = 4.5; function o(t) { return t && ("function" == typeof i && r.pointRadius(+i.apply(this, arguments)), z(t, e(r))), r.result(); } return o.area = function (t) { return z(t, e(ut)), ut.result(); }, o.measure = function (t) { return z(t, e($t)), $t.result(); }, o.bounds = function (t) { return z(t, e(yt)), yt.result(); }, o.centroid = function (t) { return z(t, e(Ct)), Ct.result(); }, o.projection = function (n) { return arguments.length ? (e = null == n ? (t = null, Q) : (t = n).stream, o) : t; }, o.context = function (t) { return arguments.length ? (r = null == t ? (n = null, new Ht()) : new Rt(n = t), "function" != typeof i && r.pointRadius(i), o) : n; }, o.pointRadius = function (t) { return arguments.length ? (i = "function" == typeof t ? t : (r.pointRadius(+t), +t), o) : i; }, o.projection(t).context(n); }; function Jt(t) { return function (n) { var e = new Kt(); for (var r in t) { e[r] = t[r]; } return e.stream = n, e; }; } function Kt() {} Kt.prototype = { constructor: Kt, point: function point(t, n) { this.stream.point(t, n); }, sphere: function sphere() { this.stream.sphere(); }, lineStart: function lineStart() { this.stream.lineStart(); }, lineEnd: function lineEnd() { this.stream.lineEnd(); }, polygonStart: function polygonStart() { this.stream.polygonStart(); }, polygonEnd: function polygonEnd() { this.stream.polygonEnd(); } }; y(30 * f); Jt({ point: function point(t, n) { this.stream.point(t * f, n * f); } }); function Qt(t) { return function (n, e) { var r = y(n), i = y(e), o = t(r * i); return [o * i * _(n), o * _(e)]; }; } function tn(t) { return function (n, e) { var r = w(n * n + e * e), i = t(r), o = _(i), a = y(i); return [v(n * o, r * a), E(r && e * o / r)]; }; } var nn = Qt(function (t) { return w(2 / (1 + t)); }); nn.invert = tn(function (t) { return 2 * E(t / 2); }); var en = Qt(function (t) { return (t = b(t)) && t / _(t); }); en.invert = tn(function (t) { return t; }); function rn(t, n) { return [t, m(x((c + n) / 2))]; } rn.invert = function (t, n) { return [t, 2 * d(g(n)) - c]; }; function on(t, n) { return [t, n]; } on.invert = on; var an = 1.340264, un = -.081106, sn = 893e-6, cn = .003796, hn = w(3) / 2; function ln(t, n) { var e = E(hn * _(n)), r = e * e, i = r * r * r; return [t * y(e) / (hn * (an + 3 * un * r + i * (7 * sn + 9 * cn * r))), e * (an + un * r + i * (sn + cn * r))]; } ln.invert = function (t, n) { for (var e, r = n, i = r * r, o = i * i * i, a = 0; a < 12 && (o = (i = (r -= e = (r * (an + un * i + o * (sn + cn * i)) - n) / (an + 3 * un * i + o * (7 * sn + 9 * cn * i))) * r) * i * i, !(p(e) < 1e-12)); ++a) { ; } return [hn * t * (an + 3 * un * i + o * (7 * sn + 9 * cn * i)) / y(r), E(_(r) / hn)]; }; function fn(t, n) { var e = y(n), r = y(t) * e; return [e * _(t) / r, _(n) / r]; } fn.invert = tn(d); function pn(t, n) { var e = n * n, r = e * e; return [t * (.8707 - .131979 * e + r * (r * (.003971 * e - .001529 * r) - .013791)), n * (1.007226 + e * (.015085 + r * (.028874 * e - .044475 - .005916 * r)))]; } pn.invert = function (t, n) { var e, r = n, i = 25; do { var o = r * r, a = o * o; r -= e = (r * (1.007226 + o * (.015085 + a * (.028874 * o - .044475 - .005916 * a))) - n) / (1.007226 + o * (.045255 + a * (.259866 * o - .311325 - .005916 * 11 * a))); } while (p(e) > u && --i > 0); return [t / (.8707 + (o = r * r) * (o * (o * o * o * (.003971 - .001529 * o) - .013791) - .131979)), r]; }; function dn(t, n) { return [y(n) * _(t), _(n)]; } dn.invert = tn(E); function vn(t, n) { var e = y(n), r = 1 + y(t) * e; return [e * _(t) / r, _(n) / r]; } vn.invert = tn(function (t) { return 2 * d(t); }); function yn(t, n) { return [m(x((c + n) / 2)), -t]; } yn.invert = function (t, n) { return [-n, 2 * d(g(t)) - c]; }; e.d(n, "a", function () { return Wt; }); }, function (t, n) { t.exports = function (t, n) { if (!_instanceof(t, n)) throw new TypeError("Cannot call a class as a function"); }; }, function (t, n) { function e(t, n) { for (var e = 0; e < n.length; e++) { var r = n[e]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r); } } t.exports = function (t, n, r) { return n && e(t.prototype, n), r && e(t, r), t; }; }, function (t, n, e) { "use strict"; n.a = { baseURL: "", title: "Use your mouse or fingers to pan + zoom.\nTo edit the map, submit your ballot on November 6th.", maxZoom: 1e3 }; }, function (t, n, e) { "use strict"; var r = e(5), i = e.n(r), o = e(6), a = e.n(o), u = e(0), s = e.n(u), c = "http://www.w3.org/1999/xhtml", h = { svg: "http://www.w3.org/2000/svg", xhtml: c, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }, l = function l(t) { var n = t += "", e = n.indexOf(":"); return e >= 0 && "xmlns" !== (n = t.slice(0, e)) && (t = t.slice(e + 1)), h.hasOwnProperty(n) ? { space: h[n], local: t } : t; }; var f = function f(t) { var n = l(t); return (n.local ? function (t) { return function () { return this.ownerDocument.createElementNS(t.space, t.local); }; } : function (t) { return function () { var n = this.ownerDocument, e = this.namespaceURI; return e === c && n.documentElement.namespaceURI === c ? n.createElement(t) : n.createElementNS(e, t); }; })(n); }; function p() {} var d = function d(t) { return null == t ? p : function () { return this.querySelector(t); }; }; function v() { return []; } var y = function y(t) { return null == t ? v : function () { return this.querySelectorAll(t); }; }, g = function g(t) { return function () { return this.matches(t); }; }; if ("undefined" != typeof document) { var m = document.documentElement; if (!m.matches) { var _ = m.webkitMatchesSelector || m.msMatchesSelector || m.mozMatchesSelector || m.oMatchesSelector; g = function g(t) { return function () { return _.call(this, t); }; }; } } var w = g, x = function x(t) { return new Array(t.length); }; function b(t, n) { this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = n; } b.prototype = { constructor: b, appendChild: function appendChild(t) { return this._parent.insertBefore(t, this._next); }, insertBefore: function insertBefore(t, n) { return this._parent.insertBefore(t, n); }, querySelector: function querySelector(t) { return this._parent.querySelector(t); }, querySelectorAll: function querySelectorAll(t) { return this._parent.querySelectorAll(t); } }; var E = "$"; function M(t, n, e, r, i, o) { for (var a, u = 0, s = n.length, c = o.length; u < c; ++u) { (a = n[u]) ? (a.__data__ = o[u], r[u] = a) : e[u] = new b(t, o[u]); } for (; u < s; ++u) { (a = n[u]) && (i[u] = a); } } function k(t, n, e, r, i, o, a) { var u, s, c, h = {}, l = n.length, f = o.length, p = new Array(l); for (u = 0; u < l; ++u) { (s = n[u]) && (p[u] = c = E + a.call(s, s.__data__, u, n), c in h ? i[u] = s : h[c] = s); } for (u = 0; u < f; ++u) { (s = h[c = E + a.call(t, o[u], u, o)]) ? (r[u] = s, s.__data__ = o[u], h[c] = null) : e[u] = new b(t, o[u]); } for (u = 0; u < l; ++u) { (s = n[u]) && h[p[u]] === s && (i[u] = s); } } function S(t, n) { return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; } var N = function N(t) { return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView; }; function A(t, n) { return t.style.getPropertyValue(n) || N(t).getComputedStyle(t, null).getPropertyValue(n); } function P(t) { return t.trim().split(/^|\s+/); } function z(t) { return t.classList || new T(t); } function T(t) { this._node = t, this._names = P(t.getAttribute("class") || ""); } function L(t, n) { for (var e = z(t), r = -1, i = n.length; ++r < i;) { e.add(n[r]); } } function I(t, n) { for (var e = z(t), r = -1, i = n.length; ++r < i;) { e.remove(n[r]); } } T.prototype = { add: function add(t) { this._names.indexOf(t) < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" "))); }, remove: function remove(t) { var n = this._names.indexOf(t); n >= 0 && (this._names.splice(n, 1), this._node.setAttribute("class", this._names.join(" "))); }, contains: function contains(t) { return this._names.indexOf(t) >= 0; } }; function j() { this.textContent = ""; } function O() { this.innerHTML = ""; } function C() { this.nextSibling && this.parentNode.appendChild(this); } function R() { this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild); } function X() { return null; } function Y() { var t = this.parentNode; t && t.removeChild(this); } function q() { return this.parentNode.insertBefore(this.cloneNode(!1), this.nextSibling); } function U() { return this.parentNode.insertBefore(this.cloneNode(!0), this.nextSibling); } var B = {}, F = null; "undefined" != typeof document && ("onmouseenter" in document.documentElement || (B = { mouseenter: "mouseover", mouseleave: "mouseout" })); function G(t, n, e) { return t = D(t, n, e), function (n) { var e = n.relatedTarget; e && (e === this || 8 & e.compareDocumentPosition(this)) || t.call(this, n); }; } function D(t, n, e) { return function (r) { var i = F; F = r; try { t.call(this, this.__data__, n, e); } finally { F = i; } }; } function V(t) { return function () { var n = this.__on; if (n) { for (var e, r = 0, i = -1, o = n.length; r < o; ++r) { e = n[r], t.type && e.type !== t.type || e.name !== t.name ? n[++i] = e : this.removeEventListener(e.type, e.listener, e.capture); } ++i ? n.length = i : delete this.__on; } }; } function $(t, n, e) { var r = B.hasOwnProperty(t.type) ? G : D; return function (i, o, a) { var u, s = this.__on, c = r(n, o, a); if (s) for (var h = 0, l = s.length; h < l; ++h) { if ((u = s[h]).type === t.type && u.name === t.name) return this.removeEventListener(u.type, u.listener, u.capture), this.addEventListener(u.type, u.listener = c, u.capture = e), void (u.value = n); } this.addEventListener(t.type, c, e), u = { type: t.type, name: t.name, value: n, listener: c, capture: e }, s ? s.push(u) : this.__on = [u]; }; } function H(t, n, e, r) { var i = F; t.sourceEvent = F, F = t; try { return n.apply(e, r); } finally { F = i; } } function Z(t, n, e) { var r = N(t), i = r.CustomEvent; "function" == typeof i ? i = new i(n, e) : (i = r.document.createEvent("Event"), e ? (i.initEvent(n, e.bubbles, e.cancelable), i.detail = e.detail) : i.initEvent(n, !1, !1)), t.dispatchEvent(i); } var W = [null]; function J(t, n) { this._groups = t, this._parents = n; } function K() { return new J([[document.documentElement]], W); } J.prototype = K.prototype = { constructor: J, select: function select(t) { "function" != typeof t && (t = d(t)); for (var n = this._groups, e = n.length, r = new Array(e), i = 0; i < e; ++i) { for (var o, a, u = n[i], s = u.length, c = r[i] = new Array(s), h = 0; h < s; ++h) { (o = u[h]) && (a = t.call(o, o.__data__, h, u)) && ("__data__" in o && (a.__data__ = o.__data__), c[h] = a); } } return new J(r, this._parents); }, selectAll: function selectAll(t) { "function" != typeof t && (t = y(t)); for (var n = this._groups, e = n.length, r = [], i = [], o = 0; o < e; ++o) { for (var a, u = n[o], s = u.length, c = 0; c < s; ++c) { (a = u[c]) && (r.push(t.call(a, a.__data__, c, u)), i.push(a)); } } return new J(r, i); }, filter: function filter(t) { "function" != typeof t && (t = w(t)); for (var n = this._groups, e = n.length, r = new Array(e), i = 0; i < e; ++i) { for (var o, a = n[i], u = a.length, s = r[i] = [], c = 0; c < u; ++c) { (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o); } } return new J(r, this._parents); }, data: function data(t, n) { if (!t) return p = new Array(this.size()), c = -1, this.each(function (t) { p[++c] = t; }), p; var e = n ? k : M, r = this._parents, i = this._groups; "function" != typeof t && (t = function (t) { return function () { return t; }; }(t)); for (var o = i.length, a = new Array(o), u = new Array(o), s = new Array(o), c = 0; c < o; ++c) { var h = r[c], l = i[c], f = l.length, p = t.call(h, h && h.__data__, c, r), d = p.length, v = u[c] = new Array(d), y = a[c] = new Array(d); e(h, l, v, y, s[c] = new Array(f), p, n); for (var g, m, _ = 0, w = 0; _ < d; ++_) { if (g = v[_]) { for (_ >= w && (w = _ + 1); !(m = y[w]) && ++w < d;) { ; } g._next = m || null; } } } return (a = new J(a, r))._enter = u, a._exit = s, a; }, enter: function enter() { return new J(this._enter || this._groups.map(x), this._parents); }, exit: function exit() { return new J(this._exit || this._groups.map(x), this._parents); }, merge: function merge(t) { for (var n = this._groups, e = t._groups, r = n.length, i = e.length, o = Math.min(r, i), a = new Array(r), u = 0; u < o; ++u) { for (var s, c = n[u], h = e[u], l = c.length, f = a[u] = new Array(l), p = 0; p < l; ++p) { (s = c[p] || h[p]) && (f[p] = s); } } for (; u < r; ++u) { a[u] = n[u]; } return new J(a, this._parents); }, order: function order() { for (var t = this._groups, n = -1, e = t.length; ++n < e;) { for (var r, i = t[n], o = i.length - 1, a = i[o]; --o >= 0;) { (r = i[o]) && (a && a !== r.nextSibling && a.parentNode.insertBefore(r, a), a = r); } } return this; }, sort: function sort(t) { function n(n, e) { return n && e ? t(n.__data__, e.__data__) : !n - !e; } t || (t = S); for (var e = this._groups, r = e.length, i = new Array(r), o = 0; o < r; ++o) { for (var a, u = e[o], s = u.length, c = i[o] = new Array(s), h = 0; h < s; ++h) { (a = u[h]) && (c[h] = a); } c.sort(n); } return new J(i, this._parents).order(); }, call: function call() { var t = arguments[0]; return arguments[0] = this, t.apply(null, arguments), this; }, nodes: function nodes() { var t = new Array(this.size()), n = -1; return this.each(function () { t[++n] = this; }), t; }, node: function node() { for (var t = this._groups, n = 0, e = t.length; n < e; ++n) { for (var r = t[n], i = 0, o = r.length; i < o; ++i) { var a = r[i]; if (a) return a; } } return null; }, size: function size() { var t = 0; return this.each(function () { ++t; }), t; }, empty: function empty() { return !this.node(); }, each: function each(t) { for (var n = this._groups, e = 0, r = n.length; e < r; ++e) { for (var i, o = n[e], a = 0, u = o.length; a < u; ++a) { (i = o[a]) && t.call(i, i.__data__, a, o); } } return this; }, attr: function attr(t, n) { var e = l(t); if (arguments.length < 2) { var r = this.node(); return e.local ? r.getAttributeNS(e.space, e.local) : r.getAttribute(e); } return this.each((null == n ? e.local ? function (t) { return function () { this.removeAttributeNS(t.space, t.local); }; } : function (t) { return function () { this.removeAttribute(t); }; } : "function" == typeof n ? e.local ? function (t, n) { return function () { var e = n.apply(this, arguments); null == e ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, e); }; } : function (t, n) { return function () { var e = n.apply(this, arguments); null == e ? this.removeAttribute(t) : this.setAttribute(t, e); }; } : e.local ? function (t, n) { return function () { this.setAttributeNS(t.space, t.local, n); }; } : function (t, n) { return function () { this.setAttribute(t, n); }; })(e, n)); }, style: function style(t, n, e) { return arguments.length > 1 ? this.each((null == n ? function (t) { return function () { this.style.removeProperty(t); }; } : "function" == typeof n ? function (t, n, e) { return function () { var r = n.apply(this, arguments); null == r ? this.style.removeProperty(t) : this.style.setProperty(t, r, e); }; } : function (t, n, e) { return function () { this.style.setProperty(t, n, e); }; })(t, n, null == e ? "" : e)) : A(this.node(), t); }, property: function property(t, n) { return arguments.length > 1 ? this.each((null == n ? function (t) { return function () { delete this[t]; }; } : "function" == typeof n ? function (t, n) { return function () { var e = n.apply(this, arguments); null == e ? delete this[t] : this[t] = e; }; } : function (t, n) { return function () { this[t] = n; }; })(t, n)) : this.node()[t]; }, classed: function classed(t, n) { var e = P(t + ""); if (arguments.length < 2) { for (var r = z(this.node()), i = -1, o = e.length; ++i < o;) { if (!r.contains(e[i])) return !1; } return !0; } return this.each(("function" == typeof n ? function (t, n) { return function () { (n.apply(this, arguments) ? L : I)(this, t); }; } : n ? function (t) { return function () { L(this, t); }; } : function (t) { return function () { I(this, t); }; })(e, n)); }, text: function text(t) { return arguments.length ? this.each(null == t ? j : ("function" == typeof t ? function (t) { return function () { var n = t.apply(this, arguments); this.textContent = null == n ? "" : n; }; } : function (t) { return function () { this.textContent = t; }; })(t)) : this.node().textContent; }, html: function html(t) { return arguments.length ? this.each(null == t ? O : ("function" == typeof t ? function (t) { return function () { var n = t.apply(this, arguments); this.innerHTML = null == n ? "" : n; }; } : function (t) { return function () { this.innerHTML = t; }; })(t)) : this.node().innerHTML; }, raise: function raise() { return this.each(C); }, lower: function lower() { return this.each(R); }, append: function append(t) { var n = "function" == typeof t ? t : f(t); return this.select(function () { return this.appendChild(n.apply(this, arguments)); }); }, insert: function insert(t, n) { var e = "function" == typeof t ? t : f(t), r = null == n ? X : "function" == typeof n ? n : d(n); return this.select(function () { return this.insertBefore(e.apply(this, arguments), r.apply(this, arguments) || null); }); }, remove: function remove() { return this.each(Y); }, clone: function clone(t) { return this.select(t ? U : q); }, datum: function datum(t) { return arguments.length ? this.property("__data__", t) : this.node().__data__; }, on: function on(t, n, e) { var r, i, o = function (t) { return t.trim().split(/^|\s+/).map(function (t) { var n = "", e = t.indexOf("."); return e >= 0 && (n = t.slice(e + 1), t = t.slice(0, e)), { type: t, name: n }; }); }(t + ""), a = o.length; if (!(arguments.length < 2)) { for (u = n ? $ : V, null == e && (e = !1), r = 0; r < a; ++r) { this.each(u(o[r], n, e)); } return this; } var u = this.node().__on; if (u) for (var s, c = 0, h = u.length; c < h; ++c) { for (r = 0, s = u[c]; r < a; ++r) { if ((i = o[r]).type === s.type && i.name === s.name) return s.value; } } }, dispatch: function dispatch(t, n) { return this.each(("function" == typeof n ? function (t, n) { return function () { return Z(this, t, n.apply(this, arguments)); }; } : function (t, n) { return function () { return Z(this, t, n); }; })(t, n)); } }; var Q = K, tt = function tt(t) { return "string" == typeof t ? new J([[document.querySelector(t)]], [document.documentElement]) : new J([[t]], W); }, nt = 0; function et() { this._ = "@" + (++nt).toString(36); } et.prototype = function () { return new et(); }.prototype = { constructor: et, get: function get(t) { for (var n = this._; !(n in t);) { if (!(t = t.parentNode)) return; } return t[n]; }, set: function set(t, n) { return t[this._] = n; }, remove: function remove(t) { return this._ in t && delete t[this._]; }, toString: function toString() { return this._; } }; var rt = function rt() { for (var t, n = F; t = n.sourceEvent;) { n = t; } return n; }, it = function it(t, n) { var e = t.ownerSVGElement || t; if (e.createSVGPoint) { var r = e.createSVGPoint(); return r.x = n.clientX, r.y = n.clientY, [(r = r.matrixTransform(t.getScreenCTM().inverse())).x, r.y]; } var i = t.getBoundingClientRect(); return [n.clientX - i.left - t.clientLeft, n.clientY - i.top - t.clientTop]; }, ot = function ot(t) { var n = rt(); return n.changedTouches && (n = n.changedTouches[0]), it(t, n); }, at = function at(t, n, e) { arguments.length < 3 && (e = n, n = rt().changedTouches); for (var r, i = 0, o = n ? n.length : 0; i < o; ++i) { if ((r = n[i]).identifier === e) return it(t, r); } return null; }, ut = e(4), st = { value: function value() {} }; function ct() { for (var t, n = 0, e = arguments.length, r = {}; n < e; ++n) { if (!(t = arguments[n] + "") || t in r) throw new Error("illegal type: " + t); r[t] = []; } return new ht(r); } function ht(t) { this._ = t; } function lt(t, n) { for (var e, r = 0, i = t.length; r < i; ++r) { if ((e = t[r]).name === n) return e.value; } } function ft(t, n, e) { for (var r = 0, i = t.length; r < i; ++r) { if (t[r].name === n) { t[r] = st, t = t.slice(0, r).concat(t.slice(r + 1)); break; } } return null != e && t.push({ name: n, value: e }), t; } ht.prototype = ct.prototype = { constructor: ht, on: function on(t, n) { var e, r = this._, i = function (t, n) { return t.trim().split(/^|\s+/).map(function (t) { var e = "", r = t.indexOf("."); if (r >= 0 && (e = t.slice(r + 1), t = t.slice(0, r)), t && !n.hasOwnProperty(t)) throw new Error("unknown type: " + t); return { type: t, name: e }; }); }(t + "", r), o = -1, a = i.length; if (!(arguments.length < 2)) { if (null != n && "function" != typeof n) throw new Error("invalid callback: " + n); for (; ++o < a;) { if (e = (t = i[o]).type) r[e] = ft(r[e], t.name, n);else if (null == n) for (e in r) { r[e] = ft(r[e], t.name, null); } } return this; } for (; ++o < a;) { if ((e = (t = i[o]).type) && (e = lt(r[e], t.name))) return e; } }, copy: function copy() { var t = {}, n = this._; for (var e in n) { t[e] = n[e].slice(); } return new ht(t); }, call: function call(t, n) { if ((e = arguments.length - 2) > 0) for (var e, r, i = new Array(e), o = 0; o < e; ++o) { i[o] = arguments[o + 2]; } if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t); for (o = 0, e = (r = this._[t]).length; o < e; ++o) { r[o].value.apply(n, i); } }, apply: function apply(t, n, e) { if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t); for (var r = this._[t], i = 0, o = r.length; i < o; ++i) { r[i].value.apply(n, e); } } }; var pt = ct; var dt = function dt() { F.preventDefault(), F.stopImmediatePropagation(); }, vt = function vt(t) { var n = t.document.documentElement, e = tt(t).on("dragstart.drag", dt, !0); "onselectstart" in n ? e.on("selectstart.drag", dt, !0) : (n.__noselect = n.style.MozUserSelect, n.style.MozUserSelect = "none"); }; function yt(t, n) { var e = t.document.documentElement, r = tt(t).on("dragstart.drag", null); n && (r.on("click.drag", dt, !0), setTimeout(function () { r.on("click.drag", null); }, 0)), "onselectstart" in e ? r.on("selectstart.drag", null) : (e.style.MozUserSelect = e.__noselect, delete e.__noselect); } function gt(t, n, e, r, i, o, a, u, s, c) { this.target = t, this.type = n, this.subject = e, this.identifier = r, this.active = i, this.x = o, this.y = a, this.dx = u, this.dy = s, this._ = c; } gt.prototype.on = function () { var t = this._.on.apply(this._, arguments); return t === this._ ? this : t; }; var mt = function mt(t, n, e) { t.prototype = n.prototype = e, e.constructor = t; }; function _t(t, n) { var e = Object.create(t.prototype); for (var r in n) { e[r] = n[r]; } return e; } function wt() {} var xt = "\\s*([+-]?\\d+)\\s*", bt = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", Et = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Mt = /^#([0-9a-f]{3})$/, kt = /^#([0-9a-f]{6})$/, St = new RegExp("^rgb\\(" + [xt, xt, xt] + "\\)$"), Nt = new RegExp("^rgb\\(" + [Et, Et, Et] + "\\)$"), At = new RegExp("^rgba\\(" + [xt, xt, xt, bt] + "\\)$"), Pt = new RegExp("^rgba\\(" + [Et, Et, Et, bt] + "\\)$"), zt = new RegExp("^hsl\\(" + [bt, Et, Et] + "\\)$"), Tt = new RegExp("^hsla\\(" + [bt, Et, Et, bt] + "\\)$"), Lt = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; function It(t) { var n; return t = (t + "").trim().toLowerCase(), (n = Mt.exec(t)) ? new Xt((n = parseInt(n[1], 16)) >> 8 & 15 | n >> 4 & 240, n >> 4 & 15 | 240 & n, (15 & n) << 4 | 15 & n, 1) : (n = kt.exec(t)) ? jt(parseInt(n[1], 16)) : (n = St.exec(t)) ? new Xt(n[1], n[2], n[3], 1) : (n = Nt.exec(t)) ? new Xt(255 * n[1] / 100, 255 * n[2] / 100, 255 * n[3] / 100, 1) : (n = At.exec(t)) ? Ot(n[1], n[2], n[3], n[4]) : (n = Pt.exec(t)) ? Ot(255 * n[1] / 100, 255 * n[2] / 100, 255 * n[3] / 100, n[4]) : (n = zt.exec(t)) ? qt(n[1], n[2] / 100, n[3] / 100, 1) : (n = Tt.exec(t)) ? qt(n[1], n[2] / 100, n[3] / 100, n[4]) : Lt.hasOwnProperty(t) ? jt(Lt[t]) : "transparent" === t ? new Xt(NaN, NaN, NaN, 0) : null; } function jt(t) { return new Xt(t >> 16 & 255, t >> 8 & 255, 255 & t, 1); } function Ot(t, n, e, r) { return r <= 0 && (t = n = e = NaN), new Xt(t, n, e, r); } function Ct(t) { return _instanceof(t, wt) || (t = It(t)), t ? new Xt((t = t.rgb()).r, t.g, t.b, t.opacity) : new Xt(); } function Rt(t, n, e, r) { return 1 === arguments.length ? Ct(t) : new Xt(t, n, e, null == r ? 1 : r); } function Xt(t, n, e, r) { this.r = +t, this.g = +n, this.b = +e, this.opacity = +r; } function Yt(t) { return ((t = Math.max(0, Math.min(255, Math.round(t) || 0))) < 16 ? "0" : "") + t.toString(16); } function qt(t, n, e, r) { return r <= 0 ? t = n = e = NaN : e <= 0 || e >= 1 ? t = n = NaN : n <= 0 && (t = NaN), new Bt(t, n, e, r); } function Ut(t, n, e, r) { return 1 === arguments.length ? function (t) { if (_instanceof(t, Bt)) return new Bt(t.h, t.s, t.l, t.opacity); if (_instanceof(t, wt) || (t = It(t)), !t) return new Bt(); if (_instanceof(t, Bt)) return t; var n = (t = t.rgb()).r / 255, e = t.g / 255, r = t.b / 255, i = Math.min(n, e, r), o = Math.max(n, e, r), a = NaN, u = o - i, s = (o + i) / 2; return u ? (a = n === o ? (e - r) / u + 6 * (e < r) : e === o ? (r - n) / u + 2 : (n - e) / u + 4, u /= s < .5 ? o + i : 2 - o - i, a *= 60) : u = s > 0 && s < 1 ? 0 : a, new Bt(a, u, s, t.opacity); }(t) : new Bt(t, n, e, null == r ? 1 : r); } function Bt(t, n, e, r) { this.h = +t, this.s = +n, this.l = +e, this.opacity = +r; } function Ft(t, n, e) { return 255 * (t < 60 ? n + (e - n) * t / 60 : t < 180 ? e : t < 240 ? n + (e - n) * (240 - t) / 60 : n); } mt(wt, It, { displayable: function displayable() { return this.rgb().displayable(); }, hex: function hex() { return this.rgb().hex(); }, toString: function toString() { return this.rgb() + ""; } }), mt(Xt, Rt, _t(wt, { brighter: function brighter(t) { return t = null == t ? 1 / .7 : Math.pow(1 / .7, t), new Xt(this.r * t, this.g * t, this.b * t, this.opacity); }, darker: function darker(t) { return t = null == t ? .7 : Math.pow(.7, t), new Xt(this.r * t, this.g * t, this.b * t, this.opacity); }, rgb: function rgb() { return this; }, displayable: function displayable() { return 0 <= this.r && this.r <= 255 && 0 <= this.g && this.g <= 255 && 0 <= this.b && this.b <= 255 && 0 <= this.opacity && this.opacity <= 1; }, hex: function hex() { return "#" + Yt(this.r) + Yt(this.g) + Yt(this.b); }, toString: function toString() { var t = this.opacity; return (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t))) ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (1 === t ? ")" : ", " + t + ")"); } })), mt(Bt, Ut, _t(wt, { brighter: function brighter(t) { return t = null == t ? 1 / .7 : Math.pow(1 / .7, t), new Bt(this.h, this.s, this.l * t, this.opacity); }, darker: function darker(t) { return t = null == t ? .7 : Math.pow(.7, t), new Bt(this.h, this.s, this.l * t, this.opacity); }, rgb: function rgb() { var t = this.h % 360 + 360 * (this.h < 0), n = isNaN(t) || isNaN(this.s) ? 0 : this.s, e = this.l, r = e + (e < .5 ? e : 1 - e) * n, i = 2 * e - r; return new Xt(Ft(t >= 240 ? t - 240 : t + 120, i, r), Ft(t, i, r), Ft(t < 120 ? t + 240 : t - 120, i, r), this.opacity); }, displayable: function displayable() { return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; } })); var Gt = Math.PI / 180, Dt = 180 / Math.PI, Vt = .96422, $t = 1, Ht = .82521, Zt = 4 / 29, Wt = 6 / 29, Jt = 3 * Wt * Wt, Kt = Wt * Wt * Wt; function Qt(t) { if (_instanceof(t, nn)) return new nn(t.l, t.a, t.b, t.opacity); if (_instanceof(t, cn)) { if (isNaN(t.h)) return new nn(t.l, 0, 0, t.opacity); var n = t.h * Gt; return new nn(t.l, Math.cos(n) * t.c, Math.sin(n) * t.c, t.opacity); } _instanceof(t, Xt) || (t = Ct(t)); var e, r, i = an(t.r), o = an(t.g), a = an(t.b), u = en((.2225045 * i + .7168786 * o + .0606169 * a) / $t); return i === o && o === a ? e = r = u : (e = en((.4360747 * i + .3850649 * o + .1430804 * a) / Vt), r = en((.0139322 * i + .0971045 * o + .7141733 * a) / Ht)), new nn(116 * u - 16, 500 * (e - u), 200 * (u - r), t.opacity); } function tn(t, n, e, r) { return 1 === arguments.length ? Qt(t) : new nn(t, n, e, null == r ? 1 : r); } function nn(t, n, e, r) { this.l = +t, this.a = +n, this.b = +e, this.opacity = +r; } function en(t) { return t > Kt ? Math.pow(t, 1 / 3) : t / Jt + Zt; } function rn(t) { return t > Wt ? t * t * t : Jt * (t - Zt); } function on(t) { return 255 * (t <= .0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - .055); } function an(t) { return (t /= 255) <= .04045 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4); } function un(t) { if (_instanceof(t, cn)) return new cn(t.h, t.c, t.l, t.opacity); if (_instanceof(t, nn) || (t = Qt(t)), 0 === t.a && 0 === t.b) return new cn(NaN, 0, t.l, t.opacity); var n = Math.atan2(t.b, t.a) * Dt; return new cn(n < 0 ? n + 360 : n, Math.sqrt(t.a * t.a + t.b * t.b), t.l, t.opacity); } function sn(t, n, e, r) { return 1 === arguments.length ? un(t) : new cn(t, n, e, null == r ? 1 : r); } function cn(t, n, e, r) { this.h = +t, this.c = +n, this.l = +e, this.opacity = +r; } mt(nn, tn, _t(wt, { brighter: function brighter(t) { return new nn(this.l + 18 * (null == t ? 1 : t), this.a, this.b, this.opacity); }, darker: function darker(t) { return new nn(this.l - 18 * (null == t ? 1 : t), this.a, this.b, this.opacity); }, rgb: function rgb() { var t = (this.l + 16) / 116, n = isNaN(this.a) ? t : t + this.a / 500, e = isNaN(this.b) ? t : t - this.b / 200; return new Xt(on(3.1338561 * (n = Vt * rn(n)) - 1.6168667 * (t = $t * rn(t)) - .4906146 * (e = Ht * rn(e))), on(-.9787684 * n + 1.9161415 * t + .033454 * e), on(.0719453 * n - .2289914 * t + 1.4052427 * e), this.opacity); } })), mt(cn, sn, _t(wt, { brighter: function brighter(t) { return new cn(this.h, this.c, this.l + 18 * (null == t ? 1 : t), this.opacity); }, darker: function darker(t) { return new cn(this.h, this.c, this.l - 18 * (null == t ? 1 : t), this.opacity); }, rgb: function rgb() { return Qt(this).rgb(); } })); var hn = -.14861, ln = 1.78277, fn = -.29227, pn = -.90649, dn = 1.97294, vn = dn * pn, yn = dn * ln, gn = ln * fn - pn * hn; function mn(t, n, e, r) { return 1 === arguments.length ? function (t) { if (_instanceof(t, _n)) return new _n(t.h, t.s, t.l, t.opacity); _instanceof(t, Xt) || (t = Ct(t)); var n = t.r / 255, e = t.g / 255, r = t.b / 255, i = (gn * r + vn * n - yn * e) / (gn + vn - yn), o = r - i, a = (dn * (e - i) - fn * o) / pn, u = Math.sqrt(a * a + o * o) / (dn * i * (1 - i)), s = u ? Math.atan2(a, o) * Dt - 120 : NaN; return new _n(s < 0 ? s + 360 : s, u, i, t.opacity); }(t) : new _n(t, n, e, null == r ? 1 : r); } function _n(t, n, e, r) { this.h = +t, this.s = +n, this.l = +e, this.opacity = +r; } function wn(t, n, e, r, i) { var o = t * t, a = o * t; return ((1 - 3 * t + 3 * o - a) * n + (4 - 6 * o + 3 * a) * e + (1 + 3 * t + 3 * o - 3 * a) * r + a * i) / 6; } mt(_n, mn, _t(wt, { brighter: function brighter(t) { return t = null == t ? 1 / .7 : Math.pow(1 / .7, t), new _n(this.h, this.s, this.l * t, this.opacity); }, darker: function darker(t) { return t = null == t ? .7 : Math.pow(.7, t), new _n(this.h, this.s, this.l * t, this.opacity); }, rgb: function rgb() { var t = isNaN(this.h) ? 0 : (this.h + 120) * Gt, n = +this.l, e = isNaN(this.s) ? 0 : this.s * n * (1 - n), r = Math.cos(t), i = Math.sin(t); return new Xt(255 * (n + e * (hn * r + ln * i)), 255 * (n + e * (fn * r + pn * i)), 255 * (n + e * (dn * r)), this.opacity); } })); var xn = function xn(t) { return function () { return t; }; }; function bn(t, n) { return function (e) { return t + e * n; }; } function En(t, n) { var e = n - t; return e ? bn(t, e > 180 || e < -180 ? e - 360 * Math.round(e / 360) : e) : xn(isNaN(t) ? n : t); } function Mn(t) { return 1 == (t = +t) ? kn : function (n, e) { return e - n ? function (t, n, e) { return t = Math.pow(t, e), n = Math.pow(n, e) - t, e = 1 / e, function (r) { return Math.pow(t + r * n, e); }; }(n, e, t) : xn(isNaN(n) ? e : n); }; } function kn(t, n) { var e = n - t; return e ? bn(t, e) : xn(isNaN(t) ? n : t); } var Sn = function t(n) { var e = Mn(n); function r(t, n) { var r = e((t = Rt(t)).r, (n = Rt(n)).r), i = e(t.g, n.g), o = e(t.b, n.b), a = kn(t.opacity, n.opacity); return function (n) { return t.r = r(n), t.g = i(n), t.b = o(n), t.opacity = a(n), t + ""; }; } return r.gamma = t, r; }(1); function Nn(t) { return function (n) { var e, r, i = n.length, o = new Array(i), a = new Array(i), u = new Array(i); for (e = 0; e < i; ++e) { r = Rt(n[e]), o[e] = r.r || 0, a[e] = r.g || 0, u[e] = r.b || 0; } return o = t(o), a = t(a), u = t(u), r.opacity = 1, function (t) { return r.r = o(t), r.g = a(t), r.b = u(t), r + ""; }; }; } Nn(function (t) { var n = t.length - 1; return function (e) { var r = e <= 0 ? e = 0 : e >= 1 ? (e = 1, n - 1) : Math.floor(e * n), i = t[r], o = t[r + 1], a = r > 0 ? t[r - 1] : 2 * i - o, u = r < n - 1 ? t[r + 2] : 2 * o - i; return wn((e - r / n) * n, a, i, o, u); }; }), Nn(function (t) { var n = t.length; return function (e) { var r = Math.floor(((e %= 1) < 0 ? ++e : e) * n), i = t[(r + n - 1) % n], o = t[r % n], a = t[(r + 1) % n], u = t[(r + 2) % n]; return wn((e - r / n) * n, i, o, a, u); }; }); var An = function An(t, n) { return n -= t = +t, function (e) { return t + n * e; }; }, Pn = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, zn = new RegExp(Pn.source, "g"); var Tn, Ln, In, jn, On = function On(t, n) { var e, r, i, o = Pn.lastIndex = zn.lastIndex = 0, a = -1, u = [], s = []; for (t += "", n += ""; (e = Pn.exec(t)) && (r = zn.exec(n));) { (i = r.index) > o && (i = n.slice(o, i), u[a] ? u[a] += i : u[++a] = i), (e = e[0]) === (r = r[0]) ? u[a] ? u[a] += r : u[++a] = r : (u[++a] = null, s.push({ i: a, x: An(e, r) })), o = zn.lastIndex; } return o < n.length && (i = n.slice(o), u[a] ? u[a] += i : u[++a] = i), u.length < 2 ? s[0] ? function (t) { return function (n) { return t(n) + ""; }; }(s[0].x) : function (t) { return function () { return t; }; }(n) : (n = s.length, function (t) { for (var e, r = 0; r < n; ++r) { u[(e = s[r]).i] = e.x(t); } return u.join(""); }); }, Cn = 180 / Math.PI, Rn = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }, Xn = function Xn(t, n, e, r, i, o) { var a, u, s; return (a = Math.sqrt(t * t + n * n)) && (t /= a, n /= a), (s = t * e + n * r) && (e -= t * s, r -= n * s), (u = Math.sqrt(e * e + r * r)) && (e /= u, r /= u, s /= u), t * r < n * e && (t = -t, n = -n, s = -s, a = -a), { translateX: i, translateY: o, rotate: Math.atan2(n, t) * Cn, skewX: Math.atan(s) * Cn, scaleX: a, scaleY: u }; }; function Yn(t, n, e, r) { function i(t) { return t.length ? t.pop() + " " : ""; } return function (o, a) { var u = [], s = []; return o = t(o), a = t(a), function (t, r, i, o, a, u) { if (t !== i || r !== o) { var s = a.push("translate(", null, n, null, e); u.push({ i: s - 4, x: An(t, i) }, { i: s - 2, x: An(r, o) }); } else (i || o) && a.push("translate(" + i + n + o + e); }(o.translateX, o.translateY, a.translateX, a.translateY, u, s), function (t, n, e, o) { t !== n ? (t - n > 180 ? n += 360 : n - t > 180 && (t += 360), o.push({ i: e.push(i(e) + "rotate(", null, r) - 2, x: An(t, n) })) : n && e.push(i(e) + "rotate(" + n + r); }(o.rotate, a.rotate, u, s), function (t, n, e, o) { t !== n ? o.push({ i: e.push(i(e) + "skewX(", null, r) - 2, x: An(t, n) }) : n && e.push(i(e) + "skewX(" + n + r); }(o.skewX, a.skewX, u, s), function (t, n, e, r, o, a) { if (t !== e || n !== r) { var u = o.push(i(o) + "scale(", null, ",", null, ")"); a.push({ i: u - 4, x: An(t, e) }, { i: u - 2, x: An(n, r) }); } else 1 === e && 1 === r || o.push(i(o) + "scale(" + e + "," + r + ")"); }(o.scaleX, o.scaleY, a.scaleX, a.scaleY, u, s), o = a = null, function (t) { for (var n, e = -1, r = s.length; ++e < r;) { u[(n = s[e]).i] = n.x(t); } return u.join(""); }; }; } var qn = Yn(function (t) { return "none" === t ? Rn : (Tn || (Tn = document.createElement("DIV"), Ln = document.documentElement, In = document.defaultView), Tn.style.transform = t, t = In.getComputedStyle(Ln.appendChild(Tn), null).getPropertyValue("transform"), Ln.removeChild(Tn), t = t.slice(7, -1).split(","), Xn(+t[0], +t[1], +t[2], +t[3], +t[4], +t[5])); }, "px, ", "px)", "deg)"), Un = Yn(function (t) { return null == t ? Rn : (jn || (jn = document.createElementNS("http://www.w3.org/2000/svg", "g")), jn.setAttribute("transform", t), (t = jn.transform.baseVal.consolidate()) ? (t = t.matrix, Xn(t.a, t.b, t.c, t.d, t.e, t.f)) : Rn); }, ", ", ")", ")"), Bn = Math.SQRT2; function Fn(t) { return ((t = Math.exp(t)) + 1 / t) / 2; } var Gn = function Gn(t, n) { var e, r, i = t[0], o = t[1], a = t[2], u = n[0], s = n[1], c = n[2], h = u - i, l = s - o, f = h * h + l * l; if (f < 1e-12) r = Math.log(c / a) / Bn, e = function e(t) { return [i + t * h, o + t * l, a * Math.exp(Bn * t * r)]; };else { var p = Math.sqrt(f), d = (c * c - a * a + 4 * f) / (2 * a * 2 * p), v = (c * c - a * a - 4 * f) / (2 * c * 2 * p), y = Math.log(Math.sqrt(d * d + 1) - d), g = Math.log(Math.sqrt(v * v + 1) - v); r = (g - y) / Bn, e = function e(t) { var n = t * r, e = Fn(y), u = a / (2 * p) * (e * function (t) { return ((t = Math.exp(2 * t)) - 1) / (t + 1); }(Bn * n + y) - function (t) { return ((t = Math.exp(t)) - 1 / t) / 2; }(y)); return [i + u * h, o + u * l, a * e / Fn(Bn * n + y)]; }; } return e.duration = 1e3 * r, e; }; function Dn(t) { return function (n, e) { var r = t((n = Ut(n)).h, (e = Ut(e)).h), i = kn(n.s, e.s), o = kn(n.l, e.l), a = kn(n.opacity, e.opacity); return function (t) { return n.h = r(t), n.s = i(t), n.l = o(t), n.opacity = a(t), n + ""; }; }; } Dn(En), Dn(kn); function Vn(t) { return function (n, e) { var r = t((n = sn(n)).h, (e = sn(e)).h), i = kn(n.c, e.c), o = kn(n.l, e.l), a = kn(n.opacity, e.opacity); return function (t) { return n.h = r(t), n.c = i(t), n.l = o(t), n.opacity = a(t), n + ""; }; }; } Vn(En), Vn(kn); function $n(t) { return function n(e) { function r(n, r) { var i = t((n = mn(n)).h, (r = mn(r)).h), o = kn(n.s, r.s), a = kn(n.l, r.l), u = kn(n.opacity, r.opacity); return function (t) { return n.h = i(t), n.s = o(t), n.l = a(Math.pow(t, e)), n.opacity = u(t), n + ""; }; } return e = +e, r.gamma = n, r; }(1); } $n(En), $n(kn); var Hn, Zn, Wn = 0, Jn = 0, Kn = 0, Qn = 1e3, te = 0, ne = 0, ee = 0, re = "object" == (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && performance.now ? performance : Date, ie = "object" == (typeof window === "undefined" ? "undefined" : _typeof(window)) && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (t) { setTimeout(t, 17); }; function oe() { return ne || (ie(ae), ne = re.now() + ee); } function ae() { ne = 0; } function ue() { this._call = this._time = this._next = null; } function se(t, n, e) { var r = new ue(); return r.restart(t, n, e), r; } function ce() { ne = (te = re.now()) + ee, Wn = Jn = 0; try { !function () { oe(), ++Wn; for (var t, n = Hn; n;) { (t = ne - n._time) >= 0 && n._call.call(null, t), n = n._next; } --Wn; }(); } finally { Wn = 0, function () { var t, n, e = Hn, r = 1 / 0; for (; e;) { e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : Hn = n); } Zn = t, le(r); }(), ne = 0; } } function he() { var t = re.now(), n = t - te; n > Qn && (ee -= n, te = t); } function le(t) { Wn || (Jn && (Jn = clearTimeout(Jn)), t - ne > 24 ? (t < 1 / 0 && (Jn = setTimeout(ce, t - re.now() - ee)), Kn && (Kn = clearInterval(Kn))) : (Kn || (te = re.now(), Kn = setInterval(he, Qn)), Wn = 1, ie(ce))); } ue.prototype = se.prototype = { constructor: ue, restart: function restart(t, n, e) { if ("function" != typeof t) throw new TypeError("callback is not a function"); e = (null == e ? oe() : +e) + (null == n ? 0 : +n), this._next || Zn === this || (Zn ? Zn._next = this : Hn = this, Zn = this), this._call = t, this._time = e, le(); }, stop: function stop() { this._call && (this._call = null, this._time = 1 / 0, le()); } }; var fe = function fe(t, n, e) { var r = new ue(); return n = null == n ? 0 : +n, r.restart(function (e) { r.stop(), t(e + n); }, n, e), r; }, pe = pt("start", "end", "interrupt"), de = [], ve = 0, ye = 1, ge = 2, me = 3, _e = 4, we = 5, xe = 6, be = function be(t, n, e, r, i, o) { var a = t.__transition; if (a) { if (e in a) return; } else t.__transition = {}; !function (t, n, e) { var r, i = t.__transition; function o(s) { var c, h, l, f; if (e.state !== ye) return u(); for (c in i) { if ((f = i[c]).name === e.name) { if (f.state === me) return fe(o); f.state === _e ? (f.state = xe, f.timer.stop(), f.on.call("interrupt", t, t.__data__, f.index, f.group), delete i[c]) : +c < n && (f.state = xe, f.timer.stop(), delete i[c]); } } if (fe(function () { e.state === me && (e.state = _e, e.timer.restart(a, e.delay, e.time), a(s)); }), e.state = ge, e.on.call("start", t, t.__data__, e.index, e.group), e.state === ge) { for (e.state = me, r = new Array(l = e.tween.length), c = 0, h = -1; c < l; ++c) { (f = e.tween[c].value.call(t, t.__data__, e.index, e.group)) && (r[++h] = f); } r.length = h + 1; } } function a(n) { for (var i = n < e.duration ? e.ease.call(null, n / e.duration) : (e.timer.restart(u), e.state = we, 1), o = -1, a = r.length; ++o < a;) { r[o].call(null, i); } e.state === we && (e.on.call("end", t, t.__data__, e.index, e.group), u()); } function u() { for (var r in e.state = xe, e.timer.stop(), delete i[n], i) { return; } delete t.__transition; } i[n] = e, e.timer = se(function (t) { e.state = ye, e.timer.restart(o, e.delay, e.time), e.delay <= t && o(t - e.delay); }, 0, e.time); }(t, e, { name: n, index: r, group: i, on: pe, tween: de, time: o.time, delay: o.delay, duration: o.duration, ease: o.ease, timer: null, state: ve }); }; function Ee(t, n) { var e = ke(t, n); if (e.state > ve) throw new Error("too late; already scheduled"); return e; } function Me(t, n) { var e = ke(t, n); if (e.state > ge) throw new Error("too late; already started"); return e; } function ke(t, n) { var e = t.__transition; if (!e || !(e = e[n])) throw new Error("transition not found"); return e; } var Se = function Se(t, n) { var e, r, i, o = t.__transition, a = !0; if (o) { for (i in n = null == n ? null : n + "", o) { (e = o[i]).name === n ? (r = e.state > ge && e.state < we, e.state = xe, e.timer.stop(), r && e.on.call("interrupt", t, t.__data__, e.index, e.group), delete o[i]) : a = !1; } a && delete t.__transition; } }; function Ne(t, n, e) { var r = t._id; return t.each(function () { var t = Me(this, r); (t.value || (t.value = {}))[n] = e.apply(this, arguments); }), function (t) { return ke(t, r).value[n]; }; } var Ae = function Ae(t, n) { var e; return ("number" == typeof n ? An : _instanceof(n, It) ? Sn : (e = It(n)) ? (n = e, Sn) : On)(t, n); }; var Pe = Q.prototype.constructor; var ze = 0; function Te(t, n, e, r) { this._groups = t, this._parents = n, this._name = e, this._id = r; } function Le() { return ++ze; } var Ie = Q.prototype; Te.prototype = function (t) { return Q().transition(t); }.prototype = { constructor: Te, select: function select(t) { var n = this._name, e = this._id; "function" != typeof t && (t = d(t)); for (var r = this._groups, i = r.length, o = new Array(i), a = 0; a < i; ++a) { for (var u, s, c = r[a], h = c.length, l = o[a] = new Array(h), f = 0; f < h; ++f) { (u = c[f]) && (s = t.call(u, u.__data__, f, c)) && ("__data__" in u && (s.__data__ = u.__data__), l[f] = s, be(l[f], n, e, f, l, ke(u, e))); } } return new Te(o, this._parents, n, e); }, selectAll: function selectAll(t) { var n = this._name, e = this._id; "function" != typeof t && (t = y(t)); for (var r = this._groups, i = r.length, o = [], a = [], u = 0; u < i; ++u) { for (var s, c = r[u], h = c.length, l = 0; l < h; ++l) { if (s = c[l]) { for (var f, p = t.call(s, s.__data__, l, c), d = ke(s, e), v = 0, g = p.length; v < g; ++v) { (f = p[v]) && be(f, n, e, v, p, d); } o.push(p), a.push(s); } } } return new Te(o, a, n, e); }, filter: function filter(t) { "function" != typeof t && (t = w(t)); for (var n = this._groups, e = n.length, r = new Array(e), i = 0; i < e; ++i) { for (var o, a = n[i], u = a.length, s = r[i] = [], c = 0; c < u; ++c) { (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o); } } return new Te(r, this._parents, this._name, this._id); }, merge: function merge(t) { if (t._id !== this._id) throw new Error(); for (var n = this._groups, e = t._groups, r = n.length, i = e.length, o = Math.min(r, i), a = new Array(r), u = 0; u < o; ++u) { for (var s, c = n[u], h = e[u], l = c.length, f = a[u] = new Array(l), p = 0; p < l; ++p) { (s = c[p] || h[p]) && (f[p] = s); } } for (; u < r; ++u) { a[u] = n[u]; } return new Te(a, this._parents, this._name, this._id); }, selection: function selection() { return new Pe(this._groups, this._parents); }, transition: function transition() { for (var t = this._name, n = this._id, e = Le(), r = this._groups, i = r.length, o = 0; o < i; ++o) { for (var a, u = r[o], s = u.length, c = 0; c < s; ++c) { if (a = u[c]) { var h = ke(a, n); be(a, t, e, c, u, { time: h.time + h.delay + h.duration, delay: 0, duration: h.duration, ease: h.ease }); } } } return new Te(r, this._parents, t, e); }, call: Ie.call, nodes: Ie.nodes, node: Ie.node, size: Ie.size, empty: Ie.empty, each: Ie.each, on: function on(t, n) { var e = this._id; return arguments.length < 2 ? ke(this.node(), e).on.on(t) : this.each(function (t, n, e) { var r, i, o = function (t) { return (t + "").trim().split(/^|\s+/).every(function (t) { var n = t.indexOf("."); return n >= 0 && (t = t.slice(0, n)), !t || "start" === t; }); }(n) ? Ee : Me; return function () { var a = o(this, t), u = a.on; u !== r && (i = (r = u).copy()).on(n, e), a.on = i; }; }(e, t, n)); }, attr: function attr(t, n) { var e = l(t), r = "transform" === e ? Un : Ae; return this.attrTween(t, "function" == typeof n ? (e.local ? function (t, n, e) { var r, i, o; return function () { var a, u = e(this); if (null != u) return (a = this.getAttributeNS(t.space, t.local)) === u ? null : a === r && u === i ? o : o = n(r = a, i = u); this.removeAttributeNS(t.space, t.local); }; } : function (t, n, e) { var r, i, o; return function () { var a, u = e(this); if (null != u) return (a = this.getAttribute(t)) === u ? null : a === r && u === i ? o : o = n(r = a, i = u); this.removeAttribute(t); }; })(e, r, Ne(this, "attr." + t, n)) : null == n ? (e.local ? function (t) { return function () { this.removeAttributeNS(t.space, t.local); }; } : function (t) { return function () { this.removeAttribute(t); }; })(e) : (e.local ? function (t, n, e) { var r, i; return function () { var o = this.getAttributeNS(t.space, t.local); return o === e ? null : o === r ? i : i = n(r = o, e); }; } : function (t, n, e) { var r, i; return function () { var o = this.getAttribute(t); return o === e ? null : o === r ? i : i = n(r = o, e); }; })(e, r, n + "")); }, attrTween: function attrTween(t, n) { var e = "attr." + t; if (arguments.length < 2) return (e = this.tween(e)) && e._value; if (null == n) return this.tween(e, null); if ("function" != typeof n) throw new Error(); var r = l(t); return this.tween(e, (r.local ? function (t, n) { function e() { var e = this, r = n.apply(e, arguments); return r && function (n) { e.setAttributeNS(t.space, t.local, r(n)); }; } return e._value = n, e; } : function (t, n) { function e() { var e = this, r = n.apply(e, arguments); return r && function (n) { e.setAttribute(t, r(n)); }; } return e._value = n, e; })(r, n)); }, style: function style(t, n, e) { var r = "transform" == (t += "") ? qn : Ae; return null == n ? this.styleTween(t, function (t, n) { var e, r, i; return function () { var o = A(this, t), a = (this.style.removeProperty(t), A(this, t)); return o === a ? null : o === e && a === r ? i : i = n(e = o, r = a); }; }(t, r)).on("end.style." + t, function (t) { return function () { this.style.removeProperty(t); }; }(t)) : this.styleTween(t, "function" == typeof n ? function (t, n, e) { var r, i, o; return function () { var a = A(this, t), u = e(this); return null == u && (this.style.removeProperty(t), u = A(this, t)), a === u ? null : a === r && u === i ? o : o = n(r = a, i = u); }; }(t, r, Ne(this, "style." + t, n)) : function (t, n, e) { var r, i; return function () { var o = A(this, t); return o === e ? null : o === r ? i : i = n(r = o, e); }; }(t, r, n + ""), e); }, styleTween: function styleTween(t, n, e) { var r = "style." + (t += ""); if (arguments.length < 2) return (r = this.tween(r)) && r._value; if (null == n) return this.tween(r, null); if ("function" != typeof n) throw new Error(); return this.tween(r, function (t, n, e) { function r() { var r = this, i = n.apply(r, arguments); return i && function (n) { r.style.setProperty(t, i(n), e); }; } return r._value = n, r; }(t, n, null == e ? "" : e)); }, text: function text(t) { return this.tween("text", "function" == typeof t ? function (t) { return function () { var n = t(this); this.textContent = null == n ? "" : n; }; }(Ne(this, "text", t)) : function (t) { return function () { this.textContent = t; }; }(null == t ? "" : t + "")); }, remove: function remove() { return this.on("end.remove", function (t) { return function () { var n = this.parentNode; for (var e in this.__transition) { if (+e !== t) return; } n && n.removeChild(this); }; }(this._id)); }, tween: function tween(t, n) { var e = this._id; if (t += "", arguments.length < 2) { for (var r, i = ke(this.node(), e).tween, o = 0, a = i.length; o < a; ++o) { if ((r = i[o]).name === t) return r.value; } return null; } return this.each((null == n ? function (t, n) { var e, r; return function () { var i = Me(this, t), o = i.tween; if (o !== e) for (var a = 0, u = (r = e = o).length; a < u; ++a) { if (r[a].name === n) { (r = r.slice()).splice(a, 1); break; } } i.tween = r; }; } : function (t, n, e) { var r, i; if ("function" != typeof e) throw new Error(); return function () { var o = Me(this, t), a = o.tween; if (a !== r) { i = (r = a).slice(); for (var u = { name: n, value: e }, s = 0, c = i.length; s < c; ++s) { if (i[s].name === n) { i[s] = u; break; } } s === c && i.push(u); } o.tween = i; }; })(e, t, n)); }, delay: function delay(t) { var n = this._id; return arguments.length ? this.each(("function" == typeof t ? function (t, n) { return function () { Ee(this, t).delay = +n.apply(this, arguments); }; } : function (t, n) { return n = +n, function () { Ee(this, t).delay = n; }; })(n, t)) : ke(this.node(), n).delay; }, duration: function duration(t) { var n = this._id; return arguments.length ? this.each(("function" == typeof t ? function (t, n) { return function () { Me(this, t).duration = +n.apply(this, arguments); }; } : function (t, n) { return n = +n, function () { Me(this, t).duration = n; }; })(n, t)) : ke(this.node(), n).duration; }, ease: function ease(t) { var n = this._id; return arguments.length ? this.each(function (t, n) { if ("function" != typeof n) throw new Error(); return function () { Me(this, t).ease = n; }; }(n, t)) : ke(this.node(), n).ease; } }; (function t(n) { function e(t) { return Math.pow(t, n); } return n = +n, e.exponent = t, e; })(3), function t(n) { function e(t) { return 1 - Math.pow(1 - t, n); } return n = +n, e.exponent = t, e; }(3), function t(n) { function e(t) { return ((t *= 2) <= 1 ? Math.pow(t, n) : 2 - Math.pow(2 - t, n)) / 2; } return n = +n, e.exponent = t, e; }(3), Math.PI; (function t(n) { function e(t) { return t * t * ((n + 1) * t - n); } return n = +n, e.overshoot = t, e; })(1.70158), function t(n) { function e(t) { return --t * t * ((n + 1) * t + n) + 1; } return n = +n, e.overshoot = t, e; }(1.70158), function t(n) { function e(t) { return ((t *= 2) < 1 ? t * t * ((n + 1) * t - n) : (t -= 2) * t * ((n + 1) * t + n) + 2) / 2; } return n = +n, e.overshoot = t, e; }(1.70158); var je = 2 * Math.PI, Oe = (function t(n, e) { var r = Math.asin(1 / (n = Math.max(1, n))) * (e /= je); function i(t) { return n * Math.pow(2, 10 * --t) * Math.sin((r - t) / e); } return i.amplitude = function (n) { return t(n, e * je); }, i.period = function (e) { return t(n, e); }, i; }(1, .3), function t(n, e) { var r = Math.asin(1 / (n = Math.max(1, n))) * (e /= je); function i(t) { return 1 - n * Math.pow(2, -10 * (t = +t)) * Math.sin((t + r) / e); } return i.amplitude = function (n) { return t(n, e * je); }, i.period = function (e) { return t(n, e); }, i; }(1, .3), function t(n, e) { var r = Math.asin(1 / (n = Math.max(1, n))) * (e /= je); function i(t) { return ((t = 2 * t - 1) < 0 ? n * Math.pow(2, 10 * t) * Math.sin((r - t) / e) : 2 - n * Math.pow(2, -10 * t) * Math.sin((r + t) / e)) / 2; } return i.amplitude = function (n) { return t(n, e * je); }, i.period = function (e) { return t(n, e); }, i; }(1, .3), { time: null, delay: 0, duration: 250, ease: function ease(t) { return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; } }); function Ce(t, n) { for (var e; !(e = t.__transition) || !(e = e[n]);) { if (!(t = t.parentNode)) return Oe.time = oe(), Oe; } return e; } Q.prototype.interrupt = function (t) { return this.each(function () { Se(this, t); }); }, Q.prototype.transition = function (t) { var n, e; _instanceof(t, Te) ? (n = t._id, t = t._name) : (n = Le(), (e = Oe).time = oe(), t = null == t ? null : t + ""); for (var r = this._groups, i = r.length, o = 0; o < i; ++o) { for (var a, u = r[o], s = u.length, c = 0; c < s; ++c) { (a = u[c]) && be(a, t, n, c, u, e || Ce(a, n)); } } return new Te(r, this._parents, t, n); }; var Re = function Re(t) { return function () { return t; }; }; function Xe(t, n, e) { this.k = t, this.x = n, this.y = e; } Xe.prototype = { constructor: Xe, scale: function scale(t) { return 1 === t ? this : new Xe(this.k * t, this.x, this.y); }, translate: function translate(t, n) { return 0 === t & 0 === n ? this : new Xe(this.k, this.x + this.k * t, this.y + this.k * n); }, apply: function apply(t) { return [t[0] * this.k + this.x, t[1] * this.k + this.y]; }, applyX: function applyX(t) { return t * this.k + this.x; }, applyY: function applyY(t) { return t * this.k + this.y; }, invert: function invert(t) { return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k]; }, invertX: function invertX(t) { return (t - this.x) / this.k; }, invertY: function invertY(t) { return (t - this.y) / this.k; }, rescaleX: function rescaleX(t) { return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t)); }, rescaleY: function rescaleY(t) { return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t)); }, toString: function toString() { return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; } }; var Ye = new Xe(1, 0, 0); function qe(t) { return t.__zoom || Ye; } function Ue() { F.stopImmediatePropagation(); } qe.prototype = Xe.prototype; var Be = function Be() { F.preventDefault(), F.stopImmediatePropagation(); }; function Fe() { return !F.button; } function Ge() { var t, n, e = this; return _instanceof(e, SVGElement) ? (t = (e = e.ownerSVGElement || e).width.baseVal.value, n = e.height.baseVal.value) : (t = e.clientWidth, n = e.clientHeight), [[0, 0], [t, n]]; } function De() { return this.__zoom || Ye; } function Ve() { return -F.deltaY * (F.deltaMode ? 120 : 1) / 500; } function $e() { return "ontouchstart" in this; } function He(t, n, e) { var r = t.invertX(n[0][0]) - e[0][0], i = t.invertX(n[1][0]) - e[1][0], o = t.invertY(n[0][1]) - e[0][1], a = t.invertY(n[1][1]) - e[1][1]; return t.translate(i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i), a > o ? (o + a) / 2 : Math.min(0, o) || Math.max(0, a)); } var Ze = function Ze(t) { return t; }, We = function We(t) { if (null == t) return Ze; var n, e, r = t.scale[0], i = t.scale[1], o = t.translate[0], a = t.translate[1]; return function (t, u) { u || (n = e = 0); var s = 2, c = t.length, h = new Array(c); for (h[0] = (n += t[0]) * r + o, h[1] = (e += t[1]) * i + a; s < c;) { h[s] = t[s], ++s; } return h; }; }, Je = function Je(t, n) { for (var e, r = t.length, i = r - n; i < --r;) { e = t[i], t[i++] = t[r], t[r] = e; } }, Ke = function Ke(t, n) { return "GeometryCollection" === n.type ? { type: "FeatureCollection", features: n.geometries.map(function (n) { return Qe(t, n); }) } : Qe(t, n); }; function Qe(t, n) { var e = n.id, r = n.bbox, i = null == n.properties ? {} : n.properties, o = tr(t, n); return null == e && null == r ? { type: "Feature", properties: i, geometry: o } : null == r ? { type: "Feature", id: e, properties: i, geometry: o } : { type: "Feature", id: e, bbox: r, properties: i, geometry: o }; } function tr(t, n) { var e = We(t.transform), r = t.arcs; function i(t, n) { n.length && n.pop(); for (var i = r[t < 0 ? ~t : t], o = 0, a = i.length; o < a; ++o) { n.push(e(i[o], o)); } t < 0 && Je(n, a); } function o(t) { return e(t); } function a(t) { for (var n = [], e = 0, r = t.length; e < r; ++e) { i(t[e], n); } return n.length < 2 && n.push(n[0]), n; } function u(t) { for (var n = a(t); n.length < 4;) { n.push(n[0]); } return n; } function s(t) { return t.map(u); } return function t(n) { var e, r = n.type; switch (r) { case "GeometryCollection": return { type: r, geometries: n.geometries.map(t) }; case "Point": e = o(n.coordinates); break; case "MultiPoint": e = n.coordinates.map(o); break; case "LineString": e = a(n.arcs); break; case "MultiLineString": e = n.arcs.map(a); break; case "Polygon": e = s(n.arcs); break; case "MultiPolygon": e = n.arcs.map(s); break; default: return null; } return { type: r, coordinates: e }; }(n); } var nr = function nr(t, n) { var e = {}, r = {}, i = {}, o = [], a = -1; function u(t, n) { for (var r in t) { var i = t[r]; delete n[i.start], delete i.start, delete i.end, i.forEach(function (t) { e[t < 0 ? ~t : t] = 1; }), o.push(i); } } return n.forEach(function (e, r) { var i, o = t.arcs[e < 0 ? ~e : e]; o.length < 3 && !o[1][0] && !o[1][1] && (i = n[++a], n[a] = e, n[r] = i); }), n.forEach(function (n) { var e, o, a = function (n) { var e, r = t.arcs[n < 0 ? ~n : n], i = r[0]; t.transform ? (e = [0, 0], r.forEach(function (t) { e[0] += t[0], e[1] += t[1]; })) : e = r[r.length - 1]; return n < 0 ? [e, i] : [i, e]; }(n), u = a[0], s = a[1]; if (e = i[u]) { if (delete i[e.end], e.push(n), e.end = s, o = r[s]) { delete r[o.start]; var c = o === e ? e : e.concat(o); r[c.start = e.start] = i[c.end = o.end] = c; } else r[e.start] = i[e.end] = e; } else if (e = r[s]) { if (delete r[e.start], e.unshift(n), e.start = u, o = i[u]) { delete i[o.end]; var h = o === e ? e : o.concat(e); r[h.start = o.start] = i[h.end = e.end] = h; } else r[e.start] = i[e.end] = e; } else r[(e = [n]).start = u] = i[e.end = s] = e; }), u(i, r), u(r, i), n.forEach(function (t) { e[t < 0 ? ~t : t] || o.push([t]); }), o; }, er = function er(t) { return tr(t, function (t, n, e) { var r, i, o; if (arguments.length > 1) r = function (t, n, e) { var r, i = [], o = []; function a(t) { var n = t < 0 ? ~t : t; (o[n] || (o[n] = [])).push({ i: t, g: r }); } function u(t) { t.forEach(a); } function s(t) { t.forEach(u); } return function t(n) { switch (r = n, n.type) { case "GeometryCollection": n.geometries.forEach(t); break; case "LineString": u(n.arcs); break; case "MultiLineString": case "Polygon": s(n.arcs); break; case "MultiPolygon": !function (t) { t.forEach(s); }(n.arcs); } }(n), o.forEach(null == e ? function (t) { i.push(t[0].i); } : function (t) { e(t[0].g, t[t.length - 1].g) && i.push(t[0].i); }), i; }(0, n, e);else for (i = 0, r = new Array(o = t.arcs.length); i < o; ++i) { r[i] = i; } return { type: "MultiLineString", arcs: nr(t, r) }; }.apply(this, arguments)); }; var rr = new ArrayBuffer(16); new Float64Array(rr), new Uint32Array(rr); Math.PI, Math.abs, Math.atan2, Math.cos, Math.sin; var ir = /*#__PURE__*/ function () { function ir() { _classCallCheck(this, ir); this.ids = [], this.values = [], this.length = 0; } _createClass(ir, [{ key: "clear", value: function clear() { this.length = this.ids.length = this.values.length = 0; } }, { key: "push", value: function push(t, n) { this.ids.push(t), this.values.push(n); var e = this.length++; for (; e > 0;) { var _t2 = e - 1 >> 1, _r = this.values[_t2]; if (n >= _r) break; this.ids[e] = this.ids[_t2], this.values[e] = _r, e = _t2; } this.ids[e] = t, this.values[e] = n; } }, { key: "pop", value: function pop() { if (0 === this.length) return; var t = this.ids[0]; if (this.length--, this.length > 0) { var _t3 = this.ids[0] = this.ids[this.length], _n2 = this.values[0] = this.values[this.length], _e2 = this.length >> 1; var _r2 = 0; for (; _r2 < _e2;) { var _t4 = 1 + (_r2 << 1); var _e3 = _t4 + 1; var _i = this.ids[_t4], _o = this.values[_t4]; var _a = this.values[_e3]; if (_e3 < this.length && _a < _o && (_t4 = _e3, _i = this.ids[_e3], _o = _a), _o >= _n2) break; this.ids[_r2] = _i, this.values[_r2] = _o, _r2 = _t4; } this.ids[_r2] = _t3, this.values[_r2] = _n2; } return this.ids.pop(), this.values.pop(), t; } }, { key: "peek", value: function peek() { return this.ids[0]; } }, { key: "peekValue", value: function peekValue() { return this.values[0]; } }]); return ir; }(); var or = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], ar = 3; var ur = /*#__PURE__*/ function () { _createClass(ur, null, [{ key: "from", value: function from(t) { if (!_instanceof(t, ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer."); var _ref = new Uint8Array(t, 0, 2), _ref2 = _slicedToArray(_ref, 2), n = _ref2[0], e = _ref2[1]; if (251 !== n) throw new Error("Data does not appear to be in a Flatbush format."); if (e >> 4 !== ar) throw new Error("Got v".concat(e >> 4, " data when expected v").concat(ar, ".")); var _ref3 = new Uint16Array(t, 2, 1), _ref4 = _slicedToArray(_ref3, 1), r = _ref4[0], _ref5 = new Uint32Array(t, 4, 1), _ref6 = _slicedToArray(_ref5, 1), i = _ref6[0]; return new ur(i, r, or[15 & e], t); } }]); function ur(t) { var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16; var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Float64Array; var r = arguments.length > 3 ? arguments[3] : undefined; _classCallCheck(this, ur); if (void 0 === t) throw new Error("Missing required argument: numItems."); if (isNaN(t) || t <= 0) throw new Error("Unpexpected numItems value: ".concat(t, ".")); this.numItems = +t, this.nodeSize = Math.min(Math.max(+n, 2), 65535); var i = t, o = i; this._levelBounds = [4 * i]; do { o += i = Math.ceil(i / this.nodeSize), this._levelBounds.push(4 * o); } while (1 !== i); this.ArrayType = e || Float64Array, this.IndexArrayType = o < 16384 ? Uint16Array : Uint32Array; var a = or.indexOf(this.ArrayType), u = 4 * o * this.ArrayType.BYTES_PER_ELEMENT; if (a < 0) throw new Error("Unexpected typed array class: ".concat(e, ".")); r && _instanceof(r, ArrayBuffer) ? (this.data = r, this._boxes = new this.ArrayType(this.data, 8, 4 * o), this._indices = new this.IndexArrayType(this.data, 8 + u, o), this._pos = 4 * o, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new ArrayBuffer(8 + u + o * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, 4 * o), this._indices = new this.IndexArrayType(this.data, 8 + u, o), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (ar << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = n, new Uint32Array(this.data, 4, 1)[0] = t), this.queue = new ir(); } _createClass(ur, [{ key: "add", value: function add(t, n, e, r) { var i = this._pos >> 2; this._indices[i] = i, this._boxes[this._pos++] = t, this._boxes[this._pos++] = n, this._boxes[this._pos++] = e, this._boxes[this._pos++] = r, t < this.minX && (this.minX = t), n < this.minY && (this.minY = n), e > this.maxX && (this.maxX = e), r > this.maxY && (this.maxY = r); } }, { key: "finish", value: function finish() { if (this._pos >> 2 !== this.numItems) throw new Error("Added ".concat(this._pos >> 2, " items when expected ").concat(this.numItems, ".")); var t = this.maxX - this.minX, n = this.maxY - this.minY, e = new Uint32Array(this.numItems); for (var _r3 = 0; _r3 < this.numItems; _r3++) { var _i2 = 4 * _r3; var _o2 = this._boxes[_i2++], _a2 = this._boxes[_i2++], _u = this._boxes[_i2++], _s2 = this._boxes[_i2++], _c = Math.floor(65535 * ((_o2 + _u) / 2 - this.minX) / t), _h = Math.floor(65535 * ((_a2 + _s2) / 2 - this.minY) / n); e[_r3] = lr(_c, _h); } !function t(n, e, r, i, o) { if (i >= o) return; var a = n[i + o >> 1]; var u = i - 1; var s = o + 1; for (;;) { do { u++; } while (n[u] < a); do { s--; } while (n[s] > a); if (u >= s) break; hr(n, e, r, u, s); } t(n, e, r, i, s); t(n, e, r, s + 1, o); }(e, this._boxes, this._indices, 0, this.numItems - 1); for (var _t5 = 0, _n3 = 0; _t5 < this._levelBounds.length - 1; _t5++) { var _e4 = this._levelBounds[_t5]; for (; _n3 < _e4;) { var _t6 = 1 / 0, _r4 = 1 / 0, _i3 = -1 / 0, _o3 = -1 / 0; var _a3 = _n3; for (var _a4 = 0; _a4 < this.nodeSize && _n3 < _e4; _a4++) { var _e5 = this._boxes[_n3++], _a5 = this._boxes[_n3++], _u2 = this._boxes[_n3++], _s3 = this._boxes[_n3++]; _e5 < _t6 && (_t6 = _e5), _a5 < _r4 && (_r4 = _a5), _u2 > _i3 && (_i3 = _u2), _s3 > _o3 && (_o3 = _s3); } this._indices[this._pos >> 2] = _a3, this._boxes[this._pos++] = _t6, this._boxes[this._pos++] = _r4, this._boxes[this._pos++] = _i3, this._boxes[this._pos++] = _o3; } } } }, { key: "search", value: function search(t, n, e, r, i) { if (this._pos !== this._boxes.length) throw new Error("Data not yet indexed - call index.finish()."); var o = this._boxes.length - 4, a = this._levelBounds.length - 1; var u = [], s = []; for (; void 0 !== o;) { var _c2 = Math.min(o + 4 * this.nodeSize, this._levelBounds[a]); for (var _h2 = o; _h2 < _c2; _h2 += 4) { var _c3 = this._indices[_h2 >> 2]; e < this._boxes[_h2] || r < this._boxes[_h2 + 1] || t > this._boxes[_h2 + 2] || n > this._boxes[_h2 + 3] || (o < 4 * this.numItems ? (void 0 === i || i(_c3)) && s.push(_c3) : (u.push(_c3), u.push(a - 1))); } a = u.pop(), o = u.pop(); } return s; } }, { key: "neighbors", value: function neighbors(t, n) { var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1 / 0; var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1 / 0; var i = arguments.length > 4 ? arguments[4] : undefined; if (this._pos !== this._boxes.length) throw new Error("Data not yet indexed - call index.finish()."); var o = this._boxes.length - 4; var a = this.queue, u = [], s = r * r; for (; void 0 !== o;) { var _r5 = Math.min(o + 4 * this.nodeSize, cr(o, this._levelBounds)); for (var _e6 = o; _e6 < _r5; _e6 += 4) { var _r6 = this._indices[_e6 >> 2], _u3 = sr(t, this._boxes[_e6], this._boxes[_e6 + 2]), _s4 = sr(n, this._boxes[_e6 + 1], this._boxes[_e6 + 3]), _c4 = _u3 * _u3 + _s4 * _s4; o < 4 * this.numItems ? (void 0 === i || i(_r6)) && a.push(-_r6 - 1, _c4) : a.push(_r6, _c4); } for (; a.length && a.peek() < 0;) { if (a.peekValue() > s) return a.clear(), u; if (u.push(-a.pop() - 1), u.length === e) return a.clear(), u; } o = a.pop(); } return a.clear(), u; } }]); return ur; }(); function sr(t, n, e) { return t < n ? n - t : t <= e ? 0 : t - e; } function cr(t, n) { var e = 0, r = n.length - 1; for (; e < r;) { var _i4 = e + r >> 1; n[_i4] > t ? r = _i4 : e = _i4 + 1; } return n[e]; } function hr(t, n, e, r, i) { var o = t[r]; t[r] = t[i], t[i] = o; var a = 4 * r, u = 4 * i, s = n[a], c = n[a + 1], h = n[a + 2], l = n[a + 3]; n[a] = n[u], n[a + 1] = n[u + 1], n[a + 2] = n[u + 2], n[a + 3] = n[u + 3], n[u] = s, n[u + 1] = c, n[u + 2] = h, n[u + 3] = l; var f = e[r]; e[r] = e[i], e[i] = f; } function lr(t, n) { var e = t ^ n, r = 65535 ^ e, i = 65535 ^ (t | n), o = t & (65535 ^ n), a = e | r >> 1, u = e >> 1 ^ e, s = i >> 1 ^ r & o >> 1 ^ i, c = e & i >> 1 ^ o >> 1 ^ o; u = (e = a) & (r = u) >> 2 ^ r & (e ^ r) >> 2, s ^= e & (i = s) >> 2 ^ r & (o = c) >> 2, c ^= r & i >> 2 ^ (e ^ r) & o >> 2, u = (e = a = e & e >> 2 ^ r & r >> 2) & (r = u) >> 4 ^ r & (e ^ r) >> 4, s ^= e & (i = s) >> 4 ^ r & (o = c) >> 4, c ^= r & i >> 4 ^ (e ^ r) & o >> 4, s ^= (e = a = e & e >> 4 ^ r & r >> 4) & (i = s) >> 8 ^ (r = u) & (o = c) >> 8; var h = t ^ n, l = (r = (c ^= r & i >> 8 ^ (e ^ r) & o >> 8) ^ c >> 1) | 65535 ^ (h | (e = s ^ s >> 1)); return ((l = 1431655765 & ((l = 858993459 & ((l = 252645135 & ((l = 16711935 & (l | l << 8)) | l << 4)) | l << 2)) | l << 1)) << 1 | (h = 1431655765 & ((h = 858993459 & ((h = 252645135 & ((h = 16711935 & (h | h << 8)) | h << 4)) | h << 2)) | h << 1))) >>> 0; } e.d(n, "a", function () { return fr; }); var fr = function () { function t() { var n = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; i()(this, t), s()(this, "width", 960), s()(this, "height", 600), s()(this, "handleZoom", function () { n.handleGrab(), n.draw(); }), s()(this, "handleGrab", function () { var t = n.canvasEl, e = F.sourceEvent; 1 !== (e && e.buttons) || n.findUnderCursor(e).length || (t.style.cursor = "grab"); }), s()(this, "handleRelease", function () { n.canvasEl.style.cursor = "default"; }), s()(this, "handleMouseMove", function () { var t = n.canvasEl, e = n.findUnderCursor(F), r = e.length && e[0].properties.url; t.style.cursor = r ? "pointer" : "default"; }), s()(this, "handleMouseClick", function () { var t = n.findUnderCursor(F); if (t.length) { var e = t[0].properties.url; e && window.open(e); } }), s()(this, "draw", function () { var t = n.options, e = n.objIndex, r = n.canvasEl, i = n.data, o = n.ctx, a = n.width, u = n.height, s = n.tree, c = n.geoPath, h = (t.lineSpace, t.lineWidth, t.linePadding, qe(r)); o.save(), n.drawClear(), o.translate(h.x, h.y), o.scale(h.k, h.k), o.lineJoin = "round", o.lineWidth = 1 / h.k; var l = .18 + .82 / h.k; o.strokeStyle = "rgba(0, 0, 0, ".concat(l, ")"), o.beginPath(), c(er(i, i.objects.states, function (t, n) { return t !== n; })), c(Ke(i, i.objects.nation)), o.stroke(); var f = s.search(h.invertX(0), h.invertY(0), h.invertX(a), h.invertY(u)), p = !0, d = !1, v = void 0; try { for (var y, g = f[Symbol.iterator](); !(p = (y = g.next()).done); p = !0) { var m = e[y.value]; if ("comic" === m.properties.kind) { var _ = m.id, w = (z = m.properties.pos).x, x = z.y, b = z.w, E = z.th; n.drawImage(_, w, x, b, E); } } } catch (t) { d = !0, v = t; } finally { try { p || null == g.return || g.return(); } finally { if (d) throw v; } } var M = !0, k = !1, S = void 0; try { for (var N, A = f[Symbol.iterator](); !(M = (N = A.next()).done); M = !0) { var P = e[N.value]; if ("label" === P.properties.kind) { var z, T = P.properties, L = T.color, I = T.name, j = T.caption, O = (w = (z = T.pos).x, x = z.y, b = z.w, z.h), C = z.cw, R = z.ch; z.aw; o.fillStyle = L, o.textBaseline = "top", n.drawText(I, w, x, b, O) && j && n.drawText(j, w, x + O, C, R); } } } catch (t) { k = !0, S = t; } finally { try { M || null == A.return || A.return(); } finally { if (k) throw S; } } o.restore(); }), this.options = e, this.canvasEl = null, this.ctx = null, this.geoPath = null, this.data = null, this.objIndex = null, this.tree = null, this.imgs = new Map(); } return a()(t, [{ key: "create", value: function value() { var t = this.width, n = this.height, e = window.devicePixelRatio, r = this.canvasEl = document.createElement("canvas"); r.width = t * e, r.height = n * e, r.style.width = "".concat(t, "px"), r.style.height = "".concat(n, "px"), r.style.border = "2px solid black", r.style.boxSizing = "border-box", r.title = this.options.title; var i = this.ctx = r.getContext("2d", { alpha: !1 }); return i.scale(e, e), this.drawClear(), this.geoPath = Object(ut.a)().context(i), r; } }, { key: "run", value: function value(t) { this.data = t; var n = this.options.maxZoom, e = t.objects.objs.geometries, r = this.objIndex = [], i = this.tree = new ur(e.length), o = !0, a = !1, u = void 0; try { for (var s, c = e[Symbol.iterator](); !(o = (s = c.next()).done); o = !0) { var h = s.value, l = h.properties.pos, f = l.x, p = l.y, d = l.w, v = l.th; i.add(f, p, f + d, p + v), r.push(h); } } catch (t) { a = !0, u = t; } finally { try { o || null == c.return || c.return(); } finally { if (a) throw u; } } i.finish(), tt(this.canvasEl).call(function () { var t, n, e = Fe, r = Ge, i = He, o = Ve, a = $e, u = [0, 1 / 0], s = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], c = 250, h = Gn, l = [], f = pt("start", "zoom", "end"), p = 500, d = 150, v = 0; function y(t) { t.property("__zoom", De).on("wheel.zoom", E).on("mousedown.zoom", M).on("dblclick.zoom", k).filter(a).on("touchstart.zoom", S).on("touchmove.zoom", N).on("touchend.zoom touchcancel.zoom", A).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } function g(t, n) { return (n = Math.max(u[0], Math.min(u[1], n))) === t.k ? t : new Xe(n, t.x, t.y); } function m(t, n, e) { var r = n[0] - e[0] * t.k, i = n[1] - e[1] * t.k; return r === t.x && i === t.y ? t : new Xe(t.k, r, i); } function _(t) { return [(+t[0][0] + +t[1][0]) / 2, (+t[0][1] + +t[1][1]) / 2]; } function w(t, n, e) { t.on("start.zoom", function () { x(this, arguments).start(); }).on("interrupt.zoom end.zoom", function () { x(this, arguments).end(); }).tween("zoom", function () { var t = arguments, i = x(this, t), o = r.apply(this, t), a = e || _(o), u = Math.max(o[1][0] - o[0][0], o[1][1] - o[0][1]), s = this.__zoom, c = "function" == typeof n ? n.apply(this, t) : n, l = h(s.invert(a).concat(u / s.k), c.invert(a).concat(u / c.k)); return function (t) { if (1 === t) t = c;else { var n = l(t), e = u / n[2]; t = new Xe(e, a[0] - n[0] * e, a[1] - n[1] * e); } i.zoom(null, t); }; }); } function x(t, n) { for (var e, r = 0, i = l.length; r < i; ++r) { if ((e = l[r]).that === t) return e; } return new b(t, n); } function b(t, n) { this.that = t, this.args = n, this.index = -1, this.active = 0, this.extent = r.apply(t, n); } function E() { if (e.apply(this, arguments)) { var t = x(this, arguments), n = this.__zoom, r = Math.max(u[0], Math.min(u[1], n.k * Math.pow(2, o.apply(this, arguments)))), a = ot(this); if (t.wheel) t.mouse[0][0] === a[0] && t.mouse[0][1] === a[1] || (t.mouse[1] = n.invert(t.mouse[0] = a)), clearTimeout(t.wheel);else { if (n.k === r) return; t.mouse = [a, n.invert(a)], Se(this), t.start(); } Be(), t.wheel = setTimeout(function () { t.wheel = null, t.end(); }, d), t.zoom("mouse", i(m(g(n, r), t.mouse[0], t.mouse[1]), t.extent, s)); } } function M() { if (!n && e.apply(this, arguments)) { var t = x(this, arguments), r = tt(F.view).on("mousemove.zoom", function () { if (Be(), !t.moved) { var n = F.clientX - a, e = F.clientY - u; t.moved = n * n + e * e > v; } t.zoom("mouse", i(m(t.that.__zoom, t.mouse[0] = ot(t.that), t.mouse[1]), t.extent, s)); }, !0).on("mouseup.zoom", function () { r.on("mousemove.zoom mouseup.zoom", null), yt(F.view, t.moved), Be(), t.end(); }, !0), o = ot(this), a = F.clientX, u = F.clientY; vt(F.view), Ue(), t.mouse = [o, this.__zoom.invert(o)], Se(this), t.start(); } } function k() { if (e.apply(this, arguments)) { var t = this.__zoom, n = ot(this), o = t.invert(n), a = t.k * (F.shiftKey ? .5 : 2), u = i(m(g(t, a), n, o), r.apply(this, arguments), s); Be(), c > 0 ? tt(this).transition().duration(c).call(w, u, n) : tt(this).call(y.transform, u); } } function S() { if (e.apply(this, arguments)) { var n, r, i, o, a = x(this, arguments), u = F.changedTouches, s = u.length; for (Ue(), r = 0; r < s; ++r) { i = u[r], o = [o = at(this, u, i.identifier), this.__zoom.invert(o), i.identifier], a.touch0 ? a.touch1 || (a.touch1 = o) : (a.touch0 = o, n = !0); } if (t && (t = clearTimeout(t), !a.touch1)) return a.end(), void ((o = tt(this).on("dblclick.zoom")) && o.apply(this, arguments)); n && (t = setTimeout(function () { t = null; }, p), Se(this), a.start()); } } function N() { var n, e, r, o, a = x(this, arguments), u = F.changedTouches, c = u.length; for (Be(), t && (t = clearTimeout(t)), n = 0; n < c; ++n) { e = u[n], r = at(this, u, e.identifier), a.touch0 && a.touch0[2] === e.identifier ? a.touch0[0] = r : a.touch1 && a.touch1[2] === e.identifier && (a.touch1[0] = r); } if (e = a.that.__zoom, a.touch1) { var h = a.touch0[0], l = a.touch0[1], f = a.touch1[0], p = a.touch1[1], d = (d = f[0] - h[0]) * d + (d = f[1] - h[1]) * d, v = (v = p[0] - l[0]) * v + (v = p[1] - l[1]) * v; e = g(e, Math.sqrt(d / v)), r = [(h[0] + f[0]) / 2, (h[1] + f[1]) / 2], o = [(l[0] + p[0]) / 2, (l[1] + p[1]) / 2]; } else { if (!a.touch0) return; r = a.touch0[0], o = a.touch0[1]; } a.zoom("touch", i(m(e, r, o), a.extent, s)); } function A() { var t, e, r = x(this, arguments), i = F.changedTouches, o = i.length; for (Ue(), n && clearTimeout(n), n = setTimeout(function () { n = null; }, p), t = 0; t < o; ++t) { e = i[t], r.touch0 && r.touch0[2] === e.identifier ? delete r.touch0 : r.touch1 && r.touch1[2] === e.identifier && delete r.touch1; } r.touch1 && !r.touch0 && (r.touch0 = r.touch1, delete r.touch1), r.touch0 ? r.touch0[1] = this.__zoom.invert(r.touch0[0]) : r.end(); } return y.transform = function (t, n) { var e = t.selection ? t.selection() : t; e.property("__zoom", De), t !== e ? w(t, n) : e.interrupt().each(function () { x(this, arguments).start().zoom(null, "function" == typeof n ? n.apply(this, arguments) : n).end(); }); }, y.scaleBy = function (t, n) { y.scaleTo(t, function () { return this.__zoom.k * ("function" == typeof n ? n.apply(this, arguments) : n); }); }, y.scaleTo = function (t, n) { y.transform(t, function () { var t = r.apply(this, arguments), e = this.__zoom, o = _(t), a = e.invert(o), u = "function" == typeof n ? n.apply(this, arguments) : n; return i(m(g(e, u), o, a), t, s); }); }, y.translateBy = function (t, n, e) { y.transform(t, function () { return i(this.__zoom.translate("function" == typeof n ? n.apply(this, arguments) : n, "function" == typeof e ? e.apply(this, arguments) : e), r.apply(this, arguments), s); }); }, y.translateTo = function (t, n, e) { y.transform(t, function () { var t = r.apply(this, arguments), o = this.__zoom, a = _(t); return i(Ye.translate(a[0], a[1]).scale(o.k).translate("function" == typeof n ? -n.apply(this, arguments) : -n, "function" == typeof e ? -e.apply(this, arguments) : -e), t, s); }); }, b.prototype = { start: function start() { return 1 == ++this.active && (this.index = l.push(this) - 1, this.emit("start")), this; }, zoom: function zoom(t, n) { return this.mouse && "mouse" !== t && (this.mouse[1] = n.invert(this.mouse[0])), this.touch0 && "touch" !== t && (this.touch0[1] = n.invert(this.touch0[0])), this.touch1 && "touch" !== t && (this.touch1[1] = n.invert(this.touch1[0])), this.that.__zoom = n, this.emit("zoom"), this; }, end: function end() { return 0 == --this.active && (l.splice(this.index, 1), this.index = -1, this.emit("end")), this; }, emit: function emit(t) { H(new function (t, n, e) { this.target = t, this.type = n, this.transform = e; }(y, t, this.that.__zoom), f.apply, f, [t, this.that, this.args]); } }, y.wheelDelta = function (t) { return arguments.length ? (o = "function" == typeof t ? t : Re(+t), y) : o; }, y.filter = function (t) { return arguments.length ? (e = "function" == typeof t ? t : Re(!!t), y) : e; }, y.touchable = function (t) { return arguments.length ? (a = "function" == typeof t ? t : Re(!!t), y) : a; }, y.extent = function (t) { return arguments.length ? (r = "function" == typeof t ? t : Re([[+t[0][0], +t[0][1]], [+t[1][0], +t[1][1]]]), y) : r; }, y.scaleExtent = function (t) { return arguments.length ? (u[0] = +t[0], u[1] = +t[1], y) : [u[0], u[1]]; }, y.translateExtent = function (t) { return arguments.length ? (s[0][0] = +t[0][0], s[1][0] = +t[1][0], s[0][1] = +t[0][1], s[1][1] = +t[1][1], y) : [[s[0][0], s[0][1]], [s[1][0], s[1][1]]]; }, y.constrain = function (t) { return arguments.length ? (i = t, y) : i; }, y.duration = function (t) { return arguments.length ? (c = +t, y) : c; }, y.interpolate = function (t) { return arguments.length ? (h = t, y) : h; }, y.on = function () { var t = f.on.apply(f, arguments); return t === f ? y : t; }, y.clickDistance = function (t) { return arguments.length ? (v = (t = +t) * t, y) : Math.sqrt(v); }, y; }().scaleExtent([1, n]).on("zoom", this.handleZoom).on("start", this.handleGrab).on("end", this.handleRelease)).on("mousemove", this.handleMouseMove).on("click", this.handleMouseClick), this.draw(); } }, { key: "findUnderCursor", value: function value(t) { var n = this.canvasEl, e = this.objIndex, r = this.tree, i = qe(n), o = i.invertX(t.offsetX), a = i.invertY(t.offsetY); return r.search(o, a, o, a).map(function (t) { return e[t]; }); } }, { key: "drawClear", value: function value() { var t = this.ctx, n = this.width, e = this.height; t.fillStyle = "white", t.fillRect(0, 0, n, e); } }, { key: "drawText", value: function value(t, n, e, r, i) { var o = this.canvasEl, a = this.ctx, u = i * qe(o).k; if (u < .25) return !1; if (u > 2.65) { var s = 64 / i; return a.scale(1 / s, 1 / s), a.font = "normal 64px xkcd-Regular-v2", a.fillText(t.toLowerCase(), n * s, e * s), a.scale(s, s), !0; } var c = a.globalAlpha; return a.globalAlpha *= .65, a.fillRect(n, e + i / 3, r, i / 3), a.globalAlpha = c, !0; } }, { key: "getImage", value: function value(t, n) { var e = this.options.baseURL, r = new Image(); return r.onload = n, r.src = "".concat(e, "imgs/").concat(t, ".png"), r; } }, { key: "drawImage", value: function value(t, n, e, r, i) { var o = this.canvasEl, a = this.ctx, u = this.imgs, s = this.options, c = this.draw; s.baseURL; if (!(r * i * qe(o).k < 16)) { var h = u.get(t); if (h || (h = this.getImage(t, c), u.set(t, h)), h.complete) try { a.drawImage(h, n, e, r, i); } catch (n) { console.warn("unable to render img", t, h); } } } }]), t; }(); }, function (t, n, e) { var r = function () { return this || "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self; }() || Function("return this")(), i = r.regeneratorRuntime && Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime") >= 0, o = i && r.regeneratorRuntime; if (r.regeneratorRuntime = void 0, t.exports = e(10), i) r.regeneratorRuntime = o;else try { delete r.regeneratorRuntime; } catch (t) { r.regeneratorRuntime = void 0; } }, function (t, n) { !function (n) { "use strict"; var e, r = Object.prototype, i = r.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, a = o.iterator || "@@iterator", u = o.asyncIterator || "@@asyncIterator", s = o.toStringTag || "@@toStringTag", c = "object" == _typeof(t), h = n.regeneratorRuntime; if (h) c && (t.exports = h);else { (h = n.regeneratorRuntime = c ? t.exports : {}).wrap = w; var l = "suspendedStart", f = "suspendedYield", p = "executing", d = "completed", v = {}, y = {}; y[a] = function () { return this; }; var g = Object.getPrototypeOf, m = g && g(g(T([]))); m && m !== r && i.call(m, a) && (y = m); var _ = M.prototype = b.prototype = Object.create(y); E.prototype = _.constructor = M, M.constructor = E, M[s] = E.displayName = "GeneratorFunction", h.isGeneratorFunction = function (t) { var n = "function" == typeof t && t.constructor; return !!n && (n === E || "GeneratorFunction" === (n.displayName || n.name)); }, h.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, M) : (t.__proto__ = M, s in t || (t[s] = "GeneratorFunction")), t.prototype = Object.create(_), t; }, h.awrap = function (t) { return { __await: t }; }, k(S.prototype), S.prototype[u] = function () { return this; }, h.AsyncIterator = S, h.async = function (t, n, e, r) { var i = new S(w(t, n, e, r)); return h.isGeneratorFunction(n) ? i : i.next().then(function (t) { return t.done ? t.value : i.next(); }); }, k(_), _[s] = "Generator", _[a] = function () { return this; }, _.toString = function () { return "[object Generator]"; }, h.keys = function (t) { var n = []; for (var e in t) { n.push(e); } return n.reverse(), function e() { for (; n.length;) { var r = n.pop(); if (r in t) return e.value = r, e.done = !1, e; } return e.done = !0, e; }; }, h.values = T, z.prototype = { constructor: z, reset: function reset(t) { if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(P), !t) for (var n in this) { "t" === n.charAt(0) && i.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = e); } }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(t) { if (this.done) throw t; var n = this; function r(r, i) { return u.type = "throw", u.arg = t, n.next = r, i && (n.method = "next", n.arg = e), !!i; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var a = this.tryEntries[o], u = a.completion; if ("root" === a.tryLoc) return r("end"); if (a.tryLoc <= this.prev) { var s = i.call(a, "catchLoc"), c = i.call(a, "finallyLoc"); if (s && c) { if (this.prev < a.catchLoc) return r(a.catchLoc, !0); if (this.prev < a.finallyLoc) return r(a.finallyLoc); } else if (s) { if (this.prev < a.catchLoc) return r(a.catchLoc, !0); } else { if (!c) throw new Error("try statement without catch or finally"); if (this.prev < a.finallyLoc) return r(a.finallyLoc); } } } }, abrupt: function abrupt(t, n) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc <= this.prev && i.call(r, "finallyLoc") && this.prev < r.finallyLoc) { var o = r; break; } } o && ("break" === t || "continue" === t) && o.tryLoc <= n && n <= o.finallyLoc && (o = null); var a = o ? o.completion : {}; return a.type = t, a.arg = n, o ? (this.method = "next", this.next = o.finallyLoc, v) : this.complete(a); }, complete: function complete(t, n) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && n && (this.next = n), v; }, finish: function finish(t) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var e = this.tryEntries[n]; if (e.finallyLoc === t) return this.complete(e.completion, e.afterLoc), P(e), v; } }, catch: function _catch(t) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var e = this.tryEntries[n]; if (e.tryLoc === t) { var r = e.completion; if ("throw" === r.type) { var i = r.arg; P(e); } return i; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(t, n, r) { return this.delegate = { iterator: T(t), resultName: n, nextLoc: r }, "next" === this.method && (this.arg = e), v; } }; } function w(t, n, e, r) { var i = n && _instanceof(n.prototype, b) ? n : b, o = Object.create(i.prototype), a = new z(r || []); return o._invoke = function (t, n, e) { var r = l; return function (i, o) { if (r === p) throw new Error("Generator is already running"); if (r === d) { if ("throw" === i) throw o; return L(); } for (e.method = i, e.arg = o;;) { var a = e.delegate; if (a) { var u = N(a, e); if (u) { if (u === v) continue; return u; } } if ("next" === e.method) e.sent = e._sent = e.arg;else if ("throw" === e.method) { if (r === l) throw r = d, e.arg; e.dispatchException(e.arg); } else "return" === e.method && e.abrupt("return", e.arg); r = p; var s = x(t, n, e); if ("normal" === s.type) { if (r = e.done ? d : f, s.arg === v) continue; return { value: s.arg, done: e.done }; } "throw" === s.type && (r = d, e.method = "throw", e.arg = s.arg); } }; }(t, e, a), o; } function x(t, n, e) { try { return { type: "normal", arg: t.call(n, e) }; } catch (t) { return { type: "throw", arg: t }; } } function b() {} function E() {} function M() {} function k(t) { ["next", "throw", "return"].forEach(function (n) { t[n] = function (t) { return this._invoke(n, t); }; }); } function S(t) { var n; this._invoke = function (e, r) { function o() { return new Promise(function (n, o) { !function n(e, r, o, a) { var u = x(t[e], t, r); if ("throw" !== u.type) { var s = u.arg, c = s.value; return c && "object" == _typeof(c) && i.call(c, "__await") ? Promise.resolve(c.__await).then(function (t) { n("next", t, o, a); }, function (t) { n("throw", t, o, a); }) : Promise.resolve(c).then(function (t) { s.value = t, o(s); }, function (t) { return n("throw", t, o, a); }); } a(u.arg); }(e, r, n, o); }); } return n = n ? n.then(o, o) : o(); }; } function N(t, n) { var r = t.iterator[n.method]; if (r === e) { if (n.delegate = null, "throw" === n.method) { if (t.iterator.return && (n.method = "return", n.arg = e, N(t, n), "throw" === n.method)) return v; n.method = "throw", n.arg = new TypeError("The iterator does not provide a 'throw' method"); } return v; } var i = x(r, t.iterator, n.arg); if ("throw" === i.type) return n.method = "throw", n.arg = i.arg, n.delegate = null, v; var o = i.arg; return o ? o.done ? (n[t.resultName] = o.value, n.next = t.nextLoc, "return" !== n.method && (n.method = "next", n.arg = e), n.delegate = null, v) : o : (n.method = "throw", n.arg = new TypeError("iterator result is not an object"), n.delegate = null, v); } function A(t) { var n = { tryLoc: t[0] }; 1 in t && (n.catchLoc = t[1]), 2 in t && (n.finallyLoc = t[2], n.afterLoc = t[3]), this.tryEntries.push(n); } function P(t) { var n = t.completion || {}; n.type = "normal", delete n.arg, t.completion = n; } function z(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(A, this), this.reset(!0); } function T(t) { if (t) { var n = t[a]; if (n) return n.call(t); if ("function" == typeof t.next) return t; if (!isNaN(t.length)) { var r = -1, o = function n() { for (; ++r < t.length;) { if (i.call(t, r)) return n.value = t[r], n.done = !1, n; } return n.value = e, n.done = !0, n; }; return o.next = o; } } return { next: L }; } function L() { return { value: e, done: !0 }; } }(function () { return this || "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self; }() || Function("return this")()); },,,,,,,,,,,,,,,, function (t, n, e) { "use strict"; e.r(n); var r = e(1), i = e.n(r), o = e(2), a = e.n(o), u = e(3), s = e.n(u), c = e(8), h = e(7), l = "/2067/asset/"; function f() { return (f = s()(i.a.mark(function t() { var n, e, r, o, u; return i.a.wrap(function (t) { for (;;) { switch (t.prev = t.next) { case 0: return n = new c.a(a()({}, h.a, { baseURL: l })), e = n.create(), (r = document.getElementById("comic-content")).parentNode.replaceChild(e, r), t.next = 6, fetch("".concat(l, "map-data.json")); case 6: return o = t.sent, t.next = 9, o.json(); case 9: if (u = t.sent, !document.fonts) { t.next = 13; break; } return t.next = 13, document.fonts.load("normal 12px xkcd-Regular-v2"); case 13: n.run(u); case 14: case "end": return t.stop(); } } }, t, this); }))).apply(this, arguments); } document.addEventListener("DOMContentLoaded", function () { return f.apply(this, arguments); }); }]);
29.029777
810
0.434831
277ca634bd9425e566d133de94bc8bdab07fdfec
2,653
js
JavaScript
webroot/js/models/QueryAndModel.js
hari-sk/contrail-web-core
7e16ac9b0f93de9d5806ebac14f6e77b24b6d6cc
[ "Apache-2.0" ]
null
null
null
webroot/js/models/QueryAndModel.js
hari-sk/contrail-web-core
7e16ac9b0f93de9d5806ebac14f6e77b24b6d6cc
[ "Apache-2.0" ]
null
null
null
webroot/js/models/QueryAndModel.js
hari-sk/contrail-web-core
7e16ac9b0f93de9d5806ebac14f6e77b24b6d6cc
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. */ define([ 'underscore', 'backbone', 'knockout', 'contrail-model' ], function (_, Backbone, Knockout, ContrailModel) { var QueryAndModel = ContrailModel.extend({ defaultConfig: { name: '', operator: '=', value : '', suffix_name: '', suffix_operator: '=', suffix_value : '' }, constructor: function (parentModel, modelData) { ContrailModel.prototype.constructor.call(this, modelData); this.parentModel = parentModel; return this; }, validateAttr: function (attributePath, validation, data) { var model = data.model().attributes.model(), attr = cowu.getAttributeFromPath(attributePath), errors = model.get(cowc.KEY_MODEL_ERRORS), attrErrorObj = {}, isValid; isValid = model.isValid(attributePath, validation); attrErrorObj[attr + cowc.ERROR_SUFFIX_ID] = (isValid == true) ? false : isValid; errors.set(attrErrorObj); }, deleteWhereAndClause: function() { var andClauses = this.model().collection, andClause = this.model(); andClauses.remove(andClause); }, getNameOptionList: function(viewModel) { var rootModel = viewModel.parentModel().parentModel.model(), whereDataObject = rootModel.get('where_data_object'); return $.map(whereDataObject['name_option_list'], function(schemaValue, schemaKey) { if(schemaValue.index) { return {id: schemaValue.name, text: schemaValue.name}; } }); }, getSuffixNameOptionList: function(viewModel) { var rootModel = viewModel.parentModel().parentModel.model(), name = viewModel.name(), whereDataObject = rootModel.get('where_data_object'), suffixNameOptionList = []; $.each(whereDataObject['name_option_list'], function(schemaKey, schemaValue) { if(schemaValue.name === name && schemaValue.suffixes !== null) { suffixNameOptionList = $.map(schemaValue.suffixes, function(suffixValue, suffixKey) { return {id: suffixValue, text: suffixValue}; }); return false; } }); return suffixNameOptionList; }, validations: {} }); return QueryAndModel; });
32.353659
105
0.549567
277d2d53b7e4d6bff5f23ec8629225b16dce5f5d
410
js
JavaScript
public/static/api/js/trans/trans_bdxc.js
luoyjx/gaoqi-blog
3e0160e5d962913a068a61bcf49aa77a5a3924f1
[ "MIT" ]
63
2015-08-19T01:36:53.000Z
2020-12-26T13:13:57.000Z
public/static/api/js/trans/trans_bdxc.js
luoyjx/gaoqi-blog
3e0160e5d962913a068a61bcf49aa77a5a3924f1
[ "MIT" ]
134
2015-08-25T14:11:09.000Z
2020-06-02T20:31:40.000Z
public/static/api/js/trans/trans_bdxc.js
luoyjx/gaoqi-blog
3e0160e5d962913a068a61bcf49aa77a5a3924f1
[ "MIT" ]
26
2015-09-09T01:35:59.000Z
2019-06-19T09:18:33.000Z
window._bd_share_main.F.module('trans/trans_bdxc', function (e, t) { var n = function () { var e = window; var t = document; var n = '_bdXC'; var r; e[n] ? window._bdXC_loaded && e[n].reInit() : (r = t.createElement('script'), r.setAttribute('charset', 'utf-8'), r.src = 'http://xiangce.baidu.com/zt/collect/mark.js?' + (new Date()).getTime(), t.getElementsByTagName('head')[0].appendChild(r)) }; t.run = n })
205
409
0.65122
277eb2a77ba6882a0f33062ff8dc3e4e9d93611f
3,014
js
JavaScript
script.js
miptleha/quick-js-ip-info
4edc3beaa2f71c456c51f126a2f7153e548bbd7b
[ "MIT" ]
null
null
null
script.js
miptleha/quick-js-ip-info
4edc3beaa2f71c456c51f126a2f7153e548bbd7b
[ "MIT" ]
null
null
null
script.js
miptleha/quick-js-ip-info
4edc3beaa2f71c456c51f126a2f7153e548bbd7b
[ "MIT" ]
null
null
null
//https://developers.google.com/maps/documentation/javascript/examples/map-latlng-literal?hl=ru#maps_map_latlng_literal-javascript let map; function initMap(lat, lng) { const mapOptions = { zoom: 8, center: { lat: lat, lng: lng }, }; map = new google.maps.Map(document.getElementById("map"), mapOptions); const marker = new google.maps.Marker({ // The below line is equivalent to writing: // position: new google.maps.LatLng(-34.397, 150.644) position: { lat: lat, lng: lng }, map: map, }); // You can use a LatLng literal in place of a google.maps.LatLng object when // creating the Marker object. Once the Marker object is instantiated, its // position will be available as a google.maps.LatLng object. In this case, // we retrieve the marker's position using the // google.maps.LatLng.getPosition() method. const infowindow = new google.maps.InfoWindow({ content: "<p>Marker Location:" + marker.getPosition() + "</p>", }); google.maps.event.addListener(marker, "click", () => { infowindow.open(map, marker); }); } function err(msg) { var e = document.getElementById("error"); e.innerHTML = msg; } $('#check').click(function() { err(''); if (!window.navigator.onLine) { err('Internet connection required!'); return; } var ip = $('#ip').val(); if (!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip)) { err('Invalid IP Address!') return; } $.get("http://free.ipwhois.io/xml/" + ip, function(res) { var xmlDoc = res; var str = new XMLSerializer().serializeToString(xmlDoc.documentElement); console.log(str); var r = new RegExp("<continent>(.*?)</continent>(.*?)<country>(.*?)</country>(.*?)<country_flag>(.*?)</country_flag>(.*?)<region>(.*?)</region>(.*?)<city>(.*?)</city>(.*?)<currency>(.*?)</currency>"); var m = r.exec(str); var continent = '-', country = '-', flag = '-', region='-', city='-', cur='-'; if (m != null) { continent = m[1]; country = m[3]; flag = m[5]; region = m[7]; city = m[9]; cur = m[11]; } else { err('Unknown location!'); } $('#continent').text(continent); $('#country').text(country); $('#flag').attr('src', flag); $('#region').text(region); $('#city').text(city); $('#cur').text(cur); var rorg = new RegExp("<org>(.*?)</org>"); var morg = rorg.exec(str); if (morg != null) { $('#org').text(morg[1]); } else { $('#org').text('-'); } var rloc = new RegExp("<latitude>(.*?)</latitude>(.*?)<longitude>(.*?)</longitude>"); var mloc = rloc.exec(str); if (mloc != null) { var lat = parseFloat(mloc[1]); var lng = parseFloat(mloc[3]); $('#map').css({height: "100%"}); initMap(lat, lng); } else { err('Unknown location!'); $('#map').css({height: "0%"}); } }); });
31.072165
204
0.557067
277f1ed547810a319a1ecb5e3a4a3424b0b695a1
1,284
js
JavaScript
node_modules/bower/lib/util/analytics.js
clapierre/clapierre.github.io
06d4af0dec8f1b3f0481dd54da86e28d20f64eec
[ "BSD-3-Clause" ]
1
2020-02-18T02:17:57.000Z
2020-02-18T02:17:57.000Z
minified/node_modules/bower/lib/util/analytics.js
benetech/forms
798f7ad4a536ea33606d6748a46ab18df14b6e70
[ "BSD-3-Clause" ]
null
null
null
minified/node_modules/bower/lib/util/analytics.js
benetech/forms
798f7ad4a536ea33606d6748a46ab18df14b6e70
[ "BSD-3-Clause" ]
null
null
null
function ensureInsight(){if(!insight){var t=require("insight"),n=require("../../package.json");insight=new t({trackingCode:"UA-43531210-1",packageName:n.name,packageVersion:n.version})}}var Q=require("q"),mout=require("mout"),analytics=module.exports,insight,enableAnalytics=!1;analytics.setup=function(t){var n=Q.defer();return void 0===t.analytics?(ensureInsight(),t.interactive?void 0!==insight.optOut?n.resolve(!insight.optOut):insight.askPermission(null,function(t,i){n.resolve(i)}):n.resolve(!1)):n.resolve(t.analytics),n.promise.then(function(t){return enableAnalytics=t,t})};var Tracker=analytics.Tracker=function(t){function n(){return t&&void 0!==t.analytics?t.analytics:enableAnalytics}n()?ensureInsight():(this.track=function(){},this.trackDecomposedEndpoints=function(){},this.trackPackages=function(){},this.trackNames=function(){})};Tracker.prototype.track=function(){insight.track.apply(insight,arguments)},Tracker.prototype.trackDecomposedEndpoints=function(t,n){n.forEach(function(n){this.track(t,n.source,n.target)}.bind(this))},Tracker.prototype.trackPackages=function(t,n){mout.object.forOwn(n,function(n){var i=n.pkgMeta;this.track(t,i.name,i.version)}.bind(this))},Tracker.prototype.trackNames=function(t,n){n.forEach(function(n){this.track(t,n)}.bind(this))};
642
1,283
0.770249
277f6209a061bf222ae25cdaa2689a44cfdc3165
7,847
js
JavaScript
appengine/maze/generated/sk/soy.js
blocklypar/blocklypar
67481ef28e3bc8c28aab99dd9119ae421b5da917
[ "Apache-2.0" ]
null
null
null
appengine/maze/generated/sk/soy.js
blocklypar/blocklypar
67481ef28e3bc8c28aab99dd9119ae421b5da917
[ "Apache-2.0" ]
4
2019-12-03T02:02:51.000Z
2019-12-05T14:53:21.000Z
tasks/generated/sk/soy.js
blocklypar/blocklypar.github.io
f92b263016d7f6095c3236229a8e6755061d09e8
[ "Apache-2.0" ]
null
null
null
// This file was automatically generated from template.soy. // Please don't edit this file by hand. /** * @fileoverview Templates in namespace Maze.soy. */ goog.provide('Maze.soy'); goog.require('soy'); goog.require('soydata'); goog.require('BlocklyGames.soy'); Maze.soy.messages = function(opt_data, opt_ignored, opt_ijData) { return BlocklyGames.soy.messages(null, null, opt_ijData) + '<div style="display: none"><span id="Maze_moveForward">cho\u010F dopredu</span><span id="Maze_turnLeft">oto\u010D sa v\u013Eavo</span><span id="Maze_turnRight">oto\u010D sa vpravo</span><span id="Maze_doCode">urob</span><span id="Maze_elseCode">inak</span><span id="Maze_helpIfElse">Pr\u00EDkaz ak-inak urob\u00ED bu\u010F jedno alebo druh\u00E9.</span><span id="Maze_pathAhead">ak je cesta pred</span><span id="Maze_pathLeft">ak je cesta v\u013Eavo</span><span id="Maze_pathRight">ak je cesta vpravo</span><span id="Maze_repeatUntil">opakuj k\u00FDm nebude</span><span id="Maze_moveForwardTooltip">Posun hr\u00E1\u010Da o jednu d\u013A\u017Eku dopredu.</span><span id="Maze_turnTooltip">Oto\u010Denie hr\u00E1\u010Da o 90\u00B0 v\u013Eavo \u010Di vpravo.</span><span id="Maze_ifTooltip">Ak je t\u00FDm smerom cesta, vykonaj pr\u00EDkazy.</span><span id="Maze_ifelseTooltip">Ak je t\u00FDm smerom cesta, vykonaj prv\u00FD blok pr\u00EDkazov.\\nInak vykonaj druh\u00FD blok pr\u00EDkazov.</span><span id="Maze_whileTooltip">Opakuj pr\u00EDkazy vo vn\u00FAtri bloku, \\na\u017E k\u00FDm nepr\u00EDde\u0161 do cie\u013Ea. </span><span id="Maze_capacity0">Zostalo ti %0 blokov.</span><span id="Maze_capacity1">M\u00E1\u0161 u\u017E iba %1 blok.</span><span id="Maze_capacity2">Zostalo ti e\u0161te %2 blokov.</span></div>'; }; if (goog.DEBUG) { Maze.soy.messages.soyTemplateName = 'Maze.soy.messages'; } Maze.soy.start = function(opt_data, opt_ignored, opt_ijData) { return Maze.soy.messages(null, null, opt_ijData) + '<table width="100%"><tr><td><h1>' + BlocklyGames.soy.titleSpan({appName: 'Bludisko'}, null, opt_ijData) + BlocklyGames.soy.levelLinks({level: opt_ijData.level, maxLevel: opt_ijData.maxLevel, lang: opt_ijData.lang, suffix: '&skin=' + soy.$$escapeHtml(opt_ijData.skin)}, null, opt_ijData) + '</h1></td><td class="farSide"><select id="languageMenu"></select>&nbsp;<button id="linkButton" title="Ulo\u017Ei\u0165 a zdie\u013Ea\u0165 odkaz na tento program."><img src="common/1x1.gif" class="link icon21"></button>&nbsp;<button id="pegmanButton"><img src="common/1x1.gif"><span id="pegmanButtonArrow"></span></button></td></tr></table><div id="visualization"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svgMaze" width="400px" height="400px"><g id="look"><path d="M 0,-15 a 15 15 0 0 1 15 15" /><path d="M 0,-35 a 35 35 0 0 1 35 35" /><path d="M 0,-55 a 55 55 0 0 1 55 55" /></g></svg><div id="capacityBubble"><div id="capacity"></div></div></div><table width="400"><tr><td style="width: 190px; text-align: center; vertical-align: top;"><td><button id="runButton" class="primary" title="Postavi\u010Dka vykon\u00E1 to, \u010Do je nap\u00EDsan\u00E9 na bloku."><img src="common/1x1.gif" class="run icon21"> Spusti\u0165</button><button id="resetButton" class="primary" style="display: none" title="Presun\u00FA\u0165 hr\u00E1\u010Da sp\u00E4\u0165 na za\u010Diatok bludiska."><img src="common/1x1.gif" class="stop icon21"> Odznova</button></td></tr></table>' + Maze.soy.toolbox(null, null, opt_ijData) + '<div id="blockly"></div><div id="pegmanMenu"></div>' + BlocklyGames.soy.dialog(null, null, opt_ijData) + BlocklyGames.soy.doneDialog(null, null, opt_ijData) + BlocklyGames.soy.abortDialog(null, null, opt_ijData) + BlocklyGames.soy.storageDialog(null, null, opt_ijData) + ((opt_ijData.level == 1) ? '<div id="dialogHelpStack" class="dialogHiddenContent"><table><tr><td><img src="common/help.png"></td><td>&nbsp;</td><td>Program je postupnos\u0165 blokov. Posp\u00E1jaj nieko\u013Eko blokov \'vpred\' a pom\u00F4\u017E mi d\u00F4js\u0165 do cie\u013Ea.</td><td valign="top"><img src="maze/help_stack.png" class="mirrorImg" height=63 width=136></td></tr></table></div><div id="dialogHelpOneTopBlock" class="dialogHiddenContent"><table><tr><td><img src="common/help.png"></td><td>&nbsp;</td><td>V tejto \u00FArovni m\u00E1\u0161 na bielej ploche posklada\u0165 v\u0161etky diely sklada\u010Dky.<div id="sampleOneTopBlock" class="readonly"></div></td></tr></table></div><div id="dialogHelpRun" class="dialogHiddenContent"><table><tr><td>Spusti svoj program a uvid\u00ED\u0161, \u010Do sa stane.</td><td rowspan=2><img src="common/help.png"></td></tr><tr><td><div><img src="maze/help_run.png" class="mirrorImg" height=27 width=141></div></td></tr></table></div>' : (opt_ijData.level == 2) ? '<div id="dialogHelpReset" class="dialogHiddenContent"><table><tr><td>Tvoj program nepre\u0161iel cez bludisko. Stla\u010D "Obnovi\u0165" a sk\u00FAs to znova.</td><td rowspan=2><img src="common/help.png"></td></tr><tr><td><div><img src="maze/help_run.png" class="mirrorImg" height=27 width=141></div></td></tr></table></div>' : (opt_ijData.level == 3 || opt_ijData.level == 4) ? ((opt_ijData.level == 3) ? '<div id="dialogHelpRepeat" class="dialogHiddenContent"><table><tr><td><img src="maze/help_up.png"></td><td>Dosiahni cie\u013E pou\u017Eit\u00EDm len dvoch blokov. Na zopakovanie bloku pou\u017Ei blok \'opakuj\'.</td><td><img src="common/help.png"></td></tr></table></div>' : '') + '<div id="dialogHelpCapacity" class="dialogHiddenContent"><table><tr><td><img src="common/help.png"></td><td>&nbsp;</td><td>Vyu\u017Eil si v\u0161etky bloky dostupn\u00E9 v tejto \u00FArovni. Ak chce\u0161 nov\u00FD blok, odstr\u00E1\u0148 najprv nejak\u00FD existuj\u00FAci.</td></tr></table></div><div id="dialogHelpRepeatMany" class="dialogHiddenContent"><table><tr><td><img src="maze/help_up.png"></td><td>Do opakovacieho bloku m\u00F4\u017Ee\u0161 umiestni\u0165 aj viac ako jeden blok.</td><td><img src="common/help.png"></td></tr></table></div>' : (opt_ijData.level == 5) ? '<div id="dialogHelpSkins" class="dialogHiddenContent"><table><tr><td><img src="common/help.png"></td><td width="95%">Zvo\u013E si svojho ob\u013E\u00FAben\u00E9ho hr\u00E1\u010Da z ponuky.</td><td><img src="maze/help_up.png"></td></tr></table></div><div id="dialogHelpIf" class="dialogHiddenContent"><table><tr><td><img src="maze/help_up.png"></td><td>Rozhodovac\u00ED blok \'ak\' urob\u00ED nie\u010Do len v pr\u00EDpade, \u017Ee je splnen\u00E1 podmienka. Sk\u00FAs oto\u010Denie v\u013Eavo, ak je cesta na\u013Eavo.</td><td><img src="common/help.png"></td></tr></table></div><div id="dialogHelpWallFollow" class="dialogHiddenContent"><table><tr><td><img src="common/help.png"></td><td>&nbsp;</td><td>Zvl\u00E1dne\u0161 aj toto komplikovan\u00E9 bludisko?\nSk\u00FAs \u00EDs\u0165 popri \u013Eavej stene. Len pre pokro\u010Dil\u00FDch program\u00E1torov!' + BlocklyGames.soy.ok(null, null, opt_ijData) + '</td></tr></table></div><div id="dialogHelpMenu" class="dialogHiddenContent"><table><tr><td><img src="maze/help_up.png"></td><td id="helpMenuText">Klikni na %1 v rozhodovacom bloku a nastav podmienku.</td><td><img src="common/help.png"></td></tr></table></div>' : ''); }; if (goog.DEBUG) { Maze.soy.start.soyTemplateName = 'Maze.soy.start'; } Maze.soy.toolbox = function(opt_data, opt_ignored, opt_ijData) { return '<xml id="toolbox" style="display: none;" xmlns="https://developers.google.com/blockly/xml"><block type="maze_moveForward"></block><block type="maze_turn"><field name="DIR">turnLeft</field></block><block type="maze_turn"><field name="DIR">turnRight</field></block>' + ((opt_ijData.level > 2) ? '<block type="maze_forever"></block>' + ((opt_ijData.level > 4) ? '<block type="maze_if"><field name="DIR">isPathLeft</field></block>' : '') : '') + '</xml>'; }; if (goog.DEBUG) { Maze.soy.toolbox.soyTemplateName = 'Maze.soy.toolbox'; }
212.081081
5,297
0.719511
277f6a75f72133560cf6bbb1cdfad95b3d3bdf2d
358
js
JavaScript
api/models/transaction.js
JonatanGarbuyo/gresos
ad5c1c4208a3cf8eab79240bc15a1b892f5f2dbe
[ "MIT" ]
null
null
null
api/models/transaction.js
JonatanGarbuyo/gresos
ad5c1c4208a3cf8eab79240bc15a1b892f5f2dbe
[ "MIT" ]
null
null
null
api/models/transaction.js
JonatanGarbuyo/gresos
ad5c1c4208a3cf8eab79240bc15a1b892f5f2dbe
[ "MIT" ]
null
null
null
import * as Yup from "yup"; export const transactionSchema = Yup.object({ date: Yup.date().required().label("Date"), concept: Yup.string().min(3).required().max(64).label("Concept"), category_id: Yup.number().required().label("Category_id"), type: Yup.string().required().max(8).label("Type"), amount: Yup.number().required().label("Amount"), });
35.8
67
0.670391
2782a476cdb292289bf5eacb9b17dc2d56630290
3,027
js
JavaScript
src/components/Home.js
MiguelSombrero/bottlestash-app-frontend
999291959aadba40c0730c5d7addc94bc943af38
[ "0BSD" ]
null
null
null
src/components/Home.js
MiguelSombrero/bottlestash-app-frontend
999291959aadba40c0730c5d7addc94bc943af38
[ "0BSD" ]
1
2021-10-06T01:38:15.000Z
2021-10-06T01:38:15.000Z
src/components/Home.js
MiguelSombrero/bottlestash-app-frontend
999291959aadba40c0730c5d7addc94bc943af38
[ "0BSD" ]
null
null
null
import React from 'react' import { Jumbotron, Row, Col, Container, ListGroup } from 'react-bootstrap' import { NavLink } from 'react-router-dom' import ResourceFeed from './ResourceFeed' const Home = (props) => { const byAdded = (a, b) => b.added > a.added ? 1 : -1 const byHidden = b => !b.user.hidden const bottlesToShow = props.bottles.filter(byHidden).sort(byAdded) const ratingsToShow = props.ratings.sort(byAdded) const showToLoggedUser = () => { return ( <> <Row> <Col className='maindiv'> <h2 style={{ color: 'white', textShadow: '2px 2px 5px black' }}>Recently added bottles</h2> </Col> </Row> <ResourceFeed resources={bottlesToShow} resource='bottle' /> <Row> <Col className='maindiv'> <h2 style={{ color: 'white', textShadow: '2px 2px 5px black' }}>Recently added ratings</h2> </Col> </Row> <ResourceFeed resources={ratingsToShow} resource='rating' /> </> ) } const showToVisitor = () => { return ( <> <Row> <Col className='maindiv' style={{ backgroundColor: 'rgb(245, 245, 245)' }} > <section> <h2 className='mb-3'>Bottlestash, eh?</h2> <h6 className='mb-4'> That's right mate! Bottlestash is an app which lets you keep track of your beer cellar. Because lets face it; you like beer. So do I - it's allright! </h6> <h6> With Bottlestash you can manage your beer cellar, so you can easily track what beers you have, how many bottles and when to drink them! </h6> </section> </Col> </Row> <Row> <Col className='maindiv' style={{ backgroundColor: 'rgb(245, 245, 245)' }}> <h2 className='mb-3'>Main features:</h2> <ListGroup variant='flush'> <ListGroup.Item><h6>Save bottles to your stash</h6></ListGroup.Item> <ListGroup.Item><h6>Keep track of your beers expiration and drink them before</h6></ListGroup.Item> <ListGroup.Item><h6>Rate beers you drink</h6></ListGroup.Item> <ListGroup.Item><h6>Peek other user's cellars and see what beers they have</h6></ListGroup.Item> </ListGroup> </Col> </Row> <Row> <Col className='maindiv' style={{ backgroundColor: 'rgb(245, 245, 245)' }}> <h6 className='mb-2'>Register now - it's free!</h6> <NavLink to='/register'>To registration</NavLink> </Col> </Row> </> ) } return ( <Container fluid className='home'> <Row> <Jumbotron as={Col} className='text-center'> <h1>Bottlestash</h1> <h5>Cooler than your wine cellar - wetter than Finnish summer</h5> <h6>(or something similar)</h6> </Jumbotron> </Row> {props.user ? showToLoggedUser() : showToVisitor() } </Container> ) } export default Home
32.902174
113
0.565576
2782e4a3a117d8536ffd9e7d30371b2c11d19702
1,108
js
JavaScript
app/middlewares/errors.js
wolox-training/jc-express-js
b2a905b62167c7cb3782efbb636c82249d571a9d
[ "MIT" ]
null
null
null
app/middlewares/errors.js
wolox-training/jc-express-js
b2a905b62167c7cb3782efbb636c82249d571a9d
[ "MIT" ]
2
2021-02-03T20:26:08.000Z
2021-02-09T16:59:28.000Z
app/middlewares/errors.js
wolox-training/jc-express-js
b2a905b62167c7cb3782efbb636c82249d571a9d
[ "MIT" ]
null
null
null
const httpStatusCodes = require('http-status-codes'); const errors = require('../errors'); const logger = require('../logger'); const DEFAULT_STATUS_CODE = 500; // Check status codes here: https://www.npmjs.com/package/http-status-codes const statusCodes = { // 4.x.x [errors.EXTERNAL_API_ERROR]: httpStatusCodes.BAD_GATEWAY, [errors.VALIDATION_ERROR]: httpStatusCodes.UNPROCESSABLE_ENTITY, [errors.MISSING_DATA_ERROR]: httpStatusCodes.BAD_REQUEST, [errors.UNIQUE_ENTITY_ERROR]: httpStatusCodes.UNPROCESSABLE_ENTITY, // 5.x.x [errors.DEFAULT_ERROR]: httpStatusCodes.INTERNAL_SERVER_ERROR, [errors.DATABASE_ERROR]: httpStatusCodes.SERVICE_UNAVAILABLE, [errors.ENCRYPTION_ERROR]: httpStatusCodes.INTERNAL_SERVER_ERROR }; exports.handle = (error, req, res, next) => { if (error.internalCode) res.status(statusCodes[error.internalCode] || DEFAULT_STATUS_CODE); else { // Unrecognized error, notifying it to rollbar. next(error); res.status(DEFAULT_STATUS_CODE); } logger.error(error); return res.send({ message: error.message, internal_code: error.internalCode }); };
35.741935
93
0.758123
278342320689c98d5bef6cb43d3a822c494ca532
1,361
js
JavaScript
PGMWeb/src/main/webapp/js/erp/lib/ERPPrint.js
yufeng1982/PGMS
c05e9ce62c2706632a4e0723e94150e575bef0ac
[ "MIT" ]
null
null
null
PGMWeb/src/main/webapp/js/erp/lib/ERPPrint.js
yufeng1982/PGMS
c05e9ce62c2706632a4e0723e94150e575bef0ac
[ "MIT" ]
4
2019-11-14T13:09:23.000Z
2022-01-21T23:25:58.000Z
PGMWeb/src/main/webapp/js/erp/lib/ERPPrint.js
yufeng1982/PGMS
c05e9ce62c2706632a4e0723e94150e575bef0ac
[ "MIT" ]
null
null
null
Ext.define('ERP.Print' ,{ args : null, id : null, printerStore : null, label : null, constructor : function(config) { Ext.apply(this , config); }, buildPrintMenu : function() { var _printMenu = new Ext.menu.Menu(); var arg; if (this.args.length == 1) return {items: this.buildItems(this.args[0])}; for (var i = 0; i < this.args.length; i++) { arg = this.args[i]; _printMenu.add({ id: arg.id, text: arg.text, iconCls : "ss_icon ss_page_gear", menu: {items: this.buildItems(arg)} }); } return _printMenu; }, buildItems : function(arg) { var items = this._buildPrintMenuItem(arg); return items; }, handleView : function(arg, isFromList) { }, _buildPrintMenuItem : function(arg) { var me = this; return [{ id : arg.id + '_view', iconCls : 'ss_sprite ss_accept', text : "View", handler: function() { } }, { id : arg.id + '_print', iconCls : 'ss_sprite ss_accept', text : "Print", scope: me, handler : function() { } }]; }, createPrintBtn : function() { return new ERP.Button({ id : 'printBtn', text : this.label || PRes["report"], iconCls : 'ss_sprite ss_accept', menu : this.buildPrintMenu(false) }); } });
20.621212
50
0.540779
27836feb5a9e54ab518c01046f0bd0ac37dc1c56
610
js
JavaScript
works/burger/burger.js
rainbowbo/rainbowbo.github.io
38e86beafe7aaadfdfd9945de87205a05e81ddc9
[ "MIT" ]
11
2015-04-28T03:22:13.000Z
2019-09-09T02:53:56.000Z
works/burger/burger.js
rainbowbo/rainbowbo.github.io
38e86beafe7aaadfdfd9945de87205a05e81ddc9
[ "MIT" ]
1
2015-09-07T09:45:31.000Z
2015-09-07T10:13:49.000Z
works/burger/burger.js
rainbowbo/rainbowbo.github.io
38e86beafe7aaadfdfd9945de87205a05e81ddc9
[ "MIT" ]
4
2015-07-10T11:33:53.000Z
2019-09-09T02:53:56.000Z
$(document).ready(function () { var animateBurger = function(){ $('.animated').addClass('fadeInDown'); setTimeout(function(){ $('.loading').addClass('fadeOutDown'); console.log("3000"); },3000); setTimeout(function(){ $('.animated').removeClass('fadeInDown'); $('.loading').removeClass('fadeOutDown'); console.log("2500"); }, 2500); setTimeout(function(){ animateBurger(); console.log("2510"); }, 2510); } setTimeout(function(){ animateBurger(); console.log("10"); },10); });
24.4
49
0.52623
2783e42fa965b07276481f14a7e5c99049517e87
1,565
js
JavaScript
lib/send-error-alert.js
lblod/delta-producer-report-generator
5b585d01948fffce86c5fa153c9b30feb86369bf
[ "MIT" ]
null
null
null
lib/send-error-alert.js
lblod/delta-producer-report-generator
5b585d01948fffce86c5fa153c9b30feb86369bf
[ "MIT" ]
1
2021-10-20T13:56:54.000Z
2021-10-20T13:56:54.000Z
lib/send-error-alert.js
lblod/delta-producer-report-generator
5b585d01948fffce86c5fa153c9b30feb86369bf
[ "MIT" ]
null
null
null
import { uuid, sparqlEscapeUri, sparqlEscapeString, sparqlEscapeDateTime } from 'mu'; import { updateSudo as update } from '@lblod/mu-auth-sudo'; import { CREATOR } from './constants'; export default async function sendErrorAlert({subject = 'Delta Report Generator', message, detail, reference} = {}) { if (!message) { throw 'ErrorAlert at least needs a message describing what went wrong.'; } const id = uuid(); const uri = `http://data.lblod.info/errors/${id}`; const q = ` PREFIX mu: <http://mu.semte.ch/vocabularies/core/> PREFIX oslc: <http://open-services.net/ns/core#> PREFIX dct: <http://purl.org/dc/terms/> INSERT DATA { GRAPH <http://mu.semte.ch/graphs/error> { ${sparqlEscapeUri(uri)} a oslc:Error ; mu:uuid ${sparqlEscapeString(id)} ; dct:subject ${sparqlEscapeString(subject)} ; oslc:message ${sparqlEscapeString(message)} ; ${reference ? `dct:references ${sparqlEscapeUri(reference)} ;` : ''} ${detail ? `oslc:largePreview ${sparqlEscapeString(detail)} ;` : ''} dct:created ${sparqlEscapeDateTime(new Date().toISOString())} ; dct:creator ${sparqlEscapeUri(CREATOR)} . } } `.trim(); try { await update(q); console.log(`Successfully sent out an error-alert.\nMessage: ${message}`); } catch (e) { console.warn(`[WARN] Something went wrong while trying to store an error-alert.\nMessage: ${e}\nQuery: ${q}`); } }
40.128205
117
0.6
27855d0accc37281ebc4d61728d333e2075623f3
80
js
JavaScript
flow/command-line-args.js
porenes-ledger/ledger-live-common
407acad56ccdcec404514044f1649b0eec50b7c5
[ "Apache-2.0" ]
1
2020-03-24T16:26:51.000Z
2020-03-24T16:26:51.000Z
flow/command-line-args.js
porenes-ledger/ledger-live-common
407acad56ccdcec404514044f1649b0eec50b7c5
[ "Apache-2.0" ]
37
2019-12-24T09:52:13.000Z
2020-01-02T17:21:09.000Z
flow/command-line-args.js
porenes-ledger/ledger-live-common
407acad56ccdcec404514044f1649b0eec50b7c5
[ "Apache-2.0" ]
2
2020-07-20T04:44:06.000Z
2020-10-20T09:31:31.000Z
// @flow declare module "command-line-args" { declare module.exports: any; }
13.333333
36
0.6875
278567445c8e41dbc1d7ed4f5adfc3faf6026ba1
123
js
JavaScript
src/types/RangeFilterValue.js
kswain1/LZCoderSearch
8c97484216a2250bb0a56e4556057be2702b5607
[ "MIT" ]
null
null
null
src/types/RangeFilterValue.js
kswain1/LZCoderSearch
8c97484216a2250bb0a56e4556057be2702b5607
[ "MIT" ]
null
null
null
src/types/RangeFilterValue.js
kswain1/LZCoderSearch
8c97484216a2250bb0a56e4556057be2702b5607
[ "MIT" ]
null
null
null
import PropTypes from "prop-types"; export default PropTypes.shape({ from: PropTypes.string, to: PropTypes.string });
17.571429
35
0.739837
27858680d5d834f016db63efee309ab3ef93940e
3,638
js
JavaScript
src/app/global-navigation/global-navigation.js
dhknudsen/Space-Switcher
906eefd9700a6668a2c79dec36d6d45e23b36baa
[ "MIT" ]
null
null
null
src/app/global-navigation/global-navigation.js
dhknudsen/Space-Switcher
906eefd9700a6668a2c79dec36d6d45e23b36baa
[ "MIT" ]
null
null
null
src/app/global-navigation/global-navigation.js
dhknudsen/Space-Switcher
906eefd9700a6668a2c79dec36d6d45e23b36baa
[ "MIT" ]
null
null
null
$(function(){ ///////////////////////////// // COMPONENT CONFIGURATION // ///////////////////////////// var ComponentName = 'GlobalNavigation'; // UI Component namespace Podio.UI.GlobalNavigation = { Config: {}, Views: {}, Session: {}, Constants: {} }; Podio.Vent = Podio.Vent || _.extend({}, Backbone.Events); // Shorthand Alias var Comp = Podio.UI[ComponentName]; // Constants Comp.Constants = { VIEWPORT_RESIZE: 'viewport:resize', OPEN_DROP: 'nav:menuOpen', DROPDOWN_BTN_CLASS: 'js-dropdown', DROPDOWN_OPEN_CLASS: 'dropdown--open', DROPDOWN_BOX_CLASS: 'dropdown__box' }; // ------------------------------------------------------------ / /////////////////////////// // Main View(Controller) // /////////////////////////// // AppView Comp.Views.MainView = Backbone.View.extend({ /* Harverst user input from the search field to trigger the list filtering */ events: { "click li.js-dropdown": "toggle" }, initialize: function () { this.$drops = $('.'+Comp.Constants.DROPDOWN_BTN_CLASS); }, /** * set current state between all drops on page * @param {Event} e - click event triggered on nav item */ setDrops: function (item){ this.$drops.each(function(index, el){ var $el = $(el); if(item && item.is($el)){ $(el).addClass(Comp.Constants.DROPDOWN_OPEN_CLASS); } else { $(el).removeClass(Comp.Constants.DROPDOWN_OPEN_CLASS); } }); }, /** * Ensures that menu dropdowns open and close as intended * @param {Event} e - click event triggered on nav item */ toggle : function (e) { if(e.target){ e.stopPropagation(); var $item = (e.target.tagName === 'A') ? $(e.target).parent() : $(e.target); var $dropdown = $item.find('.'+ Comp.Constants.DROPDOWN_BOX_CLASS); var isOpen = $item.hasClass(Comp.Constants.DROPDOWN_OPEN_CLASS); if(isOpen) { this.setDrops(); $dropdown.off('click.dd--close'); } else { this.setDrops($item); Podio.Vent.trigger(Comp.Constants.VIEWPORT_RESIZE); Podio.Vent.trigger(Comp.Constants.OPEN_DROP, { uuid: $dropdown.data('comp-uuid') }); $('html').one('click.dd--close', function(){ $item.click(); }); $dropdown.on('click.dd--close', function(event){ event.stopPropagation(); }); } } } }); var userSettings = { // Override default settings here }; Comp.Config.Settings = _.extend({}, Comp.Config.Defaults, userSettings); // Session INIT Comp.Session.Main = new Comp.Views.MainView({ el: '.header-global' }); // ------------------------------------------------------------ / });
31.634783
108
0.412864
2785aaeb89d0004628634ac617a5459232502639
4,520
js
JavaScript
src/services/rabbitmq/initialize.js
IIP-Design/content-commons-server
8c8949a98defac8de97479a110547e7de52cbb98
[ "MIT" ]
1
2021-12-21T19:12:56.000Z
2021-12-21T19:12:56.000Z
src/services/rabbitmq/initialize.js
IIP-Design/content-commons-server
8c8949a98defac8de97479a110547e7de52cbb98
[ "MIT" ]
34
2019-04-15T12:15:21.000Z
2022-02-12T05:59:40.000Z
src/services/rabbitmq/initialize.js
IIP-Design/content-commons-server
8c8949a98defac8de97479a110547e7de52cbb98
[ "MIT" ]
1
2020-02-04T17:34:40.000Z
2020-02-04T17:34:40.000Z
import amqp from 'amqplib'; // import { AMQPPubSub } from 'graphql-amqp-subscriptions'; // RabbitMQ connection string let messageQueueConnectionString = `amqp://${process.env.RABBITMQ_DOMAIN}:${process.env.RABBITMQ_PORT}`; if ( process.env.RABBITMQ_VHOST ) { messageQueueConnectionString = `${messageQueueConnectionString}/%2F${process.env.RABBITMQ_VHOST}`; } let consumerConnection = null; let publisherConnection = null; let _consumerChannel = null; let _publishChannel = null; const connect = async () => amqp.connect( messageQueueConnectionString ); const handleConnectionEvents = connection => { // handle connection closed connection.on( 'close', () => console.log( 'Connection has been closed' ) ); // handle errors connection.on( 'error', err => console.log( `Error: Connection error: ${err.toString()}` ) ); }; // Create separate connections for publisher and consumer export const getConnection = async type => { if ( type === 'consumer' ) { if ( consumerConnection ) { return consumerConnection; } consumerConnection = await connect(); return consumerConnection; } if ( publisherConnection ) { return publisherConnection; } publisherConnection = await connect(); return publisherConnection; }; // Use separaye publich and consumer channels for each thread (should we only be using 1 channel?) export const getPublishChannel = async () => { if ( _publishChannel ) { return _publishChannel; } const connection = await getConnection( 'publish' ) .catch( err => '[getPublishChannel] Unable to connect to RabbitMQ' ); if ( connection ) { handleConnectionEvents( connection ); _publishChannel = await connection.createConfirmChannel(); return _publishChannel; } }; // Use separaye publish and consumer channels for each thread (should we only be using 1 channel?) export const getConsumerChannel = async () => { if ( _consumerChannel ) { return _consumerChannel; } const connection = await getConnection( 'consumer' ) .catch( err => '[getConsumerChannel] Unable to connect to RabbitMQ' ); if ( connection ) { handleConnectionEvents( connection ); _consumerChannel = await connection.createChannel(); return _consumerChannel; } }; const setUpExchanges = async channel => { await Promise.all( [ channel.assertExchange( 'publish', 'topic', { durable: true } ), channel.assertExchange( 'publish.dlx', 'fanout', { durable: true } ), channel.assertExchange( 'util', 'topic', { durable: true } ), ] ); }; const setUpQueues = async channel => { await Promise.all( [ channel.assertQueue( 'publish.create', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'publish.update', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'publish.delete', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'publish.result', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'util.process', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'util.result', { durable: true, deadLetterExchange: 'publish.dlx' } ), channel.assertQueue( 'publish.dlq', { durable: true } ), ] ); }; const bindExhangesToQueues = async channel => { // channel.bindQueue( '[queueName], [exchange], [key]) await Promise.all( [ channel.bindQueue( 'publish.create', 'publish', 'create.*' ), channel.bindQueue( 'publish.update', 'publish', 'update.*' ), channel.bindQueue( 'publish.delete', 'publish', 'delete.*' ), channel.bindQueue( 'publish.result', 'publish', 'result.*.*' ), channel.bindQueue( 'util.process', 'util', 'convert.document' ), channel.bindQueue( 'util.result', 'util', 'convert.result' ), channel.bindQueue( 'publish.dlq', 'publish.dlx' ), ] ); }; const initalize = async () => { console.log( 'Setting up RabbitMQ Exchanges/Queues' ); // connect to RabbitMQ Instance const connection = await connect(); // create a channel const channel = await connection.createChannel(); // create exchange await setUpExchanges( channel ); // create queues await setUpQueues( channel ); // bind queues - a message goes to the queues whose binding key exactly matches the routing key of the message await bindExhangesToQueues( channel ); await channel.close(); await connection.close(); console.log( 'RabbitMQ initialization Complete' ); return true; }; export default initalize;
32.517986
112
0.695133
278704795953f3ef74096a855731690419a722a2
211
js
JavaScript
src/components/app-icon/index.js
kriskuiper/frontend-applications
70d16fe2c47519f7655cb03bb4f428eca45fbda6
[ "MIT" ]
null
null
null
src/components/app-icon/index.js
kriskuiper/frontend-applications
70d16fe2c47519f7655cb03bb4f428eca45fbda6
[ "MIT" ]
36
2019-10-15T20:08:14.000Z
2019-10-31T19:52:54.000Z
src/components/app-icon/index.js
kriskuiper/frontend-applications
70d16fe2c47519f7655cb03bb4f428eca45fbda6
[ "MIT" ]
null
null
null
import { h } from 'preact'; import style from './style.css'; const AppIcon = ({ icon }) => ( <img class={style['app-icon']} src={`../../assets/icons/${icon}.svg`} alt="" /> ); export default AppIcon;
15.071429
40
0.56872
278795eecee724170e6afe8aee76ae13d8188e34
1,707
js
JavaScript
test.js
shinnn/gh-verified-public-keys
d37c04075d2a2ceebe8cbfe4b78983e3782d3f2c
[ "MIT" ]
null
null
null
test.js
shinnn/gh-verified-public-keys
d37c04075d2a2ceebe8cbfe4b78983e3782d3f2c
[ "MIT" ]
null
null
null
test.js
shinnn/gh-verified-public-keys
d37c04075d2a2ceebe8cbfe4b78983e3782d3f2c
[ "MIT" ]
null
null
null
'use strict'; const ghVerifiedPublicKeys = require('.'); const test = require('tape'); process.env.GITHB_TOKEN = ''; test('ghVerifiedPublicKeys()', t => { t.plan(7); t.strictEqual(ghVerifiedPublicKeys.name, 'ghVerifiedPublicKeys', 'should have a function name.'); ghVerifiedPublicKeys('isaacs', {token: process.env.TOKEN_FOR_TEST}).then(keys => { t.ok( Array.isArray(keys), 'should be resolved with an array.' ); t.deepEqual( Object.keys(keys[0]), ['id', 'key'], 'should be resolved with an array of objects with `id` and `key` properties.' ); }).catch(t.fail); ghVerifiedPublicKeys('y'.repeat(99)).then(t.fail, err => { t.strictEqual( err.message, `404 Not Found (The github account with the usename "${'y'.repeat(99)}" is not found)`, 'should fail when it cannot find the specified user.' ); }).catch(t.fail); ghVerifiedPublicKeys('shinnn', {token: 'invalid_token'}).then(t.fail, err => { t.strictEqual( err.message, '401 Unauthorized (Bad credentials)', 'should fail when it takes an invalid Github token.' ); }).catch(t.fail); ghVerifiedPublicKeys(1).then(t.fail, err => { t.strictEqual( err.message, '1 is not a string. Expected a string of Github username, ' + 'for example https://github.com/shinnn -> \'shinnn\'', 'should fail when the first argument is not a string.' ); }).catch(t.fail); ghVerifiedPublicKeys('').then(t.fail, err => { t.strictEqual( err.message, 'Expected a Github username, but received an empty string.', 'should fail when the first argument is an empty string.' ); }).catch(t.fail); });
28.932203
99
0.62976
2787bc5c48eaeb3c16f37f2f92b6176dfbe4cbaa
191
js
JavaScript
server-side/src/app/routes/auth.route.js
leonardograndi/api-jokenpo
9d3970a71af477aefc683109d5c04f847f782d76
[ "MIT" ]
null
null
null
server-side/src/app/routes/auth.route.js
leonardograndi/api-jokenpo
9d3970a71af477aefc683109d5c04f847f782d76
[ "MIT" ]
null
null
null
server-side/src/app/routes/auth.route.js
leonardograndi/api-jokenpo
9d3970a71af477aefc683109d5c04f847f782d76
[ "MIT" ]
null
null
null
import express from 'express'; // import { findOne } from '../controllers'; const router = express.Router(); // router.post('/', findOne); module.exports = app => app.use('/auth', router)
21.222222
48
0.65445
278994135fde11492e2d302b5c5f3ba2ef922933
1,119
js
JavaScript
app/model/Plan.js
aricks/DMPplanner4DLCC
5557e2ec5048df595962232a0de30a3180f6e57a
[ "Unlicense" ]
2
2021-11-12T21:32:17.000Z
2022-02-01T19:47:02.000Z
app/model/Plan.js
aricks/DMPplanner4DLCC
5557e2ec5048df595962232a0de30a3180f6e57a
[ "Unlicense" ]
null
null
null
app/model/Plan.js
aricks/DMPplanner4DLCC
5557e2ec5048df595962232a0de30a3180f6e57a
[ "Unlicense" ]
8
2016-12-17T22:19:18.000Z
2021-11-12T21:32:21.000Z
Ext.define('DMPlanner.model.Plan', { extend: 'Ext.ux.data.DeepModel', requires: [// 'Ext.data.association.HasMany', // 'Ext.ux.data.DeepJsonWriter', // 'Ext.ux.data.DeepModel'// ], uses: ['DMPlanner.model.Section'], associations: [{ type: 'hasMany', model: 'DMPlanner.model.Section', primaryKey: 'id', foreignKey: 'planId', autoLoad: true, associationKey: 'sections', name: 'sections', storeConfig: { storeId: 'Sections' } }], proxy: { type: 'memory', reader: { type: 'json' } }, clearFilters: true, fields: [{ name: 'id' }, { name: 'version' }, { name: 'name' }, { name: 'code' }, { name: 'homeDoc', defaultValue: 'Home.md' }, { name: 'helpDoc', defaultValue: 'Help.md' }, { name: 'docBase', defaultValue: null }, { name: 'levels', type: 'auto' }, { name: 'defaultLevel', defaultValue: 0 }] });
19.982143
41
0.460232
278a61f7a31bbaa51c21b72e1eddefc942be8663
450
js
JavaScript
src/api/axiosApi.js
gaspardzul/front-quotes
ed3a268b89657398f36862f3c8d6638e25f82abd
[ "MIT" ]
1
2022-02-01T00:13:51.000Z
2022-02-01T00:13:51.000Z
src/api/axiosApi.js
gaspardzul/front-quotes
ed3a268b89657398f36862f3c8d6638e25f82abd
[ "MIT" ]
null
null
null
src/api/axiosApi.js
gaspardzul/front-quotes
ed3a268b89657398f36862f3c8d6638e25f82abd
[ "MIT" ]
null
null
null
import axios from "axios"; export const urlBase = 'http://localhost:1337' export const config = { baseURL: urlBase, // baseURL: domainApi, headers: { "Content-Type": "application/json" }, }; export const axiosApi = axios.create(config); axiosApi.urlBase = urlBase; axiosApi.interceptors.response.use( async function (config) { return config; }, function (error) { return Promise.reject(error); } ); export default axiosApi;
19.565217
50
0.695556
278a69485cdda3f77d994257f8e026e554c62466
408
js
JavaScript
src/app/utils/CreateKeyPress.js
UpBeet/trench
af86fc5429bcf3dec3c10e23b19b31d56b9d4104
[ "MIT" ]
1
2017-11-12T19:30:31.000Z
2017-11-12T19:30:31.000Z
src/app/utils/CreateKeyPress.js
UpBeet/trench
af86fc5429bcf3dec3c10e23b19b31d56b9d4104
[ "MIT" ]
3
2017-11-12T19:31:28.000Z
2017-11-14T05:29:22.000Z
src/app/utils/CreateKeyPress.js
UpBeet/trench
af86fc5429bcf3dec3c10e23b19b31d56b9d4104
[ "MIT" ]
null
null
null
import xs from 'xstream'; import { propEq } from 'ramda'; function createKeyPress(key, keyDown$, keyUp$) { const isKey = propEq('key', key); const thisKeyDown$ = keyDown$ .filter(isKey) .mapTo(true); const thisKeyUp$ = keyUp$ .filter(isKey) .mapTo(false); const keyState$ = xs.merge(thisKeyDown$, thisKeyUp$).startWith(false); return keyState$; } export default createKeyPress;
21.473684
72
0.678922
278b503d5d837ec08f96e94cc7ec6fd7d7aeab33
940
js
JavaScript
demo.js
bigdatacloudapi/nodejs-api-client
1c256eb098f817538d456f62cec566143e742b52
[ "MIT" ]
14
2019-04-17T15:30:21.000Z
2022-03-26T13:41:26.000Z
demo.js
bigdatacloudapi/nodejs-api-client
1c256eb098f817538d456f62cec566143e742b52
[ "MIT" ]
1
2020-09-19T13:32:54.000Z
2021-07-25T05:40:17.000Z
demo.js
bigdatacloudapi/nodejs-api-client
1c256eb098f817538d456f62cec566143e742b52
[ "MIT" ]
8
2019-04-23T20:40:44.000Z
2022-03-02T20:29:57.000Z
const client = require('./index')('XXX'); // XXX being your api key found at: https://www.bigdatacloud.net/customer/account /* * All api endpoints can be accessed via magic methods in the following camelised format: * method | endpoint * For example: an asynchronous "GET" call to the "ip-geolocation-full" endpoint would be: client.getIpGeolocationFull(); * All endpoints return a promise */ //Asynchronous example using 'then': client .getIpGeolocationFull({ip:'8.8.8.8'}) .then(jsonResult => { console.log('Asynchronous "then" result:',jsonResult); }).catch(exception => { console.log(exception); }); //Asynchronous example using 'await': (async () => { try { var jsonResult = await client.getIpGeolocationFull({ip:'8.8.8.8'}); console.log('Asynchronous "await" result:',jsonResult); } catch (error) { console.error('Asynchronous "await" error:', error); } })();
34.814815
124
0.662766
278cf398623907b335dc523ea73dbe83b3cab9ea
111
js
JavaScript
src/reducers/index.js
ozlongblack/h2
7d1212c7ec1eb233672b6f2905834fc9dc15df29
[ "MIT" ]
1
2019-01-11T05:57:30.000Z
2019-01-11T05:57:30.000Z
src/reducers/index.js
ozlongblack/h2
7d1212c7ec1eb233672b6f2905834fc9dc15df29
[ "MIT" ]
null
null
null
src/reducers/index.js
ozlongblack/h2
7d1212c7ec1eb233672b6f2905834fc9dc15df29
[ "MIT" ]
null
null
null
// @flow import i18n from './i18n/i18n'; import list from './list/list'; export default { i18n, list, };
11.1
31
0.621622
278e4c0d40aa5f84cf88246cec800986589d20bc
181
js
JavaScript
src/redux/sagas/index.js
NassirHenchiri/TrackMedds-UI
0d638f7ff52de3dcbd4733716a79c898338e5d2c
[ "MIT" ]
null
null
null
src/redux/sagas/index.js
NassirHenchiri/TrackMedds-UI
0d638f7ff52de3dcbd4733716a79c898338e5d2c
[ "MIT" ]
null
null
null
src/redux/sagas/index.js
NassirHenchiri/TrackMedds-UI
0d638f7ff52de3dcbd4733716a79c898338e5d2c
[ "MIT" ]
null
null
null
import { all, fork } from "redux-saga/effects"; // import user from "./user"; import getItems from "./getItem"; export default function* root() { yield all([fork(getItems)]); }
20.111111
47
0.668508
278e794cd4b715a2deffaaf6b6adb98a36cceb0b
2,351
js
JavaScript
src/cms/preview-templates/HomePagePreview.js
jsjophlin/hoytberenyi
67755b62bd9451494cca5905f31cd72175a00d1f
[ "MIT" ]
null
null
null
src/cms/preview-templates/HomePagePreview.js
jsjophlin/hoytberenyi
67755b62bd9451494cca5905f31cd72175a00d1f
[ "MIT" ]
null
null
null
src/cms/preview-templates/HomePagePreview.js
jsjophlin/hoytberenyi
67755b62bd9451494cca5905f31cd72175a00d1f
[ "MIT" ]
null
null
null
import React from "react"; import PropTypes from "prop-types"; import HomePageTemplate from "../../components/HomePageTemplate"; const HomePagePreview = ({ entry, getAsset }) => { const entryHeroCarousel = entry.getIn(["data", "hero_carousel"]); const heroCarousel = entryHeroCarousel ? entryHeroCarousel.toJS() : []; const entryHero = entry.getIn(["data", "hero"]); const hero = entryHero ? entryHero.toJS() : []; const entryAboutSection = entry.getIn(["data", "about_section"]); const aboutSection = entryAboutSection ? entryAboutSection.toJS() : []; const entryOurTeamSection = entry.getIn(["data", "our_team_section"]); const ourTeamSection = entryOurTeamSection ? entryOurTeamSection.toJS() : []; const entrySecondaryHero = entry.getIn(["data", "secondary_hero"]); const secondaryHero = entrySecondaryHero ? entrySecondaryHero.toJS() : []; const entryOurProcessSection = entry.getIn(["data", "our_process_section"]); const ourProcessSection = entryOurProcessSection ? entryOurProcessSection.toJS() : []; const entryOurServicesSection = entry.getIn(["data", "our_services_section"]); const ourServicesSection = entryOurServicesSection ? entryOurServicesSection.toJS() : []; const entryTertiaryHero = entry.getIn(["data", "tertiary_hero"]); const tertiaryHero = entryTertiaryHero ? entryTertiaryHero.toJS() : []; const entryProjectSection = entry.getIn(["data", "projects_section"]); const projectSection = entryProjectSection ? entryProjectSection.toJS() : []; const entryAvatar = entry.getIn(["data", "avatar"]); const avatar = entryAvatar ? entryAvatar.toJS() : []; return ( <HomePageTemplate title={entry.getIn(["data", "title"])} meta_title={entry.getIn(["data", "meta_title"])} meta_description={entry.getIn(["data", "meta_description"])} heroCarousel={heroCarousel} hero={hero} aboutSection={aboutSection} ourTeamSection={ourTeamSection} secondaryHero={secondaryHero} ourProcessSection={ourProcessSection} ourServicesSection={ourServicesSection} tertiaryHero={tertiaryHero} projectSection={projectSection} avatar={avatar} /> ); }; HomePagePreview.propTypes = { entry: PropTypes.shape({ getIn: PropTypes.func }), getAsset: PropTypes.func }; export default HomePagePreview;
35.089552
80
0.708209
278eaca9b7c21d94c60fc2f0832e8c99ffc77b3e
1,460
js
JavaScript
src/navigation/bottomNav/BottomNav.js
Elijahscriptdev/ribbon
5ad45c54c4b549b40d477993359ff46f12640e17
[ "MIT" ]
null
null
null
src/navigation/bottomNav/BottomNav.js
Elijahscriptdev/ribbon
5ad45c54c4b549b40d477993359ff46f12640e17
[ "MIT" ]
null
null
null
src/navigation/bottomNav/BottomNav.js
Elijahscriptdev/ribbon
5ad45c54c4b549b40d477993359ff46f12640e17
[ "MIT" ]
null
null
null
import React from "react"; import "./BottomNav.css"; import { BsHouseDoorFill } from "react-icons/bs"; import { GiWallet } from "react-icons/gi"; import { SiMarketo } from "react-icons/si"; import { NavLink } from "react-router-dom"; const BottomNav = () => { return ( <div className='bottom-nav'> <ul> <li> <NavLink to='/' activeClassName='active'> <div className='icon'> <BsHouseDoorFill /> </div> <div>Home</div> </NavLink> </li> <li> <NavLink to='/activity' activeClassName='active'> <div className='icon'> <GiWallet /> </div> <div>Activity</div> </NavLink> </li> <li> <NavLink to='/wallet' activeClassName='active'> <div className='icon'> <GiWallet /> </div> <div>Wallet</div> </NavLink> </li> <li> <NavLink to='/market' activeClassName='active'> <div className='icon'> <SiMarketo /> </div> <div>Market</div> </NavLink> </li> <li> <NavLink to='/earn' activeClassName='active'> <div className='icon'> <GiWallet /> </div> <div>Earn</div> </NavLink> </li> </ul> </div> ); }; export default BottomNav;
24.745763
59
0.456849
2791288b7158b41359819cb6266caafee85dea0a
6,629
js
JavaScript
test/rules.js
dwhitacre/dynamic-twitch-bot
121843fabcd388c3dca14e4d7b724156d0f6b07d
[ "Apache-2.0" ]
3
2018-11-24T22:38:00.000Z
2020-10-27T22:28:44.000Z
test/rules.js
dwhitacre/easy-twitch-bot
a5deb8939f1a1b0efc2933ec2b0ac9b547b59a8a
[ "Apache-2.0" ]
16
2018-11-25T00:07:10.000Z
2018-12-08T17:47:24.000Z
test/rules.js
dwhitacre/dynamic-twitch-bot
121843fabcd388c3dca14e4d7b724156d0f6b07d
[ "Apache-2.0" ]
null
null
null
const { expect } = require('chai'); const sinon = require('sinon'); const Rule = require('../src/rules/rule'); const Rules = require('../src/rules/rules'); describe('rules', () => { describe('.constructor', () => { it('should create the rules', () => { const rules = new Rules(); expect(rules).to.exist; expect(rules._rules).to.exist; }); }); describe('.add', () => { let rules; beforeEach(() => { rules = new Rules(); }); it('should throw an err if the ruleDef doesnt match schema', () => { expect(() => rules.add({})).to.throw(); }); it('should throw an err if the rule already exists', () => { rules._rules.push(new Rule({ name: 'test', handler: async () => {} })); expect(() => rules.add({ name: 'test', handler: async () => {} })).to.throw(); }); it('should add the rule if it has no aliases', () => { rules.add({ name: 'test', handler: async () => {} }); const rule = rules._rules.pop(); expect(rule.name).to.equal('test'); expect(rule.isAlias).to.be.false; }); it('should add the rule and alias rules if it has aliases', () => { rules.add({ name: 'test', aliases: ['t', 'e'], handler: async () => {} }); expect(rules._rules).to.have.length(3); let foundRule = false; let foundTAlias = false; let foundEAlias = false; rules._rules.forEach(rule => { if (rule.name === 'test') { foundRule = true; expect(rule.isAlias).to.be.false; } else if (rule.name === 't') { foundTAlias = true; expect(rule.isAlias).to.be.true; expect(rule.aliasTo).to.equal('test'); } else if (rule.name === 'e') { foundEAlias = true; expect(rule.isAlias).to.be.true; expect(rule.aliasTo).to.equal('test'); } }); expect(foundRule).to.be.true; expect(foundTAlias).to.be.true; expect(foundEAlias).to.be.true; }); }); describe('.get', () => { let rules; beforeEach(() => { rules = new Rules(); }); it('should return undefined if not rule is found', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); expect(rules.get('test')).to.be.undefined; }); it('should return the rule if the rule is found', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); const rule = rules.get('findme'); expect(rule).to.exist; expect(rule.name).to.equal('findme'); expect(rule.isAlias).to.be.false; }); it('should return the alias if the alias is found', () => { rules._rules.push(new Rule({ name: 'findme', aliases: ['f'], handler: async () => {} })); rules._rules.push(new Rule({ name: 'f', isAlias: true, aliasTo: 'findme', handler: async () => {} })); const rule = rules.get('f'); expect(rule).to.exist; expect(rule.name).to.equal('f'); expect(rule.isAlias).to.be.true; }); }); describe('.rm', () => { let rules; beforeEach(() => { rules = new Rules(); }); it('should do nothing if the rule doesnt exist', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); rules.rm('test'); expect(rules._rules).to.have.length(1); }); it('should remove the rule if it has no aliases', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); rules.rm('findme'); expect(rules._rules).to.have.length(0); }); it('should remove the rule and its aliases if it has some', () => { rules._rules.push(new Rule({ name: 'findme', aliases: ['f', 'i'], handler: async () => {} })); rules._rules.push(new Rule({ name: 'f', isAlias: true, aliasTo: 'findme', handler: async () => {} })); rules._rules.push(new Rule({ name: 'i', isAlias: true, aliasTo: 'findme', handler: async () => {} })); rules.rm('findme'); expect(rules._rules).to.have.length(0); }); it('should remove the alias and its pointer in its parent rule', () => { rules._rules.push(new Rule({ name: 'findme', aliases: ['f'], handler: async () => {} })); rules._rules.push(new Rule({ name: 'f', isAlias: true, aliasTo: 'findme', handler: async () => {} })); rules.rm('f'); expect(rules._rules).to.have.length(1); const rule = rules._rules.pop(); expect(rule.aliases).to.have.length(0); }); }); describe('.edit', () => { let rules; beforeEach(() => { rules = new Rules(); }); it('should throw err if the rule doesnt exist', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); expect(() => rules.edit({ name: 'test' })).to.throw(); }); it('should throw err if the rule is an alias', () => { rules._rules.push(new Rule({ name: 'findme', aliases: ['f'], handler: async () => {} })); rules._rules.push(new Rule({ name: 'f', isAlias: true, aliasTo: 'findme', handler: async () => {} })); expect(() => rules.edit({ name: 'f' })).to.throw(); }); it('should merge the new def with the existing def and create a new rule', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); rules.edit({ name: 'findme', flags: [ 'newflag' ] }); const rule = rules._rules.pop(); expect(rule.flags).to.have.length(1); expect(rule.flags[0]).to.equal('newflag'); }); it('should throw err if the new def merged with existing def doesnt match schema', () => { rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); expect(() => rules.edit({ name: 'findme', enabled: 'wow' })).to.throw(); }); }); describe('.clear', () => { it('should remove all the rules', () => { const rules = new Rules(); rules._rules.push(new Rule({ name: 'findme', handler: async () => {} })); rules.clear(); expect(rules._rules).to.have.length(0); }); }); });
28.947598
94
0.494041
279190dec3f47b0251922e14972779aed86c84d0
6,414
js
JavaScript
test/repo-test.js
dignifiedquire/js-ipfs-repo
f0d708c1c52ff9775e35d0d209094d2a7c9e923e
[ "MIT" ]
null
null
null
test/repo-test.js
dignifiedquire/js-ipfs-repo
f0d708c1c52ff9775e35d0d209094d2a7c9e923e
[ "MIT" ]
null
null
null
test/repo-test.js
dignifiedquire/js-ipfs-repo
f0d708c1c52ff9775e35d0d209094d2a7c9e923e
[ "MIT" ]
null
null
null
/* eslint-env mocha */ 'use strict' const expect = require('chai').expect const base58 = require('bs58') const bl = require('bl') const fs = require('fs') const join = require('path').join const fileA = fs.readFileSync(join(__dirname, 'test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data')) const fileAExt = fs.readFileSync(join(__dirname, 'test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.ext')) module.exports = function (repo) { describe('IPFS Repo Tests', function () { it('check if Repo exists', (done) => { repo.exists((err, exists) => { expect(err).to.not.exist expect(exists).to.equal(true) done() }) }) describe('locks', () => { it('lock, unlock', (done) => { repo.locks.lock((err) => { expect(err).to.not.exist repo.locks.unlock((err) => { expect(err).to.not.exist done() }) }) }) it('lock, lock', (done) => { repo.locks.lock((err) => { expect(err).to.not.exist repo.locks.lock((err) => { expect(err).to.not.exist repo.locks.unlock((err) => { expect(err).to.not.exist done() }) }) setTimeout(() => { repo.locks.unlock((err) => { expect(err).to.not.exist }) }, 500) }) }) }) describe('keys', () => { it('get PrivKey', (done) => { repo.keys.get((err, privKey) => { expect(err).to.not.exist expect(privKey).to.be.a('string') done() }) }) }) describe('config', () => { it('get config', (done) => { repo.config.get((err, config) => { expect(err).to.not.exist expect(config).to.be.a('object') done() }) }) it('set config', (done) => { repo.config.set({a: 'b'}, (err) => { expect(err).to.not.exist repo.config.get((err, config) => { expect(err).to.not.exist expect(config).to.deep.equal({a: 'b'}) done() }) }) }) }) describe('version', () => { it('get version', (done) => { repo.version.get((err, version) => { expect(err).to.not.exist expect(version).to.be.a('string') expect(Number(version)).to.be.a('number') done() }) }) it('set version', (done) => { repo.version.set('9000', (err) => { expect(err).to.not.exist repo.version.get((err, version) => { expect(err).to.not.exist expect(version).to.equal('9000') done() }) }) }) }) describe('datastore', function () { const baseFileHash = 'QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe' const baseExtFileHash = 'QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe' it('reads block', function (done) { const buf = new Buffer(base58.decode(baseFileHash)) repo.datastore.createReadStream(buf) .pipe(bl((err, data) => { expect(err).to.not.exist expect(data.equals(fileA)).to.equal(true) done() })) }) it('reads block, with custom extension', function (done) { const buf = new Buffer(base58.decode(baseFileHash)) repo.datastore.createReadStream(buf, 'ext') .pipe(bl((err, data) => { expect(err).to.not.exist expect(data.equals(fileAExt)).to.equal(true) done() })) }) it('write a block', function (done) { const rnd = 'QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVtesthash' const mh = new Buffer(base58.decode(rnd)) const data = new Buffer('Oh the data') repo.datastore.createWriteStream(mh, (err, metadata) => { expect(err).to.not.exist expect(metadata.key).to.equal('12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07605f55537ce990.data') done() }).end(data) }) it('write a block with custom extension', function (done) { const rnd = 'QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVtesthash' const mh = new Buffer(base58.decode(rnd)) const data = new Buffer('Oh the data') repo.datastore.createWriteStream(mh, 'ext', (err, metadata) => { expect(err).to.not.exist expect(metadata.key).to.equal('12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07605f55537ce990.ext') done() }).end(data) }) it('block exists', function (done) { const buf = new Buffer(base58.decode(baseFileHash)) repo.datastore.exists(buf, (err, exists) => { expect(err).to.not.exist expect(exists).to.equal(true) done() }) }) it('block exists, with custom extension', function (done) { const buf = new Buffer(base58.decode(baseExtFileHash)) repo.datastore.exists(buf, 'ext', (err, exists) => { expect(err).to.not.exist expect(exists).to.equal(true) done() }) }) it('check for non existent block', function (done) { const buf = new Buffer('random buffer') repo.datastore.exists(buf, (err, exists) => { expect(err).to.not.exist expect(exists).to.equal(false) done() }) }) it('remove a block', function (done) { const buf = new Buffer(base58.decode(baseFileHash)) repo.datastore.remove(buf, (err) => { expect(err).to.not.exist repo.datastore.exists(buf, (err, exists) => { expect(err).to.not.exist expect(exists).to.equal(false) done() }) }) }) it('remove a block, with custom extension', function (done) { const buf = new Buffer(base58.decode(baseExtFileHash)) repo.datastore.remove(buf, 'ext', (err) => { expect(err).to.not.exist repo.datastore.exists(buf, 'ext', (err, exists) => { expect(err).to.not.exist expect(exists).to.equal(false) done() }) }) }) }) describe('datastore-legacy', () => {}) }) }
29.832558
151
0.53508
2791ac4b57bd5c9d722d9fcacf9ea35312efb94b
1,625
js
JavaScript
tests/components/Entry/Entry.spec.js
developerdu/ascvd-risk-calculator
636dbad605f4dc19a1811c94d3bb40c442256b16
[ "Apache-2.0" ]
47
2017-04-11T17:02:37.000Z
2022-03-08T07:56:30.000Z
tests/components/Entry/Entry.spec.js
developerdu/ascvd-risk-calculator
636dbad605f4dc19a1811c94d3bb40c442256b16
[ "Apache-2.0" ]
17
2017-05-26T14:57:53.000Z
2022-02-10T16:08:17.000Z
tests/components/Entry/Entry.spec.js
developerdu/ascvd-risk-calculator
636dbad605f4dc19a1811c94d3bb40c442256b16
[ "Apache-2.0" ]
44
2017-05-03T00:11:02.000Z
2022-01-18T20:47:05.000Z
jest.mock('../../../app/load_fhir_data'); import React from 'react'; import chai from 'chai'; import chaiEnzyme from 'chai-enzyme'; import { shallowWithIntl, mountWithIntl } from '../../helpers/intl-enzyme-test-helper'; import Entry from '../../../components/Entry/entry'; import App from '../../../components/App/index'; import ErrorContainer from '../../../components/Error/index'; describe('<Entry />', () => { let wrapper; chai.use(chaiEnzyme()); beforeEach(() => { wrapper = shallowWithIntl(<Entry displayErrorScreen={false} />); }); it('should have props', () => { const wrap = mountWithIntl(<Entry displayErrorScreen={false} />); expect(wrap.props('displayErrorScreen')).toBeDefined(); }); it('should have state', () => { expect(wrapper.state('locale')).toBeDefined(); }); describe('when displayErrorScreen prop is set to false', () => { it('should contain a IntlProvider and App component', () => { expect(wrapper.find(App)).toHaveLength(1); }); }); describe('when displayErrorScreen prop is set to true', () => { it('should contain a IntlProvider and an ErrorContainer component', () => { wrapper = shallowWithIntl(<Entry displayErrorScreen />); expect(wrapper.find(ErrorContainer)).toHaveLength(1); }); }); it('should change locale state if another language is specified', () => { const wrap = mountWithIntl(<Entry />); wrap.find('.settings').simulate('click'); wrap.find('input[name="locales"]').at(0).simulate('change', {'target': {'value': 'en-us'}}) expect(wrap.state('locale')).toEqual('en-us'); }); });
31.25
95
0.64
279252df9ee171710b37829ca253b99abda8efe0
1,488
js
JavaScript
example/public/base-lib/@types/bitclave-base/repository/models/OfferPrice.js
Winger1994/base-client-js
77699102acfc413a374b6a469b2368c99e7932b3
[ "MIT" ]
null
null
null
example/public/base-lib/@types/bitclave-base/repository/models/OfferPrice.js
Winger1994/base-client-js
77699102acfc413a374b6a469b2368c99e7932b3
[ "MIT" ]
null
null
null
example/public/base-lib/@types/bitclave-base/repository/models/OfferPrice.js
Winger1994/base-client-js
77699102acfc413a374b6a469b2368c99e7932b3
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var OfferPrice = /** @class */ (function () { function OfferPrice(id, description, worth, rules) { if (id === void 0) { id = 0; } if (description === void 0) { description = ''; } if (worth === void 0) { worth = ''; } if (rules === void 0) { rules = new Array(); } this.id = id; this.description = description; this.worth = worth; this.rules = rules; } OfferPrice.prototype.toJson = function () { var str = JSON.stringify(this); var obj = JSON.parse(str); obj.rules = this.rules && this.rules.map(function (e) { return e.toJson(); }); return obj; }; OfferPrice.prototype.isRelevant = function (data) { return this.rules && this.rules.length && this.rules.every(function (priceRule) { var value = data.get(priceRule.rulesKey); return (value && priceRule.isValid(value)) ? true : false; }) ? true : false; }; OfferPrice.prototype.getFieldsForAcception = function (accessRight) { var fields = new Map(); if (this.rules && this.rules.length > 0) { this.rules.forEach(function (element) { fields.set(element.rulesKey, accessRight); }); } return fields; }; return OfferPrice; }()); exports.OfferPrice = OfferPrice; //# sourceMappingURL=OfferPrice.js.map
37.2
89
0.563172
2793f2e8d6237757aa299269816ce55f6e7d8520
1,166
js
JavaScript
webpack/webpack.common.js
theremintourette/d3-starter-template
8dc14b9f64b4be943df7b4683bd351dd93df8a8d
[ "MIT" ]
null
null
null
webpack/webpack.common.js
theremintourette/d3-starter-template
8dc14b9f64b4be943df7b4683bd351dd93df8a8d
[ "MIT" ]
5
2021-03-09T04:21:13.000Z
2022-02-26T11:00:38.000Z
webpack/webpack.common.js
theremintourette/d3-starter-template
8dc14b9f64b4be943df7b4683bd351dd93df8a8d
[ "MIT" ]
null
null
null
const path = require('path'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const config = require('./config'); module.exports = { entry: { app: `${config.srcPath}/js/index.js`, }, output: { path: config.buildPath, filename: 'js/[name].js', }, optimization: { splitChunks: { chunks: 'all', name: false, }, }, plugins: [ new CleanWebpackPlugin(), new CopyWebpackPlugin([ { from: config.publicPath, to: 'public' }, ]), new HtmlWebpackPlugin({ template: `${config.srcPath}/index.html`, }), ], resolve: { alias: { '~': path.resolve(__dirname, '../src'), }, }, module: { rules: [ { test: /\.mjs$/, include: /node_modules/, type: 'javascript/auto', }, { test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, use: { loader: 'file-loader', options: { name: '[path][name].[ext]', }, }, }, ], }, };
20.821429
81
0.524014
27946a181c9f5a5870b5bcbd303675fd9d4b46a8
2,892
js
JavaScript
test/aria/widgets/wai/popup/dialog/modal/PopupDialogModalJawsTestCase.js
fbasso/ariatemplates
7012e1aa79e1eca2d700024642b7f6ea32048d33
[ "Apache-2.0" ]
37
2015-01-13T15:30:57.000Z
2021-11-18T08:38:20.000Z
test/aria/widgets/wai/popup/dialog/modal/PopupDialogModalJawsTestCase.js
fbasso/ariatemplates
7012e1aa79e1eca2d700024642b7f6ea32048d33
[ "Apache-2.0" ]
431
2015-01-06T13:43:30.000Z
2022-02-26T01:45:56.000Z
test/aria/widgets/wai/popup/dialog/modal/PopupDialogModalJawsTestCase.js
fbasso/ariatemplates
7012e1aa79e1eca2d700024642b7f6ea32048d33
[ "Apache-2.0" ]
26
2015-08-06T09:11:55.000Z
2021-07-02T09:16:53.000Z
/* * Copyright 2016 Amadeus s.a.s. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Aria = require('ariatemplates/Aria'); var Model = require('./Model'); module.exports = Aria.classDefinition({ $classpath : 'test.aria.widgets.wai.popup.dialog.modal.PopupDialogModalJawsTestCase', $extends : require('ariatemplates/jsunit/JawsTestCase'), $constructor : function () { this.$JawsTestCase.constructor.call(this); this.setTestEnv({ template : 'test.aria.widgets.wai.popup.dialog.modal.Tpl', data : Model.buildData() }); }, $prototype : { skipClearHistory : true, runTemplateTest : function () { var data = this.templateCtxt.data; var actions = []; function labelToJawsSay(label) { return label.replace(/\(/g, ' left paren ').replace(/\)/g, ' right paren '); } function processDialog(dialog) { if (!dialog.wai) { return; } actions.push( ['click', this.getElementById(dialog.elementBeforeId)], ['waitForJawsToSay', 'Element before'], ['type', null, '[tab]'], ['waitForJawsToSay', labelToJawsSay(dialog.buttonLabel) + ' Button'], ['type', null, '[enter]'], ['waitForJawsToSay', labelToJawsSay(dialog.title) + ' dialog'], ['waitForJawsToSay', labelToJawsSay(dialog.title) + ' heading level 1'] ); if (!dialog.fullyEmpty) { actions.push( ['type', null, '[tab]'], ['waitForJawsToSay', labelToJawsSay(dialog.closeLabel) + ' Button'], ['type', null, '[tab]'], ['waitForJawsToSay', labelToJawsSay(dialog.maximizeLabel) + ' Button'] ); } actions.push( ['type', null, '[escape]'], ['waitForJawsToSay', labelToJawsSay(dialog.buttonLabel) + ' Button'] ); } data.dialogs.forEach(processDialog.bind(this)); this.execute(actions, { fn: this.end, scope: this }); } } });
35.268293
94
0.53527
279508e513837bcf34feca089e32c6fb37293ab5
469
js
JavaScript
Backend/Config/Verification/routes/base.js
HENIT0885/Robovitics_Official-Desktop
0dd6ef81f8f7818e173a24934f16ac5a391e9ab7
[ "MIT" ]
8
2021-08-31T07:42:37.000Z
2021-10-04T10:32:15.000Z
Backend/Config/Verification/routes/base.js
HENIT0885/Robovitics_Official-Summer_Project
0dd6ef81f8f7818e173a24934f16ac5a391e9ab7
[ "MIT" ]
null
null
null
Backend/Config/Verification/routes/base.js
HENIT0885/Robovitics_Official-Summer_Project
0dd6ef81f8f7818e173a24934f16ac5a391e9ab7
[ "MIT" ]
null
null
null
const express = require('express'); const router = express.Router(); router.get("/", (req, res) => { const body = { "data" : "Hiii there, this is Henit Chobisa and this backend is a summer project for robovitics VIT Vellore, you can access the documentation via ...", "metadata" : { "success" : true, "status" : res.statusCode, "timeStamp" : Date() } } res.json(body); }) module.exports = router
29.3125
159
0.575693
2796bbc20e8bc3397193f80a5bebfda2cc225472
1,270
js
JavaScript
Kooboo.CMS/KoobooModule/Scripts/tiny_mce/plugins/insertPage/plugin.min.js
syberside/CMS
9b4e785e7f6324c9ade56f79a81dac33ec4292e7
[ "BSD-3-Clause" ]
288
2015-01-02T08:42:16.000Z
2021-09-29T14:01:59.000Z
Kooboo.CMS/KoobooModule/Scripts/tiny_mce/plugins/insertPage/plugin.min.js
syberside/CMS
9b4e785e7f6324c9ade56f79a81dac33ec4292e7
[ "BSD-3-Clause" ]
45
2015-01-13T13:32:02.000Z
2021-05-03T23:33:52.000Z
Kooboo.CMS/KoobooModule/Scripts/tiny_mce/plugins/insertPage/plugin.min.js
syberside/CMS
9b4e785e7f6324c9ade56f79a81dac33ec4292e7
[ "BSD-3-Clause" ]
171
2015-01-03T15:00:36.000Z
2021-01-08T01:52:47.000Z
/// <reference path="../../tiny_mce_src.js" /> (function () { tinymce.create('tinymce.plugins.insertPage', { init: function (ed, url) { ed.addCommand('insertPage', function () { // cache current selection var bookmark; if (tinymce.isIE) { bookmark = ed.selection.getBookmark(1); } // insert to editor if (tinymce.isIE) { ed.selection.moveToBookmark(bookmark); } // restore cached selection ed.execCommand('mceInsertContent', false, '[[url:pagename|userkey=key1]]', { skip_undo: 1 }); ed.undoManager.add(); }); ed.addButton('insertPage', { cmd: 'insertPage', title: ed.getLang('kooboo.insertPage', 'Insert page') }); }, getInfo: function () { return { longname: 'Insert page', author: 'Kooboo R&D', authorurl: 'http://www.kooboo.com', infourl: 'http://www.kooboo.com', version: tinymce.majorVersion + "." + tinymce.minorVersion }; } }); tinymce.PluginManager.add('insertPage', tinymce.plugins.insertPage); })();
38.484848
113
0.500787
279793db53f85d3821a3b69a2be40a90633950d5
922
js
JavaScript
packages/pull-quote/src/pull-quote.base.js
whitegoogles/times-components
1df1963421d472b0f7e6982c071c78b3363e912d
[ "BSD-3-Clause" ]
null
null
null
packages/pull-quote/src/pull-quote.base.js
whitegoogles/times-components
1df1963421d472b0f7e6982c071c78b3363e912d
[ "BSD-3-Clause" ]
null
null
null
packages/pull-quote/src/pull-quote.base.js
whitegoogles/times-components
1df1963421d472b0f7e6982c071c78b3363e912d
[ "BSD-3-Clause" ]
null
null
null
import React from "react"; import { Text, View } from "react-native"; import PullQuoteContent from "./pull-quote-content"; import PullQuoteTwitterLink from "./pull-quote-twitter-link"; import { propTypes, defaultProps } from "./pull-quote-prop-types"; import styles from "./styles"; const PullQuotes = ({ captionColour, children, content, onTwitterLinkPress, quoteColour, twitter }) => ( <View style={styles.container}> <Text style={[styles.quotes, { color: quoteColour }]}>&ldquo;</Text> <PullQuoteContent>{content}</PullQuoteContent> <View style={styles.captionContainer}> <Text style={[styles.caption, { color: captionColour }]}>{children}</Text> <PullQuoteTwitterLink onTwitterLinkPress={onTwitterLinkPress} twitter={twitter} /> </View> </View> ); PullQuotes.propTypes = propTypes; PullQuotes.defaultProps = defaultProps; export default PullQuotes;
27.939394
80
0.700651
2797d49eb5a8355f96ddd63fb0c11308ff3c353a
939
js
JavaScript
src/components/BingoBoard.js
etcusic/learning-materials-frontend
3f964fbf1659ddd76db933745a497fedbfcc78cd
[ "MIT" ]
null
null
null
src/components/BingoBoard.js
etcusic/learning-materials-frontend
3f964fbf1659ddd76db933745a497fedbfcc78cd
[ "MIT" ]
null
null
null
src/components/BingoBoard.js
etcusic/learning-materials-frontend
3f964fbf1659ddd76db933745a497fedbfcc78cd
[ "MIT" ]
null
null
null
import React from 'react'; const BingoBoard = ({ matrix }) => { return ( <div> <table id="bingo-board"> <tbody> <tr key="bingo-row-0"> { matrix[0].map(bingoCell => bingoCell) } </tr> <tr key="bingo-row-1"> { matrix[1].map(bingoCell => bingoCell) } </tr> <tr key="bingo-row-2"> { matrix[2].map(bingoCell => bingoCell) } </tr> <tr key="bingo-row-3"> { matrix[3].map(bingoCell => bingoCell) } </tr> <tr key="bingo-row-4"> { matrix[4].map(bingoCell => bingoCell) } </tr> </tbody> </table> </div> ); } export default BingoBoard
27.617647
65
0.349308
27984b7c20449a6f7ca18b0262b0f590d21b0a6c
6,440
js
JavaScript
index.js
Ibrahim-Khdairat/Practicing-for-301
41763d2ac941e43c235ca30a9ac3721988d29b54
[ "MIT" ]
null
null
null
index.js
Ibrahim-Khdairat/Practicing-for-301
41763d2ac941e43c235ca30a9ac3721988d29b54
[ "MIT" ]
null
null
null
index.js
Ibrahim-Khdairat/Practicing-for-301
41763d2ac941e43c235ca30a9ac3721988d29b54
[ "MIT" ]
null
null
null
// // const Vehicles = function(name , wheels ,door){ // // this.name = name; // // this.wheels = wheels; // // this.door = function(){ // // this.doors = door; // // } // // } // // Vehicles.prototype.fast = function(){ // // this.isFast = true; // // } // // Vehicles.prototype.slow = function(){ // // this.isSlow = true; // // } // // Vehicles.prototype.comfort = function(){ // // this.isComfort = 'Soo Comfort'; // // } // // let BMW = new Vehicles ('BMW' , 4 , 2); // // BMW.fast(); // // BMW.comfort(); // // BMW.door(); // // console.log(BMW); // // const Bikes = function (name ,wheels) // // { // // Vehicles.call(this ,name , wheels); // // } // // Bikes.prototype = Object.create(Vehicles.prototype); // // Bikes.prototype.maxSpeed = function() // // { // // this.maxSpeed = '300 KM/H'; // // } // // let Honda = new Bikes ( 'Honda', 2); // // Honda.fast(); // // Honda.maxSpeed(); // // console.log(Honda); // // console.log(BMW instanceof Vehicles); // // console.log(BMW instanceof Bikes); // // console.log(Honda instanceof Vehicles); // // console.log(Honda instanceof Bikes); // // constructor for a new car // const Vehicle = function(name, wheels){ // this.name = name; // this.wheels = wheels; // //this methode is a properety for the car // this.fast = function(){ // this.isFast = true; // } // } // //Attribute for the car or (Behavior) // Vehicle.prototype.exhaust = function (){ // this.haveExhaust = true; // } // const Car = function (name, wheels) // { // Vehicle.call(this, name, wheels); // } // Car.prototype = Object.create(Vehicle.prototype); // let BMW = new Car ('BMW', 4); // BMW.exhaust(); // BMW.fast(); // console.log(BMW); // console.log(BMW instanceof Vehicle); // console.log(BMW instanceof Car); // class Vehicle { // constructor(name , wheels){ // this.name = name; // this.wheels = wheels; // } // fast(){ // this.isFast = true; // } // exhaust(){ // this.haveExhaust = true; // } // } // let MercedesBenz = new Vehicle ("MercedesBenz" , 4); // MercedesBenz.fast(); // console.log(MercedesBenz); // class Cars extends Vehicle{ // constructor(name , wheels , color){ // super (name , wheels); // this.color = color; // } // doors(){ // this.doorsNumber = 4; // } // } // let Kia = new Cars ('Kia' , 4 , "red"); // Kia.exhaust(); // Kia.doors(); // console.log(Kia); // // //Main Vehicle class // // class Vehicle { // // constructor(name, wheels){ // // this.name = name; // // this.wheels = wheels; // // } // // exhaust(){ // // this.haveExhaust = true; // // } // // fast(){ // // this.isFast = true; // // } // // // comfort(){ // // // this.IsComfort = 'So Comfort'; // // // console.log('So Comfort'); // // // } // // } // // //Sub class of Vehicle // // class Car extends Vehicle{ // // constructor(name, wheels, type){ // // super(name, wheels); // // this.type = type; // // } // // comfort(){ // // console.log('So Comfort'); // // this.isComfort = 'So Comfort'; // // } // // } // // let MercedesBenz = new Car ('MercedesBenz', 4, 'Sport'); // // MercedesBenz.exhaust(); // // MercedesBenz.fast(); // // MercedesBenz.comfort(); // // console.log(MercedesBenz); // // // let MercedesBenz = new Car ('MercedesBenz', 4); // // // MercedesBenz.exhaust(); // // // MercedesBenz.fast(); // // // console.log(MercedesBenz); 'use strict'; // function reverse(arr) { // let reversed =[]; // for (let i=(arr.length-1) ; i>=0; i--) // { // reversed.push(arr[i]); // } // console.log(arr); // return reversed; // } // console.log(reverse(['M','A','R','A','M'])); // function countTrue(arr) { // let count=0; // for(let i=0 ; i<arr.length ; i++){ // if(arr[i]==true){count++;} // } // return count; // } // countTrue([true,true,false,true]); // function console.log(evenOrOdd(str) { // let even = 0; // let odd = 0; // for (let i=0;i<str.length;i++) // { // if(str[i]%2===0){ even++; } // else{ odd++ }; // } // console.log( `even ${even} : odd ${odd}`); // if(even == odd){ return "Even and Odd are the same"; } // else if (even > odd) { return "Even is greater than Odd"; } // else if (odd < even) { return "Odd is greater than Even" ;} // } // console.log( console.log(evenOrOdd("4589620")); // function compact(arr) { // let result =[]; // for( let i=0; i<arr.length; i++) // { // if ( arr[i] > 0 || arr[i] <0 ) // { // result.push(arr[i]); // } // } // return result; // } // console.log(compact([0, 1, false, 2, "", 3, -9 , 0.0004 , -0.00005 , true])); // function toArray(obj) { // let arr =[]; // for (const properety in obj) { // arr.push([ properety , obj[properety] ]); // } // console.log(arr); // return arr; // } // console.log(toArray({})); // function evenOrOdd(str) { // let even = 0; // let odd = 0; // for (let i=0;i<str.length;i++) // { // if(str[i]%2===0){ even++; } // else{ odd++ }; // } // if(even == odd){ return "Even and Odd are the same"; } // else if (even > odd) { return "Even is greater than Odd"; } // else if (odd > even) { return "Odd is greater than Even" ;} // } // console.log(evenOrOdd('12345')); // console.log(evenOrOdd('143')); // console.log(evenOrOdd('2221')); // console.log(evenOrOdd('23456')); // console.log(evenOrOdd('4321')); // console.log(evenOrOdd('3245')); // console.log(evenOrOdd('14256')); // console.log(evenOrOdd('11234')); // console.log(evenOrOdd('1734')); // console.log(evenOrOdd('145')); // console.log(evenOrOdd('22471')); // console.log(evenOrOdd('213613')); // console.log(evenOrOdd('23456')); // console.log(evenOrOdd('9738')); // console.log(evenOrOdd('34522')); // console.log(evenOrOdd('12378')); // console.log(evenOrOdd('45228')); // console.log(evenOrOdd('4455')); // console.log(evenOrOdd('6721')); // console.log(evenOrOdd('92184')); // console.log(evenOrOdd('12')); // console.log(evenOrOdd('123')); // console.log(evenOrOdd('112')); // console.log(evenOrOdd('124'));
19.93808
80
0.518012
279895084a2967debdca98c04b891f1a3e8f2ba2
1,283
js
JavaScript
src/components/pull_request/pullRequestsTable/PullRequestsTableBody.js
ThaynanAndrey/tcc-git-dashboard
f8a22b3abbb3798554656cf681c480fd9b90677c
[ "MIT" ]
null
null
null
src/components/pull_request/pullRequestsTable/PullRequestsTableBody.js
ThaynanAndrey/tcc-git-dashboard
f8a22b3abbb3798554656cf681c480fd9b90677c
[ "MIT" ]
19
2019-04-11T23:29:38.000Z
2022-02-26T10:11:46.000Z
src/components/pull_request/pullRequestsTable/PullRequestsTableBody.js
ThaynanAndrey/tcc-git-dashboard
f8a22b3abbb3798554656cf681c480fd9b90677c
[ "MIT" ]
null
null
null
import React from 'react'; import Tooltip from "react-simple-tooltip"; /** * Stateless Component with the function of displaying the body of * a table with the Pull Requests added in the project. * * @author Thaynan Nunes */ const PullRequestsTableBody = ({ pullRequests, removePullRequest, openPullRequest }) => { const pullRequestElements = pullRequests.map((pullRequest, indice) => ( <tr key={indice} onClick={() => openPullRequest(pullRequest)} style={{cursor: "pointer"}}> <td>{ pullRequest.nome }</td> <td>{ pullRequest.dataCriacao }</td> <td>{ pullRequest.status }</td> <td>{ pullRequest.responsavel.nome }</td> <td>{ pullRequest.repositorio.nome }</td> <td> <Tooltip content="Excluir PR" placement="left" radius={10} style={{whiteSpace: "nowrap"}}> <i className="material-icons left red-text" style={{cursor: "pointer"}} onClick={removePullRequest.bind(this, pullRequest)}> delete </i> </Tooltip> </td> </tr> )); return ( <tbody> {pullRequestElements} </tbody> ) } export default PullRequestsTableBody;
35.638889
106
0.570538
2798f906ae3ed88696a700e2a7a42821e4ee89cc
880
js
JavaScript
dist/src/Builder.js
Edurise-Studyly/builder-pattern
d2cbec7c5189b940f096c128079b8ed57755912c
[ "MIT" ]
null
null
null
dist/src/Builder.js
Edurise-Studyly/builder-pattern
d2cbec7c5189b940f096c128079b8ed57755912c
[ "MIT" ]
null
null
null
dist/src/Builder.js
Edurise-Studyly/builder-pattern
d2cbec7c5189b940f096c128079b8ed57755912c
[ "MIT" ]
null
null
null
export function Builder(typeOrTemplate, template) { let type; if (typeOrTemplate instanceof Function) { type = typeOrTemplate; } else { template = typeOrTemplate; } const built = template ? Object.assign({}, template) : {}; const builder = new Proxy( {}, { get(target, prop) { if ("build" === prop) { if (type) { // A class name (identified by the constructor) was passed. Instantiate it with props. const obj = new type(); return () => Object.assign(obj, Object.assign({}, built)); } else { // No type information - just return the object. return () => built; } } return (x) => { built[prop.toString()] = x; return builder; }; }, } ); return builder; } //# sourceMappingURL=Builder.js.map
26.666667
98
0.529545
279a387f6e7eef6f93c6b67271361d14b2bb61dd
8,233
js
JavaScript
Lib/igk/SysMods/DesignerManager/Scripts/igk.designer.js
goukenn/cgt
69a8e8a0611cba9a10b6469e0470c4e0b8a58587
[ "Apache-2.0" ]
null
null
null
Lib/igk/SysMods/DesignerManager/Scripts/igk.designer.js
goukenn/cgt
69a8e8a0611cba9a10b6469e0470c4e0b8a58587
[ "Apache-2.0" ]
null
null
null
Lib/igk/SysMods/DesignerManager/Scripts/igk.designer.js
goukenn/cgt
69a8e8a0611cba9a10b6469e0470c4e0b8a58587
[ "Apache-2.0" ]
null
null
null
//author: C.A.D BONDJE //date : 20-05-2017 //desctription : balafonjs script page designer //dsg/mt : design media type cookies: store if we use the media type definition to store current data information "uses sctrict"; (function(){ function __init(){ if(document.body.firstChild != this.o){ //this.remove(); document.body.insertBefore(this.o, document.body.firstChild); } else{ console.debug("is first the child"); } $igk(document.body).addClass('igk-dsg-mode'); var progress; // progress = igk.createNode("div"); // progress.addClass("igk-winui-track"); // progress.add("div").addClass("track").setCss({width:"50%"}); // document.body.insertBefore(progress.o, document.body.firstChild); // progress.init(); igk.winui.dragdrop.init(document.body, { uri: this.getAttribute('dropuri'),//"!@sys//design/drop", supported:'text/html,image/jpeg,image/png,video/mp4', async:true, start:function(){ if (!progress){ progress = igk.createNode("div"); progress.addClass("igk-winui-track"); progress.add("div").addClass("track"); document.body.insertBefore(progress.o, document.body.firstChild); progress.init(); }else{ document.body.insertBefore(progress.o, document.body.firstChild); } progress.select('.track').setCss({width:"0%"}); }, update:null, done:function(evt){ progress.remove(); }, progress:function(i){ progress.select('.track').setCss({width: Math.round((i.loaded/i.total)*100, 2)+"%"}); }, drop:function(evt){ igk.winui.dragdrop.fn.update_file.apply(this, arguments); }, enter:null, over:null, leave:null }); }; var _NS=0; var m_prop=0; igk.system.createNS("igk.winui.designer", { inithierarchi:function(q){ if (!m_prop || typeof(q) =='undefined'){ console.error("can't init hierachy"); return; } igk.ajx.post(m_prop.uri+'getHierachi', null, function(xhr){ if (this.isReady()){ var p = $igk(q.parentNode); p.setHtml(xhr.responseText); p.init(); p.qselect("ul[role='alignment']").each_all(function(){ this.qselect('a[role]').each_all(function(){ //console.debug("lkj"); var r = this.getAttribute('role'); this.reg_event("click", function(evt){ igk.evts.stop(evt); if(_NS.align) _NS.align(r); }); }); }); p.qselect("ul[role='font']").each_all(function(){ this.qselect('a[role]').each_all(function(){ //console.debug("lkj"); var r = this.getAttribute('role'); this.reg_event("click", function(evt){ igk.evts.stop(evt); if (_NS.font) _NS.font(r); }); }); }); p.qselect("a[role='store']").each_all(function(){ this.reg_event('click', function(evt){ igk.evts.stop(evt); igk.ajx.post(this.getAttribute('href'), igk.winui.designer.getDesignerPostData() //'data='+igk.winui.designer.getstyledef() ,function(){ }); }); }); } }); }, init:function(q, prop){ m_prop = prop; $igk(q).remove(); } }); _NS=igk.winui.designer; igk.winui.initClassControl("igk-winui-designer",__init); igk.ready(function(){ //alert($igk(".igk-winui-designer")); //console.debug("kjdf---------------"); }); // alert( "the document "+document.readyState); //control for design (function(){ var rects=[]; var rs_mode = 0; var _vdirs=['top','left','right','bottom']; var _CSS = {}; //css data to serialize function __initRect(){ var H = 0;//global height var W = 0; //global width var L=0; var T=0; var n = null; var q = this; var sc=0;//source capture var ack = 0;//actionv var sbutton={ cssDef:{ left: q.getComputedStyle('left'), top: q.getComputedStyle('top'), right: q.getComputedStyle('right'), bottom: q.getComputedStyle('bottom'), fontSize: q.getComputedStyle('fontSize'), textAlign: q.getComputedStyle('textAlign'), width: q.getComputedStyle('width'), height: q.getComputedStyle('height') } }; var rdu; //IE 11 make some error for size because au margin calculation. function _update(){ switch(sbutton.f){ case 4: sbutton.cssDef.height=(H +sbutton.outy)+"px"; break; case 1: //display line :top if (sbutton.pos=="relative"){ sbutton.cssDef.top=(T +sbutton.outy)+"px"; } break; case 2: //display line : left if (sbutton.pos=="relative"){ sbutton.cssDef.left=(L +sbutton.outx)+"px"; } break; case 3: sbutton.cssDef.width =(W +sbutton.outx)+"px"; break; } q.setCss(sbutton.cssDef); _setdu(_style_def()); }; function _setdu(s){ if (!rdu && !sbutton.du){ sbutton.du = $igk("#du").getItemAt(0); rdu=1; } if (sbutton.du){ sbutton.du.setHtml(s); } }; function _reset(){ q.setCss({ left:'auto', top:'auto', width:'auto', height:'auto' }); }; function _align(t){ sbutton.cssDef.textAlign=t; q.setCss(sbutton.cssDef); // { // textAlign:t // }); if (t=='justify'){ //not supported for chrome or firefox q.setCss({"textJustify":'none'}); } _setdu(_style_def()); }; function _fonts(t){ sbutton.cssDef.fontSize = t; q.setCss(sbutton.cssDef); // { // fontSize:t // }); _setdu(_style_def()); }; function _style_def(){ var o = ""; o= q.getCssSelector()+"{"; o+= q.o.style["cssText"]; o+="}"; return o; } function _designerPostData(){ //get return data to post for store var mt = igk.web.getcookies("dsg/mt"); var m = 'global'; q.setCss(sbutton.cssDef); if (mt==1){ m = igk.css.getMediaType(); } //console.debug(" m = "+m); if (!(m in _CSS)){ _CSS[m]={}; } _CSS[m][q.getCssSelector()]=q.o.style["cssText"]; return "q="+igk.utils.Base64.encode(JSON.stringify(_CSS)); } igk.winui.designer.reset = _reset; igk.winui.designer.align = _align; igk.winui.designer.font = _fonts; igk.winui.designer.getstyledef=_style_def; igk.winui.designer.getDesignerPostData=_designerPostData; function _ms_down(evt){ var n = $igk(evt.target); if (igk.winui.mouseButton(evt)== igk.winui.mouseButton.Left){ // console.debug("mouse down "+n.fn.tag); H = igk.getNumber(q.getComputedStyle("height")); W = igk.getNumber(q.getComputedStyle("width")); T = igk.getNumber(q.getComputedStyle("top")); L = igk.getNumber(q.getComputedStyle("left")); sc =n; igk.winui.mouseCapture.setCapture(sc); ack=1; //console.debug(W); sbutton.f= n.fn.tag; sbutton.x = evt.screenX; sbutton.y = evt.screenY; sbutton.outx=0; sbutton.outy=0; sbutton.pos = q.getComputedStyle("position"); evt.preventDefault(); evt.stopPropagation(); } }; function _ms_move(evt){ //$igk("#du").getItemAt(0).setHtml('dim :'+Math.round(evt.screenX)+" x "+ Math.round(evt.screenY)+"<br />Target:"+evt.target) ; if (ack){ var n = $igk(evt.target); sbutton.outx = -sbutton.x + evt.screenX; sbutton.outy = -sbutton.y + evt.screenY; _update(); evt.preventDefault(); evt.stopPropagation(); } }; function _ms_up(evt){ _update(); igk.winui.mouseCapture.releaseCapture(sc); ack =0; evt.preventDefault(); evt.stopPropagation(); }; for(var i =0;i<_vdirs.length;i++){ n = this.add('div').addClass("snippet "+_vdirs[i]) .reg_event("mousedown", _ms_down) .reg_event("mousemove", _ms_move) .reg_event("mouseup", _ms_up) ; n.fn.tag=i+1; } // igk.winui.reg_event(window,"mousedown", _ms_down); // igk.winui.reg_event(window,"mousemove", _ms_move); // igk.winui.reg_event(window,"mouseup", _ms_up); // var n1 = this.add('div').addClass("snippet top").reg_event("mousedown", _ms_down); // n1.fn.tag=1; // var n2 = this.add('div').addClass("snippet right").reg_event("mousedown", _ms_down); // n2.fn.tag=2; // var n3 = this.add('div').addClass("snippet bottom").reg_event("mousedown", _ms_down); // n3.fn.tag=3; // var n4 = this.add('div').addClass("snippet left").reg_event("mousedown", _ms_down); // n4.fn.tag=4; }; igk.winui.initClassControl("igk-dsg-rect", __initRect); })(); })();
25.332308
130
0.609134
279b069291f59cb45a9236cd149a9825f96eb78d
827
js
JavaScript
src/main.js
TheUnnusAnnusArchive/UnusAnnusRenamer
cd77de3aea051915d5619f1d22fc888166b1c6f2
[ "Unlicense" ]
null
null
null
src/main.js
TheUnnusAnnusArchive/UnusAnnusRenamer
cd77de3aea051915d5619f1d22fc888166b1c6f2
[ "Unlicense" ]
null
null
null
src/main.js
TheUnnusAnnusArchive/UnusAnnusRenamer
cd77de3aea051915d5619f1d22fc888166b1c6f2
[ "Unlicense" ]
null
null
null
const { app, BrowserWindow, dialog } = require('electron') const isRoot = require('is-root') var mainWindow = null app.on('ready', () => { if (isRoot()) { dialog.showErrorBox('Do not run as root!', 'Please do not run this app as superuser! It is a possibility that it could mess something up!') process.exit() } mainWindow = new BrowserWindow({ width: 1280, height: 720, minHeight: 450, title: 'Unus Annus Renamer', fullscreenable: true, resizable: true, autoHideMenuBar: true, webPreferences: { nodeIntegration: true, enableRemoteModule: true, nodeIntegrationInSubFrames: true } }) mainWindow.loadFile('app/index.html') mainWindow.on('closed', () => { mainWindow = null }) }) exports.mainWindow = mainWindow
24.323529
144
0.62757
279b8803c60f53992a3ccb6fefc924319e7811fc
560
js
JavaScript
src/App.js
rOluochKe/financial-api-react
300873a5d304b1cdb79d44603183a410b3f2f262
[ "MIT" ]
1
2021-03-11T22:13:54.000Z
2021-03-11T22:13:54.000Z
src/App.js
rOluochKe/pokemon-api-react
300873a5d304b1cdb79d44603183a410b3f2f262
[ "MIT" ]
null
null
null
src/App.js
rOluochKe/pokemon-api-react
300873a5d304b1cdb79d44603183a410b3f2f262
[ "MIT" ]
null
null
null
import React from 'react'; import './App.css'; import { Switch, Route, NavLink, Redirect, } from 'react-router-dom'; import PokemonList from './containers/PokemonList'; import Pokemon from './containers/Pokemon'; function App() { return ( <div className="App"> <nav> <NavLink to="/">Search</NavLink> </nav> <Switch> <Route path="/" exact component={PokemonList} /> <Route path="/pokemon/:pokemon" exact component={Pokemon} /> <Redirect to="/" /> </Switch> </div> ); } export default App;
22.4
68
0.601786
279d574293265fc7197f7eb3f0efe730d4e04a9b
1,667
js
JavaScript
view/backstage/js/page/game_list.js
zpjshiwo77/personal
ff05c5685f268d2b14faea370d9339760935c3ea
[ "MIT" ]
3
2016-01-13T05:26:35.000Z
2017-06-23T09:45:40.000Z
view/backstage/js/page/game_list.js
zpjshiwo77/personal
ff05c5685f268d2b14faea370d9339760935c3ea
[ "MIT" ]
null
null
null
view/backstage/js/page/game_list.js
zpjshiwo77/personal
ff05c5685f268d2b14faea370d9339760935c3ea
[ "MIT" ]
null
null
null
$(document).ready(function(){ var ipager = new pager(); //页面初始化 function pageInit(){ vefLogin(); eventInit(); requestTotalPage(ipagerInit); }//end func //事件初始化 function eventInit(){ $("#list").on("click",".del",delMGame); }//end func //删除 function delMGame(){ var id = $(this).attr("data-val"); confirm("确定要删除吗?",function(result){ if(result) { loadingShow(); iAjax(gameUrl,{method:"deleteGame",id:id},function(data){ alert("删除成功"); requestTotalPage(function(total){ ipager.reRender({total:total}); }); }); } }); }//end func //请求总页码 function requestTotalPage(callback){ iAjax(gameUrl,{method:"getTotalPage"},function(data){ if(data.errorCode == 0) callback(data.result); },true); }//end func //分页器初始化 function ipagerInit(total){ ipager.init($("#pager"),{now:1,total:total,callback:function(page){requestGameList(page)}}); }//end func //获取分类的列表 function requestGameList(page){ loadingShow(); iAjax(gameUrl,{method:"getGameList",page:page},function(data){ if(data.errorCode == 0) renderGameList(data.result.games); else $("#list").empty(); },true); }//end func //渲染分类的列表 function renderGameList(data){ var cont = ""; var table = $("#list"); table.empty(); for (var i = 0; i < data.length; i++) { var type = data[i].Type == 0 ? "链接" : "图片"; cont += "<tr> <td>"+data[i].ID+"</td><td>"+data[i].Name+"</td><td>"+type+"</td> <td>"+data[i].Url+"</td> <td><a class='btn black' href='game_edit.php?id="+data[i].ID+"'>修改</a> <div class='btn red del m_left' data-val='"+data[i].ID+"'>删除</div> </td> </tr>"; }; table.append(cont); }//end func pageInit(); });
25.257576
259
0.612478
279e878b5651b8c366642df32693d2f6ea1c63b2
303
js
JavaScript
src/api/demo.business.issues.142.js
xuhoo/d2-admin
ccf45ba6b1bf705d4ad69a8ea88dbe8a734067dd
[ "MIT" ]
104
2018-03-18T08:15:21.000Z
2021-11-14T17:30:55.000Z
src/api/demo.business.issues.142.js
xuhoo/d2-admin
ccf45ba6b1bf705d4ad69a8ea88dbe8a734067dd
[ "MIT" ]
21
2020-09-07T04:42:13.000Z
2022-02-26T17:34:58.000Z
src/api/demo.business.issues.142.js
censhine/awesome-admin
6cf07e0678ff8c7716750ddb640f3d4c8f3a071b
[ "MIT" ]
152
2019-05-25T05:06:25.000Z
2022-03-13T14:31:22.000Z
import request from '@/plugin/axios' export function fetch () { return request({ url: '/demo/business/issues/142/fetch', method: 'get' }) } export function detail (id) { return request({ url: '/demo/business/issues/142/detail', method: 'get', params: { id } }) }
15.947368
44
0.594059
279efb9d17bacd6254d746112173054b264dfe62
348
js
JavaScript
public/js/checkbox.js
manisacharya/khojeko_ci
0be9b63a5eea219e831b9f885664f6b575756bbb
[ "MIT" ]
null
null
null
public/js/checkbox.js
manisacharya/khojeko_ci
0be9b63a5eea219e831b9f885664f6b575756bbb
[ "MIT" ]
null
null
null
public/js/checkbox.js
manisacharya/khojeko_ci
0be9b63a5eea219e831b9f885664f6b575756bbb
[ "MIT" ]
null
null
null
$("#third input[type=checkbox]").on("click", function() { if ($(this).attr("noneoption") == "false") { $("#third input[type=checkbox][noneoption=true]").attr("checked", false); } else if ($(this).attr("noneoption") == "true") { $("#third input[type=checkbox][noneoption=false]").attr("checked", false); } });
43.5
83
0.560345
279f386c4c13d112ea4637d6c9d9af3cdc89fbd9
853
js
JavaScript
src/actions/logInAction.js
rgururani/search-SWAPI
ab7ce89c3c4db8c9d338fd1324d7e32f9463de35
[ "MIT" ]
null
null
null
src/actions/logInAction.js
rgururani/search-SWAPI
ab7ce89c3c4db8c9d338fd1324d7e32f9463de35
[ "MIT" ]
null
null
null
src/actions/logInAction.js
rgururani/search-SWAPI
ab7ce89c3c4db8c9d338fd1324d7e32f9463de35
[ "MIT" ]
null
null
null
import * as types from '../constants/actionTypes'; import StarWarsApi from '../api/mockStarWarsApi'; export function userAuth(user) { return { type: types.USER_AUTHENTICATED, user}; } export function loadUser(userId = '' , password = '') { if(userId == '' || password == ''){ return (function () { throw("Plaese enter both UserId Password to Login"); }); } return function (dispatch) { return StarWarsApi.SearchByUserName(userId).then(user => { if(user.length === 1 ){ let userObject = user[0]; if( userObject.birth_year.toLowerCase() == password.toLowerCase() && userObject.name.toLowerCase() == userId.toLowerCase()) dispatch(userAuth(userObject.name)); } else throw("User Name and Date of birth do not match"); }).catch(error => { throw(error); }); }; }
26.65625
129
0.622509
27a052a9aeae90969f5931d7c14a7c13e6b2e130
26,058
js
JavaScript
test/discountedTransactions.js
DemonGun/beeline-server
56ca9dc0e4bfff173009ddd18f2ee8833def1b44
[ "MIT" ]
30
2017-10-11T00:51:29.000Z
2020-12-14T06:01:36.000Z
test/discountedTransactions.js
datagovsg/beeline-server
56ca9dc0e4bfff173009ddd18f2ee8833def1b44
[ "MIT" ]
30
2017-10-13T08:55:39.000Z
2019-11-04T04:00:58.000Z
test/discountedTransactions.js
DemonGun/beeline-server
56ca9dc0e4bfff173009ddd18f2ee8833def1b44
[ "MIT" ]
5
2017-10-11T11:35:21.000Z
2020-12-14T06:01:38.000Z
import Lab from 'lab' export const lab = Lab.script() import {expect} from 'code' import _ from 'lodash' import {roundToNearestCent} from '../src/lib/util/common' import server from '../src/index.js' import { resetTripInstances, loginAs, createStripeToken, cleanlyDeleteUsers, randomEmail, cleanlyDeletePromotions, } from './test_common' import * as testData from './test_data' const {models} = require("../src/lib/core/dbschema")() lab.experiment("Integration with transaction", function () { let userInstance let authHeaders = {} // var testName = "Name for Testing"; // var updatedTestName = "Updated name for Testing"; let companyInstance let routeInstance let stopInstances = [] let tripInstances = [] lab.afterEach(async () => resetTripInstances(models, tripInstances)) lab.before({timeout: 15000}, async () => { ({userInstance, companyInstance, tripInstances, stopInstances, routeInstance} = await testData.createUsersCompaniesRoutesAndTrips(models)) const userToken = userInstance.makeToken() authHeaders.user = {authorization: "Bearer " + userToken} const adminToken = (await loginAs("admin", { transportCompanyId: companyInstance.id, permissions: ['refund', 'issue-tickets'], })).result.sessionToken authHeaders.admin = {authorization: "Bearer " + adminToken} await cleanlyDeletePromotions({code: 'TEST PROMO'}) await models.Promotion.create({ code: 'TEST PROMO', type: 'Promotion', params: { "description": "For test", "qualifyingCriteria": [{ "type": "noLimit", }], "discountFunction": { "type": "tieredRateByQty", "params": {"schedule": [[5, 0.2]]}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) }) lab.after({timeout: 10000}, async () => { await Promise.all(tripInstances.map(instance => instance.destroy())) await Promise.all(stopInstances.map(instance => instance.destroy())) await routeInstance.destroy() await companyInstance.destroy() await userInstance.destroy() }) lab.test("Dry run ticket purchase with promoCode", {timeout: 10000}, async () => { const saleResponse = await server.inject({ method: "POST", url: "/transactions/tickets/quote", payload: { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }, { tripId: tripInstances[2].id, boardStopId: tripInstances[2].tripStops[0].id, alightStopId: tripInstances[2].tripStops[4].id, }, { tripId: tripInstances[3].id, boardStopId: tripInstances[3].tripStops[0].id, alightStopId: tripInstances[3].tripStops[4].id, }, { tripId: tripInstances[4].id, boardStopId: tripInstances[4].tripStops[0].id, alightStopId: tripInstances[4].tripStops[4].id, }], promoCode: { code: 'TEST PROMO', options: {}, }, }, headers: authHeaders.user, }) expect(saleResponse.statusCode).to.equal(200) let items = _.groupBy(saleResponse.result.transactionItems, 'itemType') expect(items.discount.length).to.equal(1) expect(parseFloat(items.discount[0].debit)).to.equal(6.05) expect(saleResponse.result.description).include('TEST PROMO') expect(saleResponse.result.description).include(items.discount[0].debit.toFixed(2)) }) lab.test("Refund after discount", {timeout: 15000}, async () => { const saleResponse = await server.inject({ method: "POST", url: "/transactions/tickets/payment", payload: { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }, { tripId: tripInstances[2].id, boardStopId: tripInstances[2].tripStops[0].id, alightStopId: tripInstances[2].tripStops[4].id, }, { tripId: tripInstances[3].id, boardStopId: tripInstances[3].tripStops[0].id, alightStopId: tripInstances[3].tripStops[4].id, }, { tripId: tripInstances[4].id, boardStopId: tripInstances[4].tripStops[0].id, alightStopId: tripInstances[4].tripStops[4].id, }], promoCode: { code: 'TEST PROMO', options: {}, }, stripeToken: await createStripeToken(), }, headers: authHeaders.user, }) expect(saleResponse.statusCode).to.equal(200) const tickets = await Promise.all(saleResponse.result.transactionItems .filter(txnItem => txnItem.itemType.startsWith("ticket")) .map(async (txnItem) => { return await models.Ticket.findById(txnItem.itemId) }) ) const ticket = tickets.find(t => t.boardStopId === tripInstances[0].tripStops[0].id) const ticketPrice = +tripInstances[0].price const discount = ticket.notes.discountValue // Refund a ticket... const refundResponse = await server.inject({ method: "POST", url: `/transactions/tickets/${ticket.id}/refund/payment`, payload: { targetAmt: ticketPrice - discount, }, headers: authHeaders.admin, }) expect(refundResponse.statusCode).to.equal(200) const items = _.groupBy(refundResponse.result.transactionItems, 'itemType') expect(parseFloat(items.ticketRefund[0].debit)).to.equal(5.85) }) lab.test("Promotions limited by telephone lists work", {timeout: 10000}, async function () { const randomTelephoneNumbersInList = [ '+601234560', '+601234561', '+601234562', '+601234563', ] const randomTelephoneNumbersNotInList = [ '+601234564', '+601234565', '+601234566', '+601234567', ] // Create the list in the database directly to bypass validation const contactList = await models.ContactList.create({ transportCompanyId: companyInstance.id, description: 'Blah', telephones: randomTelephoneNumbersInList, emails: [], }) // Create a promotion const promotion = await models.Promotion.create({ code: 'TEST TELEPHONE LIST PROMO', type: 'Promotion', params: { "description": "For test", "qualifyingCriteria": [{ type: "limitByContactList", params: { contactListId: contactList.id, }, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.4}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) // User 1 -- in the list await cleanlyDeleteUsers({ telephone: {$in: randomTelephoneNumbersInList.concat(randomTelephoneNumbersNotInList)}, }) const userInList = await models.User.create({ telephone: randomTelephoneNumbersInList[1], }) const userNotInList = await models.User.create({ telephone: randomTelephoneNumbersNotInList[1], }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: 'TEST TELEPHONE LIST PROMO', options: {}, }, } const failResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userNotInList.makeToken()}`, }, }) expect(failResponse.statusCode).equal(400) const successResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInList.makeToken()}`, }, }) expect(successResponse.result.transactionItems.find(ti => ti.itemType === 'discount' && ti.discount.code === promotion.code)) expect(successResponse.statusCode).equal(200) }) lab.test("Promotions limited by email work", {timeout: 10000}, async function () { const randomEmailInList = _.range(0, 4).map(randomEmail) const randomEmailNotInList = _.range(0, 4).map(randomEmail) // Create the list in the database directly to bypass validation const contactList = await models.ContactList.create({ transportCompanyId: companyInstance.id, description: 'Blah', emails: randomEmailInList, telephones: [], }) // Create a promotion const promotion = await models.Promotion.create({ code: 'TEST EMAIL LIST PROMO', type: 'Promotion', params: { "description": "For test", "qualifyingCriteria": [{ type: "limitByContactList", params: { contactListId: contactList.id, }, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.4}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) // User 1 -- in the list await cleanlyDeleteUsers({ telephone: {$in: randomEmailInList.concat(randomEmailNotInList)}, }) const userInList = await models.User.create({ email: randomEmailInList[1], emailVerified: true, }) const unverifiedUserInList = await models.User.create({ email: randomEmailInList[2], emailVerified: false, }) const userNotInList = await models.User.create({ email: randomEmailNotInList[1], emailVerified: true, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: promotion.code, options: {}, }, } const failResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userNotInList.makeToken()}`, }, }) expect(failResponse.statusCode).equal(400) const failResponse2 = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${unverifiedUserInList.makeToken()}`, }, }) expect(failResponse2.statusCode).equal(400) const successResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInList.makeToken()}`, }, }) expect(successResponse.statusCode).equal(200) expect(successResponse.result.transactionItems.find(ti => ti.itemType === 'discount' && ti.discount.code === promotion.code)) }) lab.test("Default promotions work", {timeout: 10000}, async function () { let promotion try { // Create a promotion promotion = await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Bulk discount promo", "qualifyingCriteria": [{ type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.4}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).equal(200) const discountValue = saleResponse.result.transactionItems .find(ti => ti.itemType === 'discount') .debit const paymentValue = saleResponse.result.transactionItems .find(ti => ti.itemType === 'payment') .debit expect(parseFloat(paymentValue) / parseFloat(discountValue)) .about(3 / 2, 0.001) } catch (err) { throw err } finally { if (promotion) await promotion.destroy() } }) lab.test("Default promotions does not throw error if it does not exist", {timeout: 10000}, async function () { try { await models.Promotion.destroy({ where: { code: '', }, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).equal(200) expect(saleResponse.result.transactionItems .find(ti => ti.itemType === 'discount')).not.exist() const paymentValue = saleResponse.result.transactionItems .find(ti => ti.itemType === 'payment') .debit expect(parseFloat(paymentValue)).about(tripInstances[0].priceF + tripInstances[1].priceF, 0.001) } catch (err) { throw err } }) lab.test("Best promo applied when > 1 have same promo code", {timeout: 10000}, async function () { await cleanlyDeletePromotions({code: ''}) await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Bad promo", "qualifyingCriteria": [{ type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.4}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Better promo", "qualifyingCriteria": [{ type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.5}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).to.equal(200) let items = _.groupBy(saleResponse.result.transactionItems, 'itemType') expect(items.discount.length).to.equal(1) expect(parseFloat(items.discount[0].debit)).about( roundToNearestCent(tripInstances[0].price * 0.5) + roundToNearestCent(tripInstances[1].price * 0.5), 0.0001 ) expect(saleResponse.result.description).include(items.discount[0].debit) }) lab.test("Best promo applied when > 1 have same promo code but diff discount functions", {timeout: 10000}, async function () { await cleanlyDeletePromotions({code: ''}) await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Bad promo", "qualifyingCriteria": [{ type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.4}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) // Create the list in the database directly to bypass validation const contactList = await models.ContactList.create({ transportCompanyId: companyInstance.id, description: 'Blah', telephones: [userInstance.telephone], emails: [], }) await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Better promo", "qualifyingCriteria": [{ type: "limitByContactList", params: { contactListId: contactList.id, }, }, { type: 'limitByMinTicketCount', params: {n: 2}, }, { type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { type: 'fixedTransactionPrice', params: {price: 1}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).to.equal(200) let items = _.groupBy(saleResponse.result.transactionItems, 'itemType') expect(items.discount.length).to.equal(1) expect(parseFloat(items.discount[0].debit)).about( roundToNearestCent(tripInstances[0].price) + roundToNearestCent(tripInstances[1].price) - 1, 0.0001 ) expect(saleResponse.result.description).include(items.discount[0].debit) }) lab.test("Expected price", {timeout: 10000}, async function () { let promotion try { // Create a promotion promotion = await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Bulk discount promo", "qualifyingCriteria": [{ type: 'limitByCompany', params: {companyId: companyInstance.id}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.67}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const previewResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/quote", payload: samplePayload, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) const expectedPrice = ( previewResponse.result.transactionItems.find(ti => ti.itemType === 'payment').debit ).toFixed(2) const nonExpectedPrice = ( parseFloat(previewResponse.result.transactionItems.find(ti => ti.itemType === 'payment') .debit) + 0.01 ).toFixed(2) const failResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, expectedPrice: nonExpectedPrice, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(failResponse.statusCode).equal(400) const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, expectedPrice: expectedPrice, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).equal(200) } finally { if (promotion) await promotion.destroy() } }) lab.test("Tickets paid with route credits not considered for promo", {timeout: 10000}, async function () { await cleanlyDeletePromotions({code: ''}) await models.Promotion.create({ code: '', type: 'Promotion', params: { "description": "Bulk discount promo", "qualifyingCriteria": [{ type: 'limitByMinTicketCount', params: {n: 2}, }], "discountFunction": { "type": "simpleRate", "params": {"rate": 0.50}, }, "refundFunction": { "type": "refundDiscountedAmt", }, "usageLimit": { "userLimit": null, "globalLimit": null, }, }, }) await routeInstance.update({ tags: ['rp-1337'] }) await server.inject({ method: "POST", url: "/transactions/route_passes/issue_free", payload: { description: 'Issue 1 Free Pass', userId: userInstance.id, routeId: routeInstance.id, tag: 'rp-1337', }, headers: authHeaders.admin, }) const samplePayload = { trips: [{ tripId: tripInstances[0].id, boardStopId: tripInstances[0].tripStops[0].id, alightStopId: tripInstances[0].tripStops[4].id, }, { tripId: tripInstances[1].id, boardStopId: tripInstances[1].tripStops[0].id, alightStopId: tripInstances[1].tripStops[4].id, }], promoCode: { code: '', options: {}, }, } const saleResponse = await server.inject({ method: 'POST', url: "/transactions/tickets/payment", payload: { ...samplePayload, applyRoutePass: true, stripeToken: await createStripeToken(), }, headers: { authorization: `Bearer ${userInstance.makeToken()}`, }, }) expect(saleResponse.statusCode).equal(200) expect(saleResponse.result.transactionItems.filter(i => i.itemType === 'discount')).length(0) await cleanlyDeletePromotions({code: ''}) await models.RoutePass.destroy({ where: { tag: 'rp-1337' } }) }) })
29.311586
128
0.573145
27a0d217286043909133153ef0a560f1d5e19ab7
455
js
JavaScript
middleware/logger.js
jetechnologicalindustries/TAWMYD
d0ba1d60b7c205bd3bf86f5a2d4668df850a02d5
[ "MIT" ]
null
null
null
middleware/logger.js
jetechnologicalindustries/TAWMYD
d0ba1d60b7c205bd3bf86f5a2d4668df850a02d5
[ "MIT" ]
null
null
null
middleware/logger.js
jetechnologicalindustries/TAWMYD
d0ba1d60b7c205bd3bf86f5a2d4668df850a02d5
[ "MIT" ]
null
null
null
const moment = require('moment'); const tynt = require('tynt'); const logger = (req, res, next) => { var ip = req.ip || req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress; console.log( `${tynt.Yellow(moment().format("dddd, MMMM Do YYYY, h:mm:ss a"))}` + ` : ${tynt.Green('Accessed')} : ` + `${req.protocol}://${req.get('host')}${ req.originalUrl }` ); next(); }; module.exports = logger;
30.333333
147
0.61978
27a247852bc7ca833a98bd706443d1cc30593915
201
js
JavaScript
Calculator/CalculatorService.js
lewisvatcky/oneway
ccefe95e24de5d62a8e96581309453d3f40017ef
[ "Apache-2.0" ]
null
null
null
Calculator/CalculatorService.js
lewisvatcky/oneway
ccefe95e24de5d62a8e96581309453d3f40017ef
[ "Apache-2.0" ]
null
null
null
Calculator/CalculatorService.js
lewisvatcky/oneway
ccefe95e24de5d62a8e96581309453d3f40017ef
[ "Apache-2.0" ]
null
null
null
import * as AusPost from "../services/AusPost"; export const calculate = (postcode, width, height, length, weight) => { return AusPost.GetEstimate(3078, postcode, width, height, length, weight); };
33.5
76
0.716418
27a2fce5a30f60646134b8b6ceec224842985452
870
js
JavaScript
js/jsKPIDefects.js
tsachikotek/CI-CD_Dashboard
1a9ca0c35e8dc42fa2f1ce36e645c4cd4bef4f86
[ "MIT" ]
1
2019-02-06T10:06:36.000Z
2019-02-06T10:06:36.000Z
js/jsKPIDefects.js
tsachikotek/CI-CD_Dashboard
1a9ca0c35e8dc42fa2f1ce36e645c4cd4bef4f86
[ "MIT" ]
null
null
null
js/jsKPIDefects.js
tsachikotek/CI-CD_Dashboard
1a9ca0c35e8dc42fa2f1ce36e645c4cd4bef4f86
[ "MIT" ]
null
null
null
 //function to call the API with the query from the QC function GetClosedVsOpenedDefects(targetId, title, subtitle, status, dataAll) { var result = ''; var that = $(this); $.ajax({ //url: '//nexus-server/NexusAPI/api/QC/GetStatisticForAllKBsByProduct?status=' + status, //'//nexus-server/NexusAPI/api/QC/GetStatisticForAllFixesByProduct?version='+version+'&status='+status, url: '//localhost:65126/api/QC/GetClosedVSOpenDefects', type: 'GET', context: that, cache: false, success: function (dataByProduct) { insertChart_AllKBS(targetId, title, subtitle, dataAll, dataByProduct); result = dataByProduct; }, error: function (xhr, ajaxOptions, thrownError) { console.log(xhr.responseText); } }); return result; }
37.826087
112
0.614943
27a32df11c725ca21159dfd368419ebc1e9ff80e
7,816
js
JavaScript
esm2015/lib/components/data-grid-template-cell/data-grid-template-cell.component.js
amn31/ma-data-grid
c2a94e6a31bc6de32f9a96c0b7b9e3d3ae4fb2dd
[ "MIT" ]
1
2021-12-24T13:01:44.000Z
2021-12-24T13:01:44.000Z
esm2015/lib/components/data-grid-template-cell/data-grid-template-cell.component.js
amn31/ma-data-grid
c2a94e6a31bc6de32f9a96c0b7b9e3d3ae4fb2dd
[ "MIT" ]
null
null
null
esm2015/lib/components/data-grid-template-cell/data-grid-template-cell.component.js
amn31/ma-data-grid
c2a94e6a31bc6de32f9a96c0b7b9e3d3ae4fb2dd
[ "MIT" ]
null
null
null
import { ComponentFactoryResolver, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { Component } from '@angular/core'; import { MaGridCellTemplateDirective } from '../../directives/ma-grid-cell-template.directive'; import { DataGridCellItemComponent } from '../data-grid-cell-item/data-grid-cell-item.component'; export class DataGridTemplateCellComponent { constructor(componentFactoryResolver) { this.componentFactoryResolver = componentFactoryResolver; // console.log('DataGridTemplateCellComponent c',this.template, this.prop); } ngOnInit() { var _a; // if (!this.template) { return; } const component = new DataGridCellItemComponent(this.template, this.data, this.col, this.prop, this.myGrid); const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component.component); if (!this.libMaGridCellTemplate) { return; } const viewContainerRef = this.libMaGridCellTemplate.viewContainerRef; const componentRef = viewContainerRef.createComponent(componentFactory); componentRef.instance.data = component.data; componentRef.instance.prop = component.prop; componentRef.instance.col = component.col; componentRef.instance.dataChange = new EventEmitter(); componentRef.instance.myGrid = component.myGrid; (_a = componentRef.instance.dataChange) === null || _a === void 0 ? void 0 : _a.subscribe(d => { // console.log("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", d); if (componentRef.instance.myGrid != null) { componentRef.instance.myGrid._dataChange(d); } }); } } DataGridTemplateCellComponent.decorators = [ { type: Component, args: [{ selector: 'ma-data-grid-template-cell-t1', template: '<ng-template libMaGridCellTemplate></ng-template>' },] } ]; DataGridTemplateCellComponent.ctorParameters = () => [ { type: ComponentFactoryResolver } ]; DataGridTemplateCellComponent.propDecorators = { data: [{ type: Input }], prop: [{ type: Input }], col: [{ type: Input }], template: [{ type: Input }], myGrid: [{ type: Input }], dataChange: [{ type: Output }], libMaGridCellTemplate: [{ type: ViewChild, args: [MaGridCellTemplateDirective, { static: true },] }] }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YS1ncmlkLXRlbXBsYXRlLWNlbGwuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IkQ6L015SG9tZS9hbmRyb2lkL3dvcmtzcGFjZS9naXQvbWEtbmctZGF0YWdyaWQvcHJvamVjdHMvbWEtZGF0YS1ncmlkL3NyYy8iLCJzb3VyY2VzIjpbImxpYi9jb21wb25lbnRzL2RhdGEtZ3JpZC10ZW1wbGF0ZS1jZWxsL2RhdGEtZ3JpZC10ZW1wbGF0ZS1jZWxsLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRWpHLE9BQU8sRUFBRSxTQUFTLEVBQVUsTUFBTSxlQUFlLENBQUM7QUFDbEQsT0FBTyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sa0RBQWtELENBQUM7QUFFL0YsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sc0RBQXNELENBQUM7QUFPakcsTUFBTSxPQUFPLDZCQUE2QjtJQVV4QyxZQUFvQix3QkFBa0Q7UUFBbEQsNkJBQXdCLEdBQXhCLHdCQUF3QixDQUEwQjtRQUNwRSwyRUFBMkU7SUFDN0UsQ0FBQztJQUVELFFBQVE7O1FBQ04sR0FBRztRQUNILElBQUksQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFO1lBQ2xCLE9BQU87U0FDUjtRQUNELE1BQU0sU0FBUyxHQUFHLElBQUkseUJBQXlCLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxHQUFHLEVBQUUsSUFBSSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7UUFFNUcsTUFBTSxnQkFBZ0IsR0FBRyxJQUFJLENBQUMsd0JBQXdCLENBQUMsdUJBQXVCLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQ3BHLElBQUksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUU7WUFDL0IsT0FBTztTQUNSO1FBQ0QsTUFBTSxnQkFBZ0IsR0FBRyxJQUFJLENBQUMscUJBQXFCLENBQUMsZ0JBQWdCLENBQUM7UUFDckUsTUFBTSxZQUFZLEdBQUcsZ0JBQWdCLENBQUMsZUFBZSxDQUE0QixnQkFBZ0IsQ0FBQyxDQUFDO1FBQ25HLFlBQVksQ0FBQyxRQUFRLENBQUMsSUFBSSxHQUFHLFNBQVMsQ0FBQyxJQUFJLENBQUM7UUFDNUMsWUFBWSxDQUFDLFFBQVEsQ0FBQyxJQUFJLEdBQUcsU0FBUyxDQUFDLElBQUksQ0FBQztRQUM1QyxZQUFZLENBQUMsUUFBUSxDQUFDLEdBQUcsR0FBRyxTQUFTLENBQUMsR0FBRyxDQUFDO1FBQzFDLFlBQVksQ0FBQyxRQUFRLENBQUMsVUFBVSxHQUFHLElBQUksWUFBWSxFQUFPLENBQUM7UUFDM0QsWUFBWSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLE1BQU0sQ0FBQztRQUNoRCxNQUFBLFlBQVksQ0FBQyxRQUFRLENBQUMsVUFBVSwwQ0FBRSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDOUMsa0VBQWtFO1lBQ2xFLElBQUksWUFBWSxDQUFDLFFBQVEsQ0FBQyxNQUFNLElBQUksSUFBSSxFQUFFO2dCQUN4QyxZQUFZLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUM7YUFFN0M7UUFDSCxDQUFDLEVBQUU7SUFFTCxDQUFDOzs7WUE1Q0YsU0FBUyxTQUFDO2dCQUNULFFBQVEsRUFBRSwrQkFBK0I7Z0JBQ3pDLFFBQVEsRUFBRSxtREFBbUQ7YUFDOUQ7OztZQVhRLHdCQUF3Qjs7O21CQWM5QixLQUFLO21CQUNMLEtBQUs7a0JBQ0wsS0FBSzt1QkFDTCxLQUFLO3FCQUNMLEtBQUs7eUJBQ0wsTUFBTTtvQ0FDTixTQUFTLFNBQUMsMkJBQTJCLEVBQUUsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ29tcG9uZW50RmFjdG9yeVJlc29sdmVyLCBFdmVudEVtaXR0ZXIsIElucHV0LCBPdXRwdXQsIFZpZXdDaGlsZCB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgVHlwZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgQ29tcG9uZW50LCBPbkluaXQgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IE1hR3JpZENlbGxUZW1wbGF0ZURpcmVjdGl2ZSB9IGZyb20gJy4uLy4uL2RpcmVjdGl2ZXMvbWEtZ3JpZC1jZWxsLXRlbXBsYXRlLmRpcmVjdGl2ZSc7XG5pbXBvcnQgeyBNYURhdGFHcmlkQ29tcG9uZW50IH0gZnJvbSAnLi4vLi4vbWEtZGF0YS1ncmlkLmNvbXBvbmVudCc7XG5pbXBvcnQgeyBEYXRhR3JpZENlbGxJdGVtQ29tcG9uZW50IH0gZnJvbSAnLi4vZGF0YS1ncmlkLWNlbGwtaXRlbS9kYXRhLWdyaWQtY2VsbC1pdGVtLmNvbXBvbmVudCc7XG5cblxuQENvbXBvbmVudCh7XG4gIHNlbGVjdG9yOiAnbWEtZGF0YS1ncmlkLXRlbXBsYXRlLWNlbGwtdDEnLFxuICB0ZW1wbGF0ZTogJzxuZy10ZW1wbGF0ZSBsaWJNYUdyaWRDZWxsVGVtcGxhdGU+PC9uZy10ZW1wbGF0ZT4nXG59KVxuZXhwb3J0IGNsYXNzIERhdGFHcmlkVGVtcGxhdGVDZWxsQ29tcG9uZW50IGltcGxlbWVudHMgT25Jbml0IHtcblxuICBASW5wdXQoKSBkYXRhOiBhbnk7XG4gIEBJbnB1dCgpIHByb3A6IGFueTtcbiAgQElucHV0KCkgY29sOiBhbnk7XG4gIEBJbnB1dCgpIHRlbXBsYXRlOiBUeXBlPGFueT47XG4gIEBJbnB1dCgpIG15R3JpZDogTWFEYXRhR3JpZENvbXBvbmVudDtcbiAgQE91dHB1dCgpIGRhdGFDaGFuZ2U6IEV2ZW50RW1pdHRlcjxhbnk+Oy8vID0gbmV3IEV2ZW50RW1pdHRlcjxhbnk+KCk7XG4gIEBWaWV3Q2hpbGQoTWFHcmlkQ2VsbFRlbXBsYXRlRGlyZWN0aXZlLCB7IHN0YXRpYzogdHJ1ZSB9KSBsaWJNYUdyaWRDZWxsVGVtcGxhdGU6IE1hR3JpZENlbGxUZW1wbGF0ZURpcmVjdGl2ZTtcblxuICBjb25zdHJ1Y3Rvcihwcml2YXRlIGNvbXBvbmVudEZhY3RvcnlSZXNvbHZlcjogQ29tcG9uZW50RmFjdG9yeVJlc29sdmVyKSB7XG4gICAgLy8gY29uc29sZS5sb2coJ0RhdGFHcmlkVGVtcGxhdGVDZWxsQ29tcG9uZW50IGMnLHRoaXMudGVtcGxhdGUsIHRoaXMucHJvcCk7XG4gIH1cblxuICBuZ09uSW5pdCgpOiB2b2lkIHtcbiAgICAvLyBcbiAgICBpZiAoIXRoaXMudGVtcGxhdGUpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgY29uc3QgY29tcG9uZW50ID0gbmV3IERhdGFHcmlkQ2VsbEl0ZW1Db21wb25lbnQodGhpcy50ZW1wbGF0ZSwgdGhpcy5kYXRhLCB0aGlzLmNvbCwgdGhpcy5wcm9wLCB0aGlzLm15R3JpZCk7XG5cbiAgICBjb25zdCBjb21wb25lbnRGYWN0b3J5ID0gdGhpcy5jb21wb25lbnRGYWN0b3J5UmVzb2x2ZXIucmVzb2x2ZUNvbXBvbmVudEZhY3RvcnkoY29tcG9uZW50LmNvbXBvbmVudCk7XG4gICAgaWYgKCF0aGlzLmxpYk1hR3JpZENlbGxUZW1wbGF0ZSkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cbiAgICBjb25zdCB2aWV3Q29udGFpbmVyUmVmID0gdGhpcy5saWJNYUdyaWRDZWxsVGVtcGxhdGUudmlld0NvbnRhaW5lclJlZjtcbiAgICBjb25zdCBjb21wb25lbnRSZWYgPSB2aWV3Q29udGFpbmVyUmVmLmNyZWF0ZUNvbXBvbmVudDxEYXRhR3JpZENlbGxJdGVtQ29tcG9uZW50Pihjb21wb25lbnRGYWN0b3J5KTtcbiAgICBjb21wb25lbnRSZWYuaW5zdGFuY2UuZGF0YSA9IGNvbXBvbmVudC5kYXRhO1xuICAgIGNvbXBvbmVudFJlZi5pbnN0YW5jZS5wcm9wID0gY29tcG9uZW50LnByb3A7XG4gICAgY29tcG9uZW50UmVmLmluc3RhbmNlLmNvbCA9IGNvbXBvbmVudC5jb2w7XG4gICAgY29tcG9uZW50UmVmLmluc3RhbmNlLmRhdGFDaGFuZ2UgPSBuZXcgRXZlbnRFbWl0dGVyPGFueT4oKTtcbiAgICBjb21wb25lbnRSZWYuaW5zdGFuY2UubXlHcmlkID0gY29tcG9uZW50Lm15R3JpZDtcbiAgICBjb21wb25lbnRSZWYuaW5zdGFuY2UuZGF0YUNoYW5nZT8uc3Vic2NyaWJlKGQgPT4ge1xuICAgICAgLy8gY29uc29sZS5sb2coXCJERERERERERERERERERERERERERERERERERERERERERERERERERERERERERFwiLCBkKTtcbiAgICAgIGlmIChjb21wb25lbnRSZWYuaW5zdGFuY2UubXlHcmlkICE9IG51bGwpIHtcbiAgICAgICAgY29tcG9uZW50UmVmLmluc3RhbmNlLm15R3JpZC5fZGF0YUNoYW5nZShkKTtcblxuICAgICAgfVxuICAgIH0pO1xuXG4gIH1cbn1cbiJdfQ==
144.740741
5,386
0.893168
27a3b20e0d2231f5822231cf0415bf173d1cabdf
5,374
js
JavaScript
src/demo-server.js
briandemant/docker-k8s-test
0fd3eb08aca5d2bcbc45b19cd4535cecabeb1264
[ "Apache-2.0" ]
null
null
null
src/demo-server.js
briandemant/docker-k8s-test
0fd3eb08aca5d2bcbc45b19cd4535cecabeb1264
[ "Apache-2.0" ]
null
null
null
src/demo-server.js
briandemant/docker-k8s-test
0fd3eb08aca5d2bcbc45b19cd4535cecabeb1264
[ "Apache-2.0" ]
null
null
null
// content of index.js const http = require('http') const URL = require('url') const os = require('os') const port = 3000 const started = now() const healthchecks = { latest: {}, liveness: 0, readyness: 0, log: [], } let state = "init" const version = process.env.VERSION const codes = { "init": 404, "lost": 404, "sleepy": 406, "ok": 200, "distracted": 504, "better": 399, // kubernetes liveness accepts this "sick": 418, "stopping": 410, "dying": 503, } function getDelay(url) { let time = Math.max(url.query.delay | 0, 0) if (time == 0) { time = 10 } return 1000 * time } function delayedState(url, stateNow, stateLater) { let delay = getDelay(url) clearTimeout(delayedState.intervalId) if (typeof stateLater == 'string') { delayedState.intervalId = setTimeout(() => { console.log(`setting state to ${stateLater}`) state = stateLater if (state == "dead") { process.exit(1) } }, delay) } else { delayedState.intervalId = setTimeout(stateLater, delay) } console.log(`setting state from ${state} to ${stateNow}\n .. waiting ${delay}s for ${stateLater}`) state = stateNow return delay } function setState(newState) { clearTimeout(delayedState.intervalId) state = newState } function now() { return (new Date()).toISOString() } const requestHandler = (request, response) => { function respond(state, msg, end = true) { response.statusCode = data.meta.status let output = `version:${version}\n${msg}\n` if (typeof url.query.q == 'undefined') { data.meta.msg = msg data.meta.status = codes[state] output = JSON.stringify(data) } if (end) { response.end(output) } else { response.write(output) } } let url = URL.parse(request.url, true) let msg = `I'm feeling CONFUSED!` const data = { "meta": { "hostname": os.hostname(), "version": version, "msg": null, "status": 200, "started": started, }, "data": {}, "debug": { "request": { "url": request.url, "httpVersion": request.httpVersion, "method": request.method, "headers": request.headers, }, "env": process.env, "host": { "hostname": os.hostname(), "uptime": os.uptime(), "totalmem": os.totalmem(), "loadavg": os.loadavg(), "freemem": os.freemem(), "arch": os.arch(), "release": os.release(), "userInfo": os.userInfo(), "type": os.type(), "platform": os.platform(), "cpus": os.cpus(), "networkInterfaces": os.networkInterfaces(), }, }, } if (url.pathname == "/sleep") { let time = delayedState(url, "sleepy", "ok") msg = `I'm feeling ${state}! sleeping for ${time} seconds` } else if (url.pathname == "/wake") { setState("ok") msg = `I'm feeling ${state}!` } else if (url.pathname == "/sick") { let time = delayedState(url, "sick", "better") msg = `I'm feeling ${state}!` } else if (url.pathname == "/medicin") { let time = delayedState(url, "better", "ok") msg = `I'm feeling ${state}! wait ${time} seconds` } else if (url.pathname == "/distract") { msg = `I was distracted .. please wait ... like, 2 min :)` delayedState(url, "distracted", state) return respond("distracted", msg, false) } else if (url.pathname == "/slow") { return setTimeout(() => { respond("ok", `I am slow :)`) }, getDelay(url)) } else if (url.pathname == "/kill") { let time = delayedState(url, "dying", "dead") msg = `I'm dying! expected termination in ${time} seconds` } else if (url.pathname == "/stop") { return delayedState(url, "stopping", () => { console.log("The server will be stopped") respond("stopping", `I'm am now stopping`) server.close(() => { console.log("The server has been stopped") }) }) } else if (url.pathname == "/healthz" || url.pathname == "/") { const checkType = request.headers['x-check-header'] data.data = healthchecks if (checkType == "Liveness") { healthchecks.liveness++ healthchecks.latest = { type: "live", time: now(), state, } console.log(healthchecks.latest) healthchecks.log.push(healthchecks.latest) } else if (checkType == "Readyness") { healthchecks.readyness++ healthchecks.latest = { type: "ready", time: now(), state, } console.log(healthchecks.latest) healthchecks.log.push(healthchecks.latest) } if (healthchecks.log.length == 0) { data.data = {} } msg = `I'm feeling ${state}!` } else { return respond("lost", `I'm feeling CONFUSED!`) } respond(state, msg) } const server = http.createServer(requestHandler) // server.setTimeout(120 * 1000, (socket) => { // console.log("timeout triggered") // console.log(socket.end()) // // // }) server.listen(port, (err) => { if (err) { return console.log('something bad happened', err) } console.log(`Server v${version} is listening on ${port}`) delayedState({query: {delay: 10}}, "sleepy", "ok") }) // kill -1 [pid] // 1 2 3 15 12 'SIGHUP SIGINT SIGQUIT SIGTERM SIGUSR2' // SIGSTOP - 19 .split(/ /) .forEach((signal) => { console.log(`listening for ${signal}`) process.on(signal, () => { console.log(`Received ${signal} and quitting.`) process.exit() }) }) // 10 14 18 'SIGUSR1 SIGALRM SIGCONT' .split(/ /) .forEach((signal) => { console.log(`listening for ${signal}`) process.on(signal, () => { console.log(`Received ${signal} but keep running.`) }) })
22.965812
99
0.61444
27a3c8104e8e44da3f920d86cf41145cf92594ac
471
js
JavaScript
leftovers/experimental/ThreeLight.js
designstem/archive
af1cc787b2cb1cae09bdeee1a50cc8b1a3d411ae
[ "MIT" ]
null
null
null
leftovers/experimental/ThreeLight.js
designstem/archive
af1cc787b2cb1cae09bdeee1a50cc8b1a3d411ae
[ "MIT" ]
null
null
null
leftovers/experimental/ThreeLight.js
designstem/archive
af1cc787b2cb1cae09bdeee1a50cc8b1a3d411ae
[ "MIT" ]
null
null
null
import { Object3D } from "../3d/3d.js"; export default { mixins: [Object3D], tag: 'Experimental', props: { color: { default: 'white', type: [String, Number] }, intensity: { default: 1, type: Number } }, data() { let curObj = this.obj; if (!curObj) { curObj = new THREE.DirectionalLight( new THREE.Color(this.color), this.intensity ); } curObj.name = curObj.name || curObj.type; return { curObj }; } };
21.409091
56
0.564756
27a3cf67927e09129698bc433524c46d4231c5dc
2,660
js
JavaScript
example/src/screens-example/SideMenu.js
khanhqd/SuperSale2.0
6d03166fc7ee2c626d27c1ebe00e891139b5901d
[ "MIT" ]
null
null
null
example/src/screens-example/SideMenu.js
khanhqd/SuperSale2.0
6d03166fc7ee2c626d27c1ebe00e891139b5901d
[ "MIT" ]
null
null
null
example/src/screens-example/SideMenu.js
khanhqd/SuperSale2.0
6d03166fc7ee2c626d27c1ebe00e891139b5901d
[ "MIT" ]
null
null
null
import React, {Component} from 'react'; import { Text, View, ScrollView, TouchableOpacity, StyleSheet, AlertIOS } from 'react-native'; export default class SideMenu extends Component { constructor(props) { super(props); } render() { return ( <View style={styles.container}> <Text style={styles.title}>Night Pizza</Text> <TouchableOpacity onPress={ this.onPressGioiThieu.bind(this) }> <Text style={styles.button}>Giới thiệu</Text> </TouchableOpacity> <TouchableOpacity onPress={ this.onPressMenu.bind(this) }> <Text style={styles.button}>Menu</Text> </TouchableOpacity> <TouchableOpacity onPress={ this.onPressKhuyenMai.bind(this) }> <Text style={styles.button}>Khuyến mại</Text> </TouchableOpacity> <TouchableOpacity onPress={ this.onPressLienHe.bind(this) }> <Text style={styles.button}>Liên hệ</Text> </TouchableOpacity> </View> ); } // onReplaceTab2Press() { // this._toggleDrawer(); // // push/pop navigator actions affect the navigation stack of the current screen only. // // since side menu actions are normally directed at sibling tabs, push/pop will // // not help us. the recommended alternative is to use deep links for this purpose // this.props.navigator.handleDeepLink({ // link: "tab2/example.PushedScreen" // }); // } onPressGioiThieu() { this._toggleDrawer(); this.props.navigator.resetTo({ title: "Giới Thiệu", screen: "example.GioiThieu", animated:true }); } onPressMenu() { this._toggleDrawer(); this.props.navigator.resetTo({ title: "Menu", screen: "example.Menu", animated:true }); } onPressLienHe() { this._toggleDrawer(); this.props.navigator.push({ title: "Liên Hệ", screen: "example.LienHe", animated:true }); } onPressKhuyenMai() { this._toggleDrawer(); this.props.navigator.push({ title: "Khuyến Mãi", screen: "example.KhuyenMai", animated:false }); } _toggleDrawer() { this.props.navigator.toggleDrawer({ to: 'closed', side: 'left', animated: false }); } } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', backgroundColor: 'white', justifyContent: 'center', width: 300 }, title: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop:10, fontWeight: '500' }, button: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop:10, color: 'blue' } });
23.75
92
0.611654
27a6495dfebaaef3c5d0ce46e9380ac7850f2568
27,988
js
JavaScript
test/index.js
propadata/usergt
d3e4d33d269f96b10400ca5d3fd86d7cd6279bdd
[ "BSD-3-Clause" ]
null
null
null
test/index.js
propadata/usergt
d3e4d33d269f96b10400ca5d3fd86d7cd6279bdd
[ "BSD-3-Clause" ]
1
2017-05-29T14:15:51.000Z
2018-01-08T00:49:00.000Z
test/index.js
propadata/usergt
d3e4d33d269f96b10400ca5d3fd86d7cd6279bdd
[ "BSD-3-Clause" ]
1
2017-05-14T19:41:26.000Z
2017-05-14T19:41:26.000Z
'use strict'; const Code = require('code'); const Lab = require('lab'); const Usergt = require('../'); const Query = require('../lib/user/query/index.js'); // Test shortcuts const lab = exports.lab = Lab.script(); const describe = lab.describe; const it = lab.it; const expect = Code.expect; const beforeEach = lab.beforeEach; // const before = lab.before; // Declare internals const internals = {}; const Config = { dbname: 'usergt', connection: { host: 'localhost', port: 28015 }, test: true }; const newUser = { username: 'zoelogic', email: 'zoe@zoelogic.com', password: 'BiSyy44_+556677', // password: 'dasfadsf', scope: ['user', 'admin'], created: Date.now(), loginCount: 0, lockUntil: Date.now() - (60 * 1000) }; const invalidPasswordRecord = { username: 'zoelogic', email: 'js@zoelogic.com', password: 'BiSyy445577', scope: ['user'] }; const badUserRecord = { username: 'zoelogic', email: 'js@zoelogic.com', password: 'BiSyy44_+898989', scope: ['user'] }; const goodUserRecord = { username: 'zoelogic', email: 'zoe@zoelogic.com', password: 'BiSyy44_+556677', scope: ['user'] }; describe('usergt init', () => { it('successfully generates usergt', async () => { try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. expect(Object.keys(usergt).length).to.equal(10); } catch (error) { internals.usergt.close(); throw error; } }); it('builds penseur connection no test option set (connect versus establish)', async () => { Config.test = undefined; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. Config.test = true; expect(Object.keys(usergt).length).to.equal(10); }); it('builds penseur connection (connect versus establish)', async () => { Config.test = false; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. Config.test = true; expect(Object.keys(usergt).length).to.equal(10); }); it('fails to generate penseur connection', async () => { const original = Config.connection; delete Config.connection; try { await Usergt.init(Config); // Done at startup. } catch (error) { Config.connection = original; expect(error.message).to.equal('Cannot set property \'onDisconnect\' of undefined'); } }); }); describe('usergt.create', () => { it('succssfully creates user record.', async () => { try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.create(newUser); await usergt.close(); expect(record.length).to.equal(36); } catch (error) { internals.usergt.close(); throw error; } }); it('fails to create user record. username too long.', async () => { const original = newUser.username; newUser.username = '88888888888888888888888888888888888888888' + '99999999999999999999999999999999999999999'; try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.create(newUser); await usergt.close(); expect(record.length).to.equal(36); } catch (error) { // console.log('WATCH ERROR: ' + JSON.stringify(error)); // console.log('WATCH ERROR 2: ' + JSON.stringify(error.output)); expect(error.output.payload.statusCode).to.equal(422); expect(error.output.payload.error).to.equal('Unprocessable Entity'); expect(error.output.payload.message).to.equal('invalid user record'); internals.usergt.close(); newUser.username = original; } }); }); describe('usergt.destroy', () => { it('successfully destroys user document', async () => { Config.test = true; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const newUserRecordID = await usergt.create(newUser); expect(newUserRecordID.length).to.equal(36); const destroyResultId = await usergt.destroy(newUserRecordID); expect(newUserRecordID).to.equal(destroyResultId); const result = await usergt.db.user.get(newUserRecordID); expect(result).to.equal(null); await usergt.close(); }); it('fails to destroy document, ', async () => { Config.test = true; try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const newUserRecordID = await usergt.create(newUser); expect(newUserRecordID.length).to.equal(36); await usergt.disable('user', 'update'); await usergt.destroy(newUserRecordID); await usergt.close(); } catch (error) { expect(error.data.message).to.equal('disabled this.db.user.update'); expect(error.output.payload.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); } }); }); describe('usergt.authenticate', () => { beforeEach(async () => { Config.test = true; // destroys and rebuilds the db. const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.create(newUser); expect(record.length).to.equal(36); }); it('succssfully authenticates a user', async () => { try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.authenticate(goodUserRecord.username, goodUserRecord.password); // record equals authenticated user record (pasword is removed). await usergt.close(); expect(record.username).to.equal(goodUserRecord.username); expect(record.email).to.equal(goodUserRecord.email); } catch (error) { internals.usergt.close(); throw error; } }); it('fails to authenticate username does not exist', async () => { try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = goodUserRecord.username; goodUserRecord.username = 'notexists'; await usergt.authenticate(goodUserRecord.username, goodUserRecord.password); goodUserRecord.username = original; } catch (error) { expect(error.output.statusCode).to.equal(404); expect(error.output.payload.error).to.equal('Not Found'); expect(error.output.payload.message).to.equal('username does not exist'); internals.usergt.close(); } }); it('fails to authenticate user, findByUsername throw error', async () => { try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.db; delete usergt.db; await usergt.authenticate(goodUserRecord.username, goodUserRecord.password); usergt.db = original; await usergt.close(); } catch (error) { // internals.usergt.close(); expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); // throw error; } }); it('fails to authenticate user, invalid password', async () => { // invalid credentials which fail Joi validation throw errors wihout // hitting the database for a read. That is what happend here. try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.authenticate(invalidPasswordRecord.username, invalidPasswordRecord.password); } catch (error) { Config.test = true; await internals.usergt.close(); expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } }); it('fails to authenticate user, invalid username', async () => { // invalid credentials which fail Joi validation throw errors wihout // hitting the database for a read. This is what happens here. try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = invalidPasswordRecord.username; invalidPasswordRecord.username = '88888888888888888888888888888888888888888' + '99999999999999999999999999999999999999999'; await usergt.authenticate(invalidPasswordRecord.username, invalidPasswordRecord.password); invalidPasswordRecord.username = original; } catch (error) { Config.test = true; await internals.usergt.close(); expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('username incorrect'); } }); it('fails to authenticate user, valid(Joi) credentials but bad pw', async () => { try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.authenticate(badUserRecord.username, badUserRecord.password); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); internals.usergt.close(); } }); it('fails to authenticate, db.connect failure', async () => { try { Config.test = false; // create connection do not purge db on connect (establish). const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.connected; usergt.connected = false; await usergt.authenticate(goodUserRecord.username, goodUserRecord.password); usergt.connected = original; } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); internals.usergt.close(); } }); }); describe('usergt.authenticate lockout:', () => { it('locks out user on ten failed authentication attempts', async () => { const badAttempt1 = async function (count) { // const badUserRecord = { // username: 'zoelogic', // email: 'js@zoelogic.com', // password: 'BiSyy44_+898989', // scope: ['user'] // }; Config.test = false; let usergt; try { // console.log('start bad attempt' + count); usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.authenticate(badUserRecord.username, badUserRecord.password); // console.log('close bad attempt'); await usergt.close(); return record; } catch (error) { // console.log('error got it: ' + JSON.stringify(error)); usergt.close(); throw error; } }; const CreateUser = async (newUserRecord) => { Config.test = true; let usergt; try { usergt = await Usergt.init(Config); // Done at startup. const record = await usergt.create(newUserRecord); await usergt.close(); return record; } catch (error) { usergt.close(); throw error; } }; // InitiateLockout(); await CreateUser(newUser); try { await badAttempt1(1); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(2); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(3); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(4); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(5); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(6); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(7); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(8); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(9); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect'); } try { await badAttempt1(10); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('password incorrect (started lockout)'); } Config.test = false; const usergt = await Usergt.init(Config); const userDocument = await Query.user.findByUsername.call(usergt, badUserRecord.username); // console.log('FINISHED VIEW userdoc: ' + JSON.stringify(userDocument, 0, 2)); const now = Date.now(); const hours23 = (((1000 * 60) * 60) * 23); const lock23Limit = now + hours23; expect(userDocument.lockUntil).to.be.above(lock23Limit); // lockUntil time is great then 23 hours. // console.log('lockUntil: ' + userDocument.lockUntil); // console.log('now: ' + Date.now()); // console.log('difference:' + ((((userDocument.lockUntil - Date.now()) / 1000) / 60) / 60)); }); it('enforces lockout', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.authenticate(badUserRecord.username, newUser.password); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('user account locked'); } // await usergt.authenticate(newUser.username, newUser.password); }); it('fails to expire lockout. username does not exist.', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.expireLockout('badusername'); } catch (error) { expect(error.output.statusCode).to.equal(404); expect(error.output.payload.error).to.equal('Not Found'); expect(error.output.payload.message).to.equal('Expire lockout failed. username does not exist.'); } }); it('fails to expire lockout. db.connect fails.', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.connected; usergt.connected = false; await usergt.expireLockout(badUserRecord.username); usergt.connected = original; } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); } }); it('fails to expire lockout. this.db undefined.', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.db; delete usergt.db; await usergt.expireLockout(badUserRecord.username); usergt.db = original; } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); } }); it('expires the lockout', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const userRecord = await usergt.expireLockout(badUserRecord.username); // console.log('unlocked userRecord: ' + JSON.stringify(userRecord, 0 , 2)); // console.log('lockUntil: ' + userRecord.lockUntil); // console.log('now: ' + Date.now()); // console.log('difference:' + ((((userRecord.lockUntil - Date.now()) / 1000) / 60) / 60)); expect(userRecord.lockUntil).to.be.below(Date.now()); // lockUntil time is less than now. lockout is over. } catch (error) { } }); it('successfully authenticates after lockout expires', async () => { try { Config.test = false; // do not destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const userRecord = await usergt.authenticate(badUserRecord.username, newUser.password); // console.log('Authenticated UserRecord: ' + JSON.stringify(userRecord)); expect(userRecord.lockUntil).to.be.below(Date.now()); // lockUntil time is less than now. lockout is over. expect(userRecord.username).to.equal('zoelogic'); } catch (error) { expect(error.output.statusCode).to.equal(401); expect(error.output.payload.error).to.equal('Unauthorized'); expect(error.output.payload.message).to.equal('user account locked'); } }); }); describe('bcrypt', () => { it('fails salt generation - bcrypt genSalt failure', { parallel: false }, async () => { const Bcrypt = require('bcrypt'); const original = Bcrypt.genSalt; Bcrypt.genSalt = function (saltWorkFactor, callback) { Bcrypt.genSalt = original; return callback(new Error('mock bcrypt genSalt failure'), null); }; Config.test = true; try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.create(newUser); await usergt.close(); } catch (error) { // console.log('BBOOM ' + JSON.stringify(error)); expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.message).to.equal('bcrypt genSalt failed'); internals.usergt.close(); } }); it('fails to compare password - bcrypt compare failure', { parallel: false }, async () => { const Bcrypt = require('bcrypt'); const original = Bcrypt.compare; Bcrypt.compare = function (password, hash, callback) { Bcrypt.compare = original; return callback(new Error('mock bcrypt compare failure'), null); }; Config.test = true; try { Config.test = true; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.create(newUser); await usergt.authenticate(newUser.username, newUser.password); await usergt.close(); } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.message).to.equal('bcrypt compare failed'); internals.usergt.close(); } }); it('fails to hash incoming password - bcrypt hash failure', { parallel: false }, async () => { const Bcrypt = require('bcrypt'); const original = Bcrypt.hash; Bcrypt.hash = function (password, hash, callback) { Bcrypt.hash = original; return callback(new Error('mock bcrypt hash failure'), null); }; Config.test = true; try { Config.test = true; // destroy and rebuid db const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.create(newUser); // await usergt.authenticate(newUser.username, newUser.password); await usergt.close(); } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.message).to.equal('bcrypt hash failed'); internals.usergt.close(); } }); }); describe('query & utils coverage', () => { it('fails to set lockout, this.connect failure (Query.user.setLockout)', async () => { try { const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.connected; usergt.connected = false; await Query.user.setLockout.call(usergt, 999); usergt.connected = original; } catch (error) { internals.usergt.close(); expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); } }); it('fails to set lockout, this.db failure (Query.user.setLockout)', async () => { try { const usergt = await Usergt.init(Config); // Done at startup. const original = usergt.db; delete usergt.db; await Query.user.setLockout.call(usergt, 999); usergt.db = original; } catch (error) { expect(error.output.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); } }); it('fails to create user, this.db.user.insert failure (Query.user.create)', async () => { try { Config.test = true; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. await usergt.disable('user', 'insert'); await Query.user.create.call(usergt, 'mock user record'); } catch (error) { // console.log('WATCH ERROR 1: ' + JSON.stringify(error.data.message)); // console.log('WATCH ERROR 2: ' + JSON.stringify(error)); expect(error.data.message).to.equal('disabled this.db.user.insert'); expect(error.output.payload.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); internals.usergt.close(); } }); it('fails to resetLoginCount, this.db undefined (Query.user.resetLoginCount)', async () => { try { Config.test = true; const usergt = internals.usergt = await Usergt.init(Config); // Done at startup. const original = usergt.db; delete usergt.db; await Query.user.resetLoginCount.call(usergt, 999); usergt.db = original; } catch (error) { // console.log('WATCH ERROR 1: ' + JSON.stringify(error.data.message)); // console.log('WATCH ERROR 2: ' + JSON.stringify(error)); expect(error.output.payload.statusCode).to.equal(500); expect(error.output.payload.error).to.equal('Internal Server Error'); expect(error.output.payload.message).to.equal('An internal server error occurred'); internals.usergt.close(); } }); });
29.368311
119
0.576176
27a6911c7b7661c2a6f55f188ca3a404eccd0145
789
js
JavaScript
vueTp/src/store/modules/user.js
Horse-Riding/TP
55951d4bed8e2f41647fbbe2b327fca8da964ccd
[ "Apache-2.0" ]
null
null
null
vueTp/src/store/modules/user.js
Horse-Riding/TP
55951d4bed8e2f41647fbbe2b327fca8da964ccd
[ "Apache-2.0" ]
null
null
null
vueTp/src/store/modules/user.js
Horse-Riding/TP
55951d4bed8e2f41647fbbe2b327fca8da964ccd
[ "Apache-2.0" ]
null
null
null
// import $http from '../../common/js/newAxios.js'; // import apis from '../apis'; // let url = apis.apis.organize; // initial state // shape: [{ id, quantity }] let key = 'userInfo'; const state = { userInfo: null }; const getters = { getUserStorage() { if (!state.userInfo) { state.userInfo = JSON.parse(localStorage.getItem(key)); }; return state.userInfo; } }; // actions const actions = { }; // mutations const mutations = { // 设置storage登陆状态 setStorage(state, value) { state.userInfo = value; localStorage.setItem(key, JSON.stringify(value)); }, // 设置storage取消登录状态 removeStorage(state) { state.userInfo = null; localStorage.removeItem(key); } }; export default { namespaced: true, getters, state, actions, mutations };
18.785714
61
0.636248
27a6e7139d7856dd68d95aaab7a47a7dac34d8e0
12,870
js
JavaScript
ui/app/setup/setup.controller.js
ryanjdew/ml-slush-discovery-app
b3ad19b1998e60a873df14d275c3767c8e9ae9b9
[ "Apache-2.0" ]
9
2016-03-14T19:54:20.000Z
2020-04-22T23:49:11.000Z
ui/app/setup/setup.controller.js
ryanjdew/ml-slush-discovery-app
b3ad19b1998e60a873df14d275c3767c8e9ae9b9
[ "Apache-2.0" ]
77
2016-02-16T21:15:12.000Z
2018-09-21T16:50:02.000Z
ui/app/setup/setup.controller.js
ryanjdew/ml-slush-discovery-app
b3ad19b1998e60a873df14d275c3767c8e9ae9b9
[ "Apache-2.0" ]
8
2016-03-16T20:08:53.000Z
2020-04-22T23:49:13.000Z
(function() { 'use strict'; angular.module('app.setup') .controller('SetupCtrl', SetupCtrl); SetupCtrl.$inject = [ '$uibModal', '$scope', '$timeout', 'ServerConfig', '$window', 'MLSearchFactory', 'newGeospatialIndexDialog', 'editGeospatialIndexDialog', 'newRangeIndexDialog', 'editRangeIndexDialog', 'newLabelPartDialog', 'EditConstraintDialog', 'fieldDialog', 'EditChartConfigDialog', 'CommonUtil', 'UIService' ]; function SetupCtrl( $uibModal, $scope, $timeout, ServerConfig, win, searchFactory, newGeospatialIndexDialog, editGeospatialIndexDialog, newRangeIndexDialog, editRangeIndexDialog, newLabelPartDialog, EditConstraintDialog, fieldDialog, editChartConfigDialog, CommonUtil, UIService ) { var model = { uploadCollections: [], uploadType: 'file' }; var mlSearch = searchFactory.newContext(); $scope.decodeURIComponent = win.decodeURIComponent; function updateSearchResults() { $scope.error = null; return mlSearch.setPageLength(5).search().then( function(data) { model.isInErrorState = false; model.search = data; }, function() { model.search = {}; model.isInErrorState = true; }) .catch(function() { model.search = {}; model.isInErrorState = true; }); } function handleError(response) { $scope.error = response.data.message || response.data; } updateSearchResults(); function init() { ServerConfig.get().then(function(config) { model.dataCollections = []; model.databaseName = config.databaseName; model.chartData = config.chartData; model.fields = config.fields; model.rangeIndexes = config.rangeIndexes; model.geospatialIndexes = config.geospatialIndexes; model.searchOptions = config.searchOptions; model.constraints = config.searchOptions.options.constraint || []; model.sortList = listFromOperator(config.searchOptions.options.operator, 'sort-order'); model.snippetList = listFromOperator( config.searchOptions.options.operator, 'transform-results' ); model.sortOptions = _.filter( config.searchOptions.options.operator, function(val) { return val.name === 'sort'; } )[0]; model.uiConfig = config.uiConfig; model.databaseOptions = config.databases; model.existingIndexes = angular.extend({}, model.rangeIndexes, model.geospatialIndexes, model.fields) $scope.$emit('uiConfigChanged', model.uiConfig); }); } init(); function listFromOperator(operatorArray, operatorType) { return (_.filter( operatorArray, function(val) { return val && val.state && val.state[0] && val.state[0][operatorType]; } )[0] || { state: []}).state.map(function(state) { return state.name; }); } angular.extend($scope, { model: model, constraintSortableOptions: { containment: '#constraint-table', containerPositioning: 'relative' }, state: 'database', mlSearch: mlSearch, isInputDirSupported: function() { var tmpInput = document.createElement('input'); if ('webkitdirectory' in tmpInput || 'mozdirectory' in tmpInput || 'odirectory' in tmpInput || 'msdirectory' in tmpInput || 'directory' in tmpInput) { return true; } return false; }, setDatabase: function() { ServerConfig.setDatabase({ 'database-name': model.databaseName }).then(function() { $scope.error = null; init(); updateSearchResults(); }, handleError); }, addDatabase: function() { $uibModal.open({ template: '<div>' + '<div class="modal-header">' + '<button type="button" class="close" ng-click="$dismiss()">' + '<span aria-hidden="true">&times;</span>' + '<span class="sr-only">Close</span>' + '</button>' + '<h4 class="modal-title">Add Database</h4>' + '</div>' + '<div class="modal-body">' + '<form name="form">' + '<div class="form-group">' + '<label class="control-label">Database Name </label>&nbsp;' + '<input type="text" ng-model="dbName" />' + '</div>' + '<div class="clearfix">' + '<button type="button" class="btn btn-primary pull-right" ng-click="add()">' + 'Add</button>' + '</div>' + '</form>' + '</div>' + '</div>', controller: ['$uibModalInstance', '$scope', function($uibModalInstance, $scope) { $scope.add = function() { if ($scope.dbName && $scope.dbName !== '') { $uibModalInstance.close($scope.dbName); } }; }], size: 'sm' }).result.then(function(dbName) { model.databaseOptions.push(dbName); model.databaseOptions.sort(function(a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); model.databaseName = dbName; }); }, loadData: function() { var uploaderInput = document.getElementById(model.uploadType + 'Uploader'); var allFiles = ServerConfig.arrangeFiles(uploaderInput.files); $scope.isUploading = true; $scope.currentFilesToUpload = allFiles.length; $scope.currentFilesUploaded = 0; ServerConfig.bulkUpload(allFiles, $scope.model.uploadCollections).then(function(data) { updateSearchResults().then(function() { $scope.state = 'appearance'; $scope.redrawCharts(); }); $scope.isUploading = false; try { uploaderInput.value = ''; } catch (e) {} $scope.currentFilesToUpload = 0; $scope.currentFilesUploaded = 0; $scope.model.uploadCollections.length = 0; }, handleError, function(updatedCount) { $scope.currentFilesUploaded = updatedCount; }); }, clearData: function() { ServerConfig.clearData().then(function(data) { updateSearchResults().then(function() { $scope.state = 'appearance'; $scope.redrawCharts(); }); }, handleError); }, loadResultsTab: function() { updateSearchResults().then(function() { $scope.state = 'appearance'; $scope.redrawCharts(); }); }, removeCollection: function(index) { ServerConfig.removeDataCollection(model.dataCollections[index]).then(function() { model.dataCollections.splice(index, 1); updateSearchResults().then(function() { $scope.state = 'appearance'; $scope.redrawCharts(); }); }, handleError); }, clearLoadDataInfo: function() { $scope.loadDataInfo = null; }, clearError: function() { $scope.error = null; }, removeIndex: function(indexPosition) { model.rangeIndexes['range-index-list'].splice(indexPosition, 1); ServerConfig.setRangeIndexes(model.rangeIndexes).then(updateSearchResults, handleError); }, editIndex: function(index) { editRangeIndexDialog(index).then(function(index) { if (index) { ServerConfig.setRangeIndexes(model.rangeIndexes).then(function() { ServerConfig.setFields(model.fields).then(updateSearchResults, handleError); }, handleError); } }); }, redrawCharts: function() { $timeout(function() { $scope.$broadcast('highchartsng.reflow'); }); }, editChart: function(eChart, index) { editChartConfigDialog(model.search.facets, eChart).then(function(chart) { model.chartData.charts[index] = chart; ServerConfig.setCharts(model.chartData).then(updateSearchResults, handleError); }); }, addChart: function() { editChartConfigDialog(model.search.facets).then(function(chart) { model.chartData.charts.push(chart); ServerConfig.setCharts(model.chartData).then(updateSearchResults, handleError); }); }, removeChart: function(chartPosition) { model.chartData.charts.splice(chartPosition, 1); ServerConfig.setCharts(model.chartData).then(updateSearchResults, handleError); }, addIndex: function() { newRangeIndexDialog(model.fields['field-list']).then(function(index) { model.rangeIndexes['range-index-list'].push(index); ServerConfig.setRangeIndexes(model.rangeIndexes).then(function() { ServerConfig.setFields(model.fields).then(updateSearchResults, handleError); }, handleError); }); }, addGeospatialIndex: function() { newGeospatialIndexDialog().then(function(index) { model.geospatialIndexes['geospatial-index-list'].push(index); ServerConfig.setGeospatialIndexes( model.geospatialIndexes).then(updateSearchResults, handleError); }); }, editGeospatialIndex: function(gsIndex) { editGeospatialIndexDialog(gsIndex).then(function() { ServerConfig.setGeospatialIndexes( model.geospatialIndexes).then(updateSearchResults, handleError); }); }, removeGeospatialIndex: function(index) { model.geospatialIndexes['geospatial-index-list'].splice(index, 1); ServerConfig.setGeospatialIndexes( model.geospatialIndexes).then(updateSearchResults, handleError); }, removeField: function(fieldPosition) { model.fields['field-list'].splice(fieldPosition, 1); ServerConfig.setFields(model.fields).then(updateSearchResults, handleError); }, addField: function() { fieldDialog().then(function(field) { model.fields['field-list'].push(field); ServerConfig.setFields(model.fields).then(updateSearchResults, handleError); }); }, editField: function(field) { fieldDialog(field).then(function(field) { if (field) { ServerConfig.setFields(model.fields).then(updateSearchResults, handleError); } }); }, previewUiConfig: function() { UIService.setLayout(model.uiConfig); }, setUiConfig: function() { UIService.setUIConfig(model.uiConfig) .then( function() { UIService.setLayout(model.uiConfig); updateSearchResults(); }, handleError); }, resetUiConfig: function() { model.uiConfig.logo = null; model.uiConfig.page = {}; model.uiConfig.color = null; model.uiConfig.footer = {}; UIService.setUIConfig(model.uiConfig) .then( function() { UIService.setLayout(model.uiConfig); updateSearchResults(); }, handleError); }, getUiConfig: function() { model.uiConfig = UIService.getUIConfig(); return model.uiConfig; }, previewImage: function(uiConfig, files) { var file = files[0]; var reader = new FileReader(); reader.onloadend = function () { uiConfig.logo = uiConfig.logo || {}; uiConfig.logo.image = reader.result; $scope.$apply(); }; if (file) { reader.readAsDataURL(file); } else { uiConfig.logo.image = ''; } }, removeLabelPart: function(index) { model.uiConfig['result-label'].splice(index, 1); $scope.setUiConfig(); }, addLabelPart: function() { newLabelPartDialog().then(function(part) { if (!model.uiConfig['result-label']) { model.uiConfig['result-label'] = []; } model.uiConfig['result-label'].push(part); $scope.setUiConfig(); }); }, removeResultMetadata: function(index) { model.uiConfig['result-metadata'].splice(index, 1); $scope.setUiConfig(); }, addResultMetadata: function() { newLabelPartDialog(true).then(function(part) { if (!model.uiConfig['result-metadata']) { model.uiConfig['result-metadata'] = []; } model.uiConfig['result-metadata'].push(part); $scope.setUiConfig(); }); } }); } }());
34.783784
96
0.574592
27a755a8daf2ed0ca37926e761747590621c2301
434
js
JavaScript
lib/components/SelectFood/FoodList.js
wungsow/mactrac
aa03485c5d468a00c0d9f7f8ef1bc85fe5a8ef01
[ "MIT" ]
null
null
null
lib/components/SelectFood/FoodList.js
wungsow/mactrac
aa03485c5d468a00c0d9f7f8ef1bc85fe5a8ef01
[ "MIT" ]
null
null
null
lib/components/SelectFood/FoodList.js
wungsow/mactrac
aa03485c5d468a00c0d9f7f8ef1bc85fe5a8ef01
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import FoodListItem from './FoodListItem'; const FoodList = ({ items = [], onItemClick }) => (items.map((item, index) => (<FoodListItem key={index} food={item} onClick={onItemClick}></FoodListItem>))); FoodList.propTypes = { items: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string })), onItemClick: PropTypes.func.isRequired }; export default FoodList;
33.384615
110
0.718894
27a7ea84012fd9791a69997c88dbbebc86c23502
1,972
js
JavaScript
dist/utils/createJsonEditor.js
Missyamy/tomo-cli
0b44382d127d4fd5e3d8a61af5c999d4df26c44f
[ "MIT" ]
null
null
null
dist/utils/createJsonEditor.js
Missyamy/tomo-cli
0b44382d127d4fd5e3d8a61af5c999d4df26c44f
[ "MIT" ]
null
null
null
dist/utils/createJsonEditor.js
Missyamy/tomo-cli
0b44382d127d4fd5e3d8a61af5c999d4df26c44f
[ "MIT" ]
null
null
null
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");require("core-js/modules/es.array.includes"),require("core-js/modules/es.array.iterator"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.createJsonEditor=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_path=require("path"),_fsExtra=require("fs-extra"),_BasicEditor=_interopRequireDefault(require("./BasicEditor")),_common=require("./common");const{assign}=Object,INDENT_SPACES=4,createJsonEditor=(a,b={})=>{var c;return c=class extends _BasicEditor.default{constructor(c=process.cwd()){super(),(0,_defineProperty2.default)(this,"contents",b);const d=(0,_path.join)(c,a);assign(this,{path:d})}create(){const a=this,{contents:b,fs:c,path:d,queue:e}=a;return(0,_fsExtra.existsSync)(d)||e.add(()=>c.writeJSON(d,b,null,INDENT_SPACES)),a}read(){const{fs:a,path:b}=this;return a.readJSON(b)||""}extend(a){const b=this,{fs:c,path:d,queue:e}=b;return e.add(()=>c.extendJSON(d,a,null,INDENT_SPACES)),b}/** * Check if package.json manifest file has dependencies (dependencies or devDependencies) * @param {...string} modules npm module names * @return {Boolean} Has at least one dependency (true) or none (false) */hasSome(...a){const{keys:b}=Object,c=this.read(),{dependencies:d,devDependencies:e}=(0,_common.parse)(c),f=[...b(d?d:{}),...b(e?e:{})];return a.some(a=>f.includes(a))}/** * Check if package.json manifest file has dependencies (dependencies or devDependencies) * @param {...string} modules npm module names * @return {Boolean} Has all dependencies (true) or not all (false) */hasAll(...a){const{keys:b}=Object,c=this.read(),{dependencies:d,devDependencies:e}=(0,_common.parse)(c),f=[...b(d?d:{}),...b(e?e:{})];return a.every(a=>f.includes(a))}},c};exports.createJsonEditor=createJsonEditor;var _default=createJsonEditor;exports.default=_default;
219.111111
1,077
0.727688
27a8e387519b0ae0f235b6f6e1bb2adce6c40721
3,803
js
JavaScript
assets/scripts/rk-parallax.js
kowal2499/wptheme-trzywymiary
e58c0ae73572fcaa68d01084fb2eb5c4d53d8430
[ "MIT" ]
null
null
null
assets/scripts/rk-parallax.js
kowal2499/wptheme-trzywymiary
e58c0ae73572fcaa68d01084fb2eb5c4d53d8430
[ "MIT" ]
null
null
null
assets/scripts/rk-parallax.js
kowal2499/wptheme-trzywymiary
e58c0ae73572fcaa68d01084fb2eb5c4d53d8430
[ "MIT" ]
null
null
null
(function () { "use strict"; var ParallaxClass = function() { var bucket = document.querySelector(".parallax"); var doc = document.documentElement; var oldScroll = 0; var keywords = ["agresja", "lęk", "mobbing", "uzależnienie", "złość", "rozstanie", "depresja", "DDA", "nerwica", "bezsenność", "sens życia", "mobbing", "anoreksja", "bulimia", "rozstanie", "stres", "żałoba", "schizofrenia", "kim jestem ?", "mobbing", "współuzależnienie", "cierpienie", "sens życia", "smutek", "samotność", "fobia", "kryzys", "rozwód"] var database = []; var bindEvents = function() { window.addEventListener("scroll", onScroll.bind(this)); } var onScroll = function() { var currentScroll = getYScrollPos(); doAnimation(currentScroll - oldScroll); oldScroll = currentScroll; } var getYScrollPos = function() { var top = parseInt((window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)); return top; } /* ANIMATION */ var doAnimation = function(_step) { for (var i=0; i<database.length; i++) { database[i]['posY'] = database[i]['posY'] - (_step / 30 * database[i]['speed'] * database[i]['speed']); // database[i]['element'].style.top = database[i]['posY'] + 'px'; jQuery(database[i]['element']).stop(true); jQuery(database[i]['element']).animate({ top: database[i]['posY'] }, {duration: 1200}, function() {}); } } /* INIT */ this.init = function() { // initiate database object for (var i=0; i < keywords.length; i++) { database.push( { 'word': keywords[i] } ); } // calc content for (var i=0; i<database.length; i++) { var para = document.createElement("p"); var node = document.createTextNode(database[i]['word']); database[i]['element'] = para; database[i]['speed'] = parseInt(Math.random() * 3) + 2; para.style.fontSize = database[i]['speed'] - 0.8 + 'em'; para.style.letterSpacing = database[i]['speed']*1.5 + 'px'; // var shadow, color; // switch (database[i]['speed']) { // case 2: // shadow = 3; break; // case 3: // shadow = 5; break; // default: // shadow = 3; break; // } // color = 30; // para.style.color = "rgb("+color+","+color+","+color+")"; // // para.style.textShadow = "0px 0px 3px #fff"; // para.style.textShadow = "0px 0px " + shadow + "px #eee"; para.appendChild(node); bucket.appendChild(para); } scatterElements(); bindEvents(); } /* SCATTER ELEMENTS */ var scatterElements = function() { var previousElementHeight = 30; var columnWidth = parseInt(bucket.offsetWidth/3); var column = 0; for (var i=0; i<database.length; i++) { var newPosX = parseInt(column*columnWidth + (bucket.offsetWidth/3 - database[i]['element'].offsetWidth) * Math.random()); database[i]['posX'] = newPosX; database[i]['posY'] = previousElementHeight + 50; previousElementHeight += database[i]['element'].offsetHeight; database[i]['element'].style.left = database[i]['posX'] + 'px'; database[i]['element'].style.top = database[i]['posY'] + 'px'; if ( ( i>0 ) && ( ( i % parseInt(database.length / 3) ) == 0)) { column = column + 1; previousElementHeight = 0; } } } } var myParallax = new ParallaxClass(); myParallax.init(); }) ();
33.955357
356
0.520642
27a90ef964e980aa3143f3db68416bb5439b6d09
1,811
js
JavaScript
src/components/action/input.js
vpsfreecz/haveapi-webui
0bd3d97cd2a599b6544b912f5ac0fb4728ac32c2
[ "MIT" ]
2
2016-11-20T19:26:43.000Z
2021-01-17T10:15:48.000Z
src/components/action/input.js
vpsfreecz/haveapi-webui
0bd3d97cd2a599b6544b912f5ac0fb4728ac32c2
[ "MIT" ]
1
2017-12-30T13:39:16.000Z
2017-12-30T16:07:43.000Z
src/components/action/input.js
vpsfreecz/haveapi-webui
0bd3d97cd2a599b6544b912f5ac0fb4728ac32c2
[ "MIT" ]
null
null
null
import React from 'react' import {Col, Form, FormGroup, Button} from 'react-bootstrap' import InputParameter from './input/parameter' export default React.createClass({ getInitialState: function () { return this.props.initialData || {}; }, componentDidMount: function () { if (this.props.initialData) this.setState(this.props.initialData); }, componentWillReceiveProps: function (nextProps) { if (nextProps.initialData) this.setState(nextProps.initialData); }, handleChange: function (param, value) { var state = {}; state[param] = value; console.log('input param reported changed', param, value); this.setState(Object.assign({}, this.state, state)); }, submit: function (e) { e.preventDefault(); console.log('submited with', this.state); var params = {}; for (var p in this.state) { var v = this.state[p]; if (!this.state.hasOwnProperty(p)) continue; if (v === '' || v === null || v === undefined) continue; params[p] = v; } console.log('filtered to', params); this.props.onSubmit(params); }, render: function () { var params = {}; if (this.props.action.description.input) params = this.props.action.description.input.parameters; return ( <Form horizontal onSubmit={this.submit}> {Object.keys(params).map(p => ( <InputParameter key={p} name={p} desc={params[p]} initialValue={this.state[p] === undefined ? '' : this.state[p]} errors={this.props.errors[p]} onChange={this.handleChange.bind(this, p)} /> ))} <FormGroup> <Col sm={10} smOffset={2}> {this.props.executing ? ( <Button type="submit" disabled>Executing...</Button> ) : ( <Button type="submit">Execute</Button> )} </Col> </FormGroup> </Form> ); }, });
21.819277
69
0.623965
27a94586d67098d59e90e09ee714191e6a077d64
9,403
js
JavaScript
src/components/SimpleMap/index.js
Damjan011/piperski-gatsby
b15a1806eb19b33c0a3862af00517de0b9b567b9
[ "RSA-MD" ]
null
null
null
src/components/SimpleMap/index.js
Damjan011/piperski-gatsby
b15a1806eb19b33c0a3862af00517de0b9b567b9
[ "RSA-MD" ]
null
null
null
src/components/SimpleMap/index.js
Damjan011/piperski-gatsby
b15a1806eb19b33c0a3862af00517de0b9b567b9
[ "RSA-MD" ]
null
null
null
import React, { useEffect, useState } from "react"; import "./style.css"; import GoogleMapReact from "google-map-react"; import MapPinIcon from "../Icons/MapPinIcon"; import MapPinNewIcon from "../Icons/MapPinNewIcon"; import XIcon from "../Icons/XIcon"; import MriIcon from "../Icons/MriIcon"; import HospitalIcon from "../Icons/HospitalIcon"; const distanceToMouse = (pt, mp) => { if (pt && mp) { return Math.sqrt( (pt.x - mp.x) * (pt.x - mp.x) + (pt.y - mp.y) * (pt.y - mp.y) ); } }; const places = [ // serbia { country: 'Srbija', title: "Beograd", lat: 44.8125, lng: 20.4612, projects: [ { facility: 'Dr Konjović', mri: 'Philips' }, { facility: 'Bolnica "Sveti Sava"', mri: 'GE' }, { facility: 'Univerzitetska dečija bolnica', mri: 'Philips' }, { facility: 'KBC Zemun', mri: 'Canon' }, { facility: 'Klinika za digestivne bolesti KCS', mri: 'Philips' }, { facility: 'Institut za neurologiju', mri: 'Philips' }, ] }, { country: 'Srbija', title: "Čačak", lat: 43.8914, lng: 20.3506, projects: [ { facility: 'Hipokrat MR', mri: 'Philips' } ] }, { country: 'Srbija', title: "Sremska Mitrovica", lat: 44.9798, lng: 19.6102, projects: [ { facility: 'Sirmium Medic', mri: 'Philips' } ] }, { country: 'Srbija', title: "Užice", lat: 43.8556, lng: 19.8425, projects: [ { facility: 'Zdravstveni Centar Užice', mri: 'GE' } ] }, { country: 'Srbija', title: "Novi Sad", lat: 45.24704, lng: 19.84669, projects: [ { facility: 'Klinički centar Vojvodine', mri: 'GE' }, { facility: 'Zdravlje plus', mri: 'Philips' }, ] }, { country: 'Srbija', title: "Sombor", lat: 45.7733, lng: 19.1151, projects: [ { facility: 'Poliklinika Consilium', mri: 'Philips' } ] }, // bosnia { id: 3, title: "Zenica", lat: 44.2034, lng: 17.9077, projects: [ { facility: 'Poliklinika "DR Strika"', mri: 'GE' } ] }, { id: 3, title: "Bijeljina", lat: 44.7570, lng: 19.2150, projects: [ { facility: 'Medik - T', mri: 'Philips' } ] }, { id: 3, title: "Doboj", lat: 44.7349, lng: 18.0843, projects: [ { facility: 'Dijagnostički centar Dr Brkic', mri: 'Philips' } ] }, { id: 3, title: "Brčko", lat: 44.8727, lng: 18.8106, projects: [ { facility: 'Spec. Ordinacija ALFA', mri: 'Philips' } ] }, { id: 3, title: "Zvornik", lat: 44.3865, lng: 19.1048, projects: [ { facility: 'Opšta bolnica Zvornik', mri: 'GE' } ] }, // macedonia { id: 3, title: "Tetovo", lat: 42.0069, lng: 20.9715, projects: [ { facility: 'Klinička bolnica Tetovo', mri: 'GE' } ] }, { title: "Skopje", lat: 41.9981, lng: 21.4254, projects: [ { facility: 'Klinička bolnica "Sistina"', mri: 'GE' }, { facility: 'Gradska bolnica Skopje', mri: 'GE' }, { facility: 'Klinička bolnica "Sistina"', mri: 'GE 3T' }, ] }, { title: "Štip", lat: 41.7464, lng: 22.1997, projects: [ { facility: 'Klinička bolnica Štip', mri: 'GE' }, ] }, { title: "Petrovec", lat: 41.9402, lng: 21.6094, projects: [ { facility: 'Euroitalia', mri: 'GE' } ] }, // moldavia { id: 3, title: "Balti", lat: 47.7540, lng: 27.9184, projects: [ { facility: 'Incomed', mri: 'Philips' } ] }, // poland { id: 3, title: "Bielsko-biala", lat: 49.8224, lng: 19.0584, projects: [ { facility: 'Klinika Św. Łukasza', mri: 'Philips' } ] }, // italy { id: 3, title: "Trapani", lat: 38.0174, lng: 12.5365, projects: [ {facility: 'Multimedica Trapanese', mri: 'Neusoft'} ] }, // india { title: "Karur", lng: 78.0766, lat: 10.9601, projects: [ {facility: 'Cura Healthcare', mri: 'Philips'} ] }, { title: "Jaipur", lng: 75.7873, lat: 26.9124, projects: [ {facility: 'Cura Healthcare', mri: 'Philips'} ] }, // belarus { id: 2, title: "Minsk", lat: 53.9006, lng: 27.5590, projects: [ {facility: 'Avicenna Medical', mri: 'Philips'}, ] }, // montenegro { id: 3, title: "Berane", lat: 42.8379, lng: 19.8604, projects: [ {facility: 'Poliklinika Stojanović', mri: 'GE'}, ] }, { id: 3, title: "Podgorica", lat: 42.4304, lng: 19.2594, projects: [ {facility: 'Hotel Lovćen', mri: 'GE'}, ] }, // bulgaria { id: 3, title: "Sofija", lat: 42.6977, lng: 23.3219, projects: [ {facility: 'Neo Clinic', mri: 'GE'}, // OVO PROVERI I PROMENI ] }, // germany //saarbrucken t { id: 3, title: "Saarbrücken", lat: 49.2402, lng: 6.9969, projects: [ {facility: 'Joint Orthopedic Clinic', mri: 'Philips'}, {facility: 'Joint Orthopedic Clinic (zamena magneta)', mri: 'Philips'}, ] }, { id: 3, title: "Schweinfurt", lat: 50.0492, lng: 10.2194, projects: [ {facility: 'Leopoldina', mri: 'Philips'}, ] }, { id: 3, title: "Frankfurt", lat: 50.1109, lng: 8.6821, projects: [ {facility: 'Main Clinic', mri: 'Philips'}, ] }, { id: 3, title: "Föhren", lat: 49.8588, lng: 6.7657, projects: [ {facility: 'Promed', mri: 'Philips 3T'}, {facility: 'InHealth mobile magnet', mri: 'Philips'}, {facility: 'Calumet mobile magnet', mri: 'Philips'}, {facility: 'Smith mobile magnet', mri: 'Philips'}, {facility: 'Smith relocatable magnet', mri: 'Philips'}, {facility: 'Promed', mri: 'Philips'}, ] }, { id: 3, title: "Bad Sobernheim", lat: 49.7858, lng: 7.6515, projects: [ {facility: 'Sanomed', mri: 'Philips'}, ] }, { id: 3, title: "Mannheim", lat: 49.4875, lng: 8.4660, projects: [ {facility: 'Praxis Dr J.J. Kirsch & Kollegen', mri: 'Philips'} ] }, ]; // tip posla: konstrukcija kabine ```` servisiranje/modifikacija const SimpleMap = () => { const [close, setClose] = useState(0); const InfoWindow = ({ title, active, projects }) => { if (active) { return ( <div className={`pin-info-wrapper ${projects.length > 1 ? 'larger' : ''}`}> <div className="pin-info-header"> <div style={{ width: '18px' }}></div> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}> <MapPinIcon fill='#444' marginBottom={0} width={15} /> <p>{title}</p> </div> <XIcon width={22} fill='#666' /> </div> <div className="pin-info-inner-wrapper"> {projects?.map((e, index) => ( <> {projects.length > 1 && <div className="projects-counter">{index + 1}. Projekat:</div>} <div className="pin-info-body"> <div className="pin-info-row"> <div className="pin-info-desc"> <p>MRI:</p> </div> <div className="pin-info-label"> <MriIcon fill='#444' width={22} /> <p>{e.mri}</p> </div> </div> <div className="pin-info-row"> <div className="pin-info-desc"> <p>Ustanova:</p> </div> <div className="pin-info-label"> <HospitalIcon fill='#444' width={22} /> <p>{e.facility}</p> </div> </div> </div> </> ))} </div> </div> ); } else { return null; } } const Marker = ({ title, setCurState, lat, lng, projects }) => { const handleClick = () => { setCurState({ lat: lat, lng: lng, title: title, active: true, projects: projects, }) } return ( <div onClick={handleClick} className="marker-wrapper"> <MapPinNewIcon width={18} /> </div> ); }; const [center, setCenter] = useState([46.506, 24.169949]); const [windowWidth, setWindowWidth] = useState(window.innerWidth); const [curState, setCurState] = useState({ lat: 37.506, lng: 20.169949, title: '', active: false, projects: null, }); useEffect(() => { setTimeout(() => { if (windowWidth < 1100) { setCurState({ lat: 45.506, lng: 20.169949, title: '', active: false, projects: null, }) } }, 500) }, []); useEffect(() => { setCenter([curState.lat, curState.lng]) }, [curState]) let infoBox = <InfoWindow lat={curState.lat} lng={curState.lng} title={curState.title} active={curState.active} projects={curState.projects} /> return ( <div className="map"> <GoogleMapReact onClick={() => setCurState({ ...curState, active: false })} bootstrapURLKeys={{ key: 'AIzaSyAddxvveo89wrKJZJHfpVYn2VsZZsHhdsA', language: "en", region: "US" }} defaultCenter={[46.506, 24.169949]} center={center} defaultZoom={3.8} distanceToMouse={distanceToMouse} > {places.map(({ lat, lng, title, projects }) => { return ( <Marker close={close} lat={lat} lng={lng} title={title} setCurState={setCurState} projects={projects} /> ); })} {infoBox} </GoogleMapReact> </div> ); } export default SimpleMap;
30.430421
103
0.524407
27a994857839ffabd66a6ed2d835cff222174cbd
14,108
js
JavaScript
server/src/main/resources/static/smart/launch.bundle.js
kumarerubandi/DTR-CRD
fa75f094993201d450ccf7ae0f5d893d4ac26e27
[ "Apache-2.0" ]
null
null
null
server/src/main/resources/static/smart/launch.bundle.js
kumarerubandi/DTR-CRD
fa75f094993201d450ccf7ae0f5d893d4ac26e27
[ "Apache-2.0" ]
8
2020-03-04T22:35:13.000Z
2021-12-09T21:00:52.000Z
server/src/main/resources/static/smart/launch.bundle.js
kumarerubandi/DTR-CRD
fa75f094993201d450ccf7ae0f5d893d4ac26e27
[ "Apache-2.0" ]
null
null
null
!function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(n){return t[n]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/",n(n.s=381)}({100:function(t,n,e){var r=e(19),o=e(52),i=e(43)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},101:function(t,n,e){e(8)&&"g"!=/./g.flags&&e(12).f(RegExp.prototype,"flags",{configurable:!0,get:e(64)})},102:function(t,n,e){e(44)("split",2,function(t,n,r){"use strict";var o=e(78),i=r,u=[].push,c="split",a="length",s="lastIndex";if("c"=="abbc"[c](/(b)*/)[1]||4!="test"[c](/(?:)/,-1)[a]||2!="ab"[c](/(?:ab)*/)[a]||4!="."[c](/(.?)(.?)/)[a]||1<"."[c](/()()/)[a]||""[c](/.?/)[a]){var f=void 0===/()??/.exec("")[1];r=function(t,n){var e=this+"";if(void 0===t&&0===n)return[];if(!o(t))return i.call(e,t,n);var r,c,l,p,v,d=[],y=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),h=0,g=void 0===n?4294967295:n>>>0,x=new RegExp(t.source,y+"g");for(f||(r=new RegExp("^"+x.source+"$(?!\\s)",y));(c=x.exec(e))&&!((l=c.index+c[0][a])>h&&(d.push(e.slice(h,c.index)),!f&&1<c[a]&&c[0].replace(r,function(){for(v=1;v<arguments[a]-2;v++)void 0===arguments[v]&&(c[v]=void 0)}),1<c[a]&&c.index<e[a]&&u.apply(d,c.slice(1)),p=c[0][a],h=l,d[a]>=g));)x[s]===c.index&&x[s]++;return h===e[a]?(p||!x.test(""))&&d.push(""):d.push(e.slice(h)),d[a]>g?d.slice(0,g):d}}else"0"[c](void 0,0)[a]&&(r=function(t,n){return void 0===t&&0===n?[]:i.call(this,t,n)});return[function(e,o){var i=t(this),u=null==e?void 0:e[n];return void 0===u?r.call(i+"",e,o):u.call(e,i,o)},r]})},11:function(t,n,e){var r=e(12),o=e(37);t.exports=e(8)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},12:function(t,n,e){var r=e(9),o=e(71),i=e(61),u=Object.defineProperty;n.f=e(8)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},13:function(t,n,e){var r=e(6),o=e(21),i=e(11),u=e(15),c=e(27),a="prototype",s=function(t,n,e){var f,l,p,v,d=t&s.F,y=t&s.G,h=t&s.S,g=t&s.P,x=t&s.B,m=y?r:h?r[n]||(r[n]={}):(r[n]||{})[a],b=y?o:o[n]||(o[n]={}),S=b[a]||(b[a]={});for(f in y&&(e=n),e)p=((l=!d&&m&&void 0!==m[f])?m:e)[f],v=x&&l?c(p,r):g&&"function"==typeof p?c(Function.call,p):p,m&&u(m,f,p,t&s.U),b[f]!=p&&i(b,f,v),g&&S[f]!=p&&(S[f]=p)};r.core=o,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},14:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},15:function(t,n,e){var r=e(6),o=e(11),i=e(19),u=e(30)("src"),c="toString",a=Function[c],s=(""+a).split(c);e(21).inspectSource=function(t){return a.call(t)},(t.exports=function(t,n,e,c){var a="function"==typeof e;a&&(i(e,"name")||o(e,"name",n)),t[n]===e||(a&&(i(e,u)||o(e,u,t[n]?""+t[n]:s.join(n+""))),t===r?t[n]=e:c?t[n]?t[n]=e:o(t,n,e):(delete t[n],o(t,n,e)))})(Function.prototype,c,function(){return"function"==typeof this&&this[u]||a.call(this)})},18:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},19:function(t){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},21:function(t){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},22:function(t,n,e){var r=e(73),o=e(18);t.exports=function(t){return r(o(t))}},25:function(t,n,e){for(var r=e(26),o=e(33),i=e(15),u=e(6),c=e(11),a=e(31),s=e(4),f=s("iterator"),l=s("toStringTag"),p=a.Array,v={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(v),y=0;y<d.length;y++){var h,g=d[y],x=v[g],m=u[g],b=m&&m.prototype;if(b&&(b[f]||c(b,f,p),b[l]||c(b,l,g),a[g]=p,x))for(h in r)b[h]||i(b,h,r[h],!0)}},26:function(t,n,e){"use strict";var r=e(60),o=e(72),i=e(31),u=e(22);t.exports=e(62)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},27:function(t,n,e){var r=e(50);t.exports=function(t,n,e){return r(t),void 0===n?t:1===e?function(e){return t.call(n,e)}:2===e?function(e,r){return t.call(n,e,r)}:3===e?function(e,r,o){return t.call(n,e,r,o)}:function(){return t.apply(n,arguments)}}},30:function(t){var n=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+e).toString(36))}},31:function(t){t.exports={}},32:function(t){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},33:function(t,n,e){var r=e(74),o=e(51);t.exports=Object.keys||function(t){return r(t,o)}},36:function(t){t.exports=!1},37:function(t){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},38:function(t,n,e){var r=e(42),o=Math.min;t.exports=function(t){return 0<t?o(r(t),9007199254740991):0}},381:function(t,n,e){"use strict";e.r(n);var r=e(25),o=(e.n(r),e(77)),i=(e.n(o),e(53)),u=(e.n(i),e(59)),c="app-login",a=null,s=u.a.getUrlParameter("iss"),f=u.a.getUrlParameter("launch"),l=u.a.getUrlParameter("patientId"),p="patient/*.read launch",v=Math.round(1e8*Math.random()).toString(),d=(window.location.protocol+"//"+window.location.host+window.location.pathname).replace("launch","index"),y=new XMLHttpRequest;y.open("GET",s+"/metadata"),y.onload=function(){if(200!==y.status)return errorMsg="Conformance statement request failed. Returned status: "+y.status,document.body.innerText=errorMsg,void console.error(errorMsg);var t;try{t=JSON.parse(y.responseText)}catch(t){return errorMsg="Unable to parse conformance statement.",document.body.innerText=errorMsg,void console.error(errorMsg)}!function(t){var n,e;t.rest[0].security.extension.filter(function(t){return"http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris"===t.url})[0].extension.forEach(function(t){"authorize"===t.url?n=t.valueUri:"token"===t.url&&(e=t.valueUri)}),console.log(n),console.log(e),sessionStorage[v]=JSON.stringify({clientId:c,secret:a,serviceUri:s,redirectUri:d,patientId:l,tokenUri:e}),window.location.href=n+"?response_type=code&client_id="+encodeURIComponent(c)+"&scope="+encodeURIComponent(p)+"&redirect_uri="+encodeURIComponent(d)+"&aud="+encodeURIComponent(s)+"&launch="+f+"&state="+v}(t)},y.send()},39:function(t,n,e){var r=e(12).f,o=e(19),i=e(4)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},4:function(t,n,e){var r=e(48)("wks"),o=e(30),i=e(6).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},42:function(t){var n=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(0<t?e:n)(t)}},43:function(t,n,e){var r=e(48)("keys"),o=e(30);t.exports=function(t){return r[t]||(r[t]=o(t))}},44:function(t,n,e){"use strict";var r=e(11),o=e(15),i=e(14),u=e(18),c=e(4);t.exports=function(t,n,e){var a=c(t),s=e(u,a,""[t]),f=s[0],l=s[1];i(function(){var n={};return n[a]=function(){return 7},7!=""[t](n)})&&(o(String.prototype,t,f),r(RegExp.prototype,a,2==n?function(t,n){return l.call(t,this,n)}:function(t){return l.call(t,this)}))}},48:function(t,n,e){var r=e(21),o=e(6),i="__core-js_shared__",u=o[i]||(o[i]={});(t.exports=function(t,n){return u[t]||(u[t]=void 0===n?{}:n)})("versions",[]).push({version:r.version,mode:e(36)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},49:function(t,n,e){var r=e(7),o=e(6).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},50:function(t){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},51:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},52:function(t,n,e){var r=e(18);t.exports=function(t){return Object(r(t))}},53:function(t,n,e){"use strict";e(101);var r=e(9),o=e(64),i=e(8),u="toString",c=/./[u],a=function(t){e(15)(RegExp.prototype,u,t,!0)};e(14)(function(){return"/a/b"!=c.call({source:"a",flags:"b"})})?a(function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!i&&t instanceof RegExp?o.call(t):void 0)}):c.name!=u&&a(function(){return c.call(this)})},59:function(t,n,e){"use strict";var r=e(77),o=(e.n(r),e(102)),i=(e.n(o),e(79)),u=(e.n(i),{getUrlParameter:function(t){for(var n,e=window.location.search.substring(1).split("&"),r=0;r<e.length;r++)if((n=e[r].split("="))[0]===t){var o=n[1].replace(/\+/g,"%20");return decodeURIComponent(o)}}});n.a=u},6:function(t){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},60:function(t,n,e){var r=e(4)("unscopables"),o=Array.prototype;null==o[r]&&e(11)(o,r,{}),t.exports=function(t){o[r][t]=!0}},61:function(t,n,e){var r=e(7);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},62:function(t,n,e){"use strict";var r=e(36),o=e(13),i=e(15),u=e(11),c=e(31),a=e(97),s=e(39),f=e(100),l=e(4)("iterator"),p=!([].keys&&"next"in[].keys()),v="keys",d="values",y=function(){return this};t.exports=function(t,n,e,h,g,x,m){a(e,n,h);var b,S,O,w=function(t){return!p&&t in j?j[t]:function(){return new e(this,t)}},M=n+" Iterator",_=g==d,P=!1,j=t.prototype,L=j[l]||j["@@iterator"]||g&&j[g],T=L||w(g),E=g?_?w("entries"):T:void 0,R="Array"==n&&j.entries||L;if(R&&((O=f(R.call(new t)))!==Object.prototype&&O.next&&(s(O,M,!0),!r&&"function"!=typeof O[l]&&u(O,l,y))),_&&L&&L.name!==d&&(P=!0,T=function(){return L.call(this)}),(!r||m)&&(p||P||!j[l])&&u(j,l,T),c[n]=T,c[M]=y,g)if(b={values:_?T:w(d),keys:x?T:w(v),entries:E},m)for(S in b)S in j||i(j,S,b[S]);else o(o.P+o.F*(p||P),n,b);return b}},63:function(t,n,e){var r=e(9),o=e(98),i=e(51),u=e(43)("IE_PROTO"),c=function(){},a="prototype",s=function(){var t,n=e(49)("iframe"),r=i.length;for(n.style.display="none",e(76).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),s=t.F;r--;)delete s[a][i[r]];return s()};t.exports=Object.create||function(t,n){var e;return null===t?e=s():(c[a]=r(t),e=new c,c[a]=null,e[u]=t),void 0===n?e:o(e,n)}},64:function(t,n,e){"use strict";var r=e(9);t.exports=function(){var t=r(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},7:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},71:function(t,n,e){t.exports=!e(8)&&!e(14)(function(){return 7!=Object.defineProperty(e(49)("div"),"a",{get:function(){return 7}}).a})},72:function(t){t.exports=function(t,n){return{value:n,done:!!t}}},73:function(t,n,e){var r=e(32);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},74:function(t,n,e){var r=e(19),o=e(22),i=e(75)(!1),u=e(43)("IE_PROTO");t.exports=function(t,n){var e,c=o(t),a=0,s=[];for(e in c)e!=u&&r(c,e)&&s.push(e);for(;n.length>a;)r(c,e=n[a++])&&(~i(s,e)||s.push(e));return s}},75:function(t,n,e){var r=e(22),o=e(38),i=e(99);t.exports=function(t){return function(n,e,u){var c,a=r(n),s=o(a.length),f=i(u,s);if(t&&e!=e){for(;s>f;)if((c=a[f++])!=c)return!0}else for(;s>f;f++)if((t||f in a)&&a[f]===e)return t||f||0;return!t&&-1}}},76:function(t,n,e){var r=e(6).document;t.exports=r&&r.documentElement},77:function(t,n,e){e(44)("replace",2,function(t,n,e){return[function(r,o){"use strict";var i=t(this),u=null==r?void 0:r[n];return void 0===u?e.call(i+"",r,o):u.call(r,i,o)},e]})},78:function(t,n,e){var r=e(7),o=e(32),i=e(4)("match");t.exports=function(t){var n;return r(t)&&(void 0===(n=t[i])?"RegExp"==o(t):!!n)}},79:function(t,n,e){e(44)("search",1,function(t,n,e){return[function(e){"use strict";var r=t(this),o=null==e?void 0:e[n];return void 0===o?new RegExp(e)[n](r+""):o.call(e,r)},e]})},8:function(t,n,e){t.exports=!e(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},9:function(t,n,e){var r=e(7);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},97:function(t,n,e){"use strict";var r=e(63),o=e(37),i=e(39),u={};e(11)(u,e(4)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},98:function(t,n,e){var r=e(12),o=e(9),i=e(33);t.exports=e(8)?Object.defineProperties:function(t,n){o(t);for(var e,u=i(n),c=u.length,a=0;c>a;)r.f(t,e=u[a++],n[e]);return t}},99:function(t,n,e){var r=e(42),o=Math.max,i=Math.min;t.exports=function(t,n){return 0>(t=r(t))?o(t+n,0):i(t,n)}}});
14,108
14,108
0.638999
311e8aa9d519844ee2e60dffd80732efecbc4da3
1,326
js
JavaScript
server/api/orders.spec.js
Iskak83/book-shopper
e4eb6483f192917d26415ec9c2b2e7ada61d3494
[ "MIT" ]
null
null
null
server/api/orders.spec.js
Iskak83/book-shopper
e4eb6483f192917d26415ec9c2b2e7ada61d3494
[ "MIT" ]
18
2020-06-16T16:39:59.000Z
2020-06-23T22:17:25.000Z
server/api/orders.spec.js
Iskak83/book-shopper
e4eb6483f192917d26415ec9c2b2e7ada61d3494
[ "MIT" ]
1
2020-07-22T20:33:43.000Z
2020-07-22T20:33:43.000Z
const {expect} = require('chai') const app = require('../index') const agent = require('supertest')(app) const request = require('supertest') const db = require('../db') const Order = require('../db/models/order') describe('Order routes', () => { let storedOrders const orderData = [ { totalPrice: 100, isCheckedout: false, quantity: 1 }, { totalPrice: 55, isCheckedout: true, quantity: 2 }, { totalPrice: 80, isCheckedout: false, quantity: 1 } ] beforeEach(async () => { const createdOrder = await Order.bulkCreate(orderData) storedOrders = createdOrder.map(order => order.dataValues) }) // Route for updating orders via PUT request describe('PUT `/`', () => { it('updates order via PUT request', async () => { const orderToUpdate = { totalPrice: 100, isCheckedout: true, quantity: 1 } const response = await agent .post('/') .send(orderToUpdate) .expect(200) expect(response.body).to.be.an('object') // expect(response.body).to.equal(orderToUpdate.totalPrice) // expect(response.body.isCheckedout).to.equal(orderToUpdate.isCheckedout) // expect(response.body.quantity).to.equal(orderToUpdate.quantity) }) }) })
23.678571
82
0.600302
311ed8f7c73aebcab83899d2be677a13e3a73f9e
817
js
JavaScript
Array.from.done.js
chunjuwang/Javascript-Note
1540101bb1732fe1b05528cb0be023962075d878
[ "MIT" ]
null
null
null
Array.from.done.js
chunjuwang/Javascript-Note
1540101bb1732fe1b05528cb0be023962075d878
[ "MIT" ]
null
null
null
Array.from.done.js
chunjuwang/Javascript-Note
1540101bb1732fe1b05528cb0be023962075d878
[ "MIT" ]
null
null
null
Array.fromCustom = function (arrayLike, mapFn, thisArg) { let array = []; if (arrayLike[Symbol.iterator]) { // 如果 iterator 不符合规范,错误将由 for...of... 接管并抛出 // 也可以在这里自己实现一个用来检测 iterator 是否符合标准的工具 for (let value of arrayLike) { array.push(value); } } else if (arrayLike.length !== null && arrayLike.length !== undefined && !Number.isNaN(Number(arrayLike.length))) { // 要体会好这里的 !Number.isNaN(Number(arrayLike.length)) for (let index = 0; index < arrayLike.length; index++) { array.push(arrayLike[index]); } } // 如果 arrayLike 参数既不是伪数组也不是具有遍历器的类型,from 方法将返回一个空数组 if (mapFn && mapFn instanceof Function) { thisArg === undefined && (thisArg = array); array = array.map(mapFn, thisArg); } return array; }
32.68
171
0.603427
311fffff260f10619e702f3f4196e4807f0067ce
3,529
js
JavaScript
ml-app-vuejs/lib/image-classification-client/src/model/WebServiceResult.js
Microsoft/microsoft-r
a6927bbf51b748a61ad4074434b811bcfb4d6790
[ "MIT" ]
87
2017-02-08T16:14:29.000Z
2019-04-09T15:13:07.000Z
ml-app-vuejs/lib/image-classification-client/src/model/WebServiceResult.js
microsoft/microsoft-r
c42fa71a37da921807839105b63f96282ca5b7c0
[ "MIT" ]
19
2017-04-21T04:01:22.000Z
2019-04-18T15:58:50.000Z
ml-app-vuejs/lib/image-classification-client/src/model/WebServiceResult.js
Microsoft/microsoft-r
a6927bbf51b748a61ad4074434b811bcfb4d6790
[ "MIT" ]
73
2017-01-19T00:27:26.000Z
2019-04-18T08:47:26.000Z
/** * ImageClassification * service for image classification * * OpenAPI spec version: 1.0.0 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.3.1 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['ApiClient', 'model/OutputParameters'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('./OutputParameters')); } else { // Browser globals (root is window) if (!root.ImageClassification) { root.ImageClassification = {}; } root.ImageClassification.WebServiceResult = factory(root.ImageClassification.ApiClient, root.ImageClassification.OutputParameters); } }(this, function(ApiClient, OutputParameters) { 'use strict'; /** * The WebServiceResult model module. * @module model/WebServiceResult * @version 1.0.0 */ /** * Constructs a new <code>WebServiceResult</code>. * @alias module:model/WebServiceResult * @class */ var exports = function() { var _this = this; }; /** * Constructs a <code>WebServiceResult</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/WebServiceResult} obj Optional instance to populate. * @return {module:model/WebServiceResult} The populated <code>WebServiceResult</code> instance. */ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); if (data.hasOwnProperty('success')) { obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } if (data.hasOwnProperty('errorMessage')) { obj['errorMessage'] = ApiClient.convertToType(data['errorMessage'], 'String'); } if (data.hasOwnProperty('consoleOutput')) { obj['consoleOutput'] = ApiClient.convertToType(data['consoleOutput'], 'String'); } if (data.hasOwnProperty('changedFiles')) { obj['changedFiles'] = ApiClient.convertToType(data['changedFiles'], ['String']); } if (data.hasOwnProperty('outputParameters')) { obj['outputParameters'] = OutputParameters.constructFromObject(data['outputParameters']); } } return obj; } /** * Boolean flag indicating the success status of web service execution. * @member {Boolean} success */ exports.prototype['success'] = undefined; /** * Error messages if any occurred during the web service execution. * @member {String} errorMessage */ exports.prototype['errorMessage'] = undefined; /** * Console output from the web service execution. * @member {String} consoleOutput */ exports.prototype['consoleOutput'] = undefined; /** * The filenames of the files modified during the web service execution. * @member {Array.<String>} changedFiles */ exports.prototype['changedFiles'] = undefined; /** * @member {module:model/OutputParameters} outputParameters */ exports.prototype['outputParameters'] = undefined; return exports; }));
29.90678
135
0.673279
31203d813ce8d594865161f4eb19efc1eead2d9b
491
js
JavaScript
src/store/appStore.js
Vandise/phoenix
93d35060eaa0f1f59f2f5a89533994224a663e9f
[ "MIT" ]
null
null
null
src/store/appStore.js
Vandise/phoenix
93d35060eaa0f1f59f2f5a89533994224a663e9f
[ "MIT" ]
null
null
null
src/store/appStore.js
Vandise/phoenix
93d35060eaa0f1f59f2f5a89533994224a663e9f
[ "MIT" ]
null
null
null
import { createStore, combineReducers, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import Reducers from '../reducers/index'; import MashableApiMiddleware from '../middleware/mashableApi'; const reducers = combineReducers(Reducers); const initialState = { stories: {}, }; export default (state = initialState) => { const store = createStore(reducers, state, applyMiddleware(thunk, MashableApiMiddleware())); store.subscribe(() => { }); return store; };
28.882353
94
0.720978
31212c2a39ad7db75c489f854551ba23c0286c9b
9,971
js
JavaScript
lib/Select.js
leowang721/k-react-native-form
aec4421ca5e37e18446e1274ed81f1b83c25c2b5
[ "MIT" ]
1
2016-07-07T06:12:48.000Z
2016-07-07T06:12:48.000Z
lib/Select.js
leowang721/k-react-native-form
aec4421ca5e37e18446e1274ed81f1b83c25c2b5
[ "MIT" ]
null
null
null
lib/Select.js
leowang721/k-react-native-form
aec4421ca5e37e18446e1274ed81f1b83c25c2b5
[ "MIT" ]
null
null
null
/** * @file Select * * @author Leo Wang(leowang721@gmail.com) */ var _ = require('lodash'); var React = require('react-native'); var { Animated, TouchableOpacity, View, Text, Image, PickerIOS, } = React; var kCore = require('k-react-native-core'); var FormElement = require('./FormElement'); var Button = require('./Button'); var Option = require('./Option'); var OptionGroup = require('./OptionGroup'); var styles = require('./styles/select'); /** * Select * @class Select * @extends FormElement * @requires FormElement */ class Select extends FormElement { /** * @constructor * * @param {Object} props properties * * @param {string} props.id element's id, setting id will set props.ref with the same value * @param {?Object} props.style style * @param {string=} props.type type of the current form element, will try to set styles[type] * values can be one of: ['normal', 'scroll', 'flat'] * @param {boolean=} props.disabled is disabled * @param {boolean=} props.readonly is readonly * * @param {?string} label label for select * @param {?(number|string|Array.<number|string>)} selected selected value * if props.multiple is true, then type Array can be used * watch out Float Number < 1, the comparation would have problem * @param {?(string|Component)} props.icon icon for button, you can use either unicode characters or a Component * @param {?(Object} props.labelStyle styles for label * @param {boolean=} props.multiple multiple select, default is false * * @param {?Object} context context */ constructor(props, context) { super(props, context); Object.assign(this.state, { selected: props.selected, selectionHeight: new Animated.Value(0), selectionOpacity: new Animated.Value(0), isSelectionShown: false }); } render() { return this.getFlatView(); } getDefaultView() { var selectStyles = this.getStyles(styles); var dataSource = this.getDataSourceByChildren(); return ( <View style={selectStyles.container}> <TouchableOpacity onPress={this.switchSelection.bind(this)} style={[...selectStyles.labelContainer, this.props.style]}> <Text style={[...selectStyles.label, this.props.labelStyle]}> {this.props.label} </Text> <Text style={selectStyles.selected}> {_.trunc(this.state.selected, 19)} </Text> <View style={selectStyles.arrow}><Text style={selectStyles.arrowText}>﹀</Text></View> </TouchableOpacity> <Animated.View style={[ ...selectStyles.selectionContainer, { height: this.state.selectionHeight, opacity: this.state.selectionOpacity, } ]}> <PickerIOS selectedValue={this.state.selected} onValueChange={this.onValueChange.bind(this)} style={selectStyles.selection}> { dataSource.map((item) => ( <PickerIOS.Item {...item} key={kCore.util.uid()} /> )) } </PickerIOS> <View style={selectStyles.selectionControl}> <Button label="✔" style={selectStyles.selectionControlBtn} onPress={this.switchSelection.bind(this)}/> </View> </Animated.View> </View> ); } getFlatView() { var selectStyles = this.getStyles(styles); var dataSource = this.getDataSourceByChildren(); return ( <Animated.View style={selectStyles.container}> <View style={[...selectStyles.labelContainer, this.props.style]}> <Text style={[...selectStyles.label, this.props.labelStyle]}> {this.props.label} </Text> <Text style={selectStyles.selected}> {_.trunc(_.isArray(this.state.selected) ? this.state.selected.join(', ') : this.state.selected, 19)} </Text> </View> <View> { dataSource.map((item, index) => { if (item instanceof Array) { return ( <OptionGroup key={index + '-' + kCore.util.uid()}> { item.map((child) => ( <Option {...child} onPress={this.onValueChange.bind(this)} selected={ this.props.multiple && _.isArray(this.state.selected) ? (_.indexOf(this.state.selected, child.value) > -1) : (child.value === this.state.selected) } /> )) } </OptionGroup> ); } return ( <Option {...item} onPress={this.onValueChange.bind(this)} selected={ this.props.multiple && _.isArray(this.state.selected) ? (_.indexOf(this.state.selected, item.value) > -1) : (item.value === this.state.selected) } /> ); }) } </View> </Animated.View> ); } onValueChange(selectedValue) { var selected = this.state.selected; if (this.props.multiple && _.isArray(selected)) { var index = _.indexOf(selected, selectedValue); if (index > -1) { selected.splice(index, 1); } else { selected.push(selectedValue); } } else { selected = selectedValue; } this.setState({selected}); this.props.onValueChange && this.props.onValueChange(selectedValue); } getDataSourceByChildren() { var children = this.props.children || []; if (!_.isArray(children)) { children = [children]; } var dataSource = _.compact(children.map((item, index) => { if (item.type.name === 'Option') { var value = item.props.value == undefined ? index : item.props.value; return { key: item.props.key || kCore.util.uid(), value: value, label: item.props.label || value.toString(), icon: item.props.icon || this.props.icon, type: item.props.type, iconStyle: item.props.iconStyle, labelStyle: item.props.labelStyle, }; } if (item.type.name === 'OptionGroup') { return _.compact(item.props.children.map((child, childIndex) => { if (child.type.name === 'Option') { var value = child.props.value == undefined ? index + '-' + childIndex : child.props.value; return { key: child.props.key || kCore.util.uid(), value: value, label: child.props.label || value.toString(), icon: child.props.icon || this.props.icon, type: child.props.type, iconStyle: child.props.iconStyle, labelStyle: child.props.labelStyle, } } })); } })); if (this.props.type !== 'flat') { dataSource.unshift({ key: kCore.util.uid(), value: null, label: 'please choose' }); } return dataSource; } switchSelection() { if (this.state.disabled || this.state.readonly) { return; } this.setState({ isSelectionShown: !this.state.isSelectionShown }); Animated.parallel([ Animated.spring( this.state.selectionHeight, { toValue: this.state.isSelectionShown ? 0 : 170 } ), Animated.spring( this.state.selectionOpacity, { toValue: this.state.isSelectionShown ? 0 : 1 } ) ]).start(); } } Select.propTypes = FormElement.assignPropTypes({ label: React.PropTypes.string, icon: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]), labelStyle: React.PropTypes.object, iconStyle: React.PropTypes.object, selected: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number, React.PropTypes.array]), multiple: React.PropTypes.bool }); Select.defaultProps = { multiple: false }; module.exports = Select;
37.768939
135
0.462541
31221fbc3d74e27a426cf379d37c6cdbce0df15b
433
js
JavaScript
leetcodeContest/186周/1424. 对角线遍历 II.js
fireairforce/leetCode-Record
8eab0d58d44e081d908810824d601ef8f14c979f
[ "MIT" ]
74
2019-08-29T13:34:15.000Z
2022-02-17T09:39:53.000Z
leetcodeContest/186周/1424. 对角线遍历 II.js
fireairforce/leetCode-Record
8eab0d58d44e081d908810824d601ef8f14c979f
[ "MIT" ]
43
2020-02-18T12:55:36.000Z
2020-03-10T08:41:05.000Z
leetcodeContest/186周/1424. 对角线遍历 II.js
fireairforce/leetCode-Record
8eab0d58d44e081d908810824d601ef8f14c979f
[ "MIT" ]
15
2019-06-14T13:55:44.000Z
2021-08-20T08:26:50.000Z
/** * @param {number[][]} nums * @return {number[]} */ var findDiagonalOrder = function (a) { if (a.length === 0) { return [] } const arr = [], res = [] for (let i = 0; i < a.length; i++) { for (let j = 0; j < nums[i].length; j++) { if (!arr[i + j]) { arr[i + j] = [] } arr[i + j].push(a[i][j]) } } for (const rows of arr) { res.push(...rows.reverse()) } return res }
18.041667
46
0.43649
312306990e66ccec1330743f693d37e2e1385c7a
1,754
js
JavaScript
index.js
ethanrusz/birthday-bot
02f229f3d8c57ff312b6a4507120611a7bec7f96
[ "MIT" ]
null
null
null
index.js
ethanrusz/birthday-bot
02f229f3d8c57ff312b6a4507120611a7bec7f96
[ "MIT" ]
null
null
null
index.js
ethanrusz/birthday-bot
02f229f3d8c57ff312b6a4507120611a7bec7f96
[ "MIT" ]
null
null
null
const Discord = require('discord.js'); const config = require('./config.json'); const mongo = require('./mongo.js') const fs = require('fs'); const client = new Discord.Client(); client.commands = new Discord.Collection(); // Collection for commands const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); // Sync only JS files for (const file of commandFiles) { const command = require(`./commands/${file}`); // Command file location client.commands.set(command.name, command); // Add commands to client based on command JS files } client.once('ready', async () => { console.log('Ready!'); // Make sure the bot is connected and ready await mongo().then(mongoose => { // Test database connection try { console.log('Connected to MongoDB!'); } catch (e) { console.log('Could not connect to MongoDB') } finally { mongoose.connection.close(); // Close the connection } }); }); client.on("message", message => { if (!message.content.startsWith(config.prefix) || message.author.bot) return; // Ignore irrelevant messages const args = message.content.slice(config.prefix.length).trim().split(/ +/); // Clean and split at spaces const command = args.shift().toLowerCase(); // Lowercase the args if (!client.commands.has(command)) return; // Fall out if the command does not exist try { client.commands.get(command).execute(message, args); // Try to execute the command file } catch (e) { console.error(e); // Log and respond to errors message.reply('Something went wrong!'); } }); client.login(config.token); // Use the configuration token to login, must be done last
37.319149
117
0.648803
31245bcc08fe2b3cea54a98f11f5e0a733b9c6f0
2,632
js
JavaScript
frontend/localhost/test/base-test.js
njcom/framework
e61ec28c587165806700b556ffa8160110fce4ab
[ "Apache-2.0" ]
1
2015-12-05T02:41:23.000Z
2015-12-05T02:41:23.000Z
frontend/localhost/test/base-test.js
morpho-os/framework
94c80d1230aec90399ed72fc13cba089b51a9915
[ "Apache-2.0" ]
503
2015-08-22T11:11:36.000Z
2021-09-25T00:39:44.000Z
frontend/localhost/test/base-test.js
njcom/framework
e61ec28c587165806700b556ffa8160110fce4ab
[ "Apache-2.0" ]
1
2020-07-22T13:03:32.000Z
2020-07-22T13:03:32.000Z
define(["require", "exports", "localhost/lib/base/base"], function (require, exports, base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); QUnit.module('base', hooks => { hooks.beforeEach(() => { }); hooks.afterEach(() => { }); QUnit.test('isDomNode', assert => { assert.notOk(base_1.isDomNode(null)); assert.notOk(base_1.isDomNode(false)); assert.notOk(base_1.isDomNode(undefined)); assert.notOk(base_1.isDomNode(0)); assert.notOk(base_1.isDomNode(-1)); assert.notOk(base_1.isDomNode('')); assert.notOk(base_1.isDomNode($())); assert.ok(base_1.isDomNode($('body')[0])); assert.notOk(base_1.isDomNode([])); assert.notOk(base_1.isDomNode({})); assert.notOk(base_1.isDomNode(123)); assert.notOk(base_1.isDomNode("some")); assert.notOk(base_1.isDomNode({ foo: 'bar' })); }); }); }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS10ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYmFzZS10ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztJQUVBLEtBQUssQ0FBQyxNQUFNLENBQUMsTUFBTSxFQUFHLEtBQUssQ0FBQyxFQUFFO1FBQzFCLEtBQUssQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFO1FBQ3RCLENBQUMsQ0FBQyxDQUFDO1FBRUgsS0FBSyxDQUFDLFNBQVMsQ0FBQyxHQUFHLEVBQUU7UUFDckIsQ0FBQyxDQUFDLENBQUM7UUFFSCxLQUFLLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRSxNQUFNLENBQUMsRUFBRTtZQUM3QixNQUFNLENBQUMsS0FBSyxDQUFDLGdCQUFTLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztZQUM5QixNQUFNLENBQUMsS0FBSyxDQUFDLGdCQUFTLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQztZQUMvQixNQUFNLENBQUMsS0FBSyxDQUFDLGdCQUFTLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQztZQUNuQyxNQUFNLENBQUMsS0FBSyxDQUFDLGdCQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMzQixNQUFNLENBQUMsS0FBSyxDQUFDLGdCQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzVCLE1BQU0sQ0FBQyxLQUFLLENBQUMsZ0JBQVMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO1lBQzVCLE1BQU0sQ0FBQyxLQUFLLENBQUMsZ0JBQVMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7WUFFN0IsTUFBTSxDQUFDLEVBQUUsQ0FBQyxnQkFBUyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFFbkMsTUFBTSxDQUFDLEtBQUssQ0FBQyxnQkFBUyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7WUFDNUIsTUFBTSxDQUFDLEtBQUssQ0FBQyxnQkFBUyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7WUFDNUIsTUFBTSxDQUFDLEtBQUssQ0FBQyxnQkFBUyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDN0IsTUFBTSxDQUFDLEtBQUssQ0FBQyxnQkFBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFDaEMsTUFBTSxDQUFDLEtBQUssQ0FBQyxnQkFBUyxDQUFDLEVBQUMsR0FBRyxFQUFFLEtBQUssRUFBQyxDQUFDLENBQUMsQ0FBQztRQUMxQyxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDIn0=
101.230769
1,598
0.819529
31245d00d59d8e35d37a4e0c7dda72730b0b909c
2,154
js
JavaScript
api/contacts.js
brrrouillard/wemanity-angular
89d0f3033f6c6302177aac61eb909edd698eb755
[ "Apache-2.0" ]
null
null
null
api/contacts.js
brrrouillard/wemanity-angular
89d0f3033f6c6302177aac61eb909edd698eb755
[ "Apache-2.0" ]
10
2020-07-16T23:14:36.000Z
2022-03-02T03:50:18.000Z
api/contacts.js
brrrouillard/wemanity-angular
89d0f3033f6c6302177aac61eb909edd698eb755
[ "Apache-2.0" ]
null
null
null
const router = require("express").Router(); const Contact = require("../models/Contact"); // Get all users router.get("/", (req, res) => { Contact.find((err, contacts) => { if (err) console.log(err); res.status(200).send(contacts); }); }); router.post("/", (req, res) => { const regExp = /^[+][0-9][0-9][ ][0-9][0-9][ ][0-9]*/; if (req.body.number.match(regExp)) { const newContact = new Contact({ firstName: req.body.firstName, lastName: req.body.lastName, number: req.body.number }); newContact .save() .then( () => `Added contact ${newContact.firstName} ${newContact.lastName}` ) .catch(err => res.status(400).send({ err })) .then(() => res.status(200).send({ msg: "OK" })); } else { res.status(400).send({msg: "Number error"}) } }); router.get("/:contact", (req, res) => { Contact.find( { $or: [ { number: { $regex: "^[+]" + req.params.contact.slice(1) } }, { firstName: { $regex: "^" + req.params.contact } }, { lastName: { $regex: "^" + req.params.contact } } ] }, (err, contacts) => { if (err) res.status(400).send({ msg: "Error" + err }); res.status(200).send(contacts); } ); }); router.get("/:number", (req, res) => { Contact.find({ number: req.params.number }, (err, contacts) => { if (err) res.status(400).send({ msg: "Error" + err }); res.status(200).send(contacts); }); }); router.get("/id/:id", (req, res) => { Contact.find({ _id: req.params.id }, (err, contact) => { if (err) res.status(400).send({ msg: "Error" + err }); res.status(200).send(contact); }); }); router.put("/:id", (req, res) => { Contact.findById(req.params.id, (err, contact) => { if (err) res.status(400).send({ msg: "Error " + err }); contact.firstName = req.body.firstName; contact.lastName = req.body.lastName; contact.number = req.body.number; contact.save(); res.status(200).send(contact); }); }); module.exports = router;
24.202247
76
0.51532
312649d2e2f87d58107f59a7e6e734ccb6f9ff5f
966
js
JavaScript
dist/file-icons/shipit.js
gurupras/repo-for-webpack-issue-7843
10fbb23a58631ab47ab546ca449aece885f5ad71
[ "MIT" ]
null
null
null
dist/file-icons/shipit.js
gurupras/repo-for-webpack-issue-7843
10fbb23a58631ab47ab546ca449aece885f5ad71
[ "MIT" ]
null
null
null
dist/file-icons/shipit.js
gurupras/repo-for-webpack-issue-7843
10fbb23a58631ab47ab546ca449aece885f5ad71
[ "MIT" ]
null
null
null
(window.webpackJsonpFileIcons=window.webpackJsonpFileIcons||[]).push([[661],{233:function(q){q.exports={viewBox:"0 0 1024 1024",font:"file-icons",code:"26f5",ref:"shipit",path:"M1023 601q3 35-5 78-7 44-28.5 87.5T931 849q-38 38-95 62-87 6-177 9-90 4-177.5 4.5T312 922q-83-4-154-13-24-7-51-35-27-29-51-71t-40-93Q0 659 0 606q37 44 94 75 56 30 121 49.5T349 758q70 9 134 8t129-9q65-7 132.5-26T881 681q70-32 142-80M486 99q15 46 21 118 7 72 7 157t-5 178q-5 93-12 181 27 3 70-1 43-5 91.5-15t97.5-25q50-15 90-32-55-99-112-197-57-97-106-176t-87-130q-38-52-55-58m304 557q-25 8-50 13.5t-52 5.5q-9-56-29-126-21-71-40.5-131.5T587 317q-12-39-5-34 14 16 40 55t56 89q30 50 61 106 31 57 56 108 2 5 1.5 9t-6.5 6M471 228q-5-35-42 6-37 42-86.5 118T241 517q-52 88-87 147 15 13 52 26 37 14 83 24t94 16q48 6 84 4 4-75 8-151 4-75 6-142.5t0-122.5q-2-55-10-90M326 674q-1 7-5 9t-9 1q-21-5-41.5-10T231 660q-10-5-12.5-12t2.5-17q33-62 67-119.5T357 404q4 2 2 26-1 25-6 63t-12 86q-7 47-15 95z"}}}]);
966
966
0.708075
312712f83bfe6b50c4411d233f16d0bf32fd8512
2,021
js
JavaScript
server/mongo-queries/get-status-history.js
egovernment/eregistrations
6fa16f0229b3177ca003a5da1adae194810caf56
[ "MIT" ]
1
2019-06-27T08:50:04.000Z
2019-06-27T08:50:04.000Z
server/mongo-queries/get-status-history.js
egovernment/eregistrations
6fa16f0229b3177ca003a5da1adae194810caf56
[ "MIT" ]
196
2017-01-15T11:47:11.000Z
2018-03-16T15:45:37.000Z
server/mongo-queries/get-status-history.js
egovernment/eregistrations
6fa16f0229b3177ca003a5da1adae194810caf56
[ "MIT" ]
null
null
null
'use strict'; var db = require('mano').db , capitalize = require('es5-ext/string/#/capitalize') , mongo = require('../mongo-db') , resolveFullStepPath = require('../../utils/resolve-processing-step-full-path'); exports.fullItemsThreshold = 1485907200000; // TS in milliseconds of introduction of statusHistory var queryCriteria = function (query) { var criteria = {}, queryDate = {}, dateFrom = Number(db.Date(query.dateFrom || 0)); if (query.onlyFullItems) { dateFrom = Math.max(dateFrom, exports.fullItemsThreshold); } if (dateFrom) queryDate.$gte = dateFrom; if (query.dateTo) queryDate.$lte = Number(db.Date(query.dateTo)); if (Object.keys(queryDate).length > 0) criteria["date.date"] = queryDate; if (query.service) { criteria["service.type"] = 'BusinessProcess' + capitalize.call(query.service); } if (query.excludeFrontDesk) { criteria['processingStep.path'] = { $not: /frontDesk/ }; } if (query.steps && query.steps.length) { criteria.$or = []; query.steps.forEach(function (step) { criteria.$or.push({ 'processingStep.path': step }); }); } if (query.step) { criteria['processingStep.path'] = { $regex: new RegExp(resolveFullStepPath(query.step + '$')) }; } return criteria; }; exports.find = function (query/*, options */) { var portion = Object(arguments[1]) , criteria = queryCriteria(query), limit, offset; offset = portion.offset || 0; limit = portion.limit || 0; return mongo.connect()(function (db) { return db.collection('processingStepsHistory') .find(criteria) .sort(query.sort) .skip(offset).limit(limit).toArray(); }); }; exports.count = function (query) { var criteria = queryCriteria(query); return mongo.connect()(function (db) { return db.collection('processingStepsHistory') .find(criteria).count(); }); }; exports.group = function (groupBy) { return mongo.connect()(function (db) { return db.collection('processingStepsHistory') .aggregate(groupBy).toArray(); }); };
29.720588
98
0.667986
31277227b5feac719dac012932325ea275d5808d
947
js
JavaScript
src/stories/Typography.stories.js
dinesh-se/ds-tech-ui-components
aa4c796d97000a9182dac2a0c3cf9b82cc12b906
[ "MIT" ]
null
null
null
src/stories/Typography.stories.js
dinesh-se/ds-tech-ui-components
aa4c796d97000a9182dac2a0c3cf9b82cc12b906
[ "MIT" ]
11
2021-02-21T19:57:01.000Z
2021-12-19T23:23:23.000Z
src/stories/Typography.stories.js
dinesh-se/ds-tech-ui-components
aa4c796d97000a9182dac2a0c3cf9b82cc12b906
[ "MIT" ]
null
null
null
import React, { Fragment } from 'react' import { centerDecorator, columnDecorator } from '../../.storybook/decorator' import { Heading as HeadingComponent } from '../../src' export default { title: 'Elements/Typography', component: HeadingComponent, decorators: [columnDecorator, centerDecorator], } const HeadingTemplate = (args) => <HeadingComponent {...args} /> export const Heading = HeadingTemplate.bind({}) Heading.args = { text: 'Heading', size: 6, } Heading.argTypes = { size: { control: { type: 'number', min: 1, max: 6, } } } export const Headings = () => ( <Fragment> <HeadingComponent text="Heading 1" size={1} /> <HeadingComponent text="Heading 2" size={2} /> <HeadingComponent text="Heading 3" size={3} /> <HeadingComponent text="Heading 4" size={4} /> <HeadingComponent text="Heading 5" size={5} /> <HeadingComponent text="Heading 6" size={6} /> </Fragment> )
24.921053
77
0.644139
3127bc9389e60b7eae11ef71a402b34e9f2985c4
397
js
JavaScript
remove-array-item.js
faizanu94/priority-queue
1189d7cc0f3c4097677e6663fe0e7090a727ca63
[ "MIT" ]
1
2021-06-10T10:05:47.000Z
2021-06-10T10:05:47.000Z
remove-array-item.js
faizanu94/priority-queue
1189d7cc0f3c4097677e6663fe0e7090a727ca63
[ "MIT" ]
1
2021-06-10T14:36:01.000Z
2021-06-10T14:36:01.000Z
remove-array-item.js
faizanu94/priority-queue
1189d7cc0f3c4097677e6663fe0e7090a727ca63
[ "MIT" ]
1
2021-06-10T10:14:13.000Z
2021-06-10T10:14:13.000Z
/** * Remove 1 item from an array * * @function removeItems * @param {Array<*>} arr The target array * @param {number} arrLength actual length of the array * @param {number} removeIdx The index to remove from (inclusive) */ export default function removeItem (arr, arrLength, removeIdx) { const len = arrLength - 1 for (let i = removeIdx; i < len; ++i) arr[i] = arr[i + 1] }
30.538462
65
0.652393
31293c8a28dc67b99cbcbb059d8f8f444b9bbddc
69
js
JavaScript
example/2.extenalres/index1.js
lh2907883/webpackstudy
47affa48fe38323d8ad39c7356f5a60aac348d81
[ "MIT" ]
1
2015-11-27T06:03:30.000Z
2015-11-27T06:03:30.000Z
example/2.extenalres/index1.js
lh2907883/webpackstudy
47affa48fe38323d8ad39c7356f5a60aac348d81
[ "MIT" ]
null
null
null
example/2.extenalres/index1.js
lh2907883/webpackstudy
47affa48fe38323d8ad39c7356f5a60aac348d81
[ "MIT" ]
null
null
null
require(["jquery"], function($){ $('body').html('It works!') });
17.25
32
0.521739
31296aaebc17d1a74cef5869e20639beb4c4b135
193
js
JavaScript
backend/models/migrations/002_tweets_addIndex_createdAt.js
kiana-h/tweet-streamer
f1aaabbfcc22fb3faaeb8ecc0956f2bba07364b9
[ "MIT" ]
null
null
null
backend/models/migrations/002_tweets_addIndex_createdAt.js
kiana-h/tweet-streamer
f1aaabbfcc22fb3faaeb8ecc0956f2bba07364b9
[ "MIT" ]
1
2021-01-19T07:22:52.000Z
2021-01-23T02:46:30.000Z
backend/models/migrations/002_tweets_addIndex_createdAt.js
kiana-h/tweet-streamer
f1aaabbfcc22fb3faaeb8ecc0956f2bba07364b9
[ "MIT" ]
1
2021-01-19T06:49:49.000Z
2021-01-19T06:49:49.000Z
module.exports = { async up(queryInterface, sequelize, Sequelize) { await queryInterface.addIndex("tweets", ["createdAt"]); }, async down(queryInterface, sequelize, Sequelize) {}, };
27.571429
59
0.699482
3129a3c846fd1d9007e68a866c8e118055de7dbd
72
js
JavaScript
src/gift.js
Dawnabelle/rpg-test-2
3f15ef41aa6068e7260b88a48b491ee427f011e3
[ "MIT" ]
null
null
null
src/gift.js
Dawnabelle/rpg-test-2
3f15ef41aa6068e7260b88a48b491ee427f011e3
[ "MIT" ]
null
null
null
src/gift.js
Dawnabelle/rpg-test-2
3f15ef41aa6068e7260b88a48b491ee427f011e3
[ "MIT" ]
null
null
null
class Gift { constructor (item){ this.item = item; export {Gift}
12
21
0.638889
3129d6c5459fc89f3cf5e3c95c24e910cf138368
197
js
JavaScript
react-client/src/app/components/onlineEvents/index.js
ArneVerleyen/mern-stack-GoingOut
148c1d1af98c24a4274ec8b1e97b2afd2628e1ce
[ "Apache-2.0" ]
null
null
null
react-client/src/app/components/onlineEvents/index.js
ArneVerleyen/mern-stack-GoingOut
148c1d1af98c24a4274ec8b1e97b2afd2628e1ce
[ "Apache-2.0" ]
null
null
null
react-client/src/app/components/onlineEvents/index.js
ArneVerleyen/mern-stack-GoingOut
148c1d1af98c24a4274ec8b1e97b2afd2628e1ce
[ "Apache-2.0" ]
null
null
null
import { default as OnlineEventDetail } from './OnlineEventDetail'; import { default as OnlineEventListPaged } from './OnlineEventListPaged'; export { OnlineEventDetail, OnlineEventListPaged, }
24.625
73
0.786802
312a86bbd42b642d6a364ce14e589ff5dd791835
17,049
js
JavaScript
src/forms/billing-settings-form.js
Subill/multi_billing
666c33c92e476cdec7afe7ac6ee3cf1486f641a9
[ "MIT" ]
null
null
null
src/forms/billing-settings-form.js
Subill/multi_billing
666c33c92e476cdec7afe7ac6ee3cf1486f641a9
[ "MIT" ]
null
null
null
src/forms/billing-settings-form.js
Subill/multi_billing
666c33c92e476cdec7afe7ac6ee3cf1486f641a9
[ "MIT" ]
1
2020-06-08T10:36:02.000Z
2020-06-08T10:36:02.000Z
import React from 'react'; import {Elements, injectStripe, CardElement, StripeProvider} from 'react-stripe-elements'; import {ServicebotBaseForm, Fetcher, inputField} from "servicebot-base-form" import {get, has} from "lodash"; import {Field,} from 'redux-form' import Buttons from "../utilities/buttons.js"; import {connect} from "react-redux"; import creditCardIcon from "../utilities/credit-card-icons.js"; import Alerts from "../utilities/alerts.js" import Load from "../utilities/load"; import RavePaymentModal from 'react-ravepayment'; class CardSection extends React.Component { render() { return ( <div className="sb-form-group" id="card-element"> </div> ); } } class BillingForm extends React.Component { constructor(props){ super(props); let user = this.props.user; this.state = { loading: false, CardModal: false, alerts: null, hasCard: false, tid: user.t_id, loading: true, email: user.email, showForm: false, card: {}, rows: {}, cardObject: {}, url: `/api/v1/funds` }; this.fetchUser = this.fetchUser.bind(this); this.getCurrency = this.getCurrency.bind(this); } callback (response) { if (response.reference) { this.setState({ alerts: { type: 'success', icon: 'check', message: 'Your card has been updated.' }}); } else { this.setState({ alerts: { type: 'danger', icon: 'time', message: 'Your card has not been updated.' }}); } //alert('success. transaction ref is ' + apiURL.message); console.log(response); // card charged successfully, get reference here } componentDidMount() { let self = this; self.getCurrency(); } fetchUser() { let self = this; //let fund = self.props.userFund.user_id; Fetcher(`/api/v1/users/${this.props.uid}`).then(function (response) { if (response) { self.setState({ email: response.name || response.email, }); } }); } fetchFund(){ let self = this; let fund = self.props.userFund; let fundId = fund.id; Fetcher(`/api/v1/funds/${fundId}`, 'DELETE').then(function (response) { if(!response.error){ self.setState({success: true, response: response}); }else{ console.error("error delete fund", response); self.setState({ alerts: { type: 'danger', icon: 'times', message: response.error } }); } }) } getLiveMode(){ let self = this; if(this.props.spk !== '') { let pk = self.state.spk; let livemode = pk ? pk.substring(9, 12) : ""; if (livemode.toUpperCase() === "TEST") { return false; } else { return true; } } } close() { console.log("Payment closed"); } getReference() { //you can put any unique reference implementation code here let text = this.state.tid; let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.="; for( let i=0; i < 15; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } getCurrency(){ let self = this; fetch(`${this.props.url}/api/v1/tenant-system-options`).then(function(response) { return response.json() }).then(function(json) { self.setState({currency : json.currency}); }).catch(e => console.error(e)); }; getAlerts() { if(this.state.alerts){ return ( <Alerts type={this.state.alerts.type} message={this.state.alerts.message} position={{position: 'fixed', bottom: true}} icon={this.state.alerts.icon} /> ); } } render() { if(this.props.userFund){ this.state.hasCard = true; this.state.card = this.props.userFund.source.card; } if (this.state.hasCard) { return ( <div className="card-accordion"> {this.getAlerts()} <p> <i className={creditCardIcon(this.state.card.brand)}/> {this.state.card.brand} ending in <span className="last4">{this.state.card.last4}</span> <span className="exp_month">{this.state.card.exp_month}</span> / <span className="exp_year">{this.state.card.exp_year}</span> </p> <hr/> <Buttons btnType="buttons _default" text="Update Payment" success={this.state.success} onClick={this.fetchFund}/> </div> ) } else { return ( //<CreditCardForm {...this.props}/> <div className="service-instance-box-content"> <h3><i className="fa fa-credit-card"/>Your credit/debit card</h3> {this.getAlerts()} <hr/> <RavePaymentModal text="Add your card" class="buttons _default" //class="payButton" //className="btn btn-default btn-rounded btn-md m-r-5 application-launcher" callback={this.callback} close={this.close} reference={this.getReference()} currency={this.state.currency} email={this.state.email} amount={1} payment_method="card" ravePubKey={this.props.spk || "no_public_token"} isProduction= {this.getLiveMode()} tag= "button" /> </div> ) } /*return ( <StripeProvider apiKey={this.props.spk}> <Elements id="payment-form"> <CreditCardForm {...this.props}/> </Elements> </StripeProvider> )*/ } } function BillingInfo(props) { let {invalid, submitting, pristine} = props; return ( <form className="mbf--funding-personal-info"> <CardSection/> <Field name="name" type="text" component={inputField} placeholder="Name on Card"/> {/*<Field name="address_line1" type="text" component={inputField} placeholder="Address"/>*/} {/*<Field name="address_city" type="text" component={inputField} placeholder="City"/>*/} {/*<Field name="address_state" type="text" component={inputField} placeholder="State"/>*/} <div className={`mbf--funding-save-button-wrapper`}> <button disabled={invalid|| submitting || pristine} className="buttons _primary mbf--btn-update-funding-save" onClick={props.handleSubmit} type="submit">Save Card</button> </div> </form> ) } class CreditCardForm extends React.Component { constructor(props) { super(props); let state = { hasCard: false, loading: true, card: {}, alerts: null, showForm: true }; if(props.userFund){ state.hasCard= true; state.showForm = false; state.card = props.userFund.source.card; } this.state = state; this.submissionPrep = this.submissionPrep.bind(this); // this.checkIfUserHasCard = this.checkIfUserHasCard.bind(this); this.handleSuccessResponse = this.handleSuccessResponse.bind(this); this.handleFailureResponse = this.handleFailureResponse.bind(this); this.showPaymentForm = this.showPaymentForm.bind(this); this.hidePaymentForm = this.hidePaymentForm.bind(this); } componentDidMount() { let self = this; self.setState({ loading: false, }); } async submissionPrep(values) { this.props.setLoading(true); let token = await this.props.stripe.createToken({...values}); if (token.error) { let message = token.error; if(token.error.message) { message = token.error.message; } this.setState({ alerts: { type: 'danger', icon: 'times', message: message }}); this.props.setLoading(false); throw token.error } return {user_id: this.props.uid, token_id: token.token.id}; } // checkIfUserHasCard() { // let self = this; // Fetcher(`/api/v1/users/${self.props.uid}`).then(function (response) { // if (!response.error) { // if (has(response, 'references.funds[0]') && has(response, 'references.funds[0].source.card')) { // let fund = get(response, 'references.funds[0]'); // let card = get(response, 'references.funds[0].source.card'); // self.setState({ // loading: false, // displayName: response.name || response.email || "You", // hasCard: true, // fund: fund, // card: card, // personalInformation: { // name: card.name || "", // address_line1: card.address_line1 || "", // address_city: card.address_city || "", // address_state: card.address_state || "", // } // }, function () { // }); // } else { // self.setState({ // loading: false, // showForm: true // }); // } // } else { // self.setState({loading: false, hasCard: false}); // } // }); // } handleSuccessResponse(response) { //If the billing form is passed in a callback, call it. if(this.props.handleResponse) { this.props.handleResponse(response); //Otherwise, set own alert. } else { this.setState({ alerts: { type: 'success', icon: 'check', message: 'Your card has been updated.' }}); //re-render // this.checkIfUserHasCard(); } this.props.setLoading(false); } handleFailureResponse(response) { if (response.error) { this.setState({ alerts: { type: 'danger', icon: 'times', message: response.error }}); } this.props.setLoading(false); } showPaymentForm(){ this.setState({ showForm: true }); } hidePaymentForm(){ this.setState({ showForm: false }); } render() { let submissionRequest = { 'method': 'POST', 'url': `${this.props.url}/api/v1/funds`, }; if(this.props.submitAPI) { submissionRequest.url = this.props.submitAPI; } let card = {} let {hasCard, displayName} = this.state; if(this.props.userFund){ hasCard = true; card = this.props.userFund.source.card; } let {brand, last4, exp_month, exp_year} = card; let getCard = ()=>{ if(hasCard) { return ( <div className={`mbf--card-wrapper ${this.state.showForm && "show-form"}`}> <div className="mbf--card-display"> <div className="mbf--card-number-holder"> <span className="mbf--card-brand"> {creditCardIcon(brand)} </span>{brand} ending in <span className="mbf--card-last4">{last4}</span> <span className="mbf--card-date-holder"> Expires <span className="mbf--card-exp-month">{exp_month} / </span> <span className="mbf--card-exp-year">{exp_year}</span> </span> </div> {!this.state.showForm && <div className="mbf--update-funding-button-wrapper"> <button className="buttons _primary _rounded mbf--btn-update-funding" onClick={this.showPaymentForm}>Update</button> </div> } </div> {this.state.showForm && <div className="mbf--update-funding-wrapper"> <div className="mbf--funding-form-element update-card-container"> <ServicebotBaseForm form={BillingInfo} formProps={{...this.props}} initialValues={{...this.state.personalInformation}} submissionPrep={this.submissionPrep} submissionRequest={submissionRequest} successMessage={"Fund added successfully"} customLoader={()=> {console.log("Calling checkout loader"); return <Load className={`subill-embed-custom-loader __form`}/>}} handleResponse={this.handleSuccessResponse} handleFailure={this.handleFailureResponse} reShowForm={true} external={this.props.external} token={this.props.token} /> </div> <button className="buttons _text mf--btn-cancel-update-funding" onClick={this.hidePaymentForm}>Cancel</button> </div> } </div> ) }else{ return ( <div className={`add-new-card-container`}> <div className="mbf--update-funding-wrapper"> <div className="mbf--funding-form-element"> <ServicebotBaseForm form={BillingInfo} formProps={{...this.props}} initialValues={{...this.state.personalInformation}} submissionPrep={this.submissionPrep} submissionRequest={submissionRequest} successMessage={"Fund added successfully"} handleResponse={this.handleSuccessResponse} handleFailure={this.handleFailureResponse} reShowForm={true} external={this.props.external} token={this.props.token} /> </div> </div> </div> ) } }; let getAlerts = ()=>{ if(this.state.alerts){ return ( <Alerts type={this.state.alerts.type} message={this.state.alerts.message} position={{position: 'fixed', bottom: true}} icon={this.state.alerts.icon} /> ); } }; return ( <div id="mbf--funding-form"> {getAlerts()} {getCard()} </div> ); } } let mapDispatchToProps = function(dispatch){ return { setLoading : function(is_loading){ dispatch({type: "SET_LOADING", is_loading}); }} }; //CreditCardForm = injectStripe(CreditCardForm); CreditCardForm = connect(null, mapDispatchToProps)(CreditCardForm); export {CreditCardForm, BillingForm, CardSection};
36.982646
164
0.464602
312ae5d63b1635dc02b595e97d21bd2b46be9024
5,913
js
JavaScript
client/components/donate.js
benjaminpwagner/rustystream
86d43a4fd70434a488988c95a70a93688d9d6baf
[ "MIT" ]
null
null
null
client/components/donate.js
benjaminpwagner/rustystream
86d43a4fd70434a488988c95a70a93688d9d6baf
[ "MIT" ]
2
2021-03-09T11:16:56.000Z
2021-05-09T23:30:12.000Z
client/components/donate.js
benjaminpwagner/rustystream
86d43a4fd70434a488988c95a70a93688d9d6baf
[ "MIT" ]
null
null
null
import React from 'react' const Donate = () => ( <div id="donate-container"> <div id="main-donate"> <div className="donate-package"> <div className='donate-content'> <div className="donate-package-header">Donor (1 month)</div> <div className="usd"> <img className="usd-symbol" src="usd.png" /> <div className="usd-text">10</div> </div> <div className="donate-package-rewards"> <div>2 supply signals</div> <div>150 high quality metal</div> <div>1 M249</div> <div>1 LR-300</div> <div>1 L96</div> <div>250 scrap</div> <div>In-game title</div> <div>Discord title</div> </div> </div> <div className='donate-buttons'> <img src='https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg' /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="hosted_button_id" value="T888Q6GNL2TCJ" /> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> </form> </div> </div> <div className="donate-package"> <div className='donate-content'> <div className="donate-package-header">VIP (1 month)</div> <div className="usd"> <img className="usd-symbol" src="usd.png" /> <div className="usd-text">25</div> </div> <div className="donate-package-rewards"> <div>4 supply signals</div> <div>300 high quality metal</div> <div>2 M249</div> <div>2 LR-300</div> <div>2 L96</div> <div>500 scrap</div> <div>In-game title</div> <div>Discord title</div> </div> </div> <div className='donate-buttons'> <img src='https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg' /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="hosted_button_id" value="MV7M5L8ZHGZ4J" /> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> </form> </div> </div> <div className="donate-package"> <div className='donate-content'> <div className="donate-package-header">Elite (Lifetime)</div> <div className="usd"> <img className="usd-symbol" src="usd.png" /> <div className="usd-text">50</div> </div> <div className="donate-package-rewards"> <div>6 supply signals</div> <div>500 high quality metal</div> <div>3 M249</div> <div>3 LR-300</div> <div>3 L96</div> <div>750 scrap</div> <div>32 explosive rifle rounds</div> <div>In-game title</div> <div>Discord title</div> </div> </div> <div className='donate-buttons'> <img src='https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg' /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="hosted_button_id" value="HBDPMYJDATRE2" /> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> </form> </div> </div> <div className="donate-package"> <div className='donate-content'> <div className="donate-package-header">Legend (Lifetime)</div> <div className="usd"> <img className="usd-symbol" src="usd.png" /> <div className="usd-text">100</div> </div> <div className="donate-package-rewards"> <div>8 supply signals</div> <div>750 high quality metal</div> <div>5 M249</div> <div>5 LR-300</div> <div>5 L96</div> <div>1000 scrap</div> <div>64 explosive rifle rounds</div> <div>In-game title</div> <div>Discord title</div> </div> </div> <div className='donate-buttons'> <img src='https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg' /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick" /> <input type="hidden" name="hosted_button_id" value="YVQN2FA3SCQJ4" /> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> </form> </div> </div> </div> </div> ) export default Donate
45.837209
211
0.560122
312bc5745edfe58ae56d7b8b2c845f05f1ca2358
11,683
js
JavaScript
js/main.js
AminAzGol/runedata
1c7f11a74c8a549d6d2f1409685aa7476fabc2bf
[ "MIT" ]
null
null
null
js/main.js
AminAzGol/runedata
1c7f11a74c8a549d6d2f1409685aa7476fabc2bf
[ "MIT" ]
null
null
null
js/main.js
AminAzGol/runedata
1c7f11a74c8a549d6d2f1409685aa7476fabc2bf
[ "MIT" ]
1
2022-01-30T08:41:05.000Z
2022-01-30T08:41:05.000Z
// Global variables to be accessible by all functions // Asset name & prices var _assetName = null; var _prices = null; // Calculation results var _userData = null; var _PLBreakdown = null; var _prediction = null; var _predictionBreakdown = null; // Charts var _simulateTotalValueChart = null; var _simulateFeesVsILChart = null; var _simulatePLBreakdownChart = null; var _predictTotalValueChart = null; var _predictPLBreakdownChart = null; const showSpinner = () => { $('#spinnerContainer').fadeIn(); }; const hideSpinner = () => { $('#spinnerContainer').fadeOut(); }; const showTooltip = (element, msg) => { element.tooltip('hide') .attr('data-original-title', msg) .tooltip('show'); }; const hideToolTip = (element, timeout = 1000) => { setTimeout(() => { element.tooltip('hide'); }, timeout) }; const generatePoolOptions = (select) => { for (asset of _assets) { select.append(new Option(`${asset.name} (${asset.chain}.${asset.symbol})`, `${asset.chain}.${asset.symbol}`)); } }; const setActiveToggle = (toggle) => { toggle.parent().parent().find('.nav-link').removeClass('active'); toggle.addClass('active'); }; const displayBests = (bests) => { for (i = 0; i < 5; i++) { $(`#bestName${i}`).html(bests[i].pool.split('.')[1].split('-')[0]); $(`#bestChain${i}`).html(bests[i].pool.split('.')[0]); $(`#bestROI${i}`).html(_formatPercentChange(bests[i].roi)); $(`#bestFees${i}`).html(_formatPercentChange(bests[i].feeAccrued)); $(`#bestIL${i}`).html(_formatPercentChange(bests[i].impermLoss)); } }; const displayWorsts = (worsts) => { for (i = 0; i < 5; i++) { $(`#worstName${i}`).html(worsts[i].pool.split('.')[1].split('-')[0]); $(`#worstChain${i}`).html(worsts[i].pool.split('.')[0]); $(`#worstROI${i}`).html(_formatPercentChange(worsts[i].roi)); $(`#worstFees${i}`).html(_formatPercentChange(worsts[i].feeAccrued)); $(`#worstIL${i}`).html(_formatPercentChange(worsts[i].impermLoss)); } }; $(async () => { //======================================== // Page selection buttons //======================================== $('#simulateBtn').click(function () { $(this).removeClass('btn-outline-primary').addClass('btn-primary'); $('#predictBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $('#leaderboardBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $('#simulateContainer').show(); $('#predictContainer').hide(); $('#leaderboardContainer').hide(); }); $('#predictBtn').click(function () { $('#simulateBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $(this).removeClass('btn-outline-primary').addClass('btn-primary'); $('#leaderboardBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $('#simulateContainer').hide(); $('#predictContainer').show(); $('#leaderboardContainer').hide(); }); $('#leaderboardBtn').click(function () { $('#simulateBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $('#predictBtn').removeClass('btn-primary').addClass('btn-outline-primary'); $(this).removeClass('btn-outline-primary').addClass('btn-primary'); $('#simulateContainer').hide(); $('#predictContainer').hide(); $('#leaderboardContainer').show(); }); //======================================== // Functions for past simulation page //======================================== $('#simulateTotalValueToggle').click(function (event) { event.preventDefault(); setActiveToggle($(this)); $('#simulateTotalValueCanvas').show(); $('#simulateFeesVsILCanvas').hide(); $('#simulatePLBreakdownCanvas').hide(); $('#simulateResultText').html(getSimulateTotalValueText(_userData, _assetName)); }); $('#simulateFeesVsILToggle').click(function (event) { event.preventDefault(); setActiveToggle($(this)); $('#simulateTotalValueCanvas').hide(); $('#simulateFeesVsILCanvas').show(); $('#simulatePLBreakdownCanvas').hide(); $('#simulateResultText').html(getSimulatePoolRewardsText(_userData)); }); $('#simulatePLBreakdownToggle').click(function (event) { event.preventDefault(); setActiveToggle($(this)); $('#simulateTotalValueCanvas').hide(); $('#simulateFeesVsILCanvas').hide(); $('#simulatePLBreakdownCanvas').show(); $('#simulateResultText').html(getSimulatePLBreakdownText(_PLBreakdown, _assetName)); }); //======================================== // Functions for future prediction page //======================================== $('#predictTotalValueToggle').click(function (event) { event.preventDefault(); setActiveToggle($(this)); $('#predictTotalValueCanvas').show(); $('#predictPLBreakdownCanvas').hide(); $('#predictResultText').html(getPredictTotalValueText(_prediction, _assetName)); }); $('#predictPLBreakdownToggle').click(function (event) { event.preventDefault(); setActiveToggle($(this)); $('#predictTotalValueCanvas').hide(); $('#predictPLBreakdownCanvas').show(); $('#predictResultText').html(getPredictPLBreakdownText(_predictionBreakdown, _assetName)); }); //======================================== // Submit buttons //======================================== $('#simulateSubmitBtn').click((event) => { event.preventDefault(); showSpinner(); getPastSimulation( parseFloat($('#amountSimulate').val()), $('#dateSimulate').val(), $('#poolSimulate').val() ) .then((userData) => { _assetName = $('#poolSimulate').val().split('.')[1].split('-')[0]; _userData = userData; _PLBreakdown = calculatePLBreakdown(userData); if (_simulateTotalValueChart) { _simulateTotalValueChart.destroy(); } if (_simulateFeesVsILChart) { _simulateFeesVsILChart.destroy(); } if (_simulatePLBreakdownChart) { _simulatePLBreakdownChart.destroy(); } _simulateTotalValueChart = plotTotalValue($('#simulateTotalValueCanvas'), userData, _assetName); _simulateFeesVsILChart = plotPoolRewards($('#simulateFeesVsILCanvas'), userData); _simulatePLBreakdownChart = plotPLBreakdown($('#simulatePLBreakdownCanvas'), _PLBreakdown, _assetName); $('#simulateTotalValueToggle').trigger('click'); $('#simulateChartOverlay').hide(); $('#simulateContainer').find('canvas').removeClass('blur'); hideSpinner(); }); }); $('#predictSubmitBtn').click((event) => { event.preventDefault(); showSpinner(); calculatePrediction( parseFloat($('#amountPredict').val()), $('#dateToPredict').val(), $('#poolPredict').val(), $('#timespanForAPY').val(), parseFloat($('#priceTargetRune').val()), parseFloat($('#priceTargetAsset').val()), _prices ) .then((results) => { var { prediction, predictionBreakdown } = results; _assetName = $('#poolPredict').val().split('.')[1].split('-')[0]; _prediction = prediction; _predictionBreakdown = predictionBreakdown; console.log(prediction); console.log(predictionBreakdown); if (_predictTotalValueChart) { _predictTotalValueChart.destroy(); } if (_predictPLBreakdownChart) { _predictPLBreakdownChart.destroy(); } _predictTotalValueChart = plotPrediction($('#predictTotalValueCanvas'), prediction, _assetName); _predictPLBreakdownChart = plotPLBreakdown($('#predictPLBreakdownCanvas'), predictionBreakdown, _assetName); $('#predictTotalValueToggle').trigger('click'); $('#predictChartOverlay').hide(); $('#predictContainer').find('canvas').removeClass('blur'); hideSpinner(); }); }); $('#leaderboardSubmitBtn') .tooltip({ placement: 'bottom' }) .click((event) => { event.preventDefault(); showSpinner(); getAllAssetPerformances($('#leaderboardDate').val()) .then(getBestsAndWorsts) .then((results) => { var { bests, worsts } = results; displayBests(bests); displayWorsts(worsts); hideSpinner(); }); }); //======================================== // Generate default page contents //======================================== // Options for pool selectors generatePoolOptions($('#poolSimulate')); generatePoolOptions($('#poolPredict')); // Placeholder images fitCanvasToContainer($('#simulateTotalValueCanvas')[0]); drawPlaceholderImage($('#simulateTotalValueCanvas')[0], 'images/simulateTotalValuePlaceholder.png'); fitCanvasToContainer($('#simulateFeesVsILCanvas')[0]); drawPlaceholderImage($('#simulateFeesVsILCanvas')[0], 'images/feesVsILPlaceholder.png'); fitCanvasToContainer($('#simulatePLBreakdownCanvas')[0]); drawPlaceholderImage($('#simulatePLBreakdownCanvas')[0], 'images/PLBreakdownPlaceholder.png'); fitCanvasToContainer($('#predictTotalValueCanvas')[0]); drawPlaceholderImage($('#predictTotalValueCanvas')[0], 'images/predictTotalValuePlaceholder.png'); fitCanvasToContainer($('#predictPLBreakdownCanvas')[0]); drawPlaceholderImage($('#predictPLBreakdownCanvas')[0], 'images/PLBreakdownPlaceholder.png'); // Fetch asset prices _prices = await getCurrentPrices(_assets); var poolPredict = $('#poolPredict'); var priceTargetRune = $('#priceTargetRune'); var priceTargetAsset = $('#priceTargetAsset'); priceTargetRune.val(_formatPrice(_prices['RUNE'])); priceTargetAsset.val(_formatPrice(_prices[`${_assets[0].chain}.${_assets[0].symbol}`])); poolPredict.change(() => { priceTargetAsset.val(_formatPrice(_prices[poolPredict.val()])); }); //======================================== // Read query strings //======================================== var args = parseQueryString(); if ( args.page == 'simulate' ) { $('#amountSimulate').val(args.amount); $('#dateSimulate').val(args.date); $('#poolSimulate').val(args.pool) $('#simulateBtn').trigger('click'); $('#simulateSubmitBtn').trigger('click'); } else if ( args.page == 'predict' ) { $('#amountPredict').val(args.amount); $('#dateToPredict').val(args.date); $('#poolPredict').val(args.pool); $('#timespanForAPY').val(args.timespan); $('#priceTargetRune').val(args.priceTargetRune); $('#priceTargetAsset').val(args.priceTargetAsset); $('#predictBtn').trigger('click'); $('#predictSubmitBtn').trigger('click'); } else if ( args.page == 'leaderboard' ) { $('#leaderboardDate').val(args.since); $('#leaderboardBtn').trigger('click'); $('#leaderboardSubmitBtn').trigger('click'); } else { // Default page behavior $('#simulateBtn').trigger('click'); $('#simulateTotalValueToggle').trigger('click'); $('#predictTotalValueToggle').trigger('click'); hideSpinner(); } });
36.85489
120
0.575024
312c9c099552556aa11fdff5be01b0d419cb4388
30,594
js
JavaScript
api/hierarchy.js
tellproject/homepage-generator
2af45729048485afaba678678f6b300e03e20847
[ "BSD-3-Clause" ]
null
null
null
api/hierarchy.js
tellproject/homepage-generator
2af45729048485afaba678678f6b300e03e20847
[ "BSD-3-Clause" ]
null
null
null
api/hierarchy.js
tellproject/homepage-generator
2af45729048485afaba678678f6b300e03e20847
[ "BSD-3-Clause" ]
null
null
null
var hierarchy = [ [ "AbstractTuple", null, [ [ "tell::db::Tuple", "classtell_1_1db_1_1_tuple.html", null ] ] ], [ "crossbow::allocator", "classcrossbow_1_1allocator.html", null ], [ "crossbow::has_visit_helper< Type >::BaseMixin", "structcrossbow_1_1has__visit__helper_1_1_base_mixin.html", [ [ "crossbow::has_visit_helper< Type >::Base", "structcrossbow_1_1has__visit__helper_1_1_base.html", null ] ] ], [ "crossbow::basic_string< Char, Traits, Allocator >", "classcrossbow_1_1basic__string.html", null ], [ "crossbow::basic_string< char >", "classcrossbow_1_1basic__string.html", null ], [ "crossbow::concurrent_map< Key, T, Hash, KeyEqual, Allocator, MutexType, ConcurrencyLevel, InitialCapacity, LoadFactor >::Bucket", "structcrossbow_1_1concurrent__map_1_1_bucket.html", null ], [ "crossbow::buffer_reader", "classcrossbow_1_1buffer__reader.html", null ], [ "crossbow::buffer_writer", "classcrossbow_1_1buffer__writer.html", null ], [ "crossbow::program_options::impl::callback_t< Fun >", "structcrossbow_1_1program__options_1_1impl_1_1callback__t.html", null ], [ "crossbow::ChunkAllocator< T >", "classcrossbow_1_1_chunk_allocator.html", null ], [ "crossbow::ChunkMemoryPool", "classcrossbow_1_1_chunk_memory_pool.html", null ], [ "crossbow::ChunkObject", "classcrossbow_1_1_chunk_object.html", [ [ "tell::db::Tuple", "classtell_1_1db_1_1_tuple.html", null ] ] ], [ "tell::db::ClientManager< Context >", "classtell_1_1db_1_1_client_manager.html", null ], [ "tell::db::impl::ClientTable", "classtell_1_1db_1_1impl_1_1_client_table.html", null ], [ "crossbow::concurrent_map< Key, T, Hash, KeyEqual, Allocator, MutexType, ConcurrencyLevel, InitialCapacity, LoadFactor >", "classcrossbow_1_1concurrent__map.html", null ], [ "crossbow::infinio::ConditionVariable", "classcrossbow_1_1infinio_1_1_condition_variable.html", null ], [ "crossbow::create_static< T >", "structcrossbow_1_1create__static.html", null ], [ "crossbow::create_using< T, allocator >", "structcrossbow_1_1create__using.html", null ], [ "crossbow::create_using_malloc< T >", "structcrossbow_1_1create__using__malloc.html", null ], [ "crossbow::create_using_new< T >", "structcrossbow_1_1create__using__new.html", null ], [ "crossbow::default_lifetime< T >", "structcrossbow_1_1default__lifetime.html", null ], [ "crossbow::program_options::tag::description", "structcrossbow_1_1program__options_1_1tag_1_1description.html", null ], [ "crossbow::deserialize_policy< Archiver, T >", "structcrossbow_1_1deserialize__policy.html", null ], [ "crossbow::deserialize_policy< Archiver, bool >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01bool_01_4.html", null ], [ "crossbow::deserialize_policy< Archiver, boost::optional< T > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01boost_1_1optional_3_01_t_01_4_01_4.html", null ], [ "crossbow::deserialize_policy< Archiver, crossbow::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01crossbow_1_1basic__string_3_01_char_00_367661013d93ffe092ed29a5faf86f65.html", null ], [ "crossbow::deserialize_policy< Archiver, std::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1basic__string_3_01_char_00_01_traits_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::deserialize_policy< Archiver, std::map< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1map_3_01_key_00_01_value_00_01_p12089c3fab328863e836bc6117729e40.html", null ], [ "crossbow::deserialize_policy< Archiver, std::multimap< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1multimap_3_01_key_00_01_value_00b40c66dad8bae8aa4295ab72893d04df.html", null ], [ "crossbow::deserialize_policy< Archiver, std::pair< U, V > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1pair_3_01_u_00_01_v_01_4_01_4.html", null ], [ "crossbow::deserialize_policy< Archiver, std::tuple< T... > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1tuple_3_01_t_8_8_8_01_4_01_4.html", null ], [ "crossbow::deserialize_policy< Archiver, std::unordered_map< Key, Value, Hash, Predicate, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1unordered__map_3_01_key_00_01_va33c1c2e5af762bcc772f6d4ce8735212.html", null ], [ "crossbow::deserialize_policy< Archiver, std::vector< T, Allocator > >", "structcrossbow_1_1deserialize__policy_3_01_archiver_00_01std_1_1vector_3_01_t_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::deserialize_policy_tuple_impl< Archiver, Tuple, Index >", "structcrossbow_1_1deserialize__policy__tuple__impl.html", null ], [ "crossbow::deserialize_policy_tuple_impl< Archiver, Tuple,-1 >", "structcrossbow_1_1deserialize__policy__tuple__impl_3_01_archiver_00_01_tuple_00-1_01_4.html", null ], [ "crossbow::deserializer", "structcrossbow_1_1deserializer.html", null ], [ "crossbow::dummy", "structcrossbow_1_1dummy.html", null ], [ "crossbow::infinio::Endpoint", "classcrossbow_1_1infinio_1_1_endpoint.html", null ], [ "error_category", null, [ [ "crossbow::infinio::error::network_category", "classcrossbow_1_1infinio_1_1error_1_1network__category.html", null ], [ "crossbow::infinio::error::rpc_category", "classcrossbow_1_1infinio_1_1error_1_1rpc__category.html", null ], [ "crossbow::infinio::error::work_completion_category", "classcrossbow_1_1infinio_1_1error_1_1work__completion__category.html", null ] ] ], [ "exception", null, [ [ "tell::db::Exception", "classtell_1_1db_1_1_exception.html", [ [ "tell::db::Conflicts", "classtell_1_1db_1_1_conflicts.html", null ], [ "tell::db::KeyException", "classtell_1_1db_1_1_key_exception.html", [ [ "tell::db::Conflict", "classtell_1_1db_1_1_conflict.html", null ], [ "tell::db::IndexConflict", "classtell_1_1db_1_1_index_conflict.html", null ], [ "tell::db::TupleDoesNotExist", "classtell_1_1db_1_1_tuple_does_not_exist.html", null ], [ "tell::db::TupleExistsException", "classtell_1_1db_1_1_tuple_exists_exception.html", null ] ] ], [ "tell::db::OpenTableException", "classtell_1_1db_1_1_open_table_exception.html", null ], [ "tell::db::UniqueViolation", "classtell_1_1db_1_1_unique_violation.html", null ] ] ] ] ], [ "tell::db::impl::FiberContext< Context >", "structtell_1_1db_1_1impl_1_1_fiber_context.html", null ], [ "tell::db::Field", "classtell_1_1db_1_1_field.html", null ], [ "tell::db::Future< T >", "classtell_1_1db_1_1_future.html", null ], [ "crossbow::has_visit< T >", "structcrossbow_1_1has__visit.html", null ], [ "crossbow::has_visit_helper< Type >", "structcrossbow_1_1has__visit__helper.html", null ], [ "std::hash< crossbow::basic_string< CharT, Traits, Allocator > >", "structstd_1_1hash_3_01crossbow_1_1basic__string_3_01_char_t_00_01_traits_00_01_allocator_01_4_01_4.html", null ], [ "std::hash< tell::db::key_t >", "structstd_1_1hash_3_01tell_1_1db_1_1key__t_01_4.html", null ], [ "std::hash< tell::db::table_t >", "structstd_1_1hash_3_01tell_1_1db_1_1table__t_01_4.html", null ], [ "crossbow::has_visit_helper< Type >::Helper< T, t >", "classcrossbow_1_1has__visit__helper_1_1_helper.html", null ], [ "crossbow::has_visit< T >::helper", "structcrossbow_1_1has__visit_1_1helper.html", null ], [ "crossbow::program_options::tag::ignore_long< V >", "structcrossbow_1_1program__options_1_1tag_1_1ignore__long.html", null ], [ "crossbow::program_options::tag::ignore_short< V >", "structcrossbow_1_1program__options_1_1tag_1_1ignore__short.html", null ], [ "crossbow::infinio::InfinibandAcceptorHandler", "classcrossbow_1_1infinio_1_1_infiniband_acceptor_handler.html", [ [ "crossbow::infinio::RpcServerManager< Manager, Socket >", "classcrossbow_1_1infinio_1_1_rpc_server_manager.html", null ] ] ], [ "crossbow::infinio::InfinibandBaseSocket< SocketType >", "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html", null ], [ "crossbow::infinio::InfinibandBaseSocket< InfinibandAcceptorImpl >", "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html", [ [ "crossbow::infinio::InfinibandAcceptorImpl", "classcrossbow_1_1infinio_1_1_infiniband_acceptor_impl.html", null ] ] ], [ "crossbow::infinio::InfinibandBaseSocket< InfinibandSocketImpl >", "classcrossbow_1_1infinio_1_1_infiniband_base_socket.html", [ [ "crossbow::infinio::InfinibandSocketImpl", "classcrossbow_1_1infinio_1_1_infiniband_socket_impl.html", null ] ] ], [ "crossbow::infinio::InfinibandBuffer", "classcrossbow_1_1infinio_1_1_infiniband_buffer.html", null ], [ "crossbow::infinio::InfinibandLimits", "structcrossbow_1_1infinio_1_1_infiniband_limits.html", null ], [ "crossbow::infinio::InfinibandSocketHandler", "classcrossbow_1_1infinio_1_1_infiniband_socket_handler.html", [ [ "crossbow::infinio::BatchingMessageSocket< RpcClientSocket >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", [ [ "crossbow::infinio::RpcClientSocket", "classcrossbow_1_1infinio_1_1_rpc_client_socket.html", null ] ] ], [ "crossbow::infinio::BatchingMessageSocket< RpcServerSocket< Manager, Socket > >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", [ [ "crossbow::infinio::RpcServerSocket< Manager, Socket >", "classcrossbow_1_1infinio_1_1_rpc_server_socket.html", null ] ] ], [ "crossbow::infinio::BatchingMessageSocket< Handler >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ] ] ], [ "crossbow::infinite_lifetime< T >", "structcrossbow_1_1infinite__lifetime.html", null ], [ "crossbow::impl::initial_string< S, V, bool >", "structcrossbow_1_1impl_1_1initial__string.html", null ], [ "crossbow::impl::initial_string< crossbow::string, V, b >", "structcrossbow_1_1impl_1_1initial__string_3_01crossbow_1_1string_00_01_v_00_01b_01_4.html", null ], [ "crossbow::impl::initial_string< crossbow::wstring, V, b >", "structcrossbow_1_1impl_1_1initial__string_3_01crossbow_1_1wstring_00_01_v_00_01b_01_4.html", null ], [ "crossbow::SingleConsumerQueue< T, QueueSize >::Item", "structcrossbow_1_1_single_consumer_queue_1_1_item.html", null ], [ "tell::db::Iterator", "classtell_1_1db_1_1_iterator.html", null ], [ "tell::db::key_t", "structtell_1_1db_1_1key__t.html", null ], [ "crossbow::lifetime_traits< T >", "structcrossbow_1_1lifetime__traits.html", null ], [ "crossbow::lifetime_traits< default_lifetime< T > >", "structcrossbow_1_1lifetime__traits_3_01default__lifetime_3_01_t_01_4_01_4.html", null ], [ "crossbow::lifetime_traits< infinite_lifetime< T > >", "structcrossbow_1_1lifetime__traits_3_01infinite__lifetime_3_01_t_01_4_01_4.html", null ], [ "crossbow::logger::LogFormatter< Args >", "structcrossbow_1_1logger_1_1_log_formatter.html", null ], [ "crossbow::logger::LogFormatter< Head, Tail... >", "structcrossbow_1_1logger_1_1_log_formatter_3_01_head_00_01_tail_8_8_8_01_4.html", null ], [ "crossbow::logger::LogFormatter< Tail... >", "structcrossbow_1_1logger_1_1_log_formatter.html", null ], [ "crossbow::logger::LogFormatter<>", "structcrossbow_1_1logger_1_1_log_formatter_3_4.html", null ], [ "crossbow::logger::LoggerConfig", "structcrossbow_1_1logger_1_1_logger_config.html", null ], [ "crossbow::logger::LoggerT", "classcrossbow_1_1logger_1_1_logger_t.html", null ], [ "crossbow::create_static< T >::max_align", "unioncrossbow_1_1create__static_1_1max__align.html", null ], [ "crossbow::infinio::MessageId", "classcrossbow_1_1infinio_1_1_message_id.html", null ], [ "crossbow::has_visit_helper< Type >::no", "classcrossbow_1_1has__visit__helper_1_1no.html", null ], [ "crossbow::no_locking", "structcrossbow_1_1no__locking.html", null ], [ "crossbow::non_copyable", "classcrossbow_1_1non__copyable.html", [ [ "crossbow::infinio::BatchingMessageSocket< RpcClientSocket >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::infinio::BatchingMessageSocket< RpcServerSocket< Manager, Socket > >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::fixed_size_stack< T >", "classcrossbow_1_1fixed__size__stack.html", null ], [ "crossbow::infinio::AllocatedMemoryRegion", "classcrossbow_1_1infinio_1_1_allocated_memory_region.html", null ], [ "crossbow::infinio::BatchingMessageSocket< Handler >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::infinio::EventPoll", "classcrossbow_1_1infinio_1_1_event_poll.html", [ [ "crossbow::infinio::LocalTaskQueue", "classcrossbow_1_1infinio_1_1_local_task_queue.html", null ], [ "crossbow::infinio::TaskQueue", "classcrossbow_1_1infinio_1_1_task_queue.html", null ] ] ], [ "crossbow::infinio::EventProcessor", "classcrossbow_1_1infinio_1_1_event_processor.html", null ], [ "crossbow::infinio::Fiber", "classcrossbow_1_1infinio_1_1_fiber.html", null ], [ "crossbow::infinio::InfinibandProcessor", "classcrossbow_1_1infinio_1_1_infiniband_processor.html", null ], [ "crossbow::infinio::InfinibandService", "classcrossbow_1_1infinio_1_1_infiniband_service.html", null ], [ "crossbow::infinio::LocalMemoryRegion", "classcrossbow_1_1infinio_1_1_local_memory_region.html", null ] ] ], [ "crossbow::non_movable", "classcrossbow_1_1non__movable.html", [ [ "crossbow::infinio::BatchingMessageSocket< RpcClientSocket >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::infinio::BatchingMessageSocket< RpcServerSocket< Manager, Socket > >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::fixed_size_stack< T >", "classcrossbow_1_1fixed__size__stack.html", null ], [ "crossbow::infinio::BatchingMessageSocket< Handler >", "classcrossbow_1_1infinio_1_1_batching_message_socket.html", null ], [ "crossbow::infinio::EventPoll", "classcrossbow_1_1infinio_1_1_event_poll.html", null ], [ "crossbow::infinio::EventProcessor", "classcrossbow_1_1infinio_1_1_event_processor.html", null ], [ "crossbow::infinio::Fiber", "classcrossbow_1_1infinio_1_1_fiber.html", null ], [ "crossbow::infinio::InfinibandProcessor", "classcrossbow_1_1infinio_1_1_infiniband_processor.html", null ], [ "crossbow::infinio::InfinibandService", "classcrossbow_1_1infinio_1_1_infiniband_service.html", null ] ] ], [ "crossbow::program_options::impl::o_options< Opts >", "structcrossbow_1_1program__options_1_1impl_1_1o__options.html", null ], [ "crossbow::program_options::impl::o_options< Opts... >", "structcrossbow_1_1program__options_1_1impl_1_1o__options.html", null ], [ "crossbow::program_options::impl::o_options< Tail... >", "structcrossbow_1_1program__options_1_1impl_1_1o__options.html", [ [ "crossbow::program_options::impl::o_options< Head, Tail... >", "structcrossbow_1_1program__options_1_1impl_1_1o__options_3_01_head_00_01_tail_8_8_8_01_4.html", null ] ] ], [ "crossbow::program_options::impl::o_options<>", "structcrossbow_1_1program__options_1_1impl_1_1o__options_3_4.html", null ], [ "crossbow::program_options::impl::option< Name, T, Opts >", "structcrossbow_1_1program__options_1_1impl_1_1option.html", null ], [ "crossbow::program_options::impl::options< Opts >", "structcrossbow_1_1program__options_1_1impl_1_1options.html", null ], [ "crossbow::program_options::impl::options< Rest... >", "structcrossbow_1_1program__options_1_1impl_1_1options.html", [ [ "crossbow::program_options::impl::options< First, Rest... >", "structcrossbow_1_1program__options_1_1impl_1_1options_3_01_first_00_01_rest_8_8_8_01_4.html", null ] ] ], [ "crossbow::program_options::impl::options<>", "structcrossbow_1_1program__options_1_1impl_1_1options_3_4.html", null ], [ "crossbow::program_options::impl::OptionType< Name, T, Opts >", "structcrossbow_1_1program__options_1_1impl_1_1_option_type.html", null ], [ "crossbow::program_options::impl::OptionType< Name, char *, T, Opts... >", "structcrossbow_1_1program__options_1_1impl_1_1_option_type_3_01_name_00_01char_01_5_00_01_t_00_01_opts_8_8_8_01_4.html", null ], [ "crossbow::program_options::impl::OptionType< Name, const char *, T, Opts... >", "structcrossbow_1_1program__options_1_1impl_1_1_option_type_3_01_name_00_01const_01char_01_5_00_01_t_00_01_opts_8_8_8_01_4.html", null ], [ "crossbow::program_options::impl::OptionType< Name, const std::string &, T, Opts... >", "structcrossbow_1_1program__options_1_1impl_1_1_option_type_3_01_name_00_01const_01std_1_1string_cddafa0c1ec09de04c92d4e471397de4.html", null ], [ "crossbow::sizer::other_impl< T >", "structcrossbow_1_1sizer_1_1other__impl.html", null ], [ "crossbow::program_options::parser< T >", "structcrossbow_1_1program__options_1_1parser.html", null ], [ "crossbow::program_options::parser< char >", "structcrossbow_1_1program__options_1_1parser_3_01char_01_4.html", null ], [ "crossbow::program_options::parser< double >", "structcrossbow_1_1program__options_1_1parser_3_01double_01_4.html", null ], [ "crossbow::program_options::parser< float >", "structcrossbow_1_1program__options_1_1parser_3_01float_01_4.html", null ], [ "crossbow::program_options::parser< int >", "structcrossbow_1_1program__options_1_1parser_3_01int_01_4.html", null ], [ "crossbow::program_options::parser< long >", "structcrossbow_1_1program__options_1_1parser_3_01long_01_4.html", null ], [ "crossbow::program_options::parser< long double >", "structcrossbow_1_1program__options_1_1parser_3_01long_01double_01_4.html", null ], [ "crossbow::program_options::parser< long long >", "structcrossbow_1_1program__options_1_1parser_3_01long_01long_01_4.html", null ], [ "crossbow::program_options::parser< short >", "structcrossbow_1_1program__options_1_1parser_3_01short_01_4.html", null ], [ "crossbow::program_options::parser< std::string >", "structcrossbow_1_1program__options_1_1parser_3_01std_1_1string_01_4.html", null ], [ "crossbow::program_options::parser< string >", "structcrossbow_1_1program__options_1_1parser_3_01string_01_4.html", null ], [ "crossbow::program_options::parser< unsigned >", "structcrossbow_1_1program__options_1_1parser_3_01unsigned_01_4.html", null ], [ "crossbow::program_options::parser< unsigned long >", "structcrossbow_1_1program__options_1_1parser_3_01unsigned_01long_01_4.html", null ], [ "crossbow::program_options::parser< unsigned long long >", "structcrossbow_1_1program__options_1_1parser_3_01unsigned_01long_01long_01_4.html", null ], [ "crossbow::program_options::parser< unsigned short >", "structcrossbow_1_1program__options_1_1parser_3_01unsigned_01short_01_4.html", null ], [ "crossbow::phoenix_lifetime< T >", "structcrossbow_1_1phoenix__lifetime.html", null ], [ "crossbow::ChunkAllocator< T >::rebind< U >", "structcrossbow_1_1_chunk_allocator_1_1rebind.html", null ], [ "crossbow::infinio::RemoteMemoryRegion", "classcrossbow_1_1infinio_1_1_remote_memory_region.html", null ], [ "crossbow::infinio::RpcResponse", "classcrossbow_1_1infinio_1_1_rpc_response.html", [ [ "crossbow::infinio::RpcResponseResult< Handler, Result >", "classcrossbow_1_1infinio_1_1_rpc_response_result.html", null ], [ "crossbow::infinio::RpcResponseResult< Handler, void >", "classcrossbow_1_1infinio_1_1_rpc_response_result_3_01_handler_00_01void_01_4.html", null ] ] ], [ "runtime_error", null, [ [ "crossbow::program_options::parse_error", "structcrossbow_1_1program__options_1_1parse__error.html", [ [ "crossbow::program_options::argument_not_found", "structcrossbow_1_1program__options_1_1argument__not__found.html", null ], [ "crossbow::program_options::inexpected_value", "structcrossbow_1_1program__options_1_1inexpected__value.html", null ] ] ] ] ], [ "crossbow::infinio::ScatterGatherBuffer", "classcrossbow_1_1infinio_1_1_scatter_gather_buffer.html", null ], [ "crossbow::serialize_policy< Archiver, T >", "structcrossbow_1_1serialize__policy.html", null ], [ "crossbow::serialize_policy< Archiver, bool >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01bool_01_4.html", null ], [ "crossbow::serialize_policy< Archiver, boost::optional< T > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01boost_1_1optional_3_01_t_01_4_01_4.html", null ], [ "crossbow::serialize_policy< Archiver, crossbow::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01crossbow_1_1basic__string_3_01_char_00_01787815800393746394ca1e50f200bedd.html", null ], [ "crossbow::serialize_policy< Archiver, std::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1basic__string_3_01_char_00_01_traits_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::serialize_policy< Archiver, std::map< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1map_3_01_key_00_01_value_00_01_prefe0a7a2332d46b14c6c73d0cd227d1ac.html", null ], [ "crossbow::serialize_policy< Archiver, std::multimap< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1multimap_3_01_key_00_01_value_00_0cab77ede05bd044b8537a2c83c44859a.html", null ], [ "crossbow::serialize_policy< Archiver, std::pair< U, V > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1pair_3_01_u_00_01_v_01_4_01_4.html", null ], [ "crossbow::serialize_policy< Archiver, std::tuple< T... > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1tuple_3_01_t_8_8_8_01_4_01_4.html", null ], [ "crossbow::serialize_policy< Archiver, std::unordered_map< Key, Value, Hash, Predicate, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1unordered__map_3_01_key_00_01_valu5ea51ea253bcc7822df628e8d1e04713.html", null ], [ "crossbow::serialize_policy< Archiver, std::vector< T, Allocator > >", "structcrossbow_1_1serialize__policy_3_01_archiver_00_01std_1_1vector_3_01_t_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::serialize_policy_tuple_impl< Archiver, Tuple, Index >", "structcrossbow_1_1serialize__policy__tuple__impl.html", null ], [ "crossbow::serialize_policy_tuple_impl< Archiver, Tuple,-1 >", "structcrossbow_1_1serialize__policy__tuple__impl_3_01_archiver_00_01_tuple_00-1_01_4.html", null ], [ "crossbow::serializer", "structcrossbow_1_1serializer.html", null ], [ "crossbow::serializer_into_array", "structcrossbow_1_1serializer__into__array.html", null ], [ "crossbow::program_options::tag::show< V >", "structcrossbow_1_1program__options_1_1tag_1_1show.html", null ], [ "crossbow::SingleConsumerQueue< T, QueueSize >", "classcrossbow_1_1_single_consumer_queue.html", null ], [ "crossbow::SingleConsumerQueue< std::function< void()>, 256 >", "classcrossbow_1_1_single_consumer_queue.html", null ], [ "crossbow::singleton< Type, Create, LifetimePolicy, Mutex >", "classcrossbow_1_1singleton.html", null ], [ "crossbow::size_policy< Archiver, T >", "structcrossbow_1_1size__policy.html", null ], [ "crossbow::size_policy< Archiver, bool >", "structcrossbow_1_1size__policy_3_01_archiver_00_01bool_01_4.html", null ], [ "crossbow::size_policy< Archiver, boost::optional< T > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01boost_1_1optional_3_01_t_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, crossbow::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01crossbow_1_1basic__string_3_01_char_00_01_traits_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, std::basic_string< Char, Traits, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1basic__string_3_01_char_00_01_traits_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, std::map< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1map_3_01_key_00_01_value_00_01_predicate_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, std::multimap< Key, Value, Predicate, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1multimap_3_01_key_00_01_value_00_01_predcacc846b11af875dd5b8f45452b0b90.html", null ], [ "crossbow::size_policy< Archiver, std::pair< U, V > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1pair_3_01_u_00_01_v_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, std::tuple< T... > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1tuple_3_01_t_8_8_8_01_4_01_4.html", null ], [ "crossbow::size_policy< Archiver, std::unordered_map< Key, Value, Hash, Predicate, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1unordered__map_3_01_key_00_01_value_00_24255cc159f0c25d71be6931ba8319ef.html", null ], [ "crossbow::size_policy< Archiver, std::vector< T, Allocator > >", "structcrossbow_1_1size__policy_3_01_archiver_00_01std_1_1vector_3_01_t_00_01_allocator_01_4_01_4.html", null ], [ "crossbow::size_policy_tuple_impl< Archiver, Tuple, Index >", "structcrossbow_1_1size__policy__tuple__impl.html", null ], [ "crossbow::size_policy_tuple_impl< Archiver, Tuple,-1 >", "structcrossbow_1_1size__policy__tuple__impl_3_01_archiver_00_01_tuple_00-1_01_4.html", null ], [ "crossbow::sizer", "structcrossbow_1_1sizer.html", null ], [ "T", null, [ [ "crossbow::serializable< T >", "structcrossbow_1_1serializable.html", null ] ] ], [ "tell::db::table_t", "structtell_1_1db_1_1table__t.html", null ], [ "tell::db::impl::TellDBContext", "structtell_1_1db_1_1impl_1_1_tell_d_b_context.html", null ], [ "tell::db::Transaction", "classtell_1_1db_1_1_transaction.html", null ], [ "tell::db::TransactionFiber< Context >", "classtell_1_1db_1_1_transaction_fiber.html", null ], [ "true_type", null, [ [ "std::is_error_code_enum< crossbow::infinio::error::network_errors >", "structstd_1_1is__error__code__enum_3_01crossbow_1_1infinio_1_1error_1_1network__errors_01_4.html", null ], [ "std::is_error_code_enum< crossbow::infinio::error::rpc_errors >", "structstd_1_1is__error__code__enum_3_01crossbow_1_1infinio_1_1error_1_1rpc__errors_01_4.html", null ], [ "std::is_error_code_enum< ibv_wc_status >", "structstd_1_1is__error__code__enum_3_01ibv__wc__status_01_4.html", null ] ] ], [ "tell::db::tuple_set< id, T >", "structtell_1_1db_1_1tuple__set.html", null ], [ "tell::db::tuple_set< 0, T... >", "structtell_1_1db_1_1tuple__set_3_010_00_01_t_8_8_8_01_4.html", null ], [ "Type", null, [ [ "crossbow::has_visit_helper< Type >::Base", "structcrossbow_1_1has__visit__helper_1_1_base.html", null ] ] ], [ "crossbow::program_options::impl::type_of< Name, Opts >", "structcrossbow_1_1program__options_1_1impl_1_1type__of.html", null ], [ "crossbow::program_options::impl::type_of_impl< Name, F, Opts >", "structcrossbow_1_1program__options_1_1impl_1_1type__of__impl.html", null ], [ "crossbow::program_options::impl::type_of_impl< Name, F, Head >", "structcrossbow_1_1program__options_1_1impl_1_1type__of__impl_3_01_name_00_01_f_00_01_head_01_4.html", null ], [ "crossbow::program_options::impl::type_of_impl< Name, F, Head, Tail... >", "structcrossbow_1_1program__options_1_1impl_1_1type__of__impl_3_01_name_00_01_f_00_01_head_00_01_tail_8_8_8_01_4.html", null ], [ "crossbow::program_options::type_printer< T >", "structcrossbow_1_1program__options_1_1type__printer.html", null ], [ "crossbow::program_options::type_printer< bool >", "structcrossbow_1_1program__options_1_1type__printer_3_01bool_01_4.html", null ], [ "crossbow::program_options::type_printer< char >", "structcrossbow_1_1program__options_1_1type__printer_3_01char_01_4.html", null ], [ "crossbow::program_options::type_printer< double >", "structcrossbow_1_1program__options_1_1type__printer_3_01double_01_4.html", null ], [ "crossbow::program_options::type_printer< int >", "structcrossbow_1_1program__options_1_1type__printer_3_01int_01_4.html", null ], [ "crossbow::program_options::type_printer< long >", "structcrossbow_1_1program__options_1_1type__printer_3_01long_01_4.html", null ], [ "crossbow::program_options::type_printer< long double >", "structcrossbow_1_1program__options_1_1type__printer_3_01long_01double_01_4.html", null ], [ "crossbow::program_options::type_printer< long long >", "structcrossbow_1_1program__options_1_1type__printer_3_01long_01long_01_4.html", null ], [ "crossbow::program_options::type_printer< short >", "structcrossbow_1_1program__options_1_1type__printer_3_01short_01_4.html", null ], [ "crossbow::program_options::type_printer< std::string >", "structcrossbow_1_1program__options_1_1type__printer_3_01std_1_1string_01_4.html", null ], [ "crossbow::program_options::type_printer< string >", "structcrossbow_1_1program__options_1_1type__printer_3_01string_01_4.html", null ], [ "crossbow::program_options::type_printer< unsigned >", "structcrossbow_1_1program__options_1_1type__printer_3_01unsigned_01_4.html", null ], [ "crossbow::program_options::type_printer< unsigned char >", "structcrossbow_1_1program__options_1_1type__printer_3_01unsigned_01char_01_4.html", null ], [ "crossbow::program_options::type_printer< unsigned long >", "structcrossbow_1_1program__options_1_1type__printer_3_01unsigned_01long_01_4.html", null ], [ "crossbow::program_options::type_printer< unsigned long long >", "structcrossbow_1_1program__options_1_1type__printer_3_01unsigned_01long_01long_01_4.html", null ], [ "crossbow::program_options::type_printer< unsigned short >", "structcrossbow_1_1program__options_1_1type__printer_3_01unsigned_01short_01_4.html", null ], [ "crossbow::program_options::type_printer< value_type >", "structcrossbow_1_1program__options_1_1type__printer.html", null ], [ "crossbow::sizer::visit_impl< T >", "structcrossbow_1_1sizer_1_1visit__impl.html", null ], [ "crossbow::has_visit_helper< Type >::yes", "classcrossbow_1_1has__visit__helper_1_1yes.html", null ] ];
115.886364
256
0.775021
312cbf1b360a96b781d5e78da60a05a0b8f6235c
1,600
js
JavaScript
src/styles/colors.js
avvo/re-suitably
5655fff5594d2394ddb4156bd134c87c74862324
[ "MIT" ]
1
2018-04-05T01:12:53.000Z
2018-04-05T01:12:53.000Z
src/styles/colors.js
avvo/re-suitably
5655fff5594d2394ddb4156bd134c87c74862324
[ "MIT" ]
4
2021-03-01T23:19:33.000Z
2021-07-20T03:08:36.000Z
src/styles/colors.js
avvo/re-suitably
5655fff5594d2394ddb4156bd134c87c74862324
[ "MIT" ]
null
null
null
const avvoPrimary = { navy: "#00447B", electricBlue: "#26DDFC", teal: "#00B7AF", coral: "#F27760", coolGrey: "#CDCFCE", bgColor: "#f9f9f9" }; const avvoSecondary = { blue: "#008CC9", orange: "#F55D25", orangeHover: "#FF8355", orangeActive: "#DD3B00" }; const avvoTertiary = { tertiaryGreen: "#52A304", tertiaryYellow: "#FC9835", tertiaryRed: "#ED4F4B" }; const avvoGreyScale = { white: "#FFFFFF", grey10: "#F9F9F9", grey20: "#EAEAEA", grey40: "#CCCCCC", grey50: "#969696", grey70: "#666666", grey90: "#333333", black: "#000000" }; const avvoTextbox = { // These should be consolidated into standard colors textboxBorder: "#66AFE9", textboxPlaceholderColor: "rgba(51,51,51,0.4)", textboxDisabledColor: "rgba(0,0,0,0.02)" }; const avvoSemantic = { avvoPro: avvoPrimary.electricBlue, semPrimary: avvoSecondary.orange, semSuccess: avvoTertiary.tertiaryGreen, semSecondary: "#0394b9", semInfo: "#03AFDA", semWarning: avvoTertiary.tertiaryYellow, semDanger: avvoTertiary.tertiaryRed, semActive: avvoSecondary.orange }; const avvoActiveItem = { activeItem: avvoGreyScale.white, activeBg: avvoSecondary.orange }; // Avvo feedback states const avvoFeedbackStates = { stateSuccess: "rgba(82, 163, 4, 0.03)", stateInfo: "rgba(3, 175, 218, 0.03)", stateWarning: "rgba(252, 152, 53, 0.03)", stateDanger: "rgba(237, 79, 75, 0.03)" }; module.exports = Object.assign( { avvoPrimary }, avvoPrimary, avvoSecondary, avvoTertiary, avvoGreyScale, avvoSemantic, avvoActiveItem, avvoFeedbackStates, avvoTextbox );
20.779221
54
0.68
312cf579273dce748ed7133b1c62ec73b222fceb
166
js
JavaScript
src/graphics/index.js
thehootengine/HootEngine
7eed6c7f277619b9eb5fbee3e58a18e648797171
[ "MIT" ]
null
null
null
src/graphics/index.js
thehootengine/HootEngine
7eed6c7f277619b9eb5fbee3e58a18e648797171
[ "MIT" ]
null
null
null
src/graphics/index.js
thehootengine/HootEngine
7eed6c7f277619b9eb5fbee3e58a18e648797171
[ "MIT" ]
null
null
null
/** @author Patrick Carroll **/ /** * @namespace Hoot.Graphics */ const Graphics = { Display: require("./Display.js") }; //Export module.exports = Graphics;
12.769231
36
0.626506
312d19d83da72224e27fb2be8ada50f5bfcccc6c
300
js
JavaScript
src/utils/external-url-prop-type.js
pmknk/ThriveGlobal-code-challenge
fcee70066ecf38611508427d255a7103f5f8f479
[ "RSA-MD" ]
null
null
null
src/utils/external-url-prop-type.js
pmknk/ThriveGlobal-code-challenge
fcee70066ecf38611508427d255a7103f5f8f479
[ "RSA-MD" ]
null
null
null
src/utils/external-url-prop-type.js
pmknk/ThriveGlobal-code-challenge
fcee70066ecf38611508427d255a7103f5f8f479
[ "RSA-MD" ]
null
null
null
const externalUrlPropType = (props, propName, componentName) => { const regex = /^(https?|http):\/\/[^\s$.?#].[^\s]*$/gm if (!regex.test(props[propName])) { return new Error(`Invalid prop ${propName} supplied to ${componentName}. Validation failed`) } } export default externalUrlPropType
33.333333
96
0.67
312d903d769f42826ccfeec3f77841852d1cf1d1
167
js
JavaScript
package/es/regexer/chinese.js
hjqcl316602/app-trade-admin
5d9403201e9392139c9e2b14f8ceacaf716a4456
[ "MIT" ]
1
2020-11-22T12:54:22.000Z
2020-11-22T12:54:22.000Z
package/es/regexer/chinese.js
hjqcl316602/app-trade
1f52013eace529f95568cdae8a57cb39746c9ab4
[ "MIT" ]
null
null
null
package/es/regexer/chinese.js
hjqcl316602/app-trade
1f52013eace529f95568cdae8a57cb39746c9ab4
[ "MIT" ]
null
null
null
export default { type: "chinese", rules: ["只能由中文汉字组成的非空字符串"], text: "是否是中文", success: ["一二三"], error: ["123456", "qazxsw"], value: /^[\u4E00-\u9FA5]+$/ };
18.555556
30
0.568862
312dda687383efb823f4fb240625eb00b4fc02fc
284
js
JavaScript
cypress/locators/textarea/index.js
blaky/carbon
57f4a9c9c8b919ff0eb1ad5380a402017bdcd56f
[ "Apache-2.0" ]
229
2017-05-18T14:24:01.000Z
2022-03-31T23:30:53.000Z
cypress/locators/textarea/index.js
blaky/carbon
57f4a9c9c8b919ff0eb1ad5380a402017bdcd56f
[ "Apache-2.0" ]
3,060
2017-05-19T01:09:37.000Z
2022-03-31T15:55:19.000Z
cypress/locators/textarea/index.js
blaky/carbon
57f4a9c9c8b919ff0eb1ad5380a402017bdcd56f
[ "Apache-2.0" ]
92
2017-05-18T11:57:17.000Z
2022-03-07T19:45:35.000Z
import { TEXTAREA, CHARACTER_LIMIT } from "./locators"; // component preview locators export const textarea = () => cy.get(TEXTAREA); export const textareaChildren = () => cy.get(TEXTAREA).find("textarea"); export const characterLimitDefaultTextarea = () => cy.get(CHARACTER_LIMIT);
40.571429
75
0.735915
312e203c7d40d5ee0dede32b2d86edab2833dbf6
1,237
js
JavaScript
study/node/chapter05/example/p176.js
Jiyong-GAL/NodeShopping
b284878c13e0d64bbb9e304363065179cbdbcd16
[ "MIT" ]
2
2019-02-10T07:24:34.000Z
2019-02-10T07:24:39.000Z
study/node/chapter05/example/p176.js
Jiyong-GAL/NodeShopping
b284878c13e0d64bbb9e304363065179cbdbcd16
[ "MIT" ]
6
2019-01-09T04:51:48.000Z
2019-02-07T09:31:33.000Z
study/node/chapter05/example/p176.js
Jiyong-GAL/NodeShopping
b284878c13e0d64bbb9e304363065179cbdbcd16
[ "MIT" ]
1
2019-01-16T06:38:30.000Z
2019-01-16T06:38:30.000Z
/* p.176 express-error-handler 미들웨어로 오류 페이지 보내기 npm install express-error-handler --save */ var express = require('express') , path = require('path'); var bodyParser = require('body-parser') ,static = require('serve-static'); var app = express(); app.set('port', process.env.PORT || 4030); app.use(bodyParser.urlencoded({extended:false})); app.use(bodyParser.json()); app.use(static(path.join(__dirname, 'public'))); var server = app.listen(app.get('port'),function(){ console.log("★★★ Server Started ... port >>>",app.get('port')," ★★★"); }); var router = express.Router(); router.route('/process/login',static(path.join(__dirname, 'public'))).post(function(req,res){ console.log('/process/login'); var paramId = req.body.inId; var paramPw = req.body.inPw; console.log('id >> ', paramId +'\npw >> ', paramPw); res.writeHead('200',{'Content-Type':'text/html; charset=utf8'}); res.write(paramId+'님 로그인 완료되었습니다.'); res.end(); }); app.use('/',router); var expressErrorHandler = require('express-error-handler'); var errorHandler = expressErrorHandler({ static : { '404' : './error/404.html' } }); app.use(expressErrorHandler.httpError(404)); app.use(errorHandler);
26.891304
93
0.648343
312e2853c3107b9facc98bf16e2b5f69d5e4191a
454
js
JavaScript
src/api/records/controllers/getAll.js
WildCodeSchool/btz-0321-aeviso-api
20e6fe3a89a52077d87907329425879c77dcad83
[ "MIT" ]
1
2021-07-23T20:19:02.000Z
2021-07-23T20:19:02.000Z
src/api/records/controllers/getAll.js
JIdayyy/btz-0321-aeviso-api
cea4341606da961d4661adbf5aaf5ed9035318df
[ "MIT" ]
20
2021-05-28T10:28:07.000Z
2021-07-19T10:32:02.000Z
src/api/records/controllers/getAll.js
JIdayyy/btz-0321-aeviso-api
cea4341606da961d4661adbf5aaf5ed9035318df
[ "MIT" ]
3
2021-07-23T20:18:51.000Z
2021-12-19T11:21:00.000Z
const prisma = require("../../../../prismaClient"); /** * GET /api/v1/records * @summary View all records * @tags records * @return {array<DisplayRecordr>} 200 - Record list successfully retrieved */ module.exports = async (req, res, next) => { const limit = +req.query.limit; try { const records = await prisma.record.findMany({ take: limit || undefined }); res.status(200).json(records); } catch (error) { next(error); } };
22.7
79
0.632159
312e6a4c966097674143cca7f0915e005f27c176
6,452
js
JavaScript
index.js
clio-one/cardano-metrics
a834161da420ce19c187413a8e392bc82e27a9d4
[ "MIT" ]
null
null
null
index.js
clio-one/cardano-metrics
a834161da420ce19c187413a8e392bc82e27a9d4
[ "MIT" ]
null
null
null
index.js
clio-one/cardano-metrics
a834161da420ce19c187413a8e392bc82e27a9d4
[ "MIT" ]
null
null
null
import GSTC from '/blocklog/timeline/dist/gstc.esm.min.js'; import { Plugin as CalendarScroll } from '/blocklog/timeline/dist/plugins/calendar-scroll.esm.min.js'; import { Plugin as DependencyLines } from '/blocklog/timeline/dist/plugins/dependency-lines.esm.min.js'; //import { Plugin as TimeBookmarks } from '/blocklog/timeline/dist/plugins/time-bookmarks.esm.min.js'; const colors = ['rgba(150, 150, 150, 0.2)', '#e17d63', '#77576b', '#555d74']; var response = await fetch('https://api.clio.one/blocklog/v1/fetch/index-dev.asp'); var data = await response.json(); console.log(data); async function refreshData() { response = await fetch('https://api.clio.one/blocklog/v1/fetch/'); data = await response.json(); console.log(data); console.log(data.base.fromISO); console.log(data.base.toISO); state.update('config.chart.items', {}); state.update('config.list.rows', {} ); //state.update('config.chart.time.from', GSTC.api.date(data.base.fromISO).valueOf()); state.update('config.chart.time.from', GSTC.api.date('2022-02-03 15:31:00').valueOf() ); //state.update('config.chart.time.to', GSTC.api.date(data.base.toISO).valueOf()); state.update('config.chart.time.to', GSTC.api.date('2022-02-03 15:36:00').valueOf()); /*state.update('config.chart.time', (time) => { time.from = GSTC.api.date('2022-02-03T14:27:00').valueOf(); //time.from = GSTC.api.date(data.base.fromISO).valueOf(); time.to = GSTC.api.date('2022-02-03T14:32:00').valueOf(); //time.to = GSTC.api.date(data.base.toISO).valueOf(); }); */ state.update('config.list.rows', GSTC.api.fromArray(data.nodes)); state.update('config.chart.items', GSTC.api.fromArray(data.blocks)); } const columnsFromDB = [ { id: 'id', label: 'ID', data: ({ row }) => Number(GSTC.api.sourceID(row.id)), // show original id sortable: ({ row }) => Number(GSTC.api.sourceID(row.id)), // sort by id converted to number width: 60, header: { content: 'ID', }, }, { id: 'label', data: 'label', sortable: 'label', isHTML: false, width: 120, header: { content: 'Node', }, }, { id: 'continent', data: 'continent', sortable: 'continent', isHTML: false, width: 40, header: { content: 'Cnt', }, }, { id: 'country', data: 'country', sortable: 'country', isHTML: false, width: 40, header: { content: 'Nat', }, }, ]; const days = [ { zoomTo: 100, // we want to display this format for all zoom levels until ... period: 'second', periodIncrement: 1, main: true, format({ timeStart }) { return timeStart.format('D-MMM '); }, }, ]; const seconds = [ { zoomTo: 100, // we want to display this format for all zoom levels until 100 period: 'second', periodIncrement: 1, format({ timeStart }) { return timeStart.format('HH:mm:ss'); }, }, ]; const slots = [ { zoomTo: 100, // we want to display this format for all zoom levels until 100 period: 'second', periodIncrement: 1, format({ timeStart }) { return GSTC.api.date(timeStart).valueOf()/1000 - 1591566291; }, }, ]; let gstc, state; function setTippyContent(element, data) { if (!gstc) return; if ((!data || !data.item) && element._tippy) return element._tippy.destroy(); const itemData = gstc.api.getItemData(data.item.id); if (!itemData) return element._tippy.destroy(); if (itemData.detached && element._tippy) return element._tippy.destroy(); // @ts-ignore if (!itemData.detached && !element._tippy) tippy(element, { trigger: 'click' }); if (!element._tippy) return; const startDate = itemData.time.startDate; const endDate = itemData.time.endDate; const deltaDate = itemData.time.endDate - itemData.time.startDate + 1 const tooltipContent = `${data.item.tlabel} in ${deltaDate}ms at ${endDate.format('mm:ss.SSS')} `; //const tooltipContent = `${data.item.tlabel} at ${startDate} `; //element._tippy.class.theme="material"; element._tippy.setContent(tooltipContent); } function itemTippy(element, data) { setTippyContent(element, data); return { update(element, data) { if (element._tippy) element._tippy.destroy(); setTippyContent(element, data); }, destroy(element, data) { if (element._tippy) element._tippy.destroy(); }, }; } // Configuration object const config = { licenseKey: '====BEGIN LICENSE KEY====\njuLIeUh7NgbfZ0486F7OqEw6uET58kJvlJSrXJALAJTUYVfEe79LrPeKTGjiYKVbadZraiJTuKwKhkZtnEenlAWCZTz0RBOVn34nE9B96R7YYf6UI3Sznb7ln0U4clVPGr4a9j7zK/R+Bn1ZksVAk0iySVoFVxmdimUh3HVLwsJhEy9LguCvFDtsArVyH4xalZuWe3lJ6Q4bs0nOPFW/6HBr4vmgCWHCmMT5P6nZyNCERU0OrHtflZM8qym9uiieLCIUI8to9MU7ZvBMlnWmc3RkAIC3ZcNk3VlQ0+sPLhKkd9+cgCCq6F0gIIBMou0Ud9ziwhP3X1JiVzoVZMTcFw==||U2FsdGVkX1+CNjx/qcFd0QLOe0tufoQlxo4QCvh94Meti/aLbuWesxxlE5xezMXS7zl1pmfk7AhlEsl+zFUCH4WJ9Gjw0sJ/yugFBJ35gLo=\nnRYzTFtKS8HiUJZGEXA967WZ12G48byJzO8w3KwT9rZWYvzVr1TQqxTJeF5WbUZr8t4rh9+9Nq/jErA2LJ/+j7/p46FOqmkt7xFutm68v3GMHN/pdDY9FvPA/fi2cRkK86KBXW8pbZxiLtY6H/vohMwKtN2rSXmXUXB5YYVah/y7tZBnh0nL9Pqd0JV5MPn8cE+bYD3s+t1ecJWqlGGndGirw5CMhyvHsu6NSCrIBz8kzEdNkUQEO8DkfDhZjJyMhZFkeEzuid5jDoHlbPwNsop1DeTG3AbiEN2hEgS3xThq4ncrinKGsrZXzxtyZDMluV4dp+2Scko3wVb9/2GI5w==\n====END LICENSE KEY====', innerHeight: 600, plugins: [ CalendarScroll(), //TimeBookmarks(GSTC.api.fromArray(data.blocks)), ], list: { columns: { data: GSTC.api.fromArray(columnsFromDB), }, rows: GSTC.api.fromArray(data.nodes), }, chart: { item: { minWidth: 1, overlap: true }, items: GSTC.api.fromArray(data.timestamps), calendarLevels: [days, seconds, slots], time: { zoom: 3, period: 'second', }, }, actions: { 'chart-timeline-items-row-item': [itemTippy], }, }; // Generate GSTC state from configuration object state = GSTC.api.stateFromConfig(config); // for testing //globalThis.state = state; const el = document.getElementById('gstc'); el.classList.add('gstc--dark'); document.body.classList.add('gstc--dark'); // Mount the component gstc = GSTC({ element: document.getElementById('gstc'), state, }); globalThis.gstc = gstc; globalThis.state = state; document.getElementById('zoom').addEventListener('input', (ev) => { const value = ev.target.value; state.update('config.chart.time.zoom', value); }); //document.getElementById('refresh').addEventListener('click', (ev) => { // refreshData(); //});
31.169082
859
0.682889
312f7dceb97775222c770467943eb1d41df02c2a
16,054
js
JavaScript
dist/server/pages/_app.js
omni-door/site
d9bdeac6d3d416ea2a04a39755489b13d7a4f4cb
[ "MIT" ]
null
null
null
dist/server/pages/_app.js
omni-door/site
d9bdeac6d3d416ea2a04a39755489b13d7a4f4cb
[ "MIT" ]
9
2020-11-27T16:32:40.000Z
2022-02-13T19:22:26.000Z
dist/server/pages/_app.js
omni-door/site
d9bdeac6d3d416ea2a04a39755489b13d7a4f4cb
[ "MIT" ]
null
null
null
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = require('../ssr-module-cache.js'); /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ threw = false; /******/ } finally { /******/ if(threw) delete installedModules[moduleId]; /******/ } /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__("cha2"); /***/ }), /***/ "Ea3V": /***/ (function(module, exports) { module.exports = { "hide": "hide___1HqNW", "hidden": "hidden___1N6-4", "speed": "speed___301xU" }; /***/ }), /***/ "cDcd": /***/ (function(module, exports) { module.exports = require("react"); /***/ }), /***/ "cha2": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _ctx_UseLocale__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("y63i"); /* harmony import */ var _src_styles_globals_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Ea3V"); /* harmony import */ var _src_styles_globals_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_src_styles_globals_css__WEBPACK_IMPORTED_MODULE_2__); var __jsx = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement; function MyApp({ Component, pageProps }) { var _pageProps$query; return __jsx(_ctx_UseLocale__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"], { lang: pageProps === null || pageProps === void 0 ? void 0 : (_pageProps$query = pageProps.query) === null || _pageProps$query === void 0 ? void 0 : _pageProps$query.lang }, __jsx(Component, pageProps)); } /* harmony default export */ __webpack_exports__["default"] = (MyApp); /***/ }), /***/ "y63i": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ UseLocale; }); // UNUSED EXPORTS: UseLocaleProvider // EXTERNAL MODULE: external "react" var external_react_ = __webpack_require__("cDcd"); var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_); // CONCATENATED MODULE: ./src/locales/cn.ts const locale = { global: { logo: '任意门', start: '开始', docs: '文档', lang: 'English' }, home: { pageTitle: '任意门', title: '任意门', subtitle: '你的项目想去哪里?不妨让任意门帮你!', description: `为前端项目的创建、开发、构建、发布提供一条龙服务。 支持基于 React和Vue 的单页应用(SPA)、服务端渲染应用(SSR)、组件库、类lodash工具集等多种前端常见项目。 `, btn_start: '开始使用', btn_docs: '文档', license: 'MIT', why: [{ title: '各种轮子随你挑', subtitle: '一行命令即可构建一个完整的前端项目工程', intro: `集成typescript; 可无缝对接 ESlint、Prettier、Stylelint、Commitlint 等各种 lint 工具, 更可以接入单元测试 `, route: { page: 'start', params: { lang: 'cn' } } }, { title: 'React单页应用', subtitle: '基于 React 和 React-Router 的 SPA 项目', intro: `SPA(Single-Application-App) 单页应用是现在的前端开发者使用频率最高的一种项目模式, 无论是适配于移动端的H5,还是服务于中后台的PC项目,都很好的满足了开发周期短、成本低、 项目结构简单、前后端分离等需求… `, route: { page: 'docs', params: { lang: 'cn', article: 'spa-react' } } }, { title: 'Vue单页应用', subtitle: '基于 Vue3 和 Vue-Router 的 SPA 项目', intro: `SPA(Single-Application-App) 单页应用是现在的前端开发者使用频率最高的一种项目模式, 无论是适配于移动端的H5,还是服务于中后台的PC项目,都很好的满足了开发周期短、成本低、 项目结构简单、前后端分离等需求… `, route: { page: 'docs', params: { lang: 'cn', article: 'spa-vue' } } }, { title: 'React服务端渲染应用', subtitle: '基于 React 和 NextJs 的 SSR 项目', intro: `基于 React + NextJs 的 SSR(Server-Side-Render) 服务端渲染应用解决了 SEO 和前后端分离的问题, 同时相比于 SPA 应用,也能有效的降低白屏时间, 无论是 PC 官网 还是 M 站,都是一个很好的选择… `, route: { page: 'docs', params: { lang: 'cn', article: 'ssr-react' } } }, { title: 'React组件库', subtitle: '基于 React 的组件库项目', intro: `一套属于自己团队或公司内部使用的组件库,几乎是每个公司前端团队的标配; 借助社区开源的组件库 Demo-UI 框架,如 docz、storybook、styleguidist 等, 让组件库的开发不再是遥不可及的技术难题… `, route: { page: 'docs', params: { lang: 'cn', article: 'component-react' } } }, { title: 'Vue组件库', subtitle: '基于 Vue 的组件库项目', intro: `一套属于自己团队或公司内部使用的组件库,几乎是每个公司前端团队的标配; 借助社区开源的组件库 storybook 框架, 让组件库的开发不再是遥不可及的技术难题… `, route: { page: 'docs', params: { lang: 'cn', article: 'component-vue' } } }, { title: '工具库', subtitle: '类lodash、ramda工具库', intro: '纯逻辑组件?耦合了业务需求的功能模块?不想耦合任何 UI 框架 —— 工具库项目很可能是你需要的…', route: { page: 'docs', params: { lang: 'cn', article: 'toolkit' } } }], demo: [] }, docs: { pageTitle: '任意门 - 文档' }, start: { pageTitle: '任意门 - 开始使用' } }; /* harmony default export */ var cn = (locale); // CONCATENATED MODULE: ./src/locales/en.ts const en_locale = { global: { logo: 'Omni-Door', start: 'Start', docs: 'Docs', lang: '中文' }, home: { pageTitle: 'Omni-Door', title: 'Omni-Door', subtitle: 'What your project do? Leave it to Omni-Door!', description: `Provide front-end projects from the initialization, development, construction, release and other one-stop services. It supports many front-end projects such as single page application (SPA), server-side rendering application (SSR), component library, lodash like toolset, etc.`, btn_start: 'Getting Started', btn_docs: 'Documentation', license: 'MIT', why: [{ title: 'Many kinds of wheels are up to you', subtitle: 'A complete front-end project project can be built in one line of command', intro: `Integrating typescript; Seamless docking of eslint, prettier, stylelint, commitlint, It can also access unit-test `, route: { page: 'start', params: { lang: 'en' } } }, { title: 'React-SPA', subtitle: 'The SPA project based on react and react-router', intro: `SPA(Single-Application-App) is the most frequently used project mode by front-end developers, Whether it is the H5 suitable for mobile terminal or the PC project serving for the middle and back office, it can meet the requirements of short development cycle, low cost, and low cost Project structure is simple, front and back end separation and other requirements… `, route: { page: 'docs', params: { lang: 'en', article: 'spa-react' } } }, { title: 'Vue-SPA', subtitle: 'The SPA project based on vue and vue-router', intro: `SPA(Single-Application-App) is the most frequently used project mode by front-end developers, Whether it is the H5 suitable for mobile terminal or the PC project serving for the middle and back office, it can meet the requirements of short development cycle, low cost, and low cost Project structure is simple, front and back end separation and other requirements… `, route: { page: 'docs', params: { lang: 'en', article: 'spa-vue' } } }, { title: 'React-SSR', subtitle: 'The SSR project based on react and nextjs', intro: `SSR (server side render) server-side rendering application based on react + nextjs solves the problem of separation of SEO and front-end, At the same time, compared with spa application, it can also effectively reduce the white screen time, Whether it is PC official website or m station, it is a good choice… `, route: { page: 'docs', params: { lang: 'en', article: 'ssr-react' } } }, { title: 'React-Component', subtitle: 'Component library project based on React', intro: `A set of component libraries for their own team or internal use is almost the standard configuration for front-end teams of each company; With the help of community open source component library demo UI framework, such as docz, storybook, styleguidist, etc, The development of component library is no longer a distant technical problem… `, route: { page: 'docs', params: { lang: 'en', article: 'component-react' } } }, { title: 'Vue-Component', subtitle: 'Component library project based on Vue', intro: `A set of component libraries for their own team or internal use is almost the standard configuration for front-end teams of each company; With the help of storybook which is community open source component library framework, The development of component library is no longer a distant technical problem… `, route: { page: 'docs', params: { lang: 'en', article: 'component-vue' } } }, { title: 'toolkit', subtitle: 'The tool library same as lodash or ramda', intro: `Pure logic component? Function modules coupled with business requirements? You don't want to couple any UI Frameworks - the tool library project is probably what you need…`, route: { page: 'docs', params: { lang: 'en', article: 'toolkit' } } }], demo: [] }, docs: { pageTitle: 'Omni-Door - Docs' }, start: { pageTitle: 'Omni-Door - Start' } }; /* harmony default export */ var en = (en_locale); // CONCATENATED MODULE: ./src/context/UseLocale.tsx var __jsx = external_react_default.a.createElement; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } const locales = { cn: cn, en: en }; const initLang = 'cn'; const ctxInitState = { lang: initLang, locale: locales[initLang], setLang: lang => console.warn('初始化未完成') }; const UseLocale = /*#__PURE__*/Object(external_react_["createContext"])(ctxInitState); const UseLocaleProvider = props => { var _props$lang, _locales; const setLang = Object(external_react_["useCallback"])(function (lang) { let locale = locales[lang]; if (!locale) { locale = ctxInitState.locale; lang = ctxInitState.lang; } setState(states => _objectSpread(_objectSpread({}, states), {}, { locale, lang })); }, []); const initState = { lang: (_props$lang = props === null || props === void 0 ? void 0 : props.lang) !== null && _props$lang !== void 0 ? _props$lang : ctxInitState.lang, locale: (_locales = locales[props === null || props === void 0 ? void 0 : props.lang]) !== null && _locales !== void 0 ? _locales : ctxInitState.locale, setLang }; const { 0: state, 1: setState } = Object(external_react_["useState"])(initState); return __jsx(UseLocale.Provider, { value: state }, props.children); }; /* harmony default export */ var context_UseLocale = __webpack_exports__["b"] = (UseLocaleProvider); /***/ }) /******/ });
34.230277
534
0.600723
312fc4aed0ffae229f911df31d3e86fbb299eaaa
885
js
JavaScript
spec/GeneratingPillarsSpec.js
pseale/ascii-birds
7adf0d232276e4c81e09b2579d18a2666e3296f2
[ "MIT" ]
1
2015-02-04T15:29:04.000Z
2015-02-04T15:29:04.000Z
spec/GeneratingPillarsSpec.js
pseale/ascii-birds
7adf0d232276e4c81e09b2579d18a2666e3296f2
[ "MIT" ]
null
null
null
spec/GeneratingPillarsSpec.js
pseale/ascii-birds
7adf0d232276e4c81e09b2579d18a2666e3296f2
[ "MIT" ]
null
null
null
"use strict"; describe("Generating pillars", function() { var pillarGenerator = {}; beforeEach(function() { pillarGenerator = new PillarGenerator(); }); it("generates the first pillar between position 7 and 10", function() { var pillar = pillarGenerator.next(true); expect(pillar.offset >= 7 && pillar.offset <= 10 ).toBeTruthy(); }); it("generates subsequent pillars from 7 to 10 columns away", function() { var firstPillar = pillarGenerator.next(true); var secondPillar = pillarGenerator.next(true); var offset = secondPillar.offset - firstPillar.offset; expect(offset >= 7 && offset <= 10).toBeTruthy(); }); it("generates pillars from 2 to 4 rows high", function() { var pillar = pillarGenerator.next(true); var height = pillar.highestRow - pillar.lowestRow + 1; expect(height >= 2 && height <= 4).toBeTruthy(); }); });
32.777778
75
0.667797
312fd8c5e38b8f3cd50b6f6ad681effcb0696d64
3,998
js
JavaScript
src/actions/auth.js
abhi40308/xtraclass-react
4917432ea81337ca0c043f71db17c2d653720e4c
[ "MIT" ]
null
null
null
src/actions/auth.js
abhi40308/xtraclass-react
4917432ea81337ca0c043f71db17c2d653720e4c
[ "MIT" ]
null
null
null
src/actions/auth.js
abhi40308/xtraclass-react
4917432ea81337ca0c043f71db17c2d653720e4c
[ "MIT" ]
null
null
null
import firebase from '../firebase/firebase'; export const LOGIN_REQUEST = 'LOGIN_REQUEST'; export const LOGIN_SUCCESS = 'LOGIN_SUCCESS'; export const LOGIN_FAILURE = 'LOGIN_FAILURE'; export const SIGNUP_REQUEST = 'SIGNUP_REQUEST'; export const SIGNUP_SUCCESS = 'SIGNUP_SUCCESS'; export const SIGNUP_FAILURE = 'SIGNUP_FAILURE'; export const GOOGLE_LOGIN_REQUEST = 'GOOGLE_LOGIN_REQUEST'; export const GOOGLE_LOGIN_SUCCESS = 'GOOGLE_LOGIN_SUCCESS'; export const GOOGLE_LOGIN_FAILURE = 'GOOGLE_LOGIN_FAILURE'; export const LOGOUT_REQUEST = 'LOGOUT_REQUEST'; export const LOGOUT_SUCCESS = 'LOGOUT_SUCCESS'; export const LOGOUT_FAILURE = 'LOGOUT_FAILURE'; export const VERIFY_REQUEST = 'VERIFY_REQUEST'; export const VERIFY_SUCCESS = 'VERIFY_SUCCESS'; // email and password login const requestLogin = () => { return { type: LOGIN_REQUEST, }; }; const receiveLogin = (user) => { return { type: LOGIN_SUCCESS, user, }; }; const loginError = () => { return { type: LOGIN_FAILURE, }; }; // email and password signup const requestSignup = () => { return { type: SIGNUP_REQUEST, }; }; const receiveSignup = (user) => { return { type: SIGNUP_SUCCESS, user, }; }; const signupError = (error) => { return { type: SIGNUP_FAILURE, error, }; }; // google login/signup const requestGoogleLogin = () => { return { type: LOGIN_REQUEST, }; }; const receiveGoogleLogin = (user) => { return { type: LOGIN_SUCCESS, user, }; }; const googleLoginError = () => { return { type: LOGIN_FAILURE, }; }; // logout const requestLogout = () => { return { type: LOGOUT_REQUEST, }; }; const receiveLogout = () => { return { type: LOGOUT_SUCCESS, }; }; const logoutError = () => { return { type: LOGOUT_FAILURE, }; }; // verify request const verifyRequest = () => { return { type: VERIFY_REQUEST, }; }; const verifySuccess = () => { return { type: VERIFY_SUCCESS, }; }; export const loginUser = (email, password) => (dispatch) => { dispatch(requestLogin()); firebase .auth() .signInWithEmailAndPassword(email, password) .then((user) => { dispatch(receiveLogin(user)); }) .catch((error) => { //Do something with the error if you want! dispatch(loginError()); }); }; export const logoutUser = () => (dispatch) => { dispatch(requestLogout()); firebase .auth() .signOut() .then(() => { dispatch(receiveLogout()); }) .catch((error) => { //Do something with the error if you want! dispatch(logoutError()); }); }; export const signupUser = (email, password) => (dispatch) => { dispatch(requestSignup()); firebase .auth() .createUserWithEmailAndPassword(email, password) .then((user) => { dispatch(receiveSignup(user)); }) .catch((error) => { //Do something with the error if you want! dispatch(signupError(error)); }); }; export const verifyAuth = () => (dispatch) => { dispatch(verifyRequest()); firebase.auth().onAuthStateChanged((user) => { if (user !== null) { dispatch(receiveLogin(user)); } dispatch(verifySuccess()); }); }; export const googleLogin = () => (dispatch) => { let provider = new firebase.auth.GoogleAuthProvider(); firebase .auth() .signInWithPopup(provider) .then((result) => { /** @type {firebase.auth.OAuthCredential} */ var credential = result.credential; // This gives you a Google Access Token. You can use it to access the Google API. var token = credential.accessToken; // The signed-in user info. var user = result.user; }) .catch((error) => { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; }); };
21.042105
87
0.630815
31301f9de7b8b93520e285b8d996da4c3948b06f
1,514
js
JavaScript
web-apis/amadeus-web-api/javascript/amadeus.js
StuartDavies/school-of-code
75c136567c15fd90cc32f251845967abaf46cd1e
[ "MIT" ]
null
null
null
web-apis/amadeus-web-api/javascript/amadeus.js
StuartDavies/school-of-code
75c136567c15fd90cc32f251845967abaf46cd1e
[ "MIT" ]
null
null
null
web-apis/amadeus-web-api/javascript/amadeus.js
StuartDavies/school-of-code
75c136567c15fd90cc32f251845967abaf46cd1e
[ "MIT" ]
null
null
null
async function fetchData() { // get an access token from the server let accessToken = await getAccessToken(); // use the access token returned from the previous call to invoke a web api // that returns data relating to activities for a given location const response = await fetch('https://test.api.amadeus.com/v1//shopping/activities?latitude=41.397158&longitude=2.160873', { method: 'GET', headers: { 'Authorization': `Bearer ${accessToken}` } }); let responseData = await response.json(); // we'll build a list inside our data div, and create a list entry // with the name of each activity returned from the web api let dataDiv = document.querySelector('#data'); let ul = document.createElement('ul'); dataDiv.appendChild(ul); responseData.data.forEach(activity => { var li = document.createElement('li'); ul.appendChild(li); li.innerText = activity.name; }); } async function getAccessToken() { const response = await fetch('https://test.api.amadeus.com/v1/security/oauth2/token', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, body: 'grant_type=client_credentials&client_id=NNMUqrWJUOiEKYdIDzjKyBBMDfa5kXc0&client_secret=pbPaHJSAOT5z7SAU' }); let responseData = await response.json(); return responseData.access_token; }
33.644444
129
0.640687