/*! * materialize v0.100.2 (http://materializecss.com) * copyright 2014-2017 materialize * mit license (https://raw.githubusercontent.com/dogfalo/materialize/master/license) */ var _createclass = 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); } } return function (constructor, protoprops, staticprops) { if (protoprops) defineproperties(constructor.prototype, protoprops); if (staticprops) defineproperties(constructor, staticprops); return constructor; }; }(); function _classcallcheck(instance, constructor) { if (!(instance instanceof constructor)) { throw new typeerror("cannot call a class as a function"); } } // check for jquery. if (typeof jquery === 'undefined') { // check if require is a defined function. if (typeof require === 'function') { jquery = $ = require('jquery'); // else use the dollar sign alias. } else { jquery = $; } } ; /* * jquery easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/ * open source under the bsd license. * copyright © 2008 george mcginley smith * all rights reserved. * https://raw.github.com/gdsmith/jquery-easing/master/license */ (function (factory) { if (typeof define === "function" && define.amd) { define(['jquery'], function ($) { return factory($); }); } else if (typeof module === "object" && typeof module.exports === "object") { exports = factory(require('jquery')); } else { factory(jquery); } })(function ($) { // preserve the original jquery "swing" easing as "jswing" $.easing['jswing'] = $.easing['swing']; var pow = math.pow, sqrt = math.sqrt, sin = math.sin, cos = math.cos, pi = math.pi, c1 = 1.70158, c2 = c1 * 1.525, c3 = c1 + 1, c4 = 2 * pi / 3, c5 = 2 * pi / 4.5; // x is the fraction of animation progress, in the range 0..1 function bounceout(x) { var n1 = 7.5625, d1 = 2.75; if (x < 1 / d1) { return n1 * x * x; } else if (x < 2 / d1) { return n1 * (x -= 1.5 / d1) * x + .75; } else if (x < 2.5 / d1) { return n1 * (x -= 2.25 / d1) * x + .9375; } else { return n1 * (x -= 2.625 / d1) * x + .984375; } } $.extend($.easing, { def: 'easeoutquad', swing: function (x) { return $.easing[$.easing.def](x); }, easeinquad: function (x) { return x * x; }, easeoutquad: function (x) { return 1 - (1 - x) * (1 - x); }, easeinoutquad: function (x) { return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2; }, easeincubic: function (x) { return x * x * x; }, easeoutcubic: function (x) { return 1 - pow(1 - x, 3); }, easeinoutcubic: function (x) { return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2; }, easeinquart: function (x) { return x * x * x * x; }, easeoutquart: function (x) { return 1 - pow(1 - x, 4); }, easeinoutquart: function (x) { return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2; }, easeinquint: function (x) { return x * x * x * x * x; }, easeoutquint: function (x) { return 1 - pow(1 - x, 5); }, easeinoutquint: function (x) { return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2; }, easeinsine: function (x) { return 1 - cos(x * pi / 2); }, easeoutsine: function (x) { return sin(x * pi / 2); }, easeinoutsine: function (x) { return -(cos(pi * x) - 1) / 2; }, easeinexpo: function (x) { return x === 0 ? 0 : pow(2, 10 * x - 10); }, easeoutexpo: function (x) { return x === 1 ? 1 : 1 - pow(2, -10 * x); }, easeinoutexpo: function (x) { return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2; }, easeincirc: function (x) { return 1 - sqrt(1 - pow(x, 2)); }, easeoutcirc: function (x) { return sqrt(1 - pow(x - 1, 2)); }, easeinoutcirc: function (x) { return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2; }, easeinelastic: function (x) { return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4); }, easeoutelastic: function (x) { return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1; }, easeinoutelastic: function (x) { return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1; }, easeinback: function (x) { return c3 * x * x * x - c1 * x * x; }, easeoutback: function (x) { return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2); }, easeinoutback: function (x) { return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2; }, easeinbounce: function (x) { return 1 - bounceout(1 - x); }, easeoutbounce: bounceout, easeinoutbounce: function (x) { return x < 0.5 ? (1 - bounceout(1 - 2 * x)) / 2 : (1 + bounceout(2 * x - 1)) / 2; } }); });; // custom easing jquery.extend(jquery.easing, { easeinoutmaterial: function (x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t + b; return c / 4 * ((t -= 2) * t * t + 2) + b; } });; /*! velocityjs.org (1.2.3). (c) 2014 julian shapiro. mit @license: en.wikipedia.org/wiki/mit_license */ /*! velocityjs.org jquery shim (1.0.1). (c) 2014 the jquery foundation. mit @license: en.wikipedia.org/wiki/mit_license. */ /*! note that this has been modified by materialize to confirm that velocity is not already being imported. */ jquery.velocity ? console.log("velocity is already loaded. you may be needlessly importing velocity again; note that materialize includes velocity.") : (!function (e) { function t(e) { var t = e.length, a = r.type(e);return "function" === a || r.iswindow(e) ? !1 : 1 === e.nodetype && t ? !0 : "array" === a || 0 === t || "number" == typeof t && t > 0 && t - 1 in e; }if (!e.jquery) { var r = function (e, t) { return new r.fn.init(e, t); };r.iswindow = function (e) { return null != e && e == e.window; }, r.type = function (e) { return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e; }, r.isarray = array.isarray || function (e) { return "array" === r.type(e); }, r.isplainobject = function (e) { var t;if (!e || "object" !== r.type(e) || e.nodetype || r.iswindow(e)) return !1;try { if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isprototypeof")) return !1; } catch (a) { return !1; }for (t in e) {}return void 0 === t || o.call(e, t); }, r.each = function (e, r, a) { var n, o = 0, i = e.length, s = t(e);if (a) { if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) {} else for (o in e) { if (n = r.apply(e[o], a), n === !1) break; } } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) {} else for (o in e) { if (n = r.call(e[o], o, e[o]), n === !1) break; }return e; }, r.data = function (e, t, n) { if (void 0 === n) { var o = e[r.expando], i = o && a[o];if (void 0 === t) return i;if (i && t in i) return i[t]; } else if (void 0 !== t) { var o = e[r.expando] || (e[r.expando] = ++r.uuid);return a[o] = a[o] || {}, a[o][t] = n, n; } }, r.removedata = function (e, t) { var n = e[r.expando], o = n && a[n];o && r.each(t, function (e, t) { delete o[t]; }); }, r.extend = function () { var e, t, a, n, o, i, s = arguments[0] || {}, l = 1, u = arguments.length, c = !1;for ("boolean" == typeof s && (c = s, s = arguments[l] || {}, l++), "object" != typeof s && "function" !== r.type(s) && (s = {}), l === u && (s = this, l--); u > l; l++) { if (null != (o = arguments[l])) for (n in o) { e = s[n], a = o[n], s !== a && (c && a && (r.isplainobject(a) || (t = r.isarray(a))) ? (t ? (t = !1, i = e && r.isarray(e) ? e : []) : i = e && r.isplainobject(e) ? e : {}, s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a)); } }return s; }, r.queue = function (e, a, n) { function o(e, r) { var a = r || [];return null != e && (t(object(e)) ? !function (e, t) { for (var r = +t.length, a = 0, n = e.length; r > a;) { e[n++] = t[a++]; }if (r !== r) for (; void 0 !== t[a];) { e[n++] = t[a++]; }return e.length = n, e; }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a; }if (e) { a = (a || "fx") + "queue";var i = r.data(e, a);return n ? (!i || r.isarray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || []; } }, r.dequeue = function (e, t) { r.each(e.nodetype ? [e] : e, function (e, a) { t = t || "fx";var n = r.queue(a, t), o = n.shift();"inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () { r.dequeue(a, t); })); }); }, r.fn = r.prototype = { init: function (e) { if (e.nodetype) return this[0] = e, this;throw new error("not a dom node."); }, offset: function () { var t = this[0].getboundingclientrect ? this[0].getboundingclientrect() : { top: 0, left: 0 };return { top: t.top + (e.pageyoffset || document.scrolltop || 0) - (document.clienttop || 0), left: t.left + (e.pagexoffset || document.scrollleft || 0) - (document.clientleft || 0) }; }, position: function () { function e() { for (var e = this.offsetparent || document; e && "html" === !e.nodetype.tolowercase && "static" === e.style.position;) { e = e.offsetparent; }return e || document; }var t = this[0], e = e.apply(t), a = this.offset(), n = /^(?:body|html)$/i.test(e.nodename) ? { top: 0, left: 0 } : r(e).offset();return a.top -= parsefloat(t.style.margintop) || 0, a.left -= parsefloat(t.style.marginleft) || 0, e.style && (n.top += parsefloat(e.style.bordertopwidth) || 0, n.left += parsefloat(e.style.borderleftwidth) || 0), { top: a.top - n.top, left: a.left - n.left }; } };var a = {};r.expando = "velocity" + new date().gettime(), r.uuid = 0;for (var n = {}, o = n.hasownproperty, i = n.tostring, s = "boolean number string function array date regexp object error".split(" "), l = 0; l < s.length; l++) { n["[object " + s[l] + "]"] = s[l].tolowercase(); }r.fn.init.prototype = r.fn, e.velocity = { utilities: r }; } }(window), function (e) { "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e(); }(function () { return function (e, t, r, a) { function n(e) { for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) { var n = e[t];n && a.push(n); }return a; }function o(e) { return m.iswrapped(e) ? e = [].slice.call(e) : m.isnode(e) && (e = [e]), e; }function i(e) { var t = f.data(e, "velocity");return null === t ? a : t; }function s(e) { return function (t) { return math.round(t * e) * (1 / e); }; }function l(e, r, a, n) { function o(e, t) { return 1 - 3 * t + 3 * e; }function i(e, t) { return 3 * t - 6 * e; }function s(e) { return 3 * e; }function l(e, t, r) { return ((o(t, r) * e + i(t, r)) * e + s(t)) * e; }function u(e, t, r) { return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t); }function c(t, r) { for (var n = 0; m > n; ++n) { var o = u(r, e, a);if (0 === o) return r;var i = l(r, e, a) - t;r -= i / o; }return r; }function p() { for (var t = 0; b > t; ++t) { w[t] = l(t * x, e, a); } }function f(t, r, n) { var o, i, s = 0;do { i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i; } while (math.abs(o) > h && ++s < v);return i; }function d(t) { for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) { r += x; }--n;var i = (t - w[n]) / (w[n + 1] - w[n]), s = r + i * x, l = u(s, e, a);return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x); }function g() { v = !0, (e != r || a != n) && p(); }var m = 4, y = .001, h = 1e-7, v = 10, b = 11, x = 1 / (b - 1), s = "float32array" in t;if (4 !== arguments.length) return !1;for (var p = 0; 4 > p; ++p) { if ("number" != typeof arguments[p] || isnan(arguments[p]) || !isfinite(arguments[p])) return !1; }e = math.min(e, 1), a = math.min(a, 1), e = math.max(e, 0), a = math.max(a, 0);var w = s ? new float32array(b) : new array(b), v = !1, c = function (t) { return v || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n); };c.getcontrolpoints = function () { return [{ x: e, y: r }, { x: a, y: n }]; };var t = "generatebezier(" + [e, r, a, n] + ")";return c.tostring = function () { return t; }, c; }function u(e, t) { var r = e;return m.isstring(e) ? b.easings[e] || (r = !1) : r = m.isarray(e) && 1 === e.length ? s.apply(null, e) : m.isarray(e) && 2 === e.length ? x.apply(null, e.concat([t])) : m.isarray(e) && 4 === e.length ? l.apply(null, e) : !1, r === !1 && (r = b.easings[b.defaults.easing] ? b.defaults.easing : v), r; }function c(e) { if (e) { var t = new date().gettime(), r = b.state.calls.length;r > 1e4 && (b.state.calls = n(b.state.calls));for (var o = 0; r > o; o++) { if (b.state.calls[o]) { var s = b.state.calls[o], l = s[0], u = s[2], d = s[3], g = !!d, y = null;d || (d = b.state.calls[o][3] = t - 16);for (var h = math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) { var p = l[v], v = p.element;if (i(v)) { var c = !1;if (u.display !== a && null !== u.display && "none" !== u.display) { if ("flex" === u.display) { var t = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];f.each(t, function (e, t) { s.setpropertyvalue(v, "display", t); }); }s.setpropertyvalue(v, "display", u.display); }u.visibility !== a && "hidden" !== u.visibility && s.setpropertyvalue(v, "visibility", u.visibility);for (var k in p) { if ("element" !== k) { var a, f = p[k], j = m.isstring(f.easing) ? b.easings[f.easing] : f.easing;if (1 === h) a = f.endvalue;else { var e = f.endvalue - f.startvalue;if (a = f.startvalue + e * j(h, u, e), !g && a === f.currentvalue) continue; }if (f.currentvalue = a, "tween" === k) y = a;else { if (s.hooks.registered[k]) { var h = s.hooks.getroot(k), n = i(v).rootpropertyvaluecache[h];n && (f.rootpropertyvalue = n); }var l = s.setpropertyvalue(v, k, f.currentvalue + (0 === parsefloat(a) ? "" : f.unittype), f.rootpropertyvalue, f.scrolldata);s.hooks.registered[k] && (i(v).rootpropertyvaluecache[h] = s.normalizations.registered[h] ? s.normalizations.registered[h]("extract", null, l[1]) : l[1]), "transform" === l[0] && (c = !0); } } }u.mobileha && i(v).transformcache.translate3d === a && (i(v).transformcache.translate3d = "(0px, 0px, 0px)", c = !0), c && s.flushtransformcache(v); } }u.display !== a && "none" !== u.display && (b.state.calls[o][2].display = !1), u.visibility !== a && "hidden" !== u.visibility && (b.state.calls[o][2].visibility = !1), u.progress && u.progress.call(s[1], s[1], h, math.max(0, d + u.duration - t), d, y), 1 === h && p(o); } } }b.state.isticking && w(c); }function p(e, t) { if (!b.state.calls[e]) return !1;for (var r = b.state.calls[e][0], n = b.state.calls[e][1], o = b.state.calls[e][2], s = b.state.calls[e][4], l = !1, u = 0, c = r.length; c > u; u++) { var p = r[u].element;if (t || o.loop || ("none" === o.display && s.setpropertyvalue(p, "display", o.display), "hidden" === o.visibility && s.setpropertyvalue(p, "visibility", o.visibility)), o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityqueueentryflag/i.test(f.queue(p)[1])) && i(p)) { i(p).isanimating = !1, i(p).rootpropertyvaluecache = {};var d = !1;f.each(s.lists.transforms3d, function (e, t) { var r = /^scale/.test(t) ? 1 : 0, n = i(p).transformcache[t];i(p).transformcache[t] !== a && new regexp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformcache[t]); }), o.mobileha && (d = !0, delete i(p).transformcache.translate3d), d && s.flushtransformcache(p), s.values.removeclass(p, "velocity-animating"); }if (!t && o.complete && !o.loop && u === c - 1) try { o.complete.call(n, n); } catch (g) { settimeout(function () { throw g; }, 1); }s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweenscontainer, function (e, t) { /^rotate/.test(e) && 360 === parsefloat(t.endvalue) && (t.endvalue = 0, t.startvalue = 360), /^backgroundposition/.test(e) && 100 === parsefloat(t.endvalue) && "%" === t.unittype && (t.endvalue = 0, t.startvalue = 100); }), b(p, "reverse", { loop: !0, delay: o.delay })), o.queue !== !1 && f.dequeue(p, o.queue); }b.state.calls[e] = !1;for (var m = 0, y = b.state.calls.length; y > m; m++) { if (b.state.calls[m] !== !1) { l = !0;break; } }l === !1 && (b.state.isticking = !1, delete b.state.calls, b.state.calls = []); }var f, d = function () { if (r.documentmode) return r.documentmode;for (var e = 7; e > 4; e--) { var t = r.createelement("div");if (t.innerhtml = "", t.getelementsbytagname("span").length) return t = null, e; }return a; }(), g = function () { var e = 0;return t.webkitrequestanimationframe || t.mozrequestanimationframe || function (t) { var r, a = new date().gettime();return r = math.max(0, 16 - (a - e)), e = a + r, settimeout(function () { t(a + r); }, r); }; }(), m = { isstring: function (e) { return "string" == typeof e; }, isarray: array.isarray || function (e) { return "[object array]" === object.prototype.tostring.call(e); }, isfunction: function (e) { return "[object function]" === object.prototype.tostring.call(e); }, isnode: function (e) { return e && e.nodetype; }, isnodelist: function (e) { return "object" == typeof e && /^\[object (htmlcollection|nodelist|object)\]$/.test(object.prototype.tostring.call(e)) && e.length !== a && (0 === e.length || "object" == typeof e[0] && e[0].nodetype > 0); }, iswrapped: function (e) { return e && (e.jquery || t.zepto && t.zepto.zepto.isz(e)); }, issvg: function (e) { return t.svgelement && e instanceof t.svgelement; }, isemptyobject: function (e) { for (var t in e) { return !1; }return !0; } }, y = !1;if (e.fn && e.fn.jquery ? (f = e, y = !0) : f = t.velocity.utilities, 8 >= d && !y) throw new error("velocity: ie8 and below require jquery to be loaded before velocity.");if (7 >= d) return void (jquery.fn.velocity = jquery.fn.animate);var h = 400, v = "swing", b = { state: { ismobile: /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent), isandroid: /android/i.test(navigator.useragent), isgingerbread: /android 2\.3\.[3-7]/i.test(navigator.useragent), ischrome: t.chrome, isfirefox: /firefox/i.test(navigator.useragent), prefixelement: r.createelement("div"), prefixmatches: {}, scrollanchor: null, scrollpropertyleft: null, scrollpropertytop: null, isticking: !1, calls: [] }, css: {}, utilities: f, redirects: {}, easings: {}, promise: t.promise, defaults: { queue: "", duration: h, easing: v, begin: a, complete: a, progress: a, display: a, visibility: a, loop: !1, delay: !1, mobileha: !0, _cachevalues: !0 }, init: function (e) { f.data(e, "velocity", { issvg: m.issvg(e), isanimating: !1, computedstyle: null, tweenscontainer: null, rootpropertyvaluecache: {}, transformcache: {} }); }, hook: null, mock: !1, version: { major: 1, minor: 2, patch: 2 }, debug: !1 };t.pageyoffset !== a ? (b.state.scrollanchor = t, b.state.scrollpropertyleft = "pagexoffset", b.state.scrollpropertytop = "pageyoffset") : (b.state.scrollanchor = r.documentelement || r.body.parentnode || r.body, b.state.scrollpropertyleft = "scrollleft", b.state.scrollpropertytop = "scrolltop");var x = function () { function e(e) { return -e.tension * e.x - e.friction * e.v; }function t(t, r, a) { var n = { x: t.x + a.dx * r, v: t.v + a.dv * r, tension: t.tension, friction: t.friction };return { dx: n.v, dv: e(n) }; }function r(r, a) { var n = { dx: r.v, dv: e(r) }, o = t(r, .5 * a, n), i = t(r, .5 * a, o), s = t(r, a, i), l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx), u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);return r.x = r.x + l * a, r.v = r.v + u * a, r; }return function a(e, t, n) { var o, i, s, l = { x: -1, v: 0, tension: null, friction: null }, u = [0], c = 0, p = 1e-4, f = .016;for (e = parsefloat(e) || 500, t = parsefloat(t) || 20, n = n || null, l.tension = e, l.friction = t, o = null !== n, o ? (c = a(e, t), i = c / n * f) : i = f; s = r(s || l, i), u.push(1 + s.x), c += 16, math.abs(s.x) > p && math.abs(s.v) > p;) {}return o ? function (e) { return u[e * (u.length - 1) | 0]; } : c; }; }();b.easings = { linear: function (e) { return e; }, swing: function (e) { return .5 - math.cos(e * math.pi) / 2; }, spring: function (e) { return 1 - math.cos(4.5 * e * math.pi) * math.exp(6 * -e); } }, f.each([["ease", [.25, .1, .25, 1]], ["ease-in", [.42, 0, 1, 1]], ["ease-out", [0, 0, .58, 1]], ["ease-in-out", [.42, 0, .58, 1]], ["easeinsine", [.47, 0, .745, .715]], ["easeoutsine", [.39, .575, .565, 1]], ["easeinoutsine", [.445, .05, .55, .95]], ["easeinquad", [.55, .085, .68, .53]], ["easeoutquad", [.25, .46, .45, .94]], ["easeinoutquad", [.455, .03, .515, .955]], ["easeincubic", [.55, .055, .675, .19]], ["easeoutcubic", [.215, .61, .355, 1]], ["easeinoutcubic", [.645, .045, .355, 1]], ["easeinquart", [.895, .03, .685, .22]], ["easeoutquart", [.165, .84, .44, 1]], ["easeinoutquart", [.77, 0, .175, 1]], ["easeinquint", [.755, .05, .855, .06]], ["easeoutquint", [.23, 1, .32, 1]], ["easeinoutquint", [.86, 0, .07, 1]], ["easeinexpo", [.95, .05, .795, .035]], ["easeoutexpo", [.19, 1, .22, 1]], ["easeinoutexpo", [1, 0, 0, 1]], ["easeincirc", [.6, .04, .98, .335]], ["easeoutcirc", [.075, .82, .165, 1]], ["easeinoutcirc", [.785, .135, .15, .86]]], function (e, t) { b.easings[t[0]] = l.apply(null, t[1]); });var s = b.css = { regex: { ishex: /^#([a-f\d]{3}){1,2}$/i, valueunwrap: /^[a-z]+\((.*)\)$/i, wrappedvaluealreadyextracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, valuesplit: /([a-z]+\(.+\))|(([a-z0-9#-.]+?)(?=\s|$))/gi }, lists: { colors: ["fill", "stroke", "stopcolor", "color", "backgroundcolor", "bordercolor", "bordertopcolor", "borderrightcolor", "borderbottomcolor", "borderleftcolor", "outlinecolor"], transformsbase: ["translatex", "translatey", "scale", "scalex", "scaley", "skewx", "skewy", "rotatez"], transforms3d: ["transformperspective", "translatez", "scalez", "rotatex", "rotatey"] }, hooks: { templates: { textshadow: ["color x y blur", "black 0px 0px 0px"], boxshadow: ["color x y blur spread", "black 0px 0px 0px 0px"], clip: ["top right bottom left", "0px 0px 0px 0px"], backgroundposition: ["x y", "0% 0%"], transformorigin: ["x y z", "50% 50% 0px"], perspectiveorigin: ["x y", "50% 50%"] }, registered: {}, register: function () { for (var e = 0; e < s.lists.colors.length; e++) { var t = "color" === s.lists.colors[e] ? "0 0 0 1" : "255 255 255 1";s.hooks.templates[s.lists.colors[e]] = ["red green blue alpha", t]; }var r, a, n;if (d) for (r in s.hooks.templates) { a = s.hooks.templates[r], n = a[0].split(" ");var o = a[1].match(s.regex.valuesplit);"color" === n[0] && (n.push(n.shift()), o.push(o.shift()), s.hooks.templates[r] = [n.join(" "), o.join(" ")]); }for (r in s.hooks.templates) { a = s.hooks.templates[r], n = a[0].split(" ");for (var e in n) { var i = r + n[e], s = e;s.hooks.registered[i] = [r, s]; } } }, getroot: function (e) { var t = s.hooks.registered[e];return t ? t[0] : e; }, cleanrootpropertyvalue: function (e, t) { return s.regex.valueunwrap.test(t) && (t = t.match(s.regex.valueunwrap)[1]), s.values.iscssnullvalue(t) && (t = s.hooks.templates[e][1]), t; }, extractvalue: function (e, t) { var r = s.hooks.registered[e];if (r) { var a = r[0], n = r[1];return t = s.hooks.cleanrootpropertyvalue(a, t), t.tostring().match(s.regex.valuesplit)[n]; }return t; }, injectvalue: function (e, t, r) { var a = s.hooks.registered[e];if (a) { var n, o, i = a[0], s = a[1];return r = s.hooks.cleanrootpropertyvalue(i, r), n = r.tostring().match(s.regex.valuesplit), n[s] = t, o = n.join(" "); }return r; } }, normalizations: { registered: { clip: function (e, t, r) { switch (e) {case "name": return "clip";case "extract": var a;return s.regex.wrappedvaluealreadyextracted.test(r) ? a = r : (a = r.tostring().match(s.regex.valueunwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a;case "inject": return "rect(" + r + ")";} }, blur: function (e, t, r) { switch (e) {case "name": return b.state.isfirefox ? "filter" : "-webkit-filter";case "extract": var a = parsefloat(r);if (!a && 0 !== a) { var n = r.tostring().match(/blur\(([0-9]+[a-z]+)\)/i);a = n ? n[1] : 0; }return a;case "inject": return parsefloat(r) ? "blur(" + r + ")" : "none";} }, opacity: function (e, t, r) { if (8 >= d) switch (e) {case "name": return "filter";case "extract": var a = r.tostring().match(/alpha\(opacity=(.*)\)/i);return r = a ? a[1] / 100 : 1;case "inject": return t.style.zoom = 1, parsefloat(r) >= 1 ? "" : "alpha(opacity=" + parseint(100 * parsefloat(r), 10) + ")";} else switch (e) {case "name": return "opacity";case "extract": return r;case "inject": return r;} } }, register: function () { 9 >= d || b.state.isgingerbread || (s.lists.transformsbase = s.lists.transformsbase.concat(s.lists.transforms3d));for (var e = 0; e < s.lists.transformsbase.length; e++) { !function () { var t = s.lists.transformsbase[e];s.normalizations.registered[t] = function (e, r, n) { switch (e) {case "name": return "transform";case "extract": return i(r) === a || i(r).transformcache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformcache[t].replace(/[()]/g, "");case "inject": var o = !1;switch (t.substr(0, t.length - 1)) {case "translate": o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);break;case "scal":case "scale": b.state.isandroid && i(r).transformcache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n);break;case "skew": o = !/(deg|\d)$/i.test(n);break;case "rotate": o = !/(deg|\d)$/i.test(n);}return o || (i(r).transformcache[t] = "(" + n + ")"), i(r).transformcache[t];} }; }(); }for (var e = 0; e < s.lists.colors.length; e++) { !function () { var t = s.lists.colors[e];s.normalizations.registered[t] = function (e, r, n) { switch (e) {case "name": return t;case "extract": var o;if (s.regex.wrappedvaluealreadyextracted.test(n)) o = n;else { var i, s = { black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", red: "rgb(255, 0, 0)", white: "rgb(255, 255, 255)" };/^[a-z]+$/i.test(n) ? i = s[n] !== a ? s[n] : s.black : s.regex.ishex.test(n) ? i = "rgb(" + s.values.hextorgb(n).join(" ") + ")" : /^rgba?\(/i.test(n) || (i = s.black), o = (i || n).tostring().match(s.regex.valueunwrap)[1].replace(/,(\s+)?/g, " "); }return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o;case "inject": return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"), (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";} }; }(); } } }, names: { camelcase: function (e) { return e.replace(/-(\w)/g, function (e, t) { return t.touppercase(); }); }, svgattribute: function (e) { var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return (d || b.state.isandroid && !b.state.ischrome) && (t += "|transform"), new regexp("^(" + t + ")$", "i").test(e); }, prefixcheck: function (e) { if (b.state.prefixmatches[e]) return [b.state.prefixmatches[e], !0];for (var t = ["", "webkit", "moz", "ms", "o"], r = 0, a = t.length; a > r; r++) { var n;if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) { return e.touppercase(); }), m.isstring(b.state.prefixelement.style[n])) return b.state.prefixmatches[e] = n, [n, !0]; }return [e, !1]; } }, values: { hextorgb: function (e) { var t, r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return e = e.replace(r, function (e, t, r, a) { return t + t + r + r + a + a; }), t = a.exec(e), t ? [parseint(t[1], 16), parseint(t[2], 16), parseint(t[3], 16)] : [0, 0, 0]; }, iscssnullvalue: function (e) { return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e); }, getunittype: function (e) { return (/^(rotate|skew)/i.test(e) ? "deg" : /(^(scale|scalex|scaley|scalez|alpha|flexgrow|flexheight|zindex|fontweight)$)|((opacity|red|green|blue|alpha)$)/i.test(e) ? "" : "px" ); }, getdisplaytype: function (e) { var t = e && e.tagname.tostring().tolowercase();return (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block" ); }, addclass: function (e, t) { e.classlist ? e.classlist.add(t) : e.classname += (e.classname.length ? " " : "") + t; }, removeclass: function (e, t) { e.classlist ? e.classlist.remove(t) : e.classname = e.classname.tostring().replace(new regexp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " "); } }, getpropertyvalue: function (e, r, n, o) { function s(e, r) { function n() { u && s.setpropertyvalue(e, "display", "none"); }var l = 0;if (8 >= d) l = f.css(e, r);else { var u = !1;if (/^(width|height)$/.test(r) && 0 === s.getpropertyvalue(e, "display") && (u = !0, s.setpropertyvalue(e, "display", s.values.getdisplaytype(e))), !o) { if ("height" === r && "border-box" !== s.getpropertyvalue(e, "boxsizing").tostring().tolowercase()) { var c = e.offsetheight - (parsefloat(s.getpropertyvalue(e, "bordertopwidth")) || 0) - (parsefloat(s.getpropertyvalue(e, "borderbottomwidth")) || 0) - (parsefloat(s.getpropertyvalue(e, "paddingtop")) || 0) - (parsefloat(s.getpropertyvalue(e, "paddingbottom")) || 0);return n(), c; }if ("width" === r && "border-box" !== s.getpropertyvalue(e, "boxsizing").tostring().tolowercase()) { var p = e.offsetwidth - (parsefloat(s.getpropertyvalue(e, "borderleftwidth")) || 0) - (parsefloat(s.getpropertyvalue(e, "borderrightwidth")) || 0) - (parsefloat(s.getpropertyvalue(e, "paddingleft")) || 0) - (parsefloat(s.getpropertyvalue(e, "paddingright")) || 0);return n(), p; } }var g;g = i(e) === a ? t.getcomputedstyle(e, null) : i(e).computedstyle ? i(e).computedstyle : i(e).computedstyle = t.getcomputedstyle(e, null), "bordercolor" === r && (r = "bordertopcolor"), l = 9 === d && "filter" === r ? g.getpropertyvalue(r) : g[r], ("" === l || null === l) && (l = e.style[r]), n(); }if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) { var m = s(e, "position");("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px"); }return l; }var l;if (s.hooks.registered[r]) { var u = r, c = s.hooks.getroot(u);n === a && (n = s.getpropertyvalue(e, s.names.prefixcheck(c)[0])), s.normalizations.registered[c] && (n = s.normalizations.registered[c]("extract", e, n)), l = s.hooks.extractvalue(u, n); } else if (s.normalizations.registered[r]) { var p, g;p = s.normalizations.registered[r]("name", e), "transform" !== p && (g = s(e, s.names.prefixcheck(p)[0]), s.values.iscssnullvalue(g) && s.hooks.templates[r] && (g = s.hooks.templates[r][1])), l = s.normalizations.registered[r]("extract", e, g); }if (!/^[\d-]/.test(l)) if (i(e) && i(e).issvg && s.names.svgattribute(r)) { if (/^(height|width)$/i.test(r)) try { l = e.getbbox()[r]; } catch (m) { l = 0; } else l = e.getattribute(r); } else l = s(e, s.names.prefixcheck(r)[0]);return s.values.iscssnullvalue(l) && (l = 0), b.debug >= 2 && console.log("get " + r + ": " + l), l; }, setpropertyvalue: function (e, r, a, n, o) { var s = r;if ("scroll" === r) o.container ? o.container["scroll" + o.direction] = a : "left" === o.direction ? t.scrollto(a, o.alternatevalue) : t.scrollto(o.alternatevalue, a);else if (s.normalizations.registered[r] && "transform" === s.normalizations.registered[r]("name", e)) s.normalizations.registered[r]("inject", e, a), s = "transform", a = i(e).transformcache[r];else { if (s.hooks.registered[r]) { var l = r, u = s.hooks.getroot(r);n = n || s.getpropertyvalue(e, u), a = s.hooks.injectvalue(l, a, n), r = u; }if (s.normalizations.registered[r] && (a = s.normalizations.registered[r]("inject", e, a), r = s.normalizations.registered[r]("name", e)), s = s.names.prefixcheck(r)[0], 8 >= d) try { e.style[s] = a; } catch (c) { b.debug && console.log("browser does not support [" + a + "] for [" + s + "]"); } else i(e) && i(e).issvg && s.names.svgattribute(r) ? e.setattribute(r, a) : e.style[s] = a;b.debug >= 2 && console.log("set " + r + " (" + s + "): " + a); }return [s, a]; }, flushtransformcache: function (e) { function t(t) { return parsefloat(s.getpropertyvalue(e, t)); }var r = "";if ((d || b.state.isandroid && !b.state.ischrome) && i(e).issvg) { var a = { translate: [t("translatex"), t("translatey")], skewx: [t("skewx")], skewy: [t("skewy")], scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scalex"), t("scaley")], rotate: [t("rotatez"), 0, 0] };f.each(i(e).transformcache, function (e) { /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), a[e] && (r += e + "(" + a[e].join(" ") + ") ", delete a[e]); }); } else { var n, o;f.each(i(e).transformcache, function (t) { return n = i(e).transformcache[t], "transformperspective" === t ? (o = n, !0) : (9 === d && "rotatez" === t && (t = "rotate"), void (r += t + n + " ")); }), o && (r = "perspective" + o + " " + r); }s.setpropertyvalue(e, "transform", r); } };s.hooks.register(), s.normalizations.register(), b.hook = function (e, t, r) { var n = a;return e = o(e), f.each(e, function (e, o) { if (i(o) === a && b.init(o), r === a) n === a && (n = b.css.getpropertyvalue(o, t));else { var s = b.css.setpropertyvalue(o, t, r);"transform" === s[0] && b.css.flushtransformcache(o), n = s; } }), n; };var p = function () { function e() { return s ? k.promise || null : l; }function n() { function e(e) { function p(e, t) { var r = a, n = a, i = a;return m.isarray(e) ? (r = e[0], !m.isarray(e[1]) && /^[\d-]/.test(e[1]) || m.isfunction(e[1]) || s.regex.ishex.test(e[1]) ? i = e[1] : (m.isstring(e[1]) && !s.regex.ishex.test(e[1]) || m.isarray(e[1])) && (n = t ? e[1] : u(e[1], s.duration), e[2] !== a && (i = e[2]))) : r = e, t || (n = n || s.easing), m.isfunction(r) && (r = r.call(o, v, w)), m.isfunction(i) && (i = i.call(o, v, w)), [r || 0, n, i]; }function d(e, t) { var r, a;return a = (t || "0").tostring().tolowercase().replace(/[%a-z]+$/, function (e) { return r = e, ""; }), r || (r = s.values.getunittype(e)), [a, r]; }function h() { var e = { myparent: o.parentnode || r.body, position: s.getpropertyvalue(o, "position"), fontsize: s.getpropertyvalue(o, "fontsize") }, a = e.position === l.lastposition && e.myparent === l.lastparent, n = e.fontsize === l.lastfontsize;l.lastparent = e.myparent, l.lastposition = e.position, l.lastfontsize = e.fontsize;var s = 100, l = {};if (n && a) l.emtopx = l.lastemtopx, l.percenttopxwidth = l.lastpercenttopxwidth, l.percenttopxheight = l.lastpercenttopxheight;else { var u = i(o).issvg ? r.createelementns("http://www.w3.org/2000/svg", "rect") : r.createelement("div");b.init(u), e.myparent.appendchild(u), f.each(["overflow", "overflowx", "overflowy"], function (e, t) { b.css.setpropertyvalue(u, t, "hidden"); }), b.css.setpropertyvalue(u, "position", e.position), b.css.setpropertyvalue(u, "fontsize", e.fontsize), b.css.setpropertyvalue(u, "boxsizing", "content-box"), f.each(["minwidth", "maxwidth", "width", "minheight", "maxheight", "height"], function (e, t) { b.css.setpropertyvalue(u, t, s + "%"); }), b.css.setpropertyvalue(u, "paddingleft", s + "em"), l.percenttopxwidth = l.lastpercenttopxwidth = (parsefloat(s.getpropertyvalue(u, "width", null, !0)) || 1) / s, l.percenttopxheight = l.lastpercenttopxheight = (parsefloat(s.getpropertyvalue(u, "height", null, !0)) || 1) / s, l.emtopx = l.lastemtopx = (parsefloat(s.getpropertyvalue(u, "paddingleft")) || 1) / s, e.myparent.removechild(u); }return null === l.remtopx && (l.remtopx = parsefloat(s.getpropertyvalue(r.body, "fontsize")) || 16), null === l.vwtopx && (l.vwtopx = parsefloat(t.innerwidth) / 100, l.vhtopx = parsefloat(t.innerheight) / 100), l.remtopx = l.remtopx, l.vwtopx = l.vwtopx, l.vhtopx = l.vhtopx, b.debug >= 1 && console.log("unit ratios: " + json.stringify(l), o), l; }if (s.begin && 0 === v) try { s.begin.call(g, g); } catch (x) { settimeout(function () { throw x; }, 1); }if ("scroll" === a) { var p, c, t, f = /^x$/i.test(s.axis) ? "left" : "top", j = parsefloat(s.offset) || 0;s.container ? m.iswrapped(s.container) || m.isnode(s.container) ? (s.container = s.container[0] || s.container, p = s.container["scroll" + f], t = p + f(o).position()[f.tolowercase()] + j) : s.container = null : (p = b.state.scrollanchor[b.state["scrollproperty" + f]], c = b.state.scrollanchor[b.state["scrollproperty" + ("left" === f ? "top" : "left")]], t = f(o).offset()[f.tolowercase()] + j), l = { scroll: { rootpropertyvalue: !1, startvalue: p, currentvalue: p, endvalue: t, unittype: "", easing: s.easing, scrolldata: { container: s.container, direction: f, alternatevalue: c } }, element: o }, b.debug && console.log("tweenscontainer (scroll): ", l.scroll, o); } else if ("reverse" === a) { if (!i(o).tweenscontainer) return void f.dequeue(o, s.queue);"none" === i(o).opts.display && (i(o).opts.display = "auto"), "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"), i(o).opts.loop = !1, i(o).opts.begin = null, i(o).opts.complete = null, v.easing || delete s.easing, v.duration || delete s.duration, s = f.extend({}, i(o).opts, s);var e = f.extend(!0, {}, i(o).tweenscontainer);for (var h in e) { if ("element" !== h) { var n = e[h].startvalue;e[h].startvalue = e[h].currentvalue = e[h].endvalue, e[h].endvalue = n, m.isemptyobject(v) || (e[h].easing = s.easing), b.debug && console.log("reverse tweenscontainer (" + h + "): " + json.stringify(e[h]), o); } }l = e; } else if ("start" === a) { var e;i(o).tweenscontainer && i(o).isanimating === !0 && (e = i(o).tweenscontainer), f.each(y, function (e, t) { if (regexp("^" + s.lists.colors.join("$|^") + "$").test(e)) { var r = p(t, !0), n = r[0], o = r[1], i = r[2];if (s.regex.ishex.test(n)) { for (var s = ["red", "green", "blue"], l = s.values.hextorgb(n), u = i ? s.values.hextorgb(i) : a, c = 0; c < s.length; c++) { var f = [l[c]];o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f; }delete y[e]; } } });for (var z in y) { var o = p(y[z]), q = o[0], $ = o[1], m = o[2];z = s.names.camelcase(z);var i = s.hooks.getroot(z), b = !1;if (i(o).issvg || "tween" === i || s.names.prefixcheck(i)[1] !== !1 || s.normalizations.registered[i] !== a) { (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !m && 0 !== q && (m = 0), s._cachevalues && e && e[z] ? (m === a && (m = e[z].endvalue + e[z].unittype), b = i(o).rootpropertyvaluecache[i]) : s.hooks.registered[z] ? m === a ? (b = s.getpropertyvalue(o, i), m = s.getpropertyvalue(o, z, b)) : b = s.hooks.templates[i][1] : m === a && (m = s.getpropertyvalue(o, z));var w, g, y, d = !1;if (w = d(z, m), m = w[0], y = w[1], w = d(z, q), q = w[0].replace(/^([+-\/*])=/, function (e, t) { return d = t, ""; }), g = w[1], m = parsefloat(m) || 0, q = parsefloat(q) || 0, "%" === g && (/^(fontsize|lineheight)$/.test(z) ? (q /= 100, g = "em") : /^scale/.test(z) ? (q /= 100, g = "") : /(red|green|blue)$/i.test(z) && (q = q / 100 * 255, g = "")), /[\/*]/.test(d)) g = y;else if (y !== g && 0 !== m) if (0 === q) g = y;else { n = n || h();var q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /x$/.test(z) || "x" === z ? "x" : "y";switch (y) {case "%": m *= "x" === q ? n.percenttopxwidth : n.percenttopxheight;break;case "px": break;default: m *= n[y + "topx"];}switch (g) {case "%": m *= 1 / ("x" === q ? n.percenttopxwidth : n.percenttopxheight);break;case "px": break;default: m *= 1 / n[g + "topx"];} }switch (d) {case "+": q = m + q;break;case "-": q = m - q;break;case "*": q = m * q;break;case "/": q = m / q;}l[z] = { rootpropertyvalue: b, startvalue: m, currentvalue: m, endvalue: q, unittype: g, easing: $ }, b.debug && console.log("tweenscontainer (" + z + "): " + json.stringify(l[z]), o); } else b.debug && console.log("skipping [" + i + "] due to a lack of browser support."); }l.element = o; }l.element && (s.values.addclass(o, "velocity-animating"), r.push(l), "" === s.queue && (i(o).tweenscontainer = l, i(o).opts = s), i(o).isanimating = !0, v === w - 1 ? (b.state.calls.push([r, g, s, null, k.resolver]), b.state.isticking === !1 && (b.state.isticking = !0, c())) : v++); }var n, o = this, s = f.extend({}, b.defaults, v), l = {};switch (i(o) === a && b.init(o), parsefloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) { b.velocityqueueentryflag = !0, i(o).delaytimer = { settimeout: settimeout(e, parsefloat(s.delay)), next: e }; }), s.duration.tostring().tolowercase()) {case "fast": s.duration = 200;break;case "normal": s.duration = h;break;case "slow": s.duration = 600;break;default: s.duration = parsefloat(s.duration) || 1;}b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parsefloat(b.mock) || 1, s.delay *= parsefloat(b.mock) || 1)), s.easing = u(s.easing, s.duration), s.begin && !m.isfunction(s.begin) && (s.begin = null), s.progress && !m.isfunction(s.progress) && (s.progress = null), s.complete && !m.isfunction(s.complete) && (s.complete = null), s.display !== a && null !== s.display && (s.display = s.display.tostring().tolowercase(), "auto" === s.display && (s.display = b.css.values.getdisplaytype(o))), s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.tostring().tolowercase()), s.mobileha = s.mobileha && b.state.ismobile && !b.state.isgingerbread, s.queue === !1 ? s.delay ? settimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) { return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityqueueentryflag = !0, void e(t)); }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o); }var s, l, d, g, y, v, x = arguments[0] && (arguments[0].p || f.isplainobject(arguments[0].properties) && !arguments[0].properties.names || m.isstring(arguments[0].properties));if (m.iswrapped(this) ? (s = !1, d = 0, g = this, l = this) : (s = !0, d = 1, g = x ? arguments[0].elements || arguments[0].e : arguments[0]), g = o(g)) { x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]);var w = g.length, v = 0;if (!/^(stop|finish)$/i.test(y) && !f.isplainobject(v)) { var c = d + 1;v = {};for (var t = c; t < arguments.length; t++) { m.isarray(arguments[t]) || !/^(fast|normal|slow)$/i.test(arguments[t]) && !/^\d/.test(arguments[t]) ? m.isstring(arguments[t]) || m.isarray(arguments[t]) ? v.easing = arguments[t] : m.isfunction(arguments[t]) && (v.complete = arguments[t]) : v.duration = arguments[t]; } }var k = { promise: null, resolver: null, rejecter: null };s && b.promise && (k.promise = new b.promise(function (e, t) { k.resolver = e, k.rejecter = t; }));var a;switch (y) {case "scroll": a = "scroll";break;case "reverse": a = "reverse";break;case "finish":case "stop": f.each(g, function (e, t) { i(t) && i(t).delaytimer && (cleartimeout(i(t).delaytimer.settimeout), i(t).delaytimer.next && i(t).delaytimer.next(), delete i(t).delaytimer); });var f = [];return f.each(b.state.calls, function (e, t) { t && f.each(t[1], function (r, n) { var o = v === a ? "" : v;return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) { a === n && ((v === !0 || m.isstring(v)) && (f.each(f.queue(a, m.isstring(v) ? v : ""), function (e, t) { m.isfunction(t) && t(null, !0); }), f.queue(a, m.isstring(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweenscontainer && o !== !1 && f.each(i(a).tweenscontainer, function (e, t) { t.endvalue = t.currentvalue; }), f.push(e)) : "finish" === y && (t[2].duration = 1)); }) : !0; }); }), "stop" === y && (f.each(f, function (e, t) { p(t, !0); }), k.promise && k.resolver(g)), e();default: if (!f.isplainobject(y) || m.isemptyobject(y)) { if (m.isstring(y) && b.redirects[y]) { var j = f.extend({}, v), e = j.duration, h = j.delay || 0;return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) { parsefloat(j.stagger) ? j.delay = h + parsefloat(j.stagger) * e : m.isfunction(j.stagger) && (j.delay = h + j.stagger.call(t, e, w)), j.drag && (j.duration = parsefloat(e) || (/^(callout|transition)/.test(y) ? 1e3 : h), j.duration = math.max(j.duration * (j.backwards ? 1 - e / w : (e + 1) / w), .75 * j.duration, 200)), b.redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a); }), e(); }var n = "velocity: first argument (" + y + ") was not a property map, a known action, or a registered redirect. aborting.";return k.promise ? k.rejecter(new error(n)) : console.log(n), e(); }a = "start";}var l = { lastparent: null, lastposition: null, lastfontsize: null, lastpercenttopxwidth: null, lastpercenttopxheight: null, lastemtopx: null, remtopx: null, vwtopx: null, vhtopx: null }, r = [];f.each(g, function (e, t) { m.isnode(t) && n.call(t); });var z, j = f.extend({}, b.defaults, v);if (j.loop = parseint(j.loop), z = 2 * j.loop - 1, j.loop) for (var o = 0; z > o; o++) { var q = { delay: j.delay, progress: j.progress };o === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), p(g, "reverse", q); }return e(); } };b = f.extend(p, b), b.animate = p;var w = t.requestanimationframe || g;return b.state.ismobile || r.hidden === a || r.addeventlistener("visibilitychange", function () { r.hidden ? (w = function (e) { return settimeout(function () { e(!0); }, 16); }, c()) : w = t.requestanimationframe || g; }), e.velocity = b, e !== t && (e.fn.velocity = p, e.fn.velocity.defaults = b.defaults), f.each(["down", "up"], function (e, t) { b.redirects["slide" + t] = function (e, r, n, o, i, s) { var l = f.extend({}, r), u = l.begin, c = l.complete, p = { height: "", margintop: "", marginbottom: "", paddingtop: "", paddingbottom: "" }, d = {};l.display === a && (l.display = "down" === t ? "inline" === b.css.values.getdisplaytype(e) ? "inline-block" : "block" : "none"), l.begin = function () { u && u.call(i, i);for (var r in p) { d[r] = e.style[r];var a = b.css.getpropertyvalue(e, r);p[r] = "down" === t ? [a, 0] : [0, a]; }d.overflow = e.style.overflow, e.style.overflow = "hidden"; }, l.complete = function () { for (var t in d) { e.style[t] = d[t]; }c && c.call(i, i), s && s.resolver(i); }, b(e, p, l); }; }), f.each(["in", "out"], function (e, t) { b.redirects["fade" + t] = function (e, r, n, o, i, s) { var l = f.extend({}, r), u = { opacity: "in" === t ? 1 : 0 }, c = l.complete;l.complete = n !== o - 1 ? l.begin = null : function () { c && c.call(i, i), s && s.resolver(i); }, l.display === a && (l.display = "in" === t ? "auto" : "none"), b(this, u, l); }; }), b; }(window.jquery || window.zepto || window, window, document); })); ;!function (a, b, c, d) { "use strict"; function k(a, b, c) { return settimeout(q(a, c), b); }function l(a, b, c) { return array.isarray(a) ? (m(a, c[b], c), !0) : !1; }function m(a, b, c) { var e;if (a) if (a.foreach) a.foreach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) { b.call(c, a[e], e, a), e++; } else for (e in a) { a.hasownproperty(e) && b.call(c, a[e], e, a); } }function n(a, b, c) { for (var e = object.keys(b), f = 0; f < e.length;) { (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++; }return a; }function o(a, b) { return n(a, b, !0); }function p(a, b, c) { var e, d = b.prototype;e = a.prototype = object.create(d), e.constructor = a, e._super = d, c && n(e, c); }function q(a, b) { return function () { return a.apply(b, arguments); }; }function r(a, b) { return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a; }function s(a, b) { return a === d ? b : a; }function t(a, b, c) { m(x(b), function (b) { a.addeventlistener(b, c, !1); }); }function u(a, b, c) { m(x(b), function (b) { a.removeeventlistener(b, c, !1); }); }function v(a, b) { for (; a;) { if (a == b) return !0;a = a.parentnode; }return !1; }function w(a, b) { return a.indexof(b) > -1; }function x(a) { return a.trim().split(/\s+/g); }function y(a, b, c) { if (a.indexof && !c) return a.indexof(b);for (var d = 0; d < a.length;) { if (c && a[d][c] == b || !c && a[d] === b) return d;d++; }return -1; }function z(a) { return array.prototype.slice.call(a, 0); }function a(a, b, c) { for (var d = [], e = [], f = 0; f < a.length;) { var g = b ? a[f][b] : a[f];y(e, g) < 0 && d.push(a[f]), e[f] = g, f++; }return c && (d = b ? d.sort(function (a, c) { return a[b] > c[b]; }) : d.sort()), d; }function b(a, b) { for (var c, f, g = b[0].touppercase() + b.slice(1), h = 0; h < e.length;) { if (c = e[h], f = c ? c + g : b, f in a) return f;h++; }return d; }function d() { return c++; }function e(a) { var b = a.ownerdocument;return b.defaultview || b.parentwindow; }function ab(a, b) { var c = this;this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputtarget, this.domhandler = function (b) { r(a.options.enable, [a]) && c.handler(b); }, this.init(); }function bb(a) { var b, c = a.options.inputclass;return b = c ? c : h ? wb : i ? eb : g ? gb : rb, new b(a, cb); }function cb(a, b, c) { var d = c.pointers.length, e = c.changedpointers.length, f = b & o && 0 === d - e, g = b & (q | r) && 0 === d - e;c.isfirst = !!f, c.isfinal = !!g, f && (a.session = {}), c.eventtype = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.previnput = c; }function db(a, b) { var c = a.session, d = b.pointers, e = d.length;c.firstinput || (c.firstinput = gb(b)), e > 1 && !c.firstmultiple ? c.firstmultiple = gb(b) : 1 === e && (c.firstmultiple = !1);var f = c.firstinput, g = c.firstmultiple, h = g ? g.center : f.center, i = b.center = hb(d);b.timestamp = j(), b.deltatime = b.timestamp - f.timestamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetdirection = jb(b.deltax, b.deltay), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b);var k = a.element;v(b.srcevent.target, k) && (k = b.srcevent.target), b.target = k; }function eb(a, b) { var c = b.center, d = a.offsetdelta || {}, e = a.prevdelta || {}, f = a.previnput || {};(b.eventtype === o || f.eventtype === q) && (e = a.prevdelta = { x: f.deltax || 0, y: f.deltay || 0 }, d = a.offsetdelta = { x: c.x, y: c.y }), b.deltax = e.x + (c.x - d.x), b.deltay = e.y + (c.y - d.y); }function fb(a, b) { var f, g, h, j, c = a.lastinterval || b, e = b.timestamp - c.timestamp;if (b.eventtype != r && (e > n || c.velocity === d)) { var k = c.deltax - b.deltax, l = c.deltay - b.deltay, m = ib(e, k, l);g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastinterval = b; } else f = c.velocity, g = c.velocityx, h = c.velocityy, j = c.direction;b.velocity = f, b.velocityx = g, b.velocityy = h, b.direction = j; }function gb(a) { for (var b = [], c = 0; c < a.pointers.length;) { b[c] = { clientx: h(a.pointers[c].clientx), clienty: h(a.pointers[c].clienty) }, c++; }return { timestamp: j(), pointers: b, center: hb(b), deltax: a.deltax, deltay: a.deltay }; }function hb(a) { var b = a.length;if (1 === b) return { x: h(a[0].clientx), y: h(a[0].clienty) };for (var c = 0, d = 0, e = 0; b > e;) { c += a[e].clientx, d += a[e].clienty, e++; }return { x: h(c / b), y: h(d / b) }; }function ib(a, b, c) { return { x: b / a || 0, y: c / a || 0 }; }function jb(a, b) { return a === b ? s : i(a) >= i(b) ? a > 0 ? t : u : b > 0 ? v : w; }function kb(a, b, c) { c || (c = $);var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]];return math.sqrt(d * d + e * e); }function lb(a, b, c) { c || (c = $);var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]];return 180 * math.atan2(e, d) / math.pi; }function mb(a, b) { return lb(b[1], b[0], _) - lb(a[1], a[0], _); }function nb(a, b) { return kb(b[0], b[1], _) / kb(a[0], a[1], _); }function rb() { this.evel = pb, this.evwin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments); }function wb() { this.evel = ub, this.evwin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerevents = []; }function ab() { this.evtarget = yb, this.evwin = zb, this.started = !1, ab.apply(this, arguments); }function bb(a, b) { var c = z(a.touches), d = z(a.changedtouches);return b & (q | r) && (c = a(c.concat(d), "identifier", !0)), [c, d]; }function eb() { this.evtarget = db, this.targetids = {}, ab.apply(this, arguments); }function fb(a, b) { var c = z(a.touches), d = this.targetids;if (b & (o | p) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];var e, f, g = z(a.changedtouches), h = [], i = this.target;if (f = c.filter(function (a) { return v(a.target, i); }), b === o) for (e = 0; e < f.length;) { d[f[e].identifier] = !0, e++; }for (e = 0; e < g.length;) { d[g[e].identifier] && h.push(g[e]), b & (q | r) && delete d[g[e].identifier], e++; }return h.length ? [a(f.concat(h), "identifier", !0), h] : void 0; }function gb() { ab.apply(this, arguments);var a = q(this.handler, this);this.touch = new eb(this.manager, a), this.mouse = new rb(this.manager, a); }function pb(a, b) { this.manager = a, this.set(b); }function qb(a) { if (w(a, mb)) return mb;var b = w(a, nb), c = w(a, ob);return b && c ? nb + " " + ob : b || c ? b ? nb : ob : w(a, lb) ? lb : kb; }function yb(a) { this.id = d(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = rb, this.simultaneous = {}, this.requirefail = []; }function zb(a) { return a & wb ? "cancel" : a & ub ? "end" : a & tb ? "move" : a & sb ? "start" : ""; }function $b(a) { return a == w ? "down" : a == v ? "up" : a == t ? "left" : a == u ? "right" : ""; }function _b(a, b) { var c = b.manager;return c ? c.get(a) : a; }function ac() { yb.apply(this, arguments); }function bc() { ac.apply(this, arguments), this.px = null, this.py = null; }function cc() { ac.apply(this, arguments); }function dc() { yb.apply(this, arguments), this._timer = null, this._input = null; }function ec() { ac.apply(this, arguments); }function fc() { ac.apply(this, arguments); }function gc() { yb.apply(this, arguments), this.ptime = !1, this.pcenter = !1, this._timer = null, this._input = null, this.count = 0; }function hc(a, b) { return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b); }function kc(a, b) { b = b || {}, this.options = o(b, hc.defaults), this.options.inputtarget = this.options.inputtarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchaction = new pb(this, this.options.touchaction), lc(this, !0), m(b.recognizers, function (a) { var b = this.add(new a[0](a[1]));a[2] && b.recognizewith(a[2]), a[3] && b.requirefailure(a[3]); }, this); }function lc(a, b) { var c = a.element;m(a.options.cssprops, function (a, d) { c.style[b(c.style, d)] = b ? a : ""; }); }function mc(a, c) { var d = b.createevent("event");d.initevent(a, !0, !0), d.gesture = c, c.target.dispatchevent(d); }var e = ["", "webkit", "moz", "ms", "ms", "o"], f = b.createelement("div"), g = "function", h = math.round, i = math.abs, j = date.now, c = 1, f = /mobile|tablet|ip(ad|hone|od)|android/i, g = "ontouchstart" in a, h = b(a, "pointerevent") !== d, i = g && f.test(navigator.useragent), j = "touch", k = "pen", l = "mouse", m = "kinect", n = 25, o = 1, p = 2, q = 4, r = 8, s = 1, t = 2, u = 4, v = 8, w = 16, x = t | u, y = v | w, z = x | y, $ = ["x", "y"], _ = ["clientx", "clienty"];ab.prototype = { handler: function () {}, init: function () { this.evel && t(this.element, this.evel, this.domhandler), this.evtarget && t(this.target, this.evtarget, this.domhandler), this.evwin && t(e(this.element), this.evwin, this.domhandler); }, destroy: function () { this.evel && u(this.element, this.evel, this.domhandler), this.evtarget && u(this.target, this.evtarget, this.domhandler), this.evwin && u(e(this.element), this.evwin, this.domhandler); } };var ob = { mousedown: o, mousemove: p, mouseup: q }, pb = "mousedown", qb = "mousemove mouseup";p(rb, ab, { handler: function (a) { var b = ob[a.type];b & o && 0 === a.button && (this.pressed = !0), b & p && 1 !== a.which && (b = q), this.pressed && this.allow && (b & q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedpointers: [a], pointertype: l, srcevent: a })); } });var sb = { pointerdown: o, pointermove: p, pointerup: q, pointercancel: r, pointerout: r }, tb = { 2: j, 3: k, 4: l, 5: m }, ub = "pointerdown", vb = "pointermove pointerup pointercancel";a.mspointerevent && (ub = "mspointerdown", vb = "mspointermove mspointerup mspointercancel"), p(wb, ab, { handler: function (a) { var b = this.store, c = !1, d = a.type.tolowercase().replace("ms", ""), e = sb[d], f = tb[a.pointertype] || a.pointertype, g = f == j, h = y(b, a.pointerid, "pointerid");e & o && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (q | r) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedpointers: [a], pointertype: f, srcevent: a }), c && b.splice(h, 1)); } });var xb = { touchstart: o, touchmove: p, touchend: q, touchcancel: r }, yb = "touchstart", zb = "touchstart touchmove touchend touchcancel";p(ab, ab, { handler: function (a) { var b = xb[a.type];if (b === o && (this.started = !0), this.started) { var c = bb.call(this, a, b);b & (q | r) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedpointers: c[1], pointertype: j, srcevent: a }); } } });var cb = { touchstart: o, touchmove: p, touchend: q, touchcancel: r }, db = "touchstart touchmove touchend touchcancel";p(eb, ab, { handler: function (a) { var b = cb[a.type], c = fb.call(this, a, b);c && this.callback(this.manager, b, { pointers: c[0], changedpointers: c[1], pointertype: j, srcevent: a }); } }), p(gb, ab, { handler: function (a, b, c) { var d = c.pointertype == j, e = c.pointertype == l;if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;b & (q | r) && (this.mouse.allow = !0), this.callback(a, b, c); }, destroy: function () { this.touch.destroy(), this.mouse.destroy(); } });var hb = b(f.style, "touchaction"), ib = hb !== d, jb = "compute", kb = "auto", lb = "manipulation", mb = "none", nb = "pan-x", ob = "pan-y";pb.prototype = { set: function (a) { a == jb && (a = this.compute()), ib && (this.manager.element.style[hb] = a), this.actions = a.tolowercase().trim(); }, update: function () { this.set(this.manager.options.touchaction); }, compute: function () { var a = [];return m(this.manager.recognizers, function (b) { r(b.options.enable, [b]) && (a = a.concat(b.gettouchaction())); }), qb(a.join(" ")); }, preventdefaults: function (a) { if (!ib) { var b = a.srcevent, c = a.offsetdirection;if (this.manager.session.prevented) return b.preventdefault(), void 0;var d = this.actions, e = w(d, mb), f = w(d, ob), g = w(d, nb);return e || f && c & x || g && c & y ? this.preventsrc(b) : void 0; } }, preventsrc: function (a) { this.manager.session.prevented = !0, a.preventdefault(); } };var rb = 1, sb = 2, tb = 4, ub = 8, vb = ub, wb = 16, xb = 32;yb.prototype = { defaults: {}, set: function (a) { return n(this.options, a), this.manager && this.manager.touchaction.update(), this; }, recognizewith: function (a) { if (l(a, "recognizewith", this)) return this;var b = this.simultaneous;return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizewith(this)), this; }, droprecognizewith: function (a) { return l(a, "droprecognizewith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this); }, requirefailure: function (a) { if (l(a, "requirefailure", this)) return this;var b = this.requirefail;return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requirefailure(this)), this; }, droprequirefailure: function (a) { if (l(a, "droprequirefailure", this)) return this;a = _b(a, this);var b = y(this.requirefail, a);return b > -1 && this.requirefail.splice(b, 1), this; }, hasrequirefailures: function () { return this.requirefail.length > 0; }, canrecognizewith: function (a) { return !!this.simultaneous[a.id]; }, emit: function (a) { function d(d) { b.manager.emit(b.options.event + (d ? zb(c) : ""), a); }var b = this, c = this.state;ub > c && d(!0), d(), c >= ub && d(!0); }, tryemit: function (a) { return this.canemit() ? this.emit(a) : (this.state = xb, void 0); }, canemit: function () { for (var a = 0; a < this.requirefail.length;) { if (!(this.requirefail[a].state & (xb | rb))) return !1;a++; }return !0; }, recognize: function (a) { var b = n({}, a);return r(this.options.enable, [this, b]) ? (this.state & (vb | wb | xb) && (this.state = rb), this.state = this.process(b), this.state & (sb | tb | ub | wb) && this.tryemit(b), void 0) : (this.reset(), this.state = xb, void 0); }, process: function () {}, gettouchaction: function () {}, reset: function () {} }, p(ac, yb, { defaults: { pointers: 1 }, attrtest: function (a) { var b = this.options.pointers;return 0 === b || a.pointers.length === b; }, process: function (a) { var b = this.state, c = a.eventtype, d = b & (sb | tb), e = this.attrtest(a);return d && (c & r || !e) ? b | wb : d || e ? c & q ? b | ub : b & sb ? b | tb : sb : xb; } }), p(bc, ac, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: z }, gettouchaction: function () { var a = this.options.direction, b = [];return a & x && b.push(ob), a & y && b.push(nb), b; }, directiontest: function (a) { var b = this.options, c = !0, d = a.distance, e = a.direction, f = a.deltax, g = a.deltay;return e & b.direction || (b.direction & x ? (e = 0 === f ? s : 0 > f ? t : u, c = f != this.px, d = math.abs(a.deltax)) : (e = 0 === g ? s : 0 > g ? v : w, c = g != this.py, d = math.abs(a.deltay))), a.direction = e, c && d > b.threshold && e & b.direction; }, attrtest: function (a) { return ac.prototype.attrtest.call(this, a) && (this.state & sb || !(this.state & sb) && this.directiontest(a)); }, emit: function (a) { this.px = a.deltax, this.py = a.deltay;var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a); } }), p(cc, ac, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, gettouchaction: function () { return [mb]; }, attrtest: function (a) { return this._super.attrtest.call(this, a) && (math.abs(a.scale - 1) > this.options.threshold || this.state & sb); }, emit: function (a) { if (this._super.emit.call(this, a), 1 !== a.scale) { var b = a.scale < 1 ? "in" : "out";this.manager.emit(this.options.event + b, a); } } }), p(dc, yb, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, gettouchaction: function () { return [kb]; }, process: function (a) { var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, e = a.deltatime > b.time;if (this._input = a, !d || !c || a.eventtype & (q | r) && !e) this.reset();else if (a.eventtype & o) this.reset(), this._timer = k(function () { this.state = vb, this.tryemit(); }, b.time, this);else if (a.eventtype & q) return vb;return xb; }, reset: function () { cleartimeout(this._timer); }, emit: function (a) { this.state === vb && (a && a.eventtype & q ? this.manager.emit(this.options.event + "up", a) : (this._input.timestamp = j(), this.manager.emit(this.options.event, this._input))); } }), p(ec, ac, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, gettouchaction: function () { return [mb]; }, attrtest: function (a) { return this._super.attrtest.call(this, a) && (math.abs(a.rotation) > this.options.threshold || this.state & sb); } }), p(fc, ac, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: x | y, pointers: 1 }, gettouchaction: function () { return bc.prototype.gettouchaction.call(this); }, attrtest: function (a) { var c, b = this.options.direction;return b & (x | y) ? c = a.velocity : b & x ? c = a.velocityx : b & y && (c = a.velocityy), this._super.attrtest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventtype & q; }, emit: function (a) { var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a); } }), p(gc, yb, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posthreshold: 10 }, gettouchaction: function () { return [lb]; }, process: function (a) { var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, e = a.deltatime < b.time;if (this.reset(), a.eventtype & o && 0 === this.count) return this.failtimeout();if (d && e && c) { if (a.eventtype != q) return this.failtimeout();var f = this.ptime ? a.timestamp - this.ptime < b.interval : !0, g = !this.pcenter || kb(this.pcenter, a.center) < b.posthreshold;this.ptime = a.timestamp, this.pcenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;var h = this.count % b.taps;if (0 === h) return this.hasrequirefailures() ? (this._timer = k(function () { this.state = vb, this.tryemit(); }, b.interval, this), sb) : vb; }return xb; }, failtimeout: function () { return this._timer = k(function () { this.state = xb; }, this.options.interval, this), xb; }, reset: function () { cleartimeout(this._timer); }, emit: function () { this.state == vb && (this._input.tapcount = this.count, this.manager.emit(this.options.event, this._input)); } }), hc.version = "2.0.4", hc.defaults = { domevents: !1, touchaction: jb, enable: !0, inputtarget: null, inputclass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: x }], [bc, { direction: x }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssprops: { userselect: "default", touchselect: "none", touchcallout: "none", contentzooming: "none", userdrag: "none", taphighlightcolor: "rgba(0,0,0,0)" } };var ic = 1, jc = 2;kc.prototype = { set: function (a) { return n(this.options, a), a.touchaction && this.touchaction.update(), a.inputtarget && (this.input.destroy(), this.input.target = a.inputtarget, this.input.init()), this; }, stop: function (a) { this.session.stopped = a ? jc : ic; }, recognize: function (a) { var b = this.session;if (!b.stopped) { this.touchaction.preventdefaults(a);var c, d = this.recognizers, e = b.currecognizer;(!e || e && e.state & vb) && (e = b.currecognizer = null);for (var f = 0; f < d.length;) { c = d[f], b.stopped === jc || e && c != e && !c.canrecognizewith(e) ? c.reset() : c.recognize(a), !e && c.state & (sb | tb | ub) && (e = b.currecognizer = c), f++; } } }, get: function (a) { if (a instanceof yb) return a;for (var b = this.recognizers, c = 0; c < b.length; c++) { if (b[c].options.event == a) return b[c]; }return null; }, add: function (a) { if (l(a, "add", this)) return this;var b = this.get(a.options.event);return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchaction.update(), a; }, remove: function (a) { if (l(a, "remove", this)) return this;var b = this.recognizers;return a = this.get(a), b.splice(y(b, a), 1), this.touchaction.update(), this; }, on: function (a, b) { var c = this.handlers;return m(x(a), function (a) { c[a] = c[a] || [], c[a].push(b); }), this; }, off: function (a, b) { var c = this.handlers;return m(x(a), function (a) { b ? c[a].splice(y(c[a], b), 1) : delete c[a]; }), this; }, emit: function (a, b) { this.options.domevents && mc(a, b);var c = this.handlers[a] && this.handlers[a].slice();if (c && c.length) { b.type = a, b.preventdefault = function () { b.srcevent.preventdefault(); };for (var d = 0; d < c.length;) { c[d](b), d++; } } }, destroy: function () { this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null; } }, n(hc, { input_start: o, input_move: p, input_end: q, input_cancel: r, state_possible: rb, state_began: sb, state_changed: tb, state_ended: ub, state_recognized: vb, state_cancelled: wb, state_failed: xb, direction_none: s, direction_left: t, direction_right: u, direction_up: v, direction_down: w, direction_horizontal: x, direction_vertical: y, direction_all: z, manager: kc, input: ab, touchaction: pb, touchinput: eb, mouseinput: rb, pointereventinput: wb, touchmouseinput: gb, singletouchinput: ab, recognizer: yb, attrrecognizer: ac, tap: gc, pan: bc, swipe: fc, pinch: cc, rotate: ec, press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindfn: q, prefixed: b }), typeof define == g && define.amd ? define(function () { return hc; }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc; }(window, document, "hammer");;(function (factory) { if (typeof define === 'function' && define.amd) { define(['jquery', 'hammerjs'], factory); } else if (typeof exports === 'object') { factory(require('jquery'), require('hammerjs')); } else { factory(jquery, hammer); } })(function ($, hammer) { function hammerify(el, options) { var $el = $(el); if (!$el.data("hammer")) { $el.data("hammer", new hammer($el[0], options)); } } $.fn.hammer = function (options) { return this.each(function () { hammerify(this, options); }); }; // extend the emit method to also trigger jquery events hammer.manager.prototype.emit = function (originalemit) { return function (type, data) { originalemit.call(this, type, data); $(this.element).trigger({ type: type, gesture: data }); }; }(hammer.manager.prototype.emit); }); ; // required for meteor package, the use of window prevents export by meteor (function (window) { if (window.package) { materialize = {}; } else { window.materialize = {}; } })(window); if (typeof exports !== 'undefined' && !exports.nodetype) { if (typeof module !== 'undefined' && !module.nodetype && module.exports) { exports = module.exports = materialize; } exports.default = materialize; } /* * raf.js * https://github.com/ngryman/raf.js * * original requestanimationframe polyfill by erik möller * inspired from paul_irish gist and post * * copyright (c) 2013 ngryman * licensed under the mit license. */ (function (window) { var lasttime = 0, vendors = ['webkit', 'moz'], requestanimationframe = window.requestanimationframe, cancelanimationframe = window.cancelanimationframe, i = vendors.length; // try to un-prefix existing raf while (--i >= 0 && !requestanimationframe) { requestanimationframe = window[vendors[i] + 'requestanimationframe']; cancelanimationframe = window[vendors[i] + 'cancelrequestanimationframe']; } // polyfill with settimeout fallback // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945 if (!requestanimationframe || !cancelanimationframe) { requestanimationframe = function (callback) { var now = +date.now(), nexttime = math.max(lasttime + 16, now); return settimeout(function () { callback(lasttime = nexttime); }, nexttime - now); }; cancelanimationframe = cleartimeout; } // export to window window.requestanimationframe = requestanimationframe; window.cancelanimationframe = cancelanimationframe; })(window); /** * generate approximated selector string for a jquery object * @param {jquery} obj jquery object to be parsed * @returns {string} */ materialize.objectselectorstring = function (obj) { var tagstr = obj.prop('tagname') || ''; var idstr = obj.attr('id') || ''; var classstr = obj.attr('class') || ''; return (tagstr + idstr + classstr).replace(/\s/g, ''); }; // unique random id materialize.guid = function () { function s4() { return math.floor((1 + math.random()) * 0x10000).tostring(16).substring(1); } return function () { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }; }(); /** * escapes hash from special characters * @param {string} hash string returned from this.hash * @returns {string} */ materialize.escapehash = function (hash) { return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1"); }; materialize.elementorparentisfixed = function (element) { var $element = $(element); var $checkelements = $element.add($element.parents()); var isfixed = false; $checkelements.each(function () { if ($(this).css("position") === "fixed") { isfixed = true; return false; } }); return isfixed; }; /** * get time in ms * @license https://raw.github.com/jashkenas/underscore/master/license * @type {function} * @return {number} */ var gettime = date.now || function () { return new date().gettime(); }; /** * returns a function, that, when invoked, will only be triggered at most once * during a given window of time. normally, the throttled function will run * as much as it can, without ever going more than once per `wait` duration; * but if you'd like to disable the execution on the leading edge, pass * `{leading: false}`. to disable execution on the trailing edge, ditto. * @license https://raw.github.com/jashkenas/underscore/master/license * @param {function} func * @param {number} wait * @param {object=} options * @returns {function} */ materialize.throttle = function (func, wait, options) { var context, args, result; var timeout = null; var previous = 0; options || (options = {}); var later = function () { previous = options.leading === false ? 0 : gettime(); timeout = null; result = func.apply(context, args); context = args = null; }; return function () { var now = gettime(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { cleartimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout && options.trailing !== false) { timeout = settimeout(later, remaining); } return result; }; }; // velocity has conflicts when loaded with jquery, this will check for it // first, check if in noconflict mode var vel; if (jquery) { vel = jquery.velocity; } else if ($) { vel = $.velocity; } else { vel = velocity; } if (vel) { materialize.vel = vel; } else { materialize.vel = velocity; } ;(function ($) { $.fn.collapsible = function (options, methodparam) { var defaults = { accordion: undefined, onopen: undefined, onclose: undefined }; var methodname = options; options = $.extend(defaults, options); return this.each(function () { var $this = $(this); var $panel_headers = $(this).find('> li > .collapsible-header'); var collapsible_type = $this.data("collapsible"); /**************** helper functions ****************/ // accordion open function accordionopen(object) { $panel_headers = $this.find('> li > .collapsible-header'); if (object.hasclass('active')) { object.parent().addclass('active'); } else { object.parent().removeclass('active'); } if (object.parent().hasclass('active')) { object.siblings('.collapsible-body').stop(true, false).slidedown({ duration: 350, easing: "easeoutquart", queue: false, complete: function () { $(this).css('height', ''); } }); } else { object.siblings('.collapsible-body').stop(true, false).slideup({ duration: 350, easing: "easeoutquart", queue: false, complete: function () { $(this).css('height', ''); } }); } $panel_headers.not(object).removeclass('active').parent().removeclass('active'); // close previously open accordion elements. $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () { if ($(this).is(':visible')) { $(this).slideup({ duration: 350, easing: "easeoutquart", queue: false, complete: function () { $(this).css('height', ''); execcallbacks($(this).siblings('.collapsible-header')); } }); } }); } // expandable open function expandableopen(object) { if (object.hasclass('active')) { object.parent().addclass('active'); } else { object.parent().removeclass('active'); } if (object.parent().hasclass('active')) { object.siblings('.collapsible-body').stop(true, false).slidedown({ duration: 350, easing: "easeoutquart", queue: false, complete: function () { $(this).css('height', ''); } }); } else { object.siblings('.collapsible-body').stop(true, false).slideup({ duration: 350, easing: "easeoutquart", queue: false, complete: function () { $(this).css('height', ''); } }); } } // open collapsible. object: .collapsible-header function collapsibleopen(object, notoggle) { if (!notoggle) { object.toggleclass('active'); } if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // handle accordion accordionopen(object); } else { // handle expandables expandableopen(object); } execcallbacks(object); } // handle callbacks function execcallbacks(object) { if (object.hasclass('active')) { if (typeof options.onopen === "function") { options.onopen.call(this, object.parent()); } } else { if (typeof options.onclose === "function") { options.onclose.call(this, object.parent()); } } } /** * check if object is children of panel header * @param {object} object jquery object * @return {boolean} true if it is children */ function ischildrenofpanelheader(object) { var panelheader = getpanelheader(object); return panelheader.length > 0; } /** * get panel header from a children element * @param {object} object jquery object * @return {object} panel header object */ function getpanelheader(object) { return object.closest('li > .collapsible-header'); } // turn off any existing event handlers function removeeventhandlers() { $this.off('click.collapse', '> li > .collapsible-header'); } /***** end helper functions *****/ // methods if (methodname === 'destroy') { removeeventhandlers(); return; } else if (methodparam >= 0 && methodparam < $panel_headers.length) { var $curr_header = $panel_headers.eq(methodparam); if ($curr_header.length && (methodname === 'open' || methodname === 'close' && $curr_header.hasclass('active'))) { collapsibleopen($curr_header); } return; } removeeventhandlers(); // add click handler to only direct collapsible header children $this.on('click.collapse', '> li > .collapsible-header', function (e) { var element = $(e.target); if (ischildrenofpanelheader(element)) { element = getpanelheader(element); } collapsibleopen(element); }); // open first active if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // handle accordion collapsibleopen($panel_headers.filter('.active').first(), true); } else { // handle expandables $panel_headers.filter('.active').each(function () { collapsibleopen($(this), true); }); } }); }; $(document).ready(function () { $('.collapsible').collapsible(); }); })(jquery);;(function ($) { // add posibility to scroll to selected option // usefull for select for example $.fn.scrollto = function (elem) { $(this).scrolltop($(this).scrolltop() - $(this).offset().top + $(elem).offset().top); return this; }; $.fn.dropdown = function (options) { var defaults = { induration: 300, outduration: 225, constrainwidth: true, // constrains width of dropdown to the activator hover: false, gutter: 0, // spacing from edge beloworigin: false, alignment: 'left', stoppropagation: false }; // open dropdown. if (options === "open") { this.each(function () { $(this).trigger('open'); }); return false; } // close dropdown. if (options === "close") { this.each(function () { $(this).trigger('close'); }); return false; } this.each(function () { var origin = $(this); var curr_options = $.extend({}, defaults, options); var isfocused = false; // dropdown menu var activates = $("#" + origin.attr('data-activates')); function updateoptions() { if (origin.data('induration') !== undefined) curr_options.induration = origin.data('induration'); if (origin.data('outduration') !== undefined) curr_options.outduration = origin.data('outduration'); if (origin.data('constrainwidth') !== undefined) curr_options.constrainwidth = origin.data('constrainwidth'); if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover'); if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter'); if (origin.data('beloworigin') !== undefined) curr_options.beloworigin = origin.data('beloworigin'); if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment'); if (origin.data('stoppropagation') !== undefined) curr_options.stoppropagation = origin.data('stoppropagation'); } updateoptions(); // attach dropdown to its activator origin.after(activates); /* helper function to position and resize dropdown. used in hover and click handler. */ function placedropdown(eventtype) { // check for simultaneous focus and click events. if (eventtype === 'focus') { isfocused = true; } // check html data attributes updateoptions(); // set dropdown state activates.addclass('active'); origin.addclass('active'); var originwidth = origin[0].getboundingclientrect().width; // constrain width if (curr_options.constrainwidth === true) { activates.css('width', originwidth); } else { activates.css('white-space', 'nowrap'); } // offscreen detection var windowheight = window.innerheight; var originheight = origin.innerheight(); var offsetleft = origin.offset().left; var offsettop = origin.offset().top - $(window).scrolltop(); var curralignment = curr_options.alignment; var gutterspacing = 0; var leftposition = 0; // below origin var verticaloffset = 0; if (curr_options.beloworigin === true) { verticaloffset = originheight; } // check for scrolling positioned container. var scrollyoffset = 0; var scrollxoffset = 0; var wrapper = origin.parent(); if (!wrapper.is('body')) { if (wrapper[0].scrollheight > wrapper[0].clientheight) { scrollyoffset = wrapper[0].scrolltop; } if (wrapper[0].scrollwidth > wrapper[0].clientwidth) { scrollxoffset = wrapper[0].scrollleft; } } if (offsetleft + activates.innerwidth() > $(window).width()) { // dropdown goes past screen on right, force right alignment curralignment = 'right'; } else if (offsetleft - activates.innerwidth() + origin.innerwidth() < 0) { // dropdown goes past screen on left, force left alignment curralignment = 'left'; } // vertical bottom offscreen detection if (offsettop + activates.innerheight() > windowheight) { // if going upwards still goes offscreen, just crop height of dropdown. if (offsettop + originheight - activates.innerheight() < 0) { var adjustedheight = windowheight - offsettop - verticaloffset; activates.css('max-height', adjustedheight); } else { // flow upwards. if (!verticaloffset) { verticaloffset += originheight; } verticaloffset -= activates.innerheight(); } } // handle edge alignment if (curralignment === 'left') { gutterspacing = curr_options.gutter; leftposition = origin.position().left + gutterspacing; } else if (curralignment === 'right') { // material icons fix activates.stop(true, true).css({ opacity: 0, left: 0 }); var offsetright = origin.position().left + originwidth - activates.width(); gutterspacing = -curr_options.gutter; leftposition = offsetright + gutterspacing; } // position dropdown activates.css({ position: 'absolute', top: origin.position().top + verticaloffset + scrollyoffset, left: leftposition + scrollxoffset }); // show dropdown activates.slidedown({ queue: false, duration: curr_options.induration, easing: 'easeoutcubic', complete: function () { $(this).css('height', ''); } }).animate({ opacity: 1 }, { queue: false, duration: curr_options.induration, easing: 'easeoutsine' }); // add click close handler to document settimeout(function () { $(document).on('click.' + activates.attr('id'), function (e) { hidedropdown(); $(document).off('click.' + activates.attr('id')); }); }, 0); } function hidedropdown() { // check for simultaneous focus and click events. isfocused = false; activates.fadeout(curr_options.outduration); activates.removeclass('active'); origin.removeclass('active'); $(document).off('click.' + activates.attr('id')); settimeout(function () { activates.css('max-height', ''); }, curr_options.outduration); } // hover if (curr_options.hover) { var open = false; origin.off('click.' + origin.attr('id')); // hover handler to show dropdown origin.on('mouseenter', function (e) { // mouse over if (open === false) { placedropdown(); open = true; } }); origin.on('mouseleave', function (e) { // if hover on origin then to something other than dropdown content, then close var toel = e.toelement || e.relatedtarget; // added browser compatibility for target element if (!$(toel).closest('.dropdown-content').is(activates)) { activates.stop(true, true); hidedropdown(); open = false; } }); activates.on('mouseleave', function (e) { // mouse out var toel = e.toelement || e.relatedtarget; if (!$(toel).closest('.dropdown-button').is(origin)) { activates.stop(true, true); hidedropdown(); open = false; } }); // click } else { // click handler to show dropdown origin.off('click.' + origin.attr('id')); origin.on('click.' + origin.attr('id'), function (e) { if (!isfocused) { if (origin[0] == e.currenttarget && !origin.hasclass('active') && $(e.target).closest('.dropdown-content').length === 0) { e.preventdefault(); // prevents button click from moving window if (curr_options.stoppropagation) { e.stoppropagation(); } placedropdown('click'); } // if origin is clicked and menu is open, close menu else if (origin.hasclass('active')) { hidedropdown(); $(document).off('click.' + activates.attr('id')); } } }); } // end else // listen to open and close event - useful for select component origin.on('open', function (e, eventtype) { placedropdown(eventtype); }); origin.on('close', hidedropdown); }); }; // end dropdown plugin $(document).ready(function () { $('.dropdown-button').dropdown(); }); })(jquery); ;(function ($, vel) { 'use strict'; var _defaults = { opacity: 0.5, induration: 250, outduration: 250, ready: undefined, complete: undefined, dismissible: true, startingtop: '4%', endingtop: '10%' }; /** * @class * */ var modal = function () { /** * construct modal instance and set up overlay * @constructor * @param {jquery} $el * @param {object} options */ function modal($el, options) { _classcallcheck(this, modal); // if exists, destroy and reinitialize if (!!$el[0].m_modal) { $el[0].m_modal.destroy(); } /** * the jquery element * @type {jquery} */ this.$el = $el; /** * options for the modal * @member modal#options * @prop {number} [opacity=0.5] - opacity of the modal overlay * @prop {number} [induration=250] - length in ms of enter transition * @prop {number} [outduration=250] - length in ms of exit transition * @prop {function} ready - callback function called when modal is finished entering * @prop {function} complete - callback function called when modal is finished exiting * @prop {boolean} [dismissible=true] - allow modal to be dismissed by keyboard or overlay click * @prop {string} [startingtop='4%'] - startingtop * @prop {string} [endingtop='10%'] - endingtop */ this.options = $.extend({}, modal.defaults, options); /** * describes open/close state of modal * @type {boolean} */ this.isopen = false; this.$el[0].m_modal = this; this.id = $el.attr('id'); this.openingtrigger = undefined; this.$overlay = $(''); modal._increment++; modal._count++; this.$overlay[0].style.zindex = 1000 + modal._increment * 2; this.$el[0].style.zindex = 1000 + modal._increment * 2 + 1; this.setupeventhandlers(); } _createclass(modal, [{ key: 'getinstance', /** * get instance */ value: function getinstance() { return this; } /** * teardown component */ }, { key: 'destroy', value: function destroy() { this.removeeventhandlers(); this.$el[0].removeattribute('style'); if (!!this.$overlay[0].parentnode) { this.$overlay[0].parentnode.removechild(this.$overlay[0]); } this.$el[0].m_modal = undefined; modal._count--; } /** * setup event handlers */ }, { key: 'setupeventhandlers', value: function setupeventhandlers() { this.handleoverlayclickbound = this.handleoverlayclick.bind(this); this.handlemodalcloseclickbound = this.handlemodalcloseclick.bind(this); if (modal._count === 1) { document.body.addeventlistener('click', this.handletriggerclick); } this.$overlay[0].addeventlistener('click', this.handleoverlayclickbound); this.$el[0].addeventlistener('click', this.handlemodalcloseclickbound); } /** * remove event handlers */ }, { key: 'removeeventhandlers', value: function removeeventhandlers() { if (modal._count === 0) { document.body.removeeventlistener('click', this.handletriggerclick); } this.$overlay[0].removeeventlistener('click', this.handleoverlayclickbound); this.$el[0].removeeventlistener('click', this.handlemodalcloseclickbound); } /** * handle trigger click * @param {event} e */ }, { key: 'handletriggerclick', value: function handletriggerclick(e) { var $trigger = $(e.target).closest('.modal-trigger'); if (e.target && $trigger.length) { var modalid = $trigger[0].getattribute('href'); if (modalid) { modalid = modalid.slice(1); } else { modalid = $trigger[0].getattribute('data-target'); } var modalinstance = document.getelementbyid(modalid).m_modal; if (modalinstance) { modalinstance.open($trigger); } e.preventdefault(); } } /** * handle overlay click */ }, { key: 'handleoverlayclick', value: function handleoverlayclick() { if (this.options.dismissible) { this.close(); } } /** * handle modal close click * @param {event} e */ }, { key: 'handlemodalcloseclick', value: function handlemodalcloseclick(e) { var $closetrigger = $(e.target).closest('.modal-close'); if (e.target && $closetrigger.length) { this.close(); } } /** * handle keydown * @param {event} e */ }, { key: 'handlekeydown', value: function handlekeydown(e) { // esc key if (e.keycode === 27 && this.options.dismissible) { this.close(); } } /** * animate in modal */ }, { key: 'animatein', value: function animatein() { var _this = this; // set initial styles $.extend(this.$el[0].style, { display: 'block', opacity: 0 }); $.extend(this.$overlay[0].style, { display: 'block', opacity: 0 }); // animate overlay vel(this.$overlay[0], { opacity: this.options.opacity }, { duration: this.options.induration, queue: false, ease: 'easeoutcubic' }); // define modal animation options var entervelocityoptions = { duration: this.options.induration, queue: false, ease: 'easeoutcubic', // handle modal ready callback complete: function () { if (typeof _this.options.ready === 'function') { _this.options.ready.call(_this, _this.$el, _this.openingtrigger); } } }; // bottom sheet animation if (this.$el[0].classlist.contains('bottom-sheet')) { vel(this.$el[0], { bottom: 0, opacity: 1 }, entervelocityoptions); // normal modal animation } else { vel.hook(this.$el[0], 'scalex', 0.7); this.$el[0].style.top = this.options.startingtop; vel(this.$el[0], { top: this.options.endingtop, opacity: 1, scalex: 1 }, entervelocityoptions); } } /** * animate out modal */ }, { key: 'animateout', value: function animateout() { var _this2 = this; // animate overlay vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outduration, queue: false, ease: 'easeoutquart' }); // define modal animation options var exitvelocityoptions = { duration: this.options.outduration, queue: false, ease: 'easeoutcubic', // handle modal ready callback complete: function () { _this2.$el[0].style.display = 'none'; // call complete callback if (typeof _this2.options.complete === 'function') { _this2.options.complete.call(_this2, _this2.$el); } _this2.$overlay[0].parentnode.removechild(_this2.$overlay[0]); } }; // bottom sheet animation if (this.$el[0].classlist.contains('bottom-sheet')) { vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitvelocityoptions); // normal modal animation } else { vel(this.$el[0], { top: this.options.startingtop, opacity: 0, scalex: 0.7 }, exitvelocityoptions); } } /** * open modal * @param {jquery} [$trigger] */ }, { key: 'open', value: function open($trigger) { if (this.isopen) { return; } this.isopen = true; var body = document.body; body.style.overflow = 'hidden'; this.$el[0].classlist.add('open'); body.appendchild(this.$overlay[0]); // set opening trigger, undefined indicates modal was opened by javascript this.openingtrigger = !!$trigger ? $trigger : undefined; if (this.options.dismissible) { this.handlekeydownbound = this.handlekeydown.bind(this); document.addeventlistener('keydown', this.handlekeydownbound); } this.animatein(); return this; } /** * close modal */ }, { key: 'close', value: function close() { if (!this.isopen) { return; } this.isopen = false; this.$el[0].classlist.remove('open'); document.body.style.overflow = ''; if (this.options.dismissible) { document.removeeventlistener('keydown', this.handlekeydownbound); } this.animateout(); return this; } }], [{ key: 'init', value: function init($els, options) { var arr = []; $els.each(function () { arr.push(new modal($(this), options)); }); return arr; } }, { key: 'defaults', get: function () { return _defaults; } }]); return modal; }(); /** * @static * @memberof modal */ modal._increment = 0; /** * @static * @memberof modal */ modal._count = 0; materialize.modal = modal; $.fn.modal = function (methodoroptions) { // call plugin method if valid method name is passed in if (modal.prototype[methodoroptions]) { // getter methods if (methodoroptions.slice(0, 3) === 'get') { return this.first()[0].m_modal[methodoroptions](); // void methods } else { return this.each(function () { this.m_modal[methodoroptions](); }); } // initialize plugin if options or no argument is passed in } else if (typeof methodoroptions === 'object' || !methodoroptions) { modal.init(this, arguments[0]); return this; // return error if an unrecognized method name is passed in } else { $.error('method ' + methodoroptions + ' does not exist on jquery.modal'); } }; })(jquery, materialize.vel); ;(function ($) { $.fn.materialbox = function () { return this.each(function () { if ($(this).hasclass('initialized')) { return; } $(this).addclass('initialized'); var overlayactive = false; var doneanimating = true; var induration = 275; var outduration = 200; var origin = $(this); var placeholder = $('
').addclass('material-placeholder'); var originalwidth = 0; var originalheight = 0; var ancestorschanged; var ancestor; var origininlinestyles = origin.attr('style'); origin.wrap(placeholder); // start click handler origin.on('click', function () { var placeholder = origin.parent('.material-placeholder'); var windowwidth = window.innerwidth; var windowheight = window.innerheight; var originalwidth = origin.width(); var originalheight = origin.height(); // if already modal, return to original if (doneanimating === false) { returntooriginal(); return false; } else if (overlayactive && doneanimating === true) { returntooriginal(); return false; } // set states doneanimating = false; origin.addclass('active'); overlayactive = true; // set positioning for placeholder placeholder.css({ width: placeholder[0].getboundingclientrect().width, height: placeholder[0].getboundingclientrect().height, position: 'relative', top: 0, left: 0 }); // find ancestor with overflow: hidden; and remove it ancestorschanged = undefined; ancestor = placeholder[0].parentnode; var count = 0; while (ancestor !== null && !$(ancestor).is(document)) { var curr = $(ancestor); if (curr.css('overflow') !== 'visible') { curr.css('overflow', 'visible'); if (ancestorschanged === undefined) { ancestorschanged = curr; } else { ancestorschanged = ancestorschanged.add(curr); } } ancestor = ancestor.parentnode; } // set css on origin origin.css({ position: 'absolute', 'z-index': 1000, 'will-change': 'left, top, width, height' }).data('width', originalwidth).data('height', originalheight); // add overlay var overlay = $('
').css({ opacity: 0 }).click(function () { if (doneanimating === true) returntooriginal(); }); // put before in origin image to preserve z-index layering. origin.before(overlay); // set dimensions if needed var overlayoffset = overlay[0].getboundingclientrect(); overlay.css({ width: windowwidth, height: windowheight, left: -1 * overlayoffset.left, top: -1 * overlayoffset.top }); // animate overlay overlay.velocity({ opacity: 1 }, { duration: induration, queue: false, easing: 'easeoutquad' }); // add and animate caption if it exists if (origin.data('caption') !== "") { var $photo_caption = $('
'); $photo_caption.text(origin.data('caption')); $('body').append($photo_caption); $photo_caption.css({ "display": "inline" }); $photo_caption.velocity({ opacity: 1 }, { duration: induration, queue: false, easing: 'easeoutquad' }); } // resize image var ratio = 0; var widthpercent = originalwidth / windowwidth; var heightpercent = originalheight / windowheight; var newwidth = 0; var newheight = 0; if (widthpercent > heightpercent) { ratio = originalheight / originalwidth; newwidth = windowwidth * 0.9; newheight = windowwidth * 0.9 * ratio; } else { ratio = originalwidth / originalheight; newwidth = windowheight * 0.9 * ratio; newheight = windowheight * 0.9; } // animate image + set z-index if (origin.hasclass('responsive-img')) { origin.velocity({ 'max-width': newwidth, 'width': originalwidth }, { duration: 0, queue: false, complete: function () { origin.css({ left: 0, top: 0 }).velocity({ height: newheight, width: newwidth, left: $(document).scrollleft() + windowwidth / 2 - origin.parent('.material-placeholder').offset().left - newwidth / 2, top: $(document).scrolltop() + windowheight / 2 - origin.parent('.material-placeholder').offset().top - newheight / 2 }, { duration: induration, queue: false, easing: 'easeoutquad', complete: function () { doneanimating = true; } }); } // end complete }); // end velocity } else { origin.css('left', 0).css('top', 0).velocity({ height: newheight, width: newwidth, left: $(document).scrollleft() + windowwidth / 2 - origin.parent('.material-placeholder').offset().left - newwidth / 2, top: $(document).scrolltop() + windowheight / 2 - origin.parent('.material-placeholder').offset().top - newheight / 2 }, { duration: induration, queue: false, easing: 'easeoutquad', complete: function () { doneanimating = true; } }); // end velocity } // handle exit triggers $(window).on('scroll.materialbox', function () { if (overlayactive) { returntooriginal(); } }); $(window).on('resize.materialbox', function () { if (overlayactive) { returntooriginal(); } }); $(document).on('keyup.materialbox', function (e) { // esc key if (e.keycode === 27 && doneanimating === true && overlayactive) { returntooriginal(); } }); }); // end click handler // this function returns the modaled image to the original spot function returntooriginal() { doneanimating = false; var placeholder = origin.parent('.material-placeholder'); var windowwidth = window.innerwidth; var windowheight = window.innerheight; var originalwidth = origin.data('width'); var originalheight = origin.data('height'); origin.velocity("stop", true); $('#materialbox-overlay').velocity("stop", true); $('.materialbox-caption').velocity("stop", true); // disable exit handlers $(window).off('scroll.materialbox'); $(document).off('keyup.materialbox'); $(window).off('resize.materialbox'); $('#materialbox-overlay').velocity({ opacity: 0 }, { duration: outduration, // delay prevents animation overlapping queue: false, easing: 'easeoutquad', complete: function () { // remove overlay overlayactive = false; $(this).remove(); } }); // resize image origin.velocity({ width: originalwidth, height: originalheight, left: 0, top: 0 }, { duration: outduration, queue: false, easing: 'easeoutquad', complete: function () { placeholder.css({ height: '', width: '', position: '', top: '', left: '' }); origin.removeattr('style'); origin.attr('style', origininlinestyles); // remove class origin.removeclass('active'); doneanimating = true; // remove overflow overrides on ancestors if (ancestorschanged) { ancestorschanged.css('overflow', ''); } } }); // remove caption + reset css settings on image $('.materialbox-caption').velocity({ opacity: 0 }, { duration: outduration, // delay prevents animation overlapping queue: false, easing: 'easeoutquad', complete: function () { $(this).remove(); } }); } }); }; $(document).ready(function () { $('.materialboxed').materialbox(); }); })(jquery); ;(function ($) { $.fn.parallax = function () { var window_width = $(window).width(); // parallax scripts return this.each(function (i) { var $this = $(this); $this.addclass('parallax'); function updateparallax(initial) { var container_height; if (window_width < 601) { container_height = $this.height() > 0 ? $this.height() : $this.children("img").height(); } else { container_height = $this.height() > 0 ? $this.height() : 500; } var $img = $this.children("img").first(); var img_height = $img.height(); var parallax_dist = img_height - container_height; var bottom = $this.offset().top + container_height; var top = $this.offset().top; var scrolltop = $(window).scrolltop(); var windowheight = window.innerheight; var windowbottom = scrolltop + windowheight; var percentscrolled = (windowbottom - top) / (container_height + windowheight); var parallax = math.round(parallax_dist * percentscrolled); if (initial) { $img.css('display', 'block'); } if (bottom > scrolltop && top < scrolltop + windowheight) { $img.css('transform', "translate3d(-50%," + parallax + "px, 0)"); } } // wait for image load $this.children("img").one("load", function () { updateparallax(true); }).each(function () { if (this.complete) $(this).trigger("load"); }); $(window).scroll(function () { window_width = $(window).width(); updateparallax(false); }); $(window).resize(function () { window_width = $(window).width(); updateparallax(false); }); }); }; })(jquery); ;(function ($) { var methods = { init: function (options) { var defaults = { onshow: null, swipeable: false, responsivethreshold: infinity // breakpoint for swipeable }; options = $.extend(defaults, options); var namespace = materialize.objectselectorstring($(this)); return this.each(function (i) { var uniquenamespace = namespace + i; // for each set of tabs, we want to keep track of // which tab is active and its associated content var $this = $(this), window_width = $(window).width(); var $active, $content, $links = $this.find('li.tab a'), $tabs_width = $this.width(), $tabs_content = $(), $tabs_wrapper, $tab_width = math.max($tabs_width, $this[0].scrollwidth) / $links.length, $indicator, index = 0, prev_index = 0, clicked = false, clickedtimeout, transition = 300; // finds right attribute for indicator based on active tab. // el: jquery object var calcrightpos = function (el) { return math.ceil($tabs_width - el.position().left - el[0].getboundingclientrect().width - $this.scrollleft()); }; // finds left attribute for indicator based on active tab. // el: jquery object var calcleftpos = function (el) { return math.floor(el.position().left + $this.scrollleft()); }; // animates indicator to active tab. // prev_index: number var animateindicator = function (prev_index) { if (index - prev_index >= 0) { $indicator.velocity({ "right": calcrightpos($active) }, { duration: transition, queue: false, easing: 'easeoutquad' }); $indicator.velocity({ "left": calcleftpos($active) }, { duration: transition, queue: false, easing: 'easeoutquad', delay: 90 }); } else { $indicator.velocity({ "left": calcleftpos($active) }, { duration: transition, queue: false, easing: 'easeoutquad' }); $indicator.velocity({ "right": calcrightpos($active) }, { duration: transition, queue: false, easing: 'easeoutquad', delay: 90 }); } }; // change swipeable according to responsive threshold if (options.swipeable) { if (window_width > options.responsivethreshold) { options.swipeable = false; } } // if the location.hash matches one of the links, use that as the active tab. $active = $($links.filter('[href="' + location.hash + '"]')); // if no match is found, use the first link or any with class 'active' as the initial active tab. if ($active.length === 0) { $active = $(this).find('li.tab a.active').first(); } if ($active.length === 0) { $active = $(this).find('li.tab a').first(); } $active.addclass('active'); index = $links.index($active); if (index < 0) { index = 0; } if ($active[0] !== undefined) { $content = $($active[0].hash); $content.addclass('active'); } // append indicator then set indicator width to tab width if (!$this.find('.indicator').length) { $this.append('
  • '); } $indicator = $this.find('.indicator'); // we make sure that the indicator is at the end of the tabs $this.append($indicator); if ($this.is(":visible")) { // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)}); // $indicator.css({"left": index * $tab_width}); settimeout(function () { $indicator.css({ "right": calcrightpos($active) }); $indicator.css({ "left": calcleftpos($active) }); }, 0); } $(window).off('resize.tabs-' + uniquenamespace).on('resize.tabs-' + uniquenamespace, function () { $tabs_width = $this.width(); $tab_width = math.max($tabs_width, $this[0].scrollwidth) / $links.length; if (index < 0) { index = 0; } if ($tab_width !== 0 && $tabs_width !== 0) { $indicator.css({ "right": calcrightpos($active) }); $indicator.css({ "left": calcleftpos($active) }); } }); // initialize tabs content. if (options.swipeable) { // todo: duplicate calls with swipeable? handle multiple div wrapping. $links.each(function () { var $curr_content = $(materialize.escapehash(this.hash)); $curr_content.addclass('carousel-item'); $tabs_content = $tabs_content.add($curr_content); }); $tabs_wrapper = $tabs_content.wrapall(''); $tabs_content.css('display', ''); $('.tabs-content.carousel').carousel({ fullwidth: true, nowrap: true, oncycleto: function (item) { if (!clicked) { var prev_index = index; index = $tabs_wrapper.index(item); $active.removeclass('active'); $active = $links.eq(index); $active.addclass('active'); animateindicator(prev_index); if (typeof options.onshow === "function") { options.onshow.call($this[0], $content); } } } }); } else { // hide the remaining content $links.not($active).each(function () { $(materialize.escapehash(this.hash)).hide(); }); } // bind the click event handler $this.off('click.tabs').on('click.tabs', 'a', function (e) { if ($(this).parent().hasclass('disabled')) { e.preventdefault(); return; } // act as regular link if target attribute is specified. if (!!$(this).attr("target")) { return; } clicked = true; $tabs_width = $this.width(); $tab_width = math.max($tabs_width, $this[0].scrollwidth) / $links.length; // make the old tab inactive. $active.removeclass('active'); var $oldcontent = $content; // update the variables with the new link and content $active = $(this); $content = $(materialize.escapehash(this.hash)); $links = $this.find('li.tab a'); var activerect = $active.position(); // make the tab active. $active.addclass('active'); prev_index = index; index = $links.index($(this)); if (index < 0) { index = 0; } // change url to current tab // window.location.hash = $active.attr('href'); // swap content if (options.swipeable) { if ($tabs_content.length) { $tabs_content.carousel('set', index, function () { if (typeof options.onshow === "function") { options.onshow.call($this[0], $content); } }); } } else { if ($content !== undefined) { $content.show(); $content.addclass('active'); if (typeof options.onshow === "function") { options.onshow.call(this, $content); } } if ($oldcontent !== undefined && !$oldcontent.is($content)) { $oldcontent.hide(); $oldcontent.removeclass('active'); } } // reset clicked state clickedtimeout = settimeout(function () { clicked = false; }, transition); // update indicator animateindicator(prev_index); // prevent the anchor's default click action e.preventdefault(); }); }); }, select_tab: function (id) { this.find('a[href="#' + id + '"]').trigger('click'); } }; $.fn.tabs = function (methodoroptions) { if (methods[methodoroptions]) { return methods[methodoroptions].apply(this, array.prototype.slice.call(arguments, 1)); } else if (typeof methodoroptions === 'object' || !methodoroptions) { // default to "init" return methods.init.apply(this, arguments); } else { $.error('method ' + methodoroptions + ' does not exist on jquery.tabs'); } }; $(document).ready(function () { $('ul.tabs').tabs(); }); })(jquery); ;(function ($) { $.fn.tooltip = function (options) { var timeout = null, margin = 5; // defaults var defaults = { delay: 350, tooltip: '', position: 'bottom', html: false }; // remove tooltip from the activator if (options === "remove") { this.each(function () { $('#' + $(this).attr('data-tooltip-id')).remove(); $(this).removeattr('data-tooltip-id'); $(this).off('mouseenter.tooltip mouseleave.tooltip'); }); return false; } options = $.extend(defaults, options); return this.each(function () { var tooltipid = materialize.guid(); var origin = $(this); // destroy old tooltip if (origin.attr('data-tooltip-id')) { $('#' + origin.attr('data-tooltip-id')).remove(); } origin.attr('data-tooltip-id', tooltipid); // get attributes. var allowhtml, tooltipdelay, tooltipposition, tooltiptext, tooltipel, backdrop; var setattributes = function () { allowhtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html; tooltipdelay = origin.attr('data-delay'); tooltipdelay = tooltipdelay === undefined || tooltipdelay === '' ? options.delay : tooltipdelay; tooltipposition = origin.attr('data-position'); tooltipposition = tooltipposition === undefined || tooltipposition === '' ? options.position : tooltipposition; tooltiptext = origin.attr('data-tooltip'); tooltiptext = tooltiptext === undefined || tooltiptext === '' ? options.tooltip : tooltiptext; }; setattributes(); var rendertooltipel = function () { var tooltip = $('
    '); // create text span if (allowhtml) { tooltiptext = $('').html(tooltiptext); } else { tooltiptext = $('').text(tooltiptext); } // create tooltip tooltip.append(tooltiptext).appendto($('body')).attr('id', tooltipid); // create backdrop backdrop = $('
    '); backdrop.appendto(tooltip); return tooltip; }; tooltipel = rendertooltipel(); // destroy previously binded events origin.off('mouseenter.tooltip mouseleave.tooltip'); // mouse in var started = false, timeoutref; origin.on({ 'mouseenter.tooltip': function (e) { var showtooltip = function () { setattributes(); started = true; tooltipel.velocity('stop'); backdrop.velocity('stop'); tooltipel.css({ visibility: 'visible', left: '0px', top: '0px' }); // tooltip positioning var originwidth = origin.outerwidth(); var originheight = origin.outerheight(); var tooltipheight = tooltipel.outerheight(); var tooltipwidth = tooltipel.outerwidth(); var tooltipverticalmovement = '0px'; var tooltiphorizontalmovement = '0px'; var backdropoffsetwidth = backdrop[0].offsetwidth; var backdropoffsetheight = backdrop[0].offsetheight; var scalexfactor = 8; var scaleyfactor = 8; var scalefactor = 0; var targettop, targetleft, newcoordinates; if (tooltipposition === "top") { // top position targettop = origin.offset().top - tooltipheight - margin; targetleft = origin.offset().left + originwidth / 2 - tooltipwidth / 2; newcoordinates = repositionwithinscreen(targetleft, targettop, tooltipwidth, tooltipheight); tooltipverticalmovement = '-10px'; backdrop.css({ bottom: 0, left: 0, borderradius: '14px 14px 0 0', transformorigin: '50% 100%', margintop: tooltipheight, marginleft: tooltipwidth / 2 - backdropoffsetwidth / 2 }); } // left position else if (tooltipposition === "left") { targettop = origin.offset().top + originheight / 2 - tooltipheight / 2; targetleft = origin.offset().left - tooltipwidth - margin; newcoordinates = repositionwithinscreen(targetleft, targettop, tooltipwidth, tooltipheight); tooltiphorizontalmovement = '-10px'; backdrop.css({ top: '-7px', right: 0, width: '14px', height: '14px', borderradius: '14px 0 0 14px', transformorigin: '95% 50%', margintop: tooltipheight / 2, marginleft: tooltipwidth }); } // right position else if (tooltipposition === "right") { targettop = origin.offset().top + originheight / 2 - tooltipheight / 2; targetleft = origin.offset().left + originwidth + margin; newcoordinates = repositionwithinscreen(targetleft, targettop, tooltipwidth, tooltipheight); tooltiphorizontalmovement = '+10px'; backdrop.css({ top: '-7px', left: 0, width: '14px', height: '14px', borderradius: '0 14px 14px 0', transformorigin: '5% 50%', margintop: tooltipheight / 2, marginleft: '0px' }); } else { // bottom position targettop = origin.offset().top + origin.outerheight() + margin; targetleft = origin.offset().left + originwidth / 2 - tooltipwidth / 2; newcoordinates = repositionwithinscreen(targetleft, targettop, tooltipwidth, tooltipheight); tooltipverticalmovement = '+10px'; backdrop.css({ top: 0, left: 0, marginleft: tooltipwidth / 2 - backdropoffsetwidth / 2 }); } // set tooptip css placement tooltipel.css({ top: newcoordinates.y, left: newcoordinates.x }); // calculate scale to fill scalexfactor = math.sqrt2 * tooltipwidth / parseint(backdropoffsetwidth); scaleyfactor = math.sqrt2 * tooltipheight / parseint(backdropoffsetheight); scalefactor = math.max(scalexfactor, scaleyfactor); tooltipel.velocity({ translatey: tooltipverticalmovement, translatex: tooltiphorizontalmovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false }); backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scalex: scalefactor, scaley: scalefactor }, { duration: 300, delay: 0, queue: false, easing: 'easeinoutquad' }); }; timeoutref = settimeout(showtooltip, tooltipdelay); // end interval // mouse out }, 'mouseleave.tooltip': function () { // reset state started = false; cleartimeout(timeoutref); // animate back settimeout(function () { if (started !== true) { tooltipel.velocity({ opacity: 0, translatey: 0, translatex: 0 }, { duration: 225, queue: false }); backdrop.velocity({ opacity: 0, scalex: 1, scaley: 1 }, { duration: 225, queue: false, complete: function () { backdrop.css({ visibility: 'hidden' }); tooltipel.css({ visibility: 'hidden' }); started = false; } }); } }, 225); } }); }); }; var repositionwithinscreen = function (x, y, width, height) { var newx = x; var newy = y; if (newx < 0) { newx = 4; } else if (newx + width > window.innerwidth) { newx -= newx + width - window.innerwidth; } if (newy < 0) { newy = 4; } else if (newy + height > window.innerheight + $(window).scrolltop) { newy -= newy + height - window.innerheight; } return { x: newx, y: newy }; }; $(document).ready(function () { $('.tooltipped').tooltip(); }); })(jquery); ; /*! * waves v0.6.4 * http://fian.my.id/waves * * copyright 2014 alfiana e. sibuea and other contributors * released under the mit license * https://github.com/fians/waves/blob/master/license */ ;(function (window) { 'use strict'; var waves = waves || {}; var $$ = document.queryselectorall.bind(document); // find exact position of element function iswindow(obj) { return obj !== null && obj === obj.window; } function getwindow(elem) { return iswindow(elem) ? elem : elem.nodetype === 9 && elem.defaultview; } function offset(elem) { var docelem, win, box = { top: 0, left: 0 }, doc = elem && elem.ownerdocument; docelem = doc.documentelement; if (typeof elem.getboundingclientrect !== typeof undefined) { box = elem.getboundingclientrect(); } win = getwindow(doc); return { top: box.top + win.pageyoffset - docelem.clienttop, left: box.left + win.pagexoffset - docelem.clientleft }; } function convertstyle(obj) { var style = ''; for (var a in obj) { if (obj.hasownproperty(a)) { style += a + ':' + obj[a] + ';'; } } return style; } var effect = { // effect delay duration: 750, show: function (e, element) { // disable right click if (e.button === 2) { return false; } var el = element || this; // create ripple var ripple = document.createelement('div'); ripple.classname = 'waves-ripple'; el.appendchild(ripple); // get click coordinate and element witdh var pos = offset(el); var relativey = e.pagey - pos.top; var relativex = e.pagex - pos.left; var scale = 'scale(' + el.clientwidth / 100 * 10 + ')'; // support for touch devices if ('touches' in e) { relativey = e.touches[0].pagey - pos.top; relativex = e.touches[0].pagex - pos.left; } // attach data to element ripple.setattribute('data-hold', date.now()); ripple.setattribute('data-scale', scale); ripple.setattribute('data-x', relativex); ripple.setattribute('data-y', relativey); // set ripple position var ripplestyle = { 'top': relativey + 'px', 'left': relativex + 'px' }; ripple.classname = ripple.classname + ' waves-notransition'; ripple.setattribute('style', convertstyle(ripplestyle)); ripple.classname = ripple.classname.replace('waves-notransition', ''); // scale the ripple ripplestyle['-webkit-transform'] = scale; ripplestyle['-moz-transform'] = scale; ripplestyle['-ms-transform'] = scale; ripplestyle['-o-transform'] = scale; ripplestyle.transform = scale; ripplestyle.opacity = '1'; ripplestyle['-webkit-transition-duration'] = effect.duration + 'ms'; ripplestyle['-moz-transition-duration'] = effect.duration + 'ms'; ripplestyle['-o-transition-duration'] = effect.duration + 'ms'; ripplestyle['transition-duration'] = effect.duration + 'ms'; ripplestyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)'; ripplestyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)'; ripplestyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)'; ripplestyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)'; ripple.setattribute('style', convertstyle(ripplestyle)); }, hide: function (e) { touchhandler.touchup(e); var el = this; var width = el.clientwidth * 1.4; // get first ripple var ripple = null; var ripples = el.getelementsbyclassname('waves-ripple'); if (ripples.length > 0) { ripple = ripples[ripples.length - 1]; } else { return false; } var relativex = ripple.getattribute('data-x'); var relativey = ripple.getattribute('data-y'); var scale = ripple.getattribute('data-scale'); // get delay beetween mousedown and mouse leave var diff = date.now() - number(ripple.getattribute('data-hold')); var delay = 350 - diff; if (delay < 0) { delay = 0; } // fade out ripple after delay settimeout(function () { var style = { 'top': relativey + 'px', 'left': relativex + 'px', 'opacity': '0', // duration '-webkit-transition-duration': effect.duration + 'ms', '-moz-transition-duration': effect.duration + 'ms', '-o-transition-duration': effect.duration + 'ms', 'transition-duration': effect.duration + 'ms', '-webkit-transform': scale, '-moz-transform': scale, '-ms-transform': scale, '-o-transform': scale, 'transform': scale }; ripple.setattribute('style', convertstyle(style)); settimeout(function () { try { el.removechild(ripple); } catch (e) { return false; } }, effect.duration); }, delay); }, // little hack to make can perform waves effect wrapinput: function (elements) { for (var a = 0; a < elements.length; a++) { var el = elements[a]; if (el.tagname.tolowercase() === 'input') { var parent = el.parentnode; // if input already have parent just pass through if (parent.tagname.tolowercase() === 'i' && parent.classname.indexof('waves-effect') !== -1) { continue; } // put element class and style to the specified parent var wrapper = document.createelement('i'); wrapper.classname = el.classname + ' waves-input-wrapper'; var elementstyle = el.getattribute('style'); if (!elementstyle) { elementstyle = ''; } wrapper.setattribute('style', elementstyle); el.classname = 'waves-button-input'; el.removeattribute('style'); // put element as child parent.replacechild(wrapper, el); wrapper.appendchild(el); } } } }; /** * disable mousedown event for 500ms during and after touch */ var touchhandler = { /* uses an integer rather than bool so there's no issues with * needing to clear timeouts if another touch event occurred * within the 500ms. cannot mouseup between touchstart and * touchend, nor in the 500ms after touchend. */ touches: 0, allowevent: function (e) { var allow = true; if (e.type === 'touchstart') { touchhandler.touches += 1; //push } else if (e.type === 'touchend' || e.type === 'touchcancel') { settimeout(function () { if (touchhandler.touches > 0) { touchhandler.touches -= 1; //pop after 500ms } }, 500); } else if (e.type === 'mousedown' && touchhandler.touches > 0) { allow = false; } return allow; }, touchup: function (e) { touchhandler.allowevent(e); } }; /** * delegated click handler for .waves-effect element. * returns null when .waves-effect element not in "click tree" */ function getwaveseffectelement(e) { if (touchhandler.allowevent(e) === false) { return null; } var element = null; var target = e.target || e.srcelement; while (target.parentnode !== null) { if (!(target instanceof svgelement) && target.classname.indexof('waves-effect') !== -1) { element = target; break; } target = target.parentnode; } return element; } /** * bubble the click and show effect if .waves-effect elem was found */ function showeffect(e) { var element = getwaveseffectelement(e); if (element !== null) { effect.show(e, element); if ('ontouchstart' in window) { element.addeventlistener('touchend', effect.hide, false); element.addeventlistener('touchcancel', effect.hide, false); } element.addeventlistener('mouseup', effect.hide, false); element.addeventlistener('mouseleave', effect.hide, false); element.addeventlistener('dragend', effect.hide, false); } } waves.displayeffect = function (options) { options = options || {}; if ('duration' in options) { effect.duration = options.duration; } //wrap input inside tag effect.wrapinput($$('.waves-effect')); if ('ontouchstart' in window) { document.body.addeventlistener('touchstart', showeffect, false); } document.body.addeventlistener('mousedown', showeffect, false); }; /** * attach waves to an input element (or any element which doesn't * bubble mouseup/mousedown events). * intended to be used with dynamically loaded forms/inputs, or * where the user doesn't want a delegated click handler. */ waves.attach = function (element) { //future: automatically add waves classes and allow users // to specify them with an options param? eg. light/classic/button if (element.tagname.tolowercase() === 'input') { effect.wrapinput([element]); element = element.parentnode; } if ('ontouchstart' in window) { element.addeventlistener('touchstart', showeffect, false); } element.addeventlistener('mousedown', showeffect, false); }; window.waves = waves; document.addeventlistener('domcontentloaded', function () { waves.displayeffect(); }, false); })(window); ;(function ($, vel) { 'use strict'; var _defaults = { displaylength: infinity, induration: 300, outduration: 375, classname: undefined, completecallback: undefined, activationpercent: 0.8 }; var toast = function () { function toast(message, displaylength, classname, completecallback) { _classcallcheck(this, toast); if (!message) { return; } /** * options for the toast * @member toast#options */ this.options = { displaylength: displaylength, classname: classname, completecallback: completecallback }; this.options = $.extend({}, toast.defaults, this.options); this.message = message; /** * describes current pan state toast * @type {boolean} */ this.panning = false; /** * time remaining until toast is removed */ this.timeremaining = this.options.displaylength; if (toast._toasts.length === 0) { toast._createcontainer(); } // create new toast toast._toasts.push(this); var toastelement = this.createtoast(); toastelement.m_toast = this; this.el = toastelement; this._animatein(); this.settimer(); } _createclass(toast, [{ key: 'createtoast', /** * create toast and append it to toast container */ value: function createtoast() { var toast = document.createelement('div'); toast.classlist.add('toast'); // add custom classes onto toast if (this.options.classname) { var classes = this.options.classname.split(' '); var i = void 0, count = void 0; for (i = 0, count = classes.length; i < count; i++) { toast.classlist.add(classes[i]); } } // set content if (typeof htmlelement === 'object' ? this.message instanceof htmlelement : this.message && typeof this.message === 'object' && this.message !== null && this.message.nodetype === 1 && typeof this.message.nodename === 'string') { toast.appendchild(this.message); // check if it is jquery object } else if (this.message instanceof jquery) { $(toast).append(this.message); // insert as text; } else { toast.innerhtml = this.message; } // append toasft toast._container.appendchild(toast); return toast; } /** * animate in toast */ }, { key: '_animatein', value: function _animatein() { // animate toast in vel(this.el, { top: 0, opacity: 1 }, { duration: 300, easing: 'easeoutcubic', queue: false }); } /** * create setinterval which automatically removes toast when timeremaining >= 0 * has been reached */ }, { key: 'settimer', value: function settimer() { var _this3 = this; if (this.timeremaining !== infinity) { this.counterinterval = setinterval(function () { // if toast is not being dragged, decrease its time remaining if (!_this3.panning) { _this3.timeremaining -= 20; } // animate toast out if (_this3.timeremaining <= 0) { _this3.remove(); } }, 20); } } /** * dismiss toast with animation */ }, { key: 'remove', value: function remove() { var _this4 = this; window.clearinterval(this.counterinterval); var activationdistance = this.el.offsetwidth * this.options.activationpercent; if (this.wasswiped) { this.el.style.transition = 'transform .05s, opacity .05s'; this.el.style.transform = 'translatex(' + activationdistance + 'px)'; this.el.style.opacity = 0; } vel(this.el, { opacity: 0, margintop: '-40px' }, { duration: this.options.outduration, easing: 'easeoutexpo', queue: false, complete: function () { // call the optional callback if (typeof _this4.options.completecallback === 'function') { _this4.options.completecallback(); } // remove toast from dom _this4.el.parentnode.removechild(_this4.el); toast._toasts.splice(toast._toasts.indexof(_this4), 1); if (toast._toasts.length === 0) { toast._removecontainer(); } } }); } }], [{ key: '_createcontainer', /** * append toast container and add event handlers */ value: function _createcontainer() { var container = document.createelement('div'); container.setattribute('id', 'toast-container'); // add event handler container.addeventlistener('touchstart', toast._ondragstart); container.addeventlistener('touchmove', toast._ondragmove); container.addeventlistener('touchend', toast._ondragend); container.addeventlistener('mousedown', toast._ondragstart); document.addeventlistener('mousemove', toast._ondragmove); document.addeventlistener('mouseup', toast._ondragend); document.body.appendchild(container); toast._container = container; } /** * remove toast container and event handlers */ }, { key: '_removecontainer', value: function _removecontainer() { // add event handler document.removeeventlistener('mousemove', toast._ondragmove); document.removeeventlistener('mouseup', toast._ondragend); toast._container.parentnode.removechild(toast._container); toast._container = null; } /** * begin drag handler * @param {event} e */ }, { key: '_ondragstart', value: function _ondragstart(e) { if (e.target && $(e.target).closest('.toast').length) { var $toast = $(e.target).closest('.toast'); var toast = $toast[0].m_toast; toast.panning = true; toast._draggedtoast = toast; toast.el.classlist.add('panning'); toast.el.style.transition = ''; toast.startingxpos = toast._xpos(e); toast.time = date.now(); toast.xpos = toast._xpos(e); } } /** * drag move handler * @param {event} e */ }, { key: '_ondragmove', value: function _ondragmove(e) { if (!!toast._draggedtoast) { e.preventdefault(); var toast = toast._draggedtoast; toast.deltax = math.abs(toast.xpos - toast._xpos(e)); toast.xpos = toast._xpos(e); toast.velocityx = toast.deltax / (date.now() - toast.time); toast.time = date.now(); var totaldeltax = toast.xpos - toast.startingxpos; var activationdistance = toast.el.offsetwidth * toast.options.activationpercent; toast.el.style.transform = 'translatex(' + totaldeltax + 'px)'; toast.el.style.opacity = 1 - math.abs(totaldeltax / activationdistance); } } /** * end drag handler * @param {event} e */ }, { key: '_ondragend', value: function _ondragend(e) { if (!!toast._draggedtoast) { var toast = toast._draggedtoast; toast.panning = false; toast.el.classlist.remove('panning'); var totaldeltax = toast.xpos - toast.startingxpos; var activationdistance = toast.el.offsetwidth * toast.options.activationpercent; var shouldbedismissed = math.abs(totaldeltax) > activationdistance || toast.velocityx > 1; // remove toast if (shouldbedismissed) { toast.wasswiped = true; toast.remove(); // animate toast back to original position } else { toast.el.style.transition = 'transform .2s, opacity .2s'; toast.el.style.transform = ''; toast.el.style.opacity = ''; } toast._draggedtoast = null; } } /** * get x position of mouse or touch event * @param {event} e */ }, { key: '_xpos', value: function _xpos(e) { if (e.targettouches && e.targettouches.length >= 1) { return e.targettouches[0].clientx; } // mouse event return e.clientx; } /** * remove all toasts */ }, { key: 'removeall', value: function removeall() { for (var toastindex in toast._toasts) { toast._toasts[toastindex].remove(); } } }, { key: 'defaults', get: function () { return _defaults; } }]); return toast; }(); /** * @static * @memberof toast * @type {array.} */ toast._toasts = []; /** * @static * @memberof toast */ toast._container = null; /** * @static * @memberof toast * @type {toast} */ toast._draggedtoast = null; materialize.toast = toast; materialize.toast = function (message, displaylength, classname, completecallback) { return new toast(message, displaylength, classname, completecallback); }; })(jquery, materialize.vel); ;(function ($) { var methods = { init: function (options) { var defaults = { menuwidth: 300, edge: 'left', closeonclick: false, draggable: true, onopen: null, onclose: null }; options = $.extend(defaults, options); $(this).each(function () { var $this = $(this); var menuid = $this.attr('data-activates'); var menu = $("#" + menuid); // set to width if (options.menuwidth != 300) { menu.css('width', options.menuwidth); } // add touch area var $dragtarget = $('.drag-target[data-sidenav="' + menuid + '"]'); if (options.draggable) { // regenerate dragtarget if ($dragtarget.length) { $dragtarget.remove(); } $dragtarget = $('
    ').attr('data-sidenav', menuid); $('body').append($dragtarget); } else { $dragtarget = $(); } if (options.edge == 'left') { menu.css('transform', 'translatex(-100%)'); $dragtarget.css({ 'left': 0 }); // add touch area } else { menu.addclass('right-aligned') // change text-alignment to right .css('transform', 'translatex(100%)'); $dragtarget.css({ 'right': 0 }); // add touch area } // if fixed sidenav, bring menu out if (menu.hasclass('fixed')) { if (window.innerwidth > 992) { menu.css('transform', 'translatex(0)'); } } // window resize to reset on large screens fixed if (menu.hasclass('fixed')) { $(window).resize(function () { if (window.innerwidth > 992) { // close menu if window is resized bigger than 992 and user has fixed sidenav if ($('#sidenav-overlay').length !== 0 && menuout) { removemenu(true); } else { // menu.removeattr('style'); menu.css('transform', 'translatex(0%)'); // menu.css('width', options.menuwidth); } } else if (menuout === false) { if (options.edge === 'left') { menu.css('transform', 'translatex(-100%)'); } else { menu.css('transform', 'translatex(100%)'); } } }); } // if closeonclick, then add close event for all a tags in side sidenav if (options.closeonclick === true) { menu.on("click.itemclick", "a:not(.collapsible-header)", function () { if (!(window.innerwidth > 992 && menu.hasclass('fixed'))) { removemenu(); } }); } var removemenu = function (restorenav) { panning = false; menuout = false; // reenable scrolling $('body').css({ overflow: '', width: '' }); $('#sidenav-overlay').velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeoutquad', complete: function () { $(this).remove(); } }); if (options.edge === 'left') { // reset phantom div $dragtarget.css({ width: '', right: '', left: '0' }); menu.velocity({ 'translatex': '-100%' }, { duration: 200, queue: false, easing: 'easeoutcubic', complete: function () { if (restorenav === true) { // restore fixed sidenav menu.removeattr('style'); menu.css('width', options.menuwidth); } } }); } else { // reset phantom div $dragtarget.css({ width: '', right: '0', left: '' }); menu.velocity({ 'translatex': '100%' }, { duration: 200, queue: false, easing: 'easeoutcubic', complete: function () { if (restorenav === true) { // restore fixed sidenav menu.removeattr('style'); menu.css('width', options.menuwidth); } } }); } // callback if (typeof options.onclose === 'function') { options.onclose.call(this, menu); } }; // touch event var panning = false; var menuout = false; if (options.draggable) { $dragtarget.on('click', function () { if (menuout) { removemenu(); } }); $dragtarget.hammer({ prevent_default: false }).on('pan', function (e) { if (e.gesture.pointertype == "touch") { var direction = e.gesture.direction; var x = e.gesture.center.x; var y = e.gesture.center.y; var velocityx = e.gesture.velocityx; // vertical scroll bugfix if (x === 0 && y === 0) { return; } // disable scrolling var $body = $('body'); var $overlay = $('#sidenav-overlay'); var oldwidth = $body.innerwidth(); $body.css('overflow', 'hidden'); $body.width(oldwidth); // if overlay does not exist, create one and if it is clicked, close menu if ($overlay.length === 0) { $overlay = $('
    '); $overlay.css('opacity', 0).click(function () { removemenu(); }); // run 'onopen' when sidenav is opened via touch/swipe if applicable if (typeof options.onopen === 'function') { options.onopen.call(this, menu); } $('body').append($overlay); } // keep within boundaries if (options.edge === 'left') { if (x > options.menuwidth) { x = options.menuwidth; } else if (x < 0) { x = 0; } } if (options.edge === 'left') { // left direction if (x < options.menuwidth / 2) { menuout = false; } // right direction else if (x >= options.menuwidth / 2) { menuout = true; } menu.css('transform', 'translatex(' + (x - options.menuwidth) + 'px)'); } else { // left direction if (x < window.innerwidth - options.menuwidth / 2) { menuout = true; } // right direction else if (x >= window.innerwidth - options.menuwidth / 2) { menuout = false; } var rightpos = x - options.menuwidth / 2; if (rightpos < 0) { rightpos = 0; } menu.css('transform', 'translatex(' + rightpos + 'px)'); } // percentage overlay var overlayperc; if (options.edge === 'left') { overlayperc = x / options.menuwidth; $overlay.velocity({ opacity: overlayperc }, { duration: 10, queue: false, easing: 'easeoutquad' }); } else { overlayperc = math.abs((x - window.innerwidth) / options.menuwidth); $overlay.velocity({ opacity: overlayperc }, { duration: 10, queue: false, easing: 'easeoutquad' }); } } }).on('panend', function (e) { if (e.gesture.pointertype == "touch") { var $overlay = $('#sidenav-overlay'); var velocityx = e.gesture.velocityx; var x = e.gesture.center.x; var leftpos = x - options.menuwidth; var rightpos = x - options.menuwidth / 2; if (leftpos > 0) { leftpos = 0; } if (rightpos < 0) { rightpos = 0; } panning = false; if (options.edge === 'left') { // if velocityx <= 0.3 then the user is flinging the menu closed so ignore menuout if (menuout && velocityx <= 0.3 || velocityx < -0.5) { // return menu to open if (leftpos !== 0) { menu.velocity({ 'translatex': [0, leftpos] }, { duration: 300, queue: false, easing: 'easeoutquad' }); } $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeoutquad' }); $dragtarget.css({ width: '50%', right: 0, left: '' }); menuout = true; } else if (!menuout || velocityx > 0.3) { // enable scrolling $('body').css({ overflow: '', width: '' }); // slide menu closed menu.velocity({ 'translatex': [-1 * options.menuwidth - 10, leftpos] }, { duration: 200, queue: false, easing: 'easeoutquad' }); $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeoutquad', complete: function () { // run 'onclose' when sidenav is closed via touch/swipe if applicable if (typeof options.onclose === 'function') { options.onclose.call(this, menu); } $(this).remove(); } }); $dragtarget.css({ width: '10px', right: '', left: 0 }); } } else { if (menuout && velocityx >= -0.3 || velocityx > 0.5) { // return menu to open if (rightpos !== 0) { menu.velocity({ 'translatex': [0, rightpos] }, { duration: 300, queue: false, easing: 'easeoutquad' }); } $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeoutquad' }); $dragtarget.css({ width: '50%', right: '', left: 0 }); menuout = true; } else if (!menuout || velocityx < -0.3) { // enable scrolling $('body').css({ overflow: '', width: '' }); // slide menu closed menu.velocity({ 'translatex': [options.menuwidth + 10, rightpos] }, { duration: 200, queue: false, easing: 'easeoutquad' }); $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeoutquad', complete: function () { // run 'onclose' when sidenav is closed via touch/swipe if applicable if (typeof options.onclose === 'function') { options.onclose.call(this, menu); } $(this).remove(); } }); $dragtarget.css({ width: '10px', right: 0, left: '' }); } } } }); } $this.off('click.sidenav').on('click.sidenav', function () { if (menuout === true) { menuout = false; panning = false; removemenu(); } else { // disable scrolling var $body = $('body'); var $overlay = $('
    '); var oldwidth = $body.innerwidth(); $body.css('overflow', 'hidden'); $body.width(oldwidth); // push current drag target on top of dom tree $('body').append($dragtarget); if (options.edge === 'left') { $dragtarget.css({ width: '50%', right: 0, left: '' }); menu.velocity({ 'translatex': [0, -1 * options.menuwidth] }, { duration: 300, queue: false, easing: 'easeoutquad' }); } else { $dragtarget.css({ width: '50%', right: '', left: 0 }); menu.velocity({ 'translatex': [0, options.menuwidth] }, { duration: 300, queue: false, easing: 'easeoutquad' }); } // overlay close on click $overlay.css('opacity', 0).click(function () { menuout = false; panning = false; removemenu(); $overlay.velocity({ opacity: 0 }, { duration: 300, queue: false, easing: 'easeoutquad', complete: function () { $(this).remove(); } }); }); // append body $('body').append($overlay); $overlay.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeoutquad', complete: function () { menuout = true; panning = false; } }); // callback if (typeof options.onopen === 'function') { options.onopen.call(this, menu); } } return false; }); }); }, destroy: function () { var $overlay = $('#sidenav-overlay'); var $dragtarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]'); $overlay.trigger('click'); $dragtarget.remove(); $(this).off('click'); $overlay.remove(); }, show: function () { this.trigger('click'); }, hide: function () { $('#sidenav-overlay').trigger('click'); } }; $.fn.sidenav = function (methodoroptions) { if (methods[methodoroptions]) { return methods[methodoroptions].apply(this, array.prototype.slice.call(arguments, 1)); } else if (typeof methodoroptions === 'object' || !methodoroptions) { // default to "init" return methods.init.apply(this, arguments); } else { $.error('method ' + methodoroptions + ' does not exist on jquery.sidenav'); } }; // plugin end })(jquery); ; /** * extend jquery with a scrollspy plugin. * this watches the window scroll and fires events when elements are scrolled into viewport. * * throttle() and gettime() taken from underscore.js * https://github.com/jashkenas/underscore * * @author copyright 2013 john smart * @license https://raw.github.com/thesmart/jquery-scrollspy/master/license * @see https://github.com/thesmart * @version 0.1.2 */ (function ($) { var jwindow = $(window); var elements = []; var elementsinview = []; var isspying = false; var ticks = 0; var unique_id = 1; var offset = { top: 0, right: 0, bottom: 0, left: 0 /** * find elements that are within the boundary * @param {number} top * @param {number} right * @param {number} bottom * @param {number} left * @return {jquery} a collection of elements */ };function findelements(top, right, bottom, left) { var hits = $(); $.each(elements, function (i, element) { if (element.height() > 0) { var eltop = element.offset().top, elleft = element.offset().left, elright = elleft + element.width(), elbottom = eltop + element.height(); var isintersect = !(elleft > right || elright < left || eltop > bottom || elbottom < top); if (isintersect) { hits.push(element); } } }); return hits; } /** * called when the user scrolls the window */ function onscroll(scrolloffset) { // unique tick id ++ticks; // viewport rectangle var top = jwindow.scrolltop(), left = jwindow.scrollleft(), right = left + jwindow.width(), bottom = top + jwindow.height(); // determine which elements are in view var intersections = findelements(top + offset.top + scrolloffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left); $.each(intersections, function (i, element) { var lasttick = element.data('scrollspy:ticks'); if (typeof lasttick != 'number') { // entered into view element.triggerhandler('scrollspy:enter'); } // update tick id element.data('scrollspy:ticks', ticks); }); // determine which elements are no longer in view $.each(elementsinview, function (i, element) { var lasttick = element.data('scrollspy:ticks'); if (typeof lasttick == 'number' && lasttick !== ticks) { // exited from view element.triggerhandler('scrollspy:exit'); element.data('scrollspy:ticks', null); } }); // remember elements in view for next tick elementsinview = intersections; } /** * called when window is resized */ function onwinsize() { jwindow.trigger('scrollspy:winsize'); } /** * enables scrollspy using a selector * @param {jquery|string} selector the elements collection, or a selector * @param {object=} options optional. throttle : number -> scrollspy throttling. default: 100 ms offsettop : number -> offset from top. default: 0 offsetright : number -> offset from right. default: 0 offsetbottom : number -> offset from bottom. default: 0 offsetleft : number -> offset from left. default: 0 activeclass : string -> class name to be added to the active link. default: active * @returns {jquery} */ $.scrollspy = function (selector, options) { var defaults = { throttle: 100, scrolloffset: 200, // offset - 200 allows elements near bottom of page to scroll activeclass: 'active', getactiveelement: function (id) { return 'a[href="#' + id + '"]'; } }; options = $.extend(defaults, options); var visible = []; selector = $(selector); selector.each(function (i, element) { elements.push($(element)); $(element).data("scrollspy:id", i); // smooth scroll to section $('a[href="#' + $(element).attr('id') + '"]').click(function (e) { e.preventdefault(); var offset = $(materialize.escapehash(this.hash)).offset().top + 1; $('html, body').animate({ scrolltop: offset - options.scrolloffset }, { duration: 400, queue: false, easing: 'easeoutcubic' }); }); }); offset.top = options.offsettop || 0; offset.right = options.offsetright || 0; offset.bottom = options.offsetbottom || 0; offset.left = options.offsetleft || 0; var throttledscroll = materialize.throttle(function () { onscroll(options.scrolloffset); }, options.throttle || 100); var readyscroll = function () { $(document).ready(throttledscroll); }; if (!isspying) { jwindow.on('scroll', readyscroll); jwindow.on('resize', readyscroll); isspying = true; } // perform a scan once, after current execution context, and after dom is ready settimeout(readyscroll, 0); selector.on('scrollspy:enter', function () { visible = $.grep(visible, function (value) { return value.height() != 0; }); var $this = $(this); if (visible[0]) { $(options.getactiveelement(visible[0].attr('id'))).removeclass(options.activeclass); if ($this.data('scrollspy:id') < visible[0].data('scrollspy:id')) { visible.unshift($(this)); } else { visible.push($(this)); } } else { visible.push($(this)); } $(options.getactiveelement(visible[0].attr('id'))).addclass(options.activeclass); }); selector.on('scrollspy:exit', function () { visible = $.grep(visible, function (value) { return value.height() != 0; }); if (visible[0]) { $(options.getactiveelement(visible[0].attr('id'))).removeclass(options.activeclass); var $this = $(this); visible = $.grep(visible, function (value) { return value.attr('id') != $this.attr('id'); }); if (visible[0]) { // check if empty $(options.getactiveelement(visible[0].attr('id'))).addclass(options.activeclass); } } }); return selector; }; /** * listen for window resize events * @param {object=} options optional. set { throttle: number } to change throttling. default: 100 ms * @returns {jquery} $(window) */ $.winsizespy = function (options) { $.winsizespy = function () { return jwindow; }; // lock from multiple calls options = options || { throttle: 100 }; return jwindow.on('resize', materialize.throttle(onwinsize, options.throttle || 100)); }; /** * enables scrollspy on a collection of elements * e.g. $('.scrollspy').scrollspy() * @param {object=} options optional. throttle : number -> scrollspy throttling. default: 100 ms offsettop : number -> offset from top. default: 0 offsetright : number -> offset from right. default: 0 offsetbottom : number -> offset from bottom. default: 0 offsetleft : number -> offset from left. default: 0 * @returns {jquery} */ $.fn.scrollspy = function (options) { return $.scrollspy($(this), options); }; })(jquery); ;(function ($) { $(document).ready(function () { // function to update labels of text fields materialize.updatetextfields = function () { var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea'; $(input_selector).each(function (index, element) { var $this = $(this); if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) { $this.siblings('label').addclass('active'); } else if ($(element)[0].validity) { $this.siblings('label').toggleclass('active', $(element)[0].validity.badinput === true); } else { $this.siblings('label').removeclass('active'); } }); }; // text based inputs var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea'; // add active if form auto complete $(document).on('change', input_selector, function () { if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) { $(this).siblings('label').addclass('active'); } validate_field($(this)); }); // add active if input element has been pre-populated on document ready $(document).ready(function () { materialize.updatetextfields(); }); // html dom form reset handling $(document).on('reset', function (e) { var formreset = $(e.target); if (formreset.is('form')) { formreset.find(input_selector).removeclass('valid').removeclass('invalid'); formreset.find(input_selector).each(function () { if ($(this).attr('value') === '') { $(this).siblings('label').removeclass('active'); } }); // reset select formreset.find('select.initialized').each(function () { var reset_text = formreset.find('option[selected]').text(); formreset.siblings('input.select-dropdown').val(reset_text); }); } }); // add active when element has focus $(document).on('focus', input_selector, function () { $(this).siblings('label, .prefix').addclass('active'); }); $(document).on('blur', input_selector, function () { var $inputelement = $(this); var selector = ".prefix"; if ($inputelement.val().length === 0 && $inputelement[0].validity.badinput !== true && $inputelement.attr('placeholder') === undefined) { selector += ", label"; } $inputelement.siblings(selector).removeclass('active'); validate_field($inputelement); }); window.validate_field = function (object) { var haslength = object.attr('data-length') !== undefined; var lenattr = parseint(object.attr('data-length')); var len = object.val().length; if (object.val().length === 0 && object[0].validity.badinput === false && !object.is(':required')) { if (object.hasclass('validate')) { object.removeclass('valid'); object.removeclass('invalid'); } } else { if (object.hasclass('validate')) { // check for character counter attributes if (object.is(':valid') && haslength && len <= lenattr || object.is(':valid') && !haslength) { object.removeclass('invalid'); object.addclass('valid'); } else { object.removeclass('valid'); object.addclass('invalid'); } } } }; // radio and checkbox focus class var radio_checkbox = 'input[type=radio], input[type=checkbox]'; $(document).on('keyup.radio', radio_checkbox, function (e) { // tab, check if tabbing to radio or checkbox. if (e.which === 9) { $(this).addclass('tabbed'); var $this = $(this); $this.one('blur', function (e) { $(this).removeclass('tabbed'); }); return; } }); // textarea auto resize var hiddendiv = $('.hiddendiv').first(); if (!hiddendiv.length) { hiddendiv = $('
    '); $('body').append(hiddendiv); } var text_area_selector = '.materialize-textarea'; function textareaautoresize($textarea) { // set font properties of hiddendiv var fontfamily = $textarea.css('font-family'); var fontsize = $textarea.css('font-size'); var lineheight = $textarea.css('line-height'); var padding = $textarea.css('padding'); if (fontsize) { hiddendiv.css('font-size', fontsize); } if (fontfamily) { hiddendiv.css('font-family', fontfamily); } if (lineheight) { hiddendiv.css('line-height', lineheight); } if (padding) { hiddendiv.css('padding', padding); } // set original-height, if none if (!$textarea.data('original-height')) { $textarea.data('original-height', $textarea.height()); } if ($textarea.attr('wrap') === 'off') { hiddendiv.css('overflow-wrap', 'normal').css('white-space', 'pre'); } hiddendiv.text($textarea.val() + '\n'); var content = hiddendiv.html().replace(/\n/g, '
    '); hiddendiv.html(content); // when textarea is hidden, width goes crazy. // approximate with half of window size if ($textarea.is(':visible')) { hiddendiv.css('width', $textarea.width()); } else { hiddendiv.css('width', $(window).width() / 2); } /** * resize if the new height is greater than the * original height of the textarea */ if ($textarea.data('original-height') <= hiddendiv.height()) { $textarea.css('height', hiddendiv.height()); } else if ($textarea.val().length < $textarea.data('previous-length')) { /** * in case the new height is less than original height, it * means the textarea has less text than before * so we set the height to the original one */ $textarea.css('height', $textarea.data('original-height')); } $textarea.data('previous-length', $textarea.val().length); } $(text_area_selector).each(function () { var $textarea = $(this); /** * instead of resizing textarea on document load, * store the original height and the original length */ $textarea.data('original-height', $textarea.height()); $textarea.data('previous-length', $textarea.val().length); }); $('body').on('keyup keydown autoresize', text_area_selector, function () { textareaautoresize($(this)); }); // file input path $(document).on('change', '.file-field input[type="file"]', function () { var file_field = $(this).closest('.file-field'); var path_input = file_field.find('input.file-path'); var files = $(this)[0].files; var file_names = []; for (var i = 0; i < files.length; i++) { file_names.push(files[i].name); } path_input.val(file_names.join(", ")); path_input.trigger('change'); }); /**************** * range input * ****************/ var range_type = 'input[type=range]'; var range_mousedown = false; var left; $(range_type).each(function () { var thumb = $(''); $(this).after(thumb); }); var showrangebubble = function (thumb) { var paddingleft = parseint(thumb.parent().css('padding-left')); var marginleft = -7 + paddingleft + 'px'; thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginleft: marginleft }, { duration: 300, easing: 'easeoutexpo' }); }; var calcrangeoffset = function (range) { var width = range.width() - 15; var max = parsefloat(range.attr('max')); var min = parsefloat(range.attr('min')); var percent = (parsefloat(range.val()) - min) / (max - min); return percent * width; }; var range_wrapper = '.range-field'; $(document).on('change', range_type, function (e) { var thumb = $(this).siblings('.thumb'); thumb.find('.value').html($(this).val()); if (!thumb.hasclass('active')) { showrangebubble(thumb); } var offsetleft = calcrangeoffset($(this)); thumb.addclass('active').css('left', offsetleft); }); $(document).on('mousedown touchstart', range_type, function (e) { var thumb = $(this).siblings('.thumb'); // if thumb indicator does not exist yet, create it if (thumb.length <= 0) { thumb = $(''); $(this).after(thumb); } // set indicator value thumb.find('.value').html($(this).val()); range_mousedown = true; $(this).addclass('active'); if (!thumb.hasclass('active')) { showrangebubble(thumb); } if (e.type !== 'input') { var offsetleft = calcrangeoffset($(this)); thumb.addclass('active').css('left', offsetleft); } }); $(document).on('mouseup touchend', range_wrapper, function () { range_mousedown = false; $(this).removeclass('active'); }); $(document).on('input mousemove touchmove', range_wrapper, function (e) { var thumb = $(this).children('.thumb'); var left; var input = $(this).find(range_type); if (range_mousedown) { if (!thumb.hasclass('active')) { showrangebubble(thumb); } var offsetleft = calcrangeoffset(input); thumb.addclass('active').css('left', offsetleft); thumb.find('.value').html(thumb.siblings(range_type).val()); } }); $(document).on('mouseout touchleave', range_wrapper, function () { if (!range_mousedown) { var thumb = $(this).children('.thumb'); var paddingleft = parseint($(this).css('padding-left')); var marginleft = 7 + paddingleft + 'px'; if (thumb.hasclass('active')) { thumb.velocity({ height: '0', width: '0', top: '10px', marginleft: marginleft }, { duration: 100 }); } thumb.removeclass('active'); } }); /************************** * auto complete plugin * *************************/ $.fn.autocomplete = function (options) { // defaults var defaults = { data: {}, limit: infinity, onautocomplete: null, minlength: 1 }; options = $.extend(defaults, options); return this.each(function () { var $input = $(this); var data = options.data, count = 0, activeindex = -1, oldval, $inputdiv = $input.closest('.input-field'); // div to append on // check if data isn't empty if (!$.isemptyobject(data)) { var $autocomplete = $(''); var $oldautocomplete; // append autocomplete element. // prevent double structure init. if ($inputdiv.length) { $oldautocomplete = $inputdiv.children('.autocomplete-content.dropdown-content').first(); if (!$oldautocomplete.length) { $inputdiv.append($autocomplete); // set ul in body } } else { $oldautocomplete = $input.next('.autocomplete-content.dropdown-content'); if (!$oldautocomplete.length) { $input.after($autocomplete); } } if ($oldautocomplete.length) { $autocomplete = $oldautocomplete; } // highlight partial match. var highlight = function (string, $el) { var img = $el.find('img'); var matchstart = $el.text().tolowercase().indexof("" + string.tolowercase() + ""), matchend = matchstart + string.length - 1, beforematch = $el.text().slice(0, matchstart), matchtext = $el.text().slice(matchstart, matchend + 1), aftermatch = $el.text().slice(matchend + 1); $el.html("" + beforematch + "" + matchtext + "" + aftermatch + ""); if (img.length) { $el.prepend(img); } }; // reset current element position var resetcurrentelement = function () { activeindex = -1; $autocomplete.find('.active').removeclass('active'); }; // remove autocomplete elements var removeautocomplete = function () { $autocomplete.empty(); resetcurrentelement(); oldval = undefined; }; $input.off('blur.autocomplete').on('blur.autocomplete', function () { removeautocomplete(); }); // perform search $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) { // reset count. count = 0; var val = $input.val().tolowercase(); // don't capture enter or arrow key usage. if (e.which === 13 || e.which === 38 || e.which === 40) { return; } // check if the input isn't empty if (oldval !== val) { removeautocomplete(); if (val.length >= options.minlength) { for (var key in data) { if (data.hasownproperty(key) && key.tolowercase().indexof(val) !== -1) { // break if past limit if (count >= options.limit) { break; } var autocompleteoption = $('
  • '); if (!!data[key]) { autocompleteoption.append('' + key + ''); } else { autocompleteoption.append('' + key + ''); } $autocomplete.append(autocompleteoption); highlight(val, autocompleteoption); count++; } } } } // update oldval oldval = val; }); $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) { // arrow keys and enter key usage var keycode = e.which, lielement, numitems = $autocomplete.children('li').length, $active = $autocomplete.children('.active').first(); // select element on enter if (keycode === 13 && activeindex >= 0) { lielement = $autocomplete.children('li').eq(activeindex); if (lielement.length) { lielement.trigger('mousedown.autocomplete'); e.preventdefault(); } return; } // capture up and down key if (keycode === 38 || keycode === 40) { e.preventdefault(); if (keycode === 38 && activeindex > 0) { activeindex--; } if (keycode === 40 && activeindex < numitems - 1) { activeindex++; } $active.removeclass('active'); if (activeindex >= 0) { $autocomplete.children('li').eq(activeindex).addclass('active'); } } }); // set input value $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () { var text = $(this).text().trim(); $input.val(text); $input.trigger('change'); removeautocomplete(); // handle onautocomplete callback. if (typeof options.onautocomplete === "function") { options.onautocomplete.call(this, text); } }); // empty data } else { $input.off('keyup.autocomplete focus.autocomplete'); } }); }; }); // end of $(document).ready /******************* * select plugin * ******************/ $.fn.material_select = function (callback) { $(this).each(function () { var $select = $(this); if ($select.hasclass('browser-default')) { return; // continue to next (return false breaks out of entire loop) } var multiple = $select.attr('multiple') ? true : false, lastid = $select.attr('data-select-id'); // tear down structure if select needs to be rebuilt if (lastid) { $select.parent().find('span.caret').remove(); $select.parent().find('input').remove(); $select.unwrap(); $('ul#select-options-' + lastid).remove(); } // if destroying the select, remove the selelct-id and reset it to it's uninitialized state. if (callback === 'destroy') { $select.removeattr('data-select-id').removeclass('initialized'); $(window).off('click.select'); return; } var uniqueid = materialize.guid(); $select.attr('data-select-id', uniqueid); var wrapper = $('
    '); wrapper.addclass($select.attr('class')); if ($select.is(':disabled')) wrapper.addclass('disabled'); var options = $(''), selectchildren = $select.children('option, optgroup'), valuesselected = [], optionshover = false; var label = $select.find('option:selected').html() || $select.find('option:first').html() || ""; // function that renders and appends the option taking into // account type and possible image icon. var appendoptionwithicon = function (select, option, type) { // add disabled attr if disabled var disabledclass = option.is(':disabled') ? 'disabled ' : ''; var optgroupclass = type === 'optgroup-option' ? 'optgroup-option ' : ''; var multiplecheckbox = multiple ? '' : ''; // add icons var icon_url = option.data('icon'); var classes = option.attr('class'); if (!!icon_url) { var classstring = ''; if (!!classes) classstring = ' class="' + classes + '"'; // check for multiple type. options.append($('
  • ' + multiplecheckbox + option.html() + '
  • ')); return true; } // check for multiple type. options.append($('
  • ' + multiplecheckbox + option.html() + '
  • ')); }; /* create dropdown structure. */ if (selectchildren.length) { selectchildren.each(function () { if ($(this).is('option')) { // direct descendant option. if (multiple) { appendoptionwithicon($select, $(this), 'multiple'); } else { appendoptionwithicon($select, $(this)); } } else if ($(this).is('optgroup')) { // optgroup. var selectoptions = $(this).children('option'); options.append($('
  • ' + $(this).attr('label') + '
  • ')); selectoptions.each(function () { appendoptionwithicon($select, $(this), 'optgroup-option'); }); } }); } options.find('li:not(.optgroup)').each(function (i) { $(this).click(function (e) { // check if option element is disabled if (!$(this).hasclass('disabled') && !$(this).hasclass('optgroup')) { var selected = true; if (multiple) { $('input[type="checkbox"]', this).prop('checked', function (i, v) { return !v; }); selected = toggleentryfromarray(valuesselected, i, $select); $newselect.trigger('focus'); } else { options.find('li').removeclass('active'); $(this).toggleclass('active'); $newselect.val($(this).text()); } activateoption(options, $(this)); $select.find('option').eq(i).prop('selected', selected); // trigger onchange() event $select.trigger('change'); if (typeof callback !== 'undefined') callback(); } e.stoppropagation(); }); }); // wrap elements $select.wrap(wrapper); // add select display element var dropdownicon = $(''); // escape double quotes var sanitizedlabelhtml = label.replace(/"/g, '"'); var $newselect = $(''); $select.before($newselect); $newselect.before(dropdownicon); $newselect.after(options); // check if section element is disabled if (!$select.is(':disabled')) { $newselect.dropdown({ 'hover': false }); } // copy tabindex if ($select.attr('tabindex')) { $($newselect[0]).attr('tabindex', $select.attr('tabindex')); } $select.addclass('initialized'); $newselect.on({ 'focus': function () { if ($('ul.select-dropdown').not(options[0]).is(':visible')) { $('input.select-dropdown').trigger('close'); $(window).off('click.select'); } if (!options.is(':visible')) { $(this).trigger('open', ['focus']); var label = $(this).val(); if (multiple && label.indexof(',') >= 0) { label = label.split(',')[0]; } var selectedoption = options.find('li').filter(function () { return $(this).text().tolowercase() === label.tolowercase(); })[0]; activateoption(options, selectedoption, true); $(window).off('click.select').on('click.select', function () { multiple && (optionshover || $newselect.trigger('close')); $(window).off('click.select'); }); } }, 'click': function (e) { e.stoppropagation(); } }); $newselect.on('blur', function () { if (!multiple) { $(this).trigger('close'); $(window).off('click.select'); } options.find('li.selected').removeclass('selected'); }); options.hover(function () { optionshover = true; }, function () { optionshover = false; }); // add initial multiple selections. if (multiple) { $select.find("option:selected:not(:disabled)").each(function () { var index = this.index; toggleentryfromarray(valuesselected, index, $select); options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true); }); } /** * make option as selected and scroll to selected position * @param {jquery} collection select options jquery element * @param {element} newoption element of the new option * @param {boolean} firstactivation if on first activation of select */ var activateoption = function (collection, newoption, firstactivation) { if (newoption) { collection.find('li.selected').removeclass('selected'); var option = $(newoption); option.addclass('selected'); if (!multiple || !!firstactivation) { options.scrollto(option); } } }; // allow user to search by typing // this array is cleared after 1 second var filterquery = [], onkeydown = function (e) { // tab - switch to another input if (e.which == 9) { $newselect.trigger('close'); return; } // arrow down when select is closed - open select options if (e.which == 40 && !options.is(':visible')) { $newselect.trigger('open'); return; } // enter when select is closed - submit form if (e.which == 13 && !options.is(':visible')) { return; } e.preventdefault(); // case when user type letters var letter = string.fromcharcode(e.which).tolowercase(), nonletters = [9, 13, 27, 38, 40]; if (letter && nonletters.indexof(e.which) === -1) { filterquery.push(letter); var string = filterquery.join(''), newoption = options.find('li').filter(function () { return $(this).text().tolowercase().indexof(string) === 0; })[0]; if (newoption) { activateoption(options, newoption); } } // enter - select option and close when select options are opened if (e.which == 13) { var activeoption = options.find('li.selected:not(.disabled)')[0]; if (activeoption) { $(activeoption).trigger('click'); if (!multiple) { $newselect.trigger('close'); } } } // arrow down - move to next not disabled option if (e.which == 40) { if (options.find('li.selected').length) { newoption = options.find('li.selected').next('li:not(.disabled)')[0]; } else { newoption = options.find('li:not(.disabled)')[0]; } activateoption(options, newoption); } // esc - close options if (e.which == 27) { $newselect.trigger('close'); } // arrow up - move to previous not disabled option if (e.which == 38) { newoption = options.find('li.selected').prev('li:not(.disabled)')[0]; if (newoption) activateoption(options, newoption); } // automaticaly clean filter query so user can search again by starting letters settimeout(function () { filterquery = []; }, 1000); }; $newselect.on('keydown', onkeydown); }); function toggleentryfromarray(entriesarray, entryindex, select) { var index = entriesarray.indexof(entryindex), notadded = index === -1; if (notadded) { entriesarray.push(entryindex); } else { entriesarray.splice(index, 1); } select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryindex).toggleclass('active'); // use notadded instead of true (to detect if the option is selected or not) select.find('option').eq(entryindex).prop('selected', notadded); setvaluetoinput(entriesarray, select); return notadded; } function setvaluetoinput(entriesarray, select) { var value = ''; for (var i = 0, count = entriesarray.length; i < count; i++) { var text = select.find('option').eq(entriesarray[i]).text(); i === 0 ? value += text : value += ', ' + text; } if (value === '') { value = select.find('option:disabled').eq(0).text(); } select.siblings('input.select-dropdown').val(value); } }; })(jquery); ;(function ($) { var methods = { init: function (options) { var defaults = { indicators: true, height: 400, transition: 500, interval: 6000 }; options = $.extend(defaults, options); return this.each(function () { // for each slider, we want to keep track of // which slide is active and its associated content var $this = $(this); var $slider = $this.find('ul.slides').first(); var $slides = $slider.find('> li'); var $active_index = $slider.find('.active').index(); var $active, $indicators, $interval; if ($active_index != -1) { $active = $slides.eq($active_index); } // transitions the caption depending on alignment function captiontransition(caption, duration) { if (caption.hasclass("center-align")) { caption.velocity({ opacity: 0, translatey: -100 }, { duration: duration, queue: false }); } else if (caption.hasclass("right-align")) { caption.velocity({ opacity: 0, translatex: 100 }, { duration: duration, queue: false }); } else if (caption.hasclass("left-align")) { caption.velocity({ opacity: 0, translatex: -100 }, { duration: duration, queue: false }); } } // this function will transition the slide to any index of the next slide function movetoslide(index) { // wrap around indices. if (index >= $slides.length) index = 0;else if (index < 0) index = $slides.length - 1; $active_index = $slider.find('.active').index(); // only do if index changes if ($active_index != index) { $active = $slides.eq($active_index); $caption = $active.find('.caption'); $active.removeclass('active'); $active.velocity({ opacity: 0 }, { duration: options.transition, queue: false, easing: 'easeoutquad', complete: function () { $slides.not('.active').velocity({ opacity: 0, translatex: 0, translatey: 0 }, { duration: 0, queue: false }); } }); captiontransition($caption, options.transition); // update indicators if (options.indicators) { $indicators.eq($active_index).removeclass('active'); } $slides.eq(index).velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeoutquad' }); $slides.eq(index).find('.caption').velocity({ opacity: 1, translatex: 0, translatey: 0 }, { duration: options.transition, delay: options.transition, queue: false, easing: 'easeoutquad' }); $slides.eq(index).addclass('active'); // update indicators if (options.indicators) { $indicators.eq(index).addclass('active'); } } } // set height of slider // if fullscreen, do nothing if (!$this.hasclass('fullscreen')) { if (options.indicators) { // add height if indicators are present $this.height(options.height + 40); } else { $this.height(options.height); } $slider.height(options.height); } // set initial positions of captions $slides.find('.caption').each(function () { captiontransition($(this), 0); }); // move img src into background-image $slides.find('img').each(function () { var placeholderbase64 = 'data:image/gif;base64,r0lgodlhaqabaiabap///waaach5baekaaealaaaaaabaaeaaaictaeaow=='; if ($(this).attr('src') !== placeholderbase64) { $(this).css('background-image', 'url("' + $(this).attr('src') + '")'); $(this).attr('src', placeholderbase64); } }); // dynamically add indicators if (options.indicators) { $indicators = $(''); $slides.each(function (index) { var $indicator = $('
  • '); // handle clicks on indicators $indicator.click(function () { var $parent = $slider.parent(); var curr_index = $parent.find($(this)).index(); movetoslide(curr_index); // reset interval clearinterval($interval); $interval = setinterval(function () { $active_index = $slider.find('.active').index(); if ($slides.length == $active_index + 1) $active_index = 0; // loop to start else $active_index += 1; movetoslide($active_index); }, options.transition + options.interval); }); $indicators.append($indicator); }); $this.append($indicators); $indicators = $this.find('ul.indicators').find('li.indicator-item'); } if ($active) { $active.show(); } else { $slides.first().addclass('active').velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeoutquad' }); $active_index = 0; $active = $slides.eq($active_index); // update indicators if (options.indicators) { $indicators.eq($active_index).addclass('active'); } } // adjust height to current slide $active.find('img').each(function () { $active.find('.caption').velocity({ opacity: 1, translatex: 0, translatey: 0 }, { duration: options.transition, queue: false, easing: 'easeoutquad' }); }); // auto scroll $interval = setinterval(function () { $active_index = $slider.find('.active').index(); movetoslide($active_index + 1); }, options.transition + options.interval); // hammerjs, swipe navigation // touch event var panning = false; var swipeleft = false; var swiperight = false; $this.hammer({ prevent_default: false }).on('pan', function (e) { if (e.gesture.pointertype === "touch") { // reset interval clearinterval($interval); var direction = e.gesture.direction; var x = e.gesture.deltax; var velocityx = e.gesture.velocityx; var velocityy = e.gesture.velocityy; $curr_slide = $slider.find('.active'); if (math.abs(velocityx) > math.abs(velocityy)) { $curr_slide.velocity({ translatex: x }, { duration: 50, queue: false, easing: 'easeoutquad' }); } // swipe left if (direction === 4 && (x > $this.innerwidth() / 2 || velocityx < -0.65)) { swiperight = true; } // swipe right else if (direction === 2 && (x < -1 * $this.innerwidth() / 2 || velocityx > 0.65)) { swipeleft = true; } // make slide behind active slide visible var next_slide; if (swipeleft) { next_slide = $curr_slide.next(); if (next_slide.length === 0) { next_slide = $slides.first(); } next_slide.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeoutquad' }); } if (swiperight) { next_slide = $curr_slide.prev(); if (next_slide.length === 0) { next_slide = $slides.last(); } next_slide.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeoutquad' }); } } }).on('panend', function (e) { if (e.gesture.pointertype === "touch") { $curr_slide = $slider.find('.active'); panning = false; curr_index = $slider.find('.active').index(); if (!swiperight && !swipeleft || $slides.length <= 1) { // return to original spot $curr_slide.velocity({ translatex: 0 }, { duration: 300, queue: false, easing: 'easeoutquad' }); } else if (swipeleft) { movetoslide(curr_index + 1); $curr_slide.velocity({ translatex: -1 * $this.innerwidth() }, { duration: 300, queue: false, easing: 'easeoutquad', complete: function () { $curr_slide.velocity({ opacity: 0, translatex: 0 }, { duration: 0, queue: false }); } }); } else if (swiperight) { movetoslide(curr_index - 1); $curr_slide.velocity({ translatex: $this.innerwidth() }, { duration: 300, queue: false, easing: 'easeoutquad', complete: function () { $curr_slide.velocity({ opacity: 0, translatex: 0 }, { duration: 0, queue: false }); } }); } swipeleft = false; swiperight = false; // restart interval clearinterval($interval); $interval = setinterval(function () { $active_index = $slider.find('.active').index(); if ($slides.length == $active_index + 1) $active_index = 0; // loop to start else $active_index += 1; movetoslide($active_index); }, options.transition + options.interval); } }); $this.on('sliderpause', function () { clearinterval($interval); }); $this.on('sliderstart', function () { clearinterval($interval); $interval = setinterval(function () { $active_index = $slider.find('.active').index(); if ($slides.length == $active_index + 1) $active_index = 0; // loop to start else $active_index += 1; movetoslide($active_index); }, options.transition + options.interval); }); $this.on('slidernext', function () { $active_index = $slider.find('.active').index(); movetoslide($active_index + 1); }); $this.on('sliderprev', function () { $active_index = $slider.find('.active').index(); movetoslide($active_index - 1); }); }); }, pause: function () { $(this).trigger('sliderpause'); }, start: function () { $(this).trigger('sliderstart'); }, next: function () { $(this).trigger('slidernext'); }, prev: function () { $(this).trigger('sliderprev'); } }; $.fn.slider = function (methodoroptions) { if (methods[methodoroptions]) { return methods[methodoroptions].apply(this, array.prototype.slice.call(arguments, 1)); } else if (typeof methodoroptions === 'object' || !methodoroptions) { // default to "init" return methods.init.apply(this, arguments); } else { $.error('method ' + methodoroptions + ' does not exist on jquery.tooltip'); } }; // plugin end })(jquery); ;(function ($) { $(document).ready(function () { $(document).on('click.card', '.card', function (e) { if ($(this).find('> .card-reveal').length) { var $card = $(e.target).closest('.card'); if ($card.data('initialoverflow') === undefined) { $card.data('initialoverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow')); } if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) { // make reveal animate down and display none $(this).find('.card-reveal').velocity({ translatey: 0 }, { duration: 225, queue: false, easing: 'easeinoutquad', complete: function () { $(this).css({ display: 'none' }); $card.css('overflow', $card.data('initialoverflow')); } }); } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) { $card.css('overflow', 'hidden'); $(this).find('.card-reveal').css({ display: 'block' }).velocity("stop", false).velocity({ translatey: '-100%' }, { duration: 300, queue: false, easing: 'easeinoutquad' }); } } }); }); })(jquery); ;(function ($) { var materialchipsdefaults = { data: [], placeholder: '', secondaryplaceholder: '', autocompleteoptions: {} }; $(document).ready(function () { // handle removal of static chips. $(document).on('click', '.chip .close', function (e) { var $chips = $(this).closest('.chips'); if ($chips.attr('data-initialized')) { return; } $(this).closest('.chip').remove(); }); }); $.fn.material_chip = function (options) { var self = this; this.$el = $(this); this.$document = $(document); this.sels = { chips: '.chips', chip: '.chip', input: 'input', delete: '.material-icons', selected_chip: '.selected' }; if ('data' === options) { return this.$el.data('chips'); } var curr_options = $.extend({}, materialchipsdefaults, options); self.hasautocomplete = !$.isemptyobject(curr_options.autocompleteoptions.data); // initialize this.init = function () { var i = 0; var chips; self.$el.each(function () { var $chips = $(this); var chipid = materialize.guid(); self.chipid = chipid; if (!curr_options.data || !(curr_options.data instanceof array)) { curr_options.data = []; } $chips.data('chips', curr_options.data); $chips.attr('data-index', i); $chips.attr('data-initialized', true); if (!$chips.hasclass(self.sels.chips)) { $chips.addclass('chips'); } self.chips($chips, chipid); i++; }); }; this.handleevents = function () { var sels = self.sels; self.$document.off('click.chips-focus', sels.chips).on('click.chips-focus', sels.chips, function (e) { $(e.target).find(sels.input).focus(); }); self.$document.off('click.chips-select', sels.chip).on('click.chips-select', sels.chip, function (e) { var $chip = $(e.target); if ($chip.length) { var wasselected = $chip.hasclass('selected'); var $chips = $chip.closest(sels.chips); $(sels.chip).removeclass('selected'); if (!wasselected) { self.selectchip($chip.index(), $chips); } } }); self.$document.off('keydown.chips').on('keydown.chips', function (e) { if ($(e.target).is('input, textarea')) { return; } // delete var $chip = self.$document.find(sels.chip + sels.selected_chip); var $chips = $chip.closest(sels.chips); var length = $chip.siblings(sels.chip).length; var index; if (!$chip.length) { return; } if (e.which === 8 || e.which === 46) { e.preventdefault(); index = $chip.index(); self.deletechip(index, $chips); var selectindex = null; if (index + 1 < length) { selectindex = index; } else if (index === length || index + 1 === length) { selectindex = length - 1; } if (selectindex < 0) selectindex = null; if (null !== selectindex) { self.selectchip(selectindex, $chips); } if (!length) $chips.find('input').focus(); // left } else if (e.which === 37) { index = $chip.index() - 1; if (index < 0) { return; } $(sels.chip).removeclass('selected'); self.selectchip(index, $chips); // right } else if (e.which === 39) { index = $chip.index() + 1; $(sels.chip).removeclass('selected'); if (index > length) { $chips.find('input').focus(); return; } self.selectchip(index, $chips); } }); self.$document.off('focusin.chips', sels.chips + ' ' + sels.input).on('focusin.chips', sels.chips + ' ' + sels.input, function (e) { var $currchips = $(e.target).closest(sels.chips); $currchips.addclass('focus'); $currchips.siblings('label, .prefix').addclass('active'); $(sels.chip).removeclass('selected'); }); self.$document.off('focusout.chips', sels.chips + ' ' + sels.input).on('focusout.chips', sels.chips + ' ' + sels.input, function (e) { var $currchips = $(e.target).closest(sels.chips); $currchips.removeclass('focus'); // remove active if empty if ($currchips.data('chips') === undefined || !$currchips.data('chips').length) { $currchips.siblings('label').removeclass('active'); } $currchips.siblings('.prefix').removeclass('active'); }); self.$document.off('keydown.chips-add', sels.chips + ' ' + sels.input).on('keydown.chips-add', sels.chips + ' ' + sels.input, function (e) { var $target = $(e.target); var $chips = $target.closest(sels.chips); var chipslength = $chips.children(sels.chip).length; // enter if (13 === e.which) { // override enter if autocompleting. if (self.hasautocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) { return; } e.preventdefault(); self.addchip({ tag: $target.val() }, $chips); $target.val(''); return; } // delete or left if ((8 === e.keycode || 37 === e.keycode) && '' === $target.val() && chipslength) { e.preventdefault(); self.selectchip(chipslength - 1, $chips); $target.blur(); return; } }); // click on delete icon in chip. self.$document.off('click.chips-delete', sels.chips + ' ' + sels.delete).on('click.chips-delete', sels.chips + ' ' + sels.delete, function (e) { var $target = $(e.target); var $chips = $target.closest(sels.chips); var $chip = $target.closest(sels.chip); e.stoppropagation(); self.deletechip($chip.index(), $chips); $chips.find('input').focus(); }); }; this.chips = function ($chips, chipid) { $chips.empty(); $chips.data('chips').foreach(function (elem) { $chips.append(self.renderchip(elem)); }); $chips.append($('')); self.setplaceholder($chips); // set for attribute for label var label = $chips.next('label'); if (label.length) { label.attr('for', chipid); if ($chips.data('chips') !== undefined && $chips.data('chips').length) { label.addclass('active'); } } // setup autocomplete if needed. var input = $('#' + chipid); if (self.hasautocomplete) { curr_options.autocompleteoptions.onautocomplete = function (val) { self.addchip({ tag: val }, $chips); input.val(''); input.focus(); }; input.autocomplete(curr_options.autocompleteoptions); } }; /** * render chip jquery element. * @param {object} elem * @return {jquery} */ this.renderchip = function (elem) { if (!elem.tag) return; var $renderedchip = $('
    '); $renderedchip.text(elem.tag); if (elem.image) { $renderedchip.prepend($('').attr('src', elem.image)); } $renderedchip.append($('close')); return $renderedchip; }; this.setplaceholder = function ($chips) { if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) { $chips.find('input').prop('placeholder', curr_options.placeholder); } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryplaceholder) { $chips.find('input').prop('placeholder', curr_options.secondaryplaceholder); } }; this.isvalid = function ($chips, elem) { var chips = $chips.data('chips'); var exists = false; for (var i = 0; i < chips.length; i++) { if (chips[i].tag === elem.tag) { exists = true; return; } } return '' !== elem.tag && !exists; }; this.addchip = function (elem, $chips) { if (!self.isvalid($chips, elem)) { return; } var $renderedchip = self.renderchip(elem); var newdata = []; var olddata = $chips.data('chips'); for (var i = 0; i < olddata.length; i++) { newdata.push(olddata[i]); } newdata.push(elem); $chips.data('chips', newdata); $renderedchip.insertbefore($chips.find('input')); $chips.trigger('chip.add', elem); self.setplaceholder($chips); }; this.deletechip = function (chipindex, $chips) { var chip = $chips.data('chips')[chipindex]; $chips.find('.chip').eq(chipindex).remove(); var newdata = []; var olddata = $chips.data('chips'); for (var i = 0; i < olddata.length; i++) { if (i !== chipindex) { newdata.push(olddata[i]); } } $chips.data('chips', newdata); $chips.trigger('chip.delete', chip); self.setplaceholder($chips); }; this.selectchip = function (chipindex, $chips) { var $chip = $chips.find('.chip').eq(chipindex); if ($chip && false === $chip.hasclass('selected')) { $chip.addclass('selected'); $chips.trigger('chip.select', $chips.data('chips')[chipindex]); } }; this.getchipselement = function (index, $chips) { return $chips.eq(index); }; // init this.init(); this.handleevents(); }; })(jquery); ;(function ($) { $.fn.pushpin = function (options) { // defaults var defaults = { top: 0, bottom: infinity, offset: 0 }; // remove pushpin event and classes if (options === "remove") { this.each(function () { if (id = $(this).data('pushpin-id')) { $(window).off('scroll.' + id); $(this).removedata('pushpin-id').removeclass('pin-top pinned pin-bottom').removeattr('style'); } }); return false; } options = $.extend(defaults, options); $index = 0; return this.each(function () { var $uniqueid = materialize.guid(), $this = $(this), $original_offset = $(this).offset().top; function removepinclasses(object) { object.removeclass('pin-top'); object.removeclass('pinned'); object.removeclass('pin-bottom'); } function updateelements(objects, scrolled) { objects.each(function () { // add position fixed (because its between top and bottom) if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasclass('pinned')) { removepinclasses($(this)); $(this).css('top', options.offset); $(this).addclass('pinned'); } // add pin-top (when scrolled position is above top) if (scrolled < options.top && !$(this).hasclass('pin-top')) { removepinclasses($(this)); $(this).css('top', 0); $(this).addclass('pin-top'); } // add pin-bottom (when scrolled position is below bottom) if (scrolled > options.bottom && !$(this).hasclass('pin-bottom')) { removepinclasses($(this)); $(this).addclass('pin-bottom'); $(this).css('top', options.bottom - $original_offset); } }); } $(this).data('pushpin-id', $uniqueid); updateelements($this, $(window).scrolltop()); $(window).on('scroll.' + $uniqueid, function () { var $scrolled = $(window).scrolltop() + options.offset; updateelements($this, $scrolled); }); }); }; })(jquery);;(function ($) { $(document).ready(function () { // jquery reverse $.fn.reverse = [].reverse; // hover behaviour: make sure this doesn't work on .click-to-toggle fabs! $(document).on('mouseenter.fixedactionbtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) { var $this = $(this); openfabmenu($this); }); $(document).on('mouseleave.fixedactionbtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) { var $this = $(this); closefabmenu($this); }); // toggle-on-click behaviour. $(document).on('click.fabclicktoggle', '.fixed-action-btn.click-to-toggle > a', function (e) { var $this = $(this); var $menu = $this.parent(); if ($menu.hasclass('active')) { closefabmenu($menu); } else { openfabmenu($menu); } }); // toolbar transition behaviour. $(document).on('click.fabtoolbar', '.fixed-action-btn.toolbar > a', function (e) { var $this = $(this); var $menu = $this.parent(); fabtotoolbar($menu); }); }); $.fn.extend({ openfab: function () { openfabmenu($(this)); }, closefab: function () { closefabmenu($(this)); }, opentoolbar: function () { fabtotoolbar($(this)); }, closetoolbar: function () { toolbartofab($(this)); } }); var openfabmenu = function (btn) { var $this = btn; if ($this.hasclass('active') === false) { // get direction option var horizontal = $this.hasclass('horizontal'); var offsety, offsetx; if (horizontal === true) { offsetx = 40; } else { offsety = 40; } $this.addclass('active'); $this.find('ul .btn-floating').velocity({ scaley: ".4", scalex: ".4", translatey: offsety + 'px', translatex: offsetx + 'px' }, { duration: 0 }); var time = 0; $this.find('ul .btn-floating').reverse().each(function () { $(this).velocity({ opacity: "1", scalex: "1", scaley: "1", translatey: "0", translatex: '0' }, { duration: 80, delay: time }); time += 40; }); } }; var closefabmenu = function (btn) { var $this = btn; // get direction option var horizontal = $this.hasclass('horizontal'); var offsety, offsetx; if (horizontal === true) { offsetx = 40; } else { offsety = 40; } $this.removeclass('active'); var time = 0; $this.find('ul .btn-floating').velocity("stop", true); $this.find('ul .btn-floating').velocity({ opacity: "0", scalex: ".4", scaley: ".4", translatey: offsety + 'px', translatex: offsetx + 'px' }, { duration: 80 }); }; /** * transform fab into toolbar * @param {object} object jquery object */ var fabtotoolbar = function (btn) { if (btn.attr('data-open') === "true") { return; } var offsetx, offsety, scalefactor; var windowwidth = window.innerwidth; var windowheight = window.innerheight; var btnrect = btn[0].getboundingclientrect(); var anchor = btn.find('> a').first(); var menu = btn.find('> ul').first(); var backdrop = $('
    '); var fabcolor = anchor.css('background-color'); anchor.append(backdrop); offsetx = btnrect.left - windowwidth / 2 + btnrect.width / 2; offsety = windowheight - btnrect.bottom; scalefactor = windowwidth / backdrop.width(); btn.attr('data-origin-bottom', btnrect.bottom); btn.attr('data-origin-left', btnrect.left); btn.attr('data-origin-width', btnrect.width); // set initial state btn.addclass('active'); btn.attr('data-open', true); btn.css({ 'text-align': 'center', width: '100%', bottom: 0, left: 0, transform: 'translatex(' + offsetx + 'px)', transition: 'none' }); anchor.css({ transform: 'translatey(' + -offsety + 'px)', transition: 'none' }); backdrop.css({ 'background-color': fabcolor }); settimeout(function () { btn.css({ transform: '', transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s' }); anchor.css({ overflow: 'visible', transform: '', transition: 'transform .2s' }); settimeout(function () { btn.css({ overflow: 'hidden', 'background-color': fabcolor }); backdrop.css({ transform: 'scale(' + scalefactor + ')', transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)' }); menu.find('> li > a').css({ opacity: 1 }); // scroll to close. $(window).on('scroll.fabtoolbarclose', function () { toolbartofab(btn); $(window).off('scroll.fabtoolbarclose'); $(document).off('click.fabtoolbarclose'); }); $(document).on('click.fabtoolbarclose', function (e) { if (!$(e.target).closest(menu).length) { toolbartofab(btn); $(window).off('scroll.fabtoolbarclose'); $(document).off('click.fabtoolbarclose'); } }); }, 100); }, 0); }; /** * transform toolbar back into fab * @param {object} object jquery object */ var toolbartofab = function (btn) { if (btn.attr('data-open') !== "true") { return; } var offsetx, offsety, scalefactor; var windowwidth = window.innerwidth; var windowheight = window.innerheight; var btnwidth = btn.attr('data-origin-width'); var btnbottom = btn.attr('data-origin-bottom'); var btnleft = btn.attr('data-origin-left'); var anchor = btn.find('> .btn-floating').first(); var menu = btn.find('> ul').first(); var backdrop = btn.find('.fab-backdrop'); var fabcolor = anchor.css('background-color'); offsetx = btnleft - windowwidth / 2 + btnwidth / 2; offsety = windowheight - btnbottom; scalefactor = windowwidth / backdrop.width(); // hide backdrop btn.removeclass('active'); btn.attr('data-open', false); btn.css({ 'background-color': 'transparent', transition: 'none' }); anchor.css({ transition: 'none' }); backdrop.css({ transform: 'scale(0)', 'background-color': fabcolor }); menu.find('> li > a').css({ opacity: '' }); settimeout(function () { backdrop.remove(); // set initial state. btn.css({ 'text-align': '', width: '', bottom: '', left: '', overflow: '', 'background-color': '', transform: 'translate3d(' + -offsetx + 'px,0,0)' }); anchor.css({ overflow: '', transform: 'translate3d(0,' + offsety + 'px,0)' }); settimeout(function () { btn.css({ transform: 'translate3d(0,0,0)', transition: 'transform .2s' }); anchor.css({ transform: 'translate3d(0,0,0)', transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)' }); }, 20); }, 200); }; })(jquery); ;(function ($) { // image transition function materialize.fadeinimage = function (selectororel) { var element; if (typeof selectororel === 'string') { element = $(selectororel); } else if (typeof selectororel === 'object') { element = selectororel; } else { return; } element.css({ opacity: 0 }); $(element).velocity({ opacity: 1 }, { duration: 650, queue: false, easing: 'easeoutsine' }); $(element).velocity({ opacity: 1 }, { duration: 1300, queue: false, easing: 'swing', step: function (now, fx) { fx.start = 100; var grayscale_setting = now / 100; var brightness_setting = 150 - (100 - now) / 1.75; if (brightness_setting < 100) { brightness_setting = 100; } if (now >= 0) { $(this).css({ "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)", "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)" }); } } }); }; // horizontal staggered list materialize.showstaggeredlist = function (selectororel) { var element; if (typeof selectororel === 'string') { element = $(selectororel); } else if (typeof selectororel === 'object') { element = selectororel; } else { return; } var time = 0; element.find('li').velocity({ translatex: "-100px" }, { duration: 0 }); element.find('li').each(function () { $(this).velocity({ opacity: "1", translatex: "0" }, { duration: 800, delay: time, easing: [60, 10] }); time += 120; }); }; $(document).ready(function () { // hardcoded .staggered-list scrollfire // var staggeredlistoptions = []; // $('ul.staggered-list').each(function (i) { // var label = 'scrollfire-' + i; // $(this).addclass(label); // staggeredlistoptions.push( // {selector: 'ul.staggered-list.' + label, // offset: 200, // callback: 'showstaggeredlist("ul.staggered-list.' + label + '")'}); // }); // scrollfire(staggeredlistoptions); // hammerjs, swipe navigation // touch event var swipeleft = false; var swiperight = false; // dismissible collections $('.dismissable').each(function () { $(this).hammer({ prevent_default: false }).on('pan', function (e) { if (e.gesture.pointertype === "touch") { var $this = $(this); var direction = e.gesture.direction; var x = e.gesture.deltax; var velocityx = e.gesture.velocityx; $this.velocity({ translatex: x }, { duration: 50, queue: false, easing: 'easeoutquad' }); // swipe left if (direction === 4 && (x > $this.innerwidth() / 2 || velocityx < -0.75)) { swipeleft = true; } // swipe right if (direction === 2 && (x < -1 * $this.innerwidth() / 2 || velocityx > 0.75)) { swiperight = true; } } }).on('panend', function (e) { // reset if collection is moved back into original position if (math.abs(e.gesture.deltax) < $(this).innerwidth() / 2) { swiperight = false; swipeleft = false; } if (e.gesture.pointertype === "touch") { var $this = $(this); if (swipeleft || swiperight) { var fullwidth; if (swipeleft) { fullwidth = $this.innerwidth(); } else { fullwidth = -1 * $this.innerwidth(); } $this.velocity({ translatex: fullwidth }, { duration: 100, queue: false, easing: 'easeoutquad', complete: function () { $this.css('border', 'none'); $this.velocity({ height: 0, padding: 0 }, { duration: 200, queue: false, easing: 'easeoutquad', complete: function () { $this.remove(); } }); } }); } else { $this.velocity({ translatex: 0 }, { duration: 100, queue: false, easing: 'easeoutquad' }); } swipeleft = false; swiperight = false; } }); }); // time = 0 // // vertical staggered list // $('ul.staggered-list.vertical li').velocity( // { translatey: "100px"}, // { duration: 0 }); // $('ul.staggered-list.vertical li').each(function() { // $(this).velocity( // { opacity: "1", translatey: "0"}, // { duration: 800, delay: time, easing: [60, 25] }); // time += 120; // }); // // fade in and scale // $('.fade-in.scale').velocity( // { scalex: .4, scaley: .4, translatex: -600}, // { duration: 0}); // $('.fade-in').each(function() { // $(this).velocity( // { opacity: "1", scalex: 1, scaley: 1, translatex: 0}, // { duration: 800, easing: [60, 10] }); // }); }); })(jquery); ;(function ($) { var scrollfireeventshandled = false; // input: array of json objects {selector, offset, callback} materialize.scrollfire = function (options) { var onscroll = function () { var windowscroll = window.pageyoffset + window.innerheight; for (var i = 0; i < options.length; i++) { // get options from each line var value = options[i]; var selector = value.selector, offset = value.offset, callback = value.callback; var currentelement = document.queryselector(selector); if (currentelement !== null) { var elementoffset = currentelement.getboundingclientrect().top + window.pageyoffset; if (windowscroll > elementoffset + offset) { if (value.done !== true) { if (typeof callback === 'function') { callback.call(this, currentelement); } else if (typeof callback === 'string') { var callbackfunc = new function(callback); callbackfunc(currentelement); } value.done = true; } } } } }; var throttledscroll = materialize.throttle(function () { onscroll(); }, options.throttle || 100); if (!scrollfireeventshandled) { window.addeventlistener("scroll", throttledscroll); window.addeventlistener("resize", throttledscroll); scrollfireeventshandled = true; } // perform a scan once, after current execution context, and after dom is ready settimeout(throttledscroll, 0); }; })(jquery); ; /*! * pickadate.js v3.5.0, 2014/04/13 * by amsul, http://amsul.ca * hosted on http://amsul.github.io/pickadate.js * licensed under mit */ (function (factory) { materialize.picker = factory(jquery); })(function ($) { var $window = $(window); var $document = $(document); var $html = $(document.documentelement); /** * the picker constructor that creates a blank picker. */ function pickerconstructor(element, name, component, options) { // if there’s no element, return the picker constructor. if (!element) return pickerconstructor; var is_default_theme = false, // the state of the picker. state = { id: element.id || 'p' + math.abs(~~(math.random() * new date())) }, // merge the defaults and options passed. settings = component ? $.extend(true, {}, component.defaults, options) : options || {}, // merge the default classes with the settings classes. classes = $.extend({}, pickerconstructor.klasses(), settings.klass), // the element node wrapper into a jquery object. $element = $(element), // pseudo picker constructor. pickerinstance = function () { return this.start(); }, // the picker prototype. p = pickerinstance.prototype = { constructor: pickerinstance, $node: $element, /** * initialize everything */ start: function () { // if it’s already started, do nothing. if (state && state.start) return p; // update the picker states. state.methods = {}; state.start = true; state.open = false; state.type = element.type; // confirm focus state, convert into text input to remove ua stylings, // and set as readonly to prevent keyboard popup. element.autofocus = element == getactiveelement(); element.readonly = !settings.editable; element.id = element.id || state.id; if (element.type != 'text') { element.type = 'text'; } // create a new picker component with the settings. p.component = new component(p, settings); // create the picker root with a holder and then prepare it. p.$root = $(pickerconstructor._.node('div', createwrappedcomponent(), classes.picker, 'id="' + element.id + '_root" tabindex="0"')); prepareelementroot(); // if there’s a format for the hidden input element, create the element. if (settings.formatsubmit) { prepareelementhidden(); } // prepare the input element. prepareelement(); // insert the root as specified in the settings. if (settings.container) $(settings.container).append(p.$root);else $element.before(p.$root); // bind the default component and settings events. p.on({ start: p.component.onstart, render: p.component.onrender, stop: p.component.onstop, open: p.component.onopen, close: p.component.onclose, set: p.component.onset }).on({ start: settings.onstart, render: settings.onrender, stop: settings.onstop, open: settings.onopen, close: settings.onclose, set: settings.onset }); // once we’re all set, check the theme in use. is_default_theme = isusingdefaulttheme(p.$root.children()[0]); // if the element has autofocus, open the picker. if (element.autofocus) { p.open(); } // trigger queued the “start” and “render” events. return p.trigger('start').trigger('render'); }, //start /** * render a new picker */ render: function (entirecomponent) { // insert a new component holder in the root or box. if (entirecomponent) p.$root.html(createwrappedcomponent());else p.$root.find('.' + classes.box).html(p.component.nodes(state.open)); // trigger the queued “render” events. return p.trigger('render'); }, //render /** * destroy everything */ stop: function () { // if it’s already stopped, do nothing. if (!state.start) return p; // then close the picker. p.close(); // remove the hidden field. if (p._hidden) { p._hidden.parentnode.removechild(p._hidden); } // remove the root. p.$root.remove(); // remove the input class, remove the stored data, and unbind // the events (after a tick for ie - see `p.close`). $element.removeclass(classes.input).removedata(name); settimeout(function () { $element.off('.' + state.id); }, 0); // restore the element state element.type = state.type; element.readonly = false; // trigger the queued “stop” events. p.trigger('stop'); // reset the picker states. state.methods = {}; state.start = false; return p; }, //stop /** * open up the picker */ open: function (dontgivefocus) { // if it’s already open, do nothing. if (state.open) return p; // add the “active” class. $element.addclass(classes.active); aria(element, 'expanded', true); // * a firefox bug, when `html` has `overflow:hidden`, results in // killing transitions :(. so add the “opened” state on the next tick. // bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289 settimeout(function () { // add the “opened” class to the picker root. p.$root.addclass(classes.opened); aria(p.$root[0], 'hidden', false); }, 0); // if we have to give focus, bind the element and doc events. if (dontgivefocus !== false) { // set it as open. state.open = true; // prevent the page from scrolling. if (is_default_theme) { $html.css('overflow', 'hidden').css('padding-right', '+=' + getscrollbarwidth()); } // pass focus to the root element’s jquery object. // * workaround for ios8 to bring the picker’s root into view. p.$root.eq(0).focus(); // bind the document events. $document.on('click.' + state.id + ' focusin.' + state.id, function (event) { var target = event.target; // if the target of the event is not the element, close the picker picker. // * don’t worry about clicks or focusins on the root because those don’t bubble up. // also, for firefox, a click on an `option` element bubbles up directly // to the doc. so make sure the target wasn't the doc. // * in firefox stoppropagation() doesn’t prevent right-click events from bubbling, // which causes the picker to unexpectedly close when right-clicking it. so make // sure the event wasn’t a right-click. if (target != element && target != document && event.which != 3) { // if the target was the holder that covers the screen, // keep the element focused to maintain tabindex. p.close(target === p.$root.children()[0]); } }).on('keydown.' + state.id, function (event) { var // get the keycode. keycode = event.keycode, // translate that to a selection change. keycodetomove = p.component.key[keycode], // grab the target. target = event.target; // on escape, close the picker and give focus. if (keycode == 27) { p.close(true); } // check if there is a key movement or “enter” keypress on the element. else if (target == p.$root[0] && (keycodetomove || keycode == 13)) { // prevent the default action to stop page movement. event.preventdefault(); // trigger the key movement action. if (keycodetomove) { pickerconstructor._.trigger(p.component.key.go, p, [pickerconstructor._.trigger(keycodetomove)]); } // on “enter”, if the highlighted item isn’t disabled, set the value and close. else if (!p.$root.find('.' + classes.highlighted).hasclass(classes.disabled)) { p.set('select', p.component.item.highlight); if (settings.closeonselect) { p.close(true); } } } // if the target is within the root and “enter” is pressed, // prevent the default action and trigger a click on the target instead. else if ($.contains(p.$root[0], target) && keycode == 13) { event.preventdefault(); target.click(); } }); } // trigger the queued “open” events. return p.trigger('open'); }, //open /** * close the picker */ close: function (givefocus) { // if we need to give focus, do it before changing states. if (givefocus) { // ....ah yes! it would’ve been incomplete without a crazy workaround for ie :| // the focus is triggered *after* the close has completed - causing it // to open again. so unbind and rebind the event at the next tick. p.$root.off('focus.toopen').eq(0).focus(); settimeout(function () { p.$root.on('focus.toopen', handlefocustoopenevent); }, 0); } // remove the “active” class. $element.removeclass(classes.active); aria(element, 'expanded', false); // * a firefox bug, when `html` has `overflow:hidden`, results in // killing transitions :(. so remove the “opened” state on the next tick. // bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289 settimeout(function () { // remove the “opened” and “focused” class from the picker root. p.$root.removeclass(classes.opened + ' ' + classes.focused); aria(p.$root[0], 'hidden', true); }, 0); // if it’s already closed, do nothing more. if (!state.open) return p; // set it as closed. state.open = false; // allow the page to scroll. if (is_default_theme) { $html.css('overflow', '').css('padding-right', '-=' + getscrollbarwidth()); } // unbind the document events. $document.off('.' + state.id); // trigger the queued “close” events. return p.trigger('close'); }, //close /** * clear the values */ clear: function (options) { return p.set('clear', null, options); }, //clear /** * set something */ set: function (thing, value, options) { var thingitem, thingvalue, thingisobject = $.isplainobject(thing), thingobject = thingisobject ? thing : {}; // make sure we have usable options. options = thingisobject && $.isplainobject(value) ? value : options || {}; if (thing) { // if the thing isn’t an object, make it one. if (!thingisobject) { thingobject[thing] = value; } // go through the things of items to set. for (thingitem in thingobject) { // grab the value of the thing. thingvalue = thingobject[thingitem]; // first, if the item exists and there’s a value, set it. if (thingitem in p.component.item) { if (thingvalue === undefined) thingvalue = null; p.component.set(thingitem, thingvalue, options); } // then, check to update the element value and broadcast a change. if (thingitem == 'select' || thingitem == 'clear') { $element.val(thingitem == 'clear' ? '' : p.get(thingitem, settings.format)).trigger('change'); } } // render a new picker. p.render(); } // when the method isn’t muted, trigger queued “set” events and pass the `thingobject`. return options.muted ? p : p.trigger('set', thingobject); }, //set /** * get something */ get: function (thing, format) { // make sure there’s something to get. thing = thing || 'value'; // if a picker state exists, return that. if (state[thing] != null) { return state[thing]; } // return the submission value, if that. if (thing == 'valuesubmit') { if (p._hidden) { return p._hidden.value; } thing = 'value'; } // return the value, if that. if (thing == 'value') { return element.value; } // check if a component item exists, return that. if (thing in p.component.item) { if (typeof format == 'string') { var thingvalue = p.component.get(thing); return thingvalue ? pickerconstructor._.trigger(p.component.formats.tostring, p.component, [format, thingvalue]) : ''; } return p.component.get(thing); } }, //get /** * bind events on the things. */ on: function (thing, method, internal) { var thingname, thingmethod, thingisobject = $.isplainobject(thing), thingobject = thingisobject ? thing : {}; if (thing) { // if the thing isn’t an object, make it one. if (!thingisobject) { thingobject[thing] = method; } // go through the things to bind to. for (thingname in thingobject) { // grab the method of the thing. thingmethod = thingobject[thingname]; // if it was an internal binding, prefix it. if (internal) { thingname = '_' + thingname; } // make sure the thing methods collection exists. state.methods[thingname] = state.methods[thingname] || []; // add the method to the relative method collection. state.methods[thingname].push(thingmethod); } } return p; }, //on /** * unbind events on the things. */ off: function () { var i, thingname, names = arguments; for (i = 0, namescount = names.length; i < namescount; i += 1) { thingname = names[i]; if (thingname in state.methods) { delete state.methods[thingname]; } } return p; }, /** * fire off method events. */ trigger: function (name, data) { var _trigger = function (name) { var methodlist = state.methods[name]; if (methodlist) { methodlist.map(function (method) { pickerconstructor._.trigger(method, p, [data]); }); } }; _trigger('_' + name); _trigger(name); return p; } //trigger //pickerinstance.prototype /** * wrap the picker holder components together. */ };function createwrappedcomponent() { // create a picker wrapper holder return pickerconstructor._.node('div', // create a picker wrapper node pickerconstructor._.node('div', // create a picker frame pickerconstructor._.node('div', // create a picker box node pickerconstructor._.node('div', // create the components nodes. p.component.nodes(state.open), // the picker box class classes.box), // picker wrap class classes.wrap), // picker frame class classes.frame), // picker holder class classes.holder); //endreturn } //createwrappedcomponent /** * prepare the input element with all bindings. */ function prepareelement() { $element. // store the picker data by component name. data(name, p). // add the “input” class name. addclass(classes.input). // remove the tabindex. attr('tabindex', -1). // if there’s a `data-value`, update the value of the element. val($element.data('value') ? p.get('select', settings.format) : element.value); // only bind keydown events if the element isn’t editable. if (!settings.editable) { $element. // on focus/click, focus onto the root to open it up. on('focus.' + state.id + ' click.' + state.id, function (event) { event.preventdefault(); p.$root.eq(0).focus(); }). // handle keyboard event based on the picker being opened or not. on('keydown.' + state.id, handlekeydownevent); } // update the aria attributes. aria(element, { haspopup: true, expanded: false, readonly: false, owns: element.id + '_root' }); } /** * prepare the root picker element with all bindings. */ function prepareelementroot() { p.$root.on({ // for ios8. keydown: handlekeydownevent, // when something within the root is focused, stop from bubbling // to the doc and remove the “focused” state from the root. focusin: function (event) { p.$root.removeclass(classes.focused); event.stoppropagation(); }, // when something within the root holder is clicked, stop it // from bubbling to the doc. 'mousedown click': function (event) { var target = event.target; // make sure the target isn’t the root holder so it can bubble up. if (target != p.$root.children()[0]) { event.stoppropagation(); // * for mousedown events, cancel the default action in order to // prevent cases where focus is shifted onto external elements // when using things like jquery mobile or magnificpopup (ref: #249 & #120). // also, for firefox, don’t prevent action on the `option` element. if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) { event.preventdefault(); // re-focus onto the root so that users can click away // from elements focused within the picker. p.$root.eq(0).focus(); } } } }). // add/remove the “target” class on focus and blur. on({ focus: function () { $element.addclass(classes.target); }, blur: function () { $element.removeclass(classes.target); } }). // open the picker and adjust the root “focused” state on('focus.toopen', handlefocustoopenevent). // if there’s a click on an actionable element, carry out the actions. on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () { var $target = $(this), targetdata = $target.data(), targetdisabled = $target.hasclass(classes.navdisabled) || $target.hasclass(classes.disabled), // * for ie, non-focusable elements can be active elements as well // (http://stackoverflow.com/a/2684561). activeelement = getactiveelement(); activeelement = activeelement && (activeelement.type || activeelement.href) && activeelement; // if it’s disabled or nothing inside is actively focused, re-focus the element. if (targetdisabled || activeelement && !$.contains(p.$root[0], activeelement)) { p.$root.eq(0).focus(); } // if something is superficially changed, update the `highlight` based on the `nav`. if (!targetdisabled && targetdata.nav) { p.set('highlight', p.component.item.highlight, { nav: targetdata.nav }); } // if something is picked, set `select` then close with focus. else if (!targetdisabled && 'pick' in targetdata) { p.set('select', targetdata.pick); if (settings.closeonselect) { p.close(true); } } // if a “clear” button is pressed, empty the values and close with focus. else if (targetdata.clear) { p.clear(); if (settings.closeonselect) { p.close(true); } } else if (targetdata.close) { p.close(true); } }); //p.$root aria(p.$root[0], 'hidden', true); } /** * prepare the hidden input element along with all bindings. */ function prepareelementhidden() { var name; if (settings.hiddenname === true) { name = element.name; element.name = ''; } else { name = [typeof settings.hiddenprefix == 'string' ? settings.hiddenprefix : '', typeof settings.hiddensuffix == 'string' ? settings.hiddensuffix : '_submit']; name = name[0] + element.name + name[1]; } p._hidden = $('')[0]; $element. // if the value changes, update the hidden input with the correct format. on('change.' + state.id, function () { p._hidden.value = element.value ? p.get('select', settings.formatsubmit) : ''; }); // insert the hidden input as specified in the settings. if (settings.container) $(settings.container).append(p._hidden);else $element.before(p._hidden); } // for ios8. function handlekeydownevent(event) { var keycode = event.keycode, // check if one of the delete keys was pressed. iskeycodedelete = /^(8|46)$/.test(keycode); // for some reason ie clears the input value on “escape”. if (keycode == 27) { p.close(); return false; } // check if `space` or `delete` was pressed or the picker is closed with a key movement. if (keycode == 32 || iskeycodedelete || !state.open && p.component.key[keycode]) { // prevent it from moving the page and bubbling to doc. event.preventdefault(); event.stoppropagation(); // if `delete` was pressed, clear the values and close the picker. // otherwise open the picker. if (iskeycodedelete) { p.clear().close(); } else { p.open(); } } } // separated for ie function handlefocustoopenevent(event) { // stop the event from propagating to the doc. event.stoppropagation(); // if it’s a focus event, add the “focused” class to the root. if (event.type == 'focus') { p.$root.addclass(classes.focused); } // and then finally open the picker. p.open(); } // return a new picker instance. return new pickerinstance(); } //pickerconstructor /** * the default classes and prefix to use for the html classes. */ pickerconstructor.klasses = function (prefix) { prefix = prefix || 'picker'; return { picker: prefix, opened: prefix + '--opened', focused: prefix + '--focused', input: prefix + '__input', active: prefix + '__input--active', target: prefix + '__input--target', holder: prefix + '__holder', frame: prefix + '__frame', wrap: prefix + '__wrap', box: prefix + '__box' }; }; //pickerconstructor.klasses /** * check if the default theme is being used. */ function isusingdefaulttheme(element) { var theme, prop = 'position'; // for ie. if (element.currentstyle) { theme = element.currentstyle[prop]; } // for normal browsers. else if (window.getcomputedstyle) { theme = getcomputedstyle(element)[prop]; } return theme == 'fixed'; } /** * get the width of the browser’s scrollbar. * taken from: https://github.com/vodkabears/remodal/blob/master/src/jquery.remodal.js */ function getscrollbarwidth() { if ($html.height() <= $window.height()) { return 0; } var $outer = $('
    ').appendto('body'); // get the width without scrollbars. var widthwithoutscroll = $outer[0].offsetwidth; // force adding scrollbars. $outer.css('overflow', 'scroll'); // add the inner div. var $inner = $('
    ').appendto($outer); // get the width with scrollbars. var widthwithscroll = $inner[0].offsetwidth; // remove the divs. $outer.remove(); // return the difference between the widths. return widthwithoutscroll - widthwithscroll; } /** * pickerconstructor helper methods. */ pickerconstructor._ = { /** * create a group of nodes. expects: * ` { min: {integer}, max: {integer}, i: {integer}, node: {string}, item: {function} } * ` */ group: function (groupobject) { var // scope for the looped object loopobjectscope, // create the nodes list nodeslist = '', // the counter starts from the `min` counter = pickerconstructor._.trigger(groupobject.min, groupobject); // loop from the `min` to `max`, incrementing by `i` for (; counter <= pickerconstructor._.trigger(groupobject.max, groupobject, [counter]); counter += groupobject.i) { // trigger the `item` function within scope of the object loopobjectscope = pickerconstructor._.trigger(groupobject.item, groupobject, [counter]); // splice the subgroup and create nodes out of the sub nodes nodeslist += pickerconstructor._.node(groupobject.node, loopobjectscope[0], // the node loopobjectscope[1], // the classes loopobjectscope[2] // the attributes ); } // return the list of nodes return nodeslist; }, //group /** * create a dom node string */ node: function (wrapper, item, klass, attribute) { // if the item is false-y, just return an empty string if (!item) return ''; // if the item is an array, do a join item = $.isarray(item) ? item.join('') : item; // check for the class klass = klass ? ' class="' + klass + '"' : ''; // check for any attributes attribute = attribute ? ' ' + attribute : ''; // return the wrapped item return '<' + wrapper + klass + attribute + '>' + item + ''; }, //node /** * lead numbers below 10 with a zero. */ lead: function (number) { return (number < 10 ? '0' : '') + number; }, /** * trigger a function otherwise return the value. */ trigger: function (callback, scope, args) { return typeof callback == 'function' ? callback.apply(scope, args || []) : callback; }, /** * if the second character is a digit, length is 2 otherwise 1. */ digits: function (string) { return (/\d/.test(string[1]) ? 2 : 1 ); }, /** * tell if something is a date object. */ isdate: function (value) { return {}.tostring.call(value).indexof('date') > -1 && this.isinteger(value.getdate()); }, /** * tell if something is an integer. */ isinteger: function (value) { return {}.tostring.call(value).indexof('number') > -1 && value % 1 === 0; }, /** * create aria attribute strings. */ ariaattr: ariaattr //pickerconstructor._ /** * extend the picker with a component and defaults. */ };pickerconstructor.extend = function (name, component) { // extend jquery. $.fn[name] = function (options, action) { // grab the component data. var componentdata = this.data(name); // if the picker is requested, return the data object. if (options == 'picker') { return componentdata; } // if the component data exists and `options` is a string, carry out the action. if (componentdata && typeof options == 'string') { return pickerconstructor._.trigger(componentdata[options], componentdata, [action]); } // otherwise go through each matched element and if the component // doesn’t exist, create a new picker using `this` element // and merging the defaults and options with a deep copy. return this.each(function () { var $this = $(this); if (!$this.data(name)) { new pickerconstructor(this, name, component, options); } }); }; // set the defaults. $.fn[name].defaults = component.defaults; }; //pickerconstructor.extend function aria(element, attribute, value) { if ($.isplainobject(attribute)) { for (var key in attribute) { ariaset(element, key, attribute[key]); } } else { ariaset(element, attribute, value); } } function ariaset(element, attribute, value) { element.setattribute((attribute == 'role' ? '' : 'aria-') + attribute, value); } function ariaattr(attribute, data) { if (!$.isplainobject(attribute)) { attribute = { attribute: data }; } data = ''; for (var key in attribute) { var attr = (key == 'role' ? '' : 'aria-') + key, attrval = attribute[key]; data += attrval == null ? '' : attr + '="' + attribute[key] + '"'; } return data; } // ie8 bug throws an error for activeelements within iframes. function getactiveelement() { try { return document.activeelement; } catch (err) {} } // expose the picker constructor. return pickerconstructor; }); ; /*! * date picker for pickadate.js v3.5.0 * http://amsul.github.io/pickadate.js/date.htm */ (function (factory) { factory(materialize.picker, jquery); })(function (picker, $) { /** * globals and constants */ var days_in_week = 7, weeks_in_calendar = 6, _ = picker._; /** * the date picker constructor */ function datepicker(picker, settings) { var calendar = this, element = picker.$node[0], elementvalue = element.value, elementdatavalue = picker.$node.data('value'), valuestring = elementdatavalue || elementvalue, formatstring = elementdatavalue ? settings.formatsubmit : settings.format, isrtl = function () { return element.currentstyle ? // for ie. element.currentstyle.direction == 'rtl' : // for normal browsers. getcomputedstyle(picker.$root[0]).direction == 'rtl'; }; calendar.settings = settings; calendar.$node = picker.$node; // the queue of methods that will be used to build item objects. calendar.queue = { min: 'measure create', max: 'measure create', now: 'now create', select: 'parse create validate', highlight: 'parse navigate create validate', view: 'parse create validate viewset', disable: 'deactivate', enable: 'activate' // the component's item object. };calendar.item = {}; calendar.item.clear = null; calendar.item.disable = (settings.disable || []).slice(0); calendar.item.enable = -function (collectiondisabled) { return collectiondisabled[0] === true ? collectiondisabled.shift() : -1; }(calendar.item.disable); calendar.set('min', settings.min).set('max', settings.max).set('now'); // when there’s a value, set the `select`, which in turn // also sets the `highlight` and `view`. if (valuestring) { calendar.set('select', valuestring, { format: formatstring }); } // if there’s no value, default to highlighting “today”. else { calendar.set('select', null).set('highlight', calendar.item.now); } // the keycode to movement mapping. calendar.key = { 40: 7, // down 38: -7, // up 39: function () { return isrtl() ? -1 : 1; }, // right 37: function () { return isrtl() ? 1 : -1; }, // left go: function (timechange) { var highlightedobject = calendar.item.highlight, targetdate = new date(highlightedobject.year, highlightedobject.month, highlightedobject.date + timechange); calendar.set('highlight', targetdate, { interval: timechange }); this.render(); } // bind some picker events. };picker.on('render', function () { picker.$root.find('.' + settings.klass.selectmonth).on('change', function () { var value = this.value; if (value) { picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]); picker.$root.find('.' + settings.klass.selectmonth).trigger('focus'); } }); picker.$root.find('.' + settings.klass.selectyear).on('change', function () { var value = this.value; if (value) { picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]); picker.$root.find('.' + settings.klass.selectyear).trigger('focus'); } }); }, 1).on('open', function () { var includetoday = ''; if (calendar.disabled(calendar.get('now'))) { includetoday = ':not(.' + settings.klass.buttontoday + ')'; } picker.$root.find('button' + includetoday + ', select').attr('disabled', false); }, 1).on('close', function () { picker.$root.find('button, select').attr('disabled', true); }, 1); } //datepicker /** * set a datepicker item object. */ datepicker.prototype.set = function (type, value, options) { var calendar = this, calendaritem = calendar.item; // if the value is `null` just set it immediately. if (value === null) { if (type == 'clear') type = 'select'; calendaritem[type] = value; return calendar; } // otherwise go through the queue of methods, and invoke the functions. // update this as the time unit, and set the final value as this item. // * in the case of `enable`, keep the queue but set `disable` instead. // and in the case of `flip`, keep the queue but set `enable` instead. calendaritem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) { value = calendar[method](type, value, options); return value; }).pop(); // check if we need to cascade through more updates. if (type == 'select') { calendar.set('highlight', calendaritem.select, options); } else if (type == 'highlight') { calendar.set('view', calendaritem.highlight, options); } else if (type.match(/^(flip|min|max|disable|enable)$/)) { if (calendaritem.select && calendar.disabled(calendaritem.select)) { calendar.set('select', calendaritem.select, options); } if (calendaritem.highlight && calendar.disabled(calendaritem.highlight)) { calendar.set('highlight', calendaritem.highlight, options); } } return calendar; }; //datepicker.prototype.set /** * get a datepicker item object. */ datepicker.prototype.get = function (type) { return this.item[type]; }; //datepicker.prototype.get /** * create a picker date object. */ datepicker.prototype.create = function (type, value, options) { var isinfinitevalue, calendar = this; // if there’s no value, use the type as the value. value = value === undefined ? type : value; // if it’s infinity, update the value. if (value == -infinity || value == infinity) { isinfinitevalue = value; } // if it’s an object, use the native date object. else if ($.isplainobject(value) && _.isinteger(value.pick)) { value = value.obj; } // if it’s an array, convert it into a date and make sure // that it’s a valid date – otherwise default to today. else if ($.isarray(value)) { value = new date(value[0], value[1], value[2]); value = _.isdate(value) ? value : calendar.create().obj; } // if it’s a number or date object, make a normalized date. else if (_.isinteger(value) || _.isdate(value)) { value = calendar.normalize(new date(value), options); } // if it’s a literal true or any other case, set it to now. else /*if ( value === true )*/{ value = calendar.now(type, value, options); } // return the compiled object. return { year: isinfinitevalue || value.getfullyear(), month: isinfinitevalue || value.getmonth(), date: isinfinitevalue || value.getdate(), day: isinfinitevalue || value.getday(), obj: isinfinitevalue || value, pick: isinfinitevalue || value.gettime() }; }; //datepicker.prototype.create /** * create a range limit object using an array, date object, * literal “true”, or integer relative to another time. */ datepicker.prototype.createrange = function (from, to) { var calendar = this, createdate = function (date) { if (date === true || $.isarray(date) || _.isdate(date)) { return calendar.create(date); } return date; }; // create objects if possible. if (!_.isinteger(from)) { from = createdate(from); } if (!_.isinteger(to)) { to = createdate(to); } // create relative dates. if (_.isinteger(from) && $.isplainobject(to)) { from = [to.year, to.month, to.date + from]; } else if (_.isinteger(to) && $.isplainobject(from)) { to = [from.year, from.month, from.date + to]; } return { from: createdate(from), to: createdate(to) }; }; //datepicker.prototype.createrange /** * check if a date unit falls within a date range object. */ datepicker.prototype.withinrange = function (range, dateunit) { range = this.createrange(range.from, range.to); return dateunit.pick >= range.from.pick && dateunit.pick <= range.to.pick; }; /** * check if two date range objects overlap. */ datepicker.prototype.overlapranges = function (one, two) { var calendar = this; // convert the ranges into comparable dates. one = calendar.createrange(one.from, one.to); two = calendar.createrange(two.from, two.to); return calendar.withinrange(one, two.from) || calendar.withinrange(one, two.to) || calendar.withinrange(two, one.from) || calendar.withinrange(two, one.to); }; /** * get the date today. */ datepicker.prototype.now = function (type, value, options) { value = new date(); if (options && options.rel) { value.setdate(value.getdate() + options.rel); } return this.normalize(value, options); }; /** * navigate to next/prev month. */ datepicker.prototype.navigate = function (type, value, options) { var targetdateobject, targetyear, targetmonth, targetdate, istargetarray = $.isarray(value), istargetobject = $.isplainobject(value), viewsetobject = this.item.view; /*, safety = 100*/ if (istargetarray || istargetobject) { if (istargetobject) { targetyear = value.year; targetmonth = value.month; targetdate = value.date; } else { targetyear = +value[0]; targetmonth = +value[1]; targetdate = +value[2]; } // if we’re navigating months but the view is in a different // month, navigate to the view’s year and month. if (options && options.nav && viewsetobject && viewsetobject.month !== targetmonth) { targetyear = viewsetobject.year; targetmonth = viewsetobject.month; } // figure out the expected target year and month. targetdateobject = new date(targetyear, targetmonth + (options && options.nav ? options.nav : 0), 1); targetyear = targetdateobject.getfullyear(); targetmonth = targetdateobject.getmonth(); // if the month we’re going to doesn’t have enough days, // keep decreasing the date until we reach the month’s last date. while ( /*safety &&*/new date(targetyear, targetmonth, targetdate).getmonth() !== targetmonth) { targetdate -= 1; /*safety -= 1 if ( !safety ) { throw 'fell into an infinite loop while navigating to ' + new date( targetyear, targetmonth, targetdate ) + '.' }*/ } value = [targetyear, targetmonth, targetdate]; } return value; }; //datepicker.prototype.navigate /** * normalize a date by setting the hours to midnight. */ datepicker.prototype.normalize = function (value /*, options*/) { value.sethours(0, 0, 0, 0); return value; }; /** * measure the range of dates. */ datepicker.prototype.measure = function (type, value /*, options*/) { var calendar = this; // if it’s anything false-y, remove the limits. if (!value) { value = type == 'min' ? -infinity : infinity; } // if it’s a string, parse it. else if (typeof value == 'string') { value = calendar.parse(type, value); } // if it's an integer, get a date relative to today. else if (_.isinteger(value)) { value = calendar.now(type, value, { rel: value }); } return value; }; ///datepicker.prototype.measure /** * create a viewset object based on navigation. */ datepicker.prototype.viewset = function (type, dateobject /*, options*/) { return this.create([dateobject.year, dateobject.month, 1]); }; /** * validate a date as enabled and shift if needed. */ datepicker.prototype.validate = function (type, dateobject, options) { var calendar = this, // keep a reference to the original date. originaldateobject = dateobject, // make sure we have an interval. interval = options && options.interval ? options.interval : 1, // check if the calendar enabled dates are inverted. isflippedbase = calendar.item.enable === -1, // check if we have any enabled dates after/before now. hasenabledbeforetarget, hasenabledaftertarget, // the min & max limits. minlimitobject = calendar.item.min, maxlimitobject = calendar.item.max, // check if we’ve reached the limit during shifting. reachedmin, reachedmax, // check if the calendar is inverted and at least one weekday is enabled. hasenabledweekdays = isflippedbase && calendar.item.disable.filter(function (value) { // if there’s a date, check where it is relative to the target. if ($.isarray(value)) { var datetime = calendar.create(value).pick; if (datetime < dateobject.pick) hasenabledbeforetarget = true;else if (datetime > dateobject.pick) hasenabledaftertarget = true; } // return only integers for enabled weekdays. return _.isinteger(value); }).length; /*, safety = 100*/ // cases to validate for: // [1] not inverted and date disabled. // [2] inverted and some dates enabled. // [3] not inverted and out of range. // // cases to **not** validate for: // • navigating months. // • not inverted and date enabled. // • inverted and all dates disabled. // • ..and anything else. if (!options || !options.nav) if ( /* 1 */!isflippedbase && calendar.disabled(dateobject) || /* 2 */isflippedbase && calendar.disabled(dateobject) && (hasenabledweekdays || hasenabledbeforetarget || hasenabledaftertarget) || /* 3 */!isflippedbase && (dateobject.pick <= minlimitobject.pick || dateobject.pick >= maxlimitobject.pick)) { // when inverted, flip the direction if there aren’t any enabled weekdays // and there are no enabled dates in the direction of the interval. if (isflippedbase && !hasenabledweekdays && (!hasenabledaftertarget && interval > 0 || !hasenabledbeforetarget && interval < 0)) { interval *= -1; } // keep looping until we reach an enabled date. while ( /*safety &&*/calendar.disabled(dateobject)) { /*safety -= 1 if ( !safety ) { throw 'fell into an infinite loop while validating ' + dateobject.obj + '.' }*/ // if we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval. if (math.abs(interval) > 1 && (dateobject.month < originaldateobject.month || dateobject.month > originaldateobject.month)) { dateobject = originaldateobject; interval = interval > 0 ? 1 : -1; } // if we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit. if (dateobject.pick <= minlimitobject.pick) { reachedmin = true; interval = 1; dateobject = calendar.create([minlimitobject.year, minlimitobject.month, minlimitobject.date + (dateobject.pick === minlimitobject.pick ? 0 : -1)]); } else if (dateobject.pick >= maxlimitobject.pick) { reachedmax = true; interval = -1; dateobject = calendar.create([maxlimitobject.year, maxlimitobject.month, maxlimitobject.date + (dateobject.pick === maxlimitobject.pick ? 0 : 1)]); } // if we’ve reached both limits, just break out of the loop. if (reachedmin && reachedmax) { break; } // finally, create the shifted date using the interval and keep looping. dateobject = calendar.create([dateobject.year, dateobject.month, dateobject.date + interval]); } } //endif // return the date object settled on. return dateobject; }; //datepicker.prototype.validate /** * check if a date is disabled. */ datepicker.prototype.disabled = function (datetoverify) { var calendar = this, // filter through the disabled dates to check if this is one. isdisabledmatch = calendar.item.disable.filter(function (datetodisable) { // if the date is a number, match the weekday with 0index and `firstday` check. if (_.isinteger(datetodisable)) { return datetoverify.day === (calendar.settings.firstday ? datetodisable : datetodisable - 1) % 7; } // if it’s an array or a native js date, create and match the exact date. if ($.isarray(datetodisable) || _.isdate(datetodisable)) { return datetoverify.pick === calendar.create(datetodisable).pick; } // if it’s an object, match a date within the “from” and “to” range. if ($.isplainobject(datetodisable)) { return calendar.withinrange(datetodisable, datetoverify); } }); // if this date matches a disabled date, confirm it’s not inverted. isdisabledmatch = isdisabledmatch.length && !isdisabledmatch.filter(function (datetodisable) { return $.isarray(datetodisable) && datetodisable[3] == 'inverted' || $.isplainobject(datetodisable) && datetodisable.inverted; }).length; // check the calendar “enabled” flag and respectively flip the // disabled state. then also check if it’s beyond the min/max limits. return calendar.item.enable === -1 ? !isdisabledmatch : isdisabledmatch || datetoverify.pick < calendar.item.min.pick || datetoverify.pick > calendar.item.max.pick; }; //datepicker.prototype.disabled /** * parse a string into a usable type. */ datepicker.prototype.parse = function (type, value, options) { var calendar = this, parsingobject = {}; // if it’s already parsed, we’re good. if (!value || typeof value != 'string') { return value; } // we need a `.format` to parse the value with. if (!(options && options.format)) { options = options || {}; options.format = calendar.settings.format; } // convert the format into an array and then map through it. calendar.formats.toarray(options.format).map(function (label) { var // grab the formatting label. formattinglabel = calendar.formats[label], // the format length is from the formatting label function or the // label length without the escaping exclamation (!) mark. formatlength = formattinglabel ? _.trigger(formattinglabel, calendar, [value, parsingobject]) : label.replace(/^!/, '').length; // if there's a format label, split the value up to the format length. // then add it to the parsing object with appropriate label. if (formattinglabel) { parsingobject[label] = value.substr(0, formatlength); } // update the value as the substring from format length to end. value = value.substr(formatlength); }); // compensate for month 0index. return [parsingobject.yyyy || parsingobject.yy, +(parsingobject.mm || parsingobject.m) - 1, parsingobject.dd || parsingobject.d]; }; //datepicker.prototype.parse /** * various formats to display the object in. */ datepicker.prototype.formats = function () { // return the length of the first word in a collection. function getwordlengthfromcollection(string, collection, dateobject) { // grab the first word from the string. var word = string.match(/\w+/)[0]; // if there's no month index, add it to the date object if (!dateobject.mm && !dateobject.m) { dateobject.m = collection.indexof(word) + 1; } // return the length of the word. return word.length; } // get the length of the first word in a string. function getfirstwordlength(string) { return string.match(/\w+/)[0].length; } return { d: function (string, dateobject) { // if there's string, then get the digits length. // otherwise return the selected date. return string ? _.digits(string) : dateobject.date; }, dd: function (string, dateobject) { // if there's a string, then the length is always 2. // otherwise return the selected date with a leading zero. return string ? 2 : _.lead(dateobject.date); }, ddd: function (string, dateobject) { // if there's a string, then get the length of the first word. // otherwise return the short selected weekday. return string ? getfirstwordlength(string) : this.settings.weekdaysshort[dateobject.day]; }, dddd: function (string, dateobject) { // if there's a string, then get the length of the first word. // otherwise return the full selected weekday. return string ? getfirstwordlength(string) : this.settings.weekdaysfull[dateobject.day]; }, m: function (string, dateobject) { // if there's a string, then get the length of the digits // otherwise return the selected month with 0index compensation. return string ? _.digits(string) : dateobject.month + 1; }, mm: function (string, dateobject) { // if there's a string, then the length is always 2. // otherwise return the selected month with 0index and leading zero. return string ? 2 : _.lead(dateobject.month + 1); }, mmm: function (string, dateobject) { var collection = this.settings.monthsshort; // if there's a string, get length of the relevant month from the short // months collection. otherwise return the selected month from that collection. return string ? getwordlengthfromcollection(string, collection, dateobject) : collection[dateobject.month]; }, mmmm: function (string, dateobject) { var collection = this.settings.monthsfull; // if there's a string, get length of the relevant month from the full // months collection. otherwise return the selected month from that collection. return string ? getwordlengthfromcollection(string, collection, dateobject) : collection[dateobject.month]; }, yy: function (string, dateobject) { // if there's a string, then the length is always 2. // otherwise return the selected year by slicing out the first 2 digits. return string ? 2 : ('' + dateobject.year).slice(2); }, yyyy: function (string, dateobject) { // if there's a string, then the length is always 4. // otherwise return the selected year. return string ? 4 : dateobject.year; }, // create an array by splitting the formatting string passed. toarray: function (formatstring) { return formatstring.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g); }, // format an object into a string using the formatting options. tostring: function (formatstring, itemobject) { var calendar = this; return calendar.formats.toarray(formatstring).map(function (label) { return _.trigger(calendar.formats[label], calendar, [0, itemobject]) || label.replace(/^!/, ''); }).join(''); } }; }(); //datepicker.prototype.formats /** * check if two date units are the exact. */ datepicker.prototype.isdateexact = function (one, two) { var calendar = this; // when we’re working with weekdays, do a direct comparison. if (_.isinteger(one) && _.isinteger(two) || typeof one == 'boolean' && typeof two == 'boolean') { return one === two; } // when we’re working with date representations, compare the “pick” value. if ((_.isdate(one) || $.isarray(one)) && (_.isdate(two) || $.isarray(two))) { return calendar.create(one).pick === calendar.create(two).pick; } // when we’re working with range objects, compare the “from” and “to”. if ($.isplainobject(one) && $.isplainobject(two)) { return calendar.isdateexact(one.from, two.from) && calendar.isdateexact(one.to, two.to); } return false; }; /** * check if two date units overlap. */ datepicker.prototype.isdateoverlap = function (one, two) { var calendar = this, firstday = calendar.settings.firstday ? 1 : 0; // when we’re working with a weekday index, compare the days. if (_.isinteger(one) && (_.isdate(two) || $.isarray(two))) { one = one % 7 + firstday; return one === calendar.create(two).day + 1; } if (_.isinteger(two) && (_.isdate(one) || $.isarray(one))) { two = two % 7 + firstday; return two === calendar.create(one).day + 1; } // when we’re working with range objects, check if the ranges overlap. if ($.isplainobject(one) && $.isplainobject(two)) { return calendar.overlapranges(one, two); } return false; }; /** * flip the “enabled” state. */ datepicker.prototype.flipenable = function (val) { var itemobject = this.item; itemobject.enable = val || (itemobject.enable == -1 ? 1 : -1); }; /** * mark a collection of dates as “disabled”. */ datepicker.prototype.deactivate = function (type, datestodisable) { var calendar = this, disableditems = calendar.item.disable.slice(0); // if we’re flipping, that’s all we need to do. if (datestodisable == 'flip') { calendar.flipenable(); } else if (datestodisable === false) { calendar.flipenable(1); disableditems = []; } else if (datestodisable === true) { calendar.flipenable(-1); disableditems = []; } // otherwise go through the dates to disable. else { datestodisable.map(function (unittodisable) { var matchfound; // when we have disabled items, check for matches. // if something is matched, immediately break out. for (var index = 0; index < disableditems.length; index += 1) { if (calendar.isdateexact(unittodisable, disableditems[index])) { matchfound = true; break; } } // if nothing was found, add the validated unit to the collection. if (!matchfound) { if (_.isinteger(unittodisable) || _.isdate(unittodisable) || $.isarray(unittodisable) || $.isplainobject(unittodisable) && unittodisable.from && unittodisable.to) { disableditems.push(unittodisable); } } }); } // return the updated collection. return disableditems; }; //datepicker.prototype.deactivate /** * mark a collection of dates as “enabled”. */ datepicker.prototype.activate = function (type, datestoenable) { var calendar = this, disableditems = calendar.item.disable, disableditemscount = disableditems.length; // if we’re flipping, that’s all we need to do. if (datestoenable == 'flip') { calendar.flipenable(); } else if (datestoenable === true) { calendar.flipenable(1); disableditems = []; } else if (datestoenable === false) { calendar.flipenable(-1); disableditems = []; } // otherwise go through the disabled dates. else { datestoenable.map(function (unittoenable) { var matchfound, disabledunit, index, isexactrange; // go through the disabled items and try to find a match. for (index = 0; index < disableditemscount; index += 1) { disabledunit = disableditems[index]; // when an exact match is found, remove it from the collection. if (calendar.isdateexact(disabledunit, unittoenable)) { matchfound = disableditems[index] = null; isexactrange = true; break; } // when an overlapped match is found, add the “inverted” state to it. else if (calendar.isdateoverlap(disabledunit, unittoenable)) { if ($.isplainobject(unittoenable)) { unittoenable.inverted = true; matchfound = unittoenable; } else if ($.isarray(unittoenable)) { matchfound = unittoenable; if (!matchfound[3]) matchfound.push('inverted'); } else if (_.isdate(unittoenable)) { matchfound = [unittoenable.getfullyear(), unittoenable.getmonth(), unittoenable.getdate(), 'inverted']; } break; } } // if a match was found, remove a previous duplicate entry. if (matchfound) for (index = 0; index < disableditemscount; index += 1) { if (calendar.isdateexact(disableditems[index], unittoenable)) { disableditems[index] = null; break; } } // in the event that we’re dealing with an exact range of dates, // make sure there are no “inverted” dates because of it. if (isexactrange) for (index = 0; index < disableditemscount; index += 1) { if (calendar.isdateoverlap(disableditems[index], unittoenable)) { disableditems[index] = null; break; } } // if something is still matched, add it into the collection. if (matchfound) { disableditems.push(matchfound); } }); } // return the updated collection. return disableditems.filter(function (val) { return val != null; }); }; //datepicker.prototype.activate /** * create a string for the nodes in the picker. */ datepicker.prototype.nodes = function (isopen) { var calendar = this, settings = calendar.settings, calendaritem = calendar.item, nowobject = calendaritem.now, selectedobject = calendaritem.select, highlightedobject = calendaritem.highlight, viewsetobject = calendaritem.view, disabledcollection = calendaritem.disable, minlimitobject = calendaritem.min, maxlimitobject = calendaritem.max, // create the calendar table head using a copy of weekday labels collection. // * we do a copy so we don't mutate the original array. tablehead = function (collection, fullcollection) { // if the first day should be monday, move sunday to the end. if (settings.firstday) { collection.push(collection.shift()); fullcollection.push(fullcollection.shift()); } // create and return the table head group. return _.node('thead', _.node('tr', _.group({ min: 0, max: days_in_week - 1, i: 1, node: 'th', item: function (counter) { return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullcollection[counter] + '"']; } }))); //endreturn // materialize modified }((settings.showweekdaysfull ? settings.weekdaysfull : settings.weekdaysletter).slice(0), settings.weekdaysfull.slice(0)), //tablehead // create the nav for next/prev month. createmonthnav = function (next) { // otherwise, return the created month tag. return _.node('div', ' ', settings.klass['nav' + (next ? 'next' : 'prev')] + ( // if the focused month is outside the range, disabled the button. next && viewsetobject.year >= maxlimitobject.year && viewsetobject.month >= maxlimitobject.month || !next && viewsetobject.year <= minlimitobject.year && viewsetobject.month <= minlimitobject.month ? ' ' + settings.klass.navdisabled : ''), 'data-nav=' + (next || -1) + ' ' + _.ariaattr({ role: 'button', controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + (next ? settings.labelmonthnext : settings.labelmonthprev) + '"'); //endreturn }, //createmonthnav // create the month label. //materialize modified createmonthlabel = function (override) { var monthscollection = settings.showmonthsshort ? settings.monthsshort : settings.monthsfull; // materialize modified if (override == "short_months") { monthscollection = settings.monthsshort; } // if there are months to select, add a dropdown menu. if (settings.selectmonths && override == undefined) { return _.node('select', _.group({ min: 0, max: 11, i: 1, node: 'option', item: function (loopedmonth) { return [ // the looped month and no classes. monthscollection[loopedmonth], 0, // set the value and selected index. 'value=' + loopedmonth + (viewsetobject.month == loopedmonth ? ' selected' : '') + (viewsetobject.year == minlimitobject.year && loopedmonth < minlimitobject.month || viewsetobject.year == maxlimitobject.year && loopedmonth > maxlimitobject.month ? ' disabled' : '')]; } }), settings.klass.selectmonth + ' browser-default', (isopen ? '' : 'disabled') + ' ' + _.ariaattr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelmonthselect + '"'); } // materialize modified if (override == "short_months") if (selectedobject != null) return monthscollection[selectedobject.month];else return monthscollection[viewsetobject.month]; // if there's a need for a month selector return _.node('div', monthscollection[viewsetobject.month], settings.klass.month); }, //createmonthlabel // create the year label. // materialize modified createyearlabel = function (override) { var focusedyear = viewsetobject.year, // if years selector is set to a literal "true", set it to 5. otherwise // divide in half to get half before and half after focused year. numberyears = settings.selectyears === true ? 5 : ~~(settings.selectyears / 2); // if there are years to select, add a dropdown menu. if (numberyears) { var minyear = minlimitobject.year, maxyear = maxlimitobject.year, lowestyear = focusedyear - numberyears, highestyear = focusedyear + numberyears; // if the min year is greater than the lowest year, increase the highest year // by the difference and set the lowest year to the min year. if (minyear > lowestyear) { highestyear += minyear - lowestyear; lowestyear = minyear; } // if the max year is less than the highest year, decrease the lowest year // by the lower of the two: available and needed years. then set the // highest year to the max year. if (maxyear < highestyear) { var availableyears = lowestyear - minyear, neededyears = highestyear - maxyear; lowestyear -= availableyears > neededyears ? neededyears : availableyears; highestyear = maxyear; } if (settings.selectyears && override == undefined) { return _.node('select', _.group({ min: lowestyear, max: highestyear, i: 1, node: 'option', item: function (loopedyear) { return [ // the looped year and no classes. loopedyear, 0, // set the value and selected index. 'value=' + loopedyear + (focusedyear == loopedyear ? ' selected' : '')]; } }), settings.klass.selectyear + ' browser-default', (isopen ? '' : 'disabled') + ' ' + _.ariaattr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelyearselect + '"'); } } // materialize modified if (override === 'raw' && selectedobject != null) { return _.node('div', selectedobject.year); } // otherwise just return the year focused return _.node('div', focusedyear, settings.klass.year); }; //createyearlabel // materialize modified createdaylabel = function () { if (selectedobject != null) return selectedobject.date;else return nowobject.date; }; createweekdaylabel = function () { var display_day; if (selectedobject != null) display_day = selectedobject.day;else display_day = nowobject.day; var weekday = settings.weekdaysshort[display_day]; return weekday; }; // create and return the entire calendar. return _.node( // date presentation view 'div', _.node( // div for year 'div', createyearlabel("raw"), settings.klass.year_display) + _.node('span', createweekdaylabel() + ', ', "picker__weekday-display") + _.node( // div for short month 'span', createmonthlabel("short_months") + ' ', settings.klass.month_display) + _.node( // div for day 'span', createdaylabel(), settings.klass.day_display), settings.klass.date_display) + // calendar container _.node('div', _.node('div', _.node('div', (settings.selectyears ? createmonthlabel() + createyearlabel() : createmonthlabel() + createyearlabel()) + createmonthnav() + createmonthnav(1), settings.klass.header) + _.node('table', tablehead + _.node('tbody', _.group({ min: 0, max: weeks_in_calendar - 1, i: 1, node: 'tr', item: function (rowcounter) { // if monday is the first day and the month starts on sunday, shift the date back a week. var shiftdateby = settings.firstday && calendar.create([viewsetobject.year, viewsetobject.month, 1]).day === 0 ? -7 : 0; return [_.group({ min: days_in_week * rowcounter - viewsetobject.day + shiftdateby + 1, // add 1 for weekday 0index max: function () { return this.min + days_in_week - 1; }, i: 1, node: 'td', item: function (targetdate) { // convert the time date from a relative date to a target date. targetdate = calendar.create([viewsetobject.year, viewsetobject.month, targetdate + (settings.firstday ? 1 : 0)]); var isselected = selectedobject && selectedobject.pick == targetdate.pick, ishighlighted = highlightedobject && highlightedobject.pick == targetdate.pick, isdisabled = disabledcollection && calendar.disabled(targetdate) || targetdate.pick < minlimitobject.pick || targetdate.pick > maxlimitobject.pick, formatteddate = _.trigger(calendar.formats.tostring, calendar, [settings.format, targetdate]); return [_.node('div', targetdate.date, function (klasses) { // add the `infocus` or `outfocus` classes based on month in view. klasses.push(viewsetobject.month == targetdate.month ? settings.klass.infocus : settings.klass.outfocus); // add the `today` class if needed. if (nowobject.pick == targetdate.pick) { klasses.push(settings.klass.now); } // add the `selected` class if something's selected and the time matches. if (isselected) { klasses.push(settings.klass.selected); } // add the `highlighted` class if something's highlighted and the time matches. if (ishighlighted) { klasses.push(settings.klass.highlighted); } // add the `disabled` class if something's disabled and the object matches. if (isdisabled) { klasses.push(settings.klass.disabled); } return klasses.join(' '); }([settings.klass.day]), 'data-pick=' + targetdate.pick + ' ' + _.ariaattr({ role: 'gridcell', label: formatteddate, selected: isselected && calendar.$node.val() === formatteddate ? true : null, activedescendant: ishighlighted ? true : null, disabled: isdisabled ? true : null }) + ' ' + (isdisabled ? '' : 'tabindex="0"')), '', _.ariaattr({ role: 'presentation' })]; //endreturn } })]; //endreturn } })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaattr({ role: 'grid', controls: calendar.$node[0].id, readonly: true })), settings.klass.calendar_container) // end calendar + // * for firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”. _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowobject.pick + (isopen && !calendar.disabled(nowobject) ? '' : ' disabled') + ' ' + _.ariaattr({ controls: calendar.$node[0].id })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isopen ? '' : ' disabled') + ' ' + _.ariaattr({ controls: calendar.$node[0].id })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isopen ? '' : ' disabled') + ' ' + _.ariaattr({ controls: calendar.$node[0].id })), settings.klass.footer), 'picker__container__wrapper'); //endreturn }; //datepicker.prototype.nodes /** * the date picker defaults. */ datepicker.defaults = function (prefix) { return { // the title label to use for the month nav buttons labelmonthnext: 'next month', labelmonthprev: 'previous month', // the title label to use for the dropdown selectors labelmonthselect: 'select a month', labelyearselect: 'select a year', // months and weekdays monthsfull: ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'], monthsshort: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], weekdaysfull: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'], weekdaysshort: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], // materialize modified weekdaysletter: ['s', 'm', 't', 'w', 't', 'f', 's'], // today and clear today: 'today', clear: 'clear', close: 'ok', // picker close behavior (prevent a change in behaviour for backwards compatibility) closeonselect: false, // the format to show on the `input` element format: 'd mmmm, yyyy', // classes klass: { table: prefix + 'table', header: prefix + 'header', // materialize added klasses date_display: prefix + 'date-display', day_display: prefix + 'day-display', month_display: prefix + 'month-display', year_display: prefix + 'year-display', calendar_container: prefix + 'calendar-container', // end navprev: prefix + 'nav--prev', navnext: prefix + 'nav--next', navdisabled: prefix + 'nav--disabled', month: prefix + 'month', year: prefix + 'year', selectmonth: prefix + 'select--month', selectyear: prefix + 'select--year', weekdays: prefix + 'weekday', day: prefix + 'day', disabled: prefix + 'day--disabled', selected: prefix + 'day--selected', highlighted: prefix + 'day--highlighted', now: prefix + 'day--today', infocus: prefix + 'day--infocus', outfocus: prefix + 'day--outfocus', footer: prefix + 'footer', buttonclear: prefix + 'button--clear', buttontoday: prefix + 'button--today', buttonclose: prefix + 'button--close' } }; }(picker.klasses().picker + '__'); /** * extend the picker to add the date picker. */ picker.extend('pickadate', datepicker); }); ; /*! * clockpicker v0.0.7 (http://weareoutman.github.io/clockpicker/) * copyright 2014 wang shenwei. * licensed under mit (https://github.com/weareoutman/clockpicker/blob/gh-pages/license) * * further modified * copyright 2015 ching yaw hao. */ (function ($) { var $win = $(window), $doc = $(document); // can i use inline svg ? var svgns = 'http://www.w3.org/2000/svg', svgsupported = 'svgangle' in window && function () { var supported, el = document.createelement('div'); el.innerhtml = ''; supported = (el.firstchild && el.firstchild.namespaceuri) == svgns; el.innerhtml = ''; return supported; }(); // can i use transition ? var transitionsupported = function () { var style = document.createelement('div').style; return 'transition' in style || 'webkittransition' in style || 'moztransition' in style || 'mstransition' in style || 'otransition' in style; }(); // listen touch events in touch screen device, instead of mouse events in desktop. var touchsupported = 'ontouchstart' in window, mousedownevent = 'mousedown' + (touchsupported ? ' touchstart' : ''), mousemoveevent = 'mousemove.clockpicker' + (touchsupported ? ' touchmove.clockpicker' : ''), mouseupevent = 'mouseup.clockpicker' + (touchsupported ? ' touchend.clockpicker' : ''); // vibrate the device if supported var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitvibrate ? 'webkitvibrate' : null; function createsvgelement(name) { return document.createelementns(svgns, name); } function leadingzero(num) { return (num < 10 ? '0' : '') + num; } // get a unique id var idcounter = 0; function uniqueid(prefix) { var id = ++idcounter + ''; return prefix ? prefix + id : id; } // clock size var dialradius = 135, outerradius = 105, // innerradius = 80 on 12 hour clock innerradius = 70, tickradius = 20, diameter = dialradius * 2, duration = transitionsupported ? 350 : 1; // popover template var tpl = ['
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '', ':', '', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '
    ', '', '
    ', '
    ', '
    ', '
    ', '
    ', '
    '].join(''); // clockpicker function clockpicker(element, options) { var popover = $(tpl), plate = popover.find('.clockpicker-plate'), holder = popover.find('.picker__holder'), hoursview = popover.find('.clockpicker-hours'), minutesview = popover.find('.clockpicker-minutes'), ampmblock = popover.find('.clockpicker-am-pm-block'), isinput = element.prop('tagname') === 'input', input = isinput ? element : element.find('input'), label = $("label[for=" + input.attr("id") + "]"), self = this; this.id = uniqueid('cp'); this.element = element; this.holder = holder; this.options = options; this.isappended = false; this.isshown = false; this.currentview = 'hours'; this.isinput = isinput; this.input = input; this.label = label; this.popover = popover; this.plate = plate; this.hoursview = hoursview; this.minutesview = minutesview; this.ampmblock = ampmblock; this.spanhours = popover.find('.clockpicker-span-hours'); this.spanminutes = popover.find('.clockpicker-span-minutes'); this.spanampm = popover.find('.clockpicker-span-am-pm'); this.footer = popover.find('.picker__footer'); this.amorpm = "pm"; // setup for for 12 hour clock if option is selected if (options.twelvehour) { if (!options.ampmclickable) { this.spanampm.empty(); $('
    am
    ').appendto(this.spanampm); $('
    pm
    ').appendto(this.spanampm); } else { this.spanampm.empty(); $('
    am
    ').on("click", function () { self.spanampm.children('#click-am').addclass("text-primary"); self.spanampm.children('#click-pm').removeclass("text-primary"); self.amorpm = "am"; }).appendto(this.spanampm); $('
    pm
    ').on("click", function () { self.spanampm.children('#click-pm').addclass("text-primary"); self.spanampm.children('#click-am').removeclass("text-primary"); self.amorpm = 'pm'; }).appendto(this.spanampm); } } // add buttons to footer $('').click($.proxy(this.clear, this)).appendto(this.footer); $('').click($.proxy(this.hide, this)).appendto(this.footer); $('').click($.proxy(this.done, this)).appendto(this.footer); this.spanhours.click($.proxy(this.toggleview, this, 'hours')); this.spanminutes.click($.proxy(this.toggleview, this, 'minutes')); // show or toggle input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this)); // build ticks var ticktpl = $('
    '), i, tick, radian, radius; // hours view if (options.twelvehour) { for (i = 1; i < 13; i += 1) { tick = ticktpl.clone(); radian = i / 6 * math.pi; radius = outerradius; tick.css({ left: dialradius + math.sin(radian) * radius - tickradius, top: dialradius - math.cos(radian) * radius - tickradius }); tick.html(i === 0 ? '00' : i); hoursview.append(tick); tick.on(mousedownevent, mousedown); } } else { for (i = 0; i < 24; i += 1) { tick = ticktpl.clone(); radian = i / 6 * math.pi; var inner = i > 0 && i < 13; radius = inner ? innerradius : outerradius; tick.css({ left: dialradius + math.sin(radian) * radius - tickradius, top: dialradius - math.cos(radian) * radius - tickradius }); tick.html(i === 0 ? '00' : i); hoursview.append(tick); tick.on(mousedownevent, mousedown); } } // minutes view for (i = 0; i < 60; i += 5) { tick = ticktpl.clone(); radian = i / 30 * math.pi; tick.css({ left: dialradius + math.sin(radian) * outerradius - tickradius, top: dialradius - math.cos(radian) * outerradius - tickradius }); tick.html(leadingzero(i)); minutesview.append(tick); tick.on(mousedownevent, mousedown); } // clicking on minutes view space plate.on(mousedownevent, function (e) { if ($(e.target).closest('.clockpicker-tick').length === 0) { mousedown(e, true); } }); // mousedown or touchstart function mousedown(e, space) { var offset = plate.offset(), istouch = /^touch/.test(e.type), x0 = offset.left + dialradius, y0 = offset.top + dialradius, dx = (istouch ? e.originalevent.touches[0] : e).pagex - x0, dy = (istouch ? e.originalevent.touches[0] : e).pagey - y0, z = math.sqrt(dx * dx + dy * dy), moved = false; // when clicking on minutes view space, check the mouse position if (space && (z < outerradius - tickradius || z > outerradius + tickradius)) { return; } e.preventdefault(); // set cursor style of body after 200ms var movingtimer = settimeout(function () { self.popover.addclass('clockpicker-moving'); }, 200); // clock self.sethand(dx, dy, !space, true); // mousemove on document $doc.off(mousemoveevent).on(mousemoveevent, function (e) { e.preventdefault(); var istouch = /^touch/.test(e.type), x = (istouch ? e.originalevent.touches[0] : e).pagex - x0, y = (istouch ? e.originalevent.touches[0] : e).pagey - y0; if (!moved && x === dx && y === dy) { // clicking in chrome on windows will trigger a mousemove event return; } moved = true; self.sethand(x, y, false, true); }); // mouseup on document $doc.off(mouseupevent).on(mouseupevent, function (e) { $doc.off(mouseupevent); e.preventdefault(); var istouch = /^touch/.test(e.type), x = (istouch ? e.originalevent.changedtouches[0] : e).pagex - x0, y = (istouch ? e.originalevent.changedtouches[0] : e).pagey - y0; if ((space || moved) && x === dx && y === dy) { self.sethand(x, y); } if (self.currentview === 'hours') { self.toggleview('minutes', duration / 2); } else if (options.autoclose) { self.minutesview.addclass('clockpicker-dial-out'); settimeout(function () { self.done(); }, duration / 2); } plate.prepend(canvas); // reset cursor style of body cleartimeout(movingtimer); self.popover.removeclass('clockpicker-moving'); // unbind mousemove event $doc.off(mousemoveevent); }); } if (svgsupported) { // draw clock hands and others var canvas = popover.find('.clockpicker-canvas'), svg = createsvgelement('svg'); svg.setattribute('class', 'clockpicker-svg'); svg.setattribute('width', diameter); svg.setattribute('height', diameter); var g = createsvgelement('g'); g.setattribute('transform', 'translate(' + dialradius + ',' + dialradius + ')'); var bearing = createsvgelement('circle'); bearing.setattribute('class', 'clockpicker-canvas-bearing'); bearing.setattribute('cx', 0); bearing.setattribute('cy', 0); bearing.setattribute('r', 4); var hand = createsvgelement('line'); hand.setattribute('x1', 0); hand.setattribute('y1', 0); var bg = createsvgelement('circle'); bg.setattribute('class', 'clockpicker-canvas-bg'); bg.setattribute('r', tickradius); g.appendchild(hand); g.appendchild(bg); g.appendchild(bearing); svg.appendchild(g); canvas.append(svg); this.hand = hand; this.bg = bg; this.bearing = bearing; this.g = g; this.canvas = canvas; } raisecallback(this.options.init); } function raisecallback(callbackfunction) { if (callbackfunction && typeof callbackfunction === "function") callbackfunction(); } // default options clockpicker.defaults = { 'default': '', // default time, 'now' or '13:14' e.g. fromnow: 0, // set default time to * milliseconds from now (using with default = 'now') donetext: 'ok', // done button text cleartext: 'clear', canceltext: 'cancel', autoclose: false, // auto close when minute is selected ampmclickable: true, // set am/pm button on itself darktheme: false, // set to dark theme twelvehour: true, // change to 12 hour am/pm clock from 24 hour vibrate: true // vibrate the device when dragging clock hand }; // show or hide popover clockpicker.prototype.toggle = function () { this[this.isshown ? 'hide' : 'show'](); }; // set popover position clockpicker.prototype.locate = function () { var element = this.element, popover = this.popover, offset = element.offset(), width = element.outerwidth(), height = element.outerheight(), align = this.options.align, self = this; popover.show(); }; // show popover clockpicker.prototype.show = function (e) { // not show again if (this.isshown) { return; } raisecallback(this.options.beforeshow); $(':input').each(function () { $(this).attr('tabindex', -1); }); var self = this; // initialize this.input.blur(); this.popover.addclass('picker--opened'); this.input.addclass('picker__input picker__input--active'); $(document.body).css('overflow', 'hidden'); // get the time var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':'); if (this.options.twelvehour && !(typeof value[1] === 'undefined')) { if (value[1].indexof("am") > 0) { this.amorpm = 'am'; } else { this.amorpm = 'pm'; } value[1] = value[1].replace("am", "").replace("pm", ""); } if (value[0] === 'now') { var now = new date(+new date() + this.options.fromnow); value = [now.gethours(), now.getminutes()]; if (this.options.twelvehour) { this.amorpm = value[0] >= 12 && value[0] < 24 ? 'pm' : 'am'; } } this.hours = +value[0] || 0; this.minutes = +value[1] || 0; this.spanhours.html(this.hours); this.spanminutes.html(leadingzero(this.minutes)); if (!this.isappended) { // append popover to input by default var containerel = document.queryselector(this.options.container); if (this.options.container && containerel) { containerel.appendchild(this.popover[0]); } else { this.popover.insertafter(this.input); } if (this.options.twelvehour) { if (this.amorpm === 'pm') { this.spanampm.children('#click-pm').addclass("text-primary"); this.spanampm.children('#click-am').removeclass("text-primary"); } else { this.spanampm.children('#click-am').addclass("text-primary"); this.spanampm.children('#click-pm').removeclass("text-primary"); } } // reset position when resize $win.on('resize.clockpicker' + this.id, function () { if (self.isshown) { self.locate(); } }); this.isappended = true; } // toggle to hours view this.toggleview('hours'); // set position this.locate(); this.isshown = true; // hide when clicking or tabbing on any element except the clock and input $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) { var target = $(e.target); if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) { self.hide(); } }); // hide when esc is pressed $doc.on('keyup.clockpicker.' + this.id, function (e) { if (e.keycode === 27) { self.hide(); } }); raisecallback(this.options.aftershow); }; // hide popover clockpicker.prototype.hide = function () { raisecallback(this.options.beforehide); this.input.removeclass('picker__input picker__input--active'); this.popover.removeclass('picker--opened'); $(document.body).css('overflow', 'visible'); this.isshown = false; $(':input').each(function (index) { $(this).attr('tabindex', index + 1); }); // unbinding events on document $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id); $doc.off('keyup.clockpicker.' + this.id); this.popover.hide(); raisecallback(this.options.afterhide); }; // toggle to hours or minutes view clockpicker.prototype.toggleview = function (view, delay) { var raiseafterhourselect = false; if (view === 'minutes' && $(this.hoursview).css("visibility") === "visible") { raisecallback(this.options.beforehourselect); raiseafterhourselect = true; } var ishours = view === 'hours', nextview = ishours ? this.hoursview : this.minutesview, hideview = ishours ? this.minutesview : this.hoursview; this.currentview = view; this.spanhours.toggleclass('text-primary', ishours); this.spanminutes.toggleclass('text-primary', !ishours); // let's make transitions hideview.addclass('clockpicker-dial-out'); nextview.css('visibility', 'visible').removeclass('clockpicker-dial-out'); // reset clock hand this.resetclock(delay); // after transitions ended cleartimeout(this.toggleviewtimer); this.toggleviewtimer = settimeout(function () { hideview.css('visibility', 'hidden'); }, duration); if (raiseafterhourselect) { raisecallback(this.options.afterhourselect); } }; // reset clock hand clockpicker.prototype.resetclock = function (delay) { var view = this.currentview, value = this[view], ishours = view === 'hours', unit = math.pi / (ishours ? 6 : 30), radian = value * unit, radius = ishours && value > 0 && value < 13 ? innerradius : outerradius, x = math.sin(radian) * radius, y = -math.cos(radian) * radius, self = this; if (svgsupported && delay) { self.canvas.addclass('clockpicker-canvas-out'); settimeout(function () { self.canvas.removeclass('clockpicker-canvas-out'); self.sethand(x, y); }, delay); } else this.sethand(x, y); }; // set clock hand to (x, y) clockpicker.prototype.sethand = function (x, y, roundby5, dragging) { var radian = math.atan2(x, -y), ishours = this.currentview === 'hours', unit = math.pi / (ishours || roundby5 ? 6 : 30), z = math.sqrt(x * x + y * y), options = this.options, inner = ishours && z < (outerradius + innerradius) / 2, radius = inner ? innerradius : outerradius, value; if (options.twelvehour) { radius = outerradius; } // radian should in range [0, 2pi] if (radian < 0) { radian = math.pi * 2 + radian; } // get the round value value = math.round(radian / unit); // get the round radian radian = value * unit; // correct the hours or minutes if (options.twelvehour) { if (ishours) { if (value === 0) value = 12; } else { if (roundby5) value *= 5; if (value === 60) value = 0; } } else { if (ishours) { if (value === 12) value = 0; value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; } else { if (roundby5) value *= 5; if (value === 60) value = 0; } } // once hours or minutes changed, vibrate the device if (this[this.currentview] !== value) { if (vibrate && this.options.vibrate) { // do not vibrate too frequently if (!this.vibratetimer) { navigator[vibrate](10); this.vibratetimer = settimeout($.proxy(function () { this.vibratetimer = null; }, this), 100); } } } this[this.currentview] = value; if (ishours) { this['spanhours'].html(value); } else { this['spanminutes'].html(leadingzero(value)); } // if svg is not supported, just add an active class to the tick if (!svgsupported) { this[ishours ? 'hoursview' : 'minutesview'].find('.clockpicker-tick').each(function () { var tick = $(this); tick.toggleclass('active', value === +tick.html()); }); return; } // set clock hand and others' position var cx1 = math.sin(radian) * (radius - tickradius), cy1 = -math.cos(radian) * (radius - tickradius), cx2 = math.sin(radian) * radius, cy2 = -math.cos(radian) * radius; this.hand.setattribute('x2', cx1); this.hand.setattribute('y2', cy1); this.bg.setattribute('cx', cx2); this.bg.setattribute('cy', cy2); }; // hours and minutes are selected clockpicker.prototype.done = function () { raisecallback(this.options.beforedone); this.hide(); this.label.addclass('active'); var last = this.input.prop('value'), value = leadingzero(this.hours) + ':' + leadingzero(this.minutes); if (this.options.twelvehour) { value = value + this.amorpm; } this.input.prop('value', value); if (value !== last) { this.input.triggerhandler('change'); if (!this.isinput) { this.element.trigger('change'); } } if (this.options.autoclose) this.input.trigger('blur'); raisecallback(this.options.afterdone); }; // clear input field clockpicker.prototype.clear = function () { this.hide(); this.label.removeclass('active'); var last = this.input.prop('value'), value = ''; this.input.prop('value', value); if (value !== last) { this.input.triggerhandler('change'); if (!this.isinput) { this.element.trigger('change'); } } if (this.options.autoclose) { this.input.trigger('blur'); } }; // remove clockpicker from input clockpicker.prototype.remove = function () { this.element.removedata('clockpicker'); this.input.off('focus.clockpicker click.clockpicker'); if (this.isshown) { this.hide(); } if (this.isappended) { $win.off('resize.clockpicker' + this.id); this.popover.remove(); } }; // extends $.fn.clockpicker $.fn.pickatime = function (option) { var args = array.prototype.slice.call(arguments, 1); return this.each(function () { var $this = $(this), data = $this.data('clockpicker'); if (!data) { var options = $.extend({}, clockpicker.defaults, $this.data(), typeof option == 'object' && option); $this.data('clockpicker', new clockpicker($this, options)); } else { // manual operatsions. show, hide, remove, e.g. if (typeof data[option] === 'function') { data[option].apply(data, args); } } }); }; })(jquery); ;(function ($) { $.fn.charactercounter = function () { return this.each(function () { var $input = $(this); var $counterelement = $input.parent().find('span[class="character-counter"]'); // character counter has already been added appended to the parent container if ($counterelement.length) { return; } var ithaslengthattribute = $input.attr('data-length') !== undefined; if (ithaslengthattribute) { $input.on('input', updatecounter); $input.on('focus', updatecounter); $input.on('blur', removecounterelement); addcounterelement($input); } }); }; function updatecounter() { var maxlength = +$(this).attr('data-length'), actuallength = +$(this).val().length, isvalidlength = actuallength <= maxlength; $(this).parent().find('span[class="character-counter"]').html(actuallength + '/' + maxlength); addinputstyle(isvalidlength, $(this)); } function addcounterelement($input) { var $counterelement = $input.parent().find('span[class="character-counter"]'); if ($counterelement.length) { return; } $counterelement = $('').addclass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1); $input.parent().append($counterelement); } function removecounterelement() { $(this).parent().find('span[class="character-counter"]').html(''); } function addinputstyle(isvalidlength, $input) { var inputhasinvalidclass = $input.hasclass('invalid'); if (isvalidlength && inputhasinvalidclass) { $input.removeclass('invalid'); } else if (!isvalidlength && !inputhasinvalidclass) { $input.removeclass('valid'); $input.addclass('invalid'); } } $(document).ready(function () { $('input, textarea').charactercounter(); }); })(jquery); ;(function ($) { var methods = { init: function (options) { var defaults = { duration: 200, // ms dist: -100, // zoom scale todo: make this more intuitive as an option shift: 0, // spacing for center image padding: 0, // padding between non center items fullwidth: false, // change to full width styles indicators: false, // toggle indicators nowrap: false, // don't wrap around and cycle through items. oncycleto: null // callback for when a new slide is cycled to. }; options = $.extend(defaults, options); var namespace = materialize.objectselectorstring($(this)); return this.each(function (i) { var images, item_width, item_height, offset, center, pressed, dim, count, reference, referencey, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged; var $indicators = $('
      '); var scrollingtimeout = null; var onetimecallback = null; // initialize var view = $(this); var hasmultipleslides = view.find('.carousel-item').length > 1; var showindicators = (view.attr('data-indicators') || options.indicators) && hasmultipleslides; var nowrap = view.attr('data-no-wrap') || options.nowrap || !hasmultipleslides; var uniquenamespace = view.attr('data-namespace') || namespace + i; view.attr('data-namespace', uniquenamespace); // options var setcarouselheight = function (imageonly) { var firstslide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first(); var firstimage = firstslide.find('img').first(); if (firstimage.length) { if (firstimage[0].complete) { // if image won't trigger the load event var imageheight = firstimage.height(); if (imageheight > 0) { view.css('height', firstimage.height()); } else { // if image still has no height, use the natural dimensions to calculate var naturalwidth = firstimage[0].naturalwidth; var naturalheight = firstimage[0].naturalheight; var adjustedheight = view.width() / naturalwidth * naturalheight; view.css('height', adjustedheight); } } else { // get height when image is loaded normally firstimage.on('load', function () { view.css('height', $(this).height()); }); } } else if (!imageonly) { var slideheight = firstslide.height(); view.css('height', slideheight); } }; if (options.fullwidth) { options.dist = 0; setcarouselheight(); // offset fixed items when indicators. if (showindicators) { view.find('.carousel-fixed-item').addclass('with-indicators'); } } // don't double initialize. if (view.hasclass('initialized')) { // recalculate variables $(window).trigger('resize'); // redraw carousel. view.trigger('carouselnext', [0.000001]); return true; } view.addclass('initialized'); pressed = false; offset = target = 0; images = []; item_width = view.find('.carousel-item').first().innerwidth(); item_height = view.find('.carousel-item').first().innerheight(); dim = item_width * 2 + options.padding; view.find('.carousel-item').each(function (i) { images.push($(this)[0]); if (showindicators) { var $indicator = $('
    • '); // add active to first by default. if (i === 0) { $indicator.addclass('active'); } // handle clicks on indicators. $indicator.click(function (e) { e.stoppropagation(); var index = $(this).index(); cycleto(index); }); $indicators.append($indicator); } }); if (showindicators) { view.append($indicators); } count = images.length; function setupevents() { if (typeof window.ontouchstart !== 'undefined') { view.on('touchstart.carousel', tap); view.on('touchmove.carousel', drag); view.on('touchend.carousel', release); } view.on('mousedown.carousel', tap); view.on('mousemove.carousel', drag); view.on('mouseup.carousel', release); view.on('mouseleave.carousel', release); view.on('click.carousel', click); } function xpos(e) { // touch event if (e.targettouches && e.targettouches.length >= 1) { return e.targettouches[0].clientx; } // mouse event return e.clientx; } function ypos(e) { // touch event if (e.targettouches && e.targettouches.length >= 1) { return e.targettouches[0].clienty; } // mouse event return e.clienty; } function wrap(x) { return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x; } function scroll(x) { // track scrolling state scrolling = true; if (!view.hasclass('scrolling')) { view.addclass('scrolling'); } if (scrollingtimeout != null) { window.cleartimeout(scrollingtimeout); } scrollingtimeout = window.settimeout(function () { scrolling = false; view.removeclass('scrolling'); }, options.duration); // start actual scroll var i, half, delta, dir, tween, el, alignment, xtranslation; var lastcenter = center; offset = typeof x === 'number' ? x : offset; center = math.floor((offset + dim / 2) / dim); delta = offset - center * dim; dir = delta < 0 ? 1 : -1; tween = -dir * delta * 2 / dim; half = count >> 1; if (!options.fullwidth) { alignment = 'translatex(' + (view[0].clientwidth - item_width) / 2 + 'px) '; alignment += 'translatey(' + (view[0].clientheight - item_height) / 2 + 'px)'; } else { alignment = 'translatex(0)'; } // set indicator active if (showindicators) { var diff = center % count; var activeindicator = $indicators.find('.indicator-item.active'); if (activeindicator.index() !== diff) { activeindicator.removeclass('active'); $indicators.find('.indicator-item').eq(diff).addclass('active'); } } // center // don't show wrapped items. if (!nowrap || center >= 0 && center < count) { el = images[wrap(center)]; // add active class to center item. if (!$(el).hasclass('active')) { view.find('.carousel-item').removeclass('active'); $(el).addclass('active'); } el.style[xform] = alignment + ' translatex(' + -delta / 2 + 'px)' + ' translatex(' + dir * options.shift * tween * i + 'px)' + ' translatez(' + options.dist * tween + 'px)'; el.style.zindex = 0; if (options.fullwidth) { tweenedopacity = 1; } else { tweenedopacity = 1 - 0.2 * tween; } el.style.opacity = tweenedopacity; el.style.display = 'block'; } for (i = 1; i <= half; ++i) { // right side if (options.fullwidth) { ztranslation = options.dist; tweenedopacity = i === half && delta < 0 ? 1 - tween : 1; } else { ztranslation = options.dist * (i * 2 + tween * dir); tweenedopacity = 1 - 0.2 * (i * 2 + tween * dir); } // don't show wrapped items. if (!nowrap || center + i < count) { el = images[wrap(center + i)]; el.style[xform] = alignment + ' translatex(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translatez(' + ztranslation + 'px)'; el.style.zindex = -i; el.style.opacity = tweenedopacity; el.style.display = 'block'; } // left side if (options.fullwidth) { ztranslation = options.dist; tweenedopacity = i === half && delta > 0 ? 1 - tween : 1; } else { ztranslation = options.dist * (i * 2 - tween * dir); tweenedopacity = 1 - 0.2 * (i * 2 - tween * dir); } // don't show wrapped items. if (!nowrap || center - i >= 0) { el = images[wrap(center - i)]; el.style[xform] = alignment + ' translatex(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translatez(' + ztranslation + 'px)'; el.style.zindex = -i; el.style.opacity = tweenedopacity; el.style.display = 'block'; } } // center // don't show wrapped items. if (!nowrap || center >= 0 && center < count) { el = images[wrap(center)]; el.style[xform] = alignment + ' translatex(' + -delta / 2 + 'px)' + ' translatex(' + dir * options.shift * tween + 'px)' + ' translatez(' + options.dist * tween + 'px)'; el.style.zindex = 0; if (options.fullwidth) { tweenedopacity = 1; } else { tweenedopacity = 1 - 0.2 * tween; } el.style.opacity = tweenedopacity; el.style.display = 'block'; } // oncycleto callback if (lastcenter !== center && typeof options.oncycleto === "function") { var $curr_item = view.find('.carousel-item').eq(wrap(center)); options.oncycleto.call(this, $curr_item, dragged); } // one time callback if (typeof onetimecallback === "function") { onetimecallback.call(this, $curr_item, dragged); onetimecallback = null; } } function track() { var now, elapsed, delta, v; now = date.now(); elapsed = now - timestamp; timestamp = now; delta = offset - frame; frame = offset; v = 1000 * delta / (1 + elapsed); velocity = 0.8 * v + 0.2 * velocity; } function autoscroll() { var elapsed, delta; if (amplitude) { elapsed = date.now() - timestamp; delta = amplitude * math.exp(-elapsed / options.duration); if (delta > 2 || delta < -2) { scroll(target - delta); requestanimationframe(autoscroll); } else { scroll(target); } } } function click(e) { // disable clicks if carousel was dragged. if (dragged) { e.preventdefault(); e.stoppropagation(); return false; } else if (!options.fullwidth) { var clickedindex = $(e.target).closest('.carousel-item').index(); var diff = wrap(center) - clickedindex; // disable clicks if carousel was shifted by click if (diff !== 0) { e.preventdefault(); e.stoppropagation(); } cycleto(clickedindex); } } function cycleto(n) { var diff = center % count - n; // account for wraparound. if (!nowrap) { if (diff < 0) { if (math.abs(diff + count) < math.abs(diff)) { diff += count; } } else if (diff > 0) { if (math.abs(diff - count) < diff) { diff -= count; } } } // call prev or next accordingly. if (diff < 0) { view.trigger('carouselnext', [math.abs(diff)]); } else if (diff > 0) { view.trigger('carouselprev', [diff]); } } function tap(e) { // fixes firefox draggable image bug if (e.type === 'mousedown' && $(e.target).is('img')) { e.preventdefault(); } pressed = true; dragged = false; vertical_dragged = false; reference = xpos(e); referencey = ypos(e); velocity = amplitude = 0; frame = offset; timestamp = date.now(); clearinterval(ticker); ticker = setinterval(track, 100); } function drag(e) { var x, delta, deltay; if (pressed) { x = xpos(e); y = ypos(e); delta = reference - x; deltay = math.abs(referencey - y); if (deltay < 30 && !vertical_dragged) { // if vertical scrolling don't allow dragging. if (delta > 2 || delta < -2) { dragged = true; reference = x; scroll(offset + delta); } } else if (dragged) { // if dragging don't allow vertical scroll. e.preventdefault(); e.stoppropagation(); return false; } else { // vertical scrolling. vertical_dragged = true; } } if (dragged) { // if dragging don't allow vertical scroll. e.preventdefault(); e.stoppropagation(); return false; } } function release(e) { if (pressed) { pressed = false; } else { return; } clearinterval(ticker); target = offset; if (velocity > 10 || velocity < -10) { amplitude = 0.9 * velocity; target = offset + amplitude; } target = math.round(target / dim) * dim; // no wrap of items. if (nowrap) { if (target >= dim * (count - 1)) { target = dim * (count - 1); } else if (target < 0) { target = 0; } } amplitude = target - offset; timestamp = date.now(); requestanimationframe(autoscroll); if (dragged) { e.preventdefault(); e.stoppropagation(); } return false; } xform = 'transform'; ['webkit', 'moz', 'o', 'ms'].every(function (prefix) { var e = prefix + 'transform'; if (typeof document.body.style[e] !== 'undefined') { xform = e; return false; } return true; }); var throttledresize = materialize.throttle(function () { if (options.fullwidth) { item_width = view.find('.carousel-item').first().innerwidth(); var imageheight = view.find('.carousel-item.active').height(); dim = item_width * 2 + options.padding; offset = center * 2 * item_width; target = offset; setcarouselheight(true); } else { scroll(); } }, 200); $(window).off('resize.carousel-' + uniquenamespace).on('resize.carousel-' + uniquenamespace, throttledresize); setupevents(); scroll(offset); $(this).on('carouselnext', function (e, n, callback) { if (n === undefined) { n = 1; } if (typeof callback === "function") { onetimecallback = callback; } target = dim * math.round(offset / dim) + dim * n; if (offset !== target) { amplitude = target - offset; timestamp = date.now(); requestanimationframe(autoscroll); } }); $(this).on('carouselprev', function (e, n, callback) { if (n === undefined) { n = 1; } if (typeof callback === "function") { onetimecallback = callback; } target = dim * math.round(offset / dim) - dim * n; if (offset !== target) { amplitude = target - offset; timestamp = date.now(); requestanimationframe(autoscroll); } }); $(this).on('carouselset', function (e, n, callback) { if (n === undefined) { n = 0; } if (typeof callback === "function") { onetimecallback = callback; } cycleto(n); }); }); }, next: function (n, callback) { $(this).trigger('carouselnext', [n, callback]); }, prev: function (n, callback) { $(this).trigger('carouselprev', [n, callback]); }, set: function (n, callback) { $(this).trigger('carouselset', [n, callback]); }, destroy: function () { var uniquenamespace = $(this).attr('data-namespace'); $(this).removeattr('data-namespace'); $(this).removeclass('initialized'); $(this).find('.indicators').remove(); // remove event handlers $(this).off('carouselnext carouselprev carouselset'); $(window).off('resize.carousel-' + uniquenamespace); if (typeof window.ontouchstart !== 'undefined') { $(this).off('touchstart.carousel touchmove.carousel touchend.carousel'); } $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel'); } }; $.fn.carousel = function (methodoroptions) { if (methods[methodoroptions]) { return methods[methodoroptions].apply(this, array.prototype.slice.call(arguments, 1)); } else if (typeof methodoroptions === 'object' || !methodoroptions) { // default to "init" return methods.init.apply(this, arguments); } else { $.error('method ' + methodoroptions + ' does not exist on jquery.carousel'); } }; // plugin end })(jquery); ;(function ($) { var methods = { init: function (options) { return this.each(function () { var origin = $('#' + $(this).attr('data-activates')); var screen = $('body'); // creating tap target var taptargetel = $(this); var taptargetwrapper = taptargetel.parent('.tap-target-wrapper'); var taptargetwave = taptargetwrapper.find('.tap-target-wave'); var taptargetoriginel = taptargetwrapper.find('.tap-target-origin'); var taptargetcontentel = taptargetel.find('.tap-target-content'); // creating wrapper if (!taptargetwrapper.length) { taptargetwrapper = taptargetel.wrap($('
      ')).parent(); } // creating content if (!taptargetcontentel.length) { taptargetcontentel = $('
      '); taptargetel.append(taptargetcontentel); } // creating foreground wave if (!taptargetwave.length) { taptargetwave = $('
      '); // creating origin if (!taptargetoriginel.length) { taptargetoriginel = origin.clone(true, true); taptargetoriginel.addclass('tap-target-origin'); taptargetoriginel.removeattr('id'); taptargetoriginel.removeattr('style'); taptargetwave.append(taptargetoriginel); } taptargetwrapper.append(taptargetwave); } // open var opentaptarget = function () { if (taptargetwrapper.is('.open')) { return; } // adding open class taptargetwrapper.addclass('open'); settimeout(function () { taptargetoriginel.off('click.taptarget').on('click.taptarget', function (e) { closetaptarget(); taptargetoriginel.off('click.taptarget'); }); $(document).off('click.taptarget').on('click.taptarget', function (e) { closetaptarget(); $(document).off('click.taptarget'); }); var throttledcalc = materialize.throttle(function () { calculatetaptarget(); }, 200); $(window).off('resize.taptarget').on('resize.taptarget', throttledcalc); }, 0); }; // close var closetaptarget = function () { if (!taptargetwrapper.is('.open')) { return; } taptargetwrapper.removeclass('open'); taptargetoriginel.off('click.taptarget'); $(document).off('click.taptarget'); $(window).off('resize.taptarget'); }; // pre calculate var calculatetaptarget = function () { // element or parent is fixed position? var isfixed = origin.css('position') === 'fixed'; if (!isfixed) { var parents = origin.parents(); for (var i = 0; i < parents.length; i++) { isfixed = $(parents[i]).css('position') == 'fixed'; if (isfixed) { break; } } } // calculating origin var originwidth = origin.outerwidth(); var originheight = origin.outerheight(); var origintop = isfixed ? origin.offset().top - $(document).scrolltop() : origin.offset().top; var originleft = isfixed ? origin.offset().left - $(document).scrollleft() : origin.offset().left; // calculating screen var windowwidth = $(window).width(); var windowheight = $(window).height(); var centerx = windowwidth / 2; var centery = windowheight / 2; var isleft = originleft <= centerx; var isright = originleft > centerx; var istop = origintop <= centery; var isbottom = origintop > centery; var iscenterx = originleft >= windowwidth * 0.25 && originleft <= windowwidth * 0.75; var iscentery = origintop >= windowheight * 0.25 && origintop <= windowheight * 0.75; // calculating tap target var taptargetwidth = taptargetel.outerwidth(); var taptargetheight = taptargetel.outerheight(); var taptargettop = origintop + originheight / 2 - taptargetheight / 2; var taptargetleft = originleft + originwidth / 2 - taptargetwidth / 2; var taptargetposition = isfixed ? 'fixed' : 'absolute'; // calculating content var taptargettextwidth = iscenterx ? taptargetwidth : taptargetwidth / 2 + originwidth; var taptargettextheight = taptargetheight / 2; var taptargettexttop = istop ? taptargetheight / 2 : 0; var taptargettextbottom = 0; var taptargettextleft = isleft && !iscenterx ? taptargetwidth / 2 - originwidth : 0; var taptargettextright = 0; var taptargettextpadding = originwidth; var taptargettextalign = isbottom ? 'bottom' : 'top'; // calculating wave var taptargetwavewidth = originwidth > originheight ? originwidth * 2 : originwidth * 2; var taptargetwaveheight = taptargetwavewidth; var taptargetwavetop = taptargetheight / 2 - taptargetwaveheight / 2; var taptargetwaveleft = taptargetwidth / 2 - taptargetwavewidth / 2; // setting tap target var taptargetwrappercssobj = {}; taptargetwrappercssobj.top = istop ? taptargettop : ''; taptargetwrappercssobj.right = isright ? windowwidth - taptargetleft - taptargetwidth : ''; taptargetwrappercssobj.bottom = isbottom ? windowheight - taptargettop - taptargetheight : ''; taptargetwrappercssobj.left = isleft ? taptargetleft : ''; taptargetwrappercssobj.position = taptargetposition; taptargetwrapper.css(taptargetwrappercssobj); // setting content taptargetcontentel.css({ width: taptargettextwidth, height: taptargettextheight, top: taptargettexttop, right: taptargettextright, bottom: taptargettextbottom, left: taptargettextleft, padding: taptargettextpadding, verticalalign: taptargettextalign }); // setting wave taptargetwave.css({ top: taptargetwavetop, left: taptargetwaveleft, width: taptargetwavewidth, height: taptargetwaveheight }); }; if (options == 'open') { calculatetaptarget(); opentaptarget(); } if (options == 'close') closetaptarget(); }); }, open: function () {}, close: function () {} }; $.fn.taptarget = function (methodoroptions) { if (methods[methodoroptions] || typeof methodoroptions === 'object') return methods.init.apply(this, arguments); $.error('method ' + methodoroptions + ' does not exist on jquery.tap-target'); }; })(jquery);