Skip to content

Instantly share code, notes, and snippets.

@nfq
Created May 23, 2016 01:26
Show Gist options
  • Save nfq/72244dfca8f8ee9efaebfc5844471208 to your computer and use it in GitHub Desktop.
Save nfq/72244dfca8f8ee9efaebfc5844471208 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
/*
AngularJS v1.2.5
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(W, N, r) {
'use strict';
function G(b) {
return function() {
var a = arguments[0], c, a = "[" + (b ? b + ":" : "") + a + "] http://errors.angularjs.org/1.2.5/" + (b ? b + "/" : "") + a;
for (c = 1; c < arguments.length; c++)
a = a + (1 == c ? "?" : "&") + "p" + (c - 1) + "=" + encodeURIComponent("function" == typeof arguments[c] ? arguments[c].toString().replace(/ \{[\s\S]*$/, "") : "undefined" == typeof arguments[c] ? "undefined" : "string" != typeof arguments[c] ? JSON.stringify(arguments[c]) : arguments[c]);
return Error(a)
}
}
function pb(b) {
if (null == b || Aa(b))
return !1;
var a =
b.length;
return 1 === b.nodeType && a?!0 : D(b) || L(b) || 0 === a || "number" === typeof a && 0 < a && a - 1 in b
}
function q(b, a, c) {
var d;
if (b)
if (A(b))
for (d in b)
"prototype" != d && ("length" != d && "name" != d && b.hasOwnProperty(d)) && a.call(c, b[d], d);
else if (b.forEach && b.forEach !== q)
b.forEach(a, c);
else if (pb(b))
for (d = 0; d < b.length; d++)
a.call(c, b[d], d);
else
for (d in b)
b.hasOwnProperty(d) && a.call(c, b[d], d);
return b
}
function Ob(b) {
var a = [], c;
for (c in b)
b.hasOwnProperty(c) && a.push(c);
return a.sort()
}
function Nc(b, a, c) {
for (var d = Ob(b),
e = 0; e < d.length; e++)
a.call(c, b[d[e]], d[e]);
return d
}
function Pb(b) {
return function(a, c) {
b(c, a)
}
}
function Za() {
for (var b = ja.length, a; b;) {
b--;
a = ja[b].charCodeAt(0);
if (57 == a)
return ja[b] = "A", ja.join("");
if (90 == a)
ja[b] = "0";
else
return ja[b] = String.fromCharCode(a + 1), ja.join("")
}
ja.unshift("0");
return ja.join("")
}
function Qb(b, a) {
a ? b.$$hashKey = a : delete b.$$hashKey
}
function w(b) {
var a = b.$$hashKey;
q(arguments, function(a) {
a !== b && q(a, function(a, c) {
b[c] = a
})
});
Qb(b, a);
return b
}
function R(b) {
return parseInt(b,
10)
}
function Rb(b, a) {
return w(new (w(function() {}, {
prototype: b
})), a)
}
function s() {}
function Ba(b) {
return b
}
function ca(b) {
return function() {
return b
}
}
function H(b) {
return "undefined" === typeof b
}
function z(b) {
return "undefined" !== typeof b
}
function U(b) {
return null != b && "object" === typeof b
}
function D(b) {
return "string" === typeof b
}
function qb(b) {
return "number" === typeof b
}
function La(b) {
return "[object Date]" === $a.call(b)
}
function L(b) {
return "[object Array]" === $a.call(b)
}
function A(b) {
return "function" === typeof b
}
function ab(b) {
return "[object RegExp]" === $a.call(b)
}
function Aa(b) {
return b && b.document && b.location && b.alert && b.setInterval
}
function Oc(b) {
return !(!b ||!(b.nodeName || b.on && b.find))
}
function Pc(b, a, c) {
var d = [];
q(b, function(b, g, f) {
d.push(a.call(c, b, g, f))
});
return d
}
function bb(b, a) {
if (b.indexOf)
return b.indexOf(a);
for (var c = 0; c < b.length; c++)
if (a === b[c])
return c;
return - 1
}
function Ma(b, a) {
var c = bb(b, a);
0 <= c && b.splice(c, 1);
return a
}
function ga(b, a) {
if (Aa(b) || b && b.$evalAsync && b.$watch)
throw Na("cpws");
if (a) {
if (b ===
a)
throw Na("cpi");
if (L(b))
for (var c = a.length = 0; c < b.length; c++)
a.push(ga(b[c]));
else {
c = a.$$hashKey;
q(a, function(b, c) {
delete a[c]
});
for (var d in b)
a[d] = ga(b[d]);
Qb(a, c)
}
} else (a = b)
&& (L(b) ? a = ga(b, []) : La(b) ? a = new Date(b.getTime()) : ab(b) ? a = RegExp(b.source) : U(b) && (a = ga(b, {})));
return a
}
function Qc(b, a) {
a = a || {};
for (var c in b)
b.hasOwnProperty(c) && "$$" !== c.substr(0, 2) && (a[c] = b[c]);
return a
}
function ta(b, a) {
if (b === a)
return !0;
if (null === b || null === a)
return !1;
if (b !== b && a !== a)
return !0;
var c = typeof b, d;
if (c == typeof a &&
"object" == c)
if (L(b)) {
if (!L(a))
return !1;
if ((c = b.length) == a.length) {
for (d = 0; d < c; d++)
if (!ta(b[d], a[d]))
return !1;
return !0
}
} else {
if (La(b))
return La(a) && b.getTime() == a.getTime();
if (ab(b) && ab(a))
return b.toString() == a.toString();
if (b && b.$evalAsync && b.$watch || a && a.$evalAsync && a.$watch || Aa(b) || Aa(a) || L(a))
return !1;
c = {};
for (d in b)
if ("$" !== d.charAt(0)&&!A(b[d])) {
if (!ta(b[d], a[d]))
return !1;
c[d]=!0
}
for (d in a)
if (!c.hasOwnProperty(d) && "$" !== d.charAt(0) && a[d] !== r&&!A(a[d]))
return !1;
return !0
}
return !1
}
function Sb() {
return N.securityPolicy &&
N.securityPolicy.isActive || N.querySelector&&!(!N.querySelector("[ng-csp]")&&!N.querySelector("[data-ng-csp]"))
}
function rb(b, a) {
var c = 2 < arguments.length ? ua.call(arguments, 2): [];
return !A(a) || a instanceof RegExp ? a : c.length ? function() {
return arguments.length ? a.apply(b, c.concat(ua.call(arguments, 0))) : a.apply(b, c)
} : function() {
return arguments.length ? a.apply(b, arguments) : a.call(b)
}
}
function Rc(b, a) {
var c = a;
"string" === typeof b && "$" === b.charAt(0) ? c = r : Aa(a) ? c = "$WINDOW" : a && N === a ? c = "$DOCUMENT" : a && (a.$evalAsync &&
a.$watch) && (c = "$SCOPE");
return c
}
function oa(b, a) {
return "undefined" === typeof b ? r : JSON.stringify(b, Rc, a ? " " : null)
}
function Tb(b) {
return D(b) ? JSON.parse(b) : b
}
function Oa(b) {
b && 0 !== b.length ? (b = v("" + b), b=!("f" == b || "0" == b || "false" == b || "no" == b || "n" == b || "[]" == b)) : b=!1;
return b
}
function ha(b) {
b = x(b).clone();
try {
b.empty()
} catch (a) {}
var c = x("<div>").append(b).html();
try {
return 3 === b[0].nodeType ? v(c) : c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/, function(a, b) {
return "<" + v(b)
})
} catch (d) {
return v(c)
}
}
function Ub(b) {
try {
return decodeURIComponent(b)
} catch (a) {}
}
function Vb(b) {
var a = {}, c, d;
q((b || "").split("&"), function(b) {
b && (c = b.split("="), d = Ub(c[0]), z(d) && (b = z(c[1]) ? Ub(c[1]) : !0, a[d] ? L(a[d]) ? a[d].push(b) : a[d] = [a[d], b] : a[d] = b))
});
return a
}
function Wb(b) {
var a = [];
q(b, function(b, d) {
L(b) ? q(b, function(b) {
a.push(va(d, !0) + (!0 === b ? "" : "=" + va(b, !0)))
}) : a.push(va(d, !0) + (!0 === b ? "" : "=" + va(b, !0)))
});
return a.length ? a.join("&") : ""
}
function sb(b) {
return va(b, !0).replace(/%26/gi, "&").replace(/%3D/gi, "=").replace(/%2B/gi, "+")
}
function va(b, a) {
return encodeURIComponent(b).replace(/%40/gi,
"@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, a ? "%20" : "+")
}
function Sc(b, a) {
function c(a) {
a && d.push(a)
}
var d = [b], e, g, f = ["ng:app", "ng-app", "x-ng-app", "data-ng-app"], h = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;
q(f, function(a) {
f[a]=!0;
c(N.getElementById(a));
a = a.replace(":", "\\:");
b.querySelectorAll && (q(b.querySelectorAll("." + a), c), q(b.querySelectorAll("." + a + "\\:"), c), q(b.querySelectorAll("[" + a + "]"), c))
});
q(d, function(a) {
if (!e) {
var b = h.exec(" " + a.className + " ");
b ? (e = a, g =
(b[2] || "").replace(/\s+/g, ",")) : q(a.attributes, function(b) {
!e && f[b.name] && (e = a, g = b.value)
})
}
});
e && a(e, g ? [g] : [])
}
function Xb(b, a) {
var c = function() {
b = x(b);
if (b.injector()) {
var c = b[0] === N ? "document": ha(b);
throw Na("btstrpd", c);
}
a = a || [];
a.unshift(["$provide", function(a) {
a.value("$rootElement", b)
}
]);
a.unshift("ng");
c = Yb(a);
c.invoke(["$rootScope", "$rootElement", "$compile", "$injector", "$animate", function(a, b, c, d, e) {
a.$apply(function() {
b.data("$injector", d);
c(b)(a)
})
}
]);
return c
}, d = /^NG_DEFER_BOOTSTRAP!/;
if (W&&!d.test(W.name))
return c();
W.name = W.name.replace(d, "");
Pa.resumeBootstrap = function(b) {
q(b, function(b) {
a.push(b)
});
c()
}
}
function cb(b, a) {
a = a || "_";
return b.replace(Tc, function(b, d) {
return (d ? a : "") + b.toLowerCase()
})
}
function tb(b, a, c) {
if (!b)
throw Na("areq", a || "?", c || "required");
return b
}
function Qa(b, a, c) {
c && L(b) && (b = b[b.length - 1]);
tb(A(b), a, "not a function, got " + (b && "object" == typeof b ? b.constructor.name || "Object" : typeof b));
return b
}
function wa(b, a) {
if ("hasOwnProperty" === b)
throw Na("badname",
a);
}
function ub(b, a, c) {
if (!a)
return b;
a = a.split(".");
for (var d, e = b, g = a.length, f = 0; f < g; f++)
d = a[f], b && (b = (e = b)[d]);
return !c && A(b) ? rb(e, b) : b
}
function vb(b) {
var a = b[0];
b = b[b.length - 1];
if (a === b)
return x(a);
var c = [a];
do {
a = a.nextSibling;
if (!a)
break;
c.push(a)
}
while (a !== b);
return x(c)
}
function Uc(b) {
var a = G("$injector"), c = G("ng");
b = b.angular || (b.angular = {});
b.$$minErr = b.$$minErr || G;
return b.module || (b.module = function() {
var b = {};
return function(e, g, f) {
if ("hasOwnProperty" === e)
throw c("badname", "module");
g &&
b.hasOwnProperty(e) && (b[e] = null);
return b[e] || (b[e] = function() {
function b(a, d, e) {
return function() {
c[e || "push"]([a, d, arguments]);
return n
}
}
if (!g)
throw a("nomod", e);
var c = [], d = [], m = b("$injector", "invoke"), n = {
_invokeQueue: c,
_runBlocks: d,
requires: g,
name: e,
provider: b("$provide", "provider"),
factory: b("$provide", "factory"),
service: b("$provide", "service"),
value: b("$provide", "value"),
constant: b("$provide", "constant", "unshift"),
animation: b("$animateProvider", "register"),
filter: b("$filterProvider", "register"),
controller: b("$controllerProvider", "register"),
directive: b("$compileProvider", "directive"),
config: m,
run: function(a) {
d.push(a);
return this
}
};
f && m(f);
return n
}())
}
}())
}
function Ra(b) {
return b.replace(Vc, function(a, b, d, e) {
return e ? d.toUpperCase() : d
}).replace(Wc, "Moz$1")
}
function wb(b, a, c, d) {
function e(b) {
var e = c && b ? [this.filter(b)]: [this], l = a, k, m, n, p, t, C;
if (!d || null != b)
for (; e.length;)
for (k = e.shift(), m = 0, n = k.length; m < n; m++)
for (p = x(k[m]), l ? p.triggerHandler("$destroy") : l=!l, t = 0, p = (C = p.children()).length; t <
p; t++)
e.push(Ca(C[t]));
return g.apply(this, arguments)
}
var g = Ca.fn[b], g = g.$original || g;
e.$original = g;
Ca.fn[b] = e
}
function I(b) {
if (b instanceof I)
return b;
if (!(this instanceof I)) {
if (D(b) && "<" != b.charAt(0))
throw xb("nosel");
return new I(b)
}
if (D(b)) {
var a = N.createElement("div");
a.innerHTML = "<div>&#160;</div>" + b;
a.removeChild(a.firstChild);
yb(this, a.childNodes);
x(N.createDocumentFragment()).append(this)
} else
yb(this, b)
}
function zb(b) {
return b.cloneNode(!0)
}
function Da(b) {
Zb(b);
var a = 0;
for (b = b.childNodes ||
[]; a < b.length; a++)
Da(b[a])
}
function $b(b, a, c, d) {
if (z(d))
throw xb("offargs");
var e = ka(b, "events");
ka(b, "handle") && (H(a) ? q(e, function(a, c) {
Ab(b, c, a);
delete e[c]
}) : q(a.split(" "), function(a) {
H(c) ? (Ab(b, a, e[a]), delete e[a]) : Ma(e[a] || [], c)
}))
}
function Zb(b, a) {
var c = b[db], d = Sa[c];
d && (a ? delete Sa[c].data[a] : (d.handle && (d.events.$destroy && d.handle({}, "$destroy"), $b(b)), delete Sa[c], b[db] = r))
}
function ka(b, a, c) {
var d = b[db], d = Sa[d||-1];
if (z(c))
d || (b[db] = d=++Xc, d = Sa[d] = {}), d[a] = c;
else
return d && d[a]
}
function ac(b,
a, c) {
var d = ka(b, "data"), e = z(c), g=!e && z(a), f = g&&!U(a);
d || f || ka(b, "data", d = {});
if (e)
d[a] = c;
else if (g) {
if (f)
return d && d[a];
w(d, a)
} else
return d
}
function Bb(b, a) {
return b.getAttribute?-1 < (" " + (b.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").indexOf(" " + a + " ") : !1
}
function Cb(b, a) {
a && b.setAttribute && q(a.split(" "), function(a) {
b.setAttribute("class", aa((" " + (b.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").replace(" " + aa(a) + " ", " ")))
})
}
function Db(b, a) {
if (a && b.setAttribute) {
var c = (" " +
(b.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ");
q(a.split(" "), function(a) {
a = aa(a);
- 1 === c.indexOf(" " + a + " ") && (c += a + " ")
});
b.setAttribute("class", aa(c))
}
}
function yb(b, a) {
if (a) {
a = a.nodeName ||!z(a.length) || Aa(a) ? [a] : a;
for (var c = 0; c < a.length; c++)
b.push(a[c])
}
}
function bc(b, a) {
return eb(b, "$" + (a || "ngController") + "Controller")
}
function eb(b, a, c) {
b = x(b);
9 == b[0].nodeType && (b = b.find("html"));
for (a = L(a) ? a : [a]; b.length;) {
for (var d = 0, e = a.length; d < e; d++)
if ((c = b.data(a[d])) !== r)
return c;
b = b.parent()
}
}
function cc(b) {
for (var a = 0, c = b.childNodes; a < c.length; a++)
Da(c[a]);
for (; b.firstChild;)
b.removeChild(b.firstChild)
}
function dc(b, a) {
var c = fb[a.toLowerCase()];
return c && ec[b.nodeName] && c
}
function Yc(b, a) {
var c = function(c, e) {
c.preventDefault || (c.preventDefault = function() {
c.returnValue=!1
});
c.stopPropagation || (c.stopPropagation = function() {
c.cancelBubble=!0
});
c.target || (c.target = c.srcElement || N);
if (H(c.defaultPrevented)) {
var g = c.preventDefault;
c.preventDefault = function() {
c.defaultPrevented=!0;
g.call(c)
};
c.defaultPrevented=!1
}
c.isDefaultPrevented = function() {
return c.defaultPrevented ||!1 === c.returnValue
};
q(a[e || c.type], function(a) {
a.call(b, c)
});
8 >= E ? (c.preventDefault = null, c.stopPropagation = null, c.isDefaultPrevented = null) : (delete c.preventDefault, delete c.stopPropagation, delete c.isDefaultPrevented)
};
c.elem = b;
return c
}
function Ea(b) {
var a = typeof b, c;
"object" == a && null !== b ? "function" == typeof(c = b.$$hashKey) ? c = b.$$hashKey() : c === r && (c = b.$$hashKey = Za()) : c = b;
return a + ":" + c
}
function Ta(b) {
q(b, this.put, this)
}
function fc(b) {
var a, c;
"function" == typeof b ? (a = b.$inject) || (a = [], b.length && (c = b.toString().replace(Zc, ""), c = c.match($c), q(c[1].split(ad), function(b) {
b.replace(bd, function(b, c, d) {
a.push(d)
})
})), b.$inject = a) : L(b) ? (c = b.length - 1, Qa(b[c], "fn"), a = b.slice(0, c)) : Qa(b, "fn", !0);
return a
}
function Yb(b) {
function a(a) {
return function(b, c) {
if (U(b))
q(b, Pb(a));
else
return a(b, c)
}
}
function c(a, b) {
wa(a, "service");
if (A(b) || L(b))
b = n.instantiate(b);
if (!b.$get)
throw Ua("pget", a);
return m[a + h] = b
}
function d(a, b) {
return c(a,
{
$get: b
})
}
function e(a) {
var b = [], c, d, h, g;
q(a, function(a) {
if (!k.get(a)) {
k.put(a, !0);
try {
if (D(a))
for (c = Va(a), b = b.concat(e(c.requires)).concat(c._runBlocks), d = c._invokeQueue, h = 0, g = d.length; h < g; h++) {
var f = d[h], l = n.get(f[0]);
l[f[1]].apply(l, f[2])
} else
A(a) ? b.push(n.invoke(a)) : L(a) ? b.push(n.invoke(a)) : Qa(a, "module")
} catch (m) {
throw L(a) && (a = a[a.length - 1]), m.message && (m.stack&&-1 == m.stack.indexOf(m.message)) && (m = m.message + "\n" + m.stack), Ua("modulerr", a, m.stack || m.message || m);
}
}
});
return b
}
function g(a, b) {
function c(d) {
if (a.hasOwnProperty(d)) {
if (a[d] ===
f)
throw Ua("cdep", l.join(" <- "));
return a[d]
}
try {
return l.unshift(d), a[d] = f, a[d] = b(d)
} finally {
l.shift()
}
}
function d(a, b, e) {
var h = [], g = fc(a), f, k, l;
k = 0;
for (f = g.length; k < f; k++) {
l = g[k];
if ("string" !== typeof l)
throw Ua("itkn", l);
h.push(e && e.hasOwnProperty(l) ? e[l] : c(l))
}
a.$inject || (a = a[f]);
return a.apply(b, h)
}
return {
invoke: d,
instantiate: function(a, b) {
var c = function() {}, e;
c.prototype = (L(a) ? a[a.length - 1] : a).prototype;
c = new c;
e = d(a, c, b);
return U(e) || A(e) ? e : c
},
get: c,
annotate: fc,
has: function(b) {
return m.hasOwnProperty(b +
h) || a.hasOwnProperty(b)
}
}
}
var f = {}, h = "Provider", l = [], k = new Ta, m = {
$provide: {
provider: a(c),
factory: a(d),
service: a(function(a, b) {
return d(a, ["$injector", function(a) {
return a.instantiate(b)
}
])
}),
value: a(function(a, b) {
return d(a, ca(b))
}),
constant: a(function(a, b) {
wa(a, "constant");
m[a] = b;
p[a] = b
}),
decorator: function(a, b) {
var c = n.get(a + h), d = c.$get;
c.$get = function() {
var a = t.invoke(d, c);
return t.invoke(b, null, {
$delegate: a
})
}
}
}
}, n = m.$injector = g(m, function() {
throw Ua("unpr", l.join(" <- "));
}), p = {}, t = p.$injector =
g(p, function(a) {
a = n.get(a + h);
return t.invoke(a.$get, a)
});
q(e(b), function(a) {
t.invoke(a || s)
});
return t
}
function cd() {
var b=!0;
this.disableAutoScrolling = function() {
b=!1
};
this.$get = ["$window", "$location", "$rootScope", function(a, c, d) {
function e(a) {
var b = null;
q(a, function(a) {
b || "a" !== v(a.nodeName) || (b = a)
});
return b
}
function g() {
var b = c.hash(), d;
b ? (d = f.getElementById(b)) ? d.scrollIntoView() : (d = e(f.getElementsByName(b))) ? d.scrollIntoView() : "top" === b && a.scrollTo(0, 0) : a.scrollTo(0, 0)
}
var f = a.document;
b && d.$watch(function() {
return c.hash()
},
function() {
d.$evalAsync(g)
});
return g
}
]
}
function dd(b, a, c, d) {
function e(a) {
try {
a.apply(null, ua.call(arguments, 1))
} finally {
if (C--, 0 === C)
for (; B.length;)
try {
B.pop()()
} catch (b) {
c.error(b)
}
}
}
function g(a, b) {
(function la() {
q(K, function(a) {
a()
});
u = b(la, a)
})()
}
function f() {
y = null;
P != h.url() && (P = h.url(), q(ba, function(a) {
a(h.url())
}))
}
var h = this, l = a[0], k = b.location, m = b.history, n = b.setTimeout, p = b.clearTimeout, t = {};
h.isMock=!1;
var C = 0, B = [];
h.$$completeOutstandingRequest = e;
h.$$incOutstandingRequestCount = function() {
C++
};
h.notifyWhenNoOutstandingRequests = function(a) {
q(K, function(a) {
a()
});
0 === C ? a() : B.push(a)
};
var K = [], u;
h.addPollFn = function(a) {
H(u) && g(100, n);
K.push(a);
return a
};
var P = k.href, Z = a.find("base"), y = null;
h.url = function(a, c) {
k !== b.location && (k = b.location);
if (a) {
if (P != a)
return P = a, d.history ? c ? m.replaceState(null, "", a) : (m.pushState(null, "", a), Z.attr("href", Z.attr("href"))) : (y = a, c ? k.replace(a) : k.href = a), h
} else
return y || k.href.replace(/%27/g, "'")
};
var ba = [], Q=!1;
h.onUrlChange = function(a) {
if (!Q) {
if (d.history)
x(b).on("popstate",
f);
if (d.hashchange)
x(b).on("hashchange", f);
else
h.addPollFn(f);
Q=!0
}
ba.push(a);
return a
};
h.baseHref = function() {
var a = Z.attr("href");
return a ? a.replace(/^https?\:\/\/[^\/]*/, "") : ""
};
var Y = {}, X = "", $ = h.baseHref();
h.cookies = function(a, b) {
var d, e, g, h;
if (a)
b === r ? l.cookie = escape(a) + "=;path=" + $ + ";expires=Thu, 01 Jan 1970 00:00:00 GMT" : D(b) && (d = (l.cookie = escape(a) + "=" + escape(b) + ";path=" + $).length + 1, 4096 < d && c.warn("Cookie '" + a + "' possibly not set or overflowed because it was too large (" + d + " > 4096 bytes)!"));
else {
if (l.cookie !== X)
for (X = l.cookie, d = X.split("; "), Y = {}, g = 0; g < d.length; g++)
e = d[g], h = e.indexOf("="), 0 < h && (a = unescape(e.substring(0, h)), Y[a] === r && (Y[a] = unescape(e.substring(h + 1))));
return Y
}
};
h.defer = function(a, b) {
var c;
C++;
c = n(function() {
delete t[c];
e(a)
}, b || 0);
t[c]=!0;
return c
};
h.defer.cancel = function(a) {
return t[a] ? (delete t[a], p(a), e(s), !0) : !1
}
}
function ed() {
this.$get = ["$window", "$log", "$sniffer", "$document", function(b, a, c, d) {
return new dd(b, d, a, c)
}
]
}
function fd() {
this.$get = function() {
function b(b,
d) {
function e(a) {
a != n && (p ? p == a && (p = a.n) : p = a, g(a.n, a.p), g(a, n), n = a, n.n = null)
}
function g(a, b) {
a != b && (a && (a.p = b), b && (b.n = a))
}
if (b in a)
throw G("$cacheFactory")("iid", b);
var f = 0, h = w({}, d, {
id: b
}), l = {}, k = d && d.capacity || Number.MAX_VALUE, m = {}, n = null, p = null;
return a[b] = {
put: function(a, b) {
var c = m[a] || (m[a] = {
key: a
});
e(c);
if (!H(b))
return a in l || f++, l[a] = b, f > k && this.remove(p.key), b
},
get: function(a) {
var b = m[a];
if (b)
return e(b), l[a]
},
remove: function(a) {
var b = m[a];
b && (b == n && (n = b.p), b == p && (p = b.n), g(b.n, b.p), delete m[a],
delete l[a], f--)
},
removeAll: function() {
l = {};
f = 0;
m = {};
n = p = null
},
destroy: function() {
m = h = l = null;
delete a[b]
},
info: function() {
return w({}, h, {
size: f
})
}
}
}
var a = {};
b.info = function() {
var b = {};
q(a, function(a, e) {
b[e] = a.info()
});
return b
};
b.get = function(b) {
return a[b]
};
return b
}
}
function gd() {
this.$get = ["$cacheFactory", function(b) {
return b("templates")
}
]
}
function hc(b, a) {
var c = {}, d = "Directive", e = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/, g = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/, f = /^(on[a-z]+|formaction)$/;
this.directive =
function l(a, e) {
wa(a, "directive");
D(a) ? (tb(e, "directiveFactory"), c.hasOwnProperty(a) || (c[a] = [], b.factory(a + d, ["$injector", "$exceptionHandler", function(b, d) {
var e = [];
q(c[a], function(c, g) {
try {
var f = b.invoke(c);
A(f) ? f = {
compile: ca(f)
} : !f.compile && f.link && (f.compile = ca(f.link));
f.priority = f.priority || 0;
f.index = g;
f.name = f.name || a;
f.require = f.require || f.controller && f.name;
f.restrict = f.restrict || "A";
e.push(f)
} catch (l) {
d(l)
}
});
return e
}
])), c[a].push(e)) : q(a, Pb(l));
return this
};
this.aHrefSanitizationWhitelist =
function(b) {
return z(b) ? (a.aHrefSanitizationWhitelist(b), this) : a.aHrefSanitizationWhitelist()
};
this.imgSrcSanitizationWhitelist = function(b) {
return z(b) ? (a.imgSrcSanitizationWhitelist(b), this) : a.imgSrcSanitizationWhitelist()
};
this.$get = ["$injector", "$interpolate", "$exceptionHandler", "$http", "$templateCache", "$parse", "$controller", "$rootScope", "$document", "$sce", "$animate", "$$sanitizeUri", function(a, b, m, n, p, t, C, B, K, u, P, Z) {
function y(a, b, c, d, e) {
a instanceof x || (a = x(a));
q(a, function(b, c) {
3 == b.nodeType &&
b.nodeValue.match(/\S+/) && (a[c] = x(b).wrap("<span></span>").parent()[0])
});
var g = Q(a, b, a, c, d, e);
return function(b, c, d) {
tb(b, "scope");
var e = c ? Fa.clone.call(a): a;
q(d, function(a, b) {
e.data("$" + b + "Controller", a)
});
d = 0;
for (var f = e.length; d < f; d++) {
var k = e[d];
1 != k.nodeType && 9 != k.nodeType || e.eq(d).data("$scope", b)
}
ba(e, "ng-scope");
c && c(e, b);
g && g(b, e, e);
return e
}
}
function ba(a, b) {
try {
a.addClass(b)
} catch (c) {}
}
function Q(a, b, c, d, e, g) {
function f(a, c, d, e) {
var g, l, m, p, n, t, C, da = [];
n = 0;
for (t = c.length; n < t; n++)
da.push(c[n]);
C = n = 0;
for (t = k.length; n < t; C++)
l = da[C], c = k[n++], g = k[n++], m = x(l), c ? (c.scope ? (p = a.$new(), m.data("$scope", p), ba(m, "ng-scope")) : p = a, (m = c.transclude) ||!e && b ? c(g, p, l, d, Y(a, m || b)) : c(g, p, l, d, e)) : g && g(a, l.childNodes, r, e)
}
for (var k = [], l, m, p, n = 0; n < a.length; n++)
m = new Eb, l = X(a[n], [], m, 0 === n ? d : r, e), l = (g = l.length ? M(l, a[n], m, b, c, null, [], [], g) : null) && g.terminal ||!a[n].childNodes ||!a[n].childNodes.length ? null : Q(a[n].childNodes, g ? g.transclude : b), k.push(g), k.push(l), p = p || g || l, g = null;
return p ? f : null
}
function Y(a, b) {
return function(c,
d, e) {
var g=!1;
c || (c = a.$new(), g = c.$$transcluded=!0);
d = b(c, d, e);
if (g)
d.on("$destroy", rb(c, c.$destroy));
return d
}
}
function X(a, b, c, d, f) {
var k = c.$attr, l;
switch (a.nodeType) {
case 1:
la(b, ma(Ga(a).toLowerCase()), "E", d, f);
var m, p, n;
l = a.attributes;
for (var t = 0, C = l && l.length; t < C; t++) {
var B=!1, y=!1;
m = l[t];
if (!E || 8 <= E || m.specified) {
p = m.name;
n = ma(p);
xa.test(n) && (p = cb(n.substr(6), "-"));
var P = n.replace(/(Start|End)$/, "");
n === P + "Start" && (B = p, y = p.substr(0, p.length - 5) + "end", p = p.substr(0, p.length - 6));
n = ma(p.toLowerCase());
k[n] = p;
c[n] = m = aa(E && "href" == p ? decodeURIComponent(a.getAttribute(p, 2)) : m.value);
dc(a, n) && (c[n]=!0);
I(a, b, m, n);
la(b, n, "A", d, f, B, y)
}
}
a = a.className;
if (D(a) && "" !== a)
for (; l = g.exec(a);)
n = ma(l[2]), la(b, n, "C", d, f) && (c[n] = aa(l[3])), a = a.substr(l.index + l[0].length);
break;
case 3:
v(b, a.nodeValue);
break;
case 8:
try {
if (l = e.exec(a.nodeValue))
n = ma(l[1]), la(b, n, "M", d, f) && (c[n] = aa(l[2]))
} catch (K) {}
}
b.sort(s);
return b
}
function $(a, b, c) {
var d = [], e = 0;
if (b && a.hasAttribute && a.hasAttribute(b)) {
do {
if (!a)
throw ia("uterdir", b,
c);
1 == a.nodeType && (a.hasAttribute(b) && e++, a.hasAttribute(c) && e--);
d.push(a);
a = a.nextSibling
}
while (0 < e)
} else
d.push(a);
return x(d)
}
function O(a, b, c) {
return function(d, e, g, f, k) {
e = $(e[0], b, c);
return a(d, e, g, f, k)
}
}
function M(a, c, d, e, g, f, l, p, n) {
function B(a, b, c, d) {
if (a) {
c && (a = O(a, c, d));
a.require = F.require;
if (Q === F || F.$$isolateScope)
a = T(a, {
isolateScope: !0
});
l.push(a)
}
if (b) {
c && (b = O(b, c, d));
b.require = F.require;
if (Q === F || F.$$isolateScope)
b = T(b, {
isolateScope: !0
});
p.push(b)
}
}
function P(a, b, c) {
var d, e = "data",
g=!1;
if (D(a)) {
for (; "^" == (d = a.charAt(0)) || "?" == d;)
a = a.substr(1), "^" == d && (e = "inheritedData"), g = g || "?" == d;
d = null;
c && "data" === e && (d = c[a]);
d = d || b[e]("$" + a + "Controller");
if (!d&&!g)
throw ia("ctreq", a, ea);
} else
L(a) && (d = [], q(a, function(a) {
d.push(P(a, b, c))
}));
return d
}
function K(a, e, g, f, n) {
function B(a, b) {
var c;
2 > arguments.length && (b = a, a = r);
Ha && (c = O);
return n(a, b, c)
}
var y, da, Y, u, $, J, O = {}, X;
y = c === g ? d : Qc(d, new Eb(x(g), d.$attr));
da = y.$$element;
if (Q) {
var S = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
f = x(g);
J = e.$new(!0);
M &&
M === Q.$$originalDirective ? f.data("$isolateScope", J) : f.data("$isolateScopeNoTemplate", J);
ba(f, "ng-isolate-scope");
q(Q.scope, function(a, c) {
var d = a.match(S) || [], g = d[3] || c, f = "?" == d[2], d = d[1], l, m, n, p;
J.$$isolateBindings[c] = d + g;
switch (d) {
case "@":
y.$observe(g, function(a) {
J[c] = a
});
y.$$observers[g].$$scope = e;
y[g] && (J[c] = b(y[g])(e));
break;
case "=":
if (f&&!y[g])
break;
m = t(y[g]);
p = m.literal ? ta : function(a, b) {
return a === b
};
n = m.assign || function() {
l = J[c] = m(e);
throw ia("nonassign", y[g], Q.name);
};
l = J[c] = m(e);
J.$watch(function() {
var a =
m(e);
p(a, J[c]) || (p(a, l) ? n(e, a = J[c]) : J[c] = a);
return l = a
}, null, m.literal);
break;
case "&":
m = t(y[g]);
J[c] = function(a) {
return m(e, a)
};
break;
default:
throw ia("iscp", Q.name, c, a);
}
})
}
X = n && B;
Z && q(Z, function(a) {
var b = {
$scope: a === Q || a.$$isolateScope ? J: e,
$element: da,
$attrs: y,
$transclude: X
}, c;
$ = a.controller;
"@" == $ && ($ = y[a.name]);
c = C($, b);
O[a.name] = c;
Ha || da.data("$" + a.name + "Controller", c);
a.controllerAs && (b.$scope[a.controllerAs] = c)
});
f = 0;
for (Y = l.length; f < Y; f++)
try {
u = l[f], u(u.isolateScope ? J : e, da, y, u.require && P(u.require,
da, O), X)
} catch (v) {
m(v, ha(da))
}
f = e;
Q && (Q.template || null === Q.templateUrl) && (f = J);
a && a(f, g.childNodes, r, n);
for (f = p.length - 1; 0 <= f; f--)
try {
u = p[f], u(u.isolateScope ? J : e, da, y, u.require && P(u.require, da, O), X)
} catch (hd) {
m(hd, ha(da))
}
}
n = n || {};
var Y =- Number.MAX_VALUE, u, Z = n.controllerDirectives, Q = n.newIsolateScopeDirective, M = n.templateDirective;
n = n.nonTlbTranscludeDirective;
for (var la=!1, Ha=!1, s = d.$$element = x(c), F, ea, v, w = e, G, I = 0, E = a.length; I < E; I++) {
F = a[I];
var xa = F.$$start, gb = F.$$end;
xa && (s = $(c, xa, gb));
v = r;
if (Y >
F.priority)
break;
if (v = F.scope)
u = u || F, F.templateUrl || (H("new/isolated scope", Q, F, s), U(v) && (Q = F));
ea = F.name;
!F.templateUrl && F.controller && (v = F.controller, Z = Z || {}, H("'" + ea + "' controller", Z[ea], F, s), Z[ea] = F);
if (v = F.transclude)
la=!0, F.$$tlb || (H("transclusion", n, F, s), n = F), "element" == v ? (Ha=!0, Y = F.priority, v = $(c, xa, gb), s = d.$$element = x(N.createComment(" " + ea + ": " + d[ea] + " ")), c = s[0], R(g, x(ua.call(v, 0)), c), w = y(v, e, Y, f && f.name, {
nonTlbTranscludeDirective: n
})) : (v = x(zb(c)).contents(), s.empty(), w = y(v, e));
if (F.template)
if (H("template",
M, F, s), M = F, v = A(F.template) ? F.template(s, d) : F.template, v = ic(v), F.replace) {
f = F;
v = x("<div>" + aa(v) + "</div>").contents();
c = v[0];
if (1 != v.length || 1 !== c.nodeType)
throw ia("tplrt", ea, "");
R(g, s, c);
E = {
$attr: {}
};
v = X(c, [], E);
var V = a.splice(I + 1, a.length - (I + 1));
Q && S(v);
a = a.concat(v).concat(V);
gc(d, E);
E = a.length
} else
s.html(v);
if (F.templateUrl)
H("template", M, F, s), M = F, F.replace && (f = F), K = z(a.splice(I, a.length - I), s, d, g, w, l, p, {
controllerDirectives: Z,
newIsolateScopeDirective: Q,
templateDirective: M,
nonTlbTranscludeDirective: n
}),
E = a.length;
else if (F.compile)
try {
G = F.compile(s, d, w), A(G) ? B(null, G, xa, gb) : G && B(G.pre, G.post, xa, gb)
} catch (W) {
m(W, ha(s))
}
F.terminal && (K.terminal=!0, Y = Math.max(Y, F.priority))
}
K.scope = u&&!0 === u.scope;
K.transclude = la && w;
return K
}
function S(a) {
for (var b = 0, c = a.length; b < c; b++)
a[b] = Rb(a[b], {
$$isolateScope: !0
})
}
function la(b, e, g, f, k, n, p) {
if (e === k)
return null;
k = null;
if (c.hasOwnProperty(e)) {
var t;
e = a.get(e + d);
for (var C = 0, B = e.length; C < B; C++)
try {
t = e[C], (f === r || f > t.priority)&&-1 != t.restrict.indexOf(g) && (n && (t = Rb(t,
{
$$start: n,
$$end: p
})), b.push(t), k = t)
} catch (y) {
m(y)
}
}
return k
}
function gc(a, b) {
var c = b.$attr, d = a.$attr, e = a.$$element;
q(a, function(d, e) {
"$" != e.charAt(0) && (b[e] && (d += ("style" === e ? ";" : " ") + b[e]), a.$set(e, d, !0, c[e]))
});
q(b, function(b, g) {
"class" == g ? (ba(e, b), a["class"] = (a["class"] ? a["class"] + " " : "") + b) : "style" == g ? (e.attr("style", e.attr("style") + ";" + b), a.style = (a.style ? a.style + ";" : "") + b) : "$" == g.charAt(0) || a.hasOwnProperty(g) || (a[g] = b, d[g] = c[g])
})
}
function z(a, b, c, d, e, g, f, k) {
var l = [], m, t, C = b[0], B = a.shift(),
y = w({}, B, {
templateUrl: null,
transclude: null,
replace: null,
$$originalDirective: B
}), P = A(B.templateUrl) ? B.templateUrl(b, c): B.templateUrl;
b.empty();
n.get(u.getTrustedResourceUrl(P), {
cache: p
}).success(function(n) {
var p, K;
n = ic(n);
if (B.replace) {
n = x("<div>" + aa(n) + "</div>").contents();
p = n[0];
if (1 != n.length || 1 !== p.nodeType)
throw ia("tplrt", B.name, P);
n = {
$attr: {}
};
R(d, b, p);
var u = X(p, [], n);
U(B.scope) && S(u);
a = u.concat(a);
gc(c, n)
} else
p = C, b.html(n);
a.unshift(y);
m = M(a, p, c, e, b, B, g, f, k);
q(d, function(a, c) {
a == p && (d[c] =
b[0])
});
for (t = Q(b[0].childNodes, e); l.length;) {
n = l.shift();
K = l.shift();
var ba = l.shift(), Z = l.shift(), u = b[0];
K !== C && (u = zb(p), R(ba, x(K), u));
K = m.transclude ? Y(n, m.transclude) : Z;
m(t, n, u, d, K)
}
l = null
}).error(function(a, b, c, d) {
throw ia("tpload", d.url);
});
return function(a, b, c, d, e) {
l ? (l.push(b), l.push(c), l.push(d), l.push(e)) : m(t, b, c, d, e)
}
}
function s(a, b) {
var c = b.priority - a.priority;
return 0 !== c ? c : a.name !== b.name ? a.name < b.name?-1 : 1 : a.index - b.index
}
function H(a, b, c, d) {
if (b)
throw ia("multidir", b.name, c.name, a,
ha(d));
}
function v(a, c) {
var d = b(c, !0);
d && a.push({
priority: 0,
compile: ca(function(a, b) {
var c = b.parent(), e = c.data("$binding") || [];
e.push(d);
ba(c.data("$binding", e), "ng-binding");
a.$watch(d, function(a) {
b[0].nodeValue = a
})
})
})
}
function G(a, b) {
if ("srcdoc" == b)
return u.HTML;
var c = Ga(a);
if ("xlinkHref" == b || "FORM" == c && "action" == b || "IMG" != c && ("src" == b || "ngSrc" == b))
return u.RESOURCE_URL
}
function I(a, c, d, e) {
var g = b(d, !0);
if (g) {
if ("multiple" === e && "SELECT" === Ga(a))
throw ia("selmulti", ha(a));
c.push({
priority: 100,
compile: function() {
return {
pre: function(c,
d, l) {
d = l.$$observers || (l.$$observers = {});
if (f.test(e))
throw ia("nodomevents");
if (g = b(l[e], !0, G(a, e)))
l[e] = g(c), (d[e] || (d[e] = [])).$$inter=!0, (l.$$observers && l.$$observers[e].$$scope || c).$watch(g, function(a, b) {
"class" === e && a != b ? l.$updateClass(a, b) : l.$set(e, a)
})
}
}
}
})
}
}
function R(a, b, c) {
var d = b[0], e = b.length, g = d.parentNode, f, l;
if (a)
for (f = 0, l = a.length; f < l; f++)
if (a[f] == d) {
a[f++] = c;
l = f + e - 1;
for (var k = a.length; f < k; f++, l++)
l < k ? a[f] = a[l] : delete a[f];
a.length -= e - 1;
break
}
g && g.replaceChild(c, d);
a = N.createDocumentFragment();
a.appendChild(d);
c[x.expando] = d[x.expando];
d = 1;
for (e = b.length; d < e; d++)
g = b[d], x(g).remove(), a.appendChild(g), delete b[d];
b[0] = c;
b.length = 1
}
function T(a, b) {
return w(function() {
return a.apply(null, arguments)
}, a, b)
}
var Eb = function(a, b) {
this.$$element = a;
this.$attr = b || {}
};
Eb.prototype = {
$normalize: ma,
$addClass: function(a) {
a && 0 < a.length && P.addClass(this.$$element, a)
},
$removeClass: function(a) {
a && 0 < a.length && P.removeClass(this.$$element, a)
},
$updateClass: function(a, b) {
this.$removeClass(jc(b, a));
this.$addClass(jc(a,
b))
},
$set: function(a, b, c, d) {
var e = dc(this.$$element[0], a);
e && (this.$$element.prop(a, b), d = e);
this[a] = b;
d ? this.$attr[a] = d : (d = this.$attr[a]) || (this.$attr[a] = d = cb(a, "-"));
e = Ga(this.$$element);
if ("A" === e && "href" === a || "IMG" === e && "src" === a)
this[a] = b = Z(b, "src" === a);
!1 !== c && (null === b || b === r ? this.$$element.removeAttr(d) : this.$$element.attr(d, b));
(c = this.$$observers) && q(c[a], function(a) {
try {
a(b)
} catch (c) {
m(c)
}
})
},
$observe: function(a, b) {
var c = this, d = c.$$observers || (c.$$observers = {}), e = d[a] || (d[a] = []);
e.push(b);
B.$evalAsync(function() {
e.$$inter || b(c[a])
});
return b
}
};
var ea = b.startSymbol(), Ha = b.endSymbol(), ic = "{{" == ea || "}}" == Ha ? Ba: function(a) {
return a.replace(/\{\{/g, ea).replace(/}}/g, Ha)
}, xa = /^ngAttr[A-Z]/;
return y
}
]
}
function ma(b) {
return Ra(b.replace(id, ""))
}
function jc(b, a) {
var c = "", d = b.split(/\s+/), e = a.split(/\s+/), g = 0;
a: for (;
g < d.length;
g++) {
for (var f = d[g], h = 0;
h < e.length;
h++)if (f == e[h])
continue a;
c += (0 < c.length ? " " : "") + f
}
return c
}
function jd() {
var b = {}, a = /^(\S+)(\s+as\s+(\w+))?$/;
this.register = function(a,
d) {
wa(a, "controller");
U(a) ? w(b, a) : b[a] = d
};
this.$get = ["$injector", "$window", function(c, d) {
return function(e, g) {
var f, h, l;
D(e) && (f = e.match(a), h = f[1], l = f[3], e = b.hasOwnProperty(h) ? b[h] : ub(g.$scope, h, !0) || ub(d, h, !0), Qa(e, h, !0));
f = c.instantiate(e, g);
if (l) {
if (!g || "object" != typeof g.$scope)
throw G("$controller")("noscp", h || e.name, l);
g.$scope[l] = f
}
return f
}
}
]
}
function kd() {
this.$get = ["$window", function(b) {
return x(b.document)
}
]
}
function ld() {
this.$get = ["$log", function(b) {
return function(a, c) {
b.error.apply(b,
arguments)
}
}
]
}
function kc(b) {
var a = {}, c, d, e;
if (!b)
return a;
q(b.split("\n"), function(b) {
e = b.indexOf(":");
c = v(aa(b.substr(0, e)));
d = aa(b.substr(e + 1));
c && (a[c] = a[c] ? a[c] + (", " + d) : d)
});
return a
}
function lc(b) {
var a = U(b) ? b: r;
return function(c) {
a || (a = kc(b));
return c ? a[v(c)] || null : a
}
}
function mc(b, a, c) {
if (A(c))
return c(b, a);
q(c, function(c) {
b = c(b, a)
});
return b
}
function md() {
var b = /^\s*(\[|\{[^\{])/, a = /[\}\]]\s*$/, c = /^\)\]\}',?\n/, d = {
"Content-Type": "application/json;charset=utf-8"
}, e = this.defaults = {
transformResponse: [function(d) {
D(d) &&
(d = d.replace(c, ""), b.test(d) && a.test(d) && (d = Tb(d)));
return d
}
],
transformRequest: [function(a) {
return U(a) && "[object File]" !== $a.call(a) ? oa(a) : a
}
],
headers: {
common: {
Accept: "application/json, text/plain, */*"
},
post: d,
put: d,
patch: d
},
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN"
}, g = this.interceptors = [], f = this.responseInterceptors = [];
this.$get = ["$httpBackend", "$browser", "$cacheFactory", "$rootScope", "$q", "$injector", function(a, b, c, d, n, p) {
function t(a) {
function c(a) {
var b = w({}, a, {
data: mc(a.data,
a.headers, d.transformResponse)
});
return 200 <= a.status && 300 > a.status ? b : n.reject(b)
}
var d = {
transformRequest: e.transformRequest,
transformResponse: e.transformResponse
}, g = function(a) {
function b(a) {
var c;
q(a, function(b, d) {
A(b) && (c = b(), null != c ? a[d] = c : delete a[d])
})
}
var c = e.headers, d = w({}, a.headers), g, f, c = w({}, c.common, c[v(a.method)]);
b(c);
b(d);
a: for (g in c) {
a = v(g);
for (f in d)
if (v(f) === a)
continue a;
d[g] = c[g]
}
return d
}(a);
w(d, a);
d.headers = g;
d.method = Ia(d.method);
(a = Fb(d.url) ? b.cookies()[d.xsrfCookieName ||
e.xsrfCookieName] : r) && (g[d.xsrfHeaderName || e.xsrfHeaderName] = a);
var f = [function(a) {
g = a.headers;
var b = mc(a.data, lc(g), a.transformRequest);
H(a.data) && q(g, function(a, b) {
"content-type" === v(b) && delete g[b]
});
H(a.withCredentials)&&!H(e.withCredentials) && (a.withCredentials = e.withCredentials);
return C(a, b, g).then(c, c)
}, r], h = n.when(d);
for (q(u, function(a) {
(a.request || a.requestError) && f.unshift(a.request, a.requestError);
(a.response || a.responseError) && f.push(a.response, a.responseError)
});
f.length;
) {
a = f.shift();
var k = f.shift(), h = h.then(a, k)
}
h.success = function(a) {
h.then(function(b) {
a(b.data, b.status, b.headers, d)
});
return h
};
h.error = function(a) {
h.then(null, function(b) {
a(b.data, b.status, b.headers, d)
});
return h
};
return h
}
function C(b, c, g) {
function f(a, b, c) {
u && (200 <= a && 300 > a ? u.put(r, [a, b, kc(c)]) : u.remove(r));
l(b, a, c);
d.$$phase || d.$apply()
}
function l(a, c, d) {
c = Math.max(c, 0);
(200 <= c && 300 > c ? p.resolve : p.reject)({
data: a,
status: c,
headers: lc(d),
config: b
})
}
function k() {
var a = bb(t.pendingRequests, b);
- 1 !== a && t.pendingRequests.splice(a,
1)
}
var p = n.defer(), C = p.promise, u, q, r = B(b.url, b.params);
t.pendingRequests.push(b);
C.then(k, k);
(b.cache || e.cache) && (!1 !== b.cache && "GET" == b.method) && (u = U(b.cache) ? b.cache : U(e.cache) ? e.cache : K);
if (u)
if (q = u.get(r), z(q)) {
if (q.then)
return q.then(k, k), q;
L(q) ? l(q[1], q[0], ga(q[2])) : l(q, 200, {})
} else
u.put(r, C);
H(q) && a(b.method, r, c, f, g, b.timeout, b.withCredentials, b.responseType);
return C
}
function B(a, b) {
if (!b)
return a;
var c = [];
Nc(b, function(a, b) {
null === a || H(a) || (L(a) || (a = [a]), q(a, function(a) {
U(a) && (a = oa(a));
c.push(va(b) + "=" + va(a))
}))
});
return a + ( - 1 == a.indexOf("?") ? "?" : "&") + c.join("&")
}
var K = c("$http"), u = [];
q(g, function(a) {
u.unshift(D(a) ? p.get(a) : p.invoke(a))
});
q(f, function(a, b) {
var c = D(a) ? p.get(a): p.invoke(a);
u.splice(b, 0, {
response: function(a) {
return c(n.when(a))
},
responseError: function(a) {
return c(n.reject(a))
}
})
});
t.pendingRequests = [];
(function(a) {
q(arguments, function(a) {
t[a] = function(b, c) {
return t(w(c || {}, {
method: a,
url: b
}))
}
})
})("get", "delete", "head", "jsonp");
(function(a) {
q(arguments, function(a) {
t[a] =
function(b, c, d) {
return t(w(d || {}, {
method: a,
url: b,
data: c
}))
}
})
})("post", "put");
t.defaults = e;
return t
}
]
}
function nd() {
this.$get = ["$browser", "$window", "$document", function(b, a, c) {
return od(b, pd, b.defer, a.angular.callbacks, c[0])
}
]
}
function od(b, a, c, d, e) {
function g(a, b) {
var c = e.createElement("script"), d = function() {
c.onreadystatechange = c.onload = c.onerror = null;
e.body.removeChild(c);
b && b()
};
c.type = "text/javascript";
c.src = a;
E && 8 >= E ? c.onreadystatechange = function() {
/loaded|complete/.test(c.readyState) && d()
} :
c.onload = c.onerror = function() {
d()
};
e.body.appendChild(c);
return d
}
var f =- 1;
return function(e, l, k, m, n, p, t, C) {
function B() {
u = f;
r && r();
y && y.abort()
}
function K(a, d, e, g) {
var f = ya(l).protocol;
ba && c.cancel(ba);
r = y = null;
d = "file" == f && 0 === d ? e ? 200 : 404 : d;
a(1223 == d ? 204 : d, e, g);
b.$$completeOutstandingRequest(s)
}
var u;
b.$$incOutstandingRequestCount();
l = l || b.url();
if ("jsonp" == v(e)) {
var P = "_" + (d.counter++).toString(36);
d[P] = function(a) {
d[P].data = a
};
var r = g(l.replace("JSON_CALLBACK", "angular.callbacks." + P), function() {
d[P].data ?
K(m, 200, d[P].data) : K(m, u||-2);
delete d[P]
})
} else {
var y = new a;
y.open(e, l, !0);
q(n, function(a, b) {
z(a) && y.setRequestHeader(b, a)
});
y.onreadystatechange = function() {
if (4 == y.readyState) {
var a = null, b = null;
u !== f && (a = y.getAllResponseHeaders(), b = y.responseType ? y.response : y.responseText);
K(m, u || y.status, b, a)
}
};
t && (y.withCredentials=!0);
C && (y.responseType = C);
y.send(k || null)
}
if (0 < p)
var ba = c(B, p);
else
p && p.then && p.then(B)
}
}
function qd() {
var b = "{{", a = "}}";
this.startSymbol = function(a) {
return a ? (b = a, this) : b
};
this.endSymbol =
function(b) {
return b ? (a = b, this) : a
};
this.$get = ["$parse", "$exceptionHandler", "$sce", function(c, d, e) {
function g(g, k, m) {
for (var n, p, t = 0, C = [], B = g.length, K=!1, u = []; t < B;)
- 1 != (n = g.indexOf(b, t))&&-1 != (p = g.indexOf(a, n + f)) ? (t != n && C.push(g.substring(t, n)), C.push(t = c(K = g.substring(n + f, p))), t.exp = K, t = p + h, K=!0) : (t != B && C.push(g.substring(t)), t = B);
(B = C.length) || (C.push(""), B = 1);
if (m && 1 < C.length)
throw nc("noconcat", g);
if (!k || K)
return u.length = B, t = function(a) {
try {
for (var b = 0, c = B, f; b < c; b++)
"function" == typeof(f = C[b]) &&
(f = f(a), f = m ? e.getTrusted(m, f) : e.valueOf(f), null === f || H(f) ? f = "" : "string" != typeof f && (f = oa(f))), u[b] = f;
return u.join("")
} catch (h) {
a = nc("interr", g, h.toString()), d(a)
}
}, t.exp = g, t.parts = C, t
}
var f = b.length, h = a.length;
g.startSymbol = function() {
return b
};
g.endSymbol = function() {
return a
};
return g
}
]
}
function rd() {
this.$get = ["$rootScope", "$window", "$q", function(b, a, c) {
function d(d, f, h, l) {
var k = a.setInterval, m = a.clearInterval, n = c.defer(), p = n.promise, t = 0, C = z(l)&&!l;
h = z(h) ? h : 0;
p.then(null, null, d);
p.$$intervalId =
k(function() {
n.notify(t++);
0 < h && t >= h && (n.resolve(t), m(p.$$intervalId), delete e[p.$$intervalId]);
C || b.$apply()
}, f);
e[p.$$intervalId] = n;
return p
}
var e = {};
d.cancel = function(a) {
return a && a.$$intervalId in e ? (e[a.$$intervalId].reject("canceled"), clearInterval(a.$$intervalId), delete e[a.$$intervalId], !0) : !1
};
return d
}
]
}
function sd() {
this.$get = function() {
return {
id: "en-us",
NUMBER_FORMATS: {
DECIMAL_SEP: ".",
GROUP_SEP: ",",
PATTERNS: [{
minInt: 1,
minFrac: 0,
maxFrac: 3,
posPre: "",
posSuf: "",
negPre: "-",
negSuf: "",
gSize: 3,
lgSize: 3
}, {
minInt: 1,
minFrac: 2,
maxFrac: 2,
posPre: "\u00a4",
posSuf: "",
negPre: "(\u00a4",
negSuf: ")",
gSize: 3,
lgSize: 3
}
],
CURRENCY_SYM: "$"
},
DATETIME_FORMATS: {
MONTH: "January February March April May June July August September October November December".split(" "),
SHORTMONTH: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
DAY: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
SHORTDAY: "Sun Mon Tue Wed Thu Fri Sat".split(" "),
AMPMS: ["AM", "PM"],
medium: "MMM d, y h:mm:ss a",
"short": "M/d/yy h:mm a",
fullDate: "EEEE, MMMM d, y",
longDate: "MMMM d, y",
mediumDate: "MMM d, y",
shortDate: "M/d/yy",
mediumTime: "h:mm:ss a",
shortTime: "h:mm a"
},
pluralCat: function(b) {
return 1 === b ? "one" : "other"
}
}
}
}
function oc(b) {
b = b.split("/");
for (var a = b.length; a--;)
b[a] = sb(b[a]);
return b.join("/")
}
function pc(b, a, c) {
b = ya(b, c);
a.$$protocol = b.protocol;
a.$$host = b.hostname;
a.$$port = R(b.port) || td[b.protocol] || null
}
function qc(b, a, c) {
var d = "/" !== b.charAt(0);
d && (b = "/" + b);
b = ya(b, c);
a.$$path = decodeURIComponent(d && "/" === b.pathname.charAt(0) ?
b.pathname.substring(1) : b.pathname);
a.$$search = Vb(b.search);
a.$$hash = decodeURIComponent(b.hash);
a.$$path && "/" != a.$$path.charAt(0) && (a.$$path = "/" + a.$$path)
}
function na(b, a) {
if (0 === a.indexOf(b))
return a.substr(b.length)
}
function Wa(b) {
var a = b.indexOf("#");
return - 1 == a ? b : b.substr(0, a)
}
function Gb(b) {
return b.substr(0, Wa(b).lastIndexOf("/") + 1)
}
function rc(b, a) {
this.$$html5=!0;
a = a || "";
var c = Gb(b);
pc(b, this, b);
this.$$parse = function(a) {
var e = na(c, a);
if (!D(e))
throw Hb("ipthprfx", a, c);
qc(e, this, b);
this.$$path ||
(this.$$path = "/");
this.$$compose()
};
this.$$compose = function() {
var a = Wb(this.$$search), b = this.$$hash ? "#" + sb(this.$$hash): "";
this.$$url = oc(this.$$path) + (a ? "?" + a : "") + b;
this.$$absUrl = c + this.$$url.substr(1)
};
this.$$rewrite = function(d) {
var e;
if ((e = na(b, d)) !== r)
return d = e, (e = na(a, e)) !== r ? c + (na("/", e) || e) : b + d;
if ((e = na(c, d)) !== r)
return c + e;
if (c == d + "/")
return c
}
}
function Ib(b, a) {
var c = Gb(b);
pc(b, this, b);
this.$$parse = function(d) {
var e = na(b, d) || na(c, d), e = "#" == e.charAt(0) ? na(a, e): this.$$html5 ? e: "";
if (!D(e))
throw Hb("ihshprfx",
d, a);
qc(e, this, b);
d = this.$$path;
var g = /^\/?.*?:(\/.*)/;
0 === e.indexOf(b) && (e = e.replace(b, ""));
g.exec(e) || (d = (e = g.exec(d)) ? e[1] : d);
this.$$path = d;
this.$$compose()
};
this.$$compose = function() {
var c = Wb(this.$$search), e = this.$$hash ? "#" + sb(this.$$hash): "";
this.$$url = oc(this.$$path) + (c ? "?" + c : "") + e;
this.$$absUrl = b + (this.$$url ? a + this.$$url : "")
};
this.$$rewrite = function(a) {
if (Wa(b) == Wa(a))
return a
}
}
function sc(b, a) {
this.$$html5=!0;
Ib.apply(this, arguments);
var c = Gb(b);
this.$$rewrite = function(d) {
var e;
if (b == Wa(d))
return d;
if (e = na(c, d))
return b + a + e;
if (c === d + "/")
return c
}
}
function hb(b) {
return function() {
return this[b]
}
}
function tc(b, a) {
return function(c) {
if (H(c))
return this[b];
this[b] = a(c);
this.$$compose();
return this
}
}
function ud() {
var b = "", a=!1;
this.hashPrefix = function(a) {
return z(a) ? (b = a, this) : b
};
this.html5Mode = function(b) {
return z(b) ? (a = b, this) : a
};
this.$get = ["$rootScope", "$browser", "$sniffer", "$rootElement", function(c, d, e, g) {
function f(a) {
c.$broadcast("$locationChangeSuccess", h.absUrl(), a)
}
var h, l = d.baseHref(),
k = d.url();
a ? (l = k.substring(0, k.indexOf("/", k.indexOf("//") + 2)) + (l || "/"), e = e.history ? rc : sc) : (l = Wa(k), e = Ib);
h = new e(l, "#" + b);
h.$$parse(h.$$rewrite(k));
g.on("click", function(a) {
if (!a.ctrlKey&&!a.metaKey && 2 != a.which) {
for (var b = x(a.target); "a" !== v(b[0].nodeName);)
if (b[0] === g[0] ||!(b = b.parent())[0])
return;
var e = b.prop("href"), f = h.$$rewrite(e);
e && (!b.attr("target") && f&&!a.isDefaultPrevented()) && (a.preventDefault(), f != d.url() && (h.$$parse(f), c.$apply(), W.angular["ff-684208-preventDefault"]=!0))
}
});
h.absUrl() !=
k && d.url(h.absUrl(), !0);
d.onUrlChange(function(a) {
h.absUrl() != a && (c.$broadcast("$locationChangeStart", a, h.absUrl()).defaultPrevented ? d.url(h.absUrl()) : (c.$evalAsync(function() {
var b = h.absUrl();
h.$$parse(a);
f(b)
}), c.$$phase || c.$digest()))
});
var m = 0;
c.$watch(function() {
var a = d.url(), b = h.$$replace;
m && a == h.absUrl() || (m++, c.$evalAsync(function() {
c.$broadcast("$locationChangeStart", h.absUrl(), a).defaultPrevented ? h.$$parse(a) : (d.url(h.absUrl(), b), f(a))
}));
h.$$replace=!1;
return m
});
return h
}
]
}
function vd() {
var b =
!0, a = this;
this.debugEnabled = function(a) {
return z(a) ? (b = a, this) : b
};
this.$get = ["$window", function(c) {
function d(a) {
a instanceof Error && (a.stack ? a = a.message&&-1 === a.stack.indexOf(a.message) ? "Error: " + a.message + "\n" + a.stack : a.stack : a.sourceURL && (a = a.message + "\n" + a.sourceURL + ":" + a.line));
return a
}
function e(a) {
var b = c.console || {}, e = b[a] || b.log || s;
return e.apply ? function() {
var a = [];
q(arguments, function(b) {
a.push(d(b))
});
return e.apply(b, a)
} : function(a, b) {
e(a, null == b ? "" : b)
}
}
return {
log: e("log"),
info: e("info"),
warn: e("warn"),
error: e("error"),
debug: function() {
var c = e("debug");
return function() {
b && c.apply(a, arguments)
}
}()
}
}
]
}
function pa(b, a) {
if ("constructor" === b)
throw za("isecfld", a);
return b
}
function Xa(b, a) {
if (b) {
if (b.constructor === b)
throw za("isecfn", a);
if (b.document && b.location && b.alert && b.setInterval)
throw za("isecwindow", a);
if (b.children && (b.nodeName || b.on && b.find))
throw za("isecdom", a);
}
return b
}
function ib(b, a, c, d, e) {
e = e || {};
a = a.split(".");
for (var g, f = 0; 1 < a.length; f++) {
g = pa(a.shift(), d);
var h = b[g];
h || (h = {}, b[g] = h);
b = h;
b.then && e.unwrapPromises && (qa(d), "$$v"in b || function(a) {
a.then(function(b) {
a.$$v = b
})
}(b), b.$$v === r && (b.$$v = {}), b = b.$$v)
}
g = pa(a.shift(), d);
return b[g] = c
}
function uc(b, a, c, d, e, g, f) {
pa(b, g);
pa(a, g);
pa(c, g);
pa(d, g);
pa(e, g);
return f.unwrapPromises ? function(f, l) {
var k = l && l.hasOwnProperty(b) ? l: f, m;
if (null === k || k === r)
return k;
(k = k[b]) && k.then && (qa(g), "$$v"in k || (m = k, m.$$v = r, m.then(function(a) {
m.$$v = a
})), k = k.$$v);
if (!a || null === k || k === r)
return k;
(k = k[a]) && k.then && (qa(g), "$$v"in k || (m = k,
m.$$v = r, m.then(function(a) {
m.$$v = a
})), k = k.$$v);
if (!c || null === k || k === r)
return k;
(k = k[c]) && k.then && (qa(g), "$$v"in k || (m = k, m.$$v = r, m.then(function(a) {
m.$$v = a
})), k = k.$$v);
if (!d || null === k || k === r)
return k;
(k = k[d]) && k.then && (qa(g), "$$v"in k || (m = k, m.$$v = r, m.then(function(a) {
m.$$v = a
})), k = k.$$v);
if (!e || null === k || k === r)
return k;
(k = k[e]) && k.then && (qa(g), "$$v"in k || (m = k, m.$$v = r, m.then(function(a) {
m.$$v = a
})), k = k.$$v);
return k
} : function(g, f) {
var k = f && f.hasOwnProperty(b) ? f: g;
if (null === k || k === r)
return k;
k = k[b];
if (!a ||
null === k || k === r)
return k;
k = k[a];
if (!c || null === k || k === r)
return k;
k = k[c];
if (!d || null === k || k === r)
return k;
k = k[d];
return e && null !== k && k !== r ? k = k[e] : k
}
}
function vc(b, a, c) {
if (Jb.hasOwnProperty(b))
return Jb[b];
var d = b.split("."), e = d.length, g;
if (a.csp)
g = 6 > e ? uc(d[0], d[1], d[2], d[3], d[4], c, a) : function(b, g) {
var f = 0, h;
do
h = uc(d[f++], d[f++], d[f++], d[f++], d[f++], c, a)(b, g), g = r, b = h;
while (f < e);
return h
};
else {
var f = "var l, fn, p;\n";
q(d, function(b, d) {
pa(b, c);
f += "if(s === null || s === undefined) return s;\nl=s;\ns=" +
(d ? "s" : '((k&&k.hasOwnProperty("' + b + '"))?k:s)') + '["' + b + '"];\n' + (a.unwrapPromises ? 'if (s && s.then) {\n pw("' + c.replace(/(["\r\n])/g, "\\$1") + '");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n' : "")
});
var f = f + "return s;", h = new Function("s", "k", "pw", f);
h.toString = function() {
return f
};
g = function(a, b) {
return h(a, b, qa)
}
}
"hasOwnProperty" !== b && (Jb[b] = g);
return g
}
function wd() {
var b = {}, a = {
csp: !1,
unwrapPromises: !1,
logPromiseWarnings: !0
};
this.unwrapPromises =
function(b) {
return z(b) ? (a.unwrapPromises=!!b, this) : a.unwrapPromises
};
this.logPromiseWarnings = function(b) {
return z(b) ? (a.logPromiseWarnings = b, this) : a.logPromiseWarnings
};
this.$get = ["$filter", "$sniffer", "$log", function(c, d, e) {
a.csp = d.csp;
qa = function(b) {
a.logPromiseWarnings&&!wc.hasOwnProperty(b) && (wc[b]=!0, e.warn("[$parse] Promise found in the expression `" + b + "`. Automatic unwrapping of promises in Angular expressions is deprecated."))
};
return function(d) {
var e;
switch (typeof d) {
case "string":
if (b.hasOwnProperty(d))
return b[d];
e = new Kb(a);
e = (new Ya(e, c, a)).parse(d, !1);
"hasOwnProperty" !== d && (b[d] = e);
return e;
case "function":
return d;
default:
return s
}
}
}
]
}
function xd() {
this.$get = ["$rootScope", "$exceptionHandler", function(b, a) {
return yd(function(a) {
b.$evalAsync(a)
}, a)
}
]
}
function yd(b, a) {
function c(a) {
return a
}
function d(a) {
return f(a)
}
var e = function() {
var h = [], l, k;
return k = {
resolve: function(a) {
if (h) {
var c = h;
h = r;
l = g(a);
c.length && b(function() {
for (var a, b = 0, d = c.length; b < d; b++)
a = c[b], l.then(a[0], a[1], a[2])
})
}
},
reject: function(a) {
k.resolve(f(a))
},
notify: function(a) {
if (h) {
var c = h;
h.length && b(function() {
for (var b, d = 0, e = c.length; d < e; d++)
b = c[d], b[2](a)
})
}
},
promise: {
then: function(b, f, g) {
var k = e(), C = function(d) {
try {
k.resolve((A(b) ? b : c)(d))
} catch (e) {
k.reject(e), a(e)
}
}, B = function(b) {
try {
k.resolve((A(f) ? f : d)(b))
} catch (c) {
k.reject(c), a(c)
}
}, K = function(b) {
try {
k.notify((A(g) ? g : c)(b))
} catch (d) {
a(d)
}
};
h ? h.push([C, B, K]) : l.then(C, B, K);
return k.promise
},
"catch": function(a) {
return this.then(null, a)
},
"finally": function(a) {
function b(a, c) {
var d = e();
c ? d.resolve(a) :
d.reject(a);
return d.promise
}
function d(e, f) {
var g = null;
try {
g = (a || c)()
} catch (h) {
return b(h, !1)
}
return g && A(g.then) ? g.then(function() {
return b(e, f)
}, function(a) {
return b(a, !1)
}) : b(e, f)
}
return this.then(function(a) {
return d(a, !0)
}, function(a) {
return d(a, !1)
})
}
}
}
}, g = function(a) {
return a && A(a.then) ? a : {
then: function(c) {
var d = e();
b(function() {
d.resolve(c(a))
});
return d.promise
}
}
}, f = function(c) {
return {
then: function(f, g) {
var m = e();
b(function() {
try {
m.resolve((A(g) ? g : d)(c))
} catch (b) {
m.reject(b), a(b)
}
});
return m.promise
}
}
};
return {
defer: e,
reject: f,
when: function(h, l, k, m) {
var n = e(), p, t = function(b) {
try {
return (A(l) ? l : c)(b)
} catch (d) {
return a(d), f(d)
}
}, C = function(b) {
try {
return (A(k) ? k : d)(b)
} catch (c) {
return a(c), f(c)
}
}, B = function(b) {
try {
return (A(m) ? m : c)(b)
} catch (d) {
a(d)
}
};
b(function() {
g(h).then(function(a) {
p || (p=!0, n.resolve(g(a).then(t, C, B)))
}, function(a) {
p || (p=!0, n.resolve(C(a)))
}, function(a) {
p || n.notify(B(a))
})
});
return n.promise
},
all: function(a) {
var b = e(), c = 0, d = L(a) ? []: {};
q(a, function(a, e) {
c++;
g(a).then(function(a) {
d.hasOwnProperty(e) ||
(d[e] = a, --c || b.resolve(d))
}, function(a) {
d.hasOwnProperty(e) || b.reject(a)
})
});
0 === c && b.resolve(d);
return b.promise
}
}
}
function zd() {
var b = 10, a = G("$rootScope"), c = null;
this.digestTtl = function(a) {
arguments.length && (b = a);
return b
};
this.$get = ["$injector", "$exceptionHandler", "$parse", "$browser", function(d, e, g, f) {
function h() {
this.$id = Za();
this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null;
this["this"] = this.$root = this;
this.$$destroyed=!1;
this.$$asyncQueue = [];
this.$$postDigestQueue = [];
this.$$listeners = {};
this.$$isolateBindings = {}
}
function l(b) {
if (n.$$phase)
throw a("inprog", n.$$phase);
n.$$phase = b
}
function k(a, b) {
var c = g(a);
Qa(c, b);
return c
}
function m() {}
h.prototype = {
constructor: h,
$new: function(a) {
a ? (a = new h, a.$root = this.$root, a.$$asyncQueue = this.$$asyncQueue, a.$$postDigestQueue = this.$$postDigestQueue) : (a = function() {}, a.prototype = this, a = new a, a.$id = Za());
a["this"] = a;
a.$$listeners = {};
a.$parent = this;
a.$$watchers = a.$$nextSibling = a.$$childHead =
a.$$childTail = null;
a.$$prevSibling = this.$$childTail;
this.$$childHead ? this.$$childTail = this.$$childTail.$$nextSibling = a : this.$$childHead = this.$$childTail = a;
return a
},
$watch: function(a, b, d) {
var e = k(a, "watch"), g = this.$$watchers, f = {
fn: b,
last: m,
get: e,
exp: a,
eq: !!d
};
c = null;
if (!A(b)) {
var h = k(b || s, "listener");
f.fn = function(a, b, c) {
h(c)
}
}
if ("string" == typeof a && e.constant) {
var l = f.fn;
f.fn = function(a, b, c) {
l.call(this, a, b, c);
Ma(g, f)
}
}
g || (g = this.$$watchers = []);
g.unshift(f);
return function() {
Ma(g, f)
}
},
$watchCollection: function(a,
b) {
var c = this, d, e, f = 0, h = g(a), l = [], k = {}, m = 0;
return this.$watch(function() {
e = h(c);
var a, b;
if (U(e))
if (pb(e))
for (d !== l && (d = l, m = d.length = 0, f++), a = e.length, m !== a && (f++, d.length = m = a), b = 0; b < a; b++)
d[b] !== e[b] && (f++, d[b] = e[b]);
else {
d !== k && (d = k = {}, m = 0, f++);
a = 0;
for (b in e)
e.hasOwnProperty(b) && (a++, d.hasOwnProperty(b) ? d[b] !== e[b] && (f++, d[b] = e[b]) : (m++, d[b] = e[b], f++));
if (m > a)
for (b in f++, d)
d.hasOwnProperty(b)&&!e.hasOwnProperty(b) && (m--, delete d[b])
} else
d !== e && (d = e, f++);
return f
}, function() {
b(e, d, c)
})
},
$digest: function() {
var d,
f, g, h, k = this.$$asyncQueue, q = this.$$postDigestQueue, r, v, y = b, s, x = [], z, X, $;
l("$digest");
c = null;
do {
v=!1;
for (s = this; k.length;) {
try {
$ = k.shift(), $.scope.$eval($.expression)
} catch (O) {
n.$$phase = null, e(O)
}
c = null
}
a:
do {
if (h = s.$$watchers)
for (r = h.length; r--;)
try {
if (d = h[r])
if ((f = d.get(s)) !== (g = d.last)&&!(d.eq ? ta(f, g) : "number" == typeof f && "number" == typeof g && isNaN(f) && isNaN(g)))
v=!0, c = d, d.last = d.eq ? ga(f) : f, d.fn(f, g === m ? f : g, s), 5 > y && (z = 4 - y, x[z] || (x[z] = []), X = A(d.exp) ? "fn: " + (d.exp.name || d.exp.toString()) : d.exp, X += "; newVal: " +
oa(f) + "; oldVal: " + oa(g), x[z].push(X));
else if (d === c) {
v=!1;
break a
}
} catch (M) {
n.$$phase = null, e(M)
}
if (!(h = s.$$childHead || s !== this && s.$$nextSibling))
for (; s !== this&&!(h = s.$$nextSibling);)
s = s.$parent
}
while (s = h);
if (v&&!y--)
throw n.$$phase = null, a("infdig", b, oa(x));
}
while (v || k.length);
for (n.$$phase = null; q.length;)
try {
q.shift()()
} catch (S) {
e(S)
}
},
$destroy: function() {
if (!this.$$destroyed) {
var a = this.$parent;
this.$broadcast("$destroy");
this.$$destroyed=!0;
this !== n && (a.$$childHead == this && (a.$$childHead = this.$$nextSibling),
a.$$childTail == this && (a.$$childTail = this.$$prevSibling), this.$$prevSibling && (this.$$prevSibling.$$nextSibling = this.$$nextSibling), this.$$nextSibling && (this.$$nextSibling.$$prevSibling = this.$$prevSibling), this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null)
}
},
$eval: function(a, b) {
return g(a)(this, b)
},
$evalAsync: function(a) {
n.$$phase || n.$$asyncQueue.length || f.defer(function() {
n.$$asyncQueue.length && n.$digest()
});
this.$$asyncQueue.push({
scope: this,
expression: a
})
},
$$postDigest: function(a) {
this.$$postDigestQueue.push(a)
},
$apply: function(a) {
try {
return l("$apply"), this.$eval(a)
} catch (b) {
e(b)
} finally {
n.$$phase = null;
try {
n.$digest()
} catch (c) {
throw e(c), c;
}
}
},
$on: function(a, b) {
var c = this.$$listeners[a];
c || (this.$$listeners[a] = c = []);
c.push(b);
return function() {
c[bb(c, b)] = null
}
},
$emit: function(a, b) {
var c = [], d, f = this, g=!1, h = {
name: a,
targetScope: f,
stopPropagation: function() {
g=!0
},
preventDefault: function() {
h.defaultPrevented=!0
},
defaultPrevented: !1
}, l = [h].concat(ua.call(arguments,
1)), k, m;
do {
d = f.$$listeners[a] || c;
h.currentScope = f;
k = 0;
for (m = d.length; k < m; k++)
if (d[k])
try {
d[k].apply(null, l)
} catch (n) {
e(n)
} else
d.splice(k, 1), k--, m--;
if (g)
break;
f = f.$parent
}
while (f);
return h
},
$broadcast: function(a, b) {
var c = this, d = this, f = {
name: a,
targetScope: this,
preventDefault: function() {
f.defaultPrevented=!0
},
defaultPrevented: !1
}, g = [f].concat(ua.call(arguments, 1)), h, k;
do {
c = d;
f.currentScope = c;
d = c.$$listeners[a] || [];
h = 0;
for (k = d.length; h < k; h++)
if (d[h])
try {
d[h].apply(null, g)
} catch (l) {
e(l)
} else
d.splice(h,
1), h--, k--;
if (!(d = c.$$childHead || c !== this && c.$$nextSibling))
for (; c !== this&&!(d = c.$$nextSibling);)
c = c.$parent
}
while (c = d);
return f
}
};
var n = new h;
return n
}
]
}
function Ad() {
var b = /^\s*(https?|ftp|mailto|tel|file):/, a = /^\s*(https?|ftp|file):|data:image\//;
this.aHrefSanitizationWhitelist = function(a) {
return z(a) ? (b = a, this) : b
};
this.imgSrcSanitizationWhitelist = function(b) {
return z(b) ? (a = b, this) : a
};
this.$get = function() {
return function(c, d) {
var e = d ? a: b, g;
if (!E || 8 <= E)
if (g = ya(c).href, "" !== g&&!g.match(e))
return "unsafe:" +
g;
return c
}
}
}
function Bd(b) {
if ("self" === b)
return b;
if (D(b)) {
if ( - 1 < b.indexOf("***"))
throw ra("iwcard", b);
b = b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08").replace("\\*\\*", ".*").replace("\\*", "[^:/.?&;]*");
return RegExp("^" + b + "$")
}
if (ab(b))
return RegExp("^" + b.source + "$");
throw ra("imatcher");
}
function xc(b) {
var a = [];
z(b) && q(b, function(b) {
a.push(Bd(b))
});
return a
}
function Cd() {
this.SCE_CONTEXTS = fa;
var b = ["self"], a = [];
this.resourceUrlWhitelist = function(a) {
arguments.length &&
(b = xc(a));
return b
};
this.resourceUrlBlacklist = function(b) {
arguments.length && (a = xc(b));
return a
};
this.$get = ["$injector", function(c) {
function d(a) {
var b = function(a) {
this.$$unwrapTrustedValue = function() {
return a
}
};
a && (b.prototype = new a);
b.prototype.valueOf = function() {
return this.$$unwrapTrustedValue()
};
b.prototype.toString = function() {
return this.$$unwrapTrustedValue().toString()
};
return b
}
var e = function(a) {
throw ra("unsafe");
};
c.has("$sanitize") && (e = c.get("$sanitize"));
var g = d(), f = {};
f[fa.HTML] = d(g);
f[fa.CSS] = d(g);
f[fa.URL] = d(g);
f[fa.JS] = d(g);
f[fa.RESOURCE_URL] = d(f[fa.URL]);
return {
trustAs: function(a, b) {
var c = f.hasOwnProperty(a) ? f[a]: null;
if (!c)
throw ra("icontext", a, b);
if (null === b || b === r || "" === b)
return b;
if ("string" !== typeof b)
throw ra("itype", a);
return new c(b)
},
getTrusted: function(c, d) {
if (null === d || d === r || "" === d)
return d;
var g = f.hasOwnProperty(c) ? f[c]: null;
if (g && d instanceof g)
return d.$$unwrapTrustedValue();
if (c === fa.RESOURCE_URL) {
var g = ya(d.toString()), m, n, p=!1;
m = 0;
for (n = b.length; m < n; m++)
if ("self" ===
b[m] ? Fb(g) : b[m].exec(g.href)) {
p=!0;
break
}
if (p)
for (m = 0, n = a.length; m < n; m++)
if ("self" === a[m] ? Fb(g) : a[m].exec(g.href)) {
p=!1;
break
}
if (p)
return d;
throw ra("insecurl", d.toString());
}
if (c === fa.HTML)
return e(d);
throw ra("unsafe");
},
valueOf: function(a) {
return a instanceof g ? a.$$unwrapTrustedValue() : a
}
}
}
]
}
function Dd() {
var b=!0;
this.enabled = function(a) {
arguments.length && (b=!!a);
return b
};
this.$get = ["$parse", "$sniffer", "$sceDelegate", function(a, c, d) {
if (b && c.msie && 8 > c.msieDocumentMode)
throw ra("iequirks");
var e =
ga(fa);
e.isEnabled = function() {
return b
};
e.trustAs = d.trustAs;
e.getTrusted = d.getTrusted;
e.valueOf = d.valueOf;
b || (e.trustAs = e.getTrusted = function(a, b) {
return b
}, e.valueOf = Ba);
e.parseAs = function(b, c) {
var d = a(c);
return d.literal && d.constant ? d : function(a, c) {
return e.getTrusted(b, d(a, c))
}
};
var g = e.parseAs, f = e.getTrusted, h = e.trustAs;
q(fa, function(a, b) {
var c = v(b);
e[Ra("parse_as_" + c)] = function(b) {
return g(a, b)
};
e[Ra("get_trusted_" + c)] = function(b) {
return f(a, b)
};
e[Ra("trust_as_" + c)] = function(b) {
return h(a, b)
}
});
return e
}
]
}
function Ed() {
this.$get = ["$window", "$document", function(b, a) {
var c = {}, d = R((/android (\d+)/.exec(v((b.navigator || {}).userAgent)) || [])[1]), e = /Boxee/i.test((b.navigator || {}).userAgent), g = a[0] || {}, f = g.documentMode, h, l = /^(Moz|webkit|O|ms)(?=[A-Z])/, k = g.body && g.body.style, m=!1, n=!1;
if (k) {
for (var p in k)
if (m = l.exec(p)) {
h = m[0];
h = h.substr(0, 1).toUpperCase() + h.substr(1);
break
}
h || (h = "WebkitOpacity"in k && "webkit");
m=!!("transition"in k || h + "Transition"in k);
n=!!("animation"in k || h + "Animation"in k);
!d || m && n || (m = D(g.body.style.webkitTransition), n = D(g.body.style.webkitAnimation))
}
return {
history: !(!b.history ||!b.history.pushState || 4 > d || e),
hashchange: "onhashchange"in b && (!f || 7 < f),
hasEvent: function(a) {
if ("input" == a && 9 == E)
return !1;
if (H(c[a])) {
var b = g.createElement("div");
c[a] = "on" + a in b
}
return c[a]
},
csp: Sb(),
vendorPrefix: h,
transitions: m,
animations: n,
msie: E,
msieDocumentMode: f
}
}
]
}
function Fd() {
this.$get = ["$rootScope", "$browser", "$q", "$exceptionHandler", function(b, a, c, d) {
function e(e, h, l) {
var k = c.defer(),
m = k.promise, n = z(l)&&!l;
h = a.defer(function() {
try {
k.resolve(e())
} catch (a) {
k.reject(a), d(a)
} finally {
delete g[m.$$timeoutId]
}
n || b.$apply()
}, h);
m.$$timeoutId = h;
g[h] = k;
return m
}
var g = {};
e.cancel = function(b) {
return b && b.$$timeoutId in g ? (g[b.$$timeoutId].reject("canceled"), delete g[b.$$timeoutId], a.defer.cancel(b.$$timeoutId)) : !1
};
return e
}
]
}
function ya(b, a) {
var c = b;
E && (T.setAttribute("href", c), c = T.href);
T.setAttribute("href", c);
return {
href: T.href,
protocol: T.protocol ? T.protocol.replace(/:$/, ""): "",
host: T.host,
search: T.search ? T.search.replace(/^\?/, ""): "",
hash: T.hash ? T.hash.replace(/^#/, ""): "",
hostname: T.hostname,
port: T.port,
pathname: "/" === T.pathname.charAt(0) ? T.pathname: "/" + T.pathname
}
}
function Fb(b) {
b = D(b) ? ya(b) : b;
return b.protocol === yc.protocol && b.host === yc.host
}
function Gd() {
this.$get = ca(W)
}
function zc(b) {
function a(d, e) {
if (U(d)) {
var g = {};
q(d, function(b, c) {
g[c] = a(c, b)
});
return g
}
return b.factory(d + c, e)
}
var c = "Filter";
this.register = a;
this.$get = ["$injector", function(a) {
return function(b) {
return a.get(b +
c)
}
}
];
a("currency", Ac);
a("date", Bc);
a("filter", Hd);
a("json", Id);
a("limitTo", Jd);
a("lowercase", Kd);
a("number", Cc);
a("orderBy", Dc);
a("uppercase", Ld)
}
function Hd() {
return function(b, a, c) {
if (!L(b))
return b;
var d = typeof c, e = [];
e.check = function(a) {
for (var b = 0; b < e.length; b++)
if (!e[b](a))
return !1;
return !0
};
"function" !== d && (c = "boolean" === d && c ? function(a, b) {
return Pa.equals(a, b)
} : function(a, b) {
b = ("" + b).toLowerCase();
return - 1 < ("" + a).toLowerCase().indexOf(b)
});
var g = function(a, b) {
if ("string" == typeof b && "!" ===
b.charAt(0))
return !g(a, b.substr(1));
switch (typeof a) {
case "boolean":
case "number":
case "string":
return c(a, b);
case "object":
switch (typeof b) {
case "object":
return c(a, b);
default:
for (var d in a)
if ("$" !== d.charAt(0) && g(a[d], b))
return !0
}
return !1;
case "array":
for (d = 0; d < a.length; d++)
if (g(a[d], b))
return !0;
return !1;
default:
return !1
}
};
switch (typeof a) {
case "boolean":
case "number":
case "string":
a = {
$: a
};
case "object":
for (var f in a)
"$" == f ? function() {
if (a[f]) {
var b = f;
e.push(function(c) {
return g(c, a[b])
})
}
}() :
function() {
if ("undefined" != typeof a[f]) {
var b = f;
e.push(function(c) {
return g(ub(c, b), a[b])
})
}
}();
break;
case "function":
e.push(a);
break;
default:
return b
}
for (var d = [], h = 0; h < b.length; h++) {
var l = b[h];
e.check(l) && d.push(l)
}
return d
}
}
function Ac(b) {
var a = b.NUMBER_FORMATS;
return function(b, d) {
H(d) && (d = a.CURRENCY_SYM);
return Ec(b, a.PATTERNS[1], a.GROUP_SEP, a.DECIMAL_SEP, 2).replace(/\u00A4/g, d)
}
}
function Cc(b) {
var a = b.NUMBER_FORMATS;
return function(b, d) {
return Ec(b, a.PATTERNS[0], a.GROUP_SEP, a.DECIMAL_SEP, d)
}
}
function Ec(b, a, c, d, e) {
if (isNaN(b) ||!isFinite(b))
return "";
var g = 0 > b;
b = Math.abs(b);
var f = b + "", h = "", l = [], k=!1;
if ( - 1 !== f.indexOf("e")) {
var m = f.match(/([\d\.]+)e(-?)(\d+)/);
m && "-" == m[2] && m[3] > e + 1 ? f = "0" : (h = f, k=!0)
}
if (k)
0 < e && ( - 1 < b && 1 > b) && (h = b.toFixed(e));
else {
f = (f.split(Fc)[1] || "").length;
H(e) && (e = Math.min(Math.max(a.minFrac, f), a.maxFrac));
f = Math.pow(10, e);
b = Math.round(b * f) / f;
b = ("" + b).split(Fc);
f = b[0];
b = b[1] || "";
var m = 0, n = a.lgSize, p = a.gSize;
if (f.length >= n + p)
for (m = f.length - n, k = 0; k < m; k++)
0 === (m - k)%p && 0 !==
k && (h += c), h += f.charAt(k);
for (k = m; k < f.length; k++)
0 === (f.length - k)%n && 0 !== k && (h += c), h += f.charAt(k);
for (; b.length < e;)
b += "0";
e && "0" !== e && (h += d + b.substr(0, e))
}
l.push(g ? a.negPre : a.posPre);
l.push(h);
l.push(g ? a.negSuf : a.posSuf);
return l.join("")
}
function Lb(b, a, c) {
var d = "";
0 > b && (d = "-", b =- b);
for (b = "" + b; b.length < a;)
b = "0" + b;
c && (b = b.substr(b.length - a));
return d + b
}
function V(b, a, c, d) {
c = c || 0;
return function(e) {
e = e["get" + b]();
if (0 < c || e>-c)
e += c;
0 === e&&-12 == c && (e = 12);
return Lb(e, a, d)
}
}
function jb(b, a) {
return function(c,
d) {
var e = c["get" + b](), g = Ia(a ? "SHORT" + b : b);
return d[g][e]
}
}
function Bc(b) {
function a(a) {
var b;
if (b = a.match(c)) {
a = new Date(0);
var g = 0, f = 0, h = b[8] ? a.setUTCFullYear: a.setFullYear, l = b[8] ? a.setUTCHours: a.setHours;
b[9] && (g = R(b[9] + b[10]), f = R(b[9] + b[11]));
h.call(a, R(b[1]), R(b[2]) - 1, R(b[3]));
g = R(b[4] || 0) - g;
f = R(b[5] || 0) - f;
h = R(b[6] || 0);
b = Math.round(1E3 * parseFloat("0." + (b[7] || 0)));
l.call(a, g, f, h, b)
}
return a
}
var c = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
return function(c, e) {
var g = "", f = [], h, l;
e = e || "mediumDate";
e = b.DATETIME_FORMATS[e] || e;
D(c) && (c = Md.test(c) ? R(c) : a(c));
qb(c) && (c = new Date(c));
if (!La(c))
return c;
for (; e;)(l = Nd.exec(e)
) ? (f = f.concat(ua.call(l, 1)), e = f.pop()) : (f.push(e), e = null);
q(f, function(a) {
h = Od[a];
g += h ? h(c, b.DATETIME_FORMATS) : a.replace(/(^'|'$)/g, "").replace(/''/g, "'")
});
return g
}
}
function Id() {
return function(b) {
return oa(b, !0)
}
}
function Jd() {
return function(b, a) {
if (!L(b)&&!D(b))
return b;
a = R(a);
if (D(b))
return a ? 0 <= a ? b.slice(0, a) : b.slice(a,
b.length) : "";
var c = [], d, e;
a > b.length ? a = b.length : a<-b.length && (a =- b.length);
0 < a ? (d = 0, e = a) : (d = b.length + a, e = b.length);
for (; d < e; d++)
c.push(b[d]);
return c
}
}
function Dc(b) {
return function(a, c, d) {
function e(a, b) {
return Oa(b) ? function(b, c) {
return a(c, b)
} : a
}
if (!L(a) ||!c)
return a;
c = L(c) ? c : [c];
c = Pc(c, function(a) {
var c=!1, d = a || Ba;
if (D(a)) {
if ("+" == a.charAt(0) || "-" == a.charAt(0))
c = "-" == a.charAt(0), a = a.substring(1);
d = b(a)
}
return e(function(a, b) {
var c;
c = d(a);
var e = d(b), f = typeof c, g = typeof e;
f == g ? ("string" == f && (c =
c.toLowerCase(), e = e.toLowerCase()), c = c === e ? 0 : c < e?-1 : 1) : c = f < g?-1 : 1;
return c
}, c)
});
for (var g = [], f = 0; f < a.length; f++)
g.push(a[f]);
return g.sort(e(function(a, b) {
for (var d = 0; d < c.length; d++) {
var e = c[d](a, b);
if (0 !== e)
return e
}
return 0
}, d))
}
}
function sa(b) {
A(b) && (b = {
link: b
});
b.restrict = b.restrict || "AC";
return ca(b)
}
function Gc(b, a) {
function c(a, c) {
c = c ? "-" + cb(c, "-") : "";
b.removeClass((a ? kb : lb) + c).addClass((a ? lb : kb) + c)
}
var d = this, e = b.parent().controller("form") || mb, g = 0, f = d.$error = {}, h = [];
d.$name = a.name || a.ngForm;
d.$dirty=!1;
d.$pristine=!0;
d.$valid=!0;
d.$invalid=!1;
e.$addControl(d);
b.addClass(Ja);
c(!0);
d.$addControl = function(a) {
wa(a.$name, "input");
h.push(a);
a.$name && (d[a.$name] = a)
};
d.$removeControl = function(a) {
a.$name && d[a.$name] === a && delete d[a.$name];
q(f, function(b, c) {
d.$setValidity(c, !0, a)
});
Ma(h, a)
};
d.$setValidity = function(a, b, h) {
var n = f[a];
if (b)
n && (Ma(n, h), n.length || (g--, g || (c(b), d.$valid=!0, d.$invalid=!1), f[a]=!1, c(!0, a), e.$setValidity(a, !0, d)));
else {
g || c(b);
if (n) {
if ( - 1 != bb(n, h))
return
} else
f[a] = n = [],
g++, c(!1, a), e.$setValidity(a, !1, d);
n.push(h);
d.$valid=!1;
d.$invalid=!0
}
};
d.$setDirty = function() {
b.removeClass(Ja).addClass(nb);
d.$dirty=!0;
d.$pristine=!1;
e.$setDirty()
};
d.$setPristine = function() {
b.removeClass(nb).addClass(Ja);
d.$dirty=!1;
d.$pristine=!0;
q(h, function(a) {
a.$setPristine()
})
}
}
function ob(b, a, c, d, e, g) {
var f=!1;
a.on("compositionstart", function() {
f=!0
});
a.on("compositionend", function() {
f=!1
});
var h = function() {
if (!f) {
var e = a.val();
Oa(c.ngTrim || "T") && (e = aa(e));
d.$viewValue !== e && b.$apply(function() {
d.$setViewValue(e)
})
}
};
if (e.hasEvent("input"))
a.on("input", h);
else {
var l, k = function() {
l || (l = g.defer(function() {
h();
l = null
}))
};
a.on("keydown", function(a) {
a = a.keyCode;
91 === a || (15 < a && 19 > a || 37 <= a && 40 >= a) || k()
});
if (e.hasEvent("paste"))
a.on("paste cut", k)
}
a.on("change", h);
d.$render = function() {
a.val(d.$isEmpty(d.$viewValue) ? "" : d.$viewValue)
};
var m = c.ngPattern, n = function(a, b) {
if (d.$isEmpty(b) || a.test(b))
return d.$setValidity("pattern", !0), b;
d.$setValidity("pattern", !1);
return r
};
m && ((e = m.match(/^\/(.*)\/([gim]*)$/)) ? (m = RegExp(e[1],
e[2]), e = function(a) {
return n(m, a)
}) : e = function(c) {
var d = b.$eval(m);
if (!d ||!d.test)
throw G("ngPattern")("noregexp", m, d, ha(a));
return n(d, c)
}, d.$formatters.push(e), d.$parsers.push(e));
if (c.ngMinlength) {
var p = R(c.ngMinlength);
e = function(a) {
if (!d.$isEmpty(a) && a.length < p)
return d.$setValidity("minlength", !1), r;
d.$setValidity("minlength", !0);
return a
};
d.$parsers.push(e);
d.$formatters.push(e)
}
if (c.ngMaxlength) {
var t = R(c.ngMaxlength);
e = function(a) {
if (!d.$isEmpty(a) && a.length > t)
return d.$setValidity("maxlength",
!1), r;
d.$setValidity("maxlength", !0);
return a
};
d.$parsers.push(e);
d.$formatters.push(e)
}
}
function Mb(b, a) {
b = "ngClass" + b;
return function() {
return {
restrict: "AC",
link: function(c, d, e) {
function g(b) {
if (!0 === a || c.$index%2 === a) {
var d = f(b || "");
h ? ta(b, h) || e.$updateClass(d, f(h)) : e.$addClass(d)
}
h = ga(b)
}
function f(a) {
if (L(a))
return a.join(" ");
if (U(a)) {
var b = [];
q(a, function(a, c) {
a && b.push(c)
});
return b.join(" ")
}
return a
}
var h;
c.$watch(e[b], g, !0);
e.$observe("class", function(a) {
g(c.$eval(e[b]))
});
"ngClass" !==
b && c.$watch("$index", function(d, g) {
var h = d & 1;
if (h !== g & 1) {
var n = f(c.$eval(e[b]));
h === a ? e.$addClass(n) : e.$removeClass(n)
}
})
}
}
}
}
var v = function(b) {
return D(b) ? b.toLowerCase() : b
}, Ia = function(b) {
return D(b) ? b.toUpperCase() : b
}, E, x, Ca, ua = [].slice, Pd = [].push, $a = Object.prototype.toString, Na = G("ng"), Pa = W.angular || (W.angular = {}), Va, Ga, ja = ["0", "0", "0"];
E = R((/msie (\d+)/.exec(v(navigator.userAgent)) || [])[1]);
isNaN(E) && (E = R((/trident\/.*; rv:(\d+)/.exec(v(navigator.userAgent)) || [])[1]));
s.$inject = [];
Ba.$inject =
[];
var aa = function() {
return String.prototype.trim ? function(b) {
return D(b) ? b.trim() : b
} : function(b) {
return D(b) ? b.replace(/^\s\s*/, "").replace(/\s\s*$/, "") : b
}
}();
Ga = 9 > E ? function(b) {
b = b.nodeName ? b : b[0];
return b.scopeName && "HTML" != b.scopeName ? Ia(b.scopeName + ":" + b.nodeName) : b.nodeName
} : function(b) {
return b.nodeName ? b.nodeName : b[0].nodeName
};
var Tc = /[A-Z]/g, Qd = {
full: "1.2.5",
major: 1,
minor: 2,
dot: 5,
codeName: "singularity-expansion"
}, Sa = I.cache = {}, db = I.expando = "ng-" + (new Date).getTime(), Xc = 1, Hc = W.document.addEventListener ?
function(b, a, c) {
b.addEventListener(a, c, !1)
}
: function(b, a, c) {
b.attachEvent("on" + a, c)
}, Ab = W.document.removeEventListener ? function(b, a, c) {
b.removeEventListener(a, c, !1)
}
: function(b, a, c) {
b.detachEvent("on" + a, c)
}, Vc = /([\:\-\_]+(.))/g, Wc = /^moz([A-Z])/, xb = G("jqLite"), Fa = I.prototype = {
ready: function(b) {
function a() {
c || (c=!0, b())
}
var c=!1;
"complete" === N.readyState ? setTimeout(a) : (this.on("DOMContentLoaded", a), I(W).on("load", a))
},
toString: function() {
var b = [];
q(this, function(a) {
b.push("" + a)
});
return "[" + b.join(", ") +
"]"
},
eq: function(b) {
return 0 <= b ? x(this[b]) : x(this[this.length + b])
},
length: 0,
push: Pd,
sort: [].sort,
splice: [].splice
}, fb = {};
q("multiple selected checked disabled readOnly required open".split(" "), function(b) {
fb[v(b)] = b
});
var ec = {};
q("input select option textarea button form details".split(" "), function(b) {
ec[Ia(b)]=!0
});
q({
data: ac,
inheritedData: eb,
scope: function(b) {
return x(b).data("$scope") || eb(b.parentNode || b, ["$isolateScope", "$scope"])
},
isolateScope: function(b) {
return x(b).data("$isolateScope") ||
x(b).data("$isolateScopeNoTemplate")
},
controller: bc,
injector: function(b) {
return eb(b, "$injector")
},
removeAttr: function(b, a) {
b.removeAttribute(a)
},
hasClass: Bb,
css: function(b, a, c) {
a = Ra(a);
if (z(c))
b.style[a] = c;
else {
var d;
8 >= E && (d = b.currentStyle && b.currentStyle[a], "" === d && (d = "auto"));
d = d || b.style[a];
8 >= E && (d = "" === d ? r : d);
return d
}
},
attr: function(b, a, c) {
var d = v(a);
if (fb[d])
if (z(c))
c ? (b[a]=!0, b.setAttribute(a, d)) : (b[a]=!1, b.removeAttribute(d));
else
return b[a] || (b.attributes.getNamedItem(a) || s).specified ?
d : r;
else if (z(c))
b.setAttribute(a, c);
else if (b.getAttribute)
return b = b.getAttribute(a, 2), null === b ? r : b
},
prop: function(b, a, c) {
if (z(c))
b[a] = c;
else
return b[a]
},
text: function() {
function b(b, d) {
var e = a[b.nodeType];
if (H(d))
return e ? b[e] : "";
b[e] = d
}
var a = [];
9 > E ? (a[1] = "innerText", a[3] = "nodeValue") : a[1] = a[3] = "textContent";
b.$dv = "";
return b
}(),
val: function(b, a) {
if (H(a)) {
if ("SELECT" === Ga(b) && b.multiple) {
var c = [];
q(b.options, function(a) {
a.selected && c.push(a.value || a.text)
});
return 0 === c.length ? null : c
}
return b.value
}
b.value =
a
},
html: function(b, a) {
if (H(a))
return b.innerHTML;
for (var c = 0, d = b.childNodes; c < d.length; c++)
Da(d[c]);
b.innerHTML = a
},
empty: cc
}, function(b, a) {
I.prototype[a] = function(a, d) {
var e, g;
if (b !== cc && (2 == b.length && b !== Bb && b !== bc ? a : d) === r) {
if (U(a)) {
for (e = 0; e < this.length; e++)
if (b === ac)
b(this[e], a);
else
for (g in a)
b(this[e], g, a[g]);
return this
}
e = b.$dv;
g = e === r ? Math.min(this.length, 1) : this.length;
for (var f = 0; f < g; f++) {
var h = b(this[f], a, d);
e = e ? e + h : h
}
return e
}
for (e = 0; e < this.length; e++)
b(this[e], a, d);
return this
}
});
q({
removeData: Zb,
dealoc: Da,
on: function a(c, d, e, g) {
if (z(g))
throw xb("onargs");
var f = ka(c, "events"), h = ka(c, "handle");
f || ka(c, "events", f = {});
h || ka(c, "handle", h = Yc(c, f));
q(d.split(" "), function(d) {
var g = f[d];
if (!g) {
if ("mouseenter" == d || "mouseleave" == d) {
var m = N.body.contains || N.body.compareDocumentPosition ? function(a, c) {
var d = 9 === a.nodeType ? a.documentElement: a, e = c && c.parentNode;
return a === e||!!(e && 1 === e.nodeType && (d.contains ? d.contains(e) : a.compareDocumentPosition && a.compareDocumentPosition(e) & 16))
}
: function(a, c) {
if (c)
for (; c =
c.parentNode;)
if (c === a)
return !0;
return !1
};
f[d] = [];
a(c, {
mouseleave: "mouseout",
mouseenter: "mouseover"
}
[d], function(a) {
var c = a.relatedTarget;
c && (c === this || m(this, c)) || h(a, d)
})
} else
Hc(c, d, h), f[d] = [];
g = f[d]
}
g.push(e)
})
},
off: $b,
replaceWith: function(a, c) {
var d, e = a.parentNode;
Da(a);
q(new I(c), function(c) {
d ? e.insertBefore(c, d.nextSibling) : e.replaceChild(c, a);
d = c
})
},
children: function(a) {
var c = [];
q(a.childNodes, function(a) {
1 === a.nodeType && c.push(a)
});
return c
},
contents: function(a) {
return a.childNodes || []
},
append: function(a, c) {
q(new I(c), function(c) {
1 !== a.nodeType && 11 !== a.nodeType || a.appendChild(c)
})
},
prepend: function(a, c) {
if (1 === a.nodeType) {
var d = a.firstChild;
q(new I(c), function(c) {
a.insertBefore(c, d)
})
}
},
wrap: function(a, c) {
c = x(c)[0];
var d = a.parentNode;
d && d.replaceChild(c, a);
c.appendChild(a)
},
remove: function(a) {
Da(a);
var c = a.parentNode;
c && c.removeChild(a)
},
after: function(a, c) {
var d = a, e = a.parentNode;
q(new I(c), function(a) {
e.insertBefore(a, d.nextSibling);
d = a
})
},
addClass: Db,
removeClass: Cb,
toggleClass: function(a,
c, d) {
H(d) && (d=!Bb(a, c));
(d ? Db : Cb)(a, c)
},
parent: function(a) {
return (a = a.parentNode) && 11 !== a.nodeType ? a : null
},
next: function(a) {
if (a.nextElementSibling)
return a.nextElementSibling;
for (a = a.nextSibling; null != a && 1 !== a.nodeType;)
a = a.nextSibling;
return a
},
find: function(a, c) {
return a.getElementsByTagName ? a.getElementsByTagName(c) : []
},
clone: zb,
triggerHandler: function(a, c, d) {
c = (ka(a, "events") || {})[c];
d = d || [];
var e = [{
preventDefault: s,
stopPropagation: s
}
];
q(c, function(c) {
c.apply(a, e.concat(d))
})
}
}, function(a, c) {
I.prototype[c] =
function(c, e, g) {
for (var f, h = 0; h < this.length; h++)
H(f) ? (f = a(this[h], c, e, g), z(f) && (f = x(f))) : yb(f, a(this[h], c, e, g));
return z(f) ? f : this
};
I.prototype.bind = I.prototype.on;
I.prototype.unbind = I.prototype.off
});
Ta.prototype = {
put: function(a, c) {
this[Ea(a)] = c
},
get: function(a) {
return this[Ea(a)]
},
remove: function(a) {
var c = this[a = Ea(a)];
delete this[a];
return c
}
};
var $c = /^function\s*[^\(]*\(\s*([^\)]*)\)/m, ad = /,/, bd = /^\s*(_?)(\S+?)\1\s*$/, Zc = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, Ua = G("$injector"), Rd = G("$animate"), Sd =
["$provide", function(a) {
this.$$selectors = {};
this.register = function(c, d) {
var e = c + "-animation";
if (c && "." != c.charAt(0))
throw Rd("notcsel", c);
this.$$selectors[c.substr(1)] = e;
a.factory(e, d)
};
this.$get = ["$timeout", function(a) {
return {
enter: function(d, e, g, f) {
g ? g.after(d) : (e && e[0] || (e = g.parent()), e.append(d));
f && a(f, 0, !1)
},
leave: function(d, e) {
d.remove();
e && a(e, 0, !1)
},
move: function(a, c, g, f) {
this.enter(a, c, g, f)
},
addClass: function(d, e, g) {
e = D(e) ? e : L(e) ? e.join(" ") : "";
q(d, function(a) {
Db(a, e)
});
g && a(g, 0, !1)
},
removeClass: function(d,
e, g) {
e = D(e) ? e : L(e) ? e.join(" ") : "";
q(d, function(a) {
Cb(a, e)
});
g && a(g, 0, !1)
},
enabled: s
}
}
]
}
], ia = G("$compile");
hc.$inject = ["$provide", "$$sanitizeUriProvider"];
var id = /^(x[\:\-_]|data[\:\-_])/i, pd = W.XMLHttpRequest || function() {
try {
return new ActiveXObject("Msxml2.XMLHTTP.6.0")
} catch (a) {}
try {
return new ActiveXObject("Msxml2.XMLHTTP.3.0")
} catch (c) {}
try {
return new ActiveXObject("Msxml2.XMLHTTP")
} catch (d) {}
throw G("$httpBackend")("noxhr");
}, nc = G("$interpolate"), Td = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/, td = {
http: 80,
https: 443,
ftp: 21
}, Hb = G("$location");
sc.prototype = Ib.prototype = rc.prototype = {
$$html5: !1,
$$replace: !1,
absUrl: hb("$$absUrl"),
url: function(a, c) {
if (H(a))
return this.$$url;
var d = Td.exec(a);
d[1] && this.path(decodeURIComponent(d[1]));
(d[2] || d[1]) && this.search(d[3] || "");
this.hash(d[5] || "", c);
return this
},
protocol: hb("$$protocol"),
host: hb("$$host"),
port: hb("$$port"),
path: tc("$$path", function(a) {
return "/" == a.charAt(0) ? a : "/" + a
}),
search: function(a, c) {
switch (arguments.length) {
case 0:
return this.$$search;
case 1:
if (D(a))
this.$$search =
Vb(a);
else if (U(a))
this.$$search = a;
else
throw Hb("isrcharg");
break;
default:
H(c) || null === c ? delete this.$$search[a] : this.$$search[a] = c
}
this.$$compose();
return this
},
hash: tc("$$hash", Ba),
replace: function() {
this.$$replace=!0;
return this
}
};
var za = G("$parse"), wc = {}, qa, Ka = {
"null": function() {
return null
},
"true": function() {
return !0
},
"false": function() {
return !1
},
undefined: s,
"+": function(a, c, d, e) {
d = d(a, c);
e = e(a, c);
return z(d) ? z(e) ? d + e : d : z(e) ? e : r
},
"-": function(a, c, d, e) {
d = d(a, c);
e = e(a, c);
return (z(d) ? d : 0) - (z(e) ?
e : 0)
},
"*": function(a, c, d, e) {
return d(a, c) * e(a, c)
},
"/": function(a, c, d, e) {
return d(a, c) / e(a, c)
},
"%": function(a, c, d, e) {
return d(a, c)%e(a, c)
},
"^": function(a, c, d, e) {
return d(a, c)^e(a, c)
},
"=": s,
"===": function(a, c, d, e) {
return d(a, c) === e(a, c)
},
"!==": function(a, c, d, e) {
return d(a, c) !== e(a, c)
},
"==": function(a, c, d, e) {
return d(a, c) == e(a, c)
},
"!=": function(a, c, d, e) {
return d(a, c) != e(a, c)
},
"<": function(a, c, d, e) {
return d(a, c) < e(a, c)
},
">": function(a, c, d, e) {
return d(a, c) > e(a, c)
},
"<=": function(a, c, d, e) {
return d(a, c) <=
e(a, c)
},
">=": function(a, c, d, e) {
return d(a, c) >= e(a, c)
},
"&&": function(a, c, d, e) {
return d(a, c) && e(a, c)
},
"||": function(a, c, d, e) {
return d(a, c) || e(a, c)
},
"&": function(a, c, d, e) {
return d(a, c) & e(a, c)
},
"|": function(a, c, d, e) {
return e(a, c)(a, c, d(a, c))
},
"!": function(a, c, d) {
return !d(a, c)
}
}, Ud = {
n: "\n",
f: "\f",
r: "\r",
t: "\t",
v: "\v",
"'": "'",
'"': '"'
}, Kb = function(a) {
this.options = a
};
Kb.prototype = {
constructor: Kb,
lex: function(a) {
this.text = a;
this.index = 0;
this.ch = r;
this.lastCh = ":";
this.tokens = [];
var c;
for (a = []; this.index < this.text.length;) {
this.ch =
this.text.charAt(this.index);
if (this.is("\"'"))
this.readString(this.ch);
else if (this.isNumber(this.ch) || this.is(".") && this.isNumber(this.peek()))
this.readNumber();
else if (this.isIdent(this.ch))
this.readIdent(), this.was("{,") && ("{" === a[0] && (c = this.tokens[this.tokens.length - 1])) && (c.json =- 1 === c.text.indexOf("."));
else if (this.is("(){}[].,;:?"))
this.tokens.push({
index: this.index,
text: this.ch,
json: this.was(":[,") && this.is("{[") || this.is("}]:,")
}), this.is("{[") && a.unshift(this.ch), this.is("}]") && a.shift(),
this.index++;
else if (this.isWhitespace(this.ch)) {
this.index++;
continue
} else {
var d = this.ch + this.peek(), e = d + this.peek(2), g = Ka[this.ch], f = Ka[d], h = Ka[e];
h ? (this.tokens.push({
index: this.index,
text: e,
fn: h
}), this.index += 3) : f ? (this.tokens.push({
index: this.index,
text: d,
fn: f
}), this.index += 2) : g ? (this.tokens.push({
index: this.index,
text: this.ch,
fn: g,
json: this.was("[,:") && this.is("+-")
}), this.index += 1) : this.throwError("Unexpected next character ", this.index, this.index + 1)
}
this.lastCh = this.ch
}
return this.tokens
},
is: function(a) {
return - 1 !== a.indexOf(this.ch)
},
was: function(a) {
return - 1 !== a.indexOf(this.lastCh)
},
peek: function(a) {
a = a || 1;
return this.index + a < this.text.length ? this.text.charAt(this.index + a) : !1
},
isNumber: function(a) {
return "0" <= a && "9" >= a
},
isWhitespace: function(a) {
return " " === a || "\r" === a || "\t" === a || "\n" === a || "\v" === a || "\u00a0" === a
},
isIdent: function(a) {
return "a" <= a && "z" >= a || "A" <= a && "Z" >= a || "_" === a || "$" === a
},
isExpOperator: function(a) {
return "-" === a || "+" === a || this.isNumber(a)
},
throwError: function(a, c, d) {
d =
d || this.index;
c = z(c) ? "s " + c + "-" + this.index + " [" + this.text.substring(c, d) + "]" : " " + d;
throw za("lexerr", a, c, this.text);
},
readNumber: function() {
for (var a = "", c = this.index; this.index < this.text.length;) {
var d = v(this.text.charAt(this.index));
if ("." == d || this.isNumber(d))
a += d;
else {
var e = this.peek();
if ("e" == d && this.isExpOperator(e))
a += d;
else if (this.isExpOperator(d) && e && this.isNumber(e) && "e" == a.charAt(a.length - 1))
a += d;
else if (!this.isExpOperator(d) || e && this.isNumber(e) || "e" != a.charAt(a.length - 1))
break;
else
this.throwError("Invalid exponent")
}
this.index++
}
a*=
1;
this.tokens.push({
index: c,
text: a,
json: !0,
fn: function() {
return a
}
})
},
readIdent: function() {
for (var a = this, c = "", d = this.index, e, g, f, h; this.index < this.text.length;) {
h = this.text.charAt(this.index);
if ("." === h || this.isIdent(h) || this.isNumber(h))
"." === h && (e = this.index), c += h;
else
break;
this.index++
}
if (e)
for (g = this.index; g < this.text.length;) {
h = this.text.charAt(g);
if ("(" === h) {
f = c.substr(e - d + 1);
c = c.substr(0, e - d);
this.index = g;
break
}
if (this.isWhitespace(h))
g++;
else
break
}
d = {
index: d,
text: c
};
if (Ka.hasOwnProperty(c))
d.fn =
Ka[c], d.json = Ka[c];
else {
var l = vc(c, this.options, this.text);
d.fn = w(function(a, c) {
return l(a, c)
}, {
assign: function(d, e) {
return ib(d, c, e, a.text, a.options)
}
})
}
this.tokens.push(d);
f && (this.tokens.push({
index: e,
text: ".",
json: !1
}), this.tokens.push({
index: e + 1,
text: f,
json: !1
}))
},
readString: function(a) {
var c = this.index;
this.index++;
for (var d = "", e = a, g=!1; this.index < this.text.length;) {
var f = this.text.charAt(this.index), e = e + f;
if (g)
"u" === f ? (f = this.text.substring(this.index + 1, this.index + 5), f.match(/[\da-f]{4}/i) ||
this.throwError("Invalid unicode escape [\\u" + f + "]"), this.index += 4, d += String.fromCharCode(parseInt(f, 16))) : d = (g = Ud[f]) ? d + g : d + f, g=!1;
else if ("\\" === f)
g=!0;
else {
if (f === a) {
this.index++;
this.tokens.push({
index: c,
text: e,
string: d,
json: !0,
fn: function() {
return d
}
});
return
}
d += f
}
this.index++
}
this.throwError("Unterminated quote", c)
}
};
var Ya = function(a, c, d) {
this.lexer = a;
this.$filter = c;
this.options = d
};
Ya.ZERO = function() {
return 0
};
Ya.prototype = {
constructor: Ya,
parse: function(a, c) {
this.text = a;
this.json = c;
this.tokens =
this.lexer.lex(a);
c && (this.assignment = this.logicalOR, this.functionCall = this.fieldAccess = this.objectIndex = this.filterChain = function() {
this.throwError("is not valid json", {
text: a,
index: 0
})
});
var d = c ? this.primary(): this.statements();
0 !== this.tokens.length && this.throwError("is an unexpected token", this.tokens[0]);
d.literal=!!d.literal;
d.constant=!!d.constant;
return d
},
primary: function() {
var a;
if (this.expect("("))
a = this.filterChain(), this.consume(")");
else if (this.expect("["))
a = this.arrayDeclaration();
else if (this.expect("{"))
a = this.object();
else {
var c = this.expect();
(a = c.fn) || this.throwError("not a primary expression", c);
c.json && (a.constant=!0, a.literal=!0)
}
for (var d; c = this.expect("(", "[", ".");)
"(" === c.text ? (a = this.functionCall(a, d), d = null) : "[" === c.text ? (d = a, a = this.objectIndex(a)) : "." === c.text ? (d = a, a = this.fieldAccess(a)) : this.throwError("IMPOSSIBLE");
return a
},
throwError: function(a, c) {
throw za("syntax", c.text, a, c.index + 1, this.text, this.text.substring(c.index));
},
peekToken: function() {
if (0 === this.tokens.length)
throw za("ueoe",
this.text);
return this.tokens[0]
},
peek: function(a, c, d, e) {
if (0 < this.tokens.length) {
var g = this.tokens[0], f = g.text;
if (f === a || f === c || f === d || f === e ||!(a || c || d || e))
return g
}
return !1
},
expect: function(a, c, d, e) {
return (a = this.peek(a, c, d, e)) ? (this.json&&!a.json && this.throwError("is not valid json", a), this.tokens.shift(), a) : !1
},
consume: function(a) {
this.expect(a) || this.throwError("is unexpected, expecting [" + a + "]", this.peek())
},
unaryFn: function(a, c) {
return w(function(d, e) {
return a(d, e, c)
}, {
constant: c.constant
})
},
ternaryFn: function(a, c, d) {
return w(function(e, g) {
return a(e, g) ? c(e, g) : d(e, g)
}, {
constant: a.constant && c.constant && d.constant
})
},
binaryFn: function(a, c, d) {
return w(function(e, g) {
return c(e, g, a, d)
}, {
constant: a.constant && d.constant
})
},
statements: function() {
for (var a = []; ;)
if (0 < this.tokens.length&&!this.peek("}", ")", ";", "]") && a.push(this.filterChain()), !this.expect(";"))
return 1 === a.length ? a[0] : function(c, d) {
for (var e, g = 0; g < a.length; g++) {
var f = a[g];
f && (e = f(c, d))
}
return e
}
},
filterChain: function() {
for (var a =
this.expression(), c; ;)
if (c = this.expect("|"))
a = this.binaryFn(a, c.fn, this.filter());
else
return a
},
filter: function() {
for (var a = this.expect(), c = this.$filter(a.text), d = []; ;)
if (a = this.expect(":"))
d.push(this.expression());
else {
var e = function(a, e, h) {
h = [h];
for (var l = 0; l < d.length; l++)
h.push(d[l](a, e));
return c.apply(a, h)
};
return function() {
return e
}
}
},
expression: function() {
return this.assignment()
},
assignment: function() {
var a = this.ternary(), c, d;
return (d = this.expect("=")) ? (a.assign || this.throwError("implies assignment but [" +
this.text.substring(0, d.index) + "] can not be assigned to", d), c = this.ternary(), function(d, g) {
return a.assign(d, c(d, g), g)
}) : a
},
ternary: function() {
var a = this.logicalOR(), c, d;
if (this.expect("?")) {
c = this.ternary();
if (d = this.expect(":"))
return this.ternaryFn(a, c, this.ternary());
this.throwError("expected :", d)
} else
return a
},
logicalOR: function() {
for (var a = this.logicalAND(), c; ;)
if (c = this.expect("||"))
a = this.binaryFn(a, c.fn, this.logicalAND());
else
return a
},
logicalAND: function() {
var a = this.equality(), c;
if (c =
this.expect("&&"))
a = this.binaryFn(a, c.fn, this.logicalAND());
return a
},
equality: function() {
var a = this.relational(), c;
if (c = this.expect("==", "!=", "===", "!=="))
a = this.binaryFn(a, c.fn, this.equality());
return a
},
relational: function() {
var a = this.additive(), c;
if (c = this.expect("<", ">", "<=", ">="))
a = this.binaryFn(a, c.fn, this.relational());
return a
},
additive: function() {
for (var a = this.multiplicative(), c; c = this.expect("+", "-");)
a = this.binaryFn(a, c.fn, this.multiplicative());
return a
},
multiplicative: function() {
for (var a =
this.unary(), c; c = this.expect("*", "/", "%");)
a = this.binaryFn(a, c.fn, this.unary());
return a
},
unary: function() {
var a;
return this.expect("+") ? this.primary() : (a = this.expect("-")) ? this.binaryFn(Ya.ZERO, a.fn, this.unary()) : (a = this.expect("!")) ? this.unaryFn(a.fn, this.unary()) : this.primary()
},
fieldAccess: function(a) {
var c = this, d = this.expect().text, e = vc(d, this.options, this.text);
return w(function(c, d, h) {
return e(h || a(c, d), d)
}, {
assign: function(e, f, h) {
return ib(a(e, h), d, f, c.text, c.options)
}
})
},
objectIndex: function(a) {
var c =
this, d = this.expression();
this.consume("]");
return w(function(e, g) {
var f = a(e, g), h = d(e, g), l;
if (!f)
return r;
(f = Xa(f[h], c.text)) && (f.then && c.options.unwrapPromises) && (l = f, "$$v"in f || (l.$$v = r, l.then(function(a) {
l.$$v = a
})), f = f.$$v);
return f
}, {
assign: function(e, g, f) {
var h = d(e, f);
return Xa(a(e, f), c.text)[h] = g
}
})
},
functionCall: function(a, c) {
var d = [];
if (")" !== this.peekToken().text) {
do
d.push(this.expression());
while (this.expect(","))
}
this.consume(")");
var e = this;
return function(g, f) {
for (var h = [], l = c ? c(g, f) :
g, k = 0; k < d.length; k++)
h.push(d[k](g, f));
k = a(g, f, l) || s;
Xa(l, e.text);
Xa(k, e.text);
h = k.apply ? k.apply(l, h) : k(h[0], h[1], h[2], h[3], h[4]);
return Xa(h, e.text)
}
}, arrayDeclaration: function() {
var a = [], c=!0;
if ("]" !== this.peekToken().text) {
do {
var d = this.expression();
a.push(d);
d.constant || (c=!1)
}
while (this.expect(","))
}
this.consume("]");
return w(function(c, d) {
for (var f = [], h = 0; h < a.length; h++)
f.push(a[h](c, d));
return f
}, {
literal: !0,
constant: c
})
}, object: function() {
var a = [], c=!0;
if ("}" !== this.peekToken().text) {
do {
var d =
this.expect(), d = d.string || d.text;
this.consume(":");
var e = this.expression();
a.push({
key: d,
value: e
});
e.constant || (c=!1)
}
while (this.expect(","))
}
this.consume("}");
return w(function(c, d) {
for (var e = {}, l = 0; l < a.length; l++) {
var k = a[l];
e[k.key] = k.value(c, d)
}
return e
}, {
literal: !0,
constant: c
})
}
};
var Jb = {}, ra = G("$sce"), fa = {
HTML: "html",
CSS: "css",
URL: "url",
RESOURCE_URL: "resourceUrl",
JS: "js"
}, T = N.createElement("a"), yc = ya(W.location.href, !0);
zc.$inject = ["$provide"];
Ac.$inject = ["$locale"];
Cc.$inject = ["$locale"];
var Fc =
".", Od = {
yyyy: V("FullYear", 4),
yy: V("FullYear", 2, 0, !0),
y: V("FullYear", 1),
MMMM: jb("Month"),
MMM: jb("Month", !0),
MM: V("Month", 2, 1),
M: V("Month", 1, 1),
dd: V("Date", 2),
d: V("Date", 1),
HH: V("Hours", 2),
H: V("Hours", 1),
hh: V("Hours", 2, - 12),
h: V("Hours", 1, - 12),
mm: V("Minutes", 2),
m: V("Minutes", 1),
ss: V("Seconds", 2),
s: V("Seconds", 1),
sss: V("Milliseconds", 3),
EEEE: jb("Day"),
EEE: jb("Day", !0),
a: function(a, c) {
return 12 > a.getHours() ? c.AMPMS[0] : c.AMPMS[1]
},
Z: function(a) {
a =- 1 * a.getTimezoneOffset();
return a = (0 <= a ? "+" : "") + (Lb(Math[0 <
a ? "floor": "ceil"](a / 60), 2) + Lb(Math.abs(a%60), 2))
}
}, Nd = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, Md = /^\-?\d+$/;
Bc.$inject = ["$locale"];
var Kd = ca(v), Ld = ca(Ia);
Dc.$inject = ["$parse"];
var Vd = ca({
restrict: "E",
compile: function(a, c) {
8 >= E && (c.href || c.name || c.$set("href", ""), a.append(N.createComment("IE fix")));
if (!c.href&&!c.name)
return function(a, c) {
c.on("click", function(a) {
c.attr("href") || a.preventDefault()
})
}
}
}), Nb = {};
q(fb, function(a, c) {
if ("multiple" != a) {
var d = ma("ng-" +
c);
Nb[d] = function() {
return {
priority: 100,
compile: function() {
return function(a, g, f) {
a.$watch(f[d], function(a) {
f.$set(c, !!a)
})
}
}
}
}
}
});
q(["src", "srcset", "href"], function(a) {
var c = ma("ng-" + a);
Nb[c] = function() {
return {
priority: 99,
link: function(d, e, g) {
g.$observe(c, function(c) {
c && (g.$set(a, c), E && e.prop(a, g[a]))
})
}
}
}
});
var mb = {
$addControl: s,
$removeControl: s,
$setValidity: s,
$setDirty: s,
$setPristine: s
};
Gc.$inject = ["$element", "$attrs", "$scope"];
var Ic = function(a) {
return ["$timeout", function(c) {
return {
name: "form",
restrict: a ? "EAC": "E",
controller: Gc,
compile: function() {
return {
pre: function(a, e, g, f) {
if (!g.action) {
var h = function(a) {
a.preventDefault ? a.preventDefault() : a.returnValue=!1
};
Hc(e[0], "submit", h);
e.on("$destroy", function() {
c(function() {
Ab(e[0], "submit", h)
}, 0, !1)
})
}
var l = e.parent().controller("form"), k = g.name || g.ngForm;
k && ib(a, k, f, k);
if (l)
e.on("$destroy", function() {
l.$removeControl(f);
k && ib(a, k, r, k);
w(f, mb)
})
}
}
}
}
}
]
}, Wd = Ic(), Xd = Ic(!0), Yd = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,
Zd = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/, $d = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/, Jc = {
text: ob,
number: function(a, c, d, e, g, f) {
ob(a, c, d, e, g, f);
e.$parsers.push(function(a) {
var c = e.$isEmpty(a);
if (c || $d.test(a))
return e.$setValidity("number", !0), "" === a ? null : c ? a : parseFloat(a);
e.$setValidity("number", !1);
return r
});
e.$formatters.push(function(a) {
return e.$isEmpty(a) ? "" : "" + a
});
d.min && (a = function(a) {
var c = parseFloat(d.min);
if (!e.$isEmpty(a) && a < c)
return e.$setValidity("min", !1), r;
e.$setValidity("min",
!0);
return a
}, e.$parsers.push(a), e.$formatters.push(a));
d.max && (a = function(a) {
var c = parseFloat(d.max);
if (!e.$isEmpty(a) && a > c)
return e.$setValidity("max", !1), r;
e.$setValidity("max", !0);
return a
}, e.$parsers.push(a), e.$formatters.push(a));
e.$formatters.push(function(a) {
if (e.$isEmpty(a) || qb(a))
return e.$setValidity("number", !0), a;
e.$setValidity("number", !1);
return r
})
},
url: function(a, c, d, e, g, f) {
ob(a, c, d, e, g, f);
a = function(a) {
if (e.$isEmpty(a) || Yd.test(a))
return e.$setValidity("url", !0), a;
e.$setValidity("url",
!1);
return r
};
e.$formatters.push(a);
e.$parsers.push(a)
},
email: function(a, c, d, e, g, f) {
ob(a, c, d, e, g, f);
a = function(a) {
if (e.$isEmpty(a) || Zd.test(a))
return e.$setValidity("email", !0), a;
e.$setValidity("email", !1);
return r
};
e.$formatters.push(a);
e.$parsers.push(a)
},
radio: function(a, c, d, e) {
H(d.name) && c.attr("name", Za());
c.on("click", function() {
c[0].checked && a.$apply(function() {
e.$setViewValue(d.value)
})
});
e.$render = function() {
c[0].checked = d.value == e.$viewValue
};
d.$observe("value", e.$render)
},
checkbox: function(a,
c, d, e) {
var g = d.ngTrueValue, f = d.ngFalseValue;
D(g) || (g=!0);
D(f) || (f=!1);
c.on("click", function() {
a.$apply(function() {
e.$setViewValue(c[0].checked)
})
});
e.$render = function() {
c[0].checked = e.$viewValue
};
e.$isEmpty = function(a) {
return a !== g
};
e.$formatters.push(function(a) {
return a === g
});
e.$parsers.push(function(a) {
return a ? g : f
})
},
hidden: s,
button: s,
submit: s,
reset: s
}, Kc = ["$browser", "$sniffer", function(a, c) {
return {
restrict: "E",
require: "?ngModel",
link: function(d, e, g, f) {
f && (Jc[v(g.type)] || Jc.text)(d, e, g, f, c, a)
}
}
}
],
lb = "ng-valid", kb = "ng-invalid", Ja = "ng-pristine", nb = "ng-dirty", ae = ["$scope", "$exceptionHandler", "$attrs", "$element", "$parse", function(a, c, d, e, g) {
function f(a, c) {
c = c ? "-" + cb(c, "-") : "";
e.removeClass((a ? kb : lb) + c).addClass((a ? lb : kb) + c)
}
this.$modelValue = this.$viewValue = Number.NaN;
this.$parsers = [];
this.$formatters = [];
this.$viewChangeListeners = [];
this.$pristine=!0;
this.$dirty=!1;
this.$valid=!0;
this.$invalid=!1;
this.$name = d.name;
var h = g(d.ngModel), l = h.assign;
if (!l)
throw G("ngModel")("nonassign", d.ngModel, ha(e));
this.$render = s;
this.$isEmpty = function(a) {
return H(a) || "" === a || null === a || a !== a
};
var k = e.inheritedData("$formController") || mb, m = 0, n = this.$error = {};
e.addClass(Ja);
f(!0);
this.$setValidity = function(a, c) {
n[a]!==!c && (c ? (n[a] && m--, m || (f(!0), this.$valid=!0, this.$invalid=!1)) : (f(!1), this.$invalid=!0, this.$valid=!1, m++), n[a]=!c, f(c, a), k.$setValidity(a, c, this))
};
this.$setPristine = function() {
this.$dirty=!1;
this.$pristine=!0;
e.removeClass(nb).addClass(Ja)
};
this.$setViewValue = function(d) {
this.$viewValue = d;
this.$pristine &&
(this.$dirty=!0, this.$pristine=!1, e.removeClass(Ja).addClass(nb), k.$setDirty());
q(this.$parsers, function(a) {
d = a(d)
});
this.$modelValue !== d && (this.$modelValue = d, l(a, d), q(this.$viewChangeListeners, function(a) {
try {
a()
} catch (d) {
c(d)
}
}))
};
var p = this;
a.$watch(function() {
var c = h(a);
if (p.$modelValue !== c) {
var d = p.$formatters, e = d.length;
for (p.$modelValue = c; e--;)
c = d[e](c);
p.$viewValue !== c && (p.$viewValue = c, p.$render())
}
return c
})
}
], be = function() {
return {
require: ["ngModel", "^?form"],
controller: ae,
link: function(a,
c, d, e) {
var g = e[0], f = e[1] || mb;
f.$addControl(g);
a.$on("$destroy", function() {
f.$removeControl(g)
})
}
}
}, ce = ca({
require: "ngModel",
link: function(a, c, d, e) {
e.$viewChangeListeners.push(function() {
a.$eval(d.ngChange)
})
}
}), Lc = function() {
return {
require: "?ngModel",
link: function(a, c, d, e) {
if (e) {
d.required=!0;
var g = function(a) {
if (d.required && e.$isEmpty(a))
e.$setValidity("required", !1);
else
return e.$setValidity("required", !0), a
};
e.$formatters.push(g);
e.$parsers.unshift(g);
d.$observe("required", function() {
g(e.$viewValue)
})
}
}
}
},
de = function() {
return {
require: "ngModel",
link: function(a, c, d, e) {
var g = (a = /\/(.*)\//.exec(d.ngList)) && RegExp(a[1]) || d.ngList || ",";
e.$parsers.push(function(a) {
if (!H(a)) {
var c = [];
a && q(a.split(g), function(a) {
a && c.push(aa(a))
});
return c
}
});
e.$formatters.push(function(a) {
return L(a) ? a.join(", ") : r
});
e.$isEmpty = function(a) {
return !a ||!a.length
}
}
}
}, ee = /^(true|false|\d+)$/, fe = function() {
return {
priority: 100,
compile: function(a, c) {
return ee.test(c.ngValue) ? function(a, c, g) {
g.$set("value", a.$eval(g.ngValue))
} : function(a,
c, g) {
a.$watch(g.ngValue, function(a) {
g.$set("value", a)
})
}
}
}
}, ge = sa(function(a, c, d) {
c.addClass("ng-binding").data("$binding", d.ngBind);
a.$watch(d.ngBind, function(a) {
c.text(a == r ? "" : a)
})
}), he = ["$interpolate", function(a) {
return function(c, d, e) {
c = a(d.attr(e.$attr.ngBindTemplate));
d.addClass("ng-binding").data("$binding", c);
e.$observe("ngBindTemplate", function(a) {
d.text(a)
})
}
}
], ie = ["$sce", "$parse", function(a, c) {
return function(d, e, g) {
e.addClass("ng-binding").data("$binding", g.ngBindHtml);
var f = c(g.ngBindHtml);
d.$watch(function() {
return (f(d) || "").toString()
}, function(c) {
e.html(a.getTrustedHtml(f(d)) || "")
})
}
}
], je = Mb("", !0), ke = Mb("Odd", 0), le = Mb("Even", 1), me = sa({
compile: function(a, c) {
c.$set("ngCloak", r);
a.removeClass("ng-cloak")
}
}), ne = [function() {
return {
scope: !0,
controller: "@",
priority: 500
}
}
], Mc = {};
q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "), function(a) {
var c = ma("ng-" + a);
Mc[c] = ["$parse", function(d) {
return {
compile: function(e,
g) {
var f = d(g[c]);
return function(c, d, e) {
d.on(v(a), function(a) {
c.$apply(function() {
f(c, {
$event: a
})
})
})
}
}
}
}
]
});
var oe = ["$animate", function(a) {
return {
transclude: "element",
priority: 600,
terminal: !0,
restrict: "A",
$$tlb: !0,
link: function(c, d, e, g, f) {
var h, l;
c.$watch(e.ngIf, function(g) {
Oa(g) ? l || (l = c.$new(), f(l, function(c) {
c[c.length++] = N.createComment(" end ngIf: " + e.ngIf + " ");
h = {
clone: c
};
a.enter(c, d.parent(), d)
})) : (l && (l.$destroy(), l = null), h && (a.leave(vb(h.clone)), h = null))
})
}
}
}
], pe = ["$http", "$templateCache",
"$anchorScroll", "$animate", "$sce", function(a, c, d, e, g) {
return {
restrict: "ECA",
priority: 400,
terminal: !0,
transclude: "element",
controller: Pa.noop,
compile: function(f, h) {
var l = h.ngInclude || h.src, k = h.onload || "", m = h.autoscroll;
return function(f, h, q, r, B) {
var s = 0, u, v, x = function() {
u && (u.$destroy(), u = null);
v && (e.leave(v), v = null)
};
f.$watch(g.parseAsResourceUrl(l), function(g) {
var l = function() {
!z(m) || m&&!f.$eval(m) || d()
}, q=++s;
g ? (a.get(g, {
cache: c
}).success(function(a) {
if (q === s) {
var c = f.$new();
r.template = a;
a = B(c,
function(a) {
x();
e.enter(a, null, h, l)
});
u = c;
v = a;
u.$emit("$includeContentLoaded");
f.$eval(k)
}
}).error(function() {
q === s && x()
}), f.$emit("$includeContentRequested")) : (x(), r.template = null)
})
}
}
}
}
], qe = ["$compile", function(a) {
return {
restrict: "ECA",
priority: - 400,
require: "ngInclude",
link: function(c, d, e, g) {
d.html(g.template);
a(d.contents())(c)
}
}
}
], re = sa({
priority: 450,
compile: function() {
return {
pre: function(a, c, d) {
a.$eval(d.ngInit)
}
}
}
}), se = sa({
terminal: !0,
priority: 1E3
}), te = ["$locale", "$interpolate", function(a, c) {
var d =
/{}/g;
return {
restrict: "EA",
link: function(e, g, f) {
var h = f.count, l = f.$attr.when && g.attr(f.$attr.when), k = f.offset || 0, m = e.$eval(l) || {}, n = {}, p = c.startSymbol(), t = c.endSymbol(), r = /^when(Minus)?(.+)$/;
q(f, function(a, c) {
r.test(c) && (m[v(c.replace("when", "").replace("Minus", "-"))] = g.attr(f.$attr[c]))
});
q(m, function(a, e) {
n[e] = c(a.replace(d, p + h + "-" + k + t))
});
e.$watch(function() {
var c = parseFloat(e.$eval(h));
if (isNaN(c))
return "";
c in m || (c = a.pluralCat(c - k));
return n[c](e, g, !0)
}, function(a) {
g.text(a)
})
}
}
}
], ue = ["$parse",
"$animate", function(a, c) {
var d = G("ngRepeat");
return {
transclude: "element",
priority: 1E3,
terminal: !0,
$$tlb: !0,
link: function(e, g, f, h, l) {
var k = f.ngRepeat, m = k.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), n, p, t, r, s, v, u = {
$id: Ea
};
if (!m)
throw d("iexp", k);
f = m[1];
h = m[2];
(m = m[4]) ? (n = a(m), p = function(a, c, d) {
v && (u[v] = a);
u[s] = c;
u.$index = d;
return n(e, u)
}) : (t = function(a, c) {
return Ea(c)
}, r = function(a) {
return a
});
m = f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
if (!m)
throw d("iidexp", f);
s = m[3] ||
m[1];
v = m[2];
var z = {};
e.$watchCollection(h, function(a) {
var f, h, m = g[0], n, u = {}, H, O, M, S, D, w, G = [];
if (pb(a))
D = a, n = p || t;
else {
n = p || r;
D = [];
for (M in a)
a.hasOwnProperty(M) && "$" != M.charAt(0) && D.push(M);
D.sort()
}
H = D.length;
h = G.length = D.length;
for (f = 0; f < h; f++)
if (M = a === D ? f : D[f], S = a[M], S = n(M, S, f), wa(S, "`track by` id"), z.hasOwnProperty(S))
w = z[S], delete z[S], u[S] = w, G[f] = w;
else {
if (u.hasOwnProperty(S))
throw q(G, function(a) {
a && a.scope && (z[a.id] = a)
}), d("dupes", k, S);
G[f] = {
id: S
};
u[S]=!1
}
for (M in z)
z.hasOwnProperty(M) && (w =
z[M], f = vb(w.clone), c.leave(f), q(f, function(a) {
a.$$NG_REMOVED=!0
}), w.scope.$destroy());
f = 0;
for (h = D.length; f < h; f++) {
M = a === D ? f : D[f];
S = a[M];
w = G[f];
G[f - 1] && (m = G[f - 1].clone[G[f - 1].clone.length - 1]);
if (w.scope) {
O = w.scope;
n = m;
do
n = n.nextSibling;
while (n && n.$$NG_REMOVED);
w.clone[0] != n && c.move(vb(w.clone), null, x(m));
m = w.clone[w.clone.length - 1]
} else
O = e.$new();
O[s] = S;
v && (O[v] = M);
O.$index = f;
O.$first = 0 === f;
O.$last = f === H - 1;
O.$middle=!(O.$first || O.$last);
O.$odd=!(O.$even = 0 === (f & 1));
w.scope || l(O, function(a) {
a[a.length++] =
N.createComment(" end ngRepeat: " + k + " ");
c.enter(a, null, x(m));
m = a;
w.scope = O;
w.clone = a;
u[w.id] = w
})
}
z = u
})
}
}
}
], ve = ["$animate", function(a) {
return function(c, d, e) {
c.$watch(e.ngShow, function(c) {
a[Oa(c) ? "removeClass": "addClass"](d, "ng-hide")
})
}
}
], we = ["$animate", function(a) {
return function(c, d, e) {
c.$watch(e.ngHide, function(c) {
a[Oa(c) ? "addClass": "removeClass"](d, "ng-hide")
})
}
}
], xe = sa(function(a, c, d) {
a.$watch(d.ngStyle, function(a, d) {
d && a !== d && q(d, function(a, d) {
c.css(d, "")
});
a && c.css(a)
}, !0)
}), ye = ["$animate",
function(a) {
return {
restrict: "EA",
require: "ngSwitch",
controller: ["$scope", function() {
this.cases = {}
}
],
link: function(c, d, e, g) {
var f, h, l = [];
c.$watch(e.ngSwitch || e.on, function(d) {
for (var m = 0, n = l.length; m < n; m++)
l[m].$destroy(), a.leave(h[m]);
h = [];
l = [];
if (f = g.cases["!" + d] || g.cases["?"])
c.$eval(e.change), q(f, function(d) {
var e = c.$new();
l.push(e);
d.transclude(e, function(c) {
var e = d.element;
h.push(c);
a.enter(c, e.parent(), e)
})
})
})
}
}
}
], ze = sa({
transclude: "element",
priority: 800,
require: "^ngSwitch",
compile: function(a,
c) {
return function(a, e, g, f, h) {
f.cases["!" + c.ngSwitchWhen] = f.cases["!" + c.ngSwitchWhen] || [];
f.cases["!" + c.ngSwitchWhen].push({
transclude: h,
element: e
})
}
}
}), Ae = sa({
transclude: "element",
priority: 800,
require: "^ngSwitch",
link: function(a, c, d, e, g) {
e.cases["?"] = e.cases["?"] || [];
e.cases["?"].push({
transclude: g,
element: c
})
}
}), Be = sa({
controller: ["$element", "$transclude", function(a, c) {
if (!c)
throw G("ngTransclude")("orphan", ha(a));
this.$transclude = c
}
],
link: function(a, c, d, e) {
e.$transclude(function(a) {
c.empty();
c.append(a)
})
}
}),
Ce = ["$templateCache", function(a) {
return {
restrict: "E",
terminal: !0,
compile: function(c, d) {
"text/ng-template" == d.type && a.put(d.id, c[0].text)
}
}
}
], De = G("ngOptions"), Ee = ca({
terminal: !0
}), Fe = ["$compile", "$parse", function(a, c) {
var d = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/, e = {
$setViewValue: s
};
return {
restrict: "E",
require: ["select", "?ngModel"],
controller: ["$element", "$scope",
"$attrs", function(a, c, d) {
var l = this, k = {}, m = e, n;
l.databound = d.ngModel;
l.init = function(a, c, d) {
m = a;
n = d
};
l.addOption = function(c) {
wa(c, '"option value"');
k[c]=!0;
m.$viewValue == c && (a.val(c), n.parent() && n.remove())
};
l.removeOption = function(a) {
this.hasOption(a) && (delete k[a], m.$viewValue == a && this.renderUnknownOption(a))
};
l.renderUnknownOption = function(c) {
c = "? " + Ea(c) + " ?";
n.val(c);
a.prepend(n);
a.val(c);
n.prop("selected", !0)
};
l.hasOption = function(a) {
return k.hasOwnProperty(a)
};
c.$on("$destroy", function() {
l.renderUnknownOption =
s
})
}
],
link: function(e, f, h, l) {
function k(a, c, d, e) {
d.$render = function() {
var a = d.$viewValue;
e.hasOption(a) ? (y.parent() && y.remove(), c.val(a), "" === a && u.prop("selected", !0)) : H(a) && u ? c.val("") : e.renderUnknownOption(a)
};
c.on("change", function() {
a.$apply(function() {
y.parent() && y.remove();
d.$setViewValue(c.val())
})
})
}
function m(a, c, d) {
var e;
d.$render = function() {
var a = new Ta(d.$viewValue);
q(c.find("option"), function(c) {
c.selected = z(a.get(c.value))
})
};
a.$watch(function() {
ta(e, d.$viewValue) || (e = ga(d.$viewValue),
d.$render())
});
c.on("change", function() {
a.$apply(function() {
var a = [];
q(c.find("option"), function(c) {
c.selected && a.push(c.value)
});
d.$setViewValue(a)
})
})
}
function n(e, f, g) {
function h() {
var a = {
"": []
}, c = [""], d, k, r, s, x;
s = g.$modelValue;
x = t(e) || [];
var B = n ? Ob(x): x, H, A, J;
A = {};
r=!1;
var E, I;
if (v)
if (u && L(s))
for (r = new Ta([]), J = 0; J < s.length; J++)
A[m] = s[J], r.put(u(e, A), s[J]);
else
r = new Ta(s);
for (J = 0; H = B.length, J < H; J++) {
k = J;
if (n) {
k = B[J];
if ("$" === k.charAt(0))
continue;
A[n] = k
}
A[m] = x[k];
d = p(e, A) || "";
(k = a[d]) || (k = a[d] =
[], c.push(d));
v ? d = z(r.remove(u ? u(e, A) : q(e, A))) : (u ? (d = {}, d[m] = s, d = u(e, d) === u(e, A)) : d = s === q(e, A), r = r || d);
E = l(e, A);
E = z(E) ? E : "";
k.push({
id: u ? u(e, A): n ? B[J]: J,
label: E,
selected: d
})
}
v || (w || null === s ? a[""].unshift({
id: "",
label: "",
selected: !r
}) : r || a[""].unshift({
id: "?",
label: "",
selected: !0
}));
A = 0;
for (B = c.length; A < B; A++) {
d = c[A];
k = a[d];
y.length <= A ? (s = {
element: G.clone().attr("label", d),
label: k.label
}, x = [s], y.push(x), f.append(s.element)) : (x = y[A], s = x[0], s.label != d && s.element.attr("label", s.label = d));
E = null;
J = 0;
for (H =
k.length; J < H; J++)
r = k[J], (d = x[J + 1]) ? (E = d.element, d.label !== r.label && E.text(d.label = r.label), d.id !== r.id && E.val(d.id = r.id), E[0].selected !== r.selected && E.prop("selected", d.selected = r.selected)) : ("" === r.id && w ? I = w : (I = D.clone()).val(r.id).attr("selected", r.selected).text(r.label), x.push({
element: I,
label: r.label,
id: r.id,
selected: r.selected
}), E ? E.after(I) : s.element.append(I), E = I);
for (J++; x.length > J;)
x.pop().element.remove()
}
for (; y.length > A;)
y.pop()[0].element.remove()
}
var k;
if (!(k = s.match(d)))
throw De("iexp",
s, ha(f));
var l = c(k[2] || k[1]), m = k[4] || k[6], n = k[5], p = c(k[3] || ""), q = c(k[2] ? k[1] : m), t = c(k[7]), u = k[8] ? c(k[8]): null, y = [[{
element: f,
label: ""
}
]];
w && (a(w)(e), w.removeClass("ng-scope"), w.remove());
f.empty();
f.on("change", function() {
e.$apply(function() {
var a, c = t(e) || [], d = {}, h, k, l, p, s, x, w;
if (v)
for (k = [], p = 0, x = y.length; p < x; p++)
for (a = y[p], l = 1, s = a.length; l < s; l++) {
if ((h = a[l].element)[0].selected) {
h = h.val();
n && (d[n] = h);
if (u)
for (w = 0; w < c.length && (d[m] = c[w], u(e, d) != h); w++);
else
d[m] = c[h];
k.push(q(e, d))
}
} else if (h = f.val(),
"?" == h)
k = r;
else if ("" === h)
k = null;
else if (u)
for (w = 0; w < c.length; w++) {
if (d[m] = c[w], u(e, d) == h) {
k = q(e, d);
break
}
} else
d[m] = c[h], n && (d[n] = h), k = q(e, d);
g.$setViewValue(k)
})
});
g.$render = h;
e.$watch(h)
}
if (l[1]) {
var p = l[0], t = l[1], v = h.multiple, s = h.ngOptions, w=!1, u, D = x(N.createElement("option")), G = x(N.createElement("optgroup")), y = D.clone();
l = 0;
for (var A = f.children(), I = A.length; l < I; l++)
if ("" === A[l].value) {
u = w = A.eq(l);
break
}
p.init(t, w, y);
if (v && (h.required || h.ngRequired)) {
var E = function(a) {
t.$setValidity("required",
!h.required || a && a.length);
return a
};
t.$parsers.push(E);
t.$formatters.unshift(E);
h.$observe("required", function() {
E(t.$viewValue)
})
}
s ? n(e, f, t) : v ? m(e, f, t) : k(e, f, t, p)
}
}
}
}
], Ge = ["$interpolate", function(a) {
var c = {
addOption: s,
removeOption: s
};
return {
restrict: "E",
priority: 100,
compile: function(d, e) {
if (H(e.value)) {
var g = a(d.text(), !0);
g || e.$set("value", d.text())
}
return function(a, d, e) {
var k = d.parent(), m = k.data("$selectController") || k.parent().data("$selectController");
m && m.databound ? d.prop("selected", !1) : m =
c;
g ? a.$watch(g, function(a, c) {
e.$set("value", a);
a !== c && m.removeOption(c);
m.addOption(a)
}) : m.addOption(e.value);
d.on("$destroy", function() {
m.removeOption(e.value)
})
}
}
}
}
], He = ca({
restrict: "E",
terminal: !0
});
(Ca = W.jQuery) ? (x = Ca, w(Ca.fn, {
scope: Fa.scope,
isolateScope: Fa.isolateScope,
controller: Fa.controller,
injector: Fa.injector,
inheritedData: Fa.inheritedData
}), wb("remove", !0, !0, !1), wb("empty", !1, !1, !1), wb("html", !1, !1, !0)) : x = I;
Pa.element = x;
(function(a) {
w(a, {
bootstrap: Xb,
copy: ga,
extend: w,
equals: ta,
element: x,
forEach: q,
injector: Yb,
noop: s,
bind: rb,
toJson: oa,
fromJson: Tb,
identity: Ba,
isUndefined: H,
isDefined: z,
isString: D,
isFunction: A,
isObject: U,
isNumber: qb,
isElement: Oc,
isArray: L,
version: Qd,
isDate: La,
lowercase: v,
uppercase: Ia,
callbacks: {
counter: 0
},
$$minErr: G,
$$csp: Sb
});
Va = Uc(W);
try {
Va("ngLocale")
} catch (c) {
Va("ngLocale", []).provider("$locale", sd)
}
Va("ng", ["ngLocale"], ["$provide", function(a) {
a.provider({
$$sanitizeUri: Ad
});
a.provider("$compile", hc).directive({
a: Vd,
input: Kc,
textarea: Kc,
form: Wd,
script: Ce,
select: Fe,
style: He,
option: Ge,
ngBind: ge,
ngBindHtml: ie,
ngBindTemplate: he,
ngClass: je,
ngClassEven: le,
ngClassOdd: ke,
ngCloak: me,
ngController: ne,
ngForm: Xd,
ngHide: we,
ngIf: oe,
ngInclude: pe,
ngInit: re,
ngNonBindable: se,
ngPluralize: te,
ngRepeat: ue,
ngShow: ve,
ngStyle: xe,
ngSwitch: ye,
ngSwitchWhen: ze,
ngSwitchDefault: Ae,
ngOptions: Ee,
ngTransclude: Be,
ngModel: be,
ngList: de,
ngChange: ce,
required: Lc,
ngRequired: Lc,
ngValue: fe
}).directive({
ngInclude: qe
}).directive(Nb).directive(Mc);
a.provider({
$anchorScroll: cd,
$animate: Sd,
$browser: ed,
$cacheFactory: fd,
$controller: jd,
$document: kd,
$exceptionHandler: ld,
$filter: zc,
$interpolate: qd,
$interval: rd,
$http: md,
$httpBackend: nd,
$location: ud,
$log: vd,
$parse: wd,
$rootScope: zd,
$q: xd,
$sce: Dd,
$sceDelegate: Cd,
$sniffer: Ed,
$templateCache: gd,
$timeout: Fd,
$window: Gd
})
}
])
})(Pa);
x(N).ready(function() {
Sc(N, Xb)
})
})(window, document);
!angular.$$csp() && angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-start{border-spacing:1px 1px;-ms-zoom:1.0001;}.ng-animate-active{border-spacing:0px 0px;-ms-zoom:1;}</style>');
//# sourceMappingURL=angular.min.js.map
/*
AngularJS v1.2.5
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(h, e, A) {
'use strict';
function u(w, q, k) {
return {
restrict: "ECA",
terminal: !0,
priority: 400,
transclude: "element",
link: function(a, c, b, f, n) {
function y() {
l && (l.$destroy(), l = null);
g && (k.leave(g), g = null)
}
function v() {
var b = w.current && w.current.locals;
if (b && b.$template) {
var b = a.$new(), f = w.current;
g = n(b, function(d) {
k.enter(d, null, g || c, function() {
!e.isDefined(t) || t&&!a.$eval(t) || q()
});
y()
});
l = f.scope = b;
l.$emit("$viewContentLoaded");
l.$eval(h)
} else
y()
}
var l, g, t = b.autoscroll, h = b.onload || "";
a.$on("$routeChangeSuccess",
v);
v()
}
}
}
function z(e, h, k) {
return {
restrict: "ECA",
priority: - 400,
link: function(a, c) {
var b = k.current, f = b.locals;
c.html(f.$template);
var n = e(c.contents());
b.controller && (f.$scope = a, f = h(b.controller, f), b.controllerAs && (a[b.controllerAs] = f), c.data("$ngControllerController", f), c.children().data("$ngControllerController", f));
n(a)
}
}
}
h = e.module("ngRoute", ["ng"]).provider("$route", function() {
function h(a, c) {
return e.extend(new (e.extend(function() {}, {
prototype: a
})), c)
}
function q(a, e) {
var b = e.caseInsensitiveMatch,
f = {
originalPath: a,
regexp: a
}, h = f.keys = [];
a = a.replace(/([().])/g, "\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g, function(a, e, b, c) {
a = "?" === c ? c : null;
c = "*" === c ? c : null;
h.push({
name: b,
optional: !!a
});
e = e || "";
return "" + (a ? "" : e) + "(?:" + (a ? e : "") + (c && "(.+?)" || "([^/]+)") + (a || "") + ")" + (a || "")
}).replace(/([\/$\*])/g, "\\$1");
f.regexp = RegExp("^" + a + "$", b ? "i" : "");
return f
}
var k = {};
this.when = function(a, c) {
k[a] = e.extend({
reloadOnSearch: !0
}, c, a && q(a, c));
if (a) {
var b = "/" == a[a.length - 1] ? a.substr(0, a.length - 1): a + "/";
k[b] = e.extend({
redirectTo: a
},
q(b, c))
}
return this
};
this.otherwise = function(a) {
this.when(null, a);
return this
};
this.$get = ["$rootScope", "$location", "$routeParams", "$q", "$injector", "$http", "$templateCache", "$sce", function(a, c, b, f, n, q, v, l) {
function g() {
var d = t(), m = r.current;
if (d && m && d.$$route === m.$$route && e.equals(d.pathParams, m.pathParams)&&!d.reloadOnSearch&&!x)
m.params = d.params, e.copy(m.params, b), a.$broadcast("$routeUpdate", m);
else if (d || m)
x=!1, a.$broadcast("$routeChangeStart", d, m), (r.current = d) && d.redirectTo && (e.isString(d.redirectTo) ?
c.path(u(d.redirectTo, d.params)).search(d.params).replace() : c.url(d.redirectTo(d.pathParams, c.path(), c.search())).replace()), f.when(d).then(function() {
if (d) {
var a = e.extend({}, d.resolve), c, b;
e.forEach(a, function(d, c) {
a[c] = e.isString(d) ? n.get(d) : n.invoke(d)
});
e.isDefined(c = d.template) ? e.isFunction(c) && (c = c(d.params)) : e.isDefined(b = d.templateUrl) && (e.isFunction(b) && (b = b(d.params)), b = l.getTrustedResourceUrl(b), e.isDefined(b) && (d.loadedTemplateUrl = b, c = q.get(b, {
cache: v
}).then(function(a) {
return a.data
})));
e.isDefined(c) && (a.$template = c);
return f.all(a)
}
}).then(function(c) {
d == r.current && (d && (d.locals = c, e.copy(d.params, b)), a.$broadcast("$routeChangeSuccess", d, m))
}, function(c) {
d == r.current && a.$broadcast("$routeChangeError", d, m, c)
})
}
function t() {
var a, b;
e.forEach(k, function(f, k) {
var p;
if (p=!b) {
var s = c.path();
p = f.keys;
var l = {};
if (f.regexp)
if (s = f.regexp.exec(s)) {
for (var g = 1, q = s.length; g < q; ++g) {
var n = p[g - 1], r = "string" == typeof s[g] ? decodeURIComponent(s[g]): s[g];
n && r && (l[n.name] = r)
}
p = l
} else
p = null;
else
p = null;
p = a = p
}
p && (b = h(f, {
params: e.extend({}, c.search(), a),
pathParams: a
}), b.$$route = f)
});
return b || k[null] && h(k[null], {
params: {},
pathParams: {}
})
}
function u(a, c) {
var b = [];
e.forEach((a || "").split(":"), function(a, d) {
if (0 === d)
b.push(a);
else {
var e = a.match(/(\w+)(.*)/), f = e[1];
b.push(c[f]);
b.push(e[2] || "");
delete c[f]
}
});
return b.join("")
}
var x=!1, r = {
routes: k,
reload: function() {
x=!0;
a.$evalAsync(g)
}
};
a.$on("$locationChangeSuccess", g);
return r
}
]
});
h.provider("$routeParams", function() {
this.$get = function() {
return {}
}
});
h.directive("ngView", u);
h.directive("ngView", z);
u.$inject = ["$route", "$anchorScroll", "$animate"];
z.$inject = ["$compile", "$controller", "$route"]
})(window, window.angular);
//# sourceMappingURL=angular-route.min.js.map
/*
AngularJS v1.2.5
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(C, k, F) {
'use strict';
k.module("ngAnimate", ["ng"]).config(["$provide", "$animateProvider", function(M, G) {
function l(l) {
for (var h = 0; h < l.length; h++) {
var m = l[h];
if (m.nodeType == T)
return m
}
}
var s = k.noop, m = k.forEach, N = G.$$selectors, T = 1, h = "$$ngAnimateState", J = "ng-animate", g = {
running: !0
};
M.decorator("$animate", ["$delegate", "$injector", "$sniffer", "$rootElement", "$timeout", "$rootScope", "$document", function(H, C, I, n, t, q, F) {
function O(a) {
if (a) {
var c = [], e = {};
a = a.substr(1).split(".");
(I.transitions || I.animations) &&
a.push("");
for (var f = 0; f < a.length; f++) {
var b = a[f], l = N[b];
l&&!e[b] && (c.push(C.get(l)), e[b]=!0)
}
return c
}
}
function p(a, c, e, f, b, g, q) {
function x(a) {
v();
if (!0 === a)
w();
else {
if (a = e.data(h))
a.done = w, e.data(h, a);
p(y, "after", w)
}
}
function p(f, b, l) {
var h = b + "End";
m(f, function(m, g) {
var d = function() {
a: {
var d = b + "Complete", a = f[g];
a[d]=!0;
(a[h] || s)();
for (a = 0; a < f.length; a++)
if (!f[a][d])
break a;
l()
}
};
"before" != b || "enter" != a && "move" != a ? m[b] ? m[h] = z ? m[b](e, c, d) : m[b](e, d) : d() : d()
})
}
function n() {
q && t(q, 0, !1)
}
function v() {
v.hasBeenRun ||
(v.hasBeenRun=!0, g())
}
function w() {
if (!w.hasBeenRun) {
w.hasBeenRun=!0;
var a = e.data(h);
a && (z ? A(e) : (a.closeAnimationTimeout = t(function() {
A(e)
}, 0, !1), e.data(h, a)));
n()
}
}
var u = l(e);
if (u) {
var u = u.className, k = (" " + (u + " " + c)).replace(/\s+/g, ".");
f || (f = b ? b.parent() : e.parent());
var k = O(k), z = "addClass" == a || "removeClass" == a;
b = e.data(h) || {};
if (K(e, f) || 0 === k.length)
v(), w();
else {
var y = [];
b.running && z && b.structural || m(k, function(b) {
if (!b.allowCancel || b.allowCancel(e, a, c)) {
var f = b[a];
"leave" == a ? (b = f, f = null) : b = b["before" +
a.charAt(0).toUpperCase() + a.substr(1)];
y.push({
before: b,
after: f
})
}
});
0 === y.length ? (v(), n()) : (f = " " + u + " ", b.running && (t.cancel(b.closeAnimationTimeout), A(e), L(b.animations), b.beforeComplete ? (b.done || s)(!0) : z&&!b.structural && (f = "removeClass" == b.event ? f.replace(b.className, "") : f + b.className + " ")), u = " " + c + " ", "addClass" == a && 0 <= f.indexOf(u) || "removeClass" == a&&-1 == f.indexOf(u) ? (v(), n()) : (e.addClass(J), e.data(h, {
running: !0,
event: a,
className: c,
structural: !z,
animations: y,
done: x
}), p(y, "before", x)))
}
} else
v(),
w()
}
function E(a) {
a = l(a);
m(a.querySelectorAll("." + J), function(a) {
a = k.element(a);
var e = a.data(h);
e && (L(e.animations), A(a))
})
}
function L(a) {
m(a, function(c) {
a.beforeComplete || (c.beforeEnd || s)(!0);
a.afterComplete || (c.afterEnd || s)(!0)
})
}
function A(a) {
l(a) == l(n) ? g.disabled || (g.running=!1, g.structural=!1) : (a.removeClass(J), a.removeData(h))
}
function K(a, c) {
if (g.disabled)
return !0;
if (l(a) == l(n))
return g.disabled || g.running;
do {
if (0 === c.length)
break;
var e = l(c) == l(n), f = e ? g: c.data(h), f = f && (!!f.disabled||!!f.running);
if (e || f)
return f;
if (e)
break
}
while (c = c.parent());
return !0
}
n.data(h, g);
q.$$postDigest(function() {
q.$$postDigest(function() {
g.running=!1
})
});
return {
enter: function(a, c, e, f) {
this.enabled(!1, a);
H.enter(a, c, e);
q.$$postDigest(function() {
p("enter", "ng-enter", a, c, e, s, f)
})
},
leave: function(a, c) {
E(a);
this.enabled(!1, a);
q.$$postDigest(function() {
p("leave", "ng-leave", a, null, null, function() {
H.leave(a)
}, c)
})
},
move: function(a, c, e, f) {
E(a);
this.enabled(!1, a);
H.move(a, c, e);
q.$$postDigest(function() {
p("move", "ng-move",
a, c, e, s, f)
})
},
addClass: function(a, c, e) {
p("addClass", c, a, null, null, function() {
H.addClass(a, c)
}, e)
},
removeClass: function(a, c, e) {
p("removeClass", c, a, null, null, function() {
H.removeClass(a, c)
}, e)
},
enabled: function(a, c) {
switch (arguments.length) {
case 2:
if (a)
A(c);
else {
var e = c.data(h) || {};
e.disabled=!0;
c.data(h, e)
}
break;
case 1:
g.disabled=!a;
break;
default:
a=!g.disabled
}
return !!a
}
}
}
]);
G.register("", ["$window", "$sniffer", "$timeout", function(h, g, I) {
function n(d) {
R.push(d);
I.cancel(S);
S = I(function() {
m(R, function(d) {
d()
});
R = [];
S = null;
D = {}
}, 10, !1)
}
function t(d, a) {
var b = a ? D[a]: null;
if (!b) {
var e = 0, c = 0, f = 0, l = 0, g, k, n, p;
m(d, function(d) {
if (d.nodeType == T) {
d = h.getComputedStyle(d) || {};
n = d[B + G];
e = Math.max(q(n), e);
p = d[B + v];
g = d[B + w];
c = Math.max(q(g), c);
k = d[x + w];
l = Math.max(q(k), l);
var a = q(d[x + G]);
0 < a && (a*=parseInt(d[x + u], 10) || 1);
f = Math.max(a, f)
}
});
b = {
total: 0,
transitionPropertyStyle: p,
transitionDurationStyle: n,
transitionDelayStyle: g,
transitionDelay: c,
transitionDuration: e,
animationDelayStyle: k,
animationDelay: l,
animationDuration: f
};
a && (D[a] = b)
}
return b
}
function q(d) {
var a = 0;
d = k.isString(d) ? d.split(/\s*,\s*/) : [];
m(d, function(d) {
a = Math.max(parseFloat(d) || 0, a)
});
return a
}
function J(d) {
var a = d.parent(), b = a.data(V);
b || (a.data(V, ++U), b = U);
return b + "-" + l(d).className
}
function O(d, a) {
var b = J(d), e = b + " " + a, c = {}, f = D[e]?++D[e].total : 0;
if (0 < f) {
var h = a + "-stagger", c = b + " " + h;
(b=!D[c]) && d.addClass(h);
c = t(d, c);
b && d.removeClass(h)
}
d.addClass(a);
e = t(d, e);
h = Math.max(e.transitionDuration, e.animationDuration);
if (0 === h)
return d.removeClass(a), !1;
var g =
"";
0 < e.transitionDuration ? (d.addClass(y), g += M + " ", l(d).style[B + v] = "none") : l(d).style[x] = "none 0s";
m(a.split(" "), function(d, a) {
g += (0 < a ? " " : "") + d + "-active"
});
d.data(z, {
className: a,
activeClassName: g,
maxDuration: h,
classes: a + " " + g,
timings: e,
stagger: c,
ii: f
});
return !0
}
function p(d) {
var a = B + v;
d = l(d);
d.style[a] && 0 < d.style[a].length && (d.style[a] = "")
}
function E(d) {
var a = x;
d = l(d);
d.style[a] && 0 < d.style[a].length && (d.style[a] = "")
}
function L(a, c, f) {
function h(a) {
a.stopPropagation();
var d = a.originalEvent || a;
a = d.$manualTimeStamp ||
d.timeStamp || Date.now();
d = parseFloat(d.elapsedTime.toFixed(N));
Math.max(a - x, 0) >= v && d >= p && f()
}
var r = a.data(z), m = l(a);
if ( - 1 != m.className.indexOf(c) && r) {
var k = r.timings, n = r.stagger, p = r.maxDuration, q = r.activeClassName, v = 1E3 * Math.max(k.transitionDelay, k.animationDelay), x = Date.now(), w = Q + " " + P, u = r.ii, y, r = "", s = [];
if (0 < k.transitionDuration) {
var t = k.transitionPropertyStyle;
- 1 == t.indexOf("all") && (y=!0, r += b + "transition-property: " + t + ", " + (g.msie ? "-ms-zoom" : "border-spacing") + "; ", r += b + "transition-duration: " +
k.transitionDurationStyle + ", " + k.transitionDuration + "s; ", s.push(b + "transition-property"), s.push(b + "transition-duration"))
}
0 < u && (0 < n.transitionDelay && 0 === n.transitionDuration && (t = k.transitionDelayStyle, y && (t += ", " + k.transitionDelay + "s"), r += b + "transition-delay: " + A(t, n.transitionDelay, u) + "; ", s.push(b + "transition-delay")), 0 < n.animationDelay && 0 === n.animationDuration && (r += b + "animation-delay: " + A(k.animationDelayStyle, n.animationDelay, u) + "; ", s.push(b + "animation-delay")));
0 < s.length && (k = m.getAttribute("style") ||
"", m.setAttribute("style", k + " " + r));
a.on(w, h);
a.addClass(q);
return function(b) {
a.off(w, h);
a.removeClass(q);
e(a, c);
b = l(a);
for (var f in s)
b.style.removeProperty(s[f])
}
}
f()
}
function A(a, b, e) {
var c = "";
m(a.split(","), function(a, d) {
c += (0 < d ? "," : "") + (e * b + parseInt(a, 10)) + "s"
});
return c
}
function K(a, b) {
if (O(a, b))
return function(c) {
c && e(a, b)
}
}
function a(a, b, c) {
if (a.data(z))
return L(a, b, c);
e(a, b);
c()
}
function c(d, b, c) {
var e = K(d, b);
if (e) {
var f = e;
n(function() {
p(d);
E(d);
f = a(d, b, c)
});
return function(a) {
(f || s)(a)
}
}
c()
}
function e(a, b) {
a.removeClass(b);
a.removeClass(y);
a.removeData(z)
}
function f(a, b) {
var c = "";
a = k.isArray(a) ? a : a.split(/\s+/);
m(a, function(a, d) {
a && 0 < a.length && (c += (0 < d ? " " : "") + a + b)
});
return c
}
var b = "", B, P, x, Q;
C.ontransitionend === F && C.onwebkittransitionend !== F ? (b = "-webkit-", B = "WebkitTransition", P = "webkitTransitionEnd transitionend") : (B = "transition", P = "transitionend");
C.onanimationend === F && C.onwebkitanimationend !== F ? (b = "-webkit-", x = "WebkitAnimation", Q = "webkitAnimationEnd animationend") : (x = "animation",
Q = "animationend");
var G = "Duration", v = "Property", w = "Delay", u = "IterationCount", V = "$$ngAnimateKey", z = "$$ngAnimateCSS3Data", y = "ng-animate-start", M = "ng-animate-active", N = 3, D = {}, U = 0, R = [], S;
return {
allowCancel: function(a, b, c) {
var e = (a.data(z) || {}).classes;
if (!e || 0 <= ["enter", "leave", "move"].indexOf(b))
return !0;
var h = a.parent(), g = k.element(l(a).cloneNode());
g.attr("style", "position:absolute; top:-9999px; left:-9999px");
g.removeAttr("id");
g.empty();
m(e.split(" "), function(a) {
g.removeClass(a)
});
g.addClass(f(c,
"addClass" == b ? "-add" : "-remove"));
h.append(g);
a = t(g);
g.remove();
return 0 < Math.max(a.transitionDuration, a.animationDuration)
},
enter: function(a, b) {
return c(a, "ng-enter", b)
},
leave: function(a, b) {
return c(a, "ng-leave", b)
},
move: function(a, b) {
return c(a, "ng-move", b)
},
beforeAddClass: function(a, b, c) {
if (b = K(a, f(b, "-add")))
return n(function() {
p(a);
E(a);
c()
}), b;
c()
},
addClass: function(b, c, e) {
return a(b, f(c, "-add"), e)
},
beforeRemoveClass: function(a, b, c) {
if (b = K(a, f(b, "-remove")))
return n(function() {
p(a);
E(a);
c()
}),
b;
c()
},
removeClass: function(b, c, e) {
return a(b, f(c, "-remove"), e)
}
}
}
])
}
])
})(window, window.angular);
//# sourceMappingURL=angular-animate.min.js.map
/*
AngularJS v1.2.11
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(H, a, A) {
'use strict';
function D(p, g) {
g = g || {};
a.forEach(g, function(a, c) {
delete g[c]
});
for (var c in p)
p.hasOwnProperty(c) && ("$" !== c.charAt(0) && "$" !== c.charAt(1)) && (g[c] = p[c]);
return g
}
var v = a.$$minErr("$resource"), C = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;
a.module("ngResource", ["ng"]).factory("$resource", ["$http", "$q", function(p, g) {
function c(a, c) {
this.template = a;
this.defaults = c || {};
this.urlParams = {}
}
function t(n, w, l) {
function r(h, d) {
var e = {};
d = x({}, w, d);
s(d, function(b, d) {
u(b) && (b = b());
var k;
if (b &&
b.charAt && "@" == b.charAt(0)) {
k = h;
var a = b.substr(1);
if (null == a || "" === a || "hasOwnProperty" === a ||!C.test("." + a))
throw v("badmember", a);
for (var a = a.split("."), f = 0, c = a.length; f < c && k !== A; f++) {
var g = a[f];
k = null !== k ? k[g] : A
}
} else
k = b;
e[d] = k
});
return e
}
function e(a) {
return a.resource
}
function f(a) {
D(a || {}, this)
}
var F = new c(n);
l = x({}, B, l);
s(l, function(h, d) {
var c = /^(POST|PUT|PATCH)$/i.test(h.method);
f[d] = function(b, d, k, w) {
var q = {}, n, l, y;
switch (arguments.length) {
case 4:
y = w, l = k;
case 3:
case 2:
if (u(d)) {
if (u(b)) {
l =
b;
y = d;
break
}
l = d;
y = k
} else {
q = b;
n = d;
l = k;
break
}
case 1:
u(b) ? l = b : c ? n = b : q = b;
break;
case 0:
break;
default:
throw v("badargs", arguments.length);
}
var t = this instanceof f, m = t ? n: h.isArray ? []: new f(n), z = {}, B = h.interceptor && h.interceptor.response || e, C = h.interceptor && h.interceptor.responseError || A;
s(h, function(a, b) {
"params" != b && ("isArray" != b && "interceptor" != b) && (z[b] = G(a))
});
c && (z.data = n);
F.setUrlParams(z, x({}, r(n, h.params || {}), q), h.url);
q = p(z).then(function(b) {
var d = b.data, k = m.$promise;
if (d) {
if (a.isArray(d)!==!!h.isArray)
throw v("badcfg",
h.isArray ? "array" : "object", a.isArray(d) ? "array" : "object");
h.isArray ? (m.length = 0, s(d, function(b) {
m.push(new f(b))
})) : (D(d, m), m.$promise = k)
}
m.$resolved=!0;
b.resource = m;
return b
}, function(b) {
m.$resolved=!0;
(y || E)(b);
return g.reject(b)
});
q = q.then(function(b) {
var a = B(b);
(l || E)(a, b.headers);
return a
}, C);
return t ? q : (m.$promise = q, m.$resolved=!1, m)
};
f.prototype["$" + d] = function(b, a, k) {
u(b) && (k = a, a = b, b = {});
b = f[d].call(this, b, this, a, k);
return b.$promise || b
}
});
f.bind = function(a) {
return t(n, x({}, w, a), l)
};
return f
}
var B = {
get: {
method: "GET"
},
save: {
method: "POST"
},
query: {
method: "GET",
isArray: !0
},
remove: {
method: "DELETE"
},
"delete": {
method: "DELETE"
}
}, E = a.noop, s = a.forEach, x = a.extend, G = a.copy, u = a.isFunction;
c.prototype = {
setUrlParams: function(c, g, l) {
var r = this, e = l || r.template, f, p, h = r.urlParams = {};
s(e.split(/\W/), function(a) {
if ("hasOwnProperty" === a)
throw v("badname");
!/^\d+$/.test(a) && (a && RegExp("(^|[^\\\\]):" + a + "(\\W|$)").test(e)) && (h[a]=!0)
});
e = e.replace(/\\:/g, ":");
g = g || {};
s(r.urlParams, function(d, c) {
f = g.hasOwnProperty(c) ?
g[c] : r.defaults[c];
a.isDefined(f) && null !== f ? (p = encodeURIComponent(f).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "%20").replace(/%26/gi, "&").replace(/%3D/gi, "=").replace(/%2B/gi, "+"), e = e.replace(RegExp(":" + c + "(\\W|$)", "g"), function(a, c) {
return p + c
})) : e = e.replace(RegExp("(/?):" + c + "(\\W|$)", "g"), function(a, c, d) {
return "/" == d.charAt(0) ? d : c + d
})
});
e = e.replace(/\/+$/, "") || "/";
e = e.replace(/\/\.(?=\w+($|\?))/, ".");
c.url = e.replace(/\/\\\./, "/.");
s(g, function(a,
e) {
r.urlParams[e] || (c.params = c.params || {}, c.params[e] = a)
})
}
};
return t
}
])
})(window, window.angular);
//# sourceMappingURL=angular-resource.min.js.map
/*
AngularJS v1.2.11
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(p, h, q) {
'use strict';
function E(a) {
var e = [];
s(e, h.noop).chars(a);
return e.join("")
}
function k(a) {
var e = {};
a = a.split(",");
var d;
for (d = 0; d < a.length; d++)
e[a[d]]=!0;
return e
}
function F(a, e) {
function d(a, b, d, g) {
b = h.lowercase(b);
if (t[b])
for (; f.last() && u[f.last()];)
c("", f.last());
v[b] && f.last() == b && c("", b);
(g = w[b]||!!g) || f.push(b);
var l = {};
d.replace(G, function(a, b, e, c, d) {
l[b] = r(e || c || d || "")
});
e.start && e.start(b, l, g)
}
function c(a, b) {
var c = 0, d;
if (b = h.lowercase(b))
for (c = f.length - 1; 0 <= c && f[c] != b; c--);
if (0 <= c) {
for (d = f.length - 1; d >= c; d--)
e.end && e.end(f[d]);
f.length = c
}
}
var b, g, f = [], l = a;
for (f.last = function() {
return f[f.length - 1]
}; a;) {
g=!0;
if (f.last() && x[f.last()])
a = a.replace(RegExp("(.*)<\\s*\\/\\s*" + f.last() + "[^>]*>", "i"), function(b, a) {
a = a.replace(H, "$1").replace(I, "$1");
e.chars && e.chars(r(a));
return ""
}), c("", f.last());
else {
if (0 === a.indexOf("\x3c!--"))
b = a.indexOf("--", 4), 0 <= b && a.lastIndexOf("--\x3e", b) === b && (e.comment && e.comment(a.substring(4, b)), a = a.substring(b + 3), g=!1);
else if (y.test(a)) {
if (b = a.match(y))
a =
a.replace(b[0], ""), g=!1
} else if (J.test(a)) {
if (b = a.match(z))
a = a.substring(b[0].length), b[0].replace(z, c), g=!1
} else
K.test(a) && (b = a.match(A)) && (a = a.substring(b[0].length), b[0].replace(A, d), g=!1);
g && (b = a.indexOf("<"), g = 0 > b ? a : a.substring(0, b), a = 0 > b ? "" : a.substring(b), e.chars && e.chars(r(g)))
}
if (a == l)
throw L("badparse", a);
l = a
}
c()
}
function r(a) {
if (!a)
return "";
var e = M.exec(a);
a = e[1];
var d = e[3];
if (e = e[2])
n.innerHTML = e.replace(/</g, "&lt;"), e = "textContent"in n ? n.textContent : n.innerText;
return a + e + d
}
function B(a) {
return a.replace(/&/g,
"&amp;").replace(N, function(a) {
return "&#" + a.charCodeAt(0) + ";"
}).replace(/</g, "&lt;").replace(/>/g, "&gt;")
}
function s(a, e) {
var d=!1, c = h.bind(a, a.push);
return {
start: function(a, g, f) {
a = h.lowercase(a);
!d && x[a] && (d = a);
d ||!0 !== C[a] || (c("<"), c(a), h.forEach(g, function(d, f) {
var g = h.lowercase(f), k = "img" === a && "src" === g || "background" === g;
!0 !== O[g] ||!0 === D[g]&&!e(d, k) || (c(" "), c(f), c('="'), c(B(d)), c('"'))
}), c(f ? "/>" : ">"))
},
end: function(a) {
a = h.lowercase(a);
d ||!0 !== C[a] || (c("</"), c(a), c(">"));
a == d && (d=!1)
},
chars: function(a) {
d ||
c(B(a))
}
}
}
var L = h.$$minErr("$sanitize"), A = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, z = /^<\s*\/\s*([\w:-]+)[^>]*>/, G = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, K = /^</, J = /^<\s*\//, H = /\x3c!--(.*?)--\x3e/g, y = /<!DOCTYPE([^>]*?)>/i, I = /<!\[CDATA\[(.*?)]]\x3e/g, N = /([^\#-~| |!])/g, w = k("area,br,col,hr,img,wbr");
p = k("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");
q = k("rp,rt");
var v = h.extend({}, q, p), t = h.extend({}, p, k("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),
u = h.extend({}, q, k("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), x = k("script,style"), C = h.extend({}, w, t, u, v), D = k("background,cite,href,longdesc,src,usemap"), O = h.extend({}, D, k("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width")),
n = document.createElement("pre"), M = /^(\s*)([\s\S]*?)(\s*)$/;
h.module("ngSanitize", []).provider("$sanitize", function() {
this.$get = ["$$sanitizeUri", function(a) {
return function(e) {
var d = [];
F(e, s(d, function(c, b) {
return !/^unsafe/.test(a(c, b))
}));
return d.join("")
}
}
]
});
h.module("ngSanitize").filter("linky", ["$sanitize", function(a) {
var e = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/, d = /^mailto:/;
return function(c, b) {
function g(a) {
a && m.push(E(a))
}
function f(a, c) {
m.push("<a ");
h.isDefined(b) &&
(m.push('target="'), m.push(b), m.push('" '));
m.push('href="');
m.push(a);
m.push('">');
g(c);
m.push("</a>")
}
if (!c)
return c;
for (var l, k = c, m = [], n, p; l = k.match(e);)
n = l[0], l[2] == l[3] && (n = "mailto:" + n), p = l.index, g(k.substr(0, p)), f(n, l[0].replace(d, "")), k = k.substring(p + l[0].length);
g(k);
return a(m.join(""))
}
}
])
})(window, window.angular);
//# sourceMappingURL=angular-sanitize.min.js.map
/**
* @license Angulartics v0.17.2
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
* License: MIT
*/
!function(a) {
"use strict";
var b = window.angulartics || (window.angulartics = {});
b.waitForVendorCount = 0, b.waitForVendorApi = function(a, c, d, e, f) {
f || b.waitForVendorCount++, e || (e = d, d = void 0), !Object.prototype.hasOwnProperty.call(window, a) || void 0 !== d && void 0 === window[a][d] ? setTimeout(function() {
b.waitForVendorApi(a, c, d, e, !0)
}, c) : (b.waitForVendorCount--, e(window[a]))
}, a.module("angulartics", []).provider("$analytics", function() {
var c = {
pageTracking: {
autoTrackFirstPage: !0,
autoTrackVirtualPages: !0,
trackRelativePath: !1,
autoBasePath: !1,
basePath: ""
},
eventTracking: {},
bufferFlushDelay: 1e3,
developerMode: !1
}, d = ["pageTrack", "eventTrack", "setAlias", "setUsername", "setAlias", "setUserProperties", "setUserPropertiesOnce", "setSuperProperties", "setSuperPropertiesOnce"], e = {}, f = {}, g = function(a) {
return function() {
b.waitForVendorCount && (e[a] || (e[a] = []), e[a].push(arguments))
}
}, h = function(b, c) {
return f[b] || (f[b] = []), f[b].push(c), function() {
var c = arguments;
a.forEach(f[b], function(a) {
a.apply(this, c)
}, this)
}
}, i = {
settings: c
}, j = function(a, b) {
b ? setTimeout(a, b) : a()
}, k = {
$get: function() {
return i
},
api: i,
settings: c,
virtualPageviews: function(a) {
this.settings.pageTracking.autoTrackVirtualPages = a
},
firstPageview: function(a) {
this.settings.pageTracking.autoTrackFirstPage = a
},
withBase: function(b) {
this.settings.pageTracking.basePath = b ? a.element("base").attr("href").slice(0, - 1) : ""
},
withAutoBase: function(a) {
this.settings.pageTracking.autoBasePath = a
},
developerMode: function(a) {
this.settings.developerMode = a
}
}, l = function(b, d) {
i[b] = h(b, d);
var f = c[b], g = f ? f.bufferFlushDelay: null, k = null !== g ? g: c.bufferFlushDelay;
a.forEach(e[b], function(a, b) {
j(function() {
d.apply(this, a)
}, b * k)
})
}, m = function(a) {
return a.replace(/^./, function(a) {
return a.toUpperCase()
})
}, n = function(a) {
var b = "register" + m(a);
k[b] = function(b) {
l(a, b)
}, i[a] = h(a, g(a))
};
return a.forEach(d, n), k
}).run(["$rootScope", "$window", "$analytics", "$injector", function(b, c, d, e) {
d.settings.pageTracking.autoTrackFirstPage && e.invoke(["$location", function(a) {
var b=!0;
if (e.has("$route")) {
var f = e.get("$route");
for (var g in f.routes) {
b=!1;
break
}
} else if (e.has("$state")) {
var h = e.get("$state");
for (var i in h.get()) {
b=!1;
break
}
}
if (b)
if (d.settings.pageTracking.autoBasePath && (d.settings.pageTracking.basePath = c.location.pathname), d.settings.trackRelativePath) {
var j = d.settings.pageTracking.basePath + a.url();
d.pageTrack(j, a)
} else
d.pageTrack(a.absUrl(), a)
}
]), d.settings.pageTracking.autoTrackVirtualPages && e.invoke(["$location", function(a) {
d.settings.pageTracking.autoBasePath && (d.settings.pageTracking.basePath = c.location.pathname + "#"), e.has("$route") && b.$on("$routeChangeSuccess", function(b, c) {
if (!c ||!(c.$$route || c).redirectTo) {
var e = d.settings.pageTracking.basePath + a.url();
d.pageTrack(e, a)
}
}), e.has("$state") && b.$on("$stateChangeSuccess", function() {
var b = d.settings.pageTracking.basePath + a.url();
d.pageTrack(b, a)
})
}
]), d.settings.developerMode && a.forEach(d, function(a, b) {
"function" == typeof a && (d[b] = function() {})
})
}
]).directive("analyticsOn", ["$analytics", function(b) {
function c(a) {
return ["a:", "button:", "button:button", "button:submit", "input:button", "input:submit"].indexOf(a.tagName.toLowerCase() + ":" + (a.type || "")) >= 0
}
function d(a) {
return c(a) ? "click" : "click"
}
function e(a) {
return c(a) ? a.innerText || a.value : a.id || a.name || a.tagName
}
function f(a) {
return "analytics" === a.substr(0, 9)&&-1 === ["On", "Event", "If", "Properties", "EventType"].indexOf(a.substr(9))
}
function g(a) {
var b = a.slice(9);
return "undefined" != typeof b && null !== b && b.length > 0 ? b.substring(0, 1).toLowerCase() + b.substring(1) : b
}
return {
restrict: "A",
link: function(c, h, i) {
var j = i.analyticsOn || d(h[0]), k = {};
a.forEach(i.$attr, function(a, b) {
f(b) && (k[g(b)] = i[b], i.$observe(b, function(a) {
k[g(b)] = a
}))
}), a.element(h[0]).bind(j, function(d) {
var f = i.analyticsEvent || e(h[0]);
k.eventType = d.type, (!i.analyticsIf || c.$eval(i.analyticsIf)) && (i.analyticsProperties && a.extend(k, c.$eval(i.analyticsProperties)), b.eventTrack(f, k))
})
}
}
}
])
}(angular);
/**
* @license Angulartics v0.17.2
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
* Google Tag Manager Plugin Contributed by http://github.com/danrowe49
* License: MIT
*/
!function(a) {
"use strict";
a.module("angulartics.google.tagmanager", ["angulartics"]).config(["$analyticsProvider", function(a) {
a.registerPageTrack(function(a) {
var b = window.dataLayer = window.dataLayer || [];
b.push({
event: "content-view",
"content-name": a
})
}), a.registerEventTrack(function(a, b) {
var c = window.dataLayer = window.dataLayer || [];
c.push({
event: "interaction",
target: b.category,
action: a,
"target-properties": b.label,
value: b.value,
"interaction-type": b.noninteraction
})
})
}
])
}(angular);
/**
* PRPL ANIMATOR is series of animation tools that rely on whether the
* element is within the viewport or not
*
* @author: Parker Hutchinson
*
*/
(function(window, angular, undefined) {
'use strict';
var ngPrplAnimator = angular.module('prplAnimator', []);
/**
* directive gets current element to add class 'inviewtop'
* or 'inviewmiddle' or 'inviewbottom' to itself when container is either visible or
* at least the elements' middle or bottom are visible. class is only removed
* if element is below window viewport not above it.
*
* @author: Parker Hutchinson
* @attr: offset = integer
*/
ngPrplAnimator.directive('prplInview', function() {
var link = function(scope, element, attrs) {
// debounce(http://davidwalsh.name/javascript-debounce-function), because duh.
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
timeout = null;
if (!immediate)
func.apply(context, args);
}, wait);
if (immediate && !timeout)
func.apply(context, args);
};
};
var inViewFun = debounce(function() {
var winTop = $(window).scrollTop(),
elementTop = $(element).offset().top - $(window).height(),
elementBottom = elementTop + $(element).outerHeight(),
elementMiddle = elementTop + $(element).outerHeight() / 2;
// only removes class if element is below
// window height
// only add class if element top is in view
if (winTop >= elementTop) {
$(element).addClass('inviewtop');
} else {
$(element).removeClass('inviewtop');
};
// only add class if element is visible && if
// middle of element can be seen
if (winTop >= elementMiddle) {
$(element).addClass('inviewmiddle');
} else {
$(element).removeClass('inviewmiddle');
};
// only add class if element bottom is in view
if (winTop >= elementBottom) {
$(element).addClass('inviewbottom');
} else {
$(element).removeClass('inviewbottom');
};
// only add class if element top is in view plus
// custom offset
if (winTop >= (elementTop + parseInt(attrs.inviewOffset))) {
$(element).addClass('inviewcustom');
} else {
$(element).removeClass('inviewcustom');
};
}, 20);
// on init
$(window).load(inViewFun);
// on scroll
$(window).on('scroll', inViewFun);
};
return {
restrict: 'A',
link: link
};
});
/**
* directive to listen for when the blue icons on fleetgistics
* are visible via the inviewbottom class. if they are, then set the
* cols to active one at a time until finished
*
* @author: Parker Hutchinson
* @requires: prplInview
* @attr: stepperDalay = integer
*/
ngPrplAnimator.directive('prplStepper', function() {
var link = function(scope, element, attrs) {
var listener,
sequence,
unlistener,
delay = parseInt(attrs.stepperDelay) || 300,
inviewClass = attrs.stepperClass || "inviewbottom";
// listening for 'inviewbottom' class to be applied
var listenerAddClass = function() {
listener = window.setInterval(function() {
if ($(element).hasClass(inviewClass)) {
// run seqeuncer
// console.log('running?')
sequencer();
listenerRemoveClass();
clearInterval(listener);
};
}, 20);
};
// init this function on load
listenerAddClass();
// listen for when inviewbottom is not applied
// removes / resets the 'active' class / animation
// restarts the inviewbottom listener
var listenerRemoveClass = function() {
unlistener = window.setInterval(function() {
if (!$(element).hasClass(inviewClass)) {
listenerAddClass();
$(element).find('.step').removeClass('step-active');
clearInterval(unlistener);
// iterupt sequencer so it can reset properly
clearInterval(sequence);
}
}, 20);
};
var sequencer = function() {
var count = 0;
// sequentially add 'active' class to elements
$(element).find('.step:eq(' + count + ')').addClass('step-active');
sequence = window.setInterval(function() {
count++;
$(element).find('.step:eq(' + count + ')').addClass('step-active');
if (count == ($(element).find('.step').length - 1)) {
clearInterval(sequence);
};
}, delay);
};
};
return {
restrict: 'A',
link: link
};
});
/**
*
* A custom animation queing directive looks for class 'prplKey'
* data from that element 'keytime' at what point the
* animation needs to fire.
*
* @author: Parker Hutchinson
* @requires: prplInview
* @attr: delay = integer
*
*/
// TODO: write comments!
ngPrplAnimator.directive('prplKeyframer', function() {
var link = function(scope, element, attrs) {
var keyframe = $(element).find('.keyframe'),
listener,
unlistener,
keyTimer = [],
inviewClass = attrs.inviewClass || "inviewbottom";
var startKeyframes = function() {
listener = window.setInterval(function() {
if ($(element).hasClass(inviewClass)) {
playKeyFrames();
resetkeyFrames();
clearInterval(listener);
}
}, 20);
};
// init
startKeyframes();
var resetkeyFrames = function() {
unlistener = window.setInterval(function() {
if (!$(element).hasClass(inviewClass)) {
clearInterval(unlistener);
for (var i = 0; i < keyTimer.length; i++) {
clearTimeout(keyTimer[i]);
}
$(keyframe).removeClass('play-keyframe');
startKeyframes();
}
}, 20);
};
var playKeyFrames = function() {
// play first keyframe immediatley
$(keyframe).each(function(i) {
var keyFrameTime = $(this).attr('data-keytime') || 500;
// push all timers to
keyTimer.push(setTimeout(function() {
// console.log($(keyframe[animationIndex]));
$(keyframe[i]).addClass('play-keyframe');
}, keyFrameTime));
});
};
};
return {
restrict: 'A',
link: link
};
});
})(window, window.angular);
/*
* angular-disqus 1.1.0
* http://github.com/kirstein/angular-disqus
*
* Licensed under the MIT license
*/
!function(a, b) {
"use strict";
var c = a.module("ngDisqus", []);
c.provider("$disqus", function() {
function c() {
return document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]
}
function d() {
return l || b.disqus_shortname
}
function e(a, b) {
return "//" + a + ".disqus.com/" + b
}
function f(a) {
var b = document.createElement("script");
return b.type = "text/javascript", b.async=!0, b.src = a, b
}
function g(a, b) {
var c, d, e = a.getElementsByTagName("script");
for (d = 0; d < e.length; d += 1)
if (c = e[d], ~c.src.indexOf(b))
return !0;
return !1
}
function h(a, c, d) {
b.disqus_identifier = a, b.disqus_url = c, b.disqus_shortname = d
}
function i() {
var c = b.DISQUSWIDGETS;
c && a.isFunction(c.getCount) && c.getCount()
}
function j(a, c) {
b.DISQUS.reset({
reload: !0,
config: function() {
this.page.identifier = c, this.page.url = a.absUrl()
}
})
}
function k(a, b) {
var d = c(), h = e(a, b);
g(d, h) || d.appendChild(f(h))
}
var l, m = "embed.js", n = "count.js";
this.setShortname = function(a) {
l = a
}, this.$get = ["$location", function(c) {
function e(e) {
var f = d();
if (!a.isDefined(f))
throw new Error("No disqus shortname defined");
if (!a.isDefined(e))
throw new Error("No disqus thread id defined");
a.isDefined(b.DISQUS) ? j(c, e) : (h(e, c.absUrl(), f), k(f, m))
}
function f(a) {
h(a, c.absUrl(), l), k(d(), m), k(d(), n), i()
}
return {
commit: e,
getShortname: d,
loadCount: f
}
}
]
}), c.directive("disqus", ["$disqus", function(b) {
return {
restrict: "AC",
replace: !0,
scope: {
id: "=disqus"
},
template: '<div id="disqus_thread"></div>',
link: function(c) {
c.$watch("id", function(c) {
a.isDefined(c) && b.commit(c)
})
}
}
}
]), c.directive("disqusIdentifier", ["$disqus", function(a) {
return {
restrict: "A",
link: function(b, c, d) {
a.loadCount(d.disqusIdentifier)
}
}
}
])
}(angular, this);
/*!
* imagesLoaded PACKAGED v3.1.5
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
/*!
* EventEmitter v4.2.6 - git.io/ee
* Oliver Caldwell
* MIT license
* @preserve
*/
(function () {
/**
* Class for managing events.
* Can be extended to provide event functionality in other classes.
*
* @class EventEmitter Manages event registering and emitting.
*/
function EventEmitter() {}
// Shortcuts to improve speed and size
var proto = EventEmitter.prototype;
var exports = this;
var originalGlobalValue = exports.EventEmitter;
/**
* Finds the index of the listener for the event in it's storage array.
*
* @param {Function[]} listeners Array of listeners to search through.
* @param {Function} listener Method to look for.
* @return {Number} Index of the specified listener, -1 if not found
* @api private
*/
function indexOfListener(listeners, listener) {
var i = listeners.length;
while (i--) {
if (listeners[i].listener === listener) {
return i;
}
}
return - 1;
}
/**
* Alias a method while keeping the context correct, to allow for overwriting of target method.
*
* @param {String} name The name of the target method.
* @return {Function} The aliased method
* @api private
*/
function alias(name) {
return function aliasClosure() {
return this[name].apply(this, arguments);
};
}
/**
* Returns the listener array for the specified event.
* Will initialise the event object and listener arrays if required.
* Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
* Each property in the object response is an array of listener functions.
*
* @param {String|RegExp} evt Name of the event to return the listeners from.
* @return {Function[]|Object} All listener functions for the event.
*/
proto.getListeners = function getListeners(evt) {
var events = this._getEvents();
var response;
var key;
// Return a concatenated array of all matching events if
// the selector is a regular expression.
if (typeof evt === 'object') {
response = {};
for (key in events) {
if (events.hasOwnProperty(key) && evt.test(key)) {
response[key] = events[key];
}
}
} else {
response = events[evt] || (events[evt] = []);
}
return response;
};
/**
* Takes a list of listener objects and flattens it into a list of listener functions.
*
* @param {Object[]} listeners Raw listener objects.
* @return {Function[]} Just the listener functions.
*/
proto.flattenListeners = function flattenListeners(listeners) {
var flatListeners = [];
var i;
for (i = 0; i < listeners.length; i += 1) {
flatListeners.push(listeners[i].listener);
}
return flatListeners;
};
/**
* Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
*
* @param {String|RegExp} evt Name of the event to return the listeners from.
* @return {Object} All listener functions for an event in an object.
*/
proto.getListenersAsObject = function getListenersAsObject(evt) {
var listeners = this.getListeners(evt);
var response;
if (listeners instanceof Array) {
response = {};
response[evt] = listeners;
}
return response || listeners;
};
/**
* Adds a listener function to the specified event.
* The listener will not be added if it is a duplicate.
* If the listener returns true then it will be removed after it is called.
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
*
* @param {String|RegExp} evt Name of the event to attach the listener to.
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.addListener = function addListener(evt, listener) {
var listeners = this.getListenersAsObject(evt);
var listenerIsWrapped = typeof listener === 'object';
var key;
for (key in listeners) {
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === - 1) {
listeners[key].push(listenerIsWrapped ? listener : {
listener: listener,
once: false
});
}
}
return this;
};
/**
* Alias of addListener
*/
proto.on = alias('addListener');
/**
* Semi-alias of addListener. It will add a listener that will be
* automatically removed after it's first execution.
*
* @param {String|RegExp} evt Name of the event to attach the listener to.
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.addOnceListener = function addOnceListener(evt, listener) {
return this.addListener(evt, {
listener: listener,
once: true
});
};
/**
* Alias of addOnceListener.
*/
proto.once = alias('addOnceListener');
/**
* Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
* You need to tell it what event names should be matched by a regex.
*
* @param {String} evt Name of the event to create.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.defineEvent = function defineEvent(evt) {
this.getListeners(evt);
return this;
};
/**
* Uses defineEvent to define multiple events.
*
* @param {String[]} evts An array of event names to define.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.defineEvents = function defineEvents(evts) {
for (var i = 0; i < evts.length; i += 1) {
this.defineEvent(evts[i]);
}
return this;
};
/**
* Removes a listener function from the specified event.
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
*
* @param {String|RegExp} evt Name of the event to remove the listener from.
* @param {Function} listener Method to remove from the event.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.removeListener = function removeListener(evt, listener) {
var listeners = this.getListenersAsObject(evt);
var index;
var key;
for (key in listeners) {
if (listeners.hasOwnProperty(key)) {
index = indexOfListener(listeners[key], listener);
if (index !== - 1) {
listeners[key].splice(index, 1);
}
}
}
return this;
};
/**
* Alias of removeListener
*/
proto.off = alias('removeListener');
/**
* Adds listeners in bulk using the manipulateListeners method.
* If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
* You can also pass it a regular expression to add the array of listeners to all events that match it.
* Yeah, this function does quite a bit. That's probably a bad thing.
*
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
* @param {Function[]} [listeners] An optional array of listener functions to add.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.addListeners = function addListeners(evt, listeners) {
// Pass through to manipulateListeners
return this.manipulateListeners(false, evt, listeners);
};
/**
* Removes listeners in bulk using the manipulateListeners method.
* If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
* You can also pass it an event name and an array of listeners to be removed.
* You can also pass it a regular expression to remove the listeners from all events that match it.
*
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
* @param {Function[]} [listeners] An optional array of listener functions to remove.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.removeListeners = function removeListeners(evt, listeners) {
// Pass through to manipulateListeners
return this.manipulateListeners(true, evt, listeners);
};
/**
* Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
* The first argument will determine if the listeners are removed (true) or added (false).
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
* You can also pass it an event name and an array of listeners to be added/removed.
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
*
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
var i;
var value;
var single = remove ? this.removeListener : this.addListener;
var multiple = remove ? this.removeListeners : this.addListeners;
// If evt is an object then pass each of it's properties to this method
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
for (i in evt) {
if (evt.hasOwnProperty(i) && (value = evt[i])) {
// Pass the single listener straight through to the singular method
if (typeof value === 'function') {
single.call(this, i, value);
} else {
// Otherwise pass back to the multiple function
multiple.call(this, i, value);
}
}
}
} else {
// So evt must be a string
// And listeners must be an array of listeners
// Loop over it and pass each one to the multiple method
i = listeners.length;
while (i--) {
single.call(this, evt, listeners[i]);
}
}
return this;
};
/**
* Removes all listeners from a specified event.
* If you do not specify an event then all listeners will be removed.
* That means every event will be emptied.
* You can also pass a regex to remove all events that match it.
*
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.removeEvent = function removeEvent(evt) {
var type = typeof evt;
var events = this._getEvents();
var key;
// Remove different things depending on the state of evt
if (type === 'string') {
// Remove all listeners for the specified event
delete events[evt];
} else if (type === 'object') {
// Remove all events matching the regex.
for (key in events) {
if (events.hasOwnProperty(key) && evt.test(key)) {
delete events[key];
}
}
} else {
// Remove all listeners in all events
delete this._events;
}
return this;
};
/**
* Alias of removeEvent.
*
* Added to mirror the node API.
*/
proto.removeAllListeners = alias('removeEvent');
/**
* Emits an event of your choice.
* When emitted, every listener attached to that event will be executed.
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
* So they will not arrive within the array on the other side, they will be separate.
* You can also pass a regular expression to emit to all events that match it.
*
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
* @param {Array} [args] Optional array of arguments to be passed to each listener.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.emitEvent = function emitEvent(evt, args) {
var listeners = this.getListenersAsObject(evt);
var listener;
var i;
var key;
var response;
for (key in listeners) {
if (listeners.hasOwnProperty(key)) {
i = listeners[key].length;
while (i--) {
// If the listener returns true then it shall be removed from the event
// The function is executed either with a basic call or an apply if there is an args array
listener = listeners[key][i];
if (listener.once === true) {
this.removeListener(evt, listener.listener);
}
response = listener.listener.apply(this, args || []);
if (response === this._getOnceReturnValue()) {
this.removeListener(evt, listener.listener);
}
}
}
}
return this;
};
/**
* Alias of emitEvent
*/
proto.trigger = alias('emitEvent');
/**
* Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
*
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
* @param {...*} Optional additional arguments to be passed to each listener.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.emit = function emit(evt) {
var args = Array.prototype.slice.call(arguments, 1);
return this.emitEvent(evt, args);
};
/**
* Sets the current value to check against when executing listeners. If a
* listeners return value matches the one set here then it will be removed
* after execution. This value defaults to true.
*
* @param {*} value The new value to check for when executing listeners.
* @return {Object} Current instance of EventEmitter for chaining.
*/
proto.setOnceReturnValue = function setOnceReturnValue(value) {
this._onceReturnValue = value;
return this;
};
/**
* Fetches the current value to check against when executing listeners. If
* the listeners return value matches this one then it should be removed
* automatically. It will return true by default.
*
* @return {*|Boolean} The current value to check for or the default, true.
* @api private
*/
proto._getOnceReturnValue = function _getOnceReturnValue() {
if (this.hasOwnProperty('_onceReturnValue')) {
return this._onceReturnValue;
} else {
return true;
}
};
/**
* Fetches the events object and creates one if required.
*
* @return {Object} The events storage object.
* @api private
*/
proto._getEvents = function _getEvents() {
return this._events || (this._events = {});
};
/**
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
*
* @return {Function} Non conflicting EventEmitter class.
*/
EventEmitter.noConflict = function noConflict() {
exports.EventEmitter = originalGlobalValue;
return EventEmitter;
};
// Expose the class either via AMD, CommonJS or the global object
if (typeof define === 'function' && define.amd) {
define('eventEmitter/EventEmitter', [], function () {
return EventEmitter;
});
} else if (typeof module === 'object' && module.exports) {
module.exports = EventEmitter;
} else {
this.EventEmitter = EventEmitter;
}
}.call(this));
/*!
* eventie v1.0.4
* event binding helper
* eventie.bind( elem, 'click', myFn )
* eventie.unbind( elem, 'click', myFn )
*/
/*jshint browser: true, undef: true, unused: true */
/*global define: false */
( function( window ) {
var docElem = document.documentElement;
var bind = function() {};
function getIEEvent( obj ) {
var event = window.event;
// add event.target
event.target = event.target || event.srcElement || obj;
return event;
}
if ( docElem.addEventListener ) {
bind = function( obj, type, fn ) {
obj.addEventListener( type, fn, false );
};
} else if ( docElem.attachEvent ) {
bind = function( obj, type, fn ) {
obj[ type + fn ] = fn.handleEvent ?
function() {
var event = getIEEvent( obj );
fn.handleEvent.call( fn, event );
} :
function() {
var event = getIEEvent( obj );
fn.call( obj, event );
};
obj.attachEvent( "on" + type, obj[ type + fn ] );
};
}
var unbind = function() {};
if ( docElem.removeEventListener ) {
unbind = function( obj, type, fn ) {
obj.removeEventListener( type, fn, false );
};
} else if ( docElem.detachEvent ) {
unbind = function( obj, type, fn ) {
obj.detachEvent( "on" + type, obj[ type + fn ] );
try {
delete obj[ type + fn ];
} catch ( err ) {
// can't delete window object properties
obj[ type + fn ] = undefined;
}
};
}
var eventie = {
bind: bind,
unbind: unbind
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( 'eventie/eventie', eventie );
} else {
// browser global
window.eventie = eventie;
}
})( this );
/*!
* imagesLoaded v3.1.5
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
( function( window, factory ) {
// universal module definition
/*global define: false, module: false, require: false */
if ( typeof define === 'function' && define.amd ) {
// AMD
define( [
'eventEmitter/EventEmitter',
'eventie/eventie'
], function( EventEmitter, eventie ) {
return factory( window, EventEmitter, eventie );
});
} else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = factory(
window,
require('eventEmitter'),
require('eventie')
);
} else {
// browser global
window.imagesLoaded = factory(
window,
window.EventEmitter,
window.eventie
);
}
})( this,
// -------------------------- factory -------------------------- //
function factory( window, EventEmitter, eventie ) {
var $ = window.jQuery;
var console = window.console;
var hasConsole = typeof console !== 'undefined';
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
var objToString = Object.prototype.toString;
function isArray( obj ) {
return objToString.call( obj ) === '[object Array]';
}
// turn element or nodeList into an array
function makeArray( obj ) {
var ary = [];
if ( isArray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( typeof obj.length === 'number' ) {
// convert nodeList to array
for ( var i = 0, len = obj.length; i < len; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
}
return ary;
}
// -------------------------- imagesLoaded -------------------------- //
/**
* @param {Array, Element, NodeList, String} elem
* @param {Object or Function} options - if function, use as callback
* @param {Function} onAlways - callback function
*/
function ImagesLoaded( elem, options, onAlways ) {
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
if ( !( this instanceof ImagesLoaded ) ) {
return new ImagesLoaded( elem, options );
}
// use elem as selector string
if ( typeof elem === 'string' ) {
elem = document.querySelectorAll( elem );
}
this.elements = makeArray( elem );
this.options = extend( {}, this.options );
if ( typeof options === 'function' ) {
onAlways = options;
} else {
extend( this.options, options );
}
if ( onAlways ) {
this.on( 'always', onAlways );
}
this.getImages();
if ( $ ) {
// add jQuery Deferred object
this.jqDeferred = new $.Deferred();
}
// HACK check async to allow time to bind listeners
var _this = this;
setTimeout( function() {
_this.check();
});
}
ImagesLoaded.prototype = new EventEmitter();
ImagesLoaded.prototype.options = {};
ImagesLoaded.prototype.getImages = function() {
this.images = [];
// filter & find items if we have an item selector
for ( var i = 0, len = this.elements.length; i < len; i++ ) {
var elem = this.elements[i];
// filter siblings
if ( elem.nodeName === 'IMG' ) {
this.addImage( elem );
}
// find children
// no non-element nodes, #143
if ( !elem.nodeType || !( elem.nodeType === 1 || elem.nodeType === 9 ) ) {
continue;
}
var childElems = elem.querySelectorAll('img');
// concat childElems to filterFound array
for ( var j = 0, jLen = childElems.length; j < jLen; j++ ) {
var img = childElems[j];
this.addImage( img );
}
}
};
/**
* @param {Image} img
*/
ImagesLoaded.prototype.addImage = function( img ) {
var loadingImage = new LoadingImage( img );
this.images.push( loadingImage );
};
ImagesLoaded.prototype.check = function() {
var _this = this;
var checkedCount = 0;
var length = this.images.length;
this.hasAnyBroken = false;
// complete if no images
if ( !length ) {
this.complete();
return;
}
function onConfirm( image, message ) {
if ( _this.options.debug && hasConsole ) {
console.log( 'confirm', image, message );
}
_this.progress( image );
checkedCount++;
if ( checkedCount === length ) {
_this.complete();
}
return true; // bind once
}
for ( var i = 0; i < length; i++ ) {
var loadingImage = this.images[i];
loadingImage.on( 'confirm', onConfirm );
loadingImage.check();
}
};
ImagesLoaded.prototype.progress = function( image ) {
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
// HACK - Chrome triggers event before object properties have changed. #83
var _this = this;
setTimeout( function() {
_this.emit( 'progress', _this, image );
if ( _this.jqDeferred && _this.jqDeferred.notify ) {
_this.jqDeferred.notify( _this, image );
}
});
};
ImagesLoaded.prototype.complete = function() {
var eventName = this.hasAnyBroken ? 'fail' : 'done';
this.isComplete = true;
var _this = this;
// HACK - another setTimeout so that confirm happens after progress
setTimeout( function() {
_this.emit( eventName, _this );
_this.emit( 'always', _this );
if ( _this.jqDeferred ) {
var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve';
_this.jqDeferred[ jqMethod ]( _this );
}
});
};
// -------------------------- jquery -------------------------- //
if ( $ ) {
$.fn.imagesLoaded = function( options, callback ) {
var instance = new ImagesLoaded( this, options, callback );
return instance.jqDeferred.promise( $(this) );
};
}
// -------------------------- -------------------------- //
function LoadingImage( img ) {
this.img = img;
}
LoadingImage.prototype = new EventEmitter();
LoadingImage.prototype.check = function() {
// first check cached any previous images that have same src
var resource = cache[ this.img.src ] || new Resource( this.img.src );
if ( resource.isConfirmed ) {
this.confirm( resource.isLoaded, 'cached was confirmed' );
return;
}
// If complete is true and browser supports natural sizes,
// try to check for image status manually.
if ( this.img.complete && this.img.naturalWidth !== undefined ) {
// report based on naturalWidth
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
return;
}
// If none of the checks above matched, simulate loading on detached element.
var _this = this;
resource.on( 'confirm', function( resrc, message ) {
_this.confirm( resrc.isLoaded, message );
return true;
});
resource.check();
};
LoadingImage.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emit( 'confirm', this, message );
};
// -------------------------- Resource -------------------------- //
// Resource checks each src, only once
// separate class from LoadingImage to prevent memory leaks. See #115
var cache = {};
function Resource( src ) {
this.src = src;
// add to cache
cache[ src ] = this;
}
Resource.prototype = new EventEmitter();
Resource.prototype.check = function() {
// only trigger checking once
if ( this.isChecked ) {
return;
}
// simulate loading on detached element
var proxyImage = new Image();
eventie.bind( proxyImage, 'load', this );
eventie.bind( proxyImage, 'error', this );
proxyImage.src = this.src;
// set flag
this.isChecked = true;
};
// ----- events ----- //
// trigger specified handler for event type
Resource.prototype.handleEvent = function( event ) {
var method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
Resource.prototype.onload = function( event ) {
this.confirm( true, 'onload' );
this.unbindProxyEvents( event );
};
Resource.prototype.onerror = function( event ) {
this.confirm( false, 'onerror' );
this.unbindProxyEvents( event );
};
// ----- confirm ----- //
Resource.prototype.confirm = function( isLoaded, message ) {
this.isConfirmed = true;
this.isLoaded = isLoaded;
this.emit( 'confirm', this, message );
};
Resource.prototype.unbindProxyEvents = function( event ) {
eventie.unbind( event.target, 'load', this );
eventie.unbind( event.target, 'error', this );
};
// ----- ----- //
return ImagesLoaded;
});
/*
* iosSlider - http://iosscripts.com/iosslider/
*
* Touch Enabled, Responsive jQuery Horizontal Content Slider/Carousel/Image Gallery Plugin
*
* A jQuery plugin which allows you to integrate a customizable, cross-browser
* content slider into your web presence. Designed for use as a content slider, carousel,
* scrolling website banner, or image gallery.
*
* Copyright (c) 2013 Marc Whitbread
*
* Version: v1.3.16 (09/24/2013)
* Minimum requirements: jQuery v1.4+
*
* Advanced requirements:
* 1) jQuery bind() click event override on slide requires jQuery v1.6+
*
* Terms of use:
*
* 1) iosSlider is licensed under the Creative Commons – Attribution-NonCommercial 3.0 License.
* 2) You may use iosSlider free for personal or non-profit purposes, without restriction.
* Attribution is not required but always appreciated. For commercial projects, you
* must purchase a license. You may download and play with the script before deciding to
* fully implement it in your project. Making sure you are satisfied, and knowing iosSlider
* is the right script for your project is paramount.
* 3) You are not permitted to make the resources found on iosscripts.com available for
* distribution elsewhere "as is" without prior consent. If you would like to feature
* iosSlider on your site, please do not link directly to the resource zip files. Please
* link to the appropriate page on iosscripts.com where users can find the download.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function(b) {
var na = 0, W = 0, da = 0, T = 0, za = "ontouchstart"in window, Ba = "onorientationchange"in window, ea=!1, aa=!1, X=!1, oa=!1, ha=!1, ia = "pointer", sa = "pointer", ja = [], J = [], ta = [], $ = [], z = [], ba = [], B = [], m = [], s = [], ua = [], fa = [], e = {
showScrollbar: function(a, e) {
a.scrollbarHide && b("." + e).css({
opacity: a.scrollbarOpacity,
filter: "alpha(opacity:" + 100 * a.scrollbarOpacity + ")"
})
},
hideScrollbar: function(b, g, c, f, h, d, m, s, B, z) {
if (b.scrollbar && b.scrollbarHide)
for (var t = c; t < c + 25; t++)
g[g.length] = e.hideScrollbarIntervalTimer(10 * t, f[c], (c + 24 - t) / 24, h, d, m, s, B, z, b)
},
hideScrollbarInterval: function(a, g, c, f, h, d, m, B, z) {
T =- 1 * a / s[B] * (h - d - m - f);
e.setSliderOffset("." + c, T);
b("." + c).css({
opacity: z.scrollbarOpacity * g,
filter: "alpha(opacity:" + 100 * z.scrollbarOpacity * g + ")"
})
},
slowScrollHorizontalInterval: function(a, g, c, f, h, d, N, O, L, K, t, w, x, y, v, q, G, p, n) {
if (n.infiniteSlider) {
if (c<=-1 * s[q]) {
var r = b(a).width();
if (c<=-1 * ua[q]) {
var u =- 1 * t[0];
b(g).each(function(c) {
e.setSliderOffset(b(g)[c], u + G);
c < w.length && (w[c] =- 1 * u);
u += v[c]
});
c +=- 1 * w[0];
m[q] =- 1 * w[0] + G;
s[q] = m[q] + r - d;
B[q] = 0
} else {
var k = 0, D = e.getSliderOffset(b(g[0]), "x");
b(g).each(function(b) {
e.getSliderOffset(this, "x") < D && (D = e.getSliderOffset(this, "x"), k = b)
});
x = m[q] + r;
e.setSliderOffset(b(g)[k], x);
m[q] =- 1 * w[1] + G;
s[q] = m[q] + r - d;
w.splice(0, 1);
w.splice(w.length, 0, - 1 * x + G);
B[q]++
}
}
if (c>=-1 * m[q] || 0 <= c) {
r = b(a).width();
if (0 <= c)
for (u =- 1 * t[0], b(g).each(function(c) {
e.setSliderOffset(b(g)[c], u + G);
c < w.length && (w[c] =- 1 * u);
u += v[c]
}), c-=-1 * w[0], m[q] =- 1 * w[0] + G, s[q] = m[q] + r - d, B[q] = y; 0<-1 * w[0] - r + G;) {
var A = 0, I = e.getSliderOffset(b(g[0]), "x");
b(g).each(function(c) {
e.getSliderOffset(this, "x") > I && (I = e.getSliderOffset(this, "x"), A = c)
});
x = m[q] - v[A];
e.setSliderOffset(b(g)[A], x);
w.splice(0, 0, - 1 * x + G);
w.splice(w.length - 1, 1);
m[q] =- 1 * w[0] + G;
s[q] = m[q] + r - d;
B[q]--;
z[q]++
}
0 > c && (A = 0, I = e.getSliderOffset(b(g[0]), "x"), b(g).each(function(c) {
e.getSliderOffset(this, "x") > I && (I = e.getSliderOffset(this, "x"), A = c)
}), x = m[q] - v[A], e.setSliderOffset(b(g)[A], x), w.splice(0, 0, - 1 * x + G), w.splice(w.length - 1, 1), m[q] =- 1 * w[0] + G, s[q] = m[q] + r - d, B[q]--)
}
}
t=!1;
d = e.calcActiveOffset(n, c, w, d, B[q], y, K, q);
x = (d + B[q] + y)%y;
n.infiniteSlider ? x != ba[q] && (t=!0) : d != z[q] && (t=!0);
if (t && (y = new e.args("change", n, a, b(a).children(":eq(" + x + ")"), x, p), b(a).parent().data("args", y), "" != n.onSlideChange))
n.onSlideChange(y);
z[q] = d;
ba[q] = x;
c = Math.floor(c);
e.setSliderOffset(a, c);
n.scrollbar && (T = Math.floor(( - 1 * c - m[q] + G) / (s[q] - m[q] + G) * (N - O - h)), a = h - L, c>=-1 * m[q] + G ? (a = h - L - - 1 * T, e.setSliderOffset(b("." + f), 0)) : (c<=-1 * s[q] + 1 && (a = N - O - L - T), e.setSliderOffset(b("." + f), T)), b("." + f).css({
width: a + "px"
}))
},
slowScrollHorizontal: function(a, g, c, f, h, d, N, O, L, K, t, w, x, y, v, q, G, p, n, r, u) {
var k = e.getSliderOffset(a, "x");
d = [];
var D = 0, A = 25 / 1024 * O;
frictionCoefficient = u.frictionCoefficient;
elasticFrictionCoefficient = u.elasticFrictionCoefficient;
snapFrictionCoefficient = u.snapFrictionCoefficient;
h > u.snapVelocityThreshold && u.snapToChildren&&!n ? D = 1 : h<-1 * u.snapVelocityThreshold && u.snapToChildren&&!n && (D =- 1);
h<-1 * A ? h =- 1 * A : h > A && (h = A);
b(a)[0] !== b(p)[0] && (D*=-1, h*=-2);
p = B[v];
if (u.infiniteSlider)
var I = m[v], l = s[v];
n = [];
for (var A = [], E = 0; E < x.length; E++)
n[E] = x[E], E < g.length && (A[E] = e.getSliderOffset(b(g[E]), "x"));
for (; 1 < h||-1 > h;) {
h*=frictionCoefficient;
k += h;
(k>-1 * m[v] || k<-1 * s[v])&&!u.infiniteSlider && (h*=elasticFrictionCoefficient, k += h);
if (u.infiniteSlider) {
if (k<=-1 * l) {
for (var l = b(a).width(), J = 0, P = A[0], E = 0; E < A.length; E++)
A[E] < P && (P = A[E], J = E);
E = I + l;
A[J] = E;
I =- 1 * n[1] + r;
l = I + l - O;
n.splice(0, 1);
n.splice(n.length, 0, - 1 * E + r);
p++
}
if (k>=-1 * I) {
l = b(a).width();
J = 0;
P = A[0];
for (E = 0; E < A.length; E++)
A[E] > P && (P = A[E], J = E);
E = I - y[J];
A[J] = E;
n.splice(0, 0, - 1 * E + r);
n.splice(n.length - 1, 1);
I =- 1 * n[0] + r;
l = I + l - O;
p--
}
}
d[d.length] = k
}
A=!1;
h = e.calcActiveOffset(u, k, n, O, p, G, z[v], v);
I = (h + p + G)%G;
u.snapToChildren && (u.infiniteSlider ? I != ba[v] && (A=!0) : h != z[v] && (A=!0), 0 > D&&!A ? (h++, h >= x.length&&!u.infiniteSlider && (h = x.length - 1)) : 0 < D&&!A && (h--, 0 > h&&!u.infiniteSlider && (h = 0)));
if (u.snapToChildren || (k>-1 * m[v] || k<-1 * s[v])&&!u.infiniteSlider) {
(k>-1 * m[v] || k<-1 * s[v])&&!u.infiniteSlider ? d.splice(0, d.length) : (d.splice(0.1 * d.length, d.length), k = 0 < d.length ? d[d.length - 1] : k);
for (; k < n[h] - 0.5 || k > n[h] + 0.5;)
k = (k - n[h]) * snapFrictionCoefficient + n[h], d[d.length] = k;
d[d.length] = n[h]
}
D = 1;
0 != d.length%2 && (D = 0);
for (k = 0; k < c.length; k++)
clearTimeout(c[k]);
p = (h + p + G)%G;
I = 0;
for (k = D; k < d.length; k += 2)
if (k == D || 1 < Math.abs(d[k] - I) || k >= d.length - 2)
I = d[k], c[c.length] = e.slowScrollHorizontalIntervalTimer(10 * k, a, g, d[k], f, N, O, L, K, t, h, w, x, q, G, y, v, r, p, u);
I = (h + B[v] + G)%G;
"" != u.onSlideComplete && 1 < d.length && (c[c.length] = e.onSlideCompleteTimer(10 * (k + 1), u, a, b(a).children(":eq(" + I + ")"), p, v));
$[v] = c;
e.hideScrollbar(u, c, k, d, f, N, O, K, t, v)
},
onSlideComplete: function(a, g, c, f, h) {
c = new e.args("complete", a, b(g), c, f, f);
b(g).parent().data("args", c);
if ("" != a.onSlideComplete)
a.onSlideComplete(c)
},
getSliderOffset: function(a, e) {
var c = 0;
e = "x" == e ? 4 : 5;
if (!ea || aa || X)
c = parseInt(b(a).css("left"), 10);
else {
for (var c = ["-webkit-transform", "-moz-transform", "transform"], f, h = 0; h < c.length; h++)
if (void 0 != b(a).css(c[h]) && 0 < b(a).css(c[h]).length) {
f = b(a).css(c[h]).split(",");
break
}
c = void 0 == f[e] ? 0 : parseInt(f[e], 10)
}
return c
},
setSliderOffset: function(a, e) {
e = parseInt(e, 10);
!ea || aa || X ? b(a).css({
left: e + "px"
}) : b(a).css({
webkitTransform: "matrix(1,0,0,1," + e + ",0)",
MozTransform: "matrix(1,0,0,1," + e + ",0)",
transform: "matrix(1,0,0,1," + e + ",0)"
})
},
setBrowserInfo: function() {
null != navigator.userAgent.match("WebKit") ? (ia = "-webkit-grab", sa = "-webkit-grabbing") : null != navigator.userAgent.match("Gecko") ? (ha=!0, ia = "move", sa = "-moz-grabbing") : null != navigator.userAgent.match("MSIE 7") ? oa = aa=!0 : null != navigator.userAgent.match("MSIE 8") ? oa = X=!0 : null != navigator.userAgent.match("MSIE 9") && (oa=!0)
},
has3DTransform: function() {
var a = !1, e = b("<div />").css({
webkitTransform: "matrix(1,1,1,1,1,1)",
MozTransform: "matrix(1,1,1,1,1,1)",
transform: "matrix(1,1,1,1,1,1)"
});
"" == e.attr("style") ? a=!1 : ha&&!za && 21 <= parseInt(navigator.userAgent.split("/")[3], 10) ? a=!1 : void 0 != e.attr("style") && (a=!0);
return a
},
getSlideNumber: function(b, e, c) {
return (b - B[e] + c)%c
},
calcActiveOffset: function(b, e, c, f, h, d, m, s) {
h=!1;
b = [];
var z;
e > c[0] && (z = 0);
e < c[c.length - 1] && (z = d - 1);
for (d = 0; d < c.length; d++)
c[d] <= e && c[d] > e - f && (h || c[d] == e || (b[b.length] = c[d - 1]), b[b.length] = c[d], h=!0);
0 == b.length && (b[0] = c[c.length - 1]);
for (d = h = 0; d < b.length; d++)
m = Math.abs(e - b[d]), m < f && (h = b[d], f = m);
for (d = 0; d < c.length; d++)
h == c[d] && (z = d);
return z
},
changeSlide: function(a, g, c, f, h, d, m, s, L, K, t, w, x, y, v, q, G, p) {
e.autoSlidePause(y);
for (var n = 0; n < f.length; n++)
clearTimeout(f[n]);
var r = Math.ceil(p.autoSlideTransTimer / 10) + 1, u = e.getSliderOffset(g, "x"), k = w[a], D = k - u;
if (p.infiniteSlider)
for (a = (a - B[y] + 2 * q)%q, n=!1, 0 == a && 2 == q && (a = q, w[a] = w[a - 1] - b(c).eq(0).outerWidth(!0), n=!0), k = w[a], D = k - u, k = [w[a] - b(g).width(), w[a] + b(g).width()], n && w.splice(w.length - 1, 1), n = 0; n < k.length; n++)
Math.abs(k[n] - u) < Math.abs(D) && (D = k[n] - u);
var k = [], A;
e.showScrollbar(p, h);
for (n = 0; n <= r; n++)
A = n, A/=r, A--, A = u + D * (Math.pow(A, 5) + 1), k[k.length] = A;
r = (a + B[y] + q)%q;
for (n = u = 0; n < k.length; n++) {
if (0 == n || 1 < Math.abs(k[n] - u) || n >= k.length - 2)
u = k[n], f[n] = e.slowScrollHorizontalIntervalTimer(10 * (n + 1), g, c, k[n], h, d, m, s, L, K, a, t, w, v, q, x, y, G, r, p);
0 == n && "" != p.onSlideStart && (D = (z[y] + B[y] + q)%q, p.onSlideStart(new e.args("start", p, g, b(g).children(":eq(" + D + ")"), D, a)))
}
u = !1;
p.infiniteSlider ? r != ba[y] && (u=!0) : a != z[y] && (u=!0);
u && "" != p.onSlideComplete && (f[f.length] = e.onSlideCompleteTimer(10 * (n + 1), p, g, b(g).children(":eq(" + r + ")"), r, y));
$[y] = f;
e.hideScrollbar(p, f, n, k, h, d, m, L, K, y);
e.autoSlide(g, c, f, h, d, m, s, L, K, t, w, x, y, v, q, G, p)
},
autoSlide: function(b, g, c, f, h, d, m, s, L, K, t, w, x, y, v, q, G) {
if (!J[x].autoSlide)
return !1;
e.autoSlidePause(x);
ja[x] = setTimeout(function() {
!G.infiniteSlider && z[x] > t.length - 1 && (z[x] -= v);
e.changeSlide((z[x] + B[x] + t.length + 1)%t.length, b, g, c, f, h, d, m, s, L, K, t, w, x, y, v, q, G);
e.autoSlide(b, g, c, f, h, d, m, s, L, K, t, w, x, y, v, q, G)
}, G.autoSlideTimer + G.autoSlideTransTimer)
},
autoSlidePause: function(b) {
clearTimeout(ja[b])
},
isUnselectable: function(a, e) {
return "" != e.unselectableSelector && 1 == b(a).closest(e.unselectableSelector).length?!0 : !1
},
slowScrollHorizontalIntervalTimer: function(b, g, c, f, h, d, m, s, z, B, t, w, x, y, v, q, G, p, n, r) {
return setTimeout(function() {
e.slowScrollHorizontalInterval(g, c, f, h, d, m, s, z, B, t, w, x, y, v, q, G, p, n, r)
}, b)
},
onSlideCompleteTimer: function(b, g, c, f, h, d) {
return setTimeout(function() {
e.onSlideComplete(g, c, f, h, d)
}, b)
},
hideScrollbarIntervalTimer: function(b, g, c, f, h, d, m, s, z, B) {
return setTimeout(function() {
e.hideScrollbarInterval(g, c, f, h, d, m, s, z, B)
}, b)
},
args: function(a, g, c, f, h, d) {
this.prevSlideNumber = void 0 == b(c).parent().data("args") ? void 0 : b(c).parent().data("args").prevSlideNumber;
this.prevSlideObject = void 0 == b(c).parent().data("args") ? void 0 : b(c).parent().data("args").prevSlideObject;
this.targetSlideNumber = d + 1;
this.targetSlideObject = b(c).children(":eq(" + d + ")");
this.slideChanged=!1;
"load" == a ? this.targetSlideObject = this.targetSlideNumber = void 0 : "start" == a ? this.targetSlideObject = this.targetSlideNumber = void 0 : "change" == a ? (this.slideChanged=!0, this.prevSlideNumber = void 0 == b(c).parent().data("args") ? g.startAtSlide : b(c).parent().data("args").currentSlideNumber, this.prevSlideObject = b(c).children(":eq(" + this.prevSlideNumber + ")")) : "complete" == a && (this.slideChanged = b(c).parent().data("args").slideChanged);
this.settings = g;
this.data = b(c).parent().data("iosslider");
this.sliderObject = c;
this.sliderContainerObject = b(c).parent();
this.currentSlideObject = f;
this.currentSlideNumber = h + 1;
this.currentSliderOffset =- 1 * e.getSliderOffset(c, "x")
},
preventDrag: function(b) {
b.preventDefault()
},
preventClick: function(b) {
b.stopImmediatePropagation();
return !1
},
enableClick: function() {
return !0
}
};
e.setBrowserInfo();
var V = {
init: function(a, g) {
ea = e.has3DTransform();
var c = b.extend(!0, {
elasticPullResistance: 0.6,
frictionCoefficient: 0.92,
elasticFrictionCoefficient: 0.6,
snapFrictionCoefficient: 0.92,
snapToChildren: !1,
snapSlideCenter: !1,
startAtSlide: 1,
scrollbar: !1,
scrollbarDrag: !1,
scrollbarHide: !0,
scrollbarLocation: "top",
scrollbarContainer: "",
scrollbarOpacity: 0.4,
scrollbarHeight: "4px",
scrollbarBorder: "0",
scrollbarMargin: "5px",
scrollbarBackground: "#000",
scrollbarBorderRadius: "100px",
scrollbarShadow: "0 0 0 #000",
scrollbarElasticPullResistance: 0.9,
desktopClickDrag: !1,
keyboardControls: !1,
tabToAdvance: !1,
responsiveSlideContainer: !0,
responsiveSlides: !0,
navSlideSelector: "",
navPrevSelector: "",
navNextSelector: "",
autoSlideToggleSelector: "",
autoSlide: !1,
autoSlideTimer: 5E3,
autoSlideTransTimer: 750,
autoSlideHoverPause: !0,
infiniteSlider: !1,
snapVelocityThreshold: 5,
slideStartVelocityThreshold: 0,
horizontalSlideLockThreshold: 5,
verticalSlideLockThreshold: 3,
stageCSS: {
position: "relative",
top: "0",
left: "0",
overflow: "hidden",
zIndex: 1
},
unselectableSelector: "",
onSliderLoaded: "",
onSliderUpdate: "",
onSliderResize: "",
onSlideStart: "",
onSlideChange: "",
onSlideComplete: ""
}, a);
void 0 == g && (g = this);
return b(g).each(function(a) {
function g() {
e.autoSlidePause(d);
va = b(F).find("a");
ja = b(F).find("[onclick]");
pa = b(F).find("*");
b(n).css("width", "");
b(n).css("height", "");
b(F).css("width", "");
C = b(F).children().not("script").get();
ga = [];
M = [];
c.responsiveSlides && b(C).css("width", "");
s[d] = 0;
l = [];
q = b(n).parent().width();
r = b(n).outerWidth(!0);
c.responsiveSlideContainer && (r = b(n).outerWidth(!0) > q ? q : b(n).width());
b(n).css({
position: c.stageCSS.position,
top: c.stageCSS.top,
left: c.stageCSS.left,
overflow: c.stageCSS.overflow,
zIndex: c.stageCSS.zIndex,
webkitPerspective: 1E3,
webkitBackfaceVisibility: "hidden",
msTouchAction: "pan-y",
width: r
});
b(c.unselectableSelector).css({
cursor: "default"
});
for (var a = 0; a < C.length; a++) {
ga[a] = b(C[a]).width();
M[a] = b(C[a]).outerWidth(!0);
var h = M[a];
c.responsiveSlides && (M[a] > r ? (h = r +- 1 * (M[a] - ga[a]), ga[a] = h, M[a] = r) : h = ga[a], b(C[a]).css({
width: h
}));
b(C[a]).css({
webkitBackfaceVisibility: "hidden",
overflow: "hidden",
position: "absolute"
});
l[a] =- 1 * s[d];
s[d] = s[d] + h + (M[a] - ga[a])
}
c.snapSlideCenter && (p = 0.5 * (r - M[0]), c.responsiveSlides && M[0] > r && (p = 0));
ua[d] = 2 * s[d];
for (a = 0; a < C.length; a++)
e.setSliderOffset(b(C[a]), - 1 * l[a] + s[d] + p), l[a] -= s[d];
if (!c.infiniteSlider&&!c.snapSlideCenter) {
for (a = 0; a < l.length&&!(l[a]<=-1 * (2 * s[d] - r)); a++)
ha = a;
l.splice(ha + 1, l.length);
l[l.length] =- 1 * (2 * s[d] - r)
}
for (a = 0; a < l.length; a++)
E[a] = l[a];
I && (J[d].startAtSlide = J[d].startAtSlide > l.length ? l.length : J[d].startAtSlide, c.infiniteSlider ? (J[d].startAtSlide = (J[d].startAtSlide - 1 + H)%H, z[d] = J[d].startAtSlide) : (J[d].startAtSlide = 0 > J[d].startAtSlide - 1 ? l.length - 1 : J[d].startAtSlide, z[d] = J[d].startAtSlide - 1), ba[d] = z[d]);
m[d] = s[d] + p;
b(F).css({
position: "relative",
cursor: ia,
webkitPerspective: "0",
webkitBackfaceVisibility: "hidden",
width: s[d] + "px"
});
R = s[d];
s[d] = 2 * s[d] - r + 2 * p;
(Y = R < r || 0 == r?!0 : !1) && b(F).css({
cursor: "default"
});
G = b(n).parent().outerHeight(!0);
u = b(n).height();
c.responsiveSlideContainer && (u = u > G ? G : u);
b(n).css({
height: u
});
e.setSliderOffset(F, l[z[d]]);
if (c.infiniteSlider&&!Y) {
a = e.getSliderOffset(b(F), "x");
for (h =- 1 * ((B[d] + H)%H); 0 > h;) {
var f = 0, A = e.getSliderOffset(b(C[0]), "x");
b(C).each(function(b) {
e.getSliderOffset(this, "x") < A && (A = e.getSliderOffset(this, "x"), f = b)
});
var L = m[d] + R;
e.setSliderOffset(b(C)[f], L);
m[d] =- 1 * l[1] + p;
s[d] = m[d] + R - r;
l.splice(0, 1);
l.splice(l.length, 0, - 1 * L + p);
h++
}
for (; 0<-1 * l[0] - R + p && c.snapSlideCenter && I;) {
var O = 0, P = e.getSliderOffset(b(C[0]), "x");
b(C).each(function(b) {
e.getSliderOffset(this, "x") > P && (P = e.getSliderOffset(this, "x"), O = b)
});
L = m[d] - M[O];
e.setSliderOffset(b(C)[O], L);
l.splice(0, 0, - 1 * L + p);
l.splice(l.length - 1, 1);
m[d] =- 1 * l[0] + p;
s[d] = m[d] + R - r;
B[d]--;
z[d]++
}
for (; a<=-1 * s[d];)
f = 0, A = e.getSliderOffset(b(C[0]), "x"), b(C).each(function(b) {
e.getSliderOffset(this, "x") < A && (A = e.getSliderOffset(this, "x"), f = b)
}), L = m[d] + R, e.setSliderOffset(b(C)[f], L), m[d] =- 1 * l[1] + p, s[d] = m[d] + R - r, l.splice(0, 1), l.splice(l.length, 0, - 1 * L + p), B[d]++, z[d]--
}
e.setSliderOffset(F, l[z[d]]);
c.desktopClickDrag || b(F).css({
cursor: "default"
});
c.scrollbar && (b("." + K).css({
margin: c.scrollbarMargin,
overflow: "hidden",
display: "none"
}), b("." + K + " ." + t).css({
border: c.scrollbarBorder
}), k = parseInt(b("." + K).css("marginLeft")) + parseInt(b("." + K).css("marginRight")), D = parseInt(b("." + K + " ." + t).css("borderLeftWidth"), 10) + parseInt(b("." + K + " ." + t).css("borderRightWidth"), 10), y = "" != c.scrollbarContainer ? b(c.scrollbarContainer).width() : r, v = r / R * (y - k), c.scrollbarHide || (V = c.scrollbarOpacity), b("." + K).css({
position: "absolute",
left: 0,
width: y - k + "px",
margin: c.scrollbarMargin
}), "top" == c.scrollbarLocation ? b("." + K).css("top", "0") : b("." + K).css("bottom", "0"), b("." + K + " ." + t).css({
borderRadius: c.scrollbarBorderRadius,
background: c.scrollbarBackground,
height: c.scrollbarHeight,
width: v - D + "px",
minWidth: c.scrollbarHeight,
border: c.scrollbarBorder,
webkitPerspective: 1E3,
webkitBackfaceVisibility: "hidden",
position: "relative",
opacity: V,
filter: "alpha(opacity:" + 100 * V + ")",
boxShadow: c.scrollbarShadow
}), e.setSliderOffset(b("." + K + " ." + t), Math.floor(( - 1 * l[z[d]] - m[d] + p) / (s[d] - m[d] + p) * (y - k - v))), b("." + K).css({
display: "block"
}), w = b("." + K + " ." + t), x = b("." + K));
c.scrollbarDrag&&!Y && b("." + K + " ." + t).css({
cursor: ia
});
c.infiniteSlider && (S = (s[d] + r) / 3);
"" != c.navSlideSelector && b(c.navSlideSelector).each(function(a) {
b(this).css({
cursor: "pointer"
});
b(this).unbind(Q).bind(Q, function(g) {
"touchstart" == g.type ? b(this).unbind("click.iosSliderEvent") : b(this).unbind("touchstart.iosSliderEvent");
Q = g.type + ".iosSliderEvent";
e.changeSlide(a, F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
})
});
"" != c.navPrevSelector && (b(c.navPrevSelector).css({
cursor: "pointer"
}), b(c.navPrevSelector).unbind(Q).bind(Q, function(a) {
"touchstart" == a.type ? b(this).unbind("click.iosSliderEvent") : b(this).unbind("touchstart.iosSliderEvent");
Q = a.type + ".iosSliderEvent";
a = (z[d] + B[d] + H)%H;
(0 < a || c.infiniteSlider) && e.changeSlide(a - 1, F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
}));
"" != c.navNextSelector && (b(c.navNextSelector).css({
cursor: "pointer"
}), b(c.navNextSelector).unbind(Q).bind(Q, function(a) {
"touchstart" == a.type ? b(this).unbind("click.iosSliderEvent") : b(this).unbind("touchstart.iosSliderEvent");
Q = a.type + ".iosSliderEvent";
a = (z[d] + B[d] + H)%H;
(a < l.length - 1 || c.infiniteSlider) && e.changeSlide(a + 1, F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
}));
c.autoSlide&&!Y && "" != c.autoSlideToggleSelector && (b(c.autoSlideToggleSelector).css({
cursor: "pointer"
}), b(c.autoSlideToggleSelector).unbind(Q).bind(Q, function(a) {
"touchstart" == a.type ? b(this).unbind("click.iosSliderEvent") : b(this).unbind("touchstart.iosSliderEvent");
Q = a.type + ".iosSliderEvent";
wa ? (e.autoSlide(F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c), wa=!1, b(c.autoSlideToggleSelector).removeClass("on")) : (e.autoSlidePause(d), wa=!0, b(c.autoSlideToggleSelector).addClass("on"))
}));
e.autoSlide(F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c);
b(n).bind("mouseleave.iosSliderEvent", function() {
e.autoSlide(F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
});
b(n).bind("touchend.iosSliderEvent", function() {
e.autoSlide(F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
});
c.autoSlideHoverPause && b(n).bind("mouseenter.iosSliderEvent", function() {
e.autoSlidePause(d)
});
b(n).data("iosslider", {
obj: Aa,
settings: c,
scrollerNode: F,
slideNodes: C,
numberOfSlides: H,
centeredSlideOffset: p,
sliderNumber: d,
originalOffsets: E,
childrenOffsets: l,
sliderMax: s[d],
scrollbarClass: t,
scrollbarWidth: v,
scrollbarStageWidth: y,
stageWidth: r,
scrollMargin: k,
scrollBorder: D,
infiniteSliderOffset: B[d],
infiniteSliderWidth: S,
slideNodeOuterWidths: M
});
I = !1;
return !0
}
na++;
var d = na, N = [];
J[d] = b.extend({}, c);
m[d] = 0;
s[d] = 0;
var O = [0, 0], L = [0, 0], K = "scrollbarBlock" + na, t = "scrollbar" + na, w, x, y, v, q, G, p = 0, n = b(this), r, u, k, D, A, I=!0;
a =- 1;
var l, E = [], V = 0, P = 0, ea = 0, F = b(this).children(":first-child"), C, ga, M, H = b(F).children().not("script").length, U=!1, ha = 0, xa=!1, qa = void 0, S;
B[d] = 0;
var Y=!1, wa=!1;
ta[d]=!1;
var Z, ra=!1, ka=!1, Q = "touchstart.iosSliderEvent click.iosSliderEvent", R, va, ja, pa;
fa[d]=!1;
$[d] = [];
c.scrollbarDrag && (c.scrollbar=!0, c.scrollbarHide=!1);
var Aa = b(this);
if (void 0 != Aa.data("iosslider")
)return !0;
b(this).find("img").bind("dragstart.iosSliderEvent", function(b) {
b.preventDefault()
});
c.infiniteSlider && (c.scrollbar=!1);
c.infiniteSlider && 1 == H && (c.infiniteSlider=!1);
c.scrollbar && ("" != c.scrollbarContainer ? b(c.scrollbarContainer).append("<div class = '" + K + "'><div class = '" + t + "'></div></div>") : b(F).parent().append("<div class = '" + K + "'><div class = '" + t + "'></div></div>"));
if (!g())
return !0;
b(this).find("a").bind("mousedown", e.preventDrag);
b(this).find("[onclick]").bind("click", e.preventDrag).each(function() {
b(this).data("onclick", this.onclick)
});
a = e.calcActiveOffset(c, e.getSliderOffset(b(F), "x"), l, r, B[d], H, void 0, d);
a = (a + B[d] + H)%H;
a = new e.args("load", c, F, b(F).children(":eq(" + a + ")"), a, a);
b(n).data("args", a);
if ("" != c.onSliderLoaded)
c.onSliderLoaded(a);
if (J[d].responsiveSlides || J[d].responsiveSlideContainer)
a = Ba ? "orientationchange" : "resize", b(window).bind(a + ".iosSliderEvent-" + d, function() {
if (!g())
return !0;
var a = b(n).data("args");
if ("" != c.onSliderResize)
c.onSliderResize(a)
});
!c.keyboardControls&&!c.tabToAdvance || Y || b(document).bind("keydown.iosSliderEvent", function(b) {
aa || X || (b = b.originalEvent);
if (37 == b.keyCode && c.keyboardControls)
b.preventDefault(), b = (z[d] + B[d] + H)%H, (0 < b || c.infiniteSlider) && e.changeSlide(b - 1, F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c);
else if (39 == b.keyCode && c.keyboardControls || 9 == b.keyCode && c.tabToAdvance)
b.preventDefault(), b = (z[d] + B[d] + H)%H, (b < l.length - 1 || c.infiniteSlider) && e.changeSlide(b + 1, F, C, N, t, v, r, y, k, D, E, l, M, d, S, H, p, c)
});
if (za || c.desktopClickDrag) {
var ca = !1, la = b(F), ma = b(F), ya=!1;
c.scrollbarDrag && (la = la.add(w), ma = ma.add(x));
b(la).bind("mousedown.iosSliderEvent touchstart.iosSliderEvent", function(a) {
if (ca)
return !0;
ca=!0;
"touchstart" == a.type ? b(ma).unbind("mousedown.iosSliderEvent") : b(ma).unbind("touchstart.iosSliderEvent");
if (fa[d] || Y || (ya = e.isUnselectable(a.target, c)))
return U = ca=!1, !0;
Z = b(this)[0] === b(w)[0] ? w : F;
aa || X || (a = a.originalEvent);
e.autoSlidePause(d);
pa.unbind(".disableClick");
if ("touchstart" == a.type)
eventX = a.touches[0].pageX, eventY = a.touches[0].pageY;
else {
if (window.getSelection)
window.getSelection().empty ? window.getSelection().empty() : window.getSelection().removeAllRanges && window.getSelection().removeAllRanges();
else if (document.selection)
if (X)
try {
document.selection.empty()
} catch (g) {} else
document.selection.empty();
eventX = a.pageX;
eventY = a.pageY;
xa=!0;
qa = F;
b(this).css({
cursor: sa
})
}
O = [0, 0];
L = [0, 0];
W = 0;
U=!1;
for (a = 0; a < N.length; a++)
clearTimeout(N[a]);
a = e.getSliderOffset(F, "x");
a>-1 * m[d] + p + R ? (a =- 1 * m[d] + p + R, e.setSliderOffset(b("." + t), a), b("." + t).css({
width: v - D + "px"
})) : a<-1 * s[d] && (e.setSliderOffset(b("." + t), y - k - v), b("." + t).css({
width: v - D + "px"
}));
a = b(this)[0] === b(w)[0] ? m[d] : 0;
P =- 1 * (e.getSliderOffset(this, "x") - eventX - a);
e.getSliderOffset(this, "y");
O[1] = eventX;
L[1] = eventY;
ka=!1
});
b(ma).bind("touchmove.iosSliderEvent mousemove.iosSliderEvent", function(a) {
aa || X || (a = a.originalEvent);
if (fa[d] || Y || ya)
return !0;
var g = 0;
if ("touchmove" == a.type)
eventX = a.touches[0].pageX, eventY = a.touches[0].pageY;
else {
if (window.getSelection)
window.getSelection().empty || window.getSelection().removeAllRanges && window.getSelection().removeAllRanges();
else if (document.selection)
if (X)
try {
document.selection.empty()
} catch (h) {} else
document.selection.empty();
eventX = a.pageX;
eventY = a.pageY;
if (!xa ||!oa && ("undefined" != typeof a.webkitMovementX || "undefined" != typeof a.webkitMovementY) && 0 === a.webkitMovementY && 0 === a.webkitMovementX)
return !0
}
O[0] = O[1];
O[1] = eventX;
W = (O[1] - O[0]) / 2;
L[0] = L[1];
L[1] = eventY;
da = (L[1] - L[0]) / 2;
if (!U) {
var f = (z[d] + B[d] + H)%H, f = new e.args("start", c, F, b(F).children(":eq(" + f + ")"), f, void 0);
b(n).data("args", f);
if ("" != c.onSlideStart)
c.onSlideStart(f)
}(da > c.verticalSlideLockThreshold || da<-1 * c.verticalSlideLockThreshold) && "touchmove" == a.type&&!U && (ra=!0);
(W > c.horizontalSlideLockThreshold || W<-1 * c.horizontalSlideLockThreshold) && "touchmove" == a.type && a.preventDefault();
if (W > c.slideStartVelocityThreshold || W<-1 * c.slideStartVelocityThreshold)
U=!0;
if (U&&!ra) {
var f = e.getSliderOffset(F, "x"), q = b(Z)[0] === b(w)[0] ? m[d]: p, u = b(Z)[0] === b(w)[0] ? (m[d] - s[d] - p) / (y - k - v): 1, x = b(Z)[0] === b(w)[0] ? c.scrollbarElasticPullResistance: c.elasticPullResistance, G = c.snapSlideCenter && b(Z)[0] === b(w)[0] ? 0: p, K = c.snapSlideCenter && b(Z)[0] === b(w)[0] ? p: 0;
"touchmove" == a.type && (ea != a.touches.length && (P =- 1 * f + eventX), ea = a.touches.length);
if (c.infiniteSlider) {
if (f<=-1 * s[d]) {
var I = b(F).width();
if (f<=-1 * ua[d]) {
var J =- 1 * E[0];
b(C).each(function(a) {
e.setSliderOffset(b(C)[a], J + p);
a < l.length && (l[a] =- 1 * J);
J += M[a]
});
P-=-1 * l[0];
m[d] =- 1 * l[0] + p;
s[d] = m[d] + I - r;
B[d] = 0
} else {
var N = 0, S = e.getSliderOffset(b(C[0]), "x");
b(C).each(function(b) {
e.getSliderOffset(this, "x") < S && (S = e.getSliderOffset(this, "x"), N = b)
});
x = m[d] + I;
e.setSliderOffset(b(C)[N], x);
m[d] =- 1 * l[1] + p;
s[d] = m[d] + I - r;
l.splice(0, 1);
l.splice(l.length, 0, - 1 * x + p);
B[d]++
}
}
if (f>=-1 * m[d] || 0 <= f)
if (I = b(F).width(), 0 <= f)
for (J =- 1 * E[0], b(C).each(function(a) {
e.setSliderOffset(b(C)[a], J + p);
a < l.length && (l[a] =- 1 * J);
J += M[a]
}), P +=- 1 * l[0], m[d] =- 1 * l[0] + p, s[d] = m[d] + I - r, B[d] = H; 0<-1 * l[0] - I + p;) {
var Q = 0, R = e.getSliderOffset(b(C[0]), "x");
b(C).each(function(b) {
e.getSliderOffset(this, "x") > R && (R = e.getSliderOffset(this, "x"), Q = b)
});
x = m[d] - M[Q];
e.setSliderOffset(b(C)[Q], x);
l.splice(0, 0, - 1 * x + p);
l.splice(l.length - 1, 1);
m[d] =- 1 * l[0] + p;
s[d] = m[d] + I - r;
B[d]--;
z[d]++
} else
Q = 0, R = e.getSliderOffset(b(C[0]), "x"), b(C).each(function(b) {
e.getSliderOffset(this, "x") > R && (R = e.getSliderOffset(this, "x"), Q = b)
}), x = m[d] - M[Q], e.setSliderOffset(b(C)[Q], x), l.splice(0, 0, - 1 * x + p), l.splice(l.length - 1, 1), m[d] =- 1 * l[0] + p, s[d] = m[d] + I - r, B[d]--
} else
I = b(F).width(), f>-1 * m[d] + p && (g =- 1 * (m[d] +- 1 * (P - q - eventX + G) * u - q) * x / u), f<-1 * s[d] && (g =- 1 * (s[d] + K +- 1 * (P - q - eventX) * u - q) * x / u);
e.setSliderOffset(F, - 1 * (P - q - eventX - g) * u - q + K);
c.scrollbar && (e.showScrollbar(c, t), T = Math.floor((P - eventX - g - m[d] + G) / (s[d] - m[d] + p) * (y - k - v) * u), f = v, 0 >= T ? (f = v - D - - 1 * T, e.setSliderOffset(b("." + t), 0), b("." + t).css({
width: f + "px"
})) : T >= y - k - D - v ? (f = y - k - D - T, e.setSliderOffset(b("." + t), T), b("." + t).css({
width: f + "px"
})) : e.setSliderOffset(b("." + t), T));
"touchmove" == a.type && (A = a.touches[0].pageX);
a=!1;
g = e.calcActiveOffset(c, - 1 * (P - eventX - g), l, r, B[d], H, void 0, d);
f = (g + B[d] + H)%H;
c.infiniteSlider ? f != ba[d] && (a=!0) : g != z[d] && (a=!0);
if (a && (z[d] = g, ba[d] = f, ka=!0, f = new e.args("change", c, F, b(F).children(":eq(" + f + ")"), f, f), b(n).data("args", f), "" != c.onSlideChange))
c.onSlideChange(f)
}
ca=!1
});
a = b(window);
if (X || aa)
a = b(document);
b(la).bind("touchend.iosSliderEvent", function(b) {
b = b.originalEvent;
if (fa[d] || Y || ya)
return !0;
if (0 != b.touches.length)
for (var a = 0; a < b.touches.length; a++)
b.touches[a].pageX == A && e.slowScrollHorizontal(F, C, N, t, W, da, v, r, y, k, D, E, l, M, d, S, H, Z, ka, p, c);
else
e.slowScrollHorizontal(F, C, N, t, W, da, v, r, y, k, D, E, l, M, d, S, H, Z, ka, p, c);
ca = ra=!1
});
b(a).bind("mouseup.iosSliderEvent-" + d, function(a) {
U ? va.unbind("click.disableClick").bind("click.disableClick", e.preventClick) : va.unbind("click.disableClick").bind("click.disableClick", e.enableClick);
ja.each(function() {
this.onclick = function(a) {
if (U)
return !1;
b(this).data("onclick").call(this, a || window.event)
};
this.onclick = b(this).data("onclick")
});
1.8 <= parseFloat(b().jquery) ? pa.each(function() {
var a = b._data(this, "events");
if (void 0 != a && void 0 != a.click && "iosSliderEvent" != a.click[0].namespace) {
if (!U)
return !1;
b(this).one("click.disableClick", e.preventClick);
var a = b._data(this, "events").click, c = a.pop();
a.splice(0, 0, c)
}
}) : 1.6 <= parseFloat(b().jquery) && pa.each(function() {
var a = b(this).data("events");
if (void 0 != a && void 0 != a.click && "iosSliderEvent" != a.click[0].namespace) {
if (!U)
return !1;
b(this).one("click.disableClick", e.preventClick);
var a = b(this).data("events").click, c = a.pop();
a.splice(0, 0, c)
}
});
if (!ta[d]) {
if (Y)
return !0;
b(la).css({
cursor: ia
});
xa=!1;
if (void 0 == qa)
return !0;
e.slowScrollHorizontal(qa, C, N, t, W, da, v, r, y, k, D, E, l, M, d, S, H, Z, ka, p, c);
qa = void 0
}
ca = ra=!1
})
}
})
},
destroy: function(a, g) {
void 0 == g && (g = this);
return b(g).each(function() {
var c = b(this), f = c.data("iosslider");
if (void 0 == f)
return !1;
void 0 == a && (a=!0);
e.autoSlidePause(f.sliderNumber);
ta[f.sliderNumber]=!0;
b(window).unbind(".iosSliderEvent-" + f.sliderNumber);
b(document).unbind(".iosSliderEvent-" + f.sliderNumber);
b(document).unbind("keydown.iosSliderEvent");
b(this).unbind(".iosSliderEvent");
b(this).children(":first-child").unbind(".iosSliderEvent");
b(this).children(":first-child").children().unbind(".iosSliderEvent");
a && (b(this).attr("style", ""), b(this).children(":first-child").attr("style", ""), b(this).children(":first-child").children().attr("style", ""), b(f.settings.navSlideSelector).attr("style", ""), b(f.settings.navPrevSelector).attr("style", ""), b(f.settings.navNextSelector).attr("style", ""), b(f.settings.autoSlideToggleSelector).attr("style", ""), b(f.settings.unselectableSelector).attr("style", ""));
f.settings.scrollbar && b(".scrollbarBlock" + f.sliderNumber).remove();
for (var f = $[f.sliderNumber], g = 0; g < f.length; g++)
clearTimeout(f[g]);
c.removeData("iosslider");
c.removeData("args")
})
},
update: function(a) {
void 0 == a && (a = this);
return b(a).each(function() {
var a = b(this), c = a.data("iosslider");
if (void 0 == c)
return !1;
c.settings.startAtSlide = a.data("args").currentSlideNumber;
V.destroy(!1, this);
1 != c.numberOfSlides && c.settings.infiniteSlider && (c.settings.startAtSlide = (z[c.sliderNumber] + 1 + B[c.sliderNumber] + c.numberOfSlides)%c.numberOfSlides);
V.init(c.settings, this);
a = new e.args("update", c.settings, c.scrollerNode, b(c.scrollerNode).children(":eq(" + (c.settings.startAtSlide - 1) + ")"), c.settings.startAtSlide - 1, c.settings.startAtSlide - 1);
b(c.stageNode).data("args", a);
if ("" != c.settings.onSliderUpdate)
c.settings.onSliderUpdate(a)
})
},
addSlide: function(a, e) {
return this.each(function() {
var c = b(this), f = c.data("iosslider");
if (void 0 == f)
return !1;
0 == b(f.scrollerNode).children().length ? (b(f.scrollerNode).append(a), c.data("args").currentSlideNumber = 1) : f.settings.infiniteSlider ? (1 == e ? b(f.scrollerNode).children(":eq(0)").before(a) : b(f.scrollerNode).children(":eq(" + (e - 2) + ")").after(a), - 1 > B[f.sliderNumber] && z[f.sliderNumber]--, c.data("args").currentSlideNumber >= e && z[f.sliderNumber]++) : (e <= f.numberOfSlides ? b(f.scrollerNode).children(":eq(" + (e - 1) + ")").before(a) : b(f.scrollerNode).children(":eq(" + (e - 2) + ")").after(a), c.data("args").currentSlideNumber >= e && c.data("args").currentSlideNumber++);
c.data("iosslider").numberOfSlides++;
V.update(this)
})
},
removeSlide: function(a) {
return this.each(function() {
var e = b(this).data("iosslider");
if (void 0 == e)
return !1;
b(e.scrollerNode).children(":eq(" + (a - 1) + ")").remove();
z[e.sliderNumber] > a - 1 && z[e.sliderNumber]--;
V.update(this)
})
},
goToSlide: function(a, g) {
void 0 == g && (g = this);
return b(g).each(function() {
var c = b(this).data("iosslider");
if (void 0 == c)
return !1;
a = a > c.childrenOffsets.length ? c.childrenOffsets.length - 1 : a - 1;
e.changeSlide(a, b(c.scrollerNode), b(c.slideNodes), $[c.sliderNumber], c.scrollbarClass, c.scrollbarWidth, c.stageWidth, c.scrollbarStageWidth, c.scrollMargin, c.scrollBorder, c.originalOffsets, c.childrenOffsets, c.slideNodeOuterWidths, c.sliderNumber, c.infiniteSliderWidth, c.numberOfSlides, c.centeredSlideOffset, c.settings)
})
},
prevSlide: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
var g = (z[a.sliderNumber] + B[a.sliderNumber] + a.numberOfSlides)%a.numberOfSlides;
(0 < g || a.settings.infiniteSlider) && e.changeSlide(g - 1, b(a.scrollerNode), b(a.slideNodes), $[a.sliderNumber], a.scrollbarClass, a.scrollbarWidth, a.stageWidth, a.scrollbarStageWidth, a.scrollMargin, a.scrollBorder, a.originalOffsets, a.childrenOffsets, a.slideNodeOuterWidths, a.sliderNumber, a.infiniteSliderWidth, a.numberOfSlides, a.centeredSlideOffset, a.settings);
z[a.sliderNumber] = g
})
},
nextSlide: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
var g = (z[a.sliderNumber] + B[a.sliderNumber] + a.numberOfSlides)%a.numberOfSlides;
(g < a.childrenOffsets.length - 1 || a.settings.infiniteSlider) && e.changeSlide(g + 1, b(a.scrollerNode), b(a.slideNodes), $[a.sliderNumber], a.scrollbarClass, a.scrollbarWidth, a.stageWidth, a.scrollbarStageWidth, a.scrollMargin, a.scrollBorder, a.originalOffsets, a.childrenOffsets, a.slideNodeOuterWidths, a.sliderNumber, a.infiniteSliderWidth, a.numberOfSlides, a.centeredSlideOffset, a.settings);
z[a.sliderNumber] = g
})
},
lock: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
fa[a.sliderNumber]=!0
})
},
unlock: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
fa[a.sliderNumber] = !1
})
},
getData: function() {
return this.each(function() {
var a = b(this).data("iosslider");
return void 0 == a?!1 : a
})
},
autoSlidePause: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
J[a.sliderNumber].autoSlide=!1;
e.autoSlidePause(a.sliderNumber);
return a
})
},
autoSlidePlay: function() {
return this.each(function() {
var a = b(this).data("iosslider");
if (void 0 == a)
return !1;
J[a.sliderNumber].autoSlide=!0;
e.autoSlide(b(a.scrollerNode), b(a.slideNodes), $[a.sliderNumber], a.scrollbarClass, a.scrollbarWidth, a.stageWidth, a.scrollbarStageWidth, a.scrollMargin, a.scrollBorder, a.originalOffsets, a.childrenOffsets, a.slideNodeOuterWidths, a.sliderNumber, a.infiniteSliderWidth, a.numberOfSlides, a.centeredSlideOffset, a.settings);
return a
})
}
};
b.fn.iosSlider = function(a) {
if (V[a])
return V[a].apply(this, Array.prototype.slice.call(arguments, 1));
if ("object" !== typeof a && a)
b.error("invalid method call!");
else
return V.init.apply(this, arguments)
}
})(jQuery);
// jQuery Plugins
// Remove whitespace
(function(a) {
a.fn.removeWhitespace = function() {
this.contents().filter(function() {
return this.nodeType == 3&&!/\S/.test(this.nodeValue)
}).remove();
return this
}
})(jQuery)
/*!
*
* jQuery collagePlus Plugin v0.3.3
* https://github.com/ed-lea/jquery-collagePlus
*
* Copyright 2012, Ed Lea twitter.com/ed_lea
*
* built for http://qiip.me
*
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*
*/
;
(function(e) {
e.fn.collagePlus = function(t) {
function n(t, n, i, s) {
var o = i.padding * (t.length - 1) + t.length * t[0][3], u = i.albumWidth - o, a = u / (n - o), f = o, l = n < i.albumWidth ? true: false;
for (var c = 0; c < t.length; c++) {
var h = e(t[c][0]), p = Math.floor(t[c][1] * a), d = Math.floor(t[c][2] * a), v=!!(c < t.length - 1);
if (i.allowPartialLastRow === true && l === true) {
p = t[c][1];
d = t[c][2]
}
f += p;
if (!v && f < i.albumWidth) {
if (i.allowPartialLastRow === true && l === true) {
p = p
} else {
p = p + (i.albumWidth - f)
}
}
p--;
var m = h.is("img") ? h: h.find("img");
m.width(p);
if (!h.is("img")) {
h.width(p + t[c][3])
}
m.height(d);
if (!h.is("img")) {
h.height(d + t[c][4])
}
r(h, v, i);
m.one("load", function(e) {
return function() {
if (i.effect == "default") {
e.animate({
opacity: "1"
}, {
duration: i.fadeSpeed
})
} else {
if (i.direction == "vertical") {
var t = s <= 10 ? s: 10
} else {
var t = c <= 9 ? c + 1: 10
}
e.removeClass(function(e, t) {
return (t.match(/\beffect-\S+/g) || []).join(" ")
});
e.addClass(i.effect);
e.addClass("effect-duration-" + t)
}
}
}(h)).each(function() {
if (this.complete)
e(this).trigger("load")
})
}
}
function r(e, t, n) {
var r = {
"margin-bottom": n.padding + "px",
"margin-right": t ? n.padding + "px": "0px",
display: n.display,
"vertical-align": "bottom",
overflow: "hidden"
};
return e.css(r)
}
function i(t) {
$img = e(t);
var n = new Array;
n["w"] = parseFloat($img.css("border-left-width")) + parseFloat($img.css("border-right-width"));
n["h"] = parseFloat($img.css("border-top-width")) + parseFloat($img.css("border-bottom-width"));
return n
}
return this.each(function() {
var r = 0, s = [], o = 1, u = e(this);
e.fn.collagePlus.defaults.albumWidth = u.width();
e.fn.collagePlus.defaults.padding = parseFloat(u.css("padding-left"));
e.fn.collagePlus.defaults.images = u.children();
var a = e.extend({}, e.fn.collagePlus.defaults, t);
a.images.each(function(t) {
var u = e(this), f = u.is("img") ? u: e(this).find("img");
var l = typeof f.data("width") != "undefined" ? f.data("width"): f.width(), c = typeof f.data("height") != "undefined" ? f.data("height"): f.height();
var h = i(f);
f.data("width", l);
f.data("height", c);
var p = Math.ceil(l / c * a.targetHeight), d = Math.ceil(a.targetHeight);
s.push([this, p, d, h["w"], h["h"]]);
r += p + h["w"] + a.padding;
if (r > a.albumWidth && s.length != 0) {
n(s, r - a.padding, a, o);
delete r;
delete s;
r = 0;
s = [];
o += 1
}
if (a.images.length - 1 == t && s.length != 0) {
n(s, r, a, o);
delete r;
delete s;
r = 0;
s = [];
o += 1
}
})
})
};
e.fn.collagePlus.defaults = {
targetHeight: 400,
fadeSpeed: "fast",
display: "inline-block",
effect: "default",
direction: "vertical",
allowPartialLastRow: false
}
})(jQuery);
/**
* photoset-grid - v1.0.1
* 2014-04-08
* jQuery plugin to arrange images into a flexible grid
* http://stylehatch.github.com/photoset-grid/
*
* Copyright 2014 Jonathan Moore - Style Hatch
*/
!function(a, b, c, d) {
"use strict";
function e(b, c) {
this.element = b, this.options = a.extend({}, g, c), this._defaults = g, this._name = f, this.init()
}
var f = "photosetGrid", g = {
width: "100%",
gutter: "0px",
highresLinks: !1,
lowresWidth: 500,
rel: "",
onInit: function() {},
onComplete: function() {}
};
e.prototype = {
init: function() {
this.options.onInit(), this._setupRows(this.element, this.options), this._setupColumns(this.element, this.options)
},
_callback: function(a) {
this.options.onComplete(a)
},
_setupRows: function(b, c) {
if (c.layout)
this.layout = c.layout;
else if (a(b).attr("data-layout"))
this.layout = a(b).attr("data-layout");
else {
for (var d = "", e = 1, f = 0; f < a(b).find("img").length; f++)
d += e.toString();
this.layout = d
}
this.rows = this.layout.split("");
for (var g in this.rows)
this.rows[g] = parseInt(this.rows[g], 10);
var h = a(b).find("img"), i = 0;
a.each(this.rows, function(a, b) {
var c = i, d = i + b;
h.slice(c, d).wrapAll('<div class="photoset-row cols-' + b + '"></div>'), i = d
}), a(b).find(".photoset-row:not(:last-child)").css({
"margin-bottom": c.gutter
})
},
_setupColumns: function(c, d) {
var e = this, f = function(e) {
function f() {
var b = a(c).width().toString();
b !== a(c).attr("data-width") && (g.each(function() {
var b = a(this).find("img:eq(0)");
a(this).find("img").each(function() {
var c = a(this);
c.attr("height") < b.attr("height") && (b = a(this)), parseInt(c.css("width"), 10) > d.lowresWidth && c.attr("data-highres") && c.attr("src", c.attr("data-highres"))
});
var c = b.attr("height") * parseInt(b.css("width"), 10) / b.attr("width"), e = Math.floor(.025 * c);
a(this).height(c - e), a(this).find("img").each(function() {
var b = a(this).attr("height") * parseInt(a(this).css("width"), 10) / a(this).attr("width"), d = .5 * (c - b) + "px";
a(this).css({
"margin-top": d
})
})
}), a(c).attr("data-width", b))
}
var g = a(c).find(".photoset-row"), h = a(c).find("img");
d.highresLinks ? (h.each(function() {
var b;
b = a(this).attr(a(this).attr("data-highres") ? "data-highres" : "src"), a(this).wrapAll('<a href="' + b + '" class="photoset-cell highres-link" />')
}), d.rel && h.parent().attr("rel", d.rel)) : h.each(function() {
a(this).wrapAll('<div class="photoset-cell" />')
});
var i = a(c).find(".photoset-cell"), j = a(c).find(".cols-1 .photoset-cell"), k = a(c).find(".cols-2 .photoset-cell"), l = a(c).find(".cols-3 .photoset-cell"), m = a(c).find(".cols-4 .photoset-cell"), n = a(c).find(".cols-5 .photoset-cell");
a(c).css({
width: d.width
}), g.css({
clear: "left",
display: "block",
overflow: "hidden"
}), i.css({
"float": "left",
display: "block",
"line-height": "0",
"-webkit-box-sizing": "border-box",
"-moz-box-sizing": "border-box",
"box-sizing": "border-box"
}), h.css({
width: "100%",
height: "auto"
}), e && h.each(function() {
a(this).attr("height", a(this).height()), a(this).attr("width", a(this).width())
}), j.css({
width: "100%"
}), k.css({
width: "50%"
}), l.css({
width: "33.3%"
}), m.css({
width: "25%"
}), n.css({
width: "20%"
});
var o = parseInt(d.gutter, 10);
a(c).find(".photoset-cell:not(:last-child)").css({
"padding-right": o / 2 + "px"
}), a(c).find(".photoset-cell:not(:first-child)").css({
"padding-left": o / 2 + "px"
}), f(), a(b).on("resize", function() {
f()
})
}, g=!0, h=!0;
a(c).find("img").each(function() {
h&=!!a(this).attr("height")&!!a(this).attr("width")
}), g=!h, g ? a(c).imagesLoaded(function() {
f(g), e._callback(c)
}) : (f(g), e._callback(c))
}
}, a.fn[f] = function(b) {
return this.each(function() {
a.data(this, "plugin_" + f) || a.data(this, "plugin_" + f, new e(this, b))
})
};
var h = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
a.fn.imagesLoaded = function(b) {
function c() {
var c = a(m), d = a(n);
i && (n.length ? i.reject(k, c, d) : i.resolve(k)), a.isFunction(b) && b.call(g, k, c, d)
}
function e(a) {
f(a.target, "error" === a.type)
}
function f(b, d) {
b.src !== h&&-1 === a.inArray(b, l) && (l.push(b), d ? n.push(b) : m.push(b), a.data(b, "imagesLoaded", {
isBroken: d,
src: b.src
}), j && i.notifyWith(a(b), [d, k, a(m), a(n)]), k.length === l.length && (setTimeout(c), k.unbind(".imagesLoaded", e)))
}
var g = this, i = a.isFunction(a.Deferred) ? a.Deferred(): 0, j = a.isFunction(i.notify), k = g.find("img").add(g.filter("img")), l = [], m = [], n = [];
return a.isPlainObject(b) && a.each(b, function(a, c) {
"callback" === a ? b = c : i && i[a](c)
}), k.length ? k.bind("load.imagesLoaded error.imagesLoaded", e).each(function(b, c) {
var e = c.src, g = a.data(c, "imagesLoaded");
return g && g.src === e ? void f(c, g.isBroken) : c.complete && c.naturalWidth !== d ? void f(c, 0 === c.naturalWidth || 0 === c.naturalHeight) : void((c.readyState || c.complete) && (c.src = h, c.src = e))
}) : c(), i ? i.promise(g) : g
};
var i, j, k, l = a.event, m = {
_: 0
}, n = 0;
i = l.special.throttledresize = {
setup: function() {
a(this).on("resize", i.handler)
},
teardown: function() {
a(this).off("resize", i.handler)
},
handler: function(b, c) {
var d = this, e = arguments;
j=!0, k || (setInterval(function() {
n++, (n > i.threshold && j || c) && (b.type = "throttledresize", l.dispatch.apply(d, e), j=!1, n = 0), n > 9 && (a(m).stop(), k=!1, n = 0)
}, 30), k=!0)
},
threshold: 0
}
}(jQuery, window, document);
/*
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function(b, c) {
var $ = b.jQuery || b.Cowboy || (b.Cowboy = {}), a;
$.throttle = a = function(e, f, j, i) {
var h, d = 0;
if (typeof f !== "boolean") {
i = j;
j = f;
f = c
}
function g() {
var o = this, m =+ new Date() - d, n = arguments;
function l() {
d =+ new Date();
j.apply(o, n)
}
function k() {
h = c
}
if (i&&!h) {
l()
}
h && clearTimeout(h);
if (i === c && m > e) {
l()
} else {
if (f !== true) {
h = setTimeout(i ? k : l, i === c ? e - m : e)
}
}
}
if ($.guid) {
g.guid = j.guid = j.guid || $.guid++
}
return g
};
$.debounce = function(d, e, f) {
return f === c ? a(d, e, false) : a(d, f, e !== false)
}
})(this);
var Plugins;
(function (Plugins) {
var AutosizeInput = (function () {
function AutosizeInput(input, options) {
var _this = this;
this._input = $(input);
this._options = options;
this._mirror = $('<span style="position:absolute; top:-999px; left:0; white-space:pre;"/>');
$.each(['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'letterSpacing', 'textTransform', 'wordSpacing', 'textIndent'], function (i, val) {
_this._mirror[0].style[val] = _this._input.css(val);
});
$("body").append(this._mirror);
this._input.on("keydown keyup input propertychange change", function (e) {
_this.update();
});
(function () {
_this.update();
})();
}
Object.defineProperty(AutosizeInput.prototype, "options", {
get: function () {
return this._options;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutosizeInput, "instanceKey", {
get: function () {
return "autosizeInputInstance";
},
enumerable: true,
configurable: true
});
AutosizeInput.prototype.update = function () {
var value = this._input.val();
if (!value) {
value = this._input.attr("placeholder") || "";
}
if (value === this._mirror.text()) {
return;
}
this._mirror.text(value);
var newWidth = this._mirror.width() + this._options.space;
this._input.width(newWidth);
};
return AutosizeInput;
})();
Plugins.AutosizeInput = AutosizeInput;
var AutosizeInputOptions = (function () {
function AutosizeInputOptions(space) {
if (typeof space === "undefined") {
space = 30;
}
this._space = space;
}
Object.defineProperty(AutosizeInputOptions.prototype, "space", {
get: function () {
return this._space;
},
set: function (value) {
this._space = value;
},
enumerable: true,
configurable: true
});
return AutosizeInputOptions;
})();
Plugins.AutosizeInputOptions = AutosizeInputOptions;
(function ($) {
var pluginDataAttributeName = "autosize-input";
var validTypes = ["text", "password", "search", "url", "tel", "email"];
$.fn.autosizeInput = function (options) {
return this.each(function () {
if (!(this.tagName == "INPUT" && $.inArray(this.type, validTypes) > - 1)) {
return;
}
var $this = $(this);
if (!$this.data(Plugins.AutosizeInput.instanceKey)) {
if (options == undefined) {
var options = $this.data(pluginDataAttributeName);
if (!(options && typeof options == 'object')) {
options = new AutosizeInputOptions();
}
}
$this.data(Plugins.AutosizeInput.instanceKey, new Plugins.AutosizeInput(this, options));
}
});
};
$(function () {
$("input[data-" + pluginDataAttributeName + "]").autosizeInput();
});
})(jQuery);
})(Plugins || (Plugins = {}));
// Generated by CoffeeScript 1.6.2
/*
jQuery Waypoints - v2.0.4
Copyright (c) 2011-2014 Caleb Troughton
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
*/
(function() {
var t = [].indexOf || function(t) {
for (var e = 0, n = this.length; e < n; e++) {
if (e in this && this[e] === t)
return e
}
return - 1
}, e = [].slice;
(function(t, e) {
if (typeof define === "function" && define.amd) {
return define("waypoints", ["jquery"], function(n) {
return e(n, t)
})
} else {
return e(t.jQuery, t)
}
})(this, function(n, r) {
var i, o, l, s, f, u, c, a, h, d, p, y, v, w, g, m;
i = n(r);
a = t.call(r, "ontouchstart") >= 0;
s = {
horizontal: {},
vertical: {}
};
f = 1;
c = {};
u = "waypoints-context-id";
p = "resize.waypoints";
y = "scroll.waypoints";
v = 1;
w = "waypoints-waypoint-ids";
g = "waypoint";
m = "waypoints";
o = function() {
function t(t) {
var e = this;
this.$element = t;
this.element = t[0];
this.didResize = false;
this.didScroll = false;
this.id = "context" + f++;
this.oldScroll = {
x: t.scrollLeft(),
y: t.scrollTop()
};
this.waypoints = {
horizontal: {},
vertical: {}
};
this.element[u] = this.id;
c[this.id] = this;
t.bind(y, function() {
var t;
if (!(e.didScroll || a)) {
e.didScroll = true;
t = function() {
e.doScroll();
return e.didScroll = false
};
return r.setTimeout(t, n[m].settings.scrollThrottle)
}
});
t.bind(p, function() {
var t;
if (!e.didResize) {
e.didResize = true;
t = function() {
n[m]("refresh");
return e.didResize = false
};
return r.setTimeout(t, n[m].settings.resizeThrottle)
}
})
}
t.prototype.doScroll = function() {
var t, e = this;
t = {
horizontal: {
newScroll: this.$element.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: "right",
backward: "left"
},
vertical: {
newScroll: this.$element.scrollTop(),
oldScroll: this.oldScroll.y,
forward: "down",
backward: "up"
}
};
if (a && (!t.vertical.oldScroll ||!t.vertical.newScroll)) {
n[m]("refresh")
}
n.each(t, function(t, r) {
var i, o, l;
l = [];
o = r.newScroll > r.oldScroll;
i = o ? r.forward : r.backward;
n.each(e.waypoints[t], function(t, e) {
var n, i;
if (r.oldScroll < (n = e.offset) && n <= r.newScroll) {
return l.push(e)
} else if (r.newScroll < (i = e.offset) && i <= r.oldScroll) {
return l.push(e)
}
});
l.sort(function(t, e) {
return t.offset - e.offset
});
if (!o) {
l.reverse()
}
return n.each(l, function(t, e) {
if (e.options.continuous || t === l.length - 1) {
return e.trigger([i])
}
})
});
return this.oldScroll = {
x: t.horizontal.newScroll,
y: t.vertical.newScroll
}
};
t.prototype.refresh = function() {
var t, e, r, i = this;
r = n.isWindow(this.element);
e = this.$element.offset();
this.doScroll();
t = {
horizontal: {
contextOffset: r ? 0: e.left,
contextScroll: r ? 0: this.oldScroll.x,
contextDimension: this.$element.width(),
oldScroll: this.oldScroll.x,
forward: "right",
backward: "left",
offsetProp: "left"
},
vertical: {
contextOffset: r ? 0: e.top,
contextScroll: r ? 0: this.oldScroll.y,
contextDimension: r ? n[m]("viewportHeight"): this.$element.height(),
oldScroll: this.oldScroll.y,
forward: "down",
backward: "up",
offsetProp: "top"
}
};
return n.each(t, function(t, e) {
return n.each(i.waypoints[t], function(t, r) {
var i, o, l, s, f;
i = r.options.offset;
l = r.offset;
o = n.isWindow(r.element) ? 0 : r.$element.offset()[e.offsetProp];
if (n.isFunction(i)) {
i = i.apply(r.element)
} else if (typeof i === "string") {
i = parseFloat(i);
if (r.options.offset.indexOf("%")>-1) {
i = Math.ceil(e.contextDimension * i / 100)
}
}
r.offset = o - e.contextOffset + e.contextScroll - i;
if (r.options.onlyOnScroll && l != null ||!r.enabled) {
return
}
if (l !== null && l < (s = e.oldScroll) && s <= r.offset) {
return r.trigger([e.backward])
} else if (l !== null && l > (f = e.oldScroll) && f >= r.offset) {
return r.trigger([e.forward])
} else if (l === null && e.oldScroll >= r.offset) {
return r.trigger([e.forward])
}
})
})
};
t.prototype.checkEmpty = function() {
if (n.isEmptyObject(this.waypoints.horizontal) && n.isEmptyObject(this.waypoints.vertical)) {
this.$element.unbind([p, y].join(" "));
return delete c[this.id]
}
};
return t
}();
l = function() {
function t(t, e, r) {
var i, o;
r = n.extend({}, n.fn[g].defaults, r);
if (r.offset === "bottom-in-view") {
r.offset = function() {
var t;
t = n[m]("viewportHeight");
if (!n.isWindow(e.element)) {
t = e.$element.height()
}
return t - n(this).outerHeight()
}
}
this.$element = t;
this.element = t[0];
this.axis = r.horizontal ? "horizontal" : "vertical";
this.callback = r.handler;
this.context = e;
this.enabled = r.enabled;
this.id = "waypoints" + v++;
this.offset = null;
this.options = r;
e.waypoints[this.axis][this.id] = this;
s[this.axis][this.id] = this;
i = (o = this.element[w]) != null ? o : [];
i.push(this.id);
this.element[w] = i
}
t.prototype.trigger = function(t) {
if (!this.enabled) {
return
}
if (this.callback != null) {
this.callback.apply(this.element, t)
}
if (this.options.triggerOnce) {
return this.destroy()
}
};
t.prototype.disable = function() {
return this.enabled = false
};
t.prototype.enable = function() {
this.context.refresh();
return this.enabled = true
};
t.prototype.destroy = function() {
delete s[this.axis][this.id];
delete this.context.waypoints[this.axis][this.id];
return this.context.checkEmpty()
};
t.getWaypointsByElement = function(t) {
var e, r;
r = t[w];
if (!r) {
return []
}
e = n.extend({}, s.horizontal, s.vertical);
return n.map(r, function(t) {
return e[t]
})
};
return t
}();
d = {
init: function(t, e) {
var r;
if (e == null) {
e = {}
}
if ((r = e.handler) == null) {
e.handler = t
}
this.each(function() {
var t, r, i, s;
t = n(this);
i = (s = e.context) != null ? s : n.fn[g].defaults.context;
if (!n.isWindow(i)) {
i = t.closest(i)
}
i = n(i);
r = c[i[0][u]];
if (!r) {
r = new o(i)
}
return new l(t, r, e)
});
n[m]("refresh");
return this
},
disable: function() {
return d._invoke.call(this, "disable")
},
enable: function() {
return d._invoke.call(this, "enable")
},
destroy: function() {
return d._invoke.call(this, "destroy")
},
prev: function(t, e) {
return d._traverse.call(this, t, e, function(t, e, n) {
if (e > 0) {
return t.push(n[e - 1])
}
})
},
next: function(t, e) {
return d._traverse.call(this, t, e, function(t, e, n) {
if (e < n.length - 1) {
return t.push(n[e + 1])
}
})
},
_traverse: function(t, e, i) {
var o, l;
if (t == null) {
t = "vertical"
}
if (e == null) {
e = r
}
l = h.aggregate(e);
o = [];
this.each(function() {
var e;
e = n.inArray(this, l[t]);
return i(o, e, l[t])
});
return this.pushStack(o)
},
_invoke: function(t) {
this.each(function() {
var e;
e = l.getWaypointsByElement(this);
return n.each(e, function(e, n) {
n[t]();
return true
})
});
return this
}
};
n.fn[g] = function() {
var t, r;
r = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
if (d[r]) {
return d[r].apply(this, t)
} else if (n.isFunction(r)) {
return d.init.apply(this, arguments)
} else if (n.isPlainObject(r)) {
return d.init.apply(this, [null, r])
} else if (!r) {
return n.error("jQuery Waypoints needs a callback function or handler option.")
} else {
return n.error("The " + r + " method does not exist in jQuery Waypoints.")
}
};
n.fn[g].defaults = {
context: r,
continuous: true,
enabled: true,
horizontal: false,
offset: 0,
triggerOnce: false
};
h = {
refresh: function() {
return n.each(c, function(t, e) {
return e.refresh()
})
},
viewportHeight: function() {
var t;
return (t = r.innerHeight) != null ? t : i.height()
},
aggregate: function(t) {
var e, r, i;
e = s;
if (t) {
e = (i = c[n(t)[0][u]]) != null ? i.waypoints : void 0
}
if (!e) {
return []
}
r = {
horizontal: [],
vertical: []
};
n.each(r, function(t, i) {
n.each(e[t], function(t, e) {
return i.push(e)
});
i.sort(function(t, e) {
return t.offset - e.offset
});
r[t] = n.map(i, function(t) {
return t.element
});
return r[t] = n.unique(r[t])
});
return r
},
above: function(t) {
if (t == null) {
t = r
}
return h._filter(t, "vertical", function(t, e) {
return e.offset <= t.oldScroll.y
})
},
below: function(t) {
if (t == null) {
t = r
}
return h._filter(t, "vertical", function(t, e) {
return e.offset > t.oldScroll.y
})
},
left: function(t) {
if (t == null) {
t = r
}
return h._filter(t, "horizontal", function(t, e) {
return e.offset <= t.oldScroll.x
})
},
right: function(t) {
if (t == null) {
t = r
}
return h._filter(t, "horizontal", function(t, e) {
return e.offset > t.oldScroll.x
})
},
enable: function() {
return h._invoke("enable")
},
disable: function() {
return h._invoke("disable")
},
destroy: function() {
return h._invoke("destroy")
},
extendFn: function(t, e) {
return d[t] = e
},
_invoke: function(t) {
var e;
e = n.extend({}, s.vertical, s.horizontal);
return n.each(e, function(e, n) {
n[t]();
return true
})
},
_filter: function(t, e, r) {
var i, o;
i = c[n(t)[0][u]];
if (!i) {
return []
}
o = [];
n.each(i.waypoints[e], function(t, e) {
if (r(i, e)) {
return o.push(e)
}
});
o.sort(function(t, e) {
return t.offset - e.offset
});
return n.map(o, function(t) {
return t.element
})
}
};
n[m] = function() {
var t, n;
n = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
if (h[n]) {
return h[n].apply(null, t)
} else {
return h.aggregate.call(null, n)
}
};
n[m].settings = {
resizeThrottle: 100,
scrollThrottle: 30
};
return i.load(function() {
return n[m]("refresh")
})
})
}).call(this);
/**
* Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Licensed under MIT
* @author Ariel Flesler
* @version 1.4.11
*/
;
(function(a) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], a)
} else {
a(jQuery)
}
}(function($) {
var j = $.scrollTo = function(a, b, c) {
return $(window).scrollTo(a, b, c)
};
j.defaults = {
axis: 'xy',
duration: parseFloat($.fn.jquery) >= 1.3 ? 0: 1,
limit: true
};
j.window = function(a) {
return $(window)._scrollable()
};
$.fn._scrollable = function() {
return this.map(function() {
var a = this, isWin=!a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body'])!=-1;
if (!isWin)
return a;
var b = (a.contentWindow || a).document || a.ownerDocument || a;
return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement
})
};
$.fn.scrollTo = function(f, g, h) {
if (typeof g == 'object') {
h = g;
g = 0
}
if (typeof h == 'function')
h = {
onAfter: h
};
if (f == 'max')
f = 9e9;
h = $.extend({}, j.defaults, h);
g = g || h.duration;
h.queue = h.queue && h.axis.length > 1;
if (h.queue)
g/=2;
h.offset = both(h.offset);
h.over = both(h.over);
return this._scrollable().each(function() {
if (f == null)
return;
var d = this, $elem = $(d), targ = f, toff, attr = {}, win = $elem.is('html,body');
switch (typeof targ) {
case'number':
case'string':
if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
targ = both(targ);
break
}
targ = $(targ, this);
if (!targ.length)
return;
case'object':
if (targ.is || targ.style)
toff = (targ = $(targ)).offset()
}
var e = $.isFunction(h.offset) && h.offset(d, targ) || h.offset;
$.each(h.axis.split(''), function(i, a) {
var b = a == 'x' ? 'Left': 'Top', pos = b.toLowerCase(), key = 'scroll' + b, old = d[key], max = j.max(d, a);
if (toff) {
attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
if (h.margin) {
attr[key] -= parseInt(targ.css('margin' + b)) || 0;
attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0
}
attr[key] += e[pos] || 0;
if (h.over[pos])
attr[key] += targ[a == 'x' ? 'width': 'height']() * h.over[pos]
} else {
var c = targ[pos];
attr[key] = c.slice && c.slice( - 1) == '%' ? parseFloat(c) / 100 * max : c
}
if (h.limit && /^\d+$/.test(attr[key]))
attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
if (!i && h.queue) {
if (old != attr[key])
animate(h.onAfterFirst);
delete attr[key]
}
});
animate(h.onAfter);
function animate(a) {
$elem.animate(attr, g, h.easing, a && function() {
a.call(this, targ, h)
})
}
}).end()
};
j.max = function(a, b) {
var c = b == 'x' ? 'Width': 'Height', scroll = 'scroll' + c;
if (!$(a).is('html,body'))
return a[scroll] - $(a)[c.toLowerCase()]();
var d = 'client' + c, html = a.ownerDocument.documentElement, body = a.ownerDocument.body;
return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])
};
function both(a) {
return $.isFunction(a) || typeof a == 'object' ? a : {
top: a,
left: a
}
};
return j
}));
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c * (t/=d) * t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return - c * (t/=d) * (t - 2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d / 2) < 1)
return c / 2 * t * t + b;
return - c / 2 * ((--t) * (t - 2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c * (t/=d) * t * t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c * ((t = t / d - 1) * t * t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d / 2) < 1)
return c / 2 * t * t * t + b;
return c / 2 * ((t -= 2) * t * t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c * (t/=d) * t * t * t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return - c * ((t = t / d - 1) * t * t * t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d / 2) < 1)
return c / 2 * t * t * t * t + b;
return - c / 2 * ((t -= 2) * t * t * t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c * (t/=d) * t * t * t * t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d / 2) < 1)
return c / 2 * t * t * t * t * t + b;
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return - c * Math.cos(t / d * (Math.PI / 2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t / d * (Math.PI / 2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return - c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t == d) ? b + c : c * ( - Math.pow(2, - 10 * t / d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t == 0)
return b;
if (t == d)
return b + c;
if ((t/=d / 2) < 1)
return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
return c / 2 * ( - Math.pow(2, - 10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return - c * (Math.sqrt(1 - (t/=d) * t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d / 2) < 1)
return - c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s = 1.70158;
var p = 0;
var a = c;
if (t == 0)
return b;
if ((t/=d) == 1)
return b + c;
if (!p)
p = d * .3;
if (a < Math.abs(c)) {
a = c;
var s = p / 4;
} else
var s = p / (2 * Math.PI) * Math.asin (c / a);
return - (a * Math.pow(2, 10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s = 1.70158;
var p = 0;
var a = c;
if (t == 0)
return b;
if ((t/=d) == 1)
return b + c;
if (!p)
p = d * .3;
if (a < Math.abs(c)) {
a = c;
var s = p / 4;
} else
var s = p / (2 * Math.PI) * Math.asin (c / a);
return a * Math.pow(2, - 10 * t) * Math.sin( (t * d - s) * (2 * Math.PI) / p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s = 1.70158;
var p = 0;
var a = c;
if (t == 0)
return b;
if ((t/=d / 2) == 2)
return b + c;
if (!p)
p = d * (.3 * 1.5);
if (a < Math.abs(c)) {
a = c;
var s = p / 4;
} else
var s = p / (2 * Math.PI) * Math.asin (c / a);
if (t < 1)
return - .5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p )) + b;
return a * Math.pow(2, - 10 * (t -= 1)) * Math.sin( (t * d - s) * (2 * Math.PI) / p ) * .5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined)
s = 1.70158;
return c * (t/=d) * t * ((s + 1) * t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined)
s = 1.70158;
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined)
s = 1.70158;
if ((t/=d / 2) < 1)
return c / 2 * (t * t * (((s*=(1.525)) + 1) * t - s)) + b;
return c / 2 * ((t -= 2) * t * (((s*=(1.525)) + 1) * t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d - t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1 / 2.75)) {
return c * (7.5625 * t * t) + b;
} else if (t < (2 / 2.75)) {
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
} else if (t < (2.5 / 2.75)) {
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
} else {
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d / 2)
return jQuery.easing.easeInBounce (x, t * 2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
Copyright 2012 Igor Vaynberg
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.
You may obtain a copy of the Apache License and the GPL License at:
http://www.apache.org/licenses/LICENSE-2.0
http://www.gnu.org/licenses/gpl-2.0.html
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the Apache License and the GPL License for the specific language governing
permissions and limitations under the Apache License and the GPL License.
*/
!function(a) {
"undefined" == typeof a.fn.each2 && a.extend(a.fn, {
each2: function(b) {
for (var c = a([0]), d =- 1, e = this.length; ++d < e && (c.context = c[0] = this[d]) && b.call(c[0], d, c)!==!1;);
return this
}
})
}(jQuery), function(a, b) {
"use strict";
function n(a) {
var b, c, d, e;
if (!a || a.length < 1)
return a;
for (b = "", c = 0, d = a.length; d > c; c++)
e = a.charAt(c), b += m[e] || e;
return b
}
function o(a, b) {
for (var c = 0, d = b.length; d > c; c += 1)
if (q(a, b[c]))
return c;
return - 1
}
function p() {
var b = a(l);
b.appendTo("body");
var c = {
width: b.width() - b[0].clientWidth,
height: b.height() - b[0].clientHeight
};
return b.remove(), c
}
function q(a, c) {
return a === c?!0 : a === b || c === b?!1 : null === a || null === c?!1 : a.constructor === String ? a + "" == c + "" : c.constructor === String ? c + "" == a + "" : !1
}
function r(b, c) {
var d, e, f;
if (null === b || b.length < 1)
return [];
for (d = b.split(c), e = 0, f = d.length; f > e; e += 1)
d[e] = a.trim(d[e]);
return d
}
function s(a) {
return a.outerWidth(!1) - a.width()
}
function t(c) {
var d = "keyup-change-value";
c.on("keydown", function() {
a.data(c, d) === b && a.data(c, d, c.val())
}), c.on("keyup", function() {
var e = a.data(c, d);
e !== b && c.val() !== e && (a.removeData(c, d), c.trigger("keyup-change"))
})
}
function u(c) {
c.on("mousemove", function(c) {
var d = i;
(d === b || d.x !== c.pageX || d.y !== c.pageY) && a(c.target).trigger("mousemove-filtered", c)
})
}
function v(a, c, d) {
d = d || b;
var e;
return function() {
var b = arguments;
window.clearTimeout(e), e = window.setTimeout(function() {
c.apply(d, b)
}, a)
}
}
function w(a) {
var c, b=!1;
return function() {
return b===!1 && (c = a(), b=!0), c
}
}
function x(a, b) {
var c = v(a, function(a) {
b.trigger("scroll-debounced", a)
});
b.on("scroll", function(a) {
o(a.target, b.get()) >= 0 && c(a)
})
}
function y(a) {
a[0] !== document.activeElement && window.setTimeout(function() {
var d, b = a[0], c = a.val().length;
a.focus(), a.is(":visible") && b === document.activeElement && (b.setSelectionRange ? b.setSelectionRange(c, c) : b.createTextRange && (d = b.createTextRange(), d.collapse(!1), d.select()))
}, 0)
}
function z(b) {
b = a(b)[0];
var c = 0, d = 0;
if ("selectionStart"in b)
c = b.selectionStart, d = b.selectionEnd - c;
else if ("selection"in document) {
b.focus();
var e = document.selection.createRange();
d = document.selection.createRange().text.length, e.moveStart("character", - b.value.length), c = e.text.length - d
}
return {
offset: c,
length: d
}
}
function A(a) {
a.preventDefault(), a.stopPropagation()
}
function B(a) {
a.preventDefault(), a.stopImmediatePropagation()
}
function C(b) {
if (!h) {
var c = b[0].currentStyle || window.getComputedStyle(b[0], null);
h = a(document.createElement("div")).css({
position: "absolute",
left: "-10000px",
top: "-10000px",
display: "none",
fontSize: c.fontSize,
fontFamily: c.fontFamily,
fontStyle: c.fontStyle,
fontWeight: c.fontWeight,
letterSpacing: c.letterSpacing,
textTransform: c.textTransform,
whiteSpace: "nowrap"
}), h.attr("class", "select2-sizer"), a("body").append(h)
}
return h.text(b.val()), h.width()
}
function D(b, c, d) {
var e, g, f = [];
e = b.attr("class"), e && (e = "" + e, a(e.split(" ")).each2(function() {
0 === this.indexOf("select2-") && f.push(this)
})), e = c.attr("class"), e && (e = "" + e, a(e.split(" ")).each2(function() {
0 !== this.indexOf("select2-") && (g = d(this), g && f.push(g))
})), b.attr("class", f.join(" "))
}
function E(a, b, c, d) {
var e = n(a.toUpperCase()).indexOf(n(b.toUpperCase())), f = b.length;
return 0 > e ? (c.push(d(a)), void 0) : (c.push(d(a.substring(0, e))), c.push("<span class='select2-match'>"), c.push(d(a.substring(e, e + f))), c.push("</span>"), c.push(d(a.substring(e + f, a.length))), void 0)
}
function F(a) {
var b = {
"\\": "&#92;",
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#47;"
};
return String(a).replace(/[&<>"'\/\\]/g, function(a) {
return b[a]
})
}
function G(c) {
var d, e = null, f = c.quietMillis || 100, g = c.url, h = this;
return function(i) {
window.clearTimeout(d), d = window.setTimeout(function() {
var d = c.data, f = g, j = c.transport || a.fn.select2.ajaxDefaults.transport, k = {
type: c.type || "GET",
cache: c.cache ||!1,
jsonpCallback: c.jsonpCallback || b,
dataType: c.dataType || "json"
}, l = a.extend({}, a.fn.select2.ajaxDefaults.params, k);
d = d ? d.call(h, i.term, i.page, i.context) : null, f = "function" == typeof f ? f.call(h, i.term, i.page, i.context) : f, e && e.abort(), c.params && (a.isFunction(c.params) ? a.extend(l, c.params.call(h)) : a.extend(l, c.params)), a.extend(l, {
url: f,
dataType: c.dataType,
data: d,
success: function(a) {
var b = c.results(a, i.page);
i.callback(b)
}
}), e = j.call(h, l)
}, f)
}
}
function H(b) {
var d, e, c = b, f = function(a) {
return "" + a.text
};
a.isArray(c) && (e = c, c = {
results: e
}), a.isFunction(c)===!1 && (e = c, c = function() {
return e
});
var g = c();
return g.text && (f = g.text, a.isFunction(f) || (d = g.text, f = function(a) {
return a[d]
})), function(b) {
var g, d = b.term, e = {
results: []
};
return "" === d ? (b.callback(c()), void 0) : (g = function(c, e) {
var h, i;
if (c = c[0], c.children) {
h = {};
for (i in c)
c.hasOwnProperty(i) && (h[i] = c[i]);
h.children = [], a(c.children).each2(function(a, b) {
g(b, h.children)
}), (h.children.length || b.matcher(d, f(h), c)) && e.push(h)
} else
b.matcher(d, f(c), c) && e.push(c)
}, a(c().results).each2(function(a, b) {
g(b, e.results)
}), b.callback(e), void 0)
}
}
function I(c) {
var d = a.isFunction(c);
return function(e) {
var f = e.term, g = {
results: []
};
a(d ? c() : c).each(function() {
var a = this.text !== b, c = a ? this.text: this;
("" === f || e.matcher(f, c)) && g.results.push(a ? this : {
id: this,
text: this
})
}), e.callback(g)
}
}
function J(b, c) {
if (a.isFunction(b))
return !0;
if (!b)
return !1;
throw new Error(c + " must be a function or a falsy value")
}
function K(b) {
return a.isFunction(b) ? b() : b
}
function L(b) {
var c = 0;
return a.each(b, function(a, b) {
b.children ? c += L(b.children) : c++
}), c
}
function M(a, c, d, e) {
var h, i, j, k, l, f = a, g=!1;
if (!e.createSearchChoice ||!e.tokenSeparators || e.tokenSeparators.length < 1)
return b;
for (; ;) {
for (i =- 1, j = 0, k = e.tokenSeparators.length; k > j && (l = e.tokenSeparators[j], i = a.indexOf(l), !(i >= 0)); j++);
if (0 > i)
break;
if (h = a.substring(0, i), a = a.substring(i + l.length), h.length > 0 && (h = e.createSearchChoice.call(this, h, c), h !== b && null !== h && e.id(h) !== b && null !== e.id(h))) {
for (g=!1, j = 0, k = c.length; k > j; j++)
if (q(e.id(h), e.id(c[j]))) {
g=!0;
break
}
g || d(h)
}
}
return f !== a ? a : void 0
}
function N(b, c) {
var d = function() {};
return d.prototype = new b, d.prototype.constructor = d, d.prototype.parent = b.prototype, d.prototype = a.extend(d.prototype, c), d
}
if (window.Select2 === b) {
var c, d, e, f, g, h, j, k, i = {
x: 0,
y: 0
}, c = {
TAB: 9,
ENTER: 13,
ESC: 27,
SPACE: 32,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAGE_UP: 33,
PAGE_DOWN: 34,
HOME: 36,
END: 35,
BACKSPACE: 8,
DELETE: 46,
isArrow: function(a) {
switch (a = a.which ? a.which : a) {
case c.LEFT:
case c.RIGHT:
case c.UP:
case c.DOWN:
return !0
}
return !1
},
isControl: function(a) {
var b = a.which;
switch (b) {
case c.SHIFT:
case c.CTRL:
case c.ALT:
return !0
}
return a.metaKey?!0 : !1
},
isFunctionKey: function(a) {
return a = a.which ? a.which : a, a >= 112 && 123 >= a
}
}, l = "<div class='select2-measure-scrollbar'></div>", m = {
"\u24b6": "A",
"\uff21": "A",
"\xc0": "A",
"\xc1": "A",
"\xc2": "A",
"\u1ea6": "A",
"\u1ea4": "A",
"\u1eaa": "A",
"\u1ea8": "A",
"\xc3": "A",
"\u0100": "A",
"\u0102": "A",
"\u1eb0": "A",
"\u1eae": "A",
"\u1eb4": "A",
"\u1eb2": "A",
"\u0226": "A",
"\u01e0": "A",
"\xc4": "A",
"\u01de": "A",
"\u1ea2": "A",
"\xc5": "A",
"\u01fa": "A",
"\u01cd": "A",
"\u0200": "A",
"\u0202": "A",
"\u1ea0": "A",
"\u1eac": "A",
"\u1eb6": "A",
"\u1e00": "A",
"\u0104": "A",
"\u023a": "A",
"\u2c6f": "A",
"\ua732": "AA",
"\xc6": "AE",
"\u01fc": "AE",
"\u01e2": "AE",
"\ua734": "AO",
"\ua736": "AU",
"\ua738": "AV",
"\ua73a": "AV",
"\ua73c": "AY",
"\u24b7": "B",
"\uff22": "B",
"\u1e02": "B",
"\u1e04": "B",
"\u1e06": "B",
"\u0243": "B",
"\u0182": "B",
"\u0181": "B",
"\u24b8": "C",
"\uff23": "C",
"\u0106": "C",
"\u0108": "C",
"\u010a": "C",
"\u010c": "C",
"\xc7": "C",
"\u1e08": "C",
"\u0187": "C",
"\u023b": "C",
"\ua73e": "C",
"\u24b9": "D",
"\uff24": "D",
"\u1e0a": "D",
"\u010e": "D",
"\u1e0c": "D",
"\u1e10": "D",
"\u1e12": "D",
"\u1e0e": "D",
"\u0110": "D",
"\u018b": "D",
"\u018a": "D",
"\u0189": "D",
"\ua779": "D",
"\u01f1": "DZ",
"\u01c4": "DZ",
"\u01f2": "Dz",
"\u01c5": "Dz",
"\u24ba": "E",
"\uff25": "E",
"\xc8": "E",
"\xc9": "E",
"\xca": "E",
"\u1ec0": "E",
"\u1ebe": "E",
"\u1ec4": "E",
"\u1ec2": "E",
"\u1ebc": "E",
"\u0112": "E",
"\u1e14": "E",
"\u1e16": "E",
"\u0114": "E",
"\u0116": "E",
"\xcb": "E",
"\u1eba": "E",
"\u011a": "E",
"\u0204": "E",
"\u0206": "E",
"\u1eb8": "E",
"\u1ec6": "E",
"\u0228": "E",
"\u1e1c": "E",
"\u0118": "E",
"\u1e18": "E",
"\u1e1a": "E",
"\u0190": "E",
"\u018e": "E",
"\u24bb": "F",
"\uff26": "F",
"\u1e1e": "F",
"\u0191": "F",
"\ua77b": "F",
"\u24bc": "G",
"\uff27": "G",
"\u01f4": "G",
"\u011c": "G",
"\u1e20": "G",
"\u011e": "G",
"\u0120": "G",
"\u01e6": "G",
"\u0122": "G",
"\u01e4": "G",
"\u0193": "G",
"\ua7a0": "G",
"\ua77d": "G",
"\ua77e": "G",
"\u24bd": "H",
"\uff28": "H",
"\u0124": "H",
"\u1e22": "H",
"\u1e26": "H",
"\u021e": "H",
"\u1e24": "H",
"\u1e28": "H",
"\u1e2a": "H",
"\u0126": "H",
"\u2c67": "H",
"\u2c75": "H",
"\ua78d": "H",
"\u24be": "I",
"\uff29": "I",
"\xcc": "I",
"\xcd": "I",
"\xce": "I",
"\u0128": "I",
"\u012a": "I",
"\u012c": "I",
"\u0130": "I",
"\xcf": "I",
"\u1e2e": "I",
"\u1ec8": "I",
"\u01cf": "I",
"\u0208": "I",
"\u020a": "I",
"\u1eca": "I",
"\u012e": "I",
"\u1e2c": "I",
"\u0197": "I",
"\u24bf": "J",
"\uff2a": "J",
"\u0134": "J",
"\u0248": "J",
"\u24c0": "K",
"\uff2b": "K",
"\u1e30": "K",
"\u01e8": "K",
"\u1e32": "K",
"\u0136": "K",
"\u1e34": "K",
"\u0198": "K",
"\u2c69": "K",
"\ua740": "K",
"\ua742": "K",
"\ua744": "K",
"\ua7a2": "K",
"\u24c1": "L",
"\uff2c": "L",
"\u013f": "L",
"\u0139": "L",
"\u013d": "L",
"\u1e36": "L",
"\u1e38": "L",
"\u013b": "L",
"\u1e3c": "L",
"\u1e3a": "L",
"\u0141": "L",
"\u023d": "L",
"\u2c62": "L",
"\u2c60": "L",
"\ua748": "L",
"\ua746": "L",
"\ua780": "L",
"\u01c7": "LJ",
"\u01c8": "Lj",
"\u24c2": "M",
"\uff2d": "M",
"\u1e3e": "M",
"\u1e40": "M",
"\u1e42": "M",
"\u2c6e": "M",
"\u019c": "M",
"\u24c3": "N",
"\uff2e": "N",
"\u01f8": "N",
"\u0143": "N",
"\xd1": "N",
"\u1e44": "N",
"\u0147": "N",
"\u1e46": "N",
"\u0145": "N",
"\u1e4a": "N",
"\u1e48": "N",
"\u0220": "N",
"\u019d": "N",
"\ua790": "N",
"\ua7a4": "N",
"\u01ca": "NJ",
"\u01cb": "Nj",
"\u24c4": "O",
"\uff2f": "O",
"\xd2": "O",
"\xd3": "O",
"\xd4": "O",
"\u1ed2": "O",
"\u1ed0": "O",
"\u1ed6": "O",
"\u1ed4": "O",
"\xd5": "O",
"\u1e4c": "O",
"\u022c": "O",
"\u1e4e": "O",
"\u014c": "O",
"\u1e50": "O",
"\u1e52": "O",
"\u014e": "O",
"\u022e": "O",
"\u0230": "O",
"\xd6": "O",
"\u022a": "O",
"\u1ece": "O",
"\u0150": "O",
"\u01d1": "O",
"\u020c": "O",
"\u020e": "O",
"\u01a0": "O",
"\u1edc": "O",
"\u1eda": "O",
"\u1ee0": "O",
"\u1ede": "O",
"\u1ee2": "O",
"\u1ecc": "O",
"\u1ed8": "O",
"\u01ea": "O",
"\u01ec": "O",
"\xd8": "O",
"\u01fe": "O",
"\u0186": "O",
"\u019f": "O",
"\ua74a": "O",
"\ua74c": "O",
"\u01a2": "OI",
"\ua74e": "OO",
"\u0222": "OU",
"\u24c5": "P",
"\uff30": "P",
"\u1e54": "P",
"\u1e56": "P",
"\u01a4": "P",
"\u2c63": "P",
"\ua750": "P",
"\ua752": "P",
"\ua754": "P",
"\u24c6": "Q",
"\uff31": "Q",
"\ua756": "Q",
"\ua758": "Q",
"\u024a": "Q",
"\u24c7": "R",
"\uff32": "R",
"\u0154": "R",
"\u1e58": "R",
"\u0158": "R",
"\u0210": "R",
"\u0212": "R",
"\u1e5a": "R",
"\u1e5c": "R",
"\u0156": "R",
"\u1e5e": "R",
"\u024c": "R",
"\u2c64": "R",
"\ua75a": "R",
"\ua7a6": "R",
"\ua782": "R",
"\u24c8": "S",
"\uff33": "S",
"\u1e9e": "S",
"\u015a": "S",
"\u1e64": "S",
"\u015c": "S",
"\u1e60": "S",
"\u0160": "S",
"\u1e66": "S",
"\u1e62": "S",
"\u1e68": "S",
"\u0218": "S",
"\u015e": "S",
"\u2c7e": "S",
"\ua7a8": "S",
"\ua784": "S",
"\u24c9": "T",
"\uff34": "T",
"\u1e6a": "T",
"\u0164": "T",
"\u1e6c": "T",
"\u021a": "T",
"\u0162": "T",
"\u1e70": "T",
"\u1e6e": "T",
"\u0166": "T",
"\u01ac": "T",
"\u01ae": "T",
"\u023e": "T",
"\ua786": "T",
"\ua728": "TZ",
"\u24ca": "U",
"\uff35": "U",
"\xd9": "U",
"\xda": "U",
"\xdb": "U",
"\u0168": "U",
"\u1e78": "U",
"\u016a": "U",
"\u1e7a": "U",
"\u016c": "U",
"\xdc": "U",
"\u01db": "U",
"\u01d7": "U",
"\u01d5": "U",
"\u01d9": "U",
"\u1ee6": "U",
"\u016e": "U",
"\u0170": "U",
"\u01d3": "U",
"\u0214": "U",
"\u0216": "U",
"\u01af": "U",
"\u1eea": "U",
"\u1ee8": "U",
"\u1eee": "U",
"\u1eec": "U",
"\u1ef0": "U",
"\u1ee4": "U",
"\u1e72": "U",
"\u0172": "U",
"\u1e76": "U",
"\u1e74": "U",
"\u0244": "U",
"\u24cb": "V",
"\uff36": "V",
"\u1e7c": "V",
"\u1e7e": "V",
"\u01b2": "V",
"\ua75e": "V",
"\u0245": "V",
"\ua760": "VY",
"\u24cc": "W",
"\uff37": "W",
"\u1e80": "W",
"\u1e82": "W",
"\u0174": "W",
"\u1e86": "W",
"\u1e84": "W",
"\u1e88": "W",
"\u2c72": "W",
"\u24cd": "X",
"\uff38": "X",
"\u1e8a": "X",
"\u1e8c": "X",
"\u24ce": "Y",
"\uff39": "Y",
"\u1ef2": "Y",
"\xdd": "Y",
"\u0176": "Y",
"\u1ef8": "Y",
"\u0232": "Y",
"\u1e8e": "Y",
"\u0178": "Y",
"\u1ef6": "Y",
"\u1ef4": "Y",
"\u01b3": "Y",
"\u024e": "Y",
"\u1efe": "Y",
"\u24cf": "Z",
"\uff3a": "Z",
"\u0179": "Z",
"\u1e90": "Z",
"\u017b": "Z",
"\u017d": "Z",
"\u1e92": "Z",
"\u1e94": "Z",
"\u01b5": "Z",
"\u0224": "Z",
"\u2c7f": "Z",
"\u2c6b": "Z",
"\ua762": "Z",
"\u24d0": "a",
"\uff41": "a",
"\u1e9a": "a",
"\xe0": "a",
"\xe1": "a",
"\xe2": "a",
"\u1ea7": "a",
"\u1ea5": "a",
"\u1eab": "a",
"\u1ea9": "a",
"\xe3": "a",
"\u0101": "a",
"\u0103": "a",
"\u1eb1": "a",
"\u1eaf": "a",
"\u1eb5": "a",
"\u1eb3": "a",
"\u0227": "a",
"\u01e1": "a",
"\xe4": "a",
"\u01df": "a",
"\u1ea3": "a",
"\xe5": "a",
"\u01fb": "a",
"\u01ce": "a",
"\u0201": "a",
"\u0203": "a",
"\u1ea1": "a",
"\u1ead": "a",
"\u1eb7": "a",
"\u1e01": "a",
"\u0105": "a",
"\u2c65": "a",
"\u0250": "a",
"\ua733": "aa",
"\xe6": "ae",
"\u01fd": "ae",
"\u01e3": "ae",
"\ua735": "ao",
"\ua737": "au",
"\ua739": "av",
"\ua73b": "av",
"\ua73d": "ay",
"\u24d1": "b",
"\uff42": "b",
"\u1e03": "b",
"\u1e05": "b",
"\u1e07": "b",
"\u0180": "b",
"\u0183": "b",
"\u0253": "b",
"\u24d2": "c",
"\uff43": "c",
"\u0107": "c",
"\u0109": "c",
"\u010b": "c",
"\u010d": "c",
"\xe7": "c",
"\u1e09": "c",
"\u0188": "c",
"\u023c": "c",
"\ua73f": "c",
"\u2184": "c",
"\u24d3": "d",
"\uff44": "d",
"\u1e0b": "d",
"\u010f": "d",
"\u1e0d": "d",
"\u1e11": "d",
"\u1e13": "d",
"\u1e0f": "d",
"\u0111": "d",
"\u018c": "d",
"\u0256": "d",
"\u0257": "d",
"\ua77a": "d",
"\u01f3": "dz",
"\u01c6": "dz",
"\u24d4": "e",
"\uff45": "e",
"\xe8": "e",
"\xe9": "e",
"\xea": "e",
"\u1ec1": "e",
"\u1ebf": "e",
"\u1ec5": "e",
"\u1ec3": "e",
"\u1ebd": "e",
"\u0113": "e",
"\u1e15": "e",
"\u1e17": "e",
"\u0115": "e",
"\u0117": "e",
"\xeb": "e",
"\u1ebb": "e",
"\u011b": "e",
"\u0205": "e",
"\u0207": "e",
"\u1eb9": "e",
"\u1ec7": "e",
"\u0229": "e",
"\u1e1d": "e",
"\u0119": "e",
"\u1e19": "e",
"\u1e1b": "e",
"\u0247": "e",
"\u025b": "e",
"\u01dd": "e",
"\u24d5": "f",
"\uff46": "f",
"\u1e1f": "f",
"\u0192": "f",
"\ua77c": "f",
"\u24d6": "g",
"\uff47": "g",
"\u01f5": "g",
"\u011d": "g",
"\u1e21": "g",
"\u011f": "g",
"\u0121": "g",
"\u01e7": "g",
"\u0123": "g",
"\u01e5": "g",
"\u0260": "g",
"\ua7a1": "g",
"\u1d79": "g",
"\ua77f": "g",
"\u24d7": "h",
"\uff48": "h",
"\u0125": "h",
"\u1e23": "h",
"\u1e27": "h",
"\u021f": "h",
"\u1e25": "h",
"\u1e29": "h",
"\u1e2b": "h",
"\u1e96": "h",
"\u0127": "h",
"\u2c68": "h",
"\u2c76": "h",
"\u0265": "h",
"\u0195": "hv",
"\u24d8": "i",
"\uff49": "i",
"\xec": "i",
"\xed": "i",
"\xee": "i",
"\u0129": "i",
"\u012b": "i",
"\u012d": "i",
"\xef": "i",
"\u1e2f": "i",
"\u1ec9": "i",
"\u01d0": "i",
"\u0209": "i",
"\u020b": "i",
"\u1ecb": "i",
"\u012f": "i",
"\u1e2d": "i",
"\u0268": "i",
"\u0131": "i",
"\u24d9": "j",
"\uff4a": "j",
"\u0135": "j",
"\u01f0": "j",
"\u0249": "j",
"\u24da": "k",
"\uff4b": "k",
"\u1e31": "k",
"\u01e9": "k",
"\u1e33": "k",
"\u0137": "k",
"\u1e35": "k",
"\u0199": "k",
"\u2c6a": "k",
"\ua741": "k",
"\ua743": "k",
"\ua745": "k",
"\ua7a3": "k",
"\u24db": "l",
"\uff4c": "l",
"\u0140": "l",
"\u013a": "l",
"\u013e": "l",
"\u1e37": "l",
"\u1e39": "l",
"\u013c": "l",
"\u1e3d": "l",
"\u1e3b": "l",
"\u017f": "l",
"\u0142": "l",
"\u019a": "l",
"\u026b": "l",
"\u2c61": "l",
"\ua749": "l",
"\ua781": "l",
"\ua747": "l",
"\u01c9": "lj",
"\u24dc": "m",
"\uff4d": "m",
"\u1e3f": "m",
"\u1e41": "m",
"\u1e43": "m",
"\u0271": "m",
"\u026f": "m",
"\u24dd": "n",
"\uff4e": "n",
"\u01f9": "n",
"\u0144": "n",
"\xf1": "n",
"\u1e45": "n",
"\u0148": "n",
"\u1e47": "n",
"\u0146": "n",
"\u1e4b": "n",
"\u1e49": "n",
"\u019e": "n",
"\u0272": "n",
"\u0149": "n",
"\ua791": "n",
"\ua7a5": "n",
"\u01cc": "nj",
"\u24de": "o",
"\uff4f": "o",
"\xf2": "o",
"\xf3": "o",
"\xf4": "o",
"\u1ed3": "o",
"\u1ed1": "o",
"\u1ed7": "o",
"\u1ed5": "o",
"\xf5": "o",
"\u1e4d": "o",
"\u022d": "o",
"\u1e4f": "o",
"\u014d": "o",
"\u1e51": "o",
"\u1e53": "o",
"\u014f": "o",
"\u022f": "o",
"\u0231": "o",
"\xf6": "o",
"\u022b": "o",
"\u1ecf": "o",
"\u0151": "o",
"\u01d2": "o",
"\u020d": "o",
"\u020f": "o",
"\u01a1": "o",
"\u1edd": "o",
"\u1edb": "o",
"\u1ee1": "o",
"\u1edf": "o",
"\u1ee3": "o",
"\u1ecd": "o",
"\u1ed9": "o",
"\u01eb": "o",
"\u01ed": "o",
"\xf8": "o",
"\u01ff": "o",
"\u0254": "o",
"\ua74b": "o",
"\ua74d": "o",
"\u0275": "o",
"\u01a3": "oi",
"\u0223": "ou",
"\ua74f": "oo",
"\u24df": "p",
"\uff50": "p",
"\u1e55": "p",
"\u1e57": "p",
"\u01a5": "p",
"\u1d7d": "p",
"\ua751": "p",
"\ua753": "p",
"\ua755": "p",
"\u24e0": "q",
"\uff51": "q",
"\u024b": "q",
"\ua757": "q",
"\ua759": "q",
"\u24e1": "r",
"\uff52": "r",
"\u0155": "r",
"\u1e59": "r",
"\u0159": "r",
"\u0211": "r",
"\u0213": "r",
"\u1e5b": "r",
"\u1e5d": "r",
"\u0157": "r",
"\u1e5f": "r",
"\u024d": "r",
"\u027d": "r",
"\ua75b": "r",
"\ua7a7": "r",
"\ua783": "r",
"\u24e2": "s",
"\uff53": "s",
"\xdf": "s",
"\u015b": "s",
"\u1e65": "s",
"\u015d": "s",
"\u1e61": "s",
"\u0161": "s",
"\u1e67": "s",
"\u1e63": "s",
"\u1e69": "s",
"\u0219": "s",
"\u015f": "s",
"\u023f": "s",
"\ua7a9": "s",
"\ua785": "s",
"\u1e9b": "s",
"\u24e3": "t",
"\uff54": "t",
"\u1e6b": "t",
"\u1e97": "t",
"\u0165": "t",
"\u1e6d": "t",
"\u021b": "t",
"\u0163": "t",
"\u1e71": "t",
"\u1e6f": "t",
"\u0167": "t",
"\u01ad": "t",
"\u0288": "t",
"\u2c66": "t",
"\ua787": "t",
"\ua729": "tz",
"\u24e4": "u",
"\uff55": "u",
"\xf9": "u",
"\xfa": "u",
"\xfb": "u",
"\u0169": "u",
"\u1e79": "u",
"\u016b": "u",
"\u1e7b": "u",
"\u016d": "u",
"\xfc": "u",
"\u01dc": "u",
"\u01d8": "u",
"\u01d6": "u",
"\u01da": "u",
"\u1ee7": "u",
"\u016f": "u",
"\u0171": "u",
"\u01d4": "u",
"\u0215": "u",
"\u0217": "u",
"\u01b0": "u",
"\u1eeb": "u",
"\u1ee9": "u",
"\u1eef": "u",
"\u1eed": "u",
"\u1ef1": "u",
"\u1ee5": "u",
"\u1e73": "u",
"\u0173": "u",
"\u1e77": "u",
"\u1e75": "u",
"\u0289": "u",
"\u24e5": "v",
"\uff56": "v",
"\u1e7d": "v",
"\u1e7f": "v",
"\u028b": "v",
"\ua75f": "v",
"\u028c": "v",
"\ua761": "vy",
"\u24e6": "w",
"\uff57": "w",
"\u1e81": "w",
"\u1e83": "w",
"\u0175": "w",
"\u1e87": "w",
"\u1e85": "w",
"\u1e98": "w",
"\u1e89": "w",
"\u2c73": "w",
"\u24e7": "x",
"\uff58": "x",
"\u1e8b": "x",
"\u1e8d": "x",
"\u24e8": "y",
"\uff59": "y",
"\u1ef3": "y",
"\xfd": "y",
"\u0177": "y",
"\u1ef9": "y",
"\u0233": "y",
"\u1e8f": "y",
"\xff": "y",
"\u1ef7": "y",
"\u1e99": "y",
"\u1ef5": "y",
"\u01b4": "y",
"\u024f": "y",
"\u1eff": "y",
"\u24e9": "z",
"\uff5a": "z",
"\u017a": "z",
"\u1e91": "z",
"\u017c": "z",
"\u017e": "z",
"\u1e93": "z",
"\u1e95": "z",
"\u01b6": "z",
"\u0225": "z",
"\u0240": "z",
"\u2c6c": "z",
"\ua763": "z"
};
j = a(document), g = function() {
var a = 1;
return function() {
return a++
}
}(), j.on("mousemove", function(a) {
i.x = a.pageX, i.y = a.pageY
}), d = N(Object, {
bind: function(a) {
var b = this;
return function() {
a.apply(b, arguments)
}
},
init: function(c) {
var d, e, f = ".select2-results";
this.opts = c = this.prepareOpts(c), this.id = c.id, c.element.data("select2") !== b && null !== c.element.data("select2") && c.element.data("select2").destroy(), this.container = this.createContainer(), this.containerId = "s2id_" + (c.element.attr("id") || "autogen" + g()), this.containerSelector = "#" + this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, "\\$1"), this.container.attr("id", this.containerId), this.body = w(function() {
return c.element.closest("body")
}), D(this.container, this.opts.element, this.opts.adaptContainerCssClass), this.container.attr("style", c.element.attr("style")), this.container.css(K(c.containerCss)), this.container.addClass(K(c.containerCssClass)), this.elementTabIndex = this.opts.element.attr("tabindex"), this.opts.element.data("select2", this).attr("tabindex", "-1").before(this.container).on("click.select2", A), this.container.data("select2", this), this.dropdown = this.container.find(".select2-drop"), D(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass), this.dropdown.addClass(K(c.dropdownCssClass)), this.dropdown.data("select2", this), this.dropdown.on("click", A), this.results = d = this.container.find(f), this.search = e = this.container.find("input.select2-input"), this.queryCount = 0, this.resultsPage = 0, this.context = null, this.initContainer(), this.container.on("click", A), u(this.results), this.dropdown.on("mousemove-filtered touchstart touchmove touchend", f, this.bind(this.highlightUnderEvent)), x(80, this.results), this.dropdown.on("scroll-debounced", f, this.bind(this.loadMoreIfNeeded)), a(this.container).on("change", ".select2-input", function(a) {
a.stopPropagation()
}), a(this.dropdown).on("change", ".select2-input", function(a) {
a.stopPropagation()
}), a.fn.mousewheel && d.mousewheel(function(a, b, c, e) {
var f = d.scrollTop();
e > 0 && 0 >= f - e ? (d.scrollTop(0), A(a)) : 0 > e && d.get(0).scrollHeight - d.scrollTop() + e <= d.height() && (d.scrollTop(d.get(0).scrollHeight - d.height()), A(a))
}), t(e), e.on("keyup-change input paste", this.bind(this.updateResults)), e.on("focus", function() {
e.addClass("select2-focused")
}), e.on("blur", function() {
e.removeClass("select2-focused")
}), this.dropdown.on("mouseup", f, this.bind(function(b) {
a(b.target).closest(".select2-result-selectable").length > 0 && (this.highlightUnderEvent(b), this.selectHighlighted(b))
})), this.dropdown.on("click mouseup mousedown", function(a) {
a.stopPropagation()
}), a.isFunction(this.opts.initSelection) && (this.initSelection(), this.monitorSource()), null !== c.maximumInputLength && this.search.attr("maxlength", c.maximumInputLength);
var h = c.element.prop("disabled");
h === b && (h=!1), this.enable(!h);
var i = c.element.prop("readonly");
i === b && (i=!1), this.readonly(i), k = k || p(), this.autofocus = c.element.prop("autofocus"), c.element.prop("autofocus", !1), this.autofocus && this.focus(), this.nextSearchTerm = b
},
destroy: function() {
var a = this.opts.element, c = a.data("select2");
this.close(), this.propertyObserver && (delete this.propertyObserver, this.propertyObserver = null), c !== b && (c.container.remove(), c.dropdown.remove(), a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus", this.autofocus ||!1), this.elementTabIndex ? a.attr({
tabindex: this.elementTabIndex
}) : a.removeAttr("tabindex"), a.show())
},
optionToData: function(a) {
return a.is("option") ? {
id: a.prop("value"),
text: a.text(),
element: a.get(),
css: a.attr("class"),
disabled: a.prop("disabled"),
locked: q(a.attr("locked"), "locked") || q(a.data("locked"), !0)
} : a.is("optgroup") ? {
text: a.attr("label"),
children: [],
element: a.get(),
css: a.attr("class")
} : void 0
},
prepareOpts: function(c) {
var d, e, f, g, h = this;
if (d = c.element, "select" === d.get(0).tagName.toLowerCase() && (this.select = e = c.element), e && a.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function() {
if (this in c)
throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.")
}), c = a.extend({}, {
populateResults: function(d, e, f) {
var g, i = this.opts.id;
g = function(d, e, j) {
var k, l, m, n, o, p, q, r, s, t;
for (d = c.sortResults(d, e, f), k = 0, l = d.length; l > k; k += 1)
m = d[k], o = m.disabled===!0, n=!o && i(m) !== b, p = m.children && m.children.length > 0, q = a("<li></li>"), q.addClass("select2-results-dept-" + j), q.addClass("select2-result"), q.addClass(n ? "select2-result-selectable" : "select2-result-unselectable"), o && q.addClass("select2-disabled"), p && q.addClass("select2-result-with-children"), q.addClass(h.opts.formatResultCssClass(m)), r = a(document.createElement("div")), r.addClass("select2-result-label"), t = c.formatResult(m, r, f, h.opts.escapeMarkup), t !== b && r.html(t), q.append(r), p && (s = a("<ul></ul>"), s.addClass("select2-result-sub"), g(m.children, s, j + 1), q.append(s)), q.data("select2-data", m), e.append(q)
}, g(e, d, 0)
}
}, a.fn.select2.defaults, c), "function" != typeof c.id && (f = c.id, c.id = function(a) {
return a[f]
}), a.isArray(c.element.data("select2Tags"))) {
if ("tags"in c)
throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + c.element.attr("id");
c.tags = c.element.data("select2Tags")
}
if (e ? (c.query = this.bind(function(a) {
var f, g, i, c = {
results: [],
more: !1
}, e = a.term;
i = function(b, c) {
var d;
b.is("option") ? a.matcher(e, b.text(), b) && c.push(h.optionToData(b)) : b.is("optgroup") && (d = h.optionToData(b), b.children().each2(function(a, b) {
i(b, d.children)
}), d.children.length > 0 && c.push(d))
}, f = d.children(), this.getPlaceholder() !== b && f.length > 0 && (g = this.getPlaceholderOption(), g && (f = f.not(g))), f.each2(function(a, b) {
i(b, c.results)
}), a.callback(c)
}), c.id = function(a) {
return a.id
}, c.formatResultCssClass = function(a) {
return a.css
}) : "query"in c || ("ajax"in c ? (g = c.element.data("ajax-url"), g && g.length > 0 && (c.ajax.url = g), c.query = G.call(c.element, c.ajax)) : "data"in c ? c.query = H(c.data) : "tags"in c && (c.query = I(c.tags), c.createSearchChoice === b && (c.createSearchChoice = function(b) {
return {
id: a.trim(b),
text: a.trim(b)
}
}), c.initSelection === b && (c.initSelection = function(b, d) {
var e = [];
a(r(b.val(), c.separator)).each(function() {
var b = {
id: this,
text: this
}, d = c.tags;
a.isFunction(d) && (d = d()), a(d).each(function() {
return q(this.id, b.id) ? (b = this, !1) : void 0
}), e.push(b)
}), d(e)
}))), "function" != typeof c.query)
throw "query function not defined for Select2 " + c.element.attr("id");
return c
},
monitorSource: function() {
var c, d, a = this.opts.element;
a.on("change.select2", this.bind(function() {
this.opts.element.data("select2-change-triggered")!==!0 && this.initSelection()
})), c = this.bind(function() {
var c = a.prop("disabled");
c === b && (c=!1), this.enable(!c);
var d = a.prop("readonly");
d === b && (d=!1), this.readonly(d), D(this.container, this.opts.element, this.opts.adaptContainerCssClass), this.container.addClass(K(this.opts.containerCssClass)), D(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass), this.dropdown.addClass(K(this.opts.dropdownCssClass))
}), a.on("propertychange.select2", c), this.mutationCallback === b && (this.mutationCallback = function(a) {
a.forEach(c)
}), d = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver, d !== b && (this.propertyObserver && (delete this.propertyObserver, this.propertyObserver = null), this.propertyObserver = new d(this.mutationCallback), this.propertyObserver.observe(a.get(0), {
attributes: !0,
subtree: !1
}))
},
triggerSelect: function(b) {
var c = a.Event("select2-selecting", {
val: this.id(b),
object: b
});
return this.opts.element.trigger(c), !c.isDefaultPrevented()
},
triggerChange: function(b) {
b = b || {}, b = a.extend({}, b, {
type: "change",
val: this.val()
}), this.opts.element.data("select2-change-triggered", !0), this.opts.element.trigger(b), this.opts.element.data("select2-change-triggered", !1), this.opts.element.click(), this.opts.blurOnChange && this.opts.element.blur()
},
isInterfaceEnabled: function() {
return this.enabledInterface===!0
},
enableInterface: function() {
var a = this._enabled&&!this._readonly, b=!a;
return a === this.enabledInterface?!1 : (this.container.toggleClass("select2-container-disabled", b), this.close(), this.enabledInterface = a, !0)
},
enable: function(a) {
a === b && (a=!0), this._enabled !== a && (this._enabled = a, this.opts.element.prop("disabled", !a), this.enableInterface())
},
disable: function() {
this.enable(!1)
},
readonly: function(a) {
return a === b && (a=!1), this._readonly === a?!1 : (this._readonly = a, this.opts.element.prop("readonly", a), this.enableInterface(), !0)
},
opened: function() {
return this.container.hasClass("select2-dropdown-open")
},
positionDropdown: function() {
var t, u, v, w, x, b = this.dropdown, c = this.container.offset(), d = this.container.outerHeight(!1), e = this.container.outerWidth(!1), f = b.outerHeight(!1), g = a(window), h = g.width(), i = g.height(), j = g.scrollLeft() + h, l = g.scrollTop() + i, m = c.top + d, n = c.left, o = l >= m + f, p = c.top - f >= this.body().scrollTop(), q = b.outerWidth(!1), r = j >= n + q, s = b.hasClass("select2-drop-above");
s ? (u=!0, !p && o && (v=!0, u=!1)) : (u=!1, !o && p && (v=!0, u=!0)), v && (b.hide(), c = this.container.offset(), d = this.container.outerHeight(!1), e = this.container.outerWidth(!1), f = b.outerHeight(!1), j = g.scrollLeft() + h, l = g.scrollTop() + i, m = c.top + d, n = c.left, q = b.outerWidth(!1), r = j >= n + q, b.show()), this.opts.dropdownAutoWidth ? (x = a(".select2-results", b)[0], b.addClass("select2-drop-auto-width"), b.css("width", ""), q = b.outerWidth(!1) + (x.scrollHeight === x.clientHeight ? 0 : k.width), q > e ? e = q : q = e, r = j >= n + q) : this.container.removeClass("select2-drop-auto-width"), "static" !== this.body().css("position") && (t = this.body().offset(), m -= t.top, n -= t.left), r || (n = c.left + e - q), w = {
left: n,
width: e
}, u ? (w.bottom = i - c.top, w.top = "auto", this.container.addClass("select2-drop-above"), b.addClass("select2-drop-above")) : (w.top = m, w.bottom = "auto", this.container.removeClass("select2-drop-above"), b.removeClass("select2-drop-above")), w = a.extend(w, K(this.opts.dropdownCss)), b.css(w)
},
shouldOpen: function() {
var b;
return this.opened()?!1 : this._enabled===!1 || this._readonly===!0?!1 : (b = a.Event("select2-opening"), this.opts.element.trigger(b), !b.isDefaultPrevented())
},
clearDropdownAlignmentPreference: function() {
this.container.removeClass("select2-drop-above"), this.dropdown.removeClass("select2-drop-above")
},
open: function() {
return this.shouldOpen() ? (this.opening(), !0) : !1
},
opening: function() {
var f, b = this.containerId, c = "scroll." + b, d = "resize." + b, e = "orientationchange." + b;
this.container.addClass("select2-dropdown-open").addClass("select2-container-active"), this.clearDropdownAlignmentPreference(), this.dropdown[0] !== this.body().children().last()[0] && this.dropdown.detach().appendTo(this.body()), f = a("#select2-drop-mask"), 0 == f.length && (f = a(document.createElement("div")), f.attr("id", "select2-drop-mask").attr("class", "select2-drop-mask"), f.hide(), f.appendTo(this.body()), f.on("mousedown touchstart click", function(b) {
var d, c = a("#select2-drop");
c.length > 0 && (d = c.data("select2"), d.opts.selectOnBlur && d.selectHighlighted({
noFocus: !0
}), d.close({
focus: !0
}), b.preventDefault(), b.stopPropagation())
})), this.dropdown.prev()[0] !== f[0] && this.dropdown.before(f), a("#select2-drop").removeAttr("id"), this.dropdown.attr("id", "select2-drop"), f.show(), this.positionDropdown(), this.dropdown.show(), this.positionDropdown(), this.dropdown.addClass("select2-drop-active");
var g = this;
this.container.parents().add(window).each(function() {
a(this).on(d + " " + c + " " + e, function() {
g.positionDropdown()
})
})
},
close: function() {
if (this.opened()) {
var b = this.containerId, c = "scroll." + b, d = "resize." + b, e = "orientationchange." + b;
this.container.parents().add(window).each(function() {
a(this).off(c).off(d).off(e)
}), this.clearDropdownAlignmentPreference(), a("#select2-drop-mask").hide(), this.dropdown.removeAttr("id"), this.dropdown.hide(), this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"), this.results.empty(), this.clearSearch(), this.search.removeClass("select2-active"), this.opts.element.trigger(a.Event("select2-close"))
}
},
externalSearch: function(a) {
this.open(), this.search.val(a), this.updateResults(!1)
},
clearSearch: function() {},
getMaximumSelectionSize: function() {
return K(this.opts.maximumSelectionSize)
},
ensureHighlightVisible: function() {
var c, d, e, f, g, h, i, b = this.results;
if (d = this.highlight(), !(0 > d)) {
if (0 == d)
return b.scrollTop(0), void 0;
c = this.findHighlightableChoices().find(".select2-result-label"), e = a(c[d]), f = e.offset().top + e.outerHeight(!0), d === c.length - 1 && (i = b.find("li.select2-more-results"), i.length > 0 && (f = i.offset().top + i.outerHeight(!0))), g = b.offset().top + b.outerHeight(!0), f > g && b.scrollTop(b.scrollTop() + (f - g)), h = e.offset().top - b.offset().top, 0 > h && "none" != e.css("display") && b.scrollTop(b.scrollTop() + h)
}
},
findHighlightableChoices: function() {
return this.results.find(".select2-result-selectable:not(.select2-disabled, .select2-selected)")
},
moveHighlight: function(b) {
for (var c = this.findHighlightableChoices(), d = this.highlight(); d>-1 && d < c.length;) {
d += b;
var e = a(c[d]);
if (e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")) {
this.highlight(d);
break
}
}
},
highlight: function(b) {
var d, e, c = this.findHighlightableChoices();
return 0 === arguments.length ? o(c.filter(".select2-highlighted")[0], c.get()) : (b >= c.length && (b = c.length - 1), 0 > b && (b = 0), this.removeHighlight(), d = a(c[b]), d.addClass("select2-highlighted"), this.ensureHighlightVisible(), e = d.data("select2-data"), e && this.opts.element.trigger({
type: "select2-highlight",
val: this.id(e),
choice: e
}), void 0)
},
removeHighlight: function() {
this.results.find(".select2-highlighted").removeClass("select2-highlighted")
},
countSelectableResults: function() {
return this.findHighlightableChoices().length
},
highlightUnderEvent: function(b) {
var c = a(b.target).closest(".select2-result-selectable");
if (c.length > 0&&!c.is(".select2-highlighted")) {
var d = this.findHighlightableChoices();
this.highlight(d.index(c))
} else
0 == c.length && this.removeHighlight()
},
loadMoreIfNeeded: function() {
var c, a = this.results, b = a.find("li.select2-more-results"), d = this.resultsPage + 1, e = this, f = this.search.val(), g = this.context;
0 !== b.length && (c = b.offset().top - a.offset().top - a.height(), c <= this.opts.loadMorePadding && (b.addClass("select2-active"), this.opts.query({
element: this.opts.element,
term: f,
page: d,
context: g,
matcher: this.opts.matcher,
callback: this.bind(function(c) {
e.opened() && (e.opts.populateResults.call(this, a, c.results, {
term: f,
page: d,
context: g
}), e.postprocessResults(c, !1, !1), c.more===!0 ? (b.detach().appendTo(a).text(e.opts.formatLoadMore(d + 1)), window.setTimeout(function() {
e.loadMoreIfNeeded()
}, 10)) : b.remove(), e.positionDropdown(), e.resultsPage = d, e.context = c.context, this.opts.element.trigger({
type: "select2-loaded",
items: c
}))
})
})))
},
tokenize: function() {},
updateResults: function(c) {
function m() {
d.removeClass("select2-active"), h.positionDropdown()
}
function n(a) {
e.html(a), m()
}
var g, i, l, d = this.search, e = this.results, f = this.opts, h = this, j = d.val(), k = a.data(this.container, "select2-last-term");
if ((c===!0 ||!k ||!q(j, k)) && (a.data(this.container, "select2-last-term", j), c===!0 || this.showSearchInput!==!1 && this.opened())) {
l=++this.queryCount;
var o = this.getMaximumSelectionSize();
if (o >= 1 && (g = this.data(), a.isArray(g) && g.length >= o && J(f.formatSelectionTooBig, "formatSelectionTooBig")))
return n("<li class='select2-selection-limit'>" + f.formatSelectionTooBig(o) + "</li>"), void 0;
if (d.val().length < f.minimumInputLength)
return J(f.formatInputTooShort, "formatInputTooShort") ? n("<li class='select2-no-results'>" + f.formatInputTooShort(d.val(), f.minimumInputLength) + "</li>") : n(""), c && this.showSearch && this.showSearch(!0), void 0;
if (f.maximumInputLength && d.val().length > f.maximumInputLength)
return J(f.formatInputTooLong, "formatInputTooLong") ? n("<li class='select2-no-results'>" + f.formatInputTooLong(d.val(), f.maximumInputLength) + "</li>") : n(""), void 0;
f.formatSearching && 0 === this.findHighlightableChoices().length && n("<li class='select2-searching'>" + f.formatSearching() + "</li>"), d.addClass("select2-active"), this.removeHighlight(), i = this.tokenize(), i != b && null != i && d.val(i), this.resultsPage = 1, f.query({
element: f.element,
term: d.val(),
page: this.resultsPage,
context: null,
matcher: f.matcher,
callback: this.bind(function(g) {
var i;
if (l == this.queryCount) {
if (!this.opened())
return this.search.removeClass("select2-active"), void 0;
if (this.context = g.context === b ? null : g.context, this.opts.createSearchChoice && "" !== d.val() && (i = this.opts.createSearchChoice.call(h, d.val(), g.results), i !== b && null !== i && h.id(i) !== b && null !== h.id(i) && 0 === a(g.results).filter(function() {
return q(h.id(this), h.id(i))
}).length && g.results.unshift(i)), 0 === g.results.length && J(f.formatNoMatches, "formatNoMatches"))
return n("<li class='select2-no-results'>" + f.formatNoMatches(d.val()) + "</li>"), void 0;
e.empty(), h.opts.populateResults.call(this, e, g.results, {
term: d.val(),
page: this.resultsPage,
context: null
}), g.more===!0 && J(f.formatLoadMore, "formatLoadMore") && (e.append("<li class='select2-more-results'>" + h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage)) + "</li>"), window.setTimeout(function() {
h.loadMoreIfNeeded()
}, 10)), this.postprocessResults(g, c), m(), this.opts.element.trigger({
type: "select2-loaded",
items: g
})
}
})
})
}
},
cancel: function() {
this.close()
},
blur: function() {
this.opts.selectOnBlur && this.selectHighlighted({
noFocus: !0
}), this.close(), this.container.removeClass("select2-container-active"), this.search[0] === document.activeElement && this.search.blur(), this.clearSearch(), this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")
},
focusSearch: function() {
y(this.search)
},
selectHighlighted: function(a) {
var b = this.highlight(), c = this.results.find(".select2-highlighted"), d = c.closest(".select2-result").data("select2-data");
d ? (this.highlight(b), this.onSelect(d, a)) : a && a.noFocus && this.close()
},
getPlaceholder: function() {
var a;
return this.opts.element.attr("placeholder") || this.opts.element.attr("data-placeholder") || this.opts.element.data("placeholder") || this.opts.placeholder || ((a = this.getPlaceholderOption()) !== b ? a.text() : b)
},
getPlaceholderOption: function() {
if (this.select) {
var a = this.select.children("option").first();
if (this.opts.placeholderOption !== b)
return "first" === this.opts.placeholderOption && a || "function" == typeof this.opts.placeholderOption && this.opts.placeholderOption(this.select);
if ("" === a.text() && "" === a.val())
return a
}
},
initContainerWidth: function() {
function c() {
var c, d, e, f, g, h;
if ("off" === this.opts.width)
return null;
if ("element" === this.opts.width)
return 0 === this.opts.element.outerWidth(!1) ? "auto" : this.opts.element.outerWidth(!1) + "px";
if ("copy" === this.opts.width || "resolve" === this.opts.width) {
if (c = this.opts.element.attr("style"), c !== b)
for (d = c.split(";"), f = 0, g = d.length; g > f; f += 1)
if (h = d[f].replace(/\s/g, ""), e = h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i), null !== e && e.length >= 1)
return e[1];
return "resolve" === this.opts.width ? (c = this.opts.element.css("width"), c.indexOf("%") > 0 ? c : 0 === this.opts.element.outerWidth(!1) ? "auto" : this.opts.element.outerWidth(!1) + "px") : null
}
return a.isFunction(this.opts.width) ? this.opts.width() : this.opts.width
}
var d = c.call(this);
null !== d && this.container.css("width", d)
}
}), e = N(d, {
createContainer: function() {
var b = a(document.createElement("div")).attr({
"class": "select2-container"
}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>", " <span class='select2-chosen'>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>", " <span class='select2-arrow'><b></b></span>", "</a>", "<input class='select2-focusser select2-offscreen' type='text'/>", "<div class='select2-drop select2-display-none'>", " <div class='select2-search'>", " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>", " </div>", " <ul class='select2-results'>", " </ul>", "</div>"].join(""));
return b
},
enableInterface: function() {
this.parent.enableInterface.apply(this, arguments) && this.focusser.prop("disabled", !this.isInterfaceEnabled())
},
opening: function() {
var c, d, e;
this.opts.minimumResultsForSearch >= 0 && this.showSearch(!0), this.parent.opening.apply(this, arguments), this.showSearchInput!==!1 && this.search.val(this.focusser.val()), this.search.focus(), c = this.search.get(0), c.createTextRange ? (d = c.createTextRange(), d.collapse(!1), d.select()) : c.setSelectionRange && (e = this.search.val().length, c.setSelectionRange(e, e)), "" === this.search.val() && this.nextSearchTerm != b && (this.search.val(this.nextSearchTerm), this.search.select()), this.focusser.prop("disabled", !0).val(""), this.updateResults(!0), this.opts.element.trigger(a.Event("select2-open"))
},
close: function(a) {
this.opened() && (this.parent.close.apply(this, arguments), a = a || {
focus: !0
}, this.focusser.removeAttr("disabled"), a.focus && this.focusser.focus())
},
focus: function() {
this.opened() ? this.close() : (this.focusser.removeAttr("disabled"), this.focusser.focus())
},
isFocused: function() {
return this.container.hasClass("select2-container-active")
},
cancel: function() {
this.parent.cancel.apply(this, arguments), this.focusser.removeAttr("disabled"), this.focusser.focus()
},
destroy: function() {
a("label[for='" + this.focusser.attr("id") + "']").attr("for", this.opts.element.attr("id")), this.parent.destroy.apply(this, arguments)
},
initContainer: function() {
var b, d = this.container, e = this.dropdown;
this.opts.minimumResultsForSearch < 0 ? this.showSearch(!1) : this.showSearch(!0), this.selection = b = d.find(".select2-choice"), this.focusser = d.find(".select2-focusser"), this.focusser.attr("id", "s2id_autogen" + g()), a("label[for='" + this.opts.element.attr("id") + "']").attr("for", this.focusser.attr("id")), this.focusser.attr("tabindex", this.elementTabIndex), this.search.on("keydown", this.bind(function(a) {
if (this.isInterfaceEnabled()) {
if (a.which === c.PAGE_UP || a.which === c.PAGE_DOWN)
return A(a), void 0;
switch (a.which) {
case c.UP:
case c.DOWN:
return this.moveHighlight(a.which === c.UP?-1 : 1), A(a), void 0;
case c.ENTER:
return this.selectHighlighted(), A(a), void 0;
case c.TAB:
return this.selectHighlighted({
noFocus: !0
}), void 0;
case c.ESC:
return this.cancel(a), A(a), void 0
}
}
})), this.search.on("blur", this.bind(function() {
document.activeElement === this.body().get(0) && window.setTimeout(this.bind(function() {
this.search.focus()
}), 0)
})), this.focusser.on("keydown", this.bind(function(a) {
if (this.isInterfaceEnabled() && a.which !== c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a) && a.which !== c.ESC) {
if (this.opts.openOnEnter===!1 && a.which === c.ENTER)
return A(a), void 0;
if (a.which == c.DOWN || a.which == c.UP || a.which == c.ENTER && this.opts.openOnEnter) {
if (a.altKey || a.ctrlKey || a.shiftKey || a.metaKey)
return;
return this.open(), A(a), void 0
}
return a.which == c.DELETE || a.which == c.BACKSPACE ? (this.opts.allowClear && this.clear(), A(a), void 0) : void 0
}
})), t(this.focusser), this.focusser.on("keyup-change input", this.bind(function(a) {
if (this.opts.minimumResultsForSearch >= 0) {
if (a.stopPropagation(), this.opened())
return;
this.open()
}
})), b.on("mousedown", "abbr", this.bind(function(a) {
this.isInterfaceEnabled() && (this.clear(), B(a), this.close(), this.selection.focus())
})), b.on("mousedown", this.bind(function(b) {
this.container.hasClass("select2-container-active") || this.opts.element.trigger(a.Event("select2-focus")), this.opened() ? this.close() : this.isInterfaceEnabled() && this.open(), A(b)
})), e.on("mousedown", this.bind(function() {
this.search.focus()
})), b.on("focus", this.bind(function(a) {
A(a)
})), this.focusser.on("focus", this.bind(function() {
this.container.hasClass("select2-container-active") || this.opts.element.trigger(a.Event("select2-focus")), this.container.addClass("select2-container-active")
})).on("blur", this.bind(function() {
this.opened() || (this.container.removeClass("select2-container-active"), this.opts.element.trigger(a.Event("select2-blur")))
})), this.search.on("focus", this.bind(function() {
this.container.hasClass("select2-container-active") || this.opts.element.trigger(a.Event("select2-focus")), this.container.addClass("select2-container-active")
})), this.initContainerWidth(), this.opts.element.addClass("select2-offscreen"), this.setPlaceholder()
},
clear: function(b) {
var c = this.selection.data("select2-data");
if (c) {
var d = a.Event("select2-clearing");
if (this.opts.element.trigger(d), d.isDefaultPrevented())
return;
var e = this.getPlaceholderOption();
this.opts.element.val(e ? e.val() : ""), this.selection.find(".select2-chosen").empty(), this.selection.removeData("select2-data"), this.setPlaceholder(), b!==!1 && (this.opts.element.trigger({
type: "select2-removed",
val: this.id(c),
choice: c
}), this.triggerChange({
removed: c
}))
}
},
initSelection: function() {
if (this.isPlaceholderOptionSelected())
this.updateSelection(null), this.close(), this.setPlaceholder();
else {
var c = this;
this.opts.initSelection.call(null, this.opts.element, function(a) {
a !== b && null !== a && (c.updateSelection(a), c.close(), c.setPlaceholder())
})
}
},
isPlaceholderOptionSelected: function() {
var a;
return this.getPlaceholder() ? (a = this.getPlaceholderOption()) !== b && a.prop("selected") || "" === this.opts.element.val() || this.opts.element.val() === b || null === this.opts.element.val() : !1
},
prepareOpts: function() {
var b = this.parent.prepareOpts.apply(this, arguments), c = this;
return "select" === b.element.get(0).tagName.toLowerCase() ? b.initSelection = function(a, b) {
var d = a.find("option").filter(function() {
return this.selected
});
b(c.optionToData(d))
} : "data"in b && (b.initSelection = b.initSelection || function(c, d) {
var e = c.val(), f = null;
b.query({
matcher: function(a, c, d) {
var g = q(e, b.id(d));
return g && (f = d), g
},
callback: a.isFunction(d) ? function() {
d(f)
}
: a.noop
})
}), b
},
getPlaceholder: function() {
return this.select && this.getPlaceholderOption() === b ? b : this.parent.getPlaceholder.apply(this, arguments)
},
setPlaceholder: function() {
var a = this.getPlaceholder();
if (this.isPlaceholderOptionSelected() && a !== b) {
if (this.select && this.getPlaceholderOption() === b)
return;
this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)), this.selection.addClass("select2-default"), this.container.removeClass("select2-allowclear")
}
},
postprocessResults: function(a, b, c) {
var d = 0, e = this;
if (this.findHighlightableChoices().each2(function(a, b) {
return q(e.id(b.data("select2-data")), e.opts.element.val()) ? (d = a, !1) : void 0
}), c!==!1 && (b===!0 && d >= 0 ? this.highlight(d) : this.highlight(0)), b===!0) {
var g = this.opts.minimumResultsForSearch;
g >= 0 && this.showSearch(L(a.results) >= g)
}
},
showSearch: function(b) {
this.showSearchInput !== b && (this.showSearchInput = b, this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !b), this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !b), a(this.dropdown, this.container).toggleClass("select2-with-searchbox", b))
},
onSelect: function(a, b) {
if (this.triggerSelect(a)) {
var c = this.opts.element.val(), d = this.data();
this.opts.element.val(this.id(a)), this.updateSelection(a), this.opts.element.trigger({
type: "select2-selected",
val: this.id(a),
choice: a
}), this.nextSearchTerm = this.opts.nextSearchTerm(a, this.search.val()), this.close(), b && b.noFocus || this.focusser.focus(), q(c, this.id(a)) || this.triggerChange({
added: a,
removed: d
})
}
},
updateSelection: function(a) {
var d, e, c = this.selection.find(".select2-chosen");
this.selection.data("select2-data", a), c.empty(), null !== a && (d = this.opts.formatSelection(a, c, this.opts.escapeMarkup)), d !== b && c.append(d), e = this.opts.formatSelectionCssClass(a, c), e !== b && c.addClass(e), this.selection.removeClass("select2-default"), this.opts.allowClear && this.getPlaceholder() !== b && this.container.addClass("select2-allowclear")
},
val: function() {
var a, c=!1, d = null, e = this, f = this.data();
if (0 === arguments.length)
return this.opts.element.val();
if (a = arguments[0], arguments.length > 1 && (c = arguments[1]), this.select)
this.select.val(a).find("option").filter(function() {
return this.selected
}).each2(function(a, b) {
return d = e.optionToData(b), !1
}), this.updateSelection(d), this.setPlaceholder(), c && this.triggerChange({
added: d,
removed: f
});
else {
if (!a && 0 !== a)
return this.clear(c), void 0;
if (this.opts.initSelection === b)
throw new Error("cannot call val() if initSelection() is not defined");
this.opts.element.val(a), this.opts.initSelection(this.opts.element, function(a) {
e.opts.element.val(a ? e.id(a) : ""), e.updateSelection(a), e.setPlaceholder(), c && e.triggerChange({
added: a,
removed: f
})
})
}
},
clearSearch: function() {
this.search.val(""), this.focusser.val("")
},
data: function(a) {
var c, d=!1;
return 0 === arguments.length ? (c = this.selection.data("select2-data"), c == b && (c = null), c) : (arguments.length > 1 && (d = arguments[1]), a ? (c = this.data(), this.opts.element.val(a ? this.id(a) : ""), this.updateSelection(a), d && this.triggerChange({
added: a,
removed: c
})) : this.clear(d), void 0)
}
}), f = N(d, {
createContainer: function() {
var b = a(document.createElement("div")).attr({
"class": "select2-container select2-container-multi"
}).html(["<ul class='select2-choices'>", " <li class='select2-search-field'>", " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>", " </li>", "</ul>", "<div class='select2-drop select2-drop-multi select2-display-none'>", " <ul class='select2-results'>", " </ul>", "</div>"].join(""));
return b
},
prepareOpts: function() {
var b = this.parent.prepareOpts.apply(this, arguments), c = this;
return "select" === b.element.get(0).tagName.toLowerCase() ? b.initSelection = function(a, b) {
var d = [];
a.find("option").filter(function() {
return this.selected
}).each2(function(a, b) {
d.push(c.optionToData(b))
}), b(d)
} : "data"in b && (b.initSelection = b.initSelection || function(c, d) {
var e = r(c.val(), b.separator), f = [];
b.query({
matcher: function(c, d, g) {
var h = a.grep(e, function(a) {
return q(a, b.id(g))
}).length;
return h && f.push(g), h
},
callback: a.isFunction(d) ? function() {
for (var a = [], c = 0; c < e.length; c++)
for (var g = e[c], h = 0; h < f.length; h++) {
var i = f[h];
if (q(g, b.id(i))) {
a.push(i), f.splice(h, 1);
break
}
}
d(a)
}
: a.noop
})
}), b
},
selectChoice: function(a) {
var b = this.container.find(".select2-search-choice-focus");
b.length && a && a[0] == b[0] || (b.length && this.opts.element.trigger("choice-deselected", b), b.removeClass("select2-search-choice-focus"), a && a.length && (this.close(), a.addClass("select2-search-choice-focus"), this.opts.element.trigger("choice-selected", a)))
},
destroy: function() {
a("label[for='" + this.search.attr("id") + "']").attr("for", this.opts.element.attr("id")), this.parent.destroy.apply(this, arguments)
},
initContainer: function() {
var d, b = ".select2-choices";
this.searchContainer = this.container.find(".select2-search-field"), this.selection = d = this.container.find(b);
var e = this;
this.selection.on("click", ".select2-search-choice:not(.select2-locked)", function() {
e.search[0].focus(), e.selectChoice(a(this))
}), this.search.attr("id", "s2id_autogen" + g()), a("label[for='" + this.opts.element.attr("id") + "']").attr("for", this.search.attr("id")), this.search.on("input paste", this.bind(function() {
this.isInterfaceEnabled() && (this.opened() || this.open())
})), this.search.attr("tabindex", this.elementTabIndex), this.keydowns = 0, this.search.on("keydown", this.bind(function(a) {
if (this.isInterfaceEnabled()) {
++this.keydowns;
var b = d.find(".select2-search-choice-focus"), e = b.prev(".select2-search-choice:not(.select2-locked)"), f = b.next(".select2-search-choice:not(.select2-locked)"), g = z(this.search);
if (b.length && (a.which == c.LEFT || a.which == c.RIGHT || a.which == c.BACKSPACE || a.which == c.DELETE || a.which == c.ENTER)) {
var h = b;
return a.which == c.LEFT && e.length ? h = e : a.which == c.RIGHT ? h = f.length ? f : null : a.which === c.BACKSPACE ? (this.unselect(b.first()), this.search.width(10), h = e.length ? e : f) : a.which == c.DELETE ? (this.unselect(b.first()), this.search.width(10), h = f.length ? f : null) : a.which == c.ENTER && (h = null), this.selectChoice(h), A(a), h && h.length || this.open(), void 0
}
if ((a.which === c.BACKSPACE && 1 == this.keydowns || a.which == c.LEFT) && 0 == g.offset&&!g.length)
return this.selectChoice(d.find(".select2-search-choice:not(.select2-locked)").last()), A(a), void 0;
if (this.selectChoice(null), this.opened())
switch (a.which) {
case c.UP:
case c.DOWN:
return this.moveHighlight(a.which === c.UP?-1 : 1), A(a), void 0;
case c.ENTER:
return this.selectHighlighted(), A(a), void 0;
case c.TAB:
return this.selectHighlighted({
noFocus: !0
}), this.close(), void 0;
case c.ESC:
return this.cancel(a), A(a), void 0
}
if (a.which !== c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a) && a.which !== c.BACKSPACE && a.which !== c.ESC) {
if (a.which === c.ENTER) {
if (this.opts.openOnEnter===!1)
return;
if (a.altKey || a.ctrlKey || a.shiftKey || a.metaKey)
return
}
this.open(), (a.which === c.PAGE_UP || a.which === c.PAGE_DOWN) && A(a), a.which === c.ENTER && A(a)
}
}
})), this.search.on("keyup", this.bind(function() {
this.keydowns = 0, this.resizeSearch()
})), this.search.on("blur", this.bind(function(b) {
this.container.removeClass("select2-container-active"), this.search.removeClass("select2-focused"), this.selectChoice(null), this.opened() || this.clearSearch(), b.stopImmediatePropagation(), this.opts.element.trigger(a.Event("select2-blur"))
})), this.container.on("click", b, this.bind(function(b) {
this.isInterfaceEnabled() && (a(b.target).closest(".select2-search-choice").length > 0 || (this.selectChoice(null), this.clearPlaceholder(), this.container.hasClass("select2-container-active") || this.opts.element.trigger(a.Event("select2-focus")), this.open(), this.focusSearch(), b.preventDefault()))
})), this.container.on("focus", b, this.bind(function() {
this.isInterfaceEnabled() && (this.container.hasClass("select2-container-active") || this.opts.element.trigger(a.Event("select2-focus")), this.container.addClass("select2-container-active"), this.dropdown.addClass("select2-drop-active"), this.clearPlaceholder())
})), this.initContainerWidth(), this.opts.element.addClass("select2-offscreen"), this.clearSearch()
},
enableInterface: function() {
this.parent.enableInterface.apply(this, arguments) && this.search.prop("disabled", !this.isInterfaceEnabled())
},
initSelection: function() {
if ("" === this.opts.element.val() && "" === this.opts.element.text() && (this.updateSelection([]), this.close(), this.clearSearch()), this.select || "" !== this.opts.element.val()) {
var c = this;
this.opts.initSelection.call(null, this.opts.element, function(a) {
a !== b && null !== a && (c.updateSelection(a), c.close(), c.clearSearch())
})
}
},
clearSearch: function() {
var a = this.getPlaceholder(), c = this.getMaxSearchWidth();
a !== b && 0 === this.getVal().length && this.search.hasClass("select2-focused")===!1 ? (this.search.val(a).addClass("select2-default"), this.search.width(c > 0 ? c : this.container.css("width"))) : this.search.val("").width(10)
},
clearPlaceholder: function() {
this.search.hasClass("select2-default") && this.search.val("").removeClass("select2-default")
},
opening: function() {
this.clearPlaceholder(), this.resizeSearch(), this.parent.opening.apply(this, arguments), this.focusSearch(), this.updateResults(!0), this.search.focus(), this.opts.element.trigger(a.Event("select2-open"))
},
close: function() {
this.opened() && this.parent.close.apply(this, arguments)
},
focus: function() {
this.close(), this.search.focus()
},
isFocused: function() {
return this.search.hasClass("select2-focused")
},
updateSelection: function(b) {
var c = [], d = [], e = this;
a(b).each(function() {
o(e.id(this), c) < 0 && (c.push(e.id(this)), d.push(this))
}), b = d, this.selection.find(".select2-search-choice").remove(), a(b).each(function() {
e.addSelectedChoice(this)
}), e.postprocessResults()
},
tokenize: function() {
var a = this.search.val();
a = this.opts.tokenizer.call(this, a, this.data(), this.bind(this.onSelect), this.opts), null != a && a != b && (this.search.val(a), a.length > 0 && this.open())
},
onSelect: function(a, b) {
this.triggerSelect(a) && (this.addSelectedChoice(a), this.opts.element.trigger({
type: "selected",
val: this.id(a),
choice: a
}), (this.select ||!this.opts.closeOnSelect) && this.postprocessResults(a, !1, this.opts.closeOnSelect===!0), this.opts.closeOnSelect ? (this.close(), this.search.width(10)) : this.countSelectableResults() > 0 ? (this.search.width(10), this.resizeSearch(), this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize() && this.updateResults(!0), this.positionDropdown()) : (this.close(), this.search.width(10)), this.triggerChange({
added: a
}), b && b.noFocus || this.focusSearch())
},
cancel: function() {
this.close(), this.focusSearch()
},
addSelectedChoice: function(c) {
var j, k, d=!c.locked, e = a("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"), f = a("<li class='select2-search-choice select2-locked'><div></div></li>"), g = d ? e : f, h = this.id(c), i = this.getVal();
j = this.opts.formatSelection(c, g.find("div"), this.opts.escapeMarkup), j != b && g.find("div").replaceWith("<div>" + j + "</div>"), k = this.opts.formatSelectionCssClass(c, g.find("div")), k != b && g.addClass(k), d && g.find(".select2-search-choice-close").on("mousedown", A).on("click dblclick", this.bind(function(b) {
this.isInterfaceEnabled() && (a(b.target).closest(".select2-search-choice").fadeOut("fast", this.bind(function() {
this.unselect(a(b.target)), this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"), this.close(), this.focusSearch()
})).dequeue(), A(b))
})).on("focus", this.bind(function() {
this.isInterfaceEnabled() && (this.container.addClass("select2-container-active"), this.dropdown.addClass("select2-drop-active"))
})), g.data("select2-data", c), g.insertBefore(this.searchContainer), i.push(h), this.setVal(i)
},
unselect: function(b) {
var d, e, c = this.getVal();
if (b = b.closest(".select2-search-choice"), 0 === b.length)
throw "Invalid argument: " + b + ". Must be .select2-search-choice";
if (d = b.data("select2-data")) {
for (; (e = o(this.id(d), c)) >= 0;)
c.splice(e, 1), this.setVal(c), this.select && this.postprocessResults();
var f = a.Event("select2-removing");
f.val = this.id(d), f.choice = d, this.opts.element.trigger(f), f.isDefaultPrevented() || (b.remove(), this.opts.element.trigger({
type: "select2-removed",
val: this.id(d),
choice: d
}), this.triggerChange({
removed: d
}))
}
},
postprocessResults: function(a, b, c) {
var d = this.getVal(), e = this.results.find(".select2-result"), f = this.results.find(".select2-result-with-children"), g = this;
e.each2(function(a, b) {
var c = g.id(b.data("select2-data"));
o(c, d) >= 0 && (b.addClass("select2-selected"), b.find(".select2-result-selectable").addClass("select2-selected"))
}), f.each2(function(a, b) {
b.is(".select2-result-selectable") || 0 !== b.find(".select2-result-selectable:not(.select2-selected)").length || b.addClass("select2-selected")
}), - 1 == this.highlight() && c!==!1 && g.highlight(0), !this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length > 0 && (!a || a&&!a.more && 0 === this.results.find(".select2-no-results").length) && J(g.opts.formatNoMatches, "formatNoMatches") && this.results.append("<li class='select2-no-results'>" + g.opts.formatNoMatches(g.search.val()) + "</li>")
},
getMaxSearchWidth: function() {
return this.selection.width() - s(this.search)
},
resizeSearch: function() {
var a, b, c, d, e, f = s(this.search);
a = C(this.search) + 10, b = this.search.offset().left, c = this.selection.width(), d = this.selection.offset().left, e = c - (b - d) - f, a > e && (e = c - f), 40 > e && (e = c - f), 0 >= e && (e = a), this.search.width(Math.floor(e))
},
getVal: function() {
var a;
return this.select ? (a = this.select.val(), null === a ? [] : a) : (a = this.opts.element.val(), r(a, this.opts.separator))
},
setVal: function(b) {
var c;
this.select ? this.select.val(b) : (c = [], a(b).each(function() {
o(this, c) < 0 && c.push(this)
}), this.opts.element.val(0 === c.length ? "" : c.join(this.opts.separator)))
},
buildChangeDetails: function(a, b) {
for (var b = b.slice(0), a = a.slice(0), c = 0; c < b.length; c++)
for (var d = 0; d < a.length; d++)
q(this.opts.id(b[c]), this.opts.id(a[d])) && (b.splice(c, 1), c > 0 && c--, a.splice(d, 1), d--);
return {
added: b,
removed: a
}
},
val: function(c, d) {
var e, f = this;
if (0 === arguments.length)
return this.getVal();
if (e = this.data(), e.length || (e = []), !c && 0 !== c)
return this.opts.element.val(""), this.updateSelection([]), this.clearSearch(), d && this.triggerChange({
added: this.data(),
removed: e
}), void 0;
if (this.setVal(c), this.select)
this.opts.initSelection(this.select, this.bind(this.updateSelection)), d && this.triggerChange(this.buildChangeDetails(e, this.data()));
else {
if (this.opts.initSelection === b)
throw new Error("val() cannot be called if initSelection() is not defined");
this.opts.initSelection(this.opts.element, function(b) {
var c = a.map(b, f.id);
f.setVal(c), f.updateSelection(b), f.clearSearch(), d && f.triggerChange(f.buildChangeDetails(e, f.data()))
})
}
this.clearSearch()
},
onSortStart: function() {
if (this.select)
throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
this.search.width(0), this.searchContainer.hide()
},
onSortEnd: function() {
var b = [], c = this;
this.searchContainer.show(), this.searchContainer.appendTo(this.searchContainer.parent()), this.resizeSearch(), this.selection.find(".select2-search-choice").each(function() {
b.push(c.opts.id(a(this).data("select2-data")))
}), this.setVal(b), this.triggerChange()
},
data: function(b, c) {
var e, f, d = this;
return 0 === arguments.length ? this.selection.find(".select2-search-choice").map(function() {
return a(this).data("select2-data")
}).get() : (f = this.data(), b || (b = []), e = a.map(b, function(a) {
return d.opts.id(a)
}), this.setVal(e), this.updateSelection(b), this.clearSearch(), c && this.triggerChange(this.buildChangeDetails(f, this.data())), void 0)
}
}), a.fn.select2 = function() {
var d, g, h, i, j, c = Array.prototype.slice.call(arguments, 0), k = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"], l = ["opened", "isFocused", "container", "dropdown"], m = ["val", "data"], n = {
search: "externalSearch"
};
return this.each(function() {
if (0 === c.length || "object" == typeof c[0])
d = 0 === c.length ? {} : a.extend({}, c[0]), d.element = a(this), "select" === d.element.get(0).tagName.toLowerCase() ? j = d.element.prop("multiple") : (j = d.multiple ||!1, "tags"in d && (d.multiple = j=!0)), g = j ? new f : new e, g.init(d);
else {
if ("string" != typeof c[0])
throw "Invalid arguments to select2 plugin: " + c;
if (o(c[0], k) < 0)
throw "Unknown method: " + c[0];
if (i = b, g = a(this).data("select2"), g === b)
return;
if (h = c[0], "container" === h ? i = g.container : "dropdown" === h ? i = g.dropdown : (n[h] && (h = n[h]), i = g[h].apply(g, c.slice(1))), o(c[0], l) >= 0 || o(c[0], m) && 1 == c.length)
return !1
}
}), i === b ? this : i
}, a.fn.select2.defaults = {
width: "copy",
loadMorePadding: 0,
closeOnSelect: !0,
openOnEnter: !0,
containerCss: {},
dropdownCss: {},
containerCssClass: "",
dropdownCssClass: "",
formatResult: function(a, b, c, d) {
var e = [];
return E(a.text, c.term, e, d), e.join("")
},
formatSelection: function(a, c, d) {
return a ? d(a.text) : b
},
sortResults: function(a) {
return a
},
formatResultCssClass: function() {
return b
},
formatSelectionCssClass: function() {
return b
},
formatNoMatches: function() {
return "No matches found"
},
formatInputTooShort: function(a, b) {
var c = b - a.length;
return "Please enter " + c + " more character" + (1 == c ? "" : "s")
},
formatInputTooLong: function(a, b) {
var c = a.length - b;
return "Please delete " + c + " character" + (1 == c ? "" : "s")
},
formatSelectionTooBig: function(a) {
return "You can only select " + a + " item" + (1 == a ? "" : "s")
},
formatLoadMore: function() {
return "Loading more results..."
},
formatSearching: function() {
return "Searching..."
},
minimumResultsForSearch: 0,
minimumInputLength: 0,
maximumInputLength: null,
maximumSelectionSize: 0,
id: function(a) {
return a.id
},
matcher: function(a, b) {
return n("" + b).toUpperCase().indexOf(n("" + a).toUpperCase()) >= 0
},
separator: ",",
tokenSeparators: [],
tokenizer: M,
escapeMarkup: F,
blurOnChange: !1,
selectOnBlur: !1,
adaptContainerCssClass: function(a) {
return a
},
adaptDropdownCssClass: function() {
return null
},
nextSearchTerm: function() {
return b
}
}, a.fn.select2.ajaxDefaults = {
transport: a.ajax,
params: {
type: "GET",
cache: !1,
dataType: "json"
}
}, window.Select2 = {
query: {
ajax: G,
local: H,
tags: I
},
util: {
debounce: v,
markMatch: E,
escapeMarkup: F,
stripDiacritics: n
},
"class": {
"abstract": d,
single: e,
multi: f
}
}
}
}(jQuery);
/*!
* Velocity.js: Accelerated JavaScript animation.
* @version 0.0.0
* @requires jQuery.js
* @docs VelocityJS.org
* @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
*/
!function(e, t, a, r) {
function o(e) {
for (var t =- 1, a = e ? e.length : 0, r = []; ++t < a;) {
var o = e[t];
o && r.push(o)
}
return r
}
function l(e) {
return "[object Function]" === Object.prototype.toString.call(e)
}
function i(t) {
if (t)
for (var a = (new Date).getTime(), o = 0, l = e.velocity.State.calls.length; l > o; o++)
if (e.velocity.State.calls[o]) {
var s = e.velocity.State.calls[o], g = s[0], d = s[2], f = s[3];
f || (f = e.velocity.State.calls[o][3] = a - 16);
for (var y = Math.min((a - f) / d.duration, 1), m = 0, h = g.length; h > m; m++) {
var v = g[m], P = v.element;
if (e.data(P, c)) {
var x=!1;
d.display && "none" !== d.display && (p.setPropertyValue(P, "display", d.display), e.velocity.State.calls[o][2].display=!1);
for (var b in v)
if ("element" !== b) {
var V = v[b], S = V.currentValue, w;
if (w = 1 === y ? V.endValue : V.startValue + (V.endValue - V.startValue) * e.easing[V.easing](y), V.currentValue = w, p.Hooks.registered[b]) {
var k = p.Hooks.getRoot(b), C = e.data(P, c).rootPropertyValueCache[k];
C && (V.rootPropertyValue = C)
}
var T = p.setPropertyValue(P, b, V.currentValue + ("auto" === w ? "" : V.unitType), V.rootPropertyValue, V.scrollContainer);
p.Hooks.registered[b] && (e.data(P, c).rootPropertyValueCache[k] = p.Normalizations.registered[k] ? p.Normalizations.registered[k]("extract", null, T[1]) : T[1]), "transform" === T[0] && (x=!0)
}
d.mobileHA && (e.data(P, c).transformCache.translate3d === r ? (e.data(P, c).transformCache.translate3d = "(0, 0, 0)", x=!0) : 1 === y && (delete e.data(P, c).transformCache.translate3d, x=!0)), x && p.flushTransformCache(P)
}
}
1 === y && n(o)
}
e.velocity.State.isTicking && u(i)
}
function n(t) {
for (var a = e.velocity.State.calls[t][0], o = e.velocity.State.calls[t][1], l = e.velocity.State.calls[t][2], i=!1, n = 0, s = a.length; s > n; n++) {
var u = a[n].element;
"none" === l.display && l.loop===!1 && p.setPropertyValue(u, "display", l.display), e.queue(u)[1] !== r && /\$\.velocity\.queueEntryFlag/i.test(e.queue(u)[1]) || e.data(u, c) && (e.data(u, c).isAnimating=!1, e.data(u, c).rootPropertyValueCache = {}), n === s - 1 && l.complete && l.complete.call(o, o), e.dequeue(u)
}
e.velocity.State.calls[t]=!1;
for (var g = 0, d = e.velocity.State.calls.length; d > g; g++)
if (e.velocity.State.calls[g]!==!1) {
i=!0;
break
}
i===!1 && (e.velocity.State.isTicking=!1, delete e.velocity.State.calls, e.velocity.State.calls = [])
}
var s = function() {
if (a.documentMode)
return a.documentMode;
for (var e = 7; e > 4; e--) {
var t = a.createElement("div");
if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length)
return t = null, e
}
return r
}(), u = t.requestAnimationFrame || function() {
var e = 0;
return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function(t) {
var a = (new Date).getTime(), r;
return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function() {
t(a + r)
}, r)
}
}();
if (7 >= s)
return void(e.fn.velocity = e.fn.animate);
if (e.velocity !== r || e.fn.velocity !== r)
return void console.log("Velocity is already loaded or its namespace is occupied.");
!function() {
var t = {};
e.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(e, a) {
t[a] = function(t) {
return Math.pow(t, e + 2)
}
}), e.extend(t, {
Sine: function(e) {
return 1 - Math.cos(e * Math.PI / 2)
},
Circ: function(e) {
return 1 - Math.sqrt(1 - e * e)
},
Elastic: function(e) {
return 0 === e || 1 === e ? e : - Math.pow(2, 8 * (e - 1)) * Math.sin((80 * (e - 1) - 7.5) * Math.PI / 15)
},
Back: function(e) {
return e * e * (3 * e - 2)
},
Bounce: function(e) {
for (var t, a = 4; e < ((t = Math.pow(2, --a)) - 1) / 11;);
return 1 / Math.pow(4, 3 - a) - 7.5625 * Math.pow((3 * t - 2) / 22 - e, 2)
}
}), e.each(t, function(t, a) {
e.easing["easeIn" + t] = a, e.easing["easeOut" + t] = function(e) {
return 1 - a(1 - e)
}, e.easing["easeInOut" + t] = function(e) {
return .5 > e ? a(2 * e) / 2 : 1 - a( - 2 * e + 2) / 2
}
}), e.easing.spring = function(e) {
return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6*-e)
}
}();
var c = "velocity";
e.velocity = {
State: {
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
prefixElement: a.createElement("div"),
prefixMatches: {},
scrollAnchor: null,
scrollProperty: null,
isTicking: !1,
calls: []
},
CSS: {},
Sequences: {},
animate: function() {},
debug: !1
}, t.pageYOffset !== r ? (e.velocity.State.scrollAnchor = t, e.velocity.State.scrollProperty = "pageYOffset") : (e.velocity.State.scrollAnchor = a.documentElement || a.body.parentNode || a.body, e.velocity.State.scrollProperty = "scrollTop");
var p = e.velocity.CSS = {
RegEx: {
valueUnwrap: /^[A-z]+\((.*)\)$/i,
wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,
valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi
},
Hooks: {
templates: {
color: ["Red Green Blue Alpha", "255 255 255 1"],
backgroundColor: ["Red Green Blue Alpha", "255 255 255 1"],
borderColor: ["Red Green Blue Alpha", "255 255 255 1"],
outlineColor: ["Red Green Blue Alpha", "255 255 255 1"],
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% 0%"],
perspectiveOrigin: ["X Y", "50% 50%"]
},
registered: {},
register: function() {
var e, t, a;
if (s)
for (e in p.Hooks.templates) {
t = p.Hooks.templates[e], a = t[0].split(" ");
var r = t[1].match(p.RegEx.valueSplit);
"Color" === a[0] && (a.push(a.shift()), r.push(r.shift()), p.Hooks.templates[e] = [a.join(" "), r.join(" ")])
}
for (e in p.Hooks.templates) {
t = p.Hooks.templates[e], a = t[0].split(" ");
for (var o in a) {
var l = e + a[o], i = o;
p.Hooks.registered[l] = [e, i]
}
}
},
getRoot: function(e) {
var t = p.Hooks.registered[e];
return t ? t[0] : e
},
cleanRootPropertyValue: function(e, t) {
return p.RegEx.valueUnwrap.test(t) && (t = t.match(p.Hooks.RegEx.valueUnwrap)[1]), p.Values.isCSSNullValue(t) && (t = p.Hooks.templates[e][1]), t
},
extractValue: function(e, t) {
var a = p.Hooks.registered[e];
if (a) {
var r = a[0], o = a[1];
return t = p.Hooks.cleanRootPropertyValue(r, t), t.toString().match(p.RegEx.valueSplit)[o]
}
return t
},
injectValue: function(e, t, a) {
var r = p.Hooks.registered[e];
if (r) {
var o = r[0], l = r[1], i, n;
return a = p.Hooks.cleanRootPropertyValue(o, a), i = a.toString().match(p.RegEx.valueSplit), i[l] = t, n = i.join(" ")
}
return a
}
},
Normalizations: {
registered: {
clip: function(e, t, a) {
switch (e) {
case"name":
return "clip";
case"extract":
var r;
return p.RegEx.wrappedValueAlreadyExtracted.test(a) ? r = a : (r = a.toString().match(p.RegEx.valueUnwrap), r && (r = r[1].replace(/,(\s+)?/g, " "))), r;
case"inject":
return "rect(" + a + ")"
}
},
opacity: function(e, t, a) {
if (8 >= s)
switch (e) {
case"name":
return "filter";
case"extract":
var r = a.toString().match(/alpha\(opacity=(.*)\)/i);
return a = r ? r[1] / 100 : 1;
case"inject":
return t.style.zoom = 1, "alpha(opacity=" + parseInt(100 * a) + ")"
} else
switch (e) {
case"name":
return "opacity";
case"extract":
return a;
case"inject":
return a
}
}
},
register: function() {
function t(e) {
var t = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, r;
return e = e.replace(t, function(e, t, a, r) {
return t + t + a + a + r + r
}), r = a.exec(e), r ? "rgb(" + (parseInt(r[1], 16) + " " + parseInt(r[2], 16) + " " + parseInt(r[3], 16)) + ")" : "rgb(0 0 0)"
}
var a = ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"];
9 >= s || (a = a.concat(["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"]));
for (var o = 0, l = a.length; l > o; o++)
!function() {
var t = a[o];
p.Normalizations.registered[t] = function(a, o, l) {
switch (a) {
case"name":
return "transform";
case"extract":
return e.data(o, c).transformCache[t] === r ? /^scale/i.test(t) ? 1 : 0 : e.data(o, c).transformCache[t].replace(/[()]/g, "");
case"inject":
var i=!1;
switch (t.substr(0, t.length - 1)) {
case"translate":
i=!/(%|px|em|rem|\d)$/i.test(l);
break;
case"scale":
i=!/(\d)$/i.test(l);
break;
case"skew":
i=!/(deg|\d)$/i.test(l);
break;
case"rotate":
i=!/(deg|\d)$/i.test(l)
}
return i || (e.data(o, c).transformCache[t] = "(" + l + ")"), e.data(o, c).transformCache[t]
}
}
}();
for (var i = ["color", "backgroundColor", "borderColor", "outlineColor"], o = 0, n = i.length; n > o; o++)
!function() {
var e = i[o];
p.Normalizations.registered[e] = function(a, o, l) {
switch (a) {
case"name":
return e;
case"extract":
var i;
if (p.RegEx.wrappedValueAlreadyExtracted.test(l))
i = l;
else {
var n, u = {
aqua: "rgb(0, 255, 255);",
black: "rgb(0, 0, 0)",
blue: "rgb(0, 0, 255)",
fuchsia: "rgb(255, 0, 255)",
gray: "rgb(128, 128, 128)",
green: "rgb(0, 128, 0)",
lime: "rgb(0, 255, 0)",
maroon: "rgb(128, 0, 0)",
navy: "rgb(0, 0, 128)",
olive: "rgb(128, 128, 0)",
purple: "rgb(128, 0, 128)",
red: "rgb(255, 0, 0)",
silver: "rgb(192, 192, 192)",
teal: "rgb(0, 128, 128)",
white: "rgb(255, 255, 255)",
yellow: "rgb(255, 255, 0)"
};
/^[A-z]+$/i.test(l) ? n = u[l] !== r ? u[l] : u.black : /^#([A-f\d]{3}){1,2}$/i.test(l) ? n = t(l) : /^rgba?\(/i.test(l) || (n = u.black), i = (n || l).toString().match(p.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ")
}
return 8 >= s || 3 !== i.split(" ").length || (i += " 1"), i;
case"inject":
return 8 >= s ? 4 === l.split(" ").length && (l = l.split(/\s+/).slice(0, 3).join(" ")) : 3 === l.split(" ").length && (l += " 1"), (8 >= s ? "rgb" : "rgba") + "(" + l.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"
}
}
}()
}
},
Names: {
camelCase: function(e) {
return e.replace(/-(\w)/g, function(e, t) {
return t.toUpperCase()
})
},
prefixCheck: function(t) {
if (e.velocity.State.prefixMatches[t])
return [e.velocity.State.prefixMatches[t], !0];
for (var a = ["", "Webkit", "Moz", "ms", "O"], r = 0, o = a.length; o > r; r++) {
var l;
if (l = 0 === r ? t : a[r] + t.replace(/^\w/, function(e) {
return e.toUpperCase()
}), "string" == typeof e.velocity.State.prefixElement.style[l])
return e.velocity.State.prefixMatches[t] = l, [l, !0]
}
return [t, !1]
}
},
Values: {
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|opacity|alpha|fillOpacity|flexGrow|flexHeight|zIndex|fontWeight)$)|color/i.test(e) ? "" : "px"
}
},
getPropertyValue: function(a, o, l, i) {
function n(a, o) {
if (!i) {
if ("height" === o && "border-box" !== p.getPropertyValue(a, "boxSizing").toLowerCase())
return a.offsetHeight - (parseFloat(p.getPropertyValue(a, "borderTopWidth")) || 0) - (parseFloat(p.getPropertyValue(a, "borderBottomWidth")) || 0) - (parseFloat(p.getPropertyValue(a, "paddingTop")) || 0) - (parseFloat(p.getPropertyValue(a, "paddingBottom")) || 0);
if ("width" === o && "border-box" !== p.getPropertyValue(a, "boxSizing").toLowerCase())
return a.offsetWidth - (parseFloat(p.getPropertyValue(a, "borderLeftWidth")) || 0) - (parseFloat(p.getPropertyValue(a, "borderRightWidth")) || 0) - (parseFloat(p.getPropertyValue(a, "paddingLeft")) || 0) - (parseFloat(p.getPropertyValue(a, "paddingRight")) || 0)
}
var l = 0;
if (8 >= s)
l = e.css(a, o);
else {
var u;
u = e.data(a, c) === r ? t.getComputedStyle(a, null) : e.data(a, c).computedStyle ? e.data(a, c).computedStyle : e.data(a, c).computedStyle = t.getComputedStyle(a, null), s && "borderColor" === o && (o = "borderTopColor"), l = 9 === s && "filter" === o ? u.getPropertyValue(o) : u[o], "" === l && (l = a.style[o])
}
if ("auto" === l && /^(top|right|bottom|left)$/i.test(o)) {
var g = n(a, "position");
("fixed" === g || "absolute" === g && /top|left/i.test(o)) && (l = e(a).position()[o] + "px")
}
return l
}
var u;
if (p.Hooks.registered[o]) {
var g = o, d = p.Hooks.getRoot(g);
l === r && (l = p.getPropertyValue(a, p.Names.prefixCheck(d)[0])), p.Normalizations.registered[d] && (l = p.Normalizations.registered[d]("extract", a, l)), u = p.Hooks.extractValue(g, l)
} else if (p.Normalizations.registered[o]) {
var f, y;
f = p.Normalizations.registered[o]("name", a), "transform" !== f && (y = n(a, p.Names.prefixCheck(f)[0]), p.Values.isCSSNullValue(y) && p.Hooks.templates[o] && (y = p.Hooks.templates[o][1])), u = p.Normalizations.registered[o]("extract", a, y)
}
return /^[\d-]/.test(u) || (u = n(a, p.Names.prefixCheck(o)[0])), p.Values.isCSSNullValue(u) && (u = 0), e.velocity.debug >= 2 && console.log("Get " + o + ": " + u), u
},
setPropertyValue: function(a, r, o, l, i) {
var n = r;
if ("scroll" === r)
i ? i.scrollTop = o : t.scrollTo(null, o);
else if (p.Normalizations.registered[r] && "transform" === p.Normalizations.registered[r]("name", a))
p.Normalizations.registered[r]("inject", a, o), n = "transform", o = e.data(a, c).transformCache[r];
else {
if (p.Hooks.registered[r]) {
var u = r, g = p.Hooks.getRoot(r);
l = l || p.getPropertyValue(a, g), o = p.Hooks.injectValue(u, o, l), r = g
}
if (p.Normalizations.registered[r] && (o = p.Normalizations.registered[r]("inject", a, o), r = p.Normalizations.registered[r]("name", a)), n = p.Names.prefixCheck(r)[0], 8 >= s)
try {
a.style[n] = o
} catch (d) {
console.log("Error setting [" + n + "] to [" + o + "]")
} else
a.style[n] = o;
e.velocity.debug >= 2 && console.log("Set " + r + " (" + n + "): " + o)
}
return [n, o]
},
flushTransformCache: function(t) {
var a = "", r, o, l;
for (r in e.data(t, c).transformCache)
o = e.data(t, c).transformCache[r], "transformPerspective" !== r ? (9 === s && "rotateZ" === r && (r = "rotate"), a += r + o + " ") : l = o;
l && (a = "perspective" + l + " " + a), p.setPropertyValue(t, "transform", a)
}
};
p.Hooks.register(), p.Normalizations.register(), e.fn.velocity = e.velocity.animate = function() {
function t() {
var t = this, n = e.extend({}, e.fn.velocity.defaults, g), y = {};
if ("stop" === h)
return e.queue(t, "string" == typeof g ? g : "", []), !0;
switch (e.data(t, c) === r && e.data(t, c, {
isAnimating: !1,
computedStyle: null,
tweensContainer: null,
rootPropertyValueCache: {},
transformCache: {}
}), n.duration.toString().toLowerCase()) {
case"fast":
n.duration = 200;
break;
case"normal":
n.duration = 400;
break;
case"slow":
n.duration = 600;
break;
default:
n.duration = parseFloat(n.duration) || parseFloat(e.fn.velocity.defaults.duration) || 400
}
e.easing[n.easing] || (n.easing = e.easing[e.fn.velocity.defaults.easing] ? e.fn.velocity.defaults.easing : "swing"), /^\d/.test(n.delay) && e.queue(t, n.queue, function(t) {
e.velocity.queueEntryFlag=!0, setTimeout(t, parseFloat(n.delay))
}), n.display && (n.display = n.display.toLowerCase()), n.mobileHA = n.mobileHA && e.velocity.State.isMobile, e.queue(t, n.queue, function(m) {
function x(a) {
var o = r, i = r, s = r;
return "[object Array]" === Object.prototype.toString.call(a) ? (o = a[0], /^[\d-]/.test(a[1]) || l(a[1]) ? s = a[1] : "string" == typeof a[1] && (e.easing[a[1]] !== r && (i = a[1]), a[2] && (s = a[2]))) : o = a, i = i || n.easing, l(o) && (o = o.call(t, f, d)), l(s) && (s = s.call(t, f, d)), [o || 0, i, s]
}
function b(e, t) {
var a, r;
return r = (t || 0).toString().toLowerCase().replace(/[%A-z]+$/, function(e) {
return a = e, ""
}), a || (a = p.Values.getUnitType(e)), [r, a]
}
function V() {
var r = {
parent: t.parentNode,
position: p.getPropertyValue(t, "position"),
fontSize: p.getPropertyValue(t, "fontSize")
}, o = r.position === v.lastPosition && r.parent === v.lastParent, l = r.fontSize === v.lastFontSize;
v.lastParent = r.parent, v.lastPosition = r.position, v.lastFontSize = r.fontSize, null === v.remToPxRatio && (v.remToPxRatio = parseFloat(p.getPropertyValue(a.body, "fontSize")) || 16);
var i = {
overflowX: null,
overflowY: null,
boxSizing: null,
width: null,
minWidth: null,
maxWidth: null,
height: null,
minHeight: null,
maxHeight: null,
paddingLeft: null
}, n = {}, s = 10;
n.remToPxRatio = v.remToPxRatio, i.overflowX = p.getPropertyValue(t, "overflowX"), i.overflowY = p.getPropertyValue(t, "overflowY"), i.boxSizing = p.getPropertyValue(t, "boxSizing"), i.width = p.getPropertyValue(t, "width", null, !0), i.minWidth = p.getPropertyValue(t, "minWidth"), i.maxWidth = p.getPropertyValue(t, "maxWidth") || "none", i.height = p.getPropertyValue(t, "height", null, !0), i.minHeight = p.getPropertyValue(t, "minHeight"), i.maxHeight = p.getPropertyValue(t, "maxHeight") || "none", i.paddingLeft = p.getPropertyValue(t, "paddingLeft"), o ? (n.percentToPxRatioWidth = v.lastPercentToPxWidth, n.percentToPxRatioHeight = v.lastPercentToPxHeight) : (p.setPropertyValue(t, "overflowX", "hidden"), p.setPropertyValue(t, "overflowY", "hidden"), p.setPropertyValue(t, "boxSizing", "content-box"), p.setPropertyValue(t, "width", s + "%"), p.setPropertyValue(t, "minWidth", s + "%"), p.setPropertyValue(t, "maxWidth", s + "%"), p.setPropertyValue(t, "height", s + "%"), p.setPropertyValue(t, "minHeight", s + "%"), p.setPropertyValue(t, "maxHeight", s + "%")), l ? n.emToPxRatio = v.lastEmToPx : p.setPropertyValue(t, "paddingLeft", s + "em"), o || (n.percentToPxRatioWidth = v.lastPercentToPxWidth = (parseFloat(p.getPropertyValue(t, "width", null, !0)) || 1) / s, n.percentToPxRatioHeight = v.lastPercentToPxHeight = (parseFloat(p.getPropertyValue(t, "height", null, !0)) || 1) / s), l || (n.emToPxRatio = v.lastEmToPx = (parseFloat(p.getPropertyValue(t, "paddingLeft")) || 1) / s);
for (var u in i)
p.setPropertyValue(t, u, i[u]);
return e.velocity.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(n), t), n
}
if (e.velocity.queueEntryFlag=!0, 0 === f && g && l(g.begin) && g.begin.call(s, s), "scroll" === h) {
var S = parseFloat(n.offset) || 0, w, k;
n.container ? n.container.jquery || n.container.nodeType ? (n.container = n.container[0] || n.container, w = n.container.scrollTop, k = w + e(t).position().top + S) : n.container = null : (w = e.velocity.State.scrollAnchor[e.velocity.State.scrollProperty], k = e(t).offset().top + S), y = {
scroll: {
rootPropertyValue: !1,
startValue: w,
currentValue: w,
endValue: k,
unitType: "",
easing: n.easing,
scrollContainer: n.container
},
element: t
}
} else if ("reverse" === h) {
if (!e.data(t, c).tweensContainer)
return void e.dequeue(t, n.queue);
"none" === e.data(t, c).opts.display && (e.data(t, c).opts.display = "block"), e.data(t, c).opts.loop=!1, n = e.extend({}, e.data(t, c).opts, g);
var C = e.extend(!0, {}, e.data(t, c).tweensContainer);
for (var T in C)
if ("element" !== T) {
var H = C[T].startValue;
C[T].startValue = C[T].currentValue = C[T].endValue, C[T].endValue = H, g && (C[T].easing = n.easing)
}
y = C
} else if ("start" === h) {
var C;
e.data(t, c).tweensContainer && e.data(t, c).isAnimating===!0 && (C = e.data(t, c).tweensContainer);
for (var R in u) {
var z = x(u[R]), q = z[0], N = z[1], j = z[2];
R = p.Names.camelCase(R);
var A = p.Hooks.getRoot(R), E=!1;
if (p.Names.prefixCheck(A)[1]!==!1 || p.Normalizations.registered[A] !== r) {
n.display && "none" !== n.display && /opacity|filter/.test(R)&&!j && 0 !== q && (j = 0), n._cacheValues && C && C[R] ? (j === r && (j = C[R].endValue + C[R].unitType), E = e.data(t, c).rootPropertyValueCache[A]) : p.Hooks.registered[R] ? j === r ? (E = p.getPropertyValue(t, A), j = p.getPropertyValue(t, R, E)) : E = p.Hooks.templates[A][1] : j === r && (j = p.getPropertyValue(t, R));
var F, M, Y, B;
F = b(R, j), j = F[0], Y = F[1], F = b(R, q), q = F[0].replace(/^([+-\/*])=/, function(e, t) {
return B = t, ""
}), M = F[1], j = parseFloat(j) || 0, q = parseFloat(q) || 0;
var W;
if ("%" === M && (/^(fontSize|lineHeight)$/.test(R) ? (q/=100, M = "em") : /^scale/.test(R) ? (q/=100, M = "") : /(Red|Green|Blue)$/i.test(R) && (q = q / 100 * 255, M = "")), /[\/*]/.test(B))
M = Y;
else if (Y !== M && 0 !== j)
if (0 === q)
M = Y;
else {
W = W || V();
var $ = /margin|padding|left|right|width|text|word|letter/i.test(R) || /X$/.test(R) ? "x": "y";
switch (Y) {
case"%":
j*="x" === $ ? W.percentToPxRatioWidth : W.percentToPxRatioHeight;
break;
case"em":
j*=W.emToPxRatio;
break;
case"rem":
j*=W.remToPxRatio;
break;
case"px":
}
switch (M) {
case"%":
j*=1 / ("x" === $ ? W.percentToPxRatioWidth : W.percentToPxRatioHeight);
break;
case"em":
j*=1 / W.emToPxRatio;
break;
case"rem":
j*=1 / W.remToPxRatio;
break;
case"px":
}
}
switch (B) {
case"+":
q = j + q;
break;
case"-":
q = j - q;
break;
case"*":
q = j * q;
break;
case"/":
q = j / q
}
y[R] = {
rootPropertyValue: E,
startValue: j,
currentValue: j,
endValue: q,
unitType: M,
easing: N
}, e.velocity.debug && console.log("tweensContainer (" + R + "): " + JSON.stringify(y[R]), t)
} else
e.velocity.debug && console.log("Skipping [" + A + "] due to a lack of browser support.")
}
y.element = t
}
y.element && (P.push(y), e.data(t, c).tweensContainer = y, e.data(t, c).opts = n, e.data(t, c).isAnimating=!0, f === d - 1 ? (e.velocity.State.calls.length > 1e4 && (e.velocity.State.calls = o(e.velocity.State.calls)), e.velocity.State.calls.push([P, s, n]), e.velocity.State.isTicking===!1 && (e.velocity.State.isTicking=!0, i())) : f++), "" !== n.queue && "fx" !== n.queue && setTimeout(m, n.duration + n.delay)
}), (n.queue===!1 || ("" === n.queue || "fx" === n.queue) && "inprogress" !== e.queue(t)[0]) && e.dequeue(t)
}
var n, s, u, g;
this.jquery ? (n=!0, s = this, u = arguments[0], g = arguments[1]) : (n=!1, s = arguments[0].jquery ? arguments[0].get() : arguments[0], u = arguments[1], g = arguments[2]);
var d = s.length || 1, f = 0;
if ("stop" !== u && "object" != typeof g) {
var y = n ? 1: 2;
g = {};
for (var m = y; m < arguments.length; m++)
/^\d / .test(arguments[m]) ? g.duration = parseFloat(arguments[m]) : "string" == typeof arguments[m] ? g.easing = arguments[m].replace(/^\s+|\s+$/g, "") : l(arguments[m]) && (g.complete = arguments[m])
}
var h;
switch (u) {
case"scroll":
h = "scroll";
break;
case"reverse":
h = "reverse";
break;
case"stop":
h = "stop";
break;
default:
if (!e.isPlainObject(u) || e.isEmptyObject(u))
return "string" == typeof u && e.velocity.Sequences[u] ? (e.each(s, function(t, a) {
e.velocity.Sequences[u].call(a, a, g || {}, t, d)
}), s) : (e.velocity.debug && console.log("First argument was not a property map, a known action, or a registered sequence. Aborting."), s);
h = "start"
}
var v = {
lastParent: null,
lastPosition: null,
lastFontSize: null,
lastPercentToPxWidth: null,
lastPercentToPxHeight: null,
lastEmToPx: null,
remToPxRatio: null
}, P = [];
if (g&&!l(g.complete) && (g.complete = null), n)
s.each(t);
else if (s.nodeType)
t.call(s);
else if (s[0] && s[0].nodeType)
for (var x in s)
t.call(s[x]);
var b = e.extend({}, e.fn.velocity.defaults, g);
if (b.loop = parseInt(b.loop), b.loop)
for (var V = 0; V < 2 * b.loop - 1; V++)
n ? s.velocity("reverse", {
delay: b.delay
}) : e.velocity.animate(s, "reverse", {
delay: b.delay
});
return s
}
}(jQuery, window, document), jQuery.fn.velocity.defaults = {
queue: "",
duration: 400,
easing: "swing",
complete: null,
display: null,
loop: !1,
delay: !1,
mobileHA: !0,
_cacheValues: !0
}, jQuery.velocity.Sequences.slideDown = function(e, t) {
var a = {
height: null,
marginTop: null,
marginBottom: null,
paddingTop: null,
paddingBottom: null
}, r = {
overflow: null,
overflowY: null
}, o = t.complete;
t.delay = t.delay || 1, t.begin = function() {
r.overflow = jQuery.velocity.CSS.getPropertyValue(e, "overflow"), r.overflowY = jQuery.velocity.CSS.getPropertyValue(e, "overflowY"), this.style.overflow = "hidden", this.style.overflowY = "hidden", e.style.height = "auto", e.style.display = "block";
for (var t in a)
a[t] = [jQuery.velocity.CSS.getPropertyValue(e, t), 0]
}, t.complete = function() {
o && o.call(this, this), this.style.overflow = r.overflow, this.style.overflowY = r.overflowY
}, jQuery.velocity.animate(e, a, t)
}, jQuery.velocity.Sequences.slideUp = function(e, t) {
var a = {
height: null,
marginTop: null,
marginBottom: null,
paddingTop: null,
paddingBottom: null,
overflow: null,
overflowY: null
}, r = t.complete;
t.display = t.display || "none", t._cacheValues=!1, t.begin = function() {
for (var t in a)
a[t] = jQuery.velocity.CSS.getPropertyValue(e, t);
this.style.overflow = "hidden", this.style.overflowY = "hidden"
}, t.complete = function() {
r && r.call(this, this);
for (var e in a)
this.style[e] = a[e]
}, jQuery.velocity.animate(e, {
height: [0, a.height],
marginTop: [0, a.marginTop],
marginBottom: [0, a.marginBottom],
paddingTop: [0, a.paddingTop],
paddingBottom: [0, a.paddingBottom]
}, t)
};
// simple debounce plugin
function debounce(a, b, c) {
var d;
return function() {
var e = this, f = arguments;
clearTimeout(d), d = setTimeout(function() {
d = null, c || a.apply(e, f)
}, b), c&&!d && a.apply(e, f)
}
}
(function(d) {
var p = {}, e, a, h = document, i = window, f = h.documentElement, j = d.expando;
d.event.special.inview = {
add: function(a) {
p[a.guid + "-" + this[j]] = {
data: a,
$element: d(this)
}
},
remove: function(a) {
try {
delete p[a.guid + "-" + this[j]]
} catch (d) {}
}
};
d(i).bind("scroll resize", function() {
e = a = null
});
!f.addEventListener && f.attachEvent && f.attachEvent("onfocusin", function() {
a = null
});
setInterval(function() {
var k = d(), j, n = 0;
d.each(p, function(a, b) {
var c = b.data.selector, d = b.$element;
k = k.add(c ? d.find(c) : d)
});
if (j = k.length) {
var b;
if (!(b = e)) {
var g = {
height: i.innerHeight,
width: i.innerWidth
};
if (!g.height && ((b = h.compatMode) ||!d.support.boxModel))
b = "CSS1Compat" === b ? f : h.body, g = {
height: b.clientHeight,
width: b.clientWidth
};
b = g
}
e = b;
for (a = a || {
top: i.pageYOffset || f.scrollTop || h.body.scrollTop,
left: i.pageXOffset || f.scrollLeft || h.body.scrollLeft
}; n < j; n++)
if (d.contains(f, k[n])) {
b = d(k[n]);
var l = b.height(), m = b.width(), c = b.offset(), g = b.data("inview");
if (!a ||!e)
break;
c.top + l > a.top && c.top < a.top + e.height && c.left + m > a.left && c.left < a.left + e.width ?
(m = a.left > c.left ? "right" : a.left + e.width < c.left + m ? "left" : "both", l = a.top > c.top ? "bottom" : a.top + e.height < c.top + l ? "top" : "both", c = m + "-" + l, (!g || g !== c) && b.data("inview", c).trigger("inview", [!0, m, l])) : g && b.data("inview", !1).trigger("inview", [!1])
}
}
}, 250)
})(jQuery);
// count up plugin https://github.com/inorganik/countUp.js
function countUp(a, b, c, d, e, f) {
for (var g = 0, h = ["webkit", "moz", "ms"], i = 0; i < h.length&&!window.requestAnimationFrame; ++i)
window.requestAnimationFrame = window[h[i] + "RequestAnimationFrame"], window.cancelAnimationFrame = window[h[i] + "CancelAnimationFrame"] || window[h[i] + "CancelRequestAnimationFrame"];
window.requestAnimationFrame || (window.requestAnimationFrame = function(a) {
var c = (new Date).getTime(), d = Math.max(0, 16 - (c - g)), e = window.setTimeout(function() {
a(c + d)
}, d);
return g = c + d, e
}), window.cancelAnimationFrame || (window.cancelAnimationFrame = function(a) {
clearTimeout(a)
}), this.options = f || {
useEasing: !0,
useGrouping: !0,
separator: ",",
decimal: "."
}, "" == this.options.separator && (this.options.useGrouping=!1);
var j = this;
this.d = "string" == typeof a ? document.getElementById(a) : a, this.startVal = Number(b), this.endVal = Number(c), this.countDown = this.startVal > this.endVal?!0 : !1, this.startTime = null, this.timestamp = null, this.remaining = null, this.frameVal = this.startVal, this.rAF = null, this.decimals = Math.max(0, d || 0), this.dec = Math.pow(10, this.decimals), this.duration = 1e3 * e || 2e3, this.version = function() {
return "1.1.1"
}, this.easeOutExpo = function(a, b, c, d) {
return 1024 * c * ( - Math.pow(2, - 10 * a / d) + 1) / 1023 + b
}, this.count = function(a) {
null === j.startTime && (j.startTime = a), j.timestamp = a;
var b = a - j.startTime;
if (j.remaining = j.duration - b, j.options.useEasing)
if (j.countDown) {
var c = j.easeOutExpo(b, 0, j.startVal - j.endVal, j.duration);
j.frameVal = j.startVal - c
} else
j.frameVal = j.easeOutExpo(b, j.startVal, j.endVal - j.startVal, j.duration);
else if (j.countDown) {
var c = (j.startVal - j.endVal) * (b / j.duration);
j.frameVal = j.startVal - c
} else
j.frameVal = j.startVal + (j.endVal - j.startVal) * (b / j.duration);
j.frameVal = Math.round(j.frameVal * j.dec) / j.dec, j.frameVal = j.countDown ? j.frameVal < j.endVal ? j.endVal : j.frameVal : j.frameVal > j.endVal ? j.endVal : j.frameVal, j.d.innerHTML = j.formatNumber(j.frameVal.toFixed(j.decimals)), b < j.duration ? j.rAF = requestAnimationFrame(j.count) : null != j.callback && j.callback()
}, this.start = function(a) {
return j.callback = a, isNaN(j.endVal) || isNaN(j.startVal) ? (console.log("countUp error: startVal or endVal is not a number"), j.d.innerHTML = "--") : j.rAF = requestAnimationFrame(j.count), !1
}, this.stop = function() {
cancelAnimationFrame(j.rAF)
}, this.reset = function() {
j.startTime = null, cancelAnimationFrame(j.rAF), j.d.innerHTML = j.formatNumber(j.startVal.toFixed(j.decimals))
}, this.resume = function() {
j.startTime = null, j.duration = j.remaining, j.startVal = j.frameVal, requestAnimationFrame(j.count)
}, this.formatNumber = function(a) {
a += "";
var b, c, d, e;
if (b = a.split("."), c = b[0], d = b.length > 1 ? j.options.decimal + b[1] : "", e = /(\d+)(\d{3})/, j.options.useGrouping)
for (; e.test(c);)
c = c.replace(e, "$1" + j.options.separator + "$2");
return c + d
}, j.d.innerHTML = j.formatNumber(j.startVal.toFixed(j.decimals))
}
/*! JSON v3.3.0 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
(function(n) {
function K(p, q) {
function s(a) {
if (s[a] !== v)
return s[a];
var c;
if ("bug-string-char-index" == a)
c = "a" != "a"[0];
else if ("json" == a)
c = s("json-stringify") && s("json-parse");
else {
var e;
if ("json-stringify" == a) {
c = q.stringify;
var b = "function" == typeof c && r;
if (b) {
(e = function() {
return 1
}).toJSON = e;
try {
b = "0" === c(0) && "0" === c(new A) && '""' == c(new B) && c(t) === v && c(v) === v && c() === v && "1" === c(e) && "[1]" == c([e]) && "[null]" == c([v]) && "null" == c(null) && "[null,null,null]" == c([v, t, null]) && '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}' ==
c({
a: [e, !0, !1, null, "\x00\b\n\f\r\t"]
}) && "1" === c(null, e) && "[\n 1,\n 2\n]" == c([1, 2], null, 1) && '"-271821-04-20T00:00:00.000Z"' == c(new D( - 864E13)) && '"+275760-09-13T00:00:00.000Z"' == c(new D(864E13)) && '"-000001-01-01T00:00:00.000Z"' == c(new D( - 621987552E5)) && '"1969-12-31T23:59:59.999Z"' == c(new D( - 1))
} catch (f) {
b=!1
}
}
c = b
}
if ("json-parse" == a) {
c = q.parse;
if ("function" == typeof c)
try {
if (0 === c("0")&&!c(!1)) {
e = c('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}');
var l = 5 == e.a.length && 1 === e.a[0];
if (l) {
try {
l=!c('"\t"')
} catch (d) {}
if (l)
try {
l =
1 !== c("01")
} catch (h) {}
if (l)
try {
l = 1 !== c("1.")
} catch (m) {}
}
}
} catch (X) {
l=!1
}
c = l
}
}
return s[a]=!!c
}
p || (p = n.Object());
q || (q = n.Object());
var A = p.Number || n.Number, B = p.String || n.String, G = p.Object || n.Object, D = p.Date || n.Date, J = p.SyntaxError || n.SyntaxError, N = p.TypeError || n.TypeError, R = p.Math || n.Math, H = p.JSON || n.JSON;
"object" == typeof H && H && (q.stringify = H.stringify, q.parse = H.parse);
var G = G.prototype, t = G.toString, u, C, v, r = new D( - 0xc782b5b800cec);
try {
r =- 109252 == r.getUTCFullYear() && 0 === r.getUTCMonth() && 1 === r.getUTCDate() &&
10 == r.getUTCHours() && 37 == r.getUTCMinutes() && 6 == r.getUTCSeconds() && 708 == r.getUTCMilliseconds()
} catch (Y) {}
if (!s("json")) {
var E = s("bug-string-char-index");
if (!r)
var w = R.floor, S = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], F = function(a, c) {
return S[c] + 365 * (a - 1970) + w((a - 1969 + (c =+ (1 < c))) / 4) - w((a - 1901 + c) / 100) + w((a - 1601 + c) / 400)
};
(u = G.hasOwnProperty) || (u = function(a) {
var c = {}, e;
(c.__proto__ = null, c.__proto__ = {
toString: 1
}, c).toString != t ? u = function(a) {
var c = this.__proto__;
a = a in (this.__proto__ = null, this);
this.__proto__ =
c;
return a
} : (e = c.constructor, u = function(a) {
var c = (this.constructor || e).prototype;
return a in this&&!(a in c && this[a] === c[a])
});
c = null;
return u.call(this, a)
});
var T = {
"boolean": 1,
number: 1,
string: 1,
undefined: 1
};
C = function(a, c) {
var e = 0, b, f, l;
(b = function() {
this.valueOf = 0
}).prototype.valueOf = 0;
f = new b;
for (l in f)
u.call(f, l) && e++;
b = f = null;
e ? C = 2 == e ? function(a, c) {
var e = {}, b = "[object Function]" == t.call(a), f;
for (f in a)
b && "prototype" == f || u.call(e, f) ||!(e[f] = 1) ||!u.call(a, f) || c(f)
} : function(a, c) {
var e = "[object Function]" ==
t.call(a), b, f;
for (b in a)
e && "prototype" == b ||!u.call(a, b) || (f = "constructor" === b) || c(b);
(f || u.call(a, b = "constructor")) && c(b)
} : (f = "valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "), C = function(a, c) {
var e = "[object Function]" == t.call(a), b, g;
if (g=!e)
if (g = "function" != typeof a.constructor)
g = typeof a.hasOwnProperty, g = "object" == g?!!a.hasOwnProperty : !T[g];
g = g ? a.hasOwnProperty : u;
for (b in a)
e && "prototype" == b ||!g.call(a, b) || c(b);
for (e = f.length; b = f[--e]; g.call(a,
b)
&& c(b));
});
return C(a, c)
};
if (!s("json-stringify")) {
var U = {
92: "\\\\",
34: '\\"',
8: "\\b",
12: "\\f",
10: "\\n",
13: "\\r",
9: "\\t"
}, x = function(a, c) {
return ("000000" + (c || 0)).slice( - a)
}, O = function(a) {
for (var c = '"', b = 0, g = a.length, f=!E || 10 < g, l = f && (E ? a.split("") : a); b < g; b++) {
var d = a.charCodeAt(b);
switch (d) {
case 8:
case 9:
case 10:
case 12:
case 13:
case 34:
case 92:
c += U[d];
break;
default:
if (32 > d) {
c += "\\u00" + x(2, d.toString(16));
break
}
c += f ? l[b] : a.charAt(b)
}
}
return c + '"'
}, L = function(a, c, b, g, f, l, d) {
var h, m, k, n, p, q, r, s, y;
try {
h =
c[a]
} catch (z) {}
if ("object" == typeof h && h)
if (m = t.call(h), "[object Date]" != m || u.call(h, "toJSON"))
"function" == typeof h.toJSON && ("[object Number]" != m && "[object String]" != m && "[object Array]" != m || u.call(h, "toJSON")) && (h = h.toJSON(a));
else if (h>-1 / 0 && h < 1 / 0) {
if (F) {
n = w(h / 864E5);
for (m = w(n / 365.2425) + 1970 - 1; F(m + 1, 0) <= n; m++);
for (k = w((n - F(m, 0)) / 30.42); F(m, k + 1) <= n; k++);
n = 1 + n - F(m, k);
p = (h%864E5 + 864E5)%864E5;
q = w(p / 36E5)%24;
r = w(p / 6E4)%60;
s = w(p / 1E3)%60;
p%=1E3
} else
m = h.getUTCFullYear(), k = h.getUTCMonth(), n = h.getUTCDate(),
q = h.getUTCHours(), r = h.getUTCMinutes(), s = h.getUTCSeconds(), p = h.getUTCMilliseconds();
h = (0 >= m || 1E4 <= m ? (0 > m ? "-" : "+") + x(6, 0 > m?-m : m) : x(4, m)) + "-" + x(2, k + 1) + "-" + x(2, n) + "T" + x(2, q) + ":" + x(2, r) + ":" + x(2, s) + "." + x(3, p) + "Z"
} else
h = null;
b && (h = b.call(c, a, h));
if (null === h)
return "null";
m = t.call(h);
if ("[object Boolean]" == m)
return "" + h;
if ("[object Number]" == m)
return h>-1 / 0 && h < 1 / 0 ? "" + h : "null";
if ("[object String]" == m)
return O("" + h);
if ("object" == typeof h) {
for (a = d.length; a--;)
if (d[a] === h)
throw N();
d.push(h);
y = [];
c = l;
l += f;
if ("[object Array]" ==
m) {
k = 0;
for (a = h.length; k < a; k++)
m = L(k, h, b, g, f, l, d), y.push(m === v ? "null" : m);
a = y.length ? f ? "[\n" + l + y.join(",\n" + l) + "\n" + c + "]" : "[" + y.join(",") + "]" : "[]"
} else
C(g || h, function(a) {
var c = L(a, h, b, g, f, l, d);
c !== v && y.push(O(a) + ":" + (f ? " " : "") + c)
}), a = y.length ? f ? "{\n" + l + y.join(",\n" + l) + "\n" + c + "}" : "{" + y.join(",") + "}" : "{}";
d.pop();
return a
}
};
q.stringify = function(a, c, b) {
var g, f, l, d;
if ("function" == typeof c || "object" == typeof c && c)
if ("[object Function]" == (d = t.call(c)))
f = c;
else if ("[object Array]" == d) {
l = {};
for (var h = 0, m = c.length,
k; h < m; k = c[h++], (d = t.call(k), "[object String]" == d || "[object Number]" == d) && (l[k] = 1));
}
if (b)
if ("[object Number]" == (d = t.call(b))) {
if (0 < (b -= b%1))
for (g = "", 10 < b && (b = 10); g.length < b; g += " ");
} else
"[object String]" == d && (g = 10 >= b.length ? b : b.slice(0, 10));
return L("", (k = {}, k[""] = a, k), f, l, g, "", [])
}
}
if (!s("json-parse")) {
var V = B.fromCharCode, W = {
92: "\\",
34: '"',
47: "/",
98: "\b",
116: "\t",
110: "\n",
102: "\f",
114: "\r"
}, b, I, k = function() {
b = I = null;
throw J();
}, z = function() {
for (var a = I, c = a.length, e, g, f, l, d; b < c;)
switch (d = a.charCodeAt(b),
d) {
case 9:
case 10:
case 13:
case 32:
b++;
break;
case 123:
case 125:
case 91:
case 93:
case 58:
case 44:
return e = E ? a.charAt(b) : a[b], b++, e;
case 34:
e = "@";
for (b++; b < c;)
if (d = a.charCodeAt(b), 32 > d)
k();
else if (92 == d)
switch (d = a.charCodeAt(++b), d) {
case 92:
case 34:
case 47:
case 98:
case 116:
case 110:
case 102:
case 114:
e += W[d];
b++;
break;
case 117:
g=++b;
for (f = b + 4; b < f; b++)
d = a.charCodeAt(b), 48 <= d && 57 >= d || 97 <= d && 102 >= d || 65 <= d && 70 >= d || k();
e += V("0x" + a.slice(g, b));
break;
default:
k()
} else {
if (34 == d)
break;
d = a.charCodeAt(b);
for (g = b; 32 <=
d && 92 != d && 34 != d;)
d = a.charCodeAt(++b);
e += a.slice(g, b)
}
if (34 == a.charCodeAt(b))
return b++, e;
k();
default:
g = b;
45 == d && (l=!0, d = a.charCodeAt(++b));
if (48 <= d && 57 >= d) {
for (48 == d && (d = a.charCodeAt(b + 1), 48 <= d && 57 >= d) && k(); b < c && (d = a.charCodeAt(b), 48 <= d && 57 >= d); b++);
if (46 == a.charCodeAt(b)) {
for (f=++b; f < c && (d = a.charCodeAt(f), 48 <= d && 57 >= d); f++);
f == b && k();
b = f
}
d = a.charCodeAt(b);
if (101 == d || 69 == d) {
d = a.charCodeAt(++b);
43 != d && 45 != d || b++;
for (f = b; f < c && (d = a.charCodeAt(f), 48 <= d && 57 >= d); f++);
f == b && k();
b = f
}
return + a.slice(g, b)
}
l &&
k();
if ("true" == a.slice(b, b + 4))
return b += 4, !0;
if ("false" == a.slice(b, b + 5))
return b += 5, !1;
if ("null" == a.slice(b, b + 4))
return b += 4, null;
k()
}
return "$"
}, M = function(a) {
var c, b;
"$" == a && k();
if ("string" == typeof a) {
if ("@" == (E ? a.charAt(0) : a[0]))
return a.slice(1);
if ("[" == a) {
for (c = []; ; b || (b=!0)
) {
a = z();
if ("]" == a)
break;
b && ("," == a ? (a = z(), "]" == a && k()) : k());
"," == a && k();
c.push(M(a))
}
return c
}
if ("{" == a) {
for (c = {}; ; b || (b=!0)
) {
a = z();
if ("}" == a)
break;
b && ("," == a ? (a = z(), "}" == a && k()) : k());
"," != a && "string" == typeof a && "@" == (E ? a.charAt(0) :
a[0]) && ":" == z() || k();
c[a.slice(1)] = M(z())
}
return c
}
k()
}
return a
}, Q = function(a, b, e) {
e = P(a, b, e);
e === v ? delete a[b] : a[b] = e
}, P = function(a, b, e) {
var g = a[b], f;
if ("object" == typeof g && g)
if ("[object Array]" == t.call(g))
for (f = g.length; f--;)
Q(g, f, e);
else
C(g, function(a) {
Q(g, a, e)
});
return e.call(a, b, g)
};
q.parse = function(a, c) {
var e, g;
b = 0;
I = "" + a;
e = M(z());
"$" != z() && k();
b = I = null;
return c && "[object Function]" == t.call(c) ? P((g = {}, g[""] = e, g), "", c) : e
}
}
}
q.runInContext = K;
return q
}
var J = typeof define === "function" && define.amd,
A = "object" == typeof global && global;
!A || A.global !== A && A.window !== A || (n = A);
if ("object" != typeof exports ||!exports || exports.nodeType || J) {
var N = n.JSON, B = K(n, n.JSON3 = {
noConflict: function() {
n.JSON = N;
return B
}
});
n.JSON = {
parse: B.parse,
stringify: B.stringify
}
} else
K(n, exports);
J && define(function() {
return B
})
})(this);
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
$(document).keydown(function(e) {
kkeys.push( e.keyCode );
if ( kkeys.toString().indexOf( konami ) >= 0 ) {
$(document).unbind('keydown', arguments.callee);
// do something awesome
$("html").addClass("konami");
$(window).trigger('KONAMI_CODE');
}
});
var modAnalytics = angular.module('PRPLAnalytics', []);
modAnalytics.factory('$prplAnalytics', function() {
var self = this;
// self.cacheTTL = '0h:0m:2s'; // dev
return {
pageview: function(url) {
ga('send', 'pageview');
// console.log('pageview url', url);
// _gaq.push(['_trackPageview', url]);
},
send: function(obj) {
if (typeof obj === 'undefined') {
return false;
} else {
var type = (typeof obj.type === 'undefined') ? "Default" : obj.type,
action = (typeof obj.action === 'undefined') ? "click" : obj.action,
value = (typeof obj.value === 'undefined') ? "Default" : obj.value;
ga('send', 'event', type, action, value);
// console.info("PRPLAnalyticz: ga('send', 'event', '" + type + "', '" + action + "', '" + value + "');")
}
},
gtm: {
pageview: function(url) {
GTMDataLayer.push({
'event': 'ngPageview',
'ngPageviewURL': url
});
}
}
};
});
modAnalytics.directive('prplAnalytics', ['$prplAnalytics', function($prplAnalytics) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var aVal = 'Default';
if (typeof attrs.analyticsVal !== 'undefined' && attrs.analyticsVal !== '') {
aVal = attrs.analyticsVal;
}
if (attrs.analytics !== '') {
if (attrs.analytics === 'click') {
element.on({
click: function() {
$prplAnalytics.send({
action: 'click',
value: aVal
});
}
});
}
}
}
}
}
]);
//! moment.js
//! version : 2.5.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function(a) {
function b() {
return {
empty: !1,
unusedTokens: [],
unusedInput: [],
overflow: - 2,
charsLeftOver: 0,
nullInput: !1,
invalidMonth: null,
invalidFormat: !1,
userInvalidated: !1,
iso: !1
}
}
function c(a, b) {
return function(c) {
return k(a.call(this, c), b)
}
}
function d(a, b) {
return function(c) {
return this.lang().ordinal(a.call(this, c), b)
}
}
function e() {}
function f(a) {
w(a), h(this, a)
}
function g(a) {
var b = q(a), c = b.year || 0, d = b.month || 0, e = b.week || 0, f = b.day || 0, g = b.hour || 0, h = b.minute || 0, i = b.second || 0, j = b.millisecond || 0;
this._milliseconds =+ j + 1e3 * i + 6e4 * h + 36e5 * g, this._days =+ f + 7 * e, this._months =+ d + 12 * c, this._data = {}, this._bubble()
}
function h(a, b) {
for (var c in b)
b.hasOwnProperty(c) && (a[c] = b[c]);
return b.hasOwnProperty("toString") && (a.toString = b.toString), b.hasOwnProperty("valueOf") && (a.valueOf = b.valueOf), a
}
function i(a) {
var b, c = {};
for (b in a)
a.hasOwnProperty(b) && qb.hasOwnProperty(b) && (c[b] = a[b]);
return c
}
function j(a) {
return 0 > a ? Math.ceil(a) : Math.floor(a)
}
function k(a, b, c) {
for (var d = "" + Math.abs(a), e = a >= 0; d.length < b;)
d = "0" + d;
return (e ? c ? "+" : "" : "-") + d
}
function l(a, b, c, d) {
var e, f, g = b._milliseconds, h = b._days, i = b._months;
g && a._d.setTime( + a._d + g * c), (h || i) && (e = a.minute(), f = a.hour()), h && a.date(a.date() + h * c), i && a.month(a.month() + i * c), g&&!d && db.updateOffset(a), (h || i) && (a.minute(e), a.hour(f))
}
function m(a) {
return "[object Array]" === Object.prototype.toString.call(a)
}
function n(a) {
return "[object Date]" === Object.prototype.toString.call(a) || a instanceof Date
}
function o(a, b, c) {
var d, e = Math.min(a.length, b.length), f = Math.abs(a.length - b.length), g = 0;
for (d = 0; e > d; d++)(c && a[d] !== b[d] ||!c && s(a[d]) !== s(b[d])
) && g++;
return g + f
}
function p(a) {
if (a) {
var b = a.toLowerCase().replace(/(.)s$/, "$1");
a = Tb[a] || Ub[b] || b
}
return a
}
function q(a) {
var b, c, d = {};
for (c in a)
a.hasOwnProperty(c) && (b = p(c), b && (d[b] = a[c]));
return d
}
function r(b) {
var c, d;
if (0 === b.indexOf("week"))
c = 7, d = "day";
else {
if (0 !== b.indexOf("month"))
return;
c = 12, d = "month"
}
db[b] = function(e, f) {
var g, h, i = db.fn._lang[b], j = [];
if ("number" == typeof e && (f = e, e = a), h = function(a) {
var b = db().utc().set(d, a);
return i.call(db.fn._lang, b, e || "")
}, null != f)
return h(f);
for (g = 0; c > g; g++)
j.push(h(g));
return j
}
}
function s(a) {
var b =+ a, c = 0;
return 0 !== b && isFinite(b) && (c = b >= 0 ? Math.floor(b) : Math.ceil(b)), c
}
function t(a, b) {
return new Date(Date.UTC(a, b + 1, 0)).getUTCDate()
}
function u(a) {
return v(a) ? 366 : 365
}
function v(a) {
return a%4 === 0 && a%100 !== 0 || a%400 === 0
}
function w(a) {
var b;
a._a&&-2 === a._pf.overflow && (b = a._a[jb] < 0 || a._a[jb] > 11 ? jb : a._a[kb] < 1 || a._a[kb] > t(a._a[ib], a._a[jb]) ? kb : a._a[lb] < 0 || a._a[lb] > 23 ? lb : a._a[mb] < 0 || a._a[mb] > 59 ? mb : a._a[nb] < 0 || a._a[nb] > 59 ? nb : a._a[ob] < 0 || a._a[ob] > 999 ? ob : - 1, a._pf._overflowDayOfYear && (ib > b || b > kb) && (b = kb), a._pf.overflow = b)
}
function x(a) {
return null == a._isValid && (a._isValid=!isNaN(a._d.getTime()) && a._pf.overflow < 0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated, a._strict && (a._isValid = a._isValid && 0 === a._pf.charsLeftOver && 0 === a._pf.unusedTokens.length)), a._isValid
}
function y(a) {
return a ? a.toLowerCase().replace("_", "-") : a
}
function z(a, b) {
return b._isUTC ? db(a).zone(b._offset || 0) : db(a).local()
}
function A(a, b) {
return b.abbr = a, pb[a] || (pb[a] = new e), pb[a].set(b), pb[a]
}
function B(a) {
delete pb[a]
}
function C(a) {
var b, c, d, e, f = 0, g = function(a) {
if (!pb[a] && rb)
try {
require("./lang/" + a)
} catch (b) {}
return pb[a]
};
if (!a)
return db.fn._lang;
if (!m(a)) {
if (c = g(a))
return c;
a = [a]
}
for (; f < a.length;) {
for (e = y(a[f]).split("-"), b = e.length, d = y(a[f + 1]), d = d ? d.split("-") : null; b > 0;) {
if (c = g(e.slice(0, b).join("-")))
return c;
if (d && d.length >= b && o(e, d, !0) >= b - 1)
break;
b--
}
f++
}
return db.fn._lang
}
function D(a) {
return a.match(/\[[\s\S]/) ? a.replace(/^\[|\]$/g, "") : a.replace(/\\/g, "")
}
function E(a) {
var b, c, d = a.match(vb);
for (b = 0, c = d.length; c > b; b++)
d[b] = Yb[d[b]] ? Yb[d[b]] : D(d[b]);
return function(e) {
var f = "";
for (b = 0; c > b; b++)
f += d[b]instanceof Function ? d[b].call(e, a) : d[b];
return f
}
}
function F(a, b) {
return a.isValid() ? (b = G(b, a.lang()), Vb[b] || (Vb[b] = E(b)), Vb[b](a)) : a.lang().invalidDate()
}
function G(a, b) {
function c(a) {
return b.longDateFormat(a) || a
}
var d = 5;
for (wb.lastIndex = 0; d >= 0 && wb.test(a);)
a = a.replace(wb, c), wb.lastIndex = 0, d -= 1;
return a
}
function H(a, b) {
var c, d = b._strict;
switch (a) {
case"DDDD":
return Ib;
case"YYYY":
case"GGGG":
case"gggg":
return d ? Jb : zb;
case"Y":
case"G":
case"g":
return Lb;
case"YYYYYY":
case"YYYYY":
case"GGGGG":
case"ggggg":
return d ? Kb : Ab;
case"S":
if (d)
return Gb;
case"SS":
if (d)
return Hb;
case"SSS":
if (d)
return Ib;
case"DDD":
return yb;
case"MMM":
case"MMMM":
case"dd":
case"ddd":
case"dddd":
return Cb;
case"a":
case"A":
return C(b._l)._meridiemParse;
case"X":
return Fb;
case"Z":
case"ZZ":
return Db;
case"T":
return Eb;
case"SSSS":
return Bb;
case"MM":
case"DD":
case"YY":
case"GG":
case"gg":
case"HH":
case"hh":
case"mm":
case"ss":
case"ww":
case"WW":
return d ? Hb : xb;
case"M":
case"D":
case"d":
case"H":
case"h":
case"m":
case"s":
case"w":
case"W":
case"e":
case"E":
return xb;
default:
return c = new RegExp(P(O(a.replace("\\", "")), "i"))
}
}
function I(a) {
a = a || "";
var b = a.match(Db) || [], c = b[b.length - 1] || [], d = (c + "").match(Qb) || ["-", 0, 0], e =+ (60 * d[1]) + s(d[2]);
return "+" === d[0]?-e : e
}
function J(a, b, c) {
var d, e = c._a;
switch (a) {
case"M":
case"MM":
null != b && (e[jb] = s(b) - 1);
break;
case"MMM":
case"MMMM":
d = C(c._l).monthsParse(b), null != d ? e[jb] = d : c._pf.invalidMonth = b;
break;
case"D":
case"DD":
null != b && (e[kb] = s(b));
break;
case"DDD":
case"DDDD":
null != b && (c._dayOfYear = s(b));
break;
case"YY":
e[ib] = s(b) + (s(b) > 68 ? 1900 : 2e3);
break;
case"YYYY":
case"YYYYY":
case"YYYYYY":
e[ib] = s(b);
break;
case"a":
case"A":
c._isPm = C(c._l).isPM(b);
break;
case"H":
case"HH":
case"h":
case"hh":
e[lb] = s(b);
break;
case"m":
case"mm":
e[mb] = s(b);
break;
case"s":
case"ss":
e[nb] = s(b);
break;
case"S":
case"SS":
case"SSS":
case"SSSS":
e[ob] = s(1e3 * ("0." + b));
break;
case"X":
c._d = new Date(1e3 * parseFloat(b));
break;
case"Z":
case"ZZ":
c._useUTC=!0, c._tzm = I(b);
break;
case"w":
case"ww":
case"W":
case"WW":
case"d":
case"dd":
case"ddd":
case"dddd":
case"e":
case"E":
a = a.substr(0, 1);
case"gg":
case"gggg":
case"GG":
case"GGGG":
case"GGGGG":
a = a.substr(0, 2), b && (c._w = c._w || {}, c._w[a] = b)
}
}
function K(a) {
var b, c, d, e, f, g, h, i, j, k, l = [];
if (!a._d) {
for (d = M(a), a._w && null == a._a[kb] && null == a._a[jb] && (f = function(b) {
var c = parseInt(b, 10);
return b ? b.length < 3 ? c > 68 ? 1900 + c : 2e3 + c : c : null == a._a[ib] ? db().weekYear() : a._a[ib]
}, g = a._w, null != g.GG || null != g.W || null != g.E ? h = Z(f(g.GG), g.W || 1, g.E, 4, 1) : (i = C(a._l), j = null != g.d ? V(g.d, i) : null != g.e ? parseInt(g.e, 10) + i._week.dow : 0, k = parseInt(g.w, 10) || 1, null != g.d && j < i._week.dow && k++, h = Z(f(g.gg), k, j, i._week.doy, i._week.dow)), a._a[ib] = h.year, a._dayOfYear = h.dayOfYear), a._dayOfYear && (e = null == a._a[ib] ? d[ib] : a._a[ib], a._dayOfYear > u(e) && (a._pf._overflowDayOfYear=!0), c = U(e, 0, a._dayOfYear), a._a[jb] = c.getUTCMonth(), a._a[kb] = c.getUTCDate()), b = 0; 3 > b && null == a._a[b]; ++b)
a._a[b] = l[b] = d[b];
for (; 7 > b; b++)
a._a[b] = l[b] = null == a._a[b] ? 2 === b ? 1 : 0 : a._a[b];
l[lb] += s((a._tzm || 0) / 60), l[mb] += s((a._tzm || 0)%60), a._d = (a._useUTC ? U : T).apply(null, l)
}
}
function L(a) {
var b;
a._d || (b = q(a._i), a._a = [b.year, b.month, b.day, b.hour, b.minute, b.second, b.millisecond], K(a))
}
function M(a) {
var b = new Date;
return a._useUTC ? [b.getUTCFullYear(), b.getUTCMonth(), b.getUTCDate()] : [b.getFullYear(), b.getMonth(), b.getDate()]
}
function N(a) {
a._a = [], a._pf.empty=!0;
var b, c, d, e, f, g = C(a._l), h = "" + a._i, i = h.length, j = 0;
for (d = G(a._f, g).match(vb) || [], b = 0; b < d.length; b++)
e = d[b], c = (h.match(H(e, a)) || [])[0], c && (f = h.substr(0, h.indexOf(c)), f.length > 0 && a._pf.unusedInput.push(f), h = h.slice(h.indexOf(c) + c.length), j += c.length), Yb[e] ? (c ? a._pf.empty=!1 : a._pf.unusedTokens.push(e), J(e, c, a)) : a._strict&&!c && a._pf.unusedTokens.push(e);
a._pf.charsLeftOver = i - j, h.length > 0 && a._pf.unusedInput.push(h), a._isPm && a._a[lb] < 12 && (a._a[lb] += 12), a._isPm===!1 && 12 === a._a[lb] && (a._a[lb] = 0), K(a), w(a)
}
function O(a) {
return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(a, b, c, d, e) {
return b || c || d || e
})
}
function P(a) {
return a.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
}
function Q(a) {
var c, d, e, f, g;
if (0 === a._f.length)
return a._pf.invalidFormat=!0, a._d = new Date(0 / 0), void 0;
for (f = 0; f < a._f.length; f++)
g = 0, c = h({}, a), c._pf = b(), c._f = a._f[f], N(c), x(c) && (g += c._pf.charsLeftOver, g += 10 * c._pf.unusedTokens.length, c._pf.score = g, (null == e || e > g) && (e = g, d = c));
h(a, d || c)
}
function R(a) {
var b, c, d = a._i, e = Mb.exec(d);
if (e) {
for (a._pf.iso=!0, b = 0, c = Ob.length; c > b; b++)
if (Ob[b][1].exec(d)) {
a._f = Ob[b][0] + (e[6] || " ");
break
}
for (b = 0, c = Pb.length; c > b; b++)
if (Pb[b][1].exec(d)) {
a._f += Pb[b][0];
break
}
d.match(Db) && (a._f += "Z"), N(a)
} else
a._d = new Date(d)
}
function S(b) {
var c = b._i, d = sb.exec(c);
c === a ? b._d = new Date : d ? b._d = new Date( + d[1]) : "string" == typeof c ? R(b) : m(c) ? (b._a = c.slice(0), K(b)) : n(c) ? b._d = new Date( + c) : "object" == typeof c ? L(b) : b._d = new Date(c)
}
function T(a, b, c, d, e, f, g) {
var h = new Date(a, b, c, d, e, f, g);
return 1970 > a && h.setFullYear(a), h
}
function U(a) {
var b = new Date(Date.UTC.apply(null, arguments));
return 1970 > a && b.setUTCFullYear(a), b
}
function V(a, b) {
if ("string" == typeof a)
if (isNaN(a)) {
if (a = b.weekdaysParse(a), "number" != typeof a)
return null
} else
a = parseInt(a, 10);
return a
}
function W(a, b, c, d, e) {
return e.relativeTime(b || 1, !!c, a, d)
}
function X(a, b, c) {
var d = hb(Math.abs(a) / 1e3), e = hb(d / 60), f = hb(e / 60), g = hb(f / 24), h = hb(g / 365), i = 45 > d && ["s", d] || 1 === e && ["m"] || 45 > e && ["mm", e] || 1 === f && ["h"] || 22 > f && ["hh", f] || 1 === g && ["d"] || 25 >= g && ["dd", g] || 45 >= g && ["M"] || 345 > g && ["MM", hb(g / 30)] || 1 === h && ["y"] || ["yy", h];
return i[2] = b, i[3] = a > 0, i[4] = c, W.apply({}, i)
}
function Y(a, b, c) {
var d, e = c - b, f = c - a.day();
return f > e && (f -= 7), e - 7 > f && (f += 7), d = db(a).add("d", f), {
week: Math.ceil(d.dayOfYear() / 7),
year: d.year()
}
}
function Z(a, b, c, d, e) {
var f, g, h = U(a, 0, 1).getUTCDay();
return c = null != c ? c : e, f = e - h + (h > d ? 7 : 0) - (e > h ? 7 : 0), g = 7 * (b - 1) + (c - e) + f + 1, {
year: g > 0 ? a: a - 1,
dayOfYear: g > 0 ? g: u(a - 1) + g
}
}
function $(a) {
var b = a._i, c = a._f;
return null === b ? db.invalid({
nullInput: !0
}) : ("string" == typeof b && (a._i = b = C().preparse(b)), db.isMoment(b) ? (a = i(b), a._d = new Date( + b._d)) : c ? m(c) ? Q(a) : N(a) : S(a), new f(a))
}
function _(a, b) {
db.fn[a] = db.fn[a + "s"] = function(a) {
var c = this._isUTC ? "UTC": "";
return null != a ? (this._d["set" + c + b](a), db.updateOffset(this), this) : this._d["get" + c + b]()
}
}
function ab(a) {
db.duration.fn[a] = function() {
return this._data[a]
}
}
function bb(a, b) {
db.duration.fn["as" + a] = function() {
return + this / b
}
}
function cb(a) {
var b=!1, c = db;
"undefined" == typeof ender && (a ? (gb.moment = function() {
return !b && console && console.warn && (b=!0, console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")), c.apply(null, arguments)
}, h(gb.moment, c)) : gb.moment = db)
}
for (var db, eb, fb = "2.5.1", gb = this, hb = Math.round, ib = 0, jb = 1, kb = 2, lb = 3, mb = 4, nb = 5, ob = 6, pb = {}, qb = {
_isAMomentObject: null,
_i: null,
_f: null,
_l: null,
_strict: null,
_isUTC: null,
_offset: null,
_pf: null,
_lang: null
}, rb = "undefined" != typeof module && module.exports && "undefined" != typeof require, sb = /^\/?Date\((\-?\d+)/i, tb = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/, ub = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, vb = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g, wb = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, xb = /\d\d?/, yb = /\d{1,3}/, zb = /\d{1,4}/, Ab = /[+\-]?\d{1,6}/, Bb = /\d+/, Cb = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, Db = /Z|[\+\-]\d\d:?\d\d/gi, Eb = /T/i, Fb = /[\+\-]?\d+(\.\d{1,3})?/, Gb = /\d/, Hb = /\d\d/, Ib = /\d{3}/, Jb = /\d{4}/, Kb = /[+-]?\d{6}/, Lb = /[+-]?\d+/, Mb = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, Nb = "YYYY-MM-DDTHH:mm:ssZ", Ob = [["YYYYYY-MM-DD", /[+-]\d{6}-\d{2}-\d{2}/], ["YYYY-MM-DD", /\d{4}-\d{2}-\d{2}/], ["GGGG-[W]WW-E", /\d{4}-W\d{2}-\d/], ["GGGG-[W]WW", /\d{4}-W\d{2}/], ["YYYY-DDD", /\d{4}-\d{3}/]], Pb = [["HH:mm:ss.SSSS", /(T| )\d\d:\d\d:\d\d\.\d{1,3}/], ["HH:mm:ss", /(T| )\d\d:\d\d:\d\d/], ["HH:mm", /(T| )\d\d:\d\d/], ["HH", /(T| )\d\d/]], Qb = /([\+\-]|\d\d)/gi, Rb = "Date|Hours|Minutes|Seconds|Milliseconds".split("|")
, Sb = {
Milliseconds: 1,
Seconds: 1e3,
Minutes: 6e4,
Hours: 36e5,
Days: 864e5,
Months: 2592e6,
Years: 31536e6
}, Tb = {
ms: "millisecond",
s: "second",
m: "minute",
h: "hour",
d: "day",
D: "date",
w: "week",
W: "isoWeek",
M: "month",
y: "year",
DDD: "dayOfYear",
e: "weekday",
E: "isoWeekday",
gg: "weekYear",
GG: "isoWeekYear"
}, Ub = {
dayofyear: "dayOfYear",
isoweekday: "isoWeekday",
isoweek: "isoWeek",
weekyear: "weekYear",
isoweekyear: "isoWeekYear"
}, Vb = {}, Wb = "DDD w W M D d".split(" "), Xb = "M D H h m s w W".split(" "), Yb = {
M: function() {
return this.month() + 1
},
MMM: function(a) {
return this.lang().monthsShort(this, a)
},
MMMM: function(a) {
return this.lang().months(this, a)
},
D: function() {
return this.date()
},
DDD: function() {
return this.dayOfYear()
},
d: function() {
return this.day()
},
dd: function(a) {
return this.lang().weekdaysMin(this, a)
},
ddd: function(a) {
return this.lang().weekdaysShort(this, a)
},
dddd: function(a) {
return this.lang().weekdays(this, a)
},
w: function() {
return this.week()
},
W: function() {
return this.isoWeek()
},
YY: function() {
return k(this.year()%100, 2)
},
YYYY: function() {
return k(this.year(), 4)
},
YYYYY: function() {
return k(this.year(), 5)
},
YYYYYY: function() {
var a = this.year(), b = a >= 0 ? "+": "-";
return b + k(Math.abs(a), 6)
},
gg: function() {
return k(this.weekYear()%100, 2)
},
gggg: function() {
return k(this.weekYear(), 4)
},
ggggg: function() {
return k(this.weekYear(), 5)
},
GG: function() {
return k(this.isoWeekYear()%100, 2)
},
GGGG: function() {
return k(this.isoWeekYear(), 4)
},
GGGGG: function() {
return k(this.isoWeekYear(), 5)
},
e: function() {
return this.weekday()
},
E: function() {
return this.isoWeekday()
},
a: function() {
return this.lang().meridiem(this.hours(), this.minutes(), !0)
},
A: function() {
return this.lang().meridiem(this.hours(), this.minutes(), !1)
},
H: function() {
return this.hours()
},
h: function() {
return this.hours()%12 || 12
},
m: function() {
return this.minutes()
},
s: function() {
return this.seconds()
},
S: function() {
return s(this.milliseconds() / 100)
},
SS: function() {
return k(s(this.milliseconds() / 10), 2)
},
SSS: function() {
return k(this.milliseconds(), 3)
},
SSSS: function() {
return k(this.milliseconds(), 3)
},
Z: function() {
var a =- this.zone(), b = "+";
return 0 > a && (a =- a, b = "-"), b + k(s(a / 60), 2) + ":" + k(s(a)%60, 2)
},
ZZ: function() {
var a =- this.zone(), b = "+";
return 0 > a && (a =- a, b = "-"), b + k(s(a / 60), 2) + k(s(a)%60, 2)
},
z: function() {
return this.zoneAbbr()
},
zz: function() {
return this.zoneName()
},
X: function() {
return this.unix()
},
Q: function() {
return this.quarter()
}
}, Zb = ["months", "monthsShort", "weekdays", "weekdaysShort", "weekdaysMin"];
Wb.length;
)eb = Wb.pop(), Yb[eb + "o"] = d(Yb[eb], eb);
for (; Xb.length;)
eb = Xb.pop(), Yb[eb + eb] = c(Yb[eb], 2);
for (Yb.DDDD = c(Yb.DDD, 3), h(e.prototype, {
set: function(a) {
var b, c;
for (c in a)
b = a[c], "function" == typeof b ? this[c] = b : this["_" + c] = b
},
_months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
months: function(a) {
return this._months[a.month()]
},
_monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
monthsShort: function(a) {
return this._monthsShort[a.month()]
},
monthsParse: function(a) {
var b, c, d;
for (this._monthsParse || (this._monthsParse = []), b = 0; 12 > b; b++)
if (this._monthsParse[b] || (c = db.utc([2e3, b]), d = "^" + this.months(c, "") + "|^" + this.monthsShort(c, ""), this._monthsParse[b] = new RegExp(d.replace(".", ""), "i")), this._monthsParse[b].test(a))
return b
},
_weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
weekdays: function(a) {
return this._weekdays[a.day()]
},
_weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
weekdaysShort: function(a) {
return this._weekdaysShort[a.day()]
},
_weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
weekdaysMin: function(a) {
return this._weekdaysMin[a.day()]
},
weekdaysParse: function(a) {
var b, c, d;
for (this._weekdaysParse || (this._weekdaysParse = []), b = 0; 7 > b; b++)
if (this._weekdaysParse[b] || (c = db([2e3, 1]).day(b), d = "^" + this.weekdays(c, "") + "|^" + this.weekdaysShort(c, "") + "|^" + this.weekdaysMin(c, ""), this._weekdaysParse[b] = new RegExp(d.replace(".", ""), "i")), this._weekdaysParse[b].test(a))
return b
},
_longDateFormat: {
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D YYYY",
LLL: "MMMM D YYYY LT",
LLLL: "dddd, MMMM D YYYY LT"
},
longDateFormat: function(a) {
var b = this._longDateFormat[a];
return !b && this._longDateFormat[a.toUpperCase()] && (b = this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function(a) {
return a.slice(1)
}), this._longDateFormat[a] = b), b
},
isPM: function(a) {
return "p" === (a + "").toLowerCase().charAt(0)
},
_meridiemParse: /[ap]\.?m?\.?/i,
meridiem: function(a, b, c) {
return a > 11 ? c ? "pm" : "PM" : c ? "am" : "AM"
},
_calendar: {
sameDay: "[Today at] LT",
nextDay: "[Tomorrow at] LT",
nextWeek: "dddd [at] LT",
lastDay: "[Yesterday at] LT",
lastWeek: "[Last] dddd [at] LT",
sameElse: "L"
},
calendar: function(a, b) {
var c = this._calendar[a];
return "function" == typeof c ? c.apply(b) : c
},
_relativeTime: {
future: "in %s",
past: "%s ago",
s: "a few seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
hh: "%d hours",
d: "a day",
dd: "%d days",
M: "a month",
MM: "%d months",
y: "a year",
yy: "%d years"
},
relativeTime: function(a, b, c, d) {
var e = this._relativeTime[c];
return "function" == typeof e ? e(a, b, c, d) : e.replace(/%d/i, a)
},
pastFuture: function(a, b) {
var c = this._relativeTime[a > 0 ? "future": "past"];
return "function" == typeof c ? c(b) : c.replace(/%s/i, b)
},
ordinal: function(a) {
return this._ordinal.replace("%d", a)
},
_ordinal: "%d",
preparse: function(a) {
return a
},
postformat: function(a) {
return a
},
week: function(a) {
return Y(a, this._week.dow, this._week.doy).week
},
_week: {
dow: 0,
doy: 6
},
_invalidDate: "Invalid date",
invalidDate: function() {
return this._invalidDate
}
}), db = function(c, d, e, f) {
var g;
return "boolean" == typeof e && (f = e, e = a), g = {}, g._isAMomentObject=!0, g._i = c, g._f = d, g._l = e, g._strict = f, g._isUTC=!1, g._pf = b(), $(g)
}, db.utc = function(c, d, e, f) {
var g;
return "boolean" == typeof e && (f = e, e = a), g = {}, g._isAMomentObject=!0, g._useUTC=!0, g._isUTC=!0, g._l = e, g._i = c, g._f = d, g._strict = f, g._pf = b(), $(g).utc()
}, db.unix = function(a) {
return db(1e3 * a)
}, db.duration = function(a, b) {
var c, d, e, f = a, h = null;
return db.isDuration(a) ? f = {
ms: a._milliseconds,
d: a._days,
M: a._months
} : "number" == typeof a ? (f = {}, b ? f[b] = a : f.milliseconds = a) : (h = tb.exec(a)) ? (c = "-" === h[1]?-1 : 1, f = {
y : 0, d : s(h[kb]) * c, h : s(h[lb]) * c, m : s(h[mb]) * c, s : s(h[nb]) * c, ms : s(h[ob]) * c
})
: (h = ub.exec(a)) && (c = "-" === h[1]?-1 : 1, e = function(a) {
var b = a && parseFloat(a.replace(",", "."));
return (isNaN(b) ? 0 : b) * c
}, f = {
y: e(h[2]),
M: e(h[3]),
d: e(h[4]),
h: e(h[5]),
m: e(h[6]),
s: e(h[7]),
w: e(h[8])
}), d = new g(f), db.isDuration(a) && a.hasOwnProperty("_lang") && (d._lang = a._lang), d
}, db.version = fb, db.defaultFormat = Nb, db.updateOffset = function() {}, db.lang = function(a, b) {
var c;
return a ? (b ? A(y(a), b) : null === b ? (B(a), a = "en") : pb[a] || C(a), c = db.duration.fn._lang = db.fn._lang = C(a), c._abbr) : db.fn._lang._abbr
}, db.langData = function(a) {
return a && a._lang && a._lang._abbr && (a = a._lang._abbr), C(a)
}, db.isMoment = function(a) {
return a instanceof f || null != a && a.hasOwnProperty("_isAMomentObject")
}, db.isDuration = function(a) {
return a instanceof g
}, eb = Zb.length - 1; eb >= 0; --eb)r(Zb[eb]);
for (db.normalizeUnits = function(a) {
return p(a)
}, db.invalid = function(a) {
var b = db.utc(0 / 0);
return null != a ? h(b._pf, a) : b._pf.userInvalidated=!0, b
}, db.parseZone = function(a) {
return db(a).parseZone()
}, h(db.fn = f.prototype, {
clone: function() {
return db(this)
},
valueOf: function() {
return + this._d + 6e4 * (this._offset || 0)
},
unix: function() {
return Math.floor( + this / 1e3)
},
toString: function() {
return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")
},
toDate: function() {
return this._offset ? new Date( + this) : this._d
},
toISOString: function() {
var a = db(this).utc();
return 0 < a.year() && a.year() <= 9999 ? F(a, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]") : F(a, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")
},
toArray: function() {
var a = this;
return [a.year(), a.month(), a.date(), a.hours(), a.minutes(), a.seconds(), a.milliseconds()]
},
isValid: function() {
return x(this)
},
isDSTShifted: function() {
return this._a ? this.isValid() && o(this._a, (this._isUTC ? db.utc(this._a) : db(this._a)).toArray()) > 0 : !1
},
parsingFlags: function() {
return h({}, this._pf)
},
invalidAt: function() {
return this._pf.overflow
},
utc: function() {
return this.zone(0)
},
local: function() {
return this.zone(0), this._isUTC=!1, this
},
format: function(a) {
var b = F(this, a || db.defaultFormat);
return this.lang().postformat(b)
},
add: function(a, b) {
var c;
return c = "string" == typeof a ? db.duration( + b, a) : db.duration(a, b), l(this, c, 1), this
},
subtract: function(a, b) {
var c;
return c = "string" == typeof a ? db.duration( + b, a) : db.duration(a, b), l(this, c, - 1), this
},
diff: function(a, b, c) {
var d, e, f = z(a, this), g = 6e4 * (this.zone() - f.zone());
return b = p(b), "year" === b || "month" === b ? (d = 432e5 * (this.daysInMonth() + f.daysInMonth()), e = 12 * (this.year() - f.year()) + (this.month() - f.month()), e += (this - db(this).startOf("month") - (f - db(f).startOf("month"))) / d, e -= 6e4 * (this.zone() - db(this).startOf("month").zone() - (f.zone() - db(f).startOf("month").zone())) / d, "year" === b && (e/=12)) : (d = this - f, e = "second" === b ? d / 1e3 : "minute" === b ? d / 6e4 : "hour" === b ? d / 36e5 : "day" === b ? (d - g) / 864e5 : "week" === b ? (d - g) / 6048e5 : d), c ? e : j(e)
},
from: function(a, b) {
return db.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)
},
fromNow: function(a) {
return this.from(db(), a)
},
calendar: function() {
var a = z(db(), this).startOf("day"), b = this.diff(a, "days", !0), c =- 6 > b ? "sameElse" : - 1 > b ? "lastWeek" : 0 > b ? "lastDay" : 1 > b ? "sameDay" : 2 > b ? "nextDay" : 7 > b ? "nextWeek" : "sameElse";
return this.format(this.lang().calendar(c, this))
},
isLeapYear: function() {
return v(this.year())
},
isDST: function() {
return this.zone() < this.clone().month(0).zone() || this.zone() < this.clone().month(5).zone()
},
day: function(a) {
var b = this._isUTC ? this._d.getUTCDay(): this._d.getDay();
return null != a ? (a = V(a, this.lang()), this.add({
d: a - b
})) : b
},
month: function(a) {
var b, c = this._isUTC ? "UTC": "";
return null != a ? "string" == typeof a && (a = this.lang().monthsParse(a), "number" != typeof a) ? this : (b = this.date(), this.date(1), this._d["set" + c + "Month"](a), this.date(Math.min(b, this.daysInMonth())), db.updateOffset(this), this) : this._d["get" + c + "Month"]()
},
startOf: function(a) {
switch (a = p(a)) {
case"year":
this.month(0);
case"month":
this.date(1);
case"week":
case"isoWeek":
case"day":
this.hours(0);
case"hour":
this.minutes(0);
case"minute":
this.seconds(0);
case"second":
this.milliseconds(0)
}
return "week" === a ? this.weekday(0) : "isoWeek" === a && this.isoWeekday(1), this
},
endOf: function(a) {
return a = p(a), this.startOf(a).add("isoWeek" === a ? "week" : a, 1).subtract("ms", 1)
},
isAfter: function(a, b) {
return b = "undefined" != typeof b ? b : "millisecond", + this.clone().startOf(b)>+db(a).startOf(b)
},
isBefore: function(a, b) {
return b = "undefined" != typeof b ? b : "millisecond", + this.clone().startOf(b)<+db(a).startOf(b)
},
isSame: function(a, b) {
return b = b || "ms", + this.clone().startOf(b) ===+ z(a, this).startOf(b)
},
min: function(a) {
return a = db.apply(null, arguments), this > a ? this : a
},
max: function(a) {
return a = db.apply(null, arguments), a > this ? this : a
},
zone: function(a) {
var b = this._offset || 0;
return null == a ? this._isUTC ? b : this._d.getTimezoneOffset() : ("string" == typeof a && (a = I(a)), Math.abs(a) < 16 && (a = 60 * a), this._offset = a, this._isUTC=!0, b !== a && l(this, db.duration(b - a, "m"), 1, !0), this)
},
zoneAbbr: function() {
return this._isUTC ? "UTC" : ""
},
zoneName: function() {
return this._isUTC ? "Coordinated Universal Time" : ""
},
parseZone: function() {
return this._tzm ? this.zone(this._tzm) : "string" == typeof this._i && this.zone(this._i), this
},
hasAlignedHourOffset: function(a) {
return a = a ? db(a).zone() : 0, (this.zone() - a)%60 === 0
},
daysInMonth: function() {
return t(this.year(), this.month())
},
dayOfYear: function(a) {
var b = hb((db(this).startOf("day") - db(this).startOf("year")) / 864e5) + 1;
return null == a ? b : this.add("d", a - b)
},
quarter: function() {
return Math.ceil((this.month() + 1) / 3)
},
weekYear: function(a) {
var b = Y(this, this.lang()._week.dow, this.lang()._week.doy).year;
return null == a ? b : this.add("y", a - b)
},
isoWeekYear: function(a) {
var b = Y(this, 1, 4).year;
return null == a ? b : this.add("y", a - b)
},
week: function(a) {
var b = this.lang().week(this);
return null == a ? b : this.add("d", 7 * (a - b))
},
isoWeek: function(a) {
var b = Y(this, 1, 4).week;
return null == a ? b : this.add("d", 7 * (a - b))
},
weekday: function(a) {
var b = (this.day() + 7 - this.lang()._week.dow)%7;
return null == a ? b : this.add("d", a - b)
},
isoWeekday: function(a) {
return null == a ? this.day() || 7 : this.day(this.day()%7 ? a : a - 7)
},
get: function(a) {
return a = p(a), this[a]()
},
set: function(a, b) {
return a = p(a), "function" == typeof this[a] && this[a](b), this
},
lang: function(b) {
return b === a ? this._lang : (this._lang = C(b), this)
}
}), eb = 0; eb < Rb.length; eb++)
_(Rb[eb].toLowerCase().replace(/s$/, ""), Rb[eb]);
_("year", "FullYear"), db.fn.days = db.fn.day, db.fn.months = db.fn.month, db.fn.weeks = db.fn.week, db.fn.isoWeeks = db.fn.isoWeek, db.fn.toJSON = db.fn.toISOString, h(db.duration.fn = g.prototype, {
_bubble: function() {
var a, b, c, d, e = this._milliseconds, f = this._days, g = this._months, h = this._data;
h.milliseconds = e%1e3, a = j(e / 1e3), h.seconds = a%60, b = j(a / 60), h.minutes = b%60, c = j(b / 60), h.hours = c%24, f += j(c / 24), h.days = f%30, g += j(f / 30), h.months = g%12, d = j(g / 12), h.years = d
},
weeks: function() {
return j(this.days() / 7)
},
valueOf: function() {
return this._milliseconds + 864e5 * this._days + this._months%12 * 2592e6 + 31536e6 * s(this._months / 12)
},
humanize: function(a) {
var b =+ this, c = X(b, !a, this.lang());
return a && (c = this.lang().pastFuture(b, c)), this.lang().postformat(c)
},
add: function(a, b) {
var c = db.duration(a, b);
return this._milliseconds += c._milliseconds, this._days += c._days, this._months += c._months, this._bubble(), this
},
subtract: function(a, b) {
var c = db.duration(a, b);
return this._milliseconds -= c._milliseconds, this._days -= c._days, this._months -= c._months, this._bubble(), this
},
get: function(a) {
return a = p(a), this[a.toLowerCase() + "s"]()
},
as: function(a) {
return a = p(a), this["as" + a.charAt(0).toUpperCase() + a.slice(1) + "s"]()
},
lang: db.fn.lang,
toIsoString: function() {
var a = Math.abs(this.years()), b = Math.abs(this.months()), c = Math.abs(this.days()), d = Math.abs(this.hours()), e = Math.abs(this.minutes()), f = Math.abs(this.seconds() + this.milliseconds() / 1e3);
return this.asSeconds() ? (this.asSeconds() < 0 ? "-" : "") + "P" + (a ? a + "Y" : "") + (b ? b + "M" : "") + (c ? c + "D" : "") + (d || e || f ? "T" : "") + (d ? d + "H" : "") + (e ? e + "M" : "") + (f ? f + "S" : "") : "P0D"
}
});
for (eb in Sb)
Sb.hasOwnProperty(eb) && (bb(eb, Sb[eb]), ab(eb.toLowerCase()));
bb("Weeks", 6048e5), db.duration.fn.asMonths = function() {
return ( + this - 31536e6 * this.years()) / 2592e6 + 12 * this.years()
}, db.lang("en", {
ordinal: function(a) {
var b = a%10, c = 1 === s(a%100 / 10) ? "th": 1 === b ? "st": 2 === b ? "nd": 3 === b ? "rd": "th";
return a + c
}
}), rb ? (module.exports = db, cb(!0)) : "function" == typeof define && define.amd ? define("moment", function(b, c, d) {
return d.config && d.config() && d.config().noGlobal!==!0 && cb(d.config().noGlobal === a), db
}) : cb()
}).call(this);
/* ================
*
* Videoz
*
* =============== */
var PRPLVideo = function (customization) {
var custom = customization;
// generated html example
// <video id="" class="" preload="preload" poster="" autoplay="true" loop="true" muted="true">
// <source src="skin/frontend/videri/default/videos/Home_2.mp4" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;">
// <source src="skin/frontend/videri/default/videos/Home_2.webmhd.webm" type="video/webm;">
// </video>
var $videos = $('[data-video="true"]');
// console.log($videos)
if ($videos.length > 0) {
for (var i = $videos.length - 1;
i >= 0;
i--) {
//get data
var $video = $($videos[i]);
var $videoParent = $video.parent(); //appendTo later;
var videoData = (typeof $video.data() !== 'undefined') ? $video.data() : false;;
var videoID = (typeof $video.attr('id') !== 'undefined') ? $video.attr('id') : 'video' + i; //generated id fallback
var videoClasses = (typeof $video.attr('class') !== 'undefined') ? $video.attr('class') : ''; //add default html classes?
//use supplied or defaults
var v = {};
v.autoplay = (typeof videoData.videoAutoplay !== 'undefined') ? videoData.videoAutoplay : true;
v.loop = (typeof videoData.videoLoop !== 'undefined') ? videoData.videoLoop : false;
v.muted = (typeof videoData.videoMuted !== 'undefined') ? videoData.videoMuted : false;
v.poster = (typeof videoData.videoPoster !== 'undefined') ? videoData.videoPoster : '';
v.preload = (typeof videoData.videoPreload !== 'undefined') ? videoData.videoPreload : false;
// defaults set above
v.htmlClasses = videoClasses;
v.htmlID = videoID;
// build html
var el = '';
if (!Modernizr.touch) {
// video element
el += '<video id="' + v.htmlID + '" class="' + v.htmlClasses + '" ';
// autoplay="' + v.autoplay + '" loop="' + v.loop + '" muted="' + v.muted + '" poster="' + v.poster + '" preload="' + v.preload + '">';
if (v.autoplay !== false) {
el += 'autoplay="' + v.autoplay + '" ';
}
if (v.loop !== false) {
el += 'loop="' + v.loop + '" ';
}
if (v.muted !== false) {
el += 'muted="' + v.muted + '" ';
}
if (v.poster !== false && v.poster !== '') {
el += 'poster="' + v.poster + '" ';
}
if (v.preload !== false) {
el += 'preload="' + v.preload + '" ';
}
el += '>';
// video sources
var $sources = $($videos[i]).find('[data-video-source]');
for (var j = $sources.length - 1; j >= 0; j--) {
var sourceData = $($sources[j]).data();
// console.log('Video Source Data: ', sourceData);
if (typeof sourceData !== 'undefined') {
var s = {};
s.src = (typeof sourceData.videoSource !== 'undefined') ? sourceData.videoSource : '';
s.type = (typeof sourceData.videoType !== 'undefined') ? sourceData.videoType : '';
el += '<source src="' + s.src + '" type="' + s.type + '" />';
}
};
el += '</video>';
}
// video css overlay
var $overlays = $($videos[i]).find('[data-video-overlay]');
for (var k = $overlays.length - 1; k >= 0; k--) {
var overlayData = $($overlays[k]).data();
if (typeof overlayData !== 'undefined') {
var o = {};
o.color = (typeof overlayData.videoOverlayColor !== 'undefined') ? overlayData.videoOverlayColor : '';
o.opacity = (typeof overlayData.videoOverlayOpacity !== 'undefined') ? overlayData.videoOverlayOpacity : 0.25;
el += '<div class="color-overlay ' + o.color + '" style="opacity:' + o.opacity + ';"></div>';
}
};
// add generated video tag, remove data divs
$videoParent.prepend(el);
$video.remove();
};
}
};
var CoverVideo = function() {
var min_w = 320; // minimum video width allowed
var vid_w_orig; // original video dimensions
var vid_h_orig;
var jWin = $(window);
var jVidContainer = $('.cover-video');
var jVideo = $('#homepageVideo');
vid_w_orig = parseInt(jVideo.attr('width'));
vid_h_orig = parseInt(jVideo.attr('height'));
function resizeToCover() {
jWin = $(window);
// set the video viewport to the window size
jVidContainer.width(jWin.width());
jVidContainer.height(jWin.height());
// use largest scale factor of horizontal/vertical
var scale_h = jWin.width() / vid_w_orig;
var scale_v = jWin.height() / vid_h_orig;
var scale = scale_h > scale_v ? scale_h : scale_v;
// don't allow scaled width < minimum video width
if (scale * vid_w_orig < min_w) {
scale = min_w / vid_w_orig;
};
// now scale the video
if ($('#hero').height() < scale * vid_h_orig) {
jVideo.width(scale * vid_w_orig);
jVideo.height(scale * vid_h_orig);
// and center it by scrolling the video viewport
jVidContainer.scrollLeft((jVideo.width() - jWin.width()) / 2);
jVidContainer.scrollTop((jVideo.height() - jWin.height()) / 2);
}
};
jQuery(window).resize(function () {
resizeToCover();
});
jQuery(window).trigger('resize');
}
/* Viewport Helper 2 [its there if you need it]
*
* viewport = {
* width: 'window window'
* height: 'window height'
* top: 'scrollTop value'
* }
*
* jquery and jquery throttle/debounce required see
* http://benalman.com/projects/jquery-throttle-debounce-plugin/ for more
* information, debounce included in scripts/lib/jquery.plugins.js
*
========================================= */
var PRPLView = function( params ) {
self = this;
var jqWin = $(window);
var jsBody = $('body');
var _construct = function() {
self.width = jqWin.width();
self.height = jqWin.height();
self.scrollTop = jqWin.scrollTop();
jqWin.on({
scroll: function(e) {
scrollHandler(e);
},
resize: function(e) {
resizeHandler(e);
}
})
}
var scrollHandler = function(e) {
self.scrollTop = $(e.currentTarget).scrollTop();
trigger('vpScroll', self.scrollTop);
}
var resizeHandler = function(e) {
setWidth($(e.currentTarget).width());
setHeight($(e.currentTarget).height());
}
var setWidth = function(newWidth) {
if (typeof newWidth === 'undefined' || newWidth === self.width) {
return false;
}
self.width = newWidth;
trigger('vpWidth', self.width);
}
var setHeight = function(newHeight) {
if (typeof newHeight === 'undefined' || newHeight === self.height) {
return false;
}
self.height = newHeight;
trigger('vpHeight', self.height);
}
// trigger jq events
var trigger = function(what, data) {
if (typeof what === 'undefined') {
return false;
}
if (typeof data === 'undefined') {
$(self).trigger(what);
} else {
$(self).trigger(what, data);
}
return true;
};
_construct();
}
/* Viewport Helper [its there if you need it]
*
* viewport = {
* width: '...'
* height: 'window height'
* domheight: 'document height'
* breakpoint: 'active breakpoint'
* top: 'scrollTop value'
* params: 'user provided object'
* }
*
* jquery and jquery throttle/debounce required
* ^ see › http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
========================================= */
var PRPLViewport = function(opts) {
var $ = jQuery;
if (typeof $ === 'undefined') {
console.log('jQuery required');
return false;
} else {}
/* ================
*
* Variables
*
* =============== */
var _class = this;
//public vars
// _class.params = (opts) ? opts : false;
// _class.waypoints = (opts.waypoints !== undefined)) ? opts.waypoints : false;
_class.top = undefined;
_class.breakpoint = undefined;
_class.width = undefined;
_class.height = undefined;
_class.domheight = undefined;
//private vars
var devmode = true;
var scrollRefreshTimer;
var breakpoints = {
'xs': 300,
'sm': 540,
'md': 768,
'lg': 960,
'xl': 1280,
'xxl': 1440
};
//cached selectors
var $win = $(window);
var $wrap = $('.site-wrap');
/* ================
*
* Constructor
*
* =============== */
var init = function() {
addWindowVars();
addWindowEvents();
setRemainingValues();
// console.log('add get url slug fn from HP');
return _class;
};
/* ================
*
* Public Methods
*
* =============== */
_class.get = function() {
return {
width : _class.width,
height : _class.height,
top: _class.top,
breakpoint: _class.breakpoint,
domheight: _class.domheight,
params: _class.params
};
};
_class.getWindowSize = function() {
// $win = $(window);
return {
width : _class.width,
height : _class.height
};
};
_class.getHeight = function() {
return _class.height;
}
_class.getWidth = function() {
return _class.width;
}
_class.getScrollTop = function() {
return _class.top;
};
_class.getBreakpoint = function() {
return _class.breakpoint;
};
// _class.addWaypoints = function(arr){
// if(typeof arr === 'undefined' || arr.length < 1){ return false; }
// var waypoints = arr;
// for (var i = waypoints.length - 1; i >= 0; i--) {
// console.log(waypoints[i]);
// };
// }
/* ================
*
* Private Fn's
*
* =============== */
// dom height etc.
var setRemainingValues = function() {
_class.domheight = $wrap.height();
};
// set public window vars
var addWindowVars = function() {
_class.width = $win.width();
_class.height = $win.height();
};
// add window events
var addWindowEvents = function() {
// defined in plugins.js
// deBouncer(jQuery,'smartresize', 'resize', 100);
// deBouncer(jQuery,'smartscroll', 'scroll', 100);
// throttled event handlers
// $win.smartresize(function(e){ onWindowSmartResize(e); });
// $win.smartscroll(function(e){ onWindowSmartScroll(e); });
$win.resize(function(e) {
onWindowResize(e);
});
$win.scroll(function(e) {
onWindowScroll(e);
});
// trigger an inital scroll and resize evt
$win.scroll();
$win.resize();
};
var onWindowResize = function(e) {
if (typeof e === 'undefined') {
return false;
}
// console.log('rageresize');
setHeight($win.height());
var $e = $(e.currentTarget);
if ($e.height() !== _class.height) {
setHeight($e.height())
};
if ($e.width() !== _class.width) {
setWidth($e.width())
};
setBreakpoint($e.width());
trigger('vp_resize', e);
};
var previousScrollPos = 0;
var scrollDirection = 'down';
var onWindowScroll = function(e) {
if (typeof e === 'undefined') {
return false;
}
// console.log('ragescroll');
var $e = $(e.currentTarget)[0];
var distanceTop = $e.scrollY;
// if(distanceTop > previousScrollPos){
// scrollDirection = 'down';
// }else{
// scrollDirection = 'up';
// }
previousScrollPos = distanceTop;
setScrollTop(distanceTop);
trigger('vp_scroll', e);
if (typeof _class.waypoints !== 'undefined' && $('body').hasClass('homepage')) {
if (_class.waypoints !== false && _class.waypoints.length > 0) {
// console.log(_class.waypoints);
var found = false;
var wps = _class.waypoints;
// if(scrollDirection === 'up'){ wps.reverse() }
for (var i = wps.length - 1; i >= 0; i--) {
var wp = wps[i];
var waypointTop = $(wp.selector).offset().top - 40;
if (distanceTop >= waypointTop) {
if (!found) {
trigger('vp_waypoint', wp);
// trigger('vp_waypoint_'+wp.name, wp);
found = true;
}
}
};
}
}
};
var onWindowSmartResize = function(e) {
if (typeof e === 'undefined') {
return false;
}
// set _class.width after resize
var $e = $(e.currentTarget);
if ($e.height() !== _class.height) {
setHeight($e.height())
};
if ($e.width() !== _class.width) {
setWidth($e.width())
};
setBreakpoint($e.width());
trigger('vp_smartresize', e);
};
var onWindowSmartScroll = function(e) {
if (typeof e === 'undefined') {
return false;
}
// set _class.top after scrolling
var $e = $(e.currentTarget)[0];
setScrollTop($e.scrollY);
// console.log($e.scrollY, $e.screenY, $e.pageYOffset); // test values
trigger('vp_smartscroll', e);
};
// like it says on the tin
var setHeight = function(h) {
if (typeof h === 'undefined') {
return false;
}
_class.height = h;
trigger('vp_height', h);
return true;
};
var setWidth = function(w) {
if (typeof w === 'undefined') {
return false;
}
_class.width = w;
trigger('vp_width', w);
return true;
};
// set the scroll top value (on debounced scroll)
var setScrollTop = function(top) {
if (typeof top === 'number') {
if (top < 0) {
if (top < - 70) {} else if (top < - 20) {
// if(devmode){console.log('this would be a good place to implement a refresh timer');}
} else {}
}
_class.top = top;
trigger('vp_scrolltop', top);
return true;
} else {
return false;
}
};
// set breakpoint (on debounced resize)
var setBreakpoint = function(width) {
if (typeof width === 'number' && width > 0) {
_class.width = width;
var prev = _class.breakpoint;
if (_class.width > 0 && _class.width <= breakpoints.xs) {
_class.breakpoint = 'xxs';
} else if (_class.width > breakpoints.xs && _class.width <= breakpoints.sm) {
_class.breakpoint = 'xs';
} else if (_class.width > breakpoints.sm && _class.width <= breakpoints.md) {
_class.breakpoint = 'sm';
} else if (_class.width > breakpoints.md && _class.width <= breakpoints.lg) {
_class.breakpoint = 'md';
} else if (_class.width > breakpoints.lg && _class.width <= breakpoints.xl) {
_class.breakpoint = 'lg';
} else if (_class.width > breakpoints.xl && _class.width <= breakpoints.xxl) {
_class.breakpoint = 'xl';
} else if (_class.width > breakpoints.xxl) {
_class.breakpoint = 'xxl';
}
if (prev !== _class.breakpoint) {
trigger('vp_breakpoint', _class.breakpoint);
return true;
} else {
return false;
}
} else {
return false;
}
};
// trigger jq events
var trigger = function(what, data) {
if (typeof what === 'undefined') {
return false;
}
if (typeof data === 'undefined') {
$(_class).trigger(what);
} else {
$(_class).trigger(what, data);
}
return true;
};
//class hack
return init();
};
/**
* Copyright (C) 2013 by Matias Niemela
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
angular.module('Scope.onReady', []).run(['$rootScope', '$injector', function($rootScope, $injector) {
//this is the special key that tells the scope when it's ready
var successKey = '__scope_success__';
var readyKey = '__scope_ready__';
var qKey = '__q__';
var deferKey = '__defer__';
var promiseKey = '__promise__';
//this is set as the default just incase you forget to call $scope.$prepareForReady() in your controller
$rootScope[successKey] = true;
$rootScope[readyKey] = true;
//this is just here for code reuse
var cleanUp = function($scope) {
$scope[qKey] = null;
$scope[deferKey] = null;
$scope[promiseKey] = null;
};
//you will need to call this first at the top of the controller
$rootScope.$prepareForReady = function($q) {
cleanUp(this);
if ($q) {
this[qKey] = $q;
}
this[successKey] = null;
this[readyKey] = false;
}
//this is used within each directive
$rootScope.$whenReady = function(success, fail) {
fail = fail || function() {}; //just incase this is not set
if ((typeof success != 'function') || (typeof fail != 'function'))
return;
if (this.$isReady()) {
//this means it's already ready
this[successKey] ? success() : fail();
} else {
//this means it needs to wait for the controller to complete it's job
if (!this[promiseKey]) {
if (!this[deferKey]) {
if (!this[qKey]) {
this[qKey] = $injector.get('$q');
}
this[deferKey] = this[qKey].defer();
}
this[promiseKey] = this[deferKey].promise;
}
var $q = this[qKey];
this[promiseKey] = this[promiseKey].then(
success,
function(reason) {
fail();
return $q.reject(reason);
});
}
};
//this will inform you if it is ready
$rootScope.$isReady = function() {
return this[readyKey] ? true : false;
};
//this will inform you if there are any events set
$rootScope.$hasReadyEvents = function() {
return this[promiseKey] && this[deferKey] ? true : false;
};
//this is called in your controller when all your data is ready
$rootScope.$onReady = function(args) {
var $scope = this;
if ($scope.$isReady())
return;
var C = function() {
cleanUp($scope);
$scope[successKey] = true;
$scope[readyKey] = true;
};
if ($scope.$hasReadyEvents()) {
var F = function() {
$scope[deferKey].resolve(args);
C();
};
$scope.$$phase ? F() : $scope.$apply(F);
} else {
C();
}
};
//this is called in your controller when there is a failure of somesort
$rootScope.$onFailure = function(args) {
var $scope = this;
if ($scope.$isReady())
return;
var C = function() {
cleanUp($scope);
$scope[successKey] = false;
$scope[readyKey] = true;
};
if ($scope.$hasReadyEvents()) {
var F = function() {
$scope[deferKey].reject(args);
C();
};
$scope.$$phase ? F() : $scope.$apply(F);
} else {
C();
}
};
}
]);
var Swiper = function(selector, params) {
if (document.body.__defineGetter__) {
if (HTMLElement) {
var element = HTMLElement.prototype;
if (element.__defineGetter__) {
element.__defineGetter__("outerHTML", function() {
return new XMLSerializer().serializeToString(this);
});
}
}
}
if (!window.getComputedStyle) {
window.getComputedStyle = function(el, pseudo) {
this.el = el;
this.getPropertyValue = function(prop) {
var re = /(\-([a-z]){1})/g;
if (prop === 'float')
prop = 'styleFloat';
if (re.test(prop)) {
prop = prop.replace(re, function() {
return arguments[2].toUpperCase();
});
}
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
}
return this;
}
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) {
return i;
}
}
return - 1;
}
}
if (!document.querySelectorAll) {
if (!window.jQuery)
return;
}
function $$(selector, context) {
if (document.querySelectorAll)
return (context || document).querySelectorAll(selector);
else
return jQuery(selector, context);
}
if (typeof selector === 'undefined')
return;
if (!(selector.nodeType)) {
if ($$(selector).length === 0)
return;
}
var _this = this;
_this.touches = {
start: 0,
startX: 0,
startY: 0,
current: 0,
currentX: 0,
currentY: 0,
diff: 0,
abs: 0
};
_this.positions = {
start: 0,
abs: 0,
diff: 0,
current: 0
};
_this.times = {
start: 0,
end: 0
};
_this.id = (new Date()).getTime();
_this.container = (selector.nodeType) ? selector : $$(selector)[0];
_this.isTouched = false;
_this.isMoved = false;
_this.activeIndex = 0;
_this.centerIndex = 0;
_this.activeLoaderIndex = 0;
_this.activeLoopIndex = 0;
_this.previousIndex = null;
_this.velocity = 0;
_this.snapGrid = [];
_this.slidesGrid = [];
_this.imagesToLoad = [];
_this.imagesLoaded = 0;
_this.wrapperLeft = 0;
_this.wrapperRight = 0;
_this.wrapperTop = 0;
_this.wrapperBottom = 0;
var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
var defaults = {
mode: 'horizontal',
touchRatio: 1,
speed: 300,
freeMode: false,
freeModeFluid: false,
momentumRatio: 1,
momentumBounce: true,
momentumBounceRatio: 1,
slidesPerView: 1,
slidesPerGroup: 1,
simulateTouch: true,
followFinger: true,
shortSwipes: true,
moveStartThreshold: false,
onlyExternal: false,
createPagination: true,
pagination: false,
paginationElement: 'span',
paginationClickable: false,
paginationAsRange: true,
resistance: true,
scrollContainer: false,
preventLinks: true,
noSwiping: false,
noSwipingClass: 'swiper-no-swiping',
initialSlide: 0,
keyboardControl: false,
mousewheelControl: false,
useCSS3Transforms: true,
autoplay: false,
autoplayDisableOnInteraction: true,
loop: false,
loopAdditionalSlides: 0,
calculateHeight: false,
cssWidthAndHeight: false,
updateOnImagesReady: true,
releaseFormElements: true,
watchActiveIndex: false,
visibilityFullFit: false,
offsetPxBefore: 0,
offsetPxAfter: 0,
offsetSlidesBefore: 0,
offsetSlidesAfter: 0,
centeredSlides: false,
queueStartCallbacks: false,
queueEndCallbacks: false,
autoResize: true,
resizeReInit: false,
DOMAnimation: true,
loader: {
slides: [],
slidesHTMLType: 'inner',
surroundGroups: 1,
logic: 'reload',
loadAllSlides: false
},
slideElement: 'div',
slideClass: 'swiper-slide',
slideActiveClass: 'swiper-slide-active',
slideVisibleClass: 'swiper-slide-visible',
wrapperClass: 'swiper-wrapper',
paginationElementClass: 'swiper-pagination-switch',
paginationActiveClass: 'swiper-active-switch',
paginationVisibleClass: 'swiper-visible-switch'
}
params = params || {};
for (var prop in defaults) {
if (prop in params && typeof params[prop] === 'object') {
for (var subProp in defaults[prop]) {
if (!(subProp in params[prop])) {
params[prop][subProp] = defaults[prop][subProp];
}
}
} else if (!(prop in params)) {
params[prop] = defaults[prop]
}
}
_this.params = params;
if (params.scrollContainer) {
params.freeMode = true;
params.freeModeFluid = true;
}
if (params.loop) {
params.resistance = '100%';
}
var isH = params.mode === 'horizontal';
_this.touchEvents = {
touchStart: _this.support.touch ||!params.simulateTouch ? 'touchstart': (_this.browser.ie10 ? 'MSPointerDown' : 'mousedown'),
touchMove: _this.support.touch ||!params.simulateTouch ? 'touchmove': (_this.browser.ie10 ? 'MSPointerMove' : 'mousemove'),
touchEnd: _this.support.touch ||!params.simulateTouch ? 'touchend': (_this.browser.ie10 ? 'MSPointerUp' : 'mouseup')
};
for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
if (_this.container.childNodes[i].className) {
var _wrapperClasses = _this.container.childNodes[i].className.split(' ')
for (var j = 0; j < _wrapperClasses.length; j++) {
if (_wrapperClasses[j] === params.wrapperClass) {
wrapper = _this.container.childNodes[i];
}
};
}
};
_this.wrapper = wrapper;
_this._extendSwiperSlide = function(el) {
el.append = function() {
if (params.loop) {
el.insertAfter(_this.slides.length - _this.loopedSlides);
_this.removeLoopedSlides();
_this.calcSlides();
_this.createLoop();
} else {
_this.wrapper.appendChild(el);
}
_this.reInit();
return el;
}
el.prepend = function() {
if (params.loop) {
_this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
_this.removeLoopedSlides();
_this.calcSlides();
_this.createLoop();
} else {
_this.wrapper.insertBefore(el, _this.wrapper.firstChild);
}
_this.reInit();
return el;
}
el.insertAfter = function(index) {
if (typeof index === 'undefined')
return false;
var beforeSlide;
if (params.loop) {
beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
_this.wrapper.insertBefore(el, beforeSlide);
_this.removeLoopedSlides();
_this.calcSlides();
_this.createLoop();
} else {
beforeSlide = _this.slides[index + 1];
_this.wrapper.insertBefore(el, beforeSlide)
}
_this.reInit();
return el;
}
el.clone = function() {
return _this._extendSwiperSlide(el.cloneNode(true))
}
el.remove = function() {
_this.wrapper.removeChild(el);
_this.reInit();
}
el.html = function(html) {
if (typeof html === 'undefined') {
return el.innerHTML;
} else {
el.innerHTML = html;
return el;
}
}
el.index = function() {
var index;
for (var i = _this.slides.length - 1; i >= 0; i--) {
if (el === _this.slides[i])
index = i;
}
return index;
}
el.isActive = function() {
if (el.index() === _this.activeIndex)
return true;
else
return false;
}
if (!el.swiperSlideDataStorage)
el.swiperSlideDataStorage = {};
el.getData = function(name) {
return el.swiperSlideDataStorage[name];
}
el.setData = function(name, value) {
el.swiperSlideDataStorage[name] = value;
return el;
}
el.data = function(name, value) {
if (!value) {
return el.getAttribute('data-' + name);
} else {
el.setAttribute('data-' + name, value);
return el;
}
}
el.getWidth = function(outer) {
return _this.h.getWidth(el, outer);
}
el.getHeight = function(outer) {
return _this.h.getHeight(el, outer);
}
el.getOffset = function() {
return _this.h.getOffset(el);
}
return el;
}
_this.calcSlides = function(forceCalcSlides) {
var oldNumber = _this.slides ? _this.slides.length: false;
_this.slides = [];
_this.displaySlides = [];
for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
if (_this.wrapper.childNodes[i].className) {
var _className = _this.wrapper.childNodes[i].className;
var _slideClasses = _className.split(' ');
for (var j = 0; j < _slideClasses.length; j++) {
if (_slideClasses[j] === params.slideClass) {
_this.slides.push(_this.wrapper.childNodes[i]);
}
}
}
}
for (i = _this.slides.length - 1; i >= 0; i--) {
_this._extendSwiperSlide(_this.slides[i]);
}
if (oldNumber === false)
return;
if (oldNumber !== _this.slides.length || forceCalcSlides) {
removeSlideEvents();
addSlideEvents();
_this.updateActiveSlide();
if (_this.params.pagination)
_this.createPagination();
_this.callPlugins('numberOfSlidesChanged');
}
}
_this.createSlide = function(html, slideClassList, el) {
var slideClassList = slideClassList || _this.params.slideClass;
var el = el || params.slideElement;
var newSlide = document.createElement(el);
newSlide.innerHTML = html || '';
newSlide.className = slideClassList;
return _this._extendSwiperSlide(newSlide);
}
_this.appendSlide = function(html, slideClassList, el) {
if (!html)
return;
if (html.nodeType) {
return _this._extendSwiperSlide(html).append()
} else {
return _this.createSlide(html, slideClassList, el).append()
}
}
_this.prependSlide = function(html, slideClassList, el) {
if (!html)
return;
if (html.nodeType) {
return _this._extendSwiperSlide(html).prepend()
} else {
return _this.createSlide(html, slideClassList, el).prepend()
}
}
_this.insertSlideAfter = function(index, html, slideClassList, el) {
if (typeof index === 'undefined')
return false;
if (html.nodeType) {
return _this._extendSwiperSlide(html).insertAfter(index);
} else {
return _this.createSlide(html, slideClassList, el).insertAfter(index);
}
}
_this.removeSlide = function(index) {
if (_this.slides[index]) {
if (params.loop) {
if (!_this.slides[index + _this.loopedSlides])
return false;
_this.slides[index + _this.loopedSlides].remove();
_this.removeLoopedSlides();
_this.calcSlides();
_this.createLoop();
} else
_this.slides[index].remove();
return true;
} else
return false;
}
_this.removeLastSlide = function() {
if (_this.slides.length > 0) {
if (params.loop) {
_this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
_this.removeLoopedSlides();
_this.calcSlides();
_this.createLoop();
} else
_this.slides[(_this.slides.length - 1)].remove();
return true;
} else {
return false;
}
}
_this.removeAllSlides = function() {
for (var i = _this.slides.length - 1; i >= 0; i--) {
_this.slides[i].remove()
}
}
_this.getSlide = function(index) {
return _this.slides[index]
}
_this.getLastSlide = function() {
return _this.slides[_this.slides.length - 1]
}
_this.getFirstSlide = function() {
return _this.slides[0]
}
_this.activeSlide = function() {
return _this.slides[_this.activeIndex]
}
var _plugins = [];
for (var plugin in _this.plugins) {
if (params[plugin]) {
var p = _this.plugins[plugin](_this, params[plugin]);
if (p)
_plugins.push(p);
}
}
_this.callPlugins = function(method, args) {
if (!args)
args = {}
for (var i = 0; i < _plugins.length; i++) {
if (method in _plugins[i]) {
_plugins[i][method](args);
}
}
}
_this.fireCallback = function() {
var callback = arguments[0];
if (Object.prototype.toString.call(callback) === '[object Array]') {
for (var i = 0; i < callback.length; i++) {
if (typeof callback[i] === 'function') {
callback[i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
}
}
} else {
callback(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
}
function isArray(obj) {
"use strict";
if (Object.prototype.toString.apply(obj) === '[object Array]')
return true;
return false;
}
_this.addCallback = function(callback, func) {
"use strict";
var _this = this, tempFunc;
if (_this.params['on' + callback]) {
if (isArray(this.params['on' + callback])) {
return this.params['on' + callback].push(func);
} else if (typeof this.params['on' + callback] === 'function') {
tempFunc = this.params['on' + callback];
this.params['on' + callback] = [];
this.params['on' + callback].push(tempFunc);
return this.params['on' + callback].push(func);
}
} else {
this.params['on' + callback] = [];
return this.params['on' + callback].push(func);
}
}
_this.removeCallbacks = function(callback) {
if (_this.params['on' + callback]) {
return _this.params['on' + callback] = null;
}
}
if (_this.browser.ie10&&!params.onlyExternal) {
_this.wrapper.classList.add('swiper-wp8-' + (isH ? 'horizontal' : 'vertical'));
}
if (params.freeMode) {
_this.container.className += ' swiper-free-mode';
}
_this.initialized = false;
_this.init = function(force, forceCalcSlides) {
var _width = _this.h.getWidth(_this.container);
var _height = _this.h.getHeight(_this.container);
if (_width === _this.width && _height === _this.height&&!force)
return;
_this.width = _width;
_this.height = _height;
containerSize = isH ? _width : _height;
var wrapper = _this.wrapper;
if (force) {
_this.calcSlides(forceCalcSlides);
}
if (params.slidesPerView === 'auto') {
var slidesWidth = 0;
var slidesHeight = 0;
if (params.slidesOffset > 0) {
wrapper.style.paddingLeft = '';
wrapper.style.paddingRight = '';
wrapper.style.paddingTop = '';
wrapper.style.paddingBottom = '';
}
wrapper.style.width = '';
wrapper.style.height = '';
if (params.offsetPxBefore > 0) {
if (isH)
_this.wrapperLeft = params.offsetPxBefore;
else
_this.wrapperTop = params.offsetPxBefore;
}
if (params.offsetPxAfter > 0) {
if (isH)
_this.wrapperRight = params.offsetPxAfter;
else
_this.wrapperBottom = params.offsetPxAfter;
}
if (params.centeredSlides) {
if (isH) {
_this.wrapperLeft = (containerSize - this.slides[0].getWidth(true)) / 2;
_this.wrapperRight = (containerSize - _this.slides[_this.slides.length - 1].getWidth(true)) / 2;
} else {
_this.wrapperTop = (containerSize - _this.slides[0].getHeight(true)) / 2;
_this.wrapperBottom = (containerSize - _this.slides[_this.slides.length - 1].getHeight(true)) / 2;
}
}
if (isH) {
if (_this.wrapperLeft >= 0)
wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
if (_this.wrapperRight >= 0)
wrapper.style.paddingRight = _this.wrapperRight + 'px';
} else {
if (_this.wrapperTop >= 0)
wrapper.style.paddingTop = _this.wrapperTop + 'px';
if (_this.wrapperBottom >= 0)
wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
}
var slideLeft = 0;
var centeredSlideLeft = 0;
_this.snapGrid = [];
_this.slidesGrid = [];
var slideMaxHeight = 0;
for (var i = 0; i < _this.slides.length; i++) {
var slideWidth = _this.slides[i].getWidth(true);
var slideHeight = _this.slides[i].getHeight(true);
if (params.calculateHeight) {
slideMaxHeight = Math.max(slideMaxHeight, slideHeight)
}
var _slideSize = isH ? slideWidth: slideHeight;
if (params.centeredSlides) {
var nextSlideWidth = i === _this.slides.length - 1 ? 0: _this.slides[i + 1].getWidth(true);
var nextSlideHeight = i === _this.slides.length - 1 ? 0: _this.slides[i + 1].getHeight(true);
var nextSlideSize = isH ? nextSlideWidth: nextSlideHeight;
if (_slideSize > containerSize) {
for (var j = 0; j <= Math.floor(_slideSize / (containerSize + _this.wrapperLeft)); j++) {
if (j === 0)
_this.snapGrid.push(slideLeft + _this.wrapperLeft);
else
_this.snapGrid.push(slideLeft + _this.wrapperLeft + containerSize * j);
}
_this.slidesGrid.push(slideLeft + _this.wrapperLeft);
} else {
_this.snapGrid.push(centeredSlideLeft);
_this.slidesGrid.push(centeredSlideLeft);
}
centeredSlideLeft += _slideSize / 2 + nextSlideSize / 2;
} else {
if (_slideSize > containerSize) {
for (var j = 0; j <= Math.floor(_slideSize / containerSize); j++) {
_this.snapGrid.push(slideLeft + containerSize * j);
}
} else {
_this.snapGrid.push(slideLeft);
}
_this.slidesGrid.push(slideLeft);
}
slideLeft += _slideSize;
slidesWidth += slideWidth;
slidesHeight += slideHeight;
}
if (params.calculateHeight)
_this.height = slideMaxHeight;
if (isH) {
wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
wrapper.style.width = (slidesWidth) + 'px';
wrapper.style.height = (_this.height) + 'px';
} else {
wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
wrapper.style.width = (_this.width) + 'px';
wrapper.style.height = (slidesHeight) + 'px';
}
} else if (params.scrollContainer) {
wrapper.style.width = '';
wrapper.style.height = '';
var wrapperWidth = _this.slides[0].getWidth(true);
var wrapperHeight = _this.slides[0].getHeight(true);
wrapperSize = isH ? wrapperWidth : wrapperHeight;
wrapper.style.width = wrapperWidth + 'px';
wrapper.style.height = wrapperHeight + 'px';
slideSize = isH ? wrapperWidth : wrapperHeight;
} else {
if (params.calculateHeight) {
var slideMaxHeight = 0;
var wrapperHeight = 0;
if (!isH)
_this.container.style.height = '';
wrapper.style.height = '';
for (var i = 0; i < _this.slides.length; i++) {
_this.slides[i].style.height = '';
slideMaxHeight = Math.max(_this.slides[i].getHeight(true), slideMaxHeight);
if (!isH)
wrapperHeight += _this.slides[i].getHeight(true);
}
var slideHeight = slideMaxHeight;
_this.height = slideHeight;
if (isH)
wrapperHeight = slideHeight;
else
containerSize = slideHeight, _this.container.style.height = containerSize + 'px';
} else {
var slideHeight = isH ? _this.height: _this.height / params.slidesPerView;
var wrapperHeight = isH ? _this.height: _this.slides.length * slideHeight;
}
var slideWidth = isH ? _this.width / params.slidesPerView: _this.width;
var wrapperWidth = isH ? _this.slides.length * slideWidth: _this.width;
slideSize = isH ? slideWidth : slideHeight;
if (params.offsetSlidesBefore > 0) {
if (isH)
_this.wrapperLeft = slideSize * params.offsetSlidesBefore;
else
_this.wrapperTop = slideSize * params.offsetSlidesBefore;
}
if (params.offsetSlidesAfter > 0) {
if (isH)
_this.wrapperRight = slideSize * params.offsetSlidesAfter;
else
_this.wrapperBottom = slideSize * params.offsetSlidesAfter;
}
if (params.offsetPxBefore > 0) {
if (isH)
_this.wrapperLeft = params.offsetPxBefore;
else
_this.wrapperTop = params.offsetPxBefore;
}
if (params.offsetPxAfter > 0) {
if (isH)
_this.wrapperRight = params.offsetPxAfter;
else
_this.wrapperBottom = params.offsetPxAfter;
}
if (params.centeredSlides) {
if (isH) {
_this.wrapperLeft = (containerSize - slideSize) / 2;
_this.wrapperRight = (containerSize - slideSize) / 2;
} else {
_this.wrapperTop = (containerSize - slideSize) / 2;
_this.wrapperBottom = (containerSize - slideSize) / 2;
}
}
if (isH) {
if (_this.wrapperLeft > 0)
wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
if (_this.wrapperRight > 0)
wrapper.style.paddingRight = _this.wrapperRight + 'px';
} else {
if (_this.wrapperTop > 0)
wrapper.style.paddingTop = _this.wrapperTop + 'px';
if (_this.wrapperBottom > 0)
wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
}
wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
if (!params.cssWidthAndHeight) {
if (parseFloat(wrapperWidth) > 0) {
wrapper.style.width = wrapperWidth + 'px';
}
if (parseFloat(wrapperHeight) > 0) {
wrapper.style.height = wrapperHeight + 'px';
}
}
var slideLeft = 0;
_this.snapGrid = [];
_this.slidesGrid = [];
for (var i = 0; i < _this.slides.length; i++) {
_this.snapGrid.push(slideLeft);
_this.slidesGrid.push(slideLeft);
slideLeft += slideSize;
if (!params.cssWidthAndHeight) {
if (parseFloat(slideWidth) > 0) {
_this.slides[i].style.width = slideWidth + 'px';
}
if (parseFloat(slideHeight) > 0) {
_this.slides[i].style.height = slideHeight + 'px';
}
}
}
}
if (!_this.initialized) {
_this.callPlugins('onFirstInit');
if (params.onFirstInit)
_this.fireCallback(params.onFirstInit, _this);
} else {
_this.callPlugins('onInit');
if (params.onInit)
_this.fireCallback(params.onInit, _this);
}
_this.initialized = true;
}
_this.reInit = function(forceCalcSlides) {
_this.init(true, forceCalcSlides);
}
_this.resizeFix = function(reInit) {
_this.callPlugins('beforeResizeFix');
_this.init(params.resizeReInit || reInit);
if (!params.freeMode) {
_this.swipeTo((params.loop ? _this.activeLoopIndex : _this.activeIndex), 0, false);
} else if (_this.getWrapperTranslate()<-maxWrapperPosition()) {
_this.setWrapperTransition(0);
_this.setWrapperTranslate( - maxWrapperPosition());
}
_this.callPlugins('afterResizeFix');
}
function maxWrapperPosition() {
var a = (wrapperSize - containerSize);
if (params.freeMode) {
a = wrapperSize - containerSize;
}
if (params.slidesPerView > _this.slides.length)
a = 0;
if (a < 0)
a = 0;
return a;
}
function minWrapperPosition() {
var a = 0;
return a;
}
function initEvents() {
var bind = _this.h.addEventListener;
if (!_this.browser.ie10) {
if (_this.support.touch) {
bind(_this.wrapper, 'touchstart', onTouchStart);
bind(_this.wrapper, 'touchmove', onTouchMove);
bind(_this.wrapper, 'touchend', onTouchEnd);
}
if (params.simulateTouch) {
bind(_this.wrapper, 'mousedown', onTouchStart);
bind(document, 'mousemove', onTouchMove);
bind(document, 'mouseup', onTouchEnd);
}
} else {
bind(_this.wrapper, _this.touchEvents.touchStart, onTouchStart);
bind(document, _this.touchEvents.touchMove, onTouchMove);
bind(document, _this.touchEvents.touchEnd, onTouchEnd);
}
if (params.autoResize) {
bind(window, 'resize', _this.resizeFix);
}
addSlideEvents();
_this._wheelEvent = false;
if (params.mousewheelControl) {
if (document.onmousewheel !== undefined) {
_this._wheelEvent = "mousewheel";
}
try {
WheelEvent("wheel");
_this._wheelEvent = "wheel";
} catch (e) {}
if (!_this._wheelEvent) {
_this._wheelEvent = "DOMMouseScroll";
}
if (_this._wheelEvent) {
bind(_this.container, _this._wheelEvent, handleMousewheel);
}
}
if (params.keyboardControl) {
bind(document, 'keydown', handleKeyboardKeys);
}
if (params.updateOnImagesReady) {
_this.imagesToLoad = $$('img', _this.container);
for (var i = 0; i < _this.imagesToLoad.length; i++) {
_loadImage(_this.imagesToLoad[i].getAttribute('src'))
}
}
function _loadImage(src) {
var image = new Image();
image.onload = function() {
_this.imagesLoaded++;
if (_this.imagesLoaded == _this.imagesToLoad.length) {
_this.reInit();
if (params.onImagesReady)
_this.fireCallback(params.onImagesReady, _this);
}
}
image.src = src;
}
}
_this.destroy = function(removeResizeFix) {
var unbind = _this.h.removeEventListener;
if (!_this.browser.ie10) {
if (_this.support.touch) {
unbind(_this.wrapper, 'touchstart', onTouchStart);
unbind(_this.wrapper, 'touchmove', onTouchMove);
unbind(_this.wrapper, 'touchend', onTouchEnd);
}
if (params.simulateTouch) {
unbind(_this.wrapper, 'mousedown', onTouchStart);
unbind(document, 'mousemove', onTouchMove);
unbind(document, 'mouseup', onTouchEnd);
}
} else {
unbind(_this.wrapper, _this.touchEvents.touchStart, onTouchStart);
unbind(document, _this.touchEvents.touchMove, onTouchMove);
unbind(document, _this.touchEvents.touchEnd, onTouchEnd);
}
if (params.autoResize) {
unbind(window, 'resize', _this.resizeFix);
}
removeSlideEvents();
if (params.paginationClickable) {
removePaginationEvents();
}
if (params.mousewheelControl && _this._wheelEvent) {
unbind(_this.container, _this._wheelEvent, handleMousewheel);
}
if (params.keyboardControl) {
unbind(document, 'keydown', handleKeyboardKeys);
}
if (params.autoplay) {
_this.stopAutoplay();
}
_this.callPlugins('onDestroy');
_this = null;
}
function addSlideEvents() {
var bind = _this.h.addEventListener, i;
if (params.preventLinks) {
var links = $$('a', _this.container);
for (i = 0; i < links.length; i++) {
bind(links[i], 'click', preventClick);
}
}
if (params.releaseFormElements) {
var formElements = $$('input, textarea, select', _this.container);
for (i = 0; i < formElements.length; i++) {
bind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
}
}
if (params.onSlideClick) {
for (i = 0; i < _this.slides.length; i++) {
bind(_this.slides[i], 'click', slideClick);
}
}
if (params.onSlideTouch) {
for (i = 0; i < _this.slides.length; i++) {
bind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
}
}
}
function removeSlideEvents() {
var unbind = _this.h.removeEventListener, i;
if (params.onSlideClick) {
for (i = 0; i < _this.slides.length; i++) {
unbind(_this.slides[i], 'click', slideClick);
}
}
if (params.onSlideTouch) {
for (i = 0; i < _this.slides.length; i++) {
unbind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
}
}
if (params.releaseFormElements) {
var formElements = $$('input, textarea, select', _this.container);
for (i = 0; i < formElements.length; i++) {
unbind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
}
}
if (params.preventLinks) {
var links = $$('a', _this.container);
for (i = 0; i < links.length; i++) {
unbind(links[i], 'click', preventClick);
}
}
}
function handleKeyboardKeys(e) {
var kc = e.keyCode || e.charCode;
if (kc == 37 || kc == 39 || kc == 38 || kc == 40) {
var inView = false;
var swiperOffset = _this.h.getOffset(_this.container);
var scrollLeft = _this.h.windowScroll().left;
var scrollTop = _this.h.windowScroll().top;
var windowWidth = _this.h.windowWidth();
var windowHeight = _this.h.windowHeight();
var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + _this.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + _this.height], [swiperOffset.left + _this.width, swiperOffset.top + _this.height]]
for (var i = 0; i < swiperCoord.length; i++) {
var point = swiperCoord[i];
if (point[0] >= scrollLeft && point[0] <= scrollLeft + windowWidth && point[1] >= scrollTop && point[1] <= scrollTop + windowHeight) {
inView = true;
}
}
if (!inView)
return;
}
if (isH) {
if (kc == 37 || kc == 39) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
}
if (kc == 39)
_this.swipeNext();
if (kc == 37)
_this.swipePrev();
} else {
if (kc == 38 || kc == 40) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
}
if (kc == 40)
_this.swipeNext();
if (kc == 38)
_this.swipePrev();
}
}
var lastScrollTime = (new Date()).getTime();
function handleMousewheel(e) {
var we = _this._wheelEvent;
var delta = 0;
if (e.detail)
delta =- e.detail;
else if (we == 'mousewheel') {
if (isH) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY))
delta = e.wheelDeltaX;
else
return;
} else {
if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX))
delta = e.wheelDeltaY;
else
return;
}
} else if (we == 'DOMMouseScroll')
delta =- e.detail;
else if (we == 'wheel') {
if (isH) {
if (Math.abs(e.deltaX) > Math.abs(e.deltaY))
delta =- e.deltaX;
else
return;
} else {
if (Math.abs(e.deltaY) > Math.abs(e.deltaX))
delta =- e.deltaY;
else
return;
}
}
if (!params.freeMode) {
if ((new Date()).getTime() - lastScrollTime > 60) {
if (delta < 0)
_this.swipeNext();
else
_this.swipePrev();
}
lastScrollTime = (new Date()).getTime();
} else {
var position = _this.getWrapperTranslate() + delta;
if (position > 0)
position = 0;
if (position<-maxWrapperPosition())
position =- maxWrapperPosition();
_this.setWrapperTransition(0);
_this.setWrapperTranslate(position);
_this.updateActiveSlide(position);
if (position == 0 || position==-maxWrapperPosition())
return;
}
if (params.autoplay)
_this.stopAutoplay(true);
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (params.grabCursor) {
var containerStyle = _this.container.style;
containerStyle.cursor = 'move';
containerStyle.cursor = 'grab';
containerStyle.cursor = '-moz-grab';
containerStyle.cursor = '-webkit-grab';
}
_this.allowSlideClick = true;
function slideClick(event) {
if (_this.allowSlideClick) {
setClickedSlide(event);
_this.fireCallback(params.onSlideClick, _this, event);
}
}
function slideTouch(event) {
setClickedSlide(event);
_this.fireCallback(params.onSlideTouch, _this, event);
}
function setClickedSlide(event) {
if (!event.currentTarget) {
var element = event.srcElement;
do {
if (element.className.indexOf(params.slideClass)>-1) {
break;
}
}
while (element = element.parentNode);
_this.clickedSlide = element;
} else {
_this.clickedSlide = event.currentTarget;
}
_this.clickedSlideIndex = _this.slides.indexOf(_this.clickedSlide);
_this.clickedSlideLoopIndex = _this.clickedSlideIndex - (_this.loopedSlides || 0);
}
_this.allowLinks = true;
function preventClick(e) {
if (!_this.allowLinks) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
}
function releaseForms(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.returnValue = false;
return false;
}
var isTouchEvent = false;
var allowThresholdMove;
var allowMomentumBounce = true;
function onTouchStart(event) {
if (params.preventLinks)
_this.allowLinks = true;
if (_this.isTouched || params.onlyExternal) {
return false;
}
if (params.noSwiping && (event.target || event.srcElement) && noSwipingSlide(event.target || event.srcElement))
return false;
allowMomentumBounce = false;
_this.isTouched = true;
isTouchEvent = event.type == 'touchstart';
if (!isTouchEvent || event.targetTouches.length == 1) {
_this.callPlugins('onTouchStartBegin');
if (!isTouchEvent) {
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
var pageX = isTouchEvent ? event.targetTouches[0].pageX: (event.pageX || event.clientX);
var pageY = isTouchEvent ? event.targetTouches[0].pageY: (event.pageY || event.clientY);
_this.touches.startX = _this.touches.currentX = pageX;
_this.touches.startY = _this.touches.currentY = pageY;
_this.touches.start = _this.touches.current = isH ? pageX : pageY;
_this.setWrapperTransition(0);
_this.positions.start = _this.positions.current = _this.getWrapperTranslate();
_this.setWrapperTranslate(_this.positions.start);
_this.times.start = (new Date()).getTime();
isScrolling = undefined;
if (params.moveStartThreshold > 0)
allowThresholdMove = false;
if (params.onTouchStart)
_this.fireCallback(params.onTouchStart, _this);
_this.callPlugins('onTouchStartEnd');
}
}
var velocityPrevPosition, velocityPrevTime;
function onTouchMove(event) {
if (!_this.isTouched || params.onlyExternal)
return;
if (isTouchEvent && event.type == 'mousemove')
return;
var pageX = isTouchEvent ? event.targetTouches[0].pageX: (event.pageX || event.clientX);
var pageY = isTouchEvent ? event.targetTouches[0].pageY: (event.pageY || event.clientY);
if (typeof isScrolling === 'undefined' && isH) {
isScrolling=!!(isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs(pageX - _this.touches.startX));
}
if (typeof isScrolling === 'undefined'&&!isH) {
isScrolling=!!(isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs(pageX - _this.touches.startX));
}
if (isScrolling) {
_this.isTouched = false;
return;
}
if (event.assignedToSwiper) {
_this.isTouched = false;
return;
}
event.assignedToSwiper = true;
if (params.preventLinks) {
_this.allowLinks = false;
}
if (params.onSlideClick) {
_this.allowSlideClick = false;
}
if (params.autoplay) {
_this.stopAutoplay(true);
}
if (!isTouchEvent || event.touches.length == 1) {
if (!_this.isMoved) {
_this.callPlugins('onTouchMoveStart');
if (params.loop) {
_this.fixLoop();
_this.positions.start = _this.getWrapperTranslate();
}
if (params.onTouchMoveStart)
_this.fireCallback(params.onTouchMoveStart, _this);
}
_this.isMoved = true;
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
_this.touches.current = isH ? pageX : pageY;
_this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
if (_this.positions.current > 0 && params.onResistanceBefore) {
_this.fireCallback(params.onResistanceBefore, _this, _this.positions.current);
}
if (_this.positions.current<-maxWrapperPosition() && params.onResistanceAfter) {
_this.fireCallback(params.onResistanceAfter, _this, Math.abs(_this.positions.current + maxWrapperPosition()));
}
if (params.resistance && params.resistance != '100%') {
if (_this.positions.current > 0) {
var resistance = 1 - _this.positions.current / containerSize / 2;
if (resistance < 0.5)
_this.positions.current = (containerSize / 2);
else
_this.positions.current = _this.positions.current * resistance;
}
if (_this.positions.current<-maxWrapperPosition()) {
var diff = (_this.touches.current - _this.touches.start) * params.touchRatio + (maxWrapperPosition() + _this.positions.start);
var resistance = (containerSize + diff) / (containerSize);
var newPos = _this.positions.current - diff * (1 - resistance) / 2;
var stopPos =- maxWrapperPosition() - containerSize / 2;
if (newPos < stopPos || resistance <= 0)
_this.positions.current = stopPos;
else
_this.positions.current = newPos;
}
}
if (params.resistance && params.resistance == '100%') {
if (_this.positions.current > 0&&!(params.freeMode&&!params.freeModeFluid)) {
_this.positions.current = 0;
}
if ((_this.positions.current)<-maxWrapperPosition()&&!(params.freeMode&&!params.freeModeFluid)) {
_this.positions.current =- maxWrapperPosition();
}
}
if (!params.followFinger)
return;
if (!params.moveStartThreshold) {
_this.setWrapperTranslate(_this.positions.current);
} else {
if (Math.abs(_this.touches.current - _this.touches.start) > params.moveStartThreshold || allowThresholdMove) {
allowThresholdMove = true;
_this.setWrapperTranslate(_this.positions.current);
} else {
_this.positions.current = _this.positions.start;
}
}
if (params.freeMode || params.watchActiveIndex) {
_this.updateActiveSlide(_this.positions.current);
}
if (params.grabCursor) {
_this.container.style.cursor = 'move';
_this.container.style.cursor = 'grabbing';
_this.container.style.cursor = '-moz-grabbin';
_this.container.style.cursor = '-webkit-grabbing';
}
if (!velocityPrevPosition)
velocityPrevPosition = _this.touches.current;
if (!velocityPrevTime)
velocityPrevTime = (new Date).getTime();
_this.velocity = (_this.touches.current - velocityPrevPosition) / ((new Date).getTime() - velocityPrevTime) / 2;
if (Math.abs(_this.touches.current - velocityPrevPosition) < 2)
_this.velocity = 0;
velocityPrevPosition = _this.touches.current;
velocityPrevTime = (new Date).getTime();
_this.callPlugins('onTouchMoveEnd');
if (params.onTouchMove)
_this.fireCallback(params.onTouchMove, _this);
return false;
}
}
function onTouchEnd(event) {
if (isScrolling) {
_this.swipeReset();
}
if (params.onlyExternal ||!_this.isTouched)
return;
_this.isTouched = false
if (params.grabCursor) {
_this.container.style.cursor = 'move';
_this.container.style.cursor = 'grab';
_this.container.style.cursor = '-moz-grab';
_this.container.style.cursor = '-webkit-grab';
}
if (!_this.positions.current && _this.positions.current !== 0) {
_this.positions.current = _this.positions.start
}
if (params.followFinger) {
_this.setWrapperTranslate(_this.positions.current);
}
_this.times.end = (new Date()).getTime();
_this.touches.diff = _this.touches.current - _this.touches.start
_this.touches.abs = Math.abs(_this.touches.diff)
_this.positions.diff = _this.positions.current - _this.positions.start
_this.positions.abs = Math.abs(_this.positions.diff)
var diff = _this.positions.diff;
var diffAbs = _this.positions.abs;
var timeDiff = _this.times.end - _this.times.start
if (diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks == false) {
if (!params.freeMode && diffAbs != 0)
_this.swipeReset()
if (params.preventLinks) {
_this.allowLinks = true;
}
if (params.onSlideClick) {
_this.allowSlideClick = true;
}
}
setTimeout(function() {
if (params.preventLinks) {
_this.allowLinks = true;
}
if (params.onSlideClick) {
_this.allowSlideClick = true;
}
}, 100);
var maxPosition = maxWrapperPosition();
if (!_this.isMoved && params.freeMode) {
_this.isMoved = false;
if (params.onTouchEnd)
_this.fireCallback(params.onTouchEnd, _this);
_this.callPlugins('onTouchEnd');
return;
}
if (!_this.isMoved || _this.positions.current > 0 || _this.positions.current<-maxPosition) {
_this.swipeReset();
if (params.onTouchEnd)
_this.fireCallback(params.onTouchEnd, _this);
_this.callPlugins('onTouchEnd');
return;
}
_this.isMoved = false;
if (params.freeMode) {
if (params.freeModeFluid) {
var momentumDuration = 1000 * params.momentumRatio;
var momentumDistance = _this.velocity * momentumDuration;
var newPosition = _this.positions.current + momentumDistance
var doBounce = false;
var afterBouncePosition;
var bounceAmount = Math.abs(_this.velocity) * 20 * params.momentumBounceRatio;
if (newPosition<-maxPosition) {
if (params.momentumBounce && _this.support.transitions) {
if (newPosition + maxPosition<-bounceAmount)
newPosition =- maxPosition - bounceAmount;
afterBouncePosition =- maxPosition;
doBounce = true;
allowMomentumBounce = true;
} else
newPosition =- maxPosition;
}
if (newPosition > 0) {
if (params.momentumBounce && _this.support.transitions) {
if (newPosition > bounceAmount)
newPosition = bounceAmount;
afterBouncePosition = 0
doBounce = true;
allowMomentumBounce = true;
} else
newPosition = 0;
}
if (_this.velocity != 0)
momentumDuration = Math.abs((newPosition - _this.positions.current) / _this.velocity)
_this.setWrapperTranslate(newPosition);
_this.setWrapperTransition(momentumDuration);
if (params.momentumBounce && doBounce) {
_this.wrapperTransitionEnd(function() {
if (!allowMomentumBounce)
return;
if (params.onMomentumBounce)
_this.fireCallback(params.onMomentumBounce, _this);
_this.callPlugins('onMomentumBounce');
_this.setWrapperTranslate(afterBouncePosition);
_this.setWrapperTransition(300);
})
}
_this.updateActiveSlide(newPosition)
}
if (!params.freeModeFluid || timeDiff >= 300)
_this.updateActiveSlide(_this.positions.current)
if (params.onTouchEnd)
_this.fireCallback(params.onTouchEnd, _this);
_this.callPlugins('onTouchEnd');
return;
}
direction = diff < 0 ? "toNext" : "toPrev"
if (direction == "toNext" && (timeDiff <= 300)) {
if (diffAbs < 30 ||!params.shortSwipes)
_this.swipeReset()
else
_this.swipeNext(true);
}
if (direction == "toPrev" && (timeDiff <= 300)) {
if (diffAbs < 30 ||!params.shortSwipes)
_this.swipeReset()
else
_this.swipePrev(true);
}
var targetSlideSize = 0;
if (params.slidesPerView == 'auto') {
var currentPosition = Math.abs(_this.getWrapperTranslate());
var slidesOffset = 0;
var _slideSize;
for (var i = 0; i < _this.slides.length; i++) {
_slideSize = isH ? _this.slides[i].getWidth(true) : _this.slides[i].getHeight(true);
slidesOffset += _slideSize;
if (slidesOffset > currentPosition) {
targetSlideSize = _slideSize;
break;
}
}
if (targetSlideSize > containerSize)
targetSlideSize = containerSize;
} else {
targetSlideSize = slideSize * params.slidesPerView;
}
if (direction == "toNext" && (timeDiff > 300)) {
if (diffAbs >= targetSlideSize * 0.5) {
_this.swipeNext(true)
} else {
_this.swipeReset()
}
}
if (direction == "toPrev" && (timeDiff > 300)) {
if (diffAbs >= targetSlideSize * 0.5) {
_this.swipePrev(true);
} else {
_this.swipeReset()
}
}
if (params.onTouchEnd)
params.onTouchEnd(_this)
_this.callPlugins('onTouchEnd');
}
function noSwipingSlide(el) {
var noSwiping = false;
do {
if (el.className.indexOf(params.noSwipingClass)>-1)
{
noSwiping = true;
}
el = el.parentElement;
}
while (!noSwiping && el.parentElement && el.className.indexOf(params.wrapperClass)==-1);
if (!noSwiping && el.className.indexOf(params.wrapperClass)>-1 && el.className.indexOf(params.noSwipingClass)>-1)
noSwiping = true;
return noSwiping;
}
_this.swipeNext = function(internal) {
if (!internal && params.loop)
_this.fixLoop();
if (!internal && params.autoplay)
_this.stopAutoplay(true);
_this.callPlugins('onSwipeNext');
var currentPosition = _this.getWrapperTranslate();
var newPosition = currentPosition;
if (params.slidesPerView == 'auto') {
for (var i = 0; i < _this.snapGrid.length; i++) {
if ( - currentPosition >= _this.snapGrid[i]&&-currentPosition < _this.snapGrid[i + 1]) {
newPosition =- _this.snapGrid[i + 1]
break;
}
}
} else {
var groupSize = slideSize * params.slidesPerGroup;
newPosition =- (Math.floor(Math.abs(currentPosition) / Math.floor(groupSize)) * groupSize + groupSize);
}
if (newPosition<- maxWrapperPosition()) {
newPosition =- maxWrapperPosition()
};
if (newPosition == currentPosition)
return false;
swipeToPosition(newPosition, 'next');
return true
}
_this.swipePrev = function(internal) {
if (!internal && params.loop)
_this.fixLoop();
if (!internal && params.autoplay)
_this.stopAutoplay(true);
_this.callPlugins('onSwipePrev');
var currentPosition = Math.ceil(_this.getWrapperTranslate());
var newPosition;
if (params.slidesPerView == 'auto') {
newPosition = 0;
for (var i = 1; i < _this.snapGrid.length; i++) {
if ( - currentPosition == _this.snapGrid[i]) {
newPosition =- _this.snapGrid[i - 1]
break;
}
if ( - currentPosition > _this.snapGrid[i]&&-currentPosition < _this.snapGrid[i + 1]) {
newPosition =- _this.snapGrid[i]
break;
}
}
} else {
var groupSize = slideSize * params.slidesPerGroup;
newPosition =- (Math.ceil( - currentPosition / groupSize) - 1) * groupSize;
}
if (newPosition > 0)
newPosition = 0;
if (newPosition == currentPosition)
return false;
swipeToPosition(newPosition, 'prev');
return true;
}
_this.swipeReset = function() {
_this.callPlugins('onSwipeReset');
var currentPosition = _this.getWrapperTranslate();
var groupSize = slideSize * params.slidesPerGroup;
var newPosition;
var maxPosition =- maxWrapperPosition();
if (params.slidesPerView == 'auto') {
newPosition = 0;
for (var i = 0; i < _this.snapGrid.length; i++) {
if ( - currentPosition === _this.snapGrid[i])
return;
if ( - currentPosition >= _this.snapGrid[i]&&-currentPosition < _this.snapGrid[i + 1]) {
if (_this.positions.diff > 0)
newPosition =- _this.snapGrid[i + 1]
else
newPosition =- _this.snapGrid[i]
break;
}
}
if ( - currentPosition >= _this.snapGrid[_this.snapGrid.length - 1])
newPosition =- _this.snapGrid[_this.snapGrid.length - 1];
if (currentPosition<=-maxWrapperPosition())
newPosition =- maxWrapperPosition()
} else {
newPosition = currentPosition < 0 ? Math.round(currentPosition / groupSize) * groupSize : 0
}
if (params.scrollContainer) {
newPosition = currentPosition < 0 ? currentPosition : 0;
}
if (newPosition<-maxWrapperPosition()) {
newPosition =- maxWrapperPosition()
}
if (params.scrollContainer && (containerSize > slideSize)) {
newPosition = 0;
}
if (newPosition == currentPosition)
return false;
swipeToPosition(newPosition, 'reset');
return true;
}
_this.swipeTo = function(index, speed, runCallbacks) {
index = parseInt(index, 10);
_this.callPlugins('onSwipeTo', {
index: index,
speed: speed
});
if (params.loop)
index = index + _this.loopedSlides;
var currentPosition = _this.getWrapperTranslate();
if (index > (_this.slides.length - 1) || index < 0)
return;
var newPosition
if (params.slidesPerView == 'auto') {
newPosition =- _this.slidesGrid[index];
} else {
newPosition =- index * slideSize;
}
if (newPosition<- maxWrapperPosition()) {
newPosition =- maxWrapperPosition();
};
if (newPosition == currentPosition)
return false;
runCallbacks = runCallbacks === false ? false : true;
swipeToPosition(newPosition, 'to', {
index: index,
speed: speed,
runCallbacks: runCallbacks
});
return true;
}
function swipeToPosition(newPosition, action, toOptions) {
var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed: params.speed;
if (_this.support.transitions ||!params.DOMAnimation) {
_this.setWrapperTranslate(newPosition);
_this.setWrapperTransition(speed);
} else {
var currentPosition = _this.getWrapperTranslate();
var animationStep = Math.ceil((newPosition - currentPosition) / speed * (1000 / 60));
var direction = currentPosition > newPosition ? 'toNext': 'toPrev';
var condition = direction == 'toNext' ? currentPosition > newPosition: currentPosition < newPosition;
if (_this._DOMAnimating)
return;
anim();
}
function anim() {
currentPosition += animationStep;
condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
if (condition) {
_this.setWrapperTranslate(Math.round(currentPosition));
_this._DOMAnimating = true
window.setTimeout(function() {
anim()
}, 1000 / 60)
} else {
if (params.onSlideChangeEnd)
_this.fireCallback(params.onSlideChangeEnd, _this);
_this.setWrapperTranslate(newPosition);
_this._DOMAnimating = false;
}
}
_this.updateActiveSlide(newPosition);
if (params.onSlideNext && action == 'next') {
_this.fireCallback(params.onSlideNext, _this, newPosition);
}
if (params.onSlidePrev && action == 'prev') {
_this.fireCallback(params.onSlidePrev, _this, newPosition);
}
if (params.onSlideReset && action == 'reset') {
_this.fireCallback(params.onSlideReset, _this, newPosition);
}
if (action == 'next' || action == 'prev' || (action == 'to' && toOptions.runCallbacks == true))
slideChangeCallbacks(action);
}
_this._queueStartCallbacks = false;
_this._queueEndCallbacks = false;
function slideChangeCallbacks(direction) {
_this.callPlugins('onSlideChangeStart');
if (params.onSlideChangeStart) {
if (params.queueStartCallbacks && _this.support.transitions) {
if (_this._queueStartCallbacks)
return;
_this._queueStartCallbacks = true;
_this.fireCallback(params.onSlideChangeStart, _this, direction)
_this.wrapperTransitionEnd(function() {
_this._queueStartCallbacks = false;
})
} else
_this.fireCallback(params.onSlideChangeStart, _this, direction)
}
if (params.onSlideChangeEnd) {
if (_this.support.transitions) {
if (params.queueEndCallbacks) {
if (_this._queueEndCallbacks)
return;
_this._queueEndCallbacks = true;
_this.wrapperTransitionEnd(function(swiper) {
_this.fireCallback(params.onSlideChangeEnd, swiper, direction)
})
} else
_this.wrapperTransitionEnd(function(swiper) {
_this.fireCallback(params.onSlideChangeEnd, swiper, direction)
})
} else {
if (!params.DOMAnimation) {
setTimeout(function() {
_this.fireCallback(params.onSlideChangeStart, _this, direction)
}, 10)
}
}
}
}
_this.updateActiveSlide = function(position) {
if (!_this.initialized)
return;
if (_this.slides.length == 0)
return;
_this.previousIndex = _this.activeIndex;
if (typeof position == 'undefined')
position = _this.getWrapperTranslate();
if (position > 0)
position = 0;
if (params.slidesPerView == 'auto') {
var slidesOffset = 0;
_this.activeIndex = _this.slidesGrid.indexOf( - position);
if (_this.activeIndex < 0) {
for (var i = 0; i < _this.slidesGrid.length - 1; i++) {
if ( - position > _this.slidesGrid[i]&&-position < _this.slidesGrid[i + 1]) {
break;
}
}
var leftDistance = Math.abs(_this.slidesGrid[i] + position)
var rightDistance = Math.abs(_this.slidesGrid[i + 1] + position)
if (leftDistance <= rightDistance)
_this.activeIndex = i;
else
_this.activeIndex = i + 1;
}
} else {
_this.activeIndex = Math[params.visibilityFullFit ? 'ceil': 'round']( - position / slideSize);
}
if (_this.activeIndex == _this.slides.length)
_this.activeIndex = _this.slides.length - 1;
if (_this.activeIndex < 0)
_this.activeIndex = 0;
if (!_this.slides[_this.activeIndex])
return;
_this.calcVisibleSlides(position);
var activeClassRegexp = new RegExp("\\s*" + params.slideActiveClass);
var inViewClassRegexp = new RegExp("\\s*" + params.slideVisibleClass);
for (var i = 0; i < _this.slides.length; i++) {
_this.slides[i].className = _this.slides[i].className.replace(activeClassRegexp, '').replace(inViewClassRegexp, '');
if (_this.visibleSlides.indexOf(_this.slides[i]) >= 0) {
_this.slides[i].className += ' ' + params.slideVisibleClass;
}
}
_this.slides[_this.activeIndex].className += ' ' + params.slideActiveClass;
if (params.loop) {
var ls = _this.loopedSlides;
_this.activeLoopIndex = _this.activeIndex - ls;
if (_this.activeLoopIndex >= _this.slides.length - ls * 2) {
_this.activeLoopIndex = _this.slides.length - ls * 2 - _this.activeLoopIndex;
}
if (_this.activeLoopIndex < 0) {
_this.activeLoopIndex = _this.slides.length - ls * 2 + _this.activeLoopIndex;
}
} else {
_this.activeLoopIndex = _this.activeIndex;
}
if (params.pagination) {
_this.updatePagination(position);
}
}
_this.createPagination = function(firstInit) {
if (params.paginationClickable && _this.paginationButtons) {
removePaginationEvents();
}
_this.paginationContainer = params.pagination.nodeType ? params.pagination : $$(params.pagination)[0];
if (params.createPagination) {
var paginationHTML = "";
var numOfSlides = _this.slides.length;
var numOfButtons = numOfSlides;
if (params.loop)
numOfButtons -= _this.loopedSlides * 2
for (var i = 0; i < numOfButtons; i++) {
paginationHTML += '<' + params.paginationElement + ' class="' + params.paginationElementClass + '"></' + params.paginationElement + '>'
}
_this.paginationContainer.innerHTML = paginationHTML;
}
_this.paginationButtons = $$('.' + params.paginationElementClass, _this.paginationContainer);
if (!firstInit)
_this.updatePagination()
_this.callPlugins('onCreatePagination');
if (params.paginationClickable) {
addPaginationEvents();
}
}
function removePaginationEvents() {
var pagers = _this.paginationButtons;
for (var i = 0; i < pagers.length; i++) {
_this.h.removeEventListener(pagers[i], 'click', paginationClick);
}
}
function addPaginationEvents() {
var pagers = _this.paginationButtons;
for (var i = 0; i < pagers.length; i++) {
_this.h.addEventListener(pagers[i], 'click', paginationClick);
}
}
function paginationClick(e) {
var index;
var target = e.target || e.srcElement;
var pagers = _this.paginationButtons;
for (var i = 0; i < pagers.length; i++) {
if (target === pagers[i])
index = i;
}
_this.swipeTo(index)
}
_this.updatePagination = function(position) {
if (!params.pagination)
return;
if (_this.slides.length < 1)
return;
var activePagers = $$('.' + params.paginationActiveClass, _this.paginationContainer);
if (!activePagers)
return;
var pagers = _this.paginationButtons;
if (pagers.length == 0)
return;
for (var i = 0; i < pagers.length; i++) {
pagers[i].className = params.paginationElementClass
}
var indexOffset = params.loop ? _this.loopedSlides: 0;
if (params.paginationAsRange) {
if (!_this.visibleSlides)
_this.calcVisibleSlides(position)
var visibleIndexes = [];
for (var i = 0; i < _this.visibleSlides.length; i++) {
var visIndex = _this.slides.indexOf(_this.visibleSlides[i]) - indexOffset
if (params.loop && visIndex < 0) {
visIndex = _this.slides.length - _this.loopedSlides * 2 + visIndex;
}
if (params.loop && visIndex >= _this.slides.length - _this.loopedSlides * 2) {
visIndex = _this.slides.length - _this.loopedSlides * 2 - visIndex;
visIndex = Math.abs(visIndex)
}
visibleIndexes.push(visIndex)
}
for (i = 0; i < visibleIndexes.length; i++) {
if (pagers[visibleIndexes[i]])
pagers[visibleIndexes[i]].className += ' ' + params.paginationVisibleClass;
}
if (params.loop) {
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass;
} else {
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass;
}
} else {
if (params.loop) {
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
} else {
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
}
}
}
_this.calcVisibleSlides = function(position) {
var visibleSlides = [];
var _slideLeft = 0, _slideSize = 0, _slideRight = 0;
if (isH && _this.wrapperLeft > 0)
position = position + _this.wrapperLeft;
if (!isH && _this.wrapperTop > 0)
position = position + _this.wrapperTop;
for (var i = 0; i < _this.slides.length; i++) {
_slideLeft += _slideSize;
if (params.slidesPerView == 'auto')
_slideSize = isH ? _this.h.getWidth(_this.slides[i], true) : _this.h.getHeight(_this.slides[i], true);
else
_slideSize = slideSize;
_slideRight = _slideLeft + _slideSize;
var isVisibile = false;
if (params.visibilityFullFit) {
if (_slideLeft>=-position && _slideRight<=-position + containerSize)
isVisibile = true;
if (_slideLeft<=-position && _slideRight>=-position + containerSize)
isVisibile = true;
} else {
if (_slideRight>-position && _slideRight <= (( - position + containerSize)))
isVisibile = true;
if (_slideLeft>=-position && _slideLeft < (( - position + containerSize)))
isVisibile = true;
if (_slideLeft<-position && _slideRight > (( - position + containerSize)))
isVisibile = true;
}
if (isVisibile)
visibleSlides.push(_this.slides[i])
}
if (visibleSlides.length == 0)
visibleSlides = [_this.slides[_this.activeIndex]]
_this.visibleSlides = visibleSlides;
}
var autoplayTimeoutId = undefined;
_this.startAutoplay = function() {
if (typeof autoplayTimeoutId !== 'undefined')
return false;
if (!params.autoplay)
return;
_this.callPlugins('onAutoplayStart');
autoplay();
}
_this.stopAutoplay = function(internal) {
if (autoplayTimeoutId)
clearTimeout(autoplayTimeoutId);
autoplayTimeoutId = undefined;
if (internal&&!params.autoplayDisableOnInteraction) {
_this.wrapperTransitionEnd(function() {
autoplay();
})
}
_this.callPlugins('onAutoplayStop');
}
function autoplay() {
autoplayTimeoutId = setTimeout(function() {
if (params.loop) {
_this.fixLoop();
_this.swipeNext(true);
} else if (!_this.swipeNext(true))
_this.swipeTo(0);
_this.wrapperTransitionEnd(function() {
if (typeof autoplayTimeoutId !== 'undefined')
autoplay();
})
}, params.autoplay)
}
_this.loopCreated = false;
_this.removeLoopedSlides = function() {
if (_this.loopCreated) {
for (var i = 0; i < _this.slides.length; i++) {
if (_this.slides[i].getData('looped') === true)
_this.wrapper.removeChild(_this.slides[i]);
}
}
}
_this.createLoop = function() {
if (_this.slides.length == 0)
return;
if (params.slidesPerView == 'auto') {
_this.loopedSlides = params.loopedSlides || 1;
} else {
_this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
}
if (_this.loopedSlides > _this.slides.length) {
_this.loopedSlides = _this.slides.length;
}
var slideFirstHTML = '', slideLastHTML = '', i;
var slidesSetFullHTML = '';
var numSlides = _this.slides.length;
var fullSlideSets = Math.floor(_this.loopedSlides / numSlides);
var remainderSlides = _this.loopedSlides%numSlides;
for (i = 0; i < (fullSlideSets * numSlides); i++) {
var j = i;
if (i >= numSlides) {
var over = Math.floor(i / numSlides);
j = i - (numSlides * over);
}
slidesSetFullHTML += _this.slides[j].outerHTML;
}
for (i = 0; i < remainderSlides; i++) {
slideLastHTML += _this.slides[i].outerHTML;
}
for (i = numSlides - remainderSlides; i < numSlides; i++) {
slideFirstHTML += _this.slides[i].outerHTML;
}
var slides = slideFirstHTML + slidesSetFullHTML + wrapper.innerHTML + slidesSetFullHTML + slideLastHTML;
wrapper.innerHTML = slides;
_this.loopCreated = true;
_this.calcSlides();
for (i = 0; i < _this.slides.length; i++) {
if (i < _this.loopedSlides || i >= _this.slides.length - _this.loopedSlides)
_this.slides[i].setData('looped', true);
}
_this.callPlugins('onCreateLoop');
}
_this.fixLoop = function() {
var newIndex;
if (_this.activeIndex < _this.loopedSlides) {
newIndex = _this.slides.length - _this.loopedSlides * 3 + _this.activeIndex;
_this.swipeTo(newIndex, 0, false);
} else if (_this.activeIndex > _this.slides.length - params.slidesPerView * 2) {
newIndex =- _this.slides.length + _this.activeIndex + _this.loopedSlides
_this.swipeTo(newIndex, 0, false);
}
}
_this.loadSlides = function() {
var slidesHTML = '';
_this.activeLoaderIndex = 0;
var slides = params.loader.slides;
var slidesToLoad = params.loader.loadAllSlides ? slides.length: params.slidesPerView * (1 + params.loader.surroundGroups);
for (var i = 0; i < slidesToLoad; i++) {
if (params.loader.slidesHTMLType == 'outer')
slidesHTML += slides[i];
else {
slidesHTML += '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
}
}
_this.wrapper.innerHTML = slidesHTML;
_this.calcSlides(true);
if (!params.loader.loadAllSlides) {
_this.wrapperTransitionEnd(_this.reloadSlides, true);
}
}
_this.reloadSlides = function() {
var slides = params.loader.slides;
var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'), 10)
if (newActiveIndex < 0 || newActiveIndex > slides.length - 1)
return
_this.activeLoaderIndex = newActiveIndex;
var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView * params.loader.surroundGroups)
var lastIndex = Math.min(newActiveIndex + params.slidesPerView * (1 + params.loader.surroundGroups) - 1, slides.length - 1)
if (newActiveIndex > 0) {
var newTransform =- slideSize * (newActiveIndex - firstIndex)
_this.setWrapperTranslate(newTransform);
_this.setWrapperTransition(0);
}
if (params.loader.logic === 'reload') {
_this.wrapper.innerHTML = '';
var slidesHTML = '';
for (var i = firstIndex; i <= lastIndex; i++) {
slidesHTML += params.loader.slidesHTMLType == 'outer' ? slides[i] : '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
}
_this.wrapper.innerHTML = slidesHTML;
} else {
var minExistIndex = 1000;
var maxExistIndex = 0;
for (var i = 0; i < _this.slides.length; i++) {
var index = _this.slides[i].data('swiperindex');
if (index < firstIndex || index > lastIndex) {
_this.wrapper.removeChild(_this.slides[i]);
} else {
minExistIndex = Math.min(index, minExistIndex)
maxExistIndex = Math.max(index, maxExistIndex)
}
}
for (var i = firstIndex; i <= lastIndex; i++) {
if (i < minExistIndex) {
var newSlide = document.createElement(params.slideElement);
newSlide.className = params.slideClass;
newSlide.setAttribute('data-swiperindex', i);
newSlide.innerHTML = slides[i];
_this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
}
if (i > maxExistIndex) {
var newSlide = document.createElement(params.slideElement);
newSlide.className = params.slideClass;
newSlide.setAttribute('data-swiperindex', i);
newSlide.innerHTML = slides[i];
_this.wrapper.appendChild(newSlide);
}
}
}
_this.reInit(true);
}
function makeSwiper() {
_this.calcSlides();
if (params.loader.slides.length > 0 && _this.slides.length == 0) {
_this.loadSlides();
}
if (params.loop) {
_this.createLoop();
}
_this.init();
initEvents();
if (params.pagination) {
_this.createPagination(true);
}
if (params.loop || params.initialSlide > 0) {
_this.swipeTo(params.initialSlide, 0, false);
} else {
_this.updateActiveSlide(0);
}
if (params.autoplay) {
_this.startAutoplay();
}
_this.centerIndex = _this.activeIndex;
if (params.onSwiperCreated)
_this.fireCallback(params.onSwiperCreated, _this);
_this.callPlugins('onSwiperCreated');
}
makeSwiper();
}
Swiper.prototype = {
plugins: {},
wrapperTransitionEnd: function(callback, permanent) {
var a = this, el = a.wrapper, events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'], i;
function fireCallBack() {
callback(a);
if (a.params.queueEndCallbacks)
a._queueEndCallbacks = false;
if (!permanent) {
for (i = 0; i < events.length; i++) {
a.h.removeEventListener(el, events[i], fireCallBack);
}
}
}
if (callback) {
for (i = 0; i < events.length; i++) {
a.h.addEventListener(el, events[i], fireCallBack);
}
}
},
getWrapperTranslate: function(axis) {
var el = this.wrapper, matrix, curTransform, curStyle, transformMatrix;
if (typeof axis == 'undefined') {
axis = this.params.mode == 'horizontal' ? 'x' : 'y';
}
if (this.support.transforms && this.params.useCSS3Transforms) {
curStyle = window.getComputedStyle(el, null);
if (window.WebKitCSSMatrix) {
transformMatrix = new WebKitCSSMatrix(curStyle.webkitTransform);
} else {
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,");
matrix = transformMatrix.toString().split(',');
}
if (axis == 'x') {
if (window.WebKitCSSMatrix)
curTransform = transformMatrix.m41;
else if (matrix.length == 16)
curTransform = parseFloat(matrix[12]);
else
curTransform = parseFloat(matrix[4]);
}
if (axis == 'y') {
if (window.WebKitCSSMatrix)
curTransform = transformMatrix.m42;
else if (matrix.length == 16)
curTransform = parseFloat(matrix[13]);
else
curTransform = parseFloat(matrix[5]);
}
} else {
if (axis == 'x')
curTransform = parseFloat(el.style.left, 10) || 0;
if (axis == 'y')
curTransform = parseFloat(el.style.top, 10) || 0;
}
return curTransform || 0;
},
setWrapperTranslate: function(x, y, z) {
var es = this.wrapper.style, coords = {
x: 0,
y: 0,
z: 0
}, translate;
if (arguments.length == 3) {
coords.x = x;
coords.y = y;
coords.z = z;
} else {
if (typeof y == 'undefined') {
y = this.params.mode == 'horizontal' ? 'x' : 'y';
}
coords[y] = x;
}
if (this.support.transforms && this.params.useCSS3Transforms) {
translate = this.support.transforms3d ? 'translate3d(' + coords.x + 'px, ' + coords.y + 'px, ' + coords.z + 'px)' : 'translate(' + coords.x + 'px, ' + coords.y + 'px)';
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = translate;
} else {
es.left = coords.x + 'px';
es.top = coords.y + 'px';
}
this.callPlugins('onSetWrapperTransform', coords);
if (this.params.onSetWrapperTransform)
this.fireCallback(this.params.onSetWrapperTransform, this, coords);
},
setWrapperTransition: function(duration) {
var es = this.wrapper.style;
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = (duration / 1000) + 's';
this.callPlugins('onSetWrapperTransition', {
duration: duration
});
if (this.params.onSetWrapperTransition)
this.fireCallback(this.params.onSetWrapperTransition, this, duration);
},
h: {
getWidth: function(el, outer) {
var width = window.getComputedStyle(el, null).getPropertyValue('width')
var returnWidth = parseFloat(width);
if (isNaN(returnWidth) || width.indexOf('%') > 0) {
returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
}
if (outer)
returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'))
return returnWidth;
},
getHeight: function(el, outer) {
if (outer)
return el.offsetHeight;
var height = window.getComputedStyle(el, null).getPropertyValue('height')
var returnHeight = parseFloat(height);
if (isNaN(returnHeight) || height.indexOf('%') > 0) {
returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
}
if (outer)
returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'))
return returnHeight;
},
getOffset: function(el) {
var box = el.getBoundingClientRect();
var body = document.body;
var clientTop = el.clientTop || body.clientTop || 0;
var clientLeft = el.clientLeft || body.clientLeft || 0;
var scrollTop = window.pageYOffset || el.scrollTop;
var scrollLeft = window.pageXOffset || el.scrollLeft;
if (document.documentElement&&!window.pageYOffset) {
scrollTop = document.documentElement.scrollTop;
scrollLeft = document.documentElement.scrollLeft;
}
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
},
windowWidth: function() {
if (window.innerWidth)
return window.innerWidth
else if (document.documentElement && document.documentElement.clientWidth)
return document.documentElement.clientWidth;
},
windowHeight: function() {
if (window.innerHeight)
return window.innerHeight
else if (document.documentElement && document.documentElement.clientHeight)
return document.documentElement.clientHeight;
},
windowScroll: function() {
var left = 0, top = 0;
if (typeof pageYOffset != 'undefined') {
return {
left: window.pageXOffset,
top: window.pageYOffset
}
} else if (document.documentElement) {
return {
left: document.documentElement.scrollLeft,
top: document.documentElement.scrollTop
}
}
},
addEventListener: function(el, event, listener, useCapture) {
if (typeof useCapture == 'undefined') {
useCapture = false;
}
if (el.addEventListener) {
el.addEventListener(event, listener, useCapture);
} else if (el.attachEvent) {
el.attachEvent('on' + event, listener);
}
},
removeEventListener: function(el, event, listener, useCapture) {
if (typeof useCapture == 'undefined') {
useCapture = false;
}
if (el.removeEventListener) {
el.removeEventListener(event, listener, useCapture);
} else if (el.detachEvent) {
el.detachEvent('on' + event, listener);
}
}
},
setTransform: function(el, transform) {
var es = el.style
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform
},
setTranslate: function(el, translate) {
var es = el.style
var pos = {
x: translate.x || 0,
y: translate.y || 0,
z: translate.z || 0
};
var transformString = this.support.transforms3d ? 'translate3d(' + (pos.x) + 'px,' + (pos.y) + 'px,' + (pos.z) + 'px)': 'translate(' + (pos.x) + 'px,' + (pos.y) + 'px)';
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
if (!this.support.transforms) {
es.left = pos.x + 'px'
es.top = pos.y + 'px'
}
},
setTransition: function(el, duration) {
var es = el.style
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration + 'ms';
},
support: {
touch: (window.Modernizr && Modernizr.touch === true) || (function() {
return !!(("ontouchstart"in window) || window.DocumentTouch && document instanceof DocumentTouch);
})(),
transforms3d: (window.Modernizr && Modernizr.csstransforms3d === true) || (function() {
var div = document.createElement('div').style;
return ("webkitPerspective"in div || "MozPerspective"in div || "OPerspective"in div || "MsPerspective"in div || "perspective"in div);
})(),
transforms: (window.Modernizr && Modernizr.csstransforms === true) || (function() {
var div = document.createElement('div').style;
return ('transform'in div || 'WebkitTransform'in div || 'MozTransform'in div || 'msTransform'in div || 'MsTransform'in div || 'OTransform'in div);
})(),
transitions: (window.Modernizr && Modernizr.csstransitions === true) || (function() {
var div = document.createElement('div').style;
return ('transition'in div || 'WebkitTransition'in div || 'MozTransition'in div || 'msTransition'in div || 'MsTransition'in div || 'OTransition'in div);
})()
},
browser: {
ie8: (function() {
var rv =- 1;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat(RegExp.$1);
}
return rv!=-1 && rv < 9;
})(),
ie10: window.navigator.msPointerEnabled
}
}
if (window.jQuery || window.Zepto) {
(function($) {
$.fn.swiper = function(params) {
var s = new Swiper($(this)[0], params)
$(this).data('swiper', s);
return s;
}
})(window.jQuery || window.Zepto)
}
if (typeof(module) !== 'undefined')
{
module.exports = Swiper;
}
Swiper.prototype.plugins.scrollbar = function(swiper, params) {
var enabled = params && params.container;
if (!enabled)
return;
var defaults = {
hide: true,
draggable: true,
snapOnRelease: false
}
params = params || {};
for (var prop in defaults) {
if (!(prop in params)) {
params[prop] = defaults[prop]
}
}
if (!document.querySelectorAll) {
if (!window.jQuery)
return;
}
function $$(s) {
if (document.querySelectorAll)
return document.querySelectorAll(s)
else
return jQuery(s)
}
if (!(params.container.nodeType)) {
if ($$(params.container).length == 0)
return;
}
var container = (params.container.nodeType) ? params.container: $$(params.container)[0];
var isH = swiper.params.mode == 'horizontal', track = container, trackWidth, trackHeight, divider, moveDivider, dragWidth, dragHeight;
var drag = document.createElement('div')
drag.className = 'swiper-scrollbar-drag';
if (params.draggable)
drag.className += ' swiper-scrollbar-cursor-drag';
track.appendChild(drag);
if (params.hide)
track.style.opacity = 0;
var te = swiper.touchEvents
if (params.draggable) {
var isTouched = false;
function dragStart(e) {
isTouched = true;
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
setDragPosition(e);
clearTimeout(timeout);
swiper.setTransition(track, 0)
track.style.opacity = 1;
swiper.setWrapperTransition(100);
swiper.setTransition(drag, 100)
if (params.onScrollbarDrag) {
params.onScrollbarDrag(swiper)
}
}
function dragMove(e) {
if (!isTouched)
return;
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
setDragPosition(e);
swiper.setWrapperTransition(0);
swiper.setTransition(track, 0)
swiper.setTransition(drag, 0)
if (params.onScrollbarDrag) {
params.onScrollbarDrag(swiper)
}
}
function dragEnd(e) {
isTouched = false;
if (params.hide) {
clearTimeout(timeout)
timeout = setTimeout(function() {
track.style.opacity = 0;
swiper.setTransition(track, 400)
}, 1000)
}
if (params.snapOnRelease) {
swiper.swipeReset()
}
}
var lestenEl = swiper.support.touch ? track: document
swiper.h.addEventListener(track, te.touchStart, dragStart, false)
swiper.h.addEventListener(lestenEl, te.touchMove, dragMove, false)
swiper.h.addEventListener(lestenEl, te.touchEnd, dragEnd, false)
function setDragPosition(e) {
var x = y = 0;
var position;
if (isH) {
var pageX = (e.type == 'touchstart' || e.type == 'touchmove') ? e.targetTouches[0].pageX: e.pageX || e.clientX;
x = (pageX) - swiper.h.getOffset(track).left - dragWidth / 2
if (x < 0)
x = 0;
else if ((x + dragWidth) > trackWidth) {
x = trackWidth - dragWidth;
}
} else {
var pageY = (e.type == 'touchstart' || e.type == 'touchmove') ? e.targetTouches[0].pageY: e.pageY || e.clientY;
y = (pageY) - swiper.h.getOffset(track).top - dragHeight / 2;
if (y < 0)
y = 0;
else if ((y + dragHeight) > trackHeight) {
y = trackHeight - dragHeight;
}
}
swiper.setTranslate(drag, {
x: x,
y: y
})
var wrapX =- x / moveDivider;
var wrapY =- y / moveDivider;
swiper.setWrapperTranslate(wrapX, wrapY, 0)
swiper.updateActiveSlide(isH ? wrapX : wrapY);
}
}
function setScrollBars() {
drag.style.width = ''
drag.style.height = ''
if (isH) {
trackWidth = swiper.h.getWidth(track, true);
divider = swiper.width / (swiper.h.getWidth(swiper.wrapper) + swiper.wrapperLeft + swiper.wrapperRight);
moveDivider = divider * (trackWidth / swiper.width);
dragWidth = trackWidth * divider;
drag.style.width = dragWidth + 'px';
} else {
trackHeight = swiper.h.getHeight(track, true);
divider = swiper.height / (swiper.h.getHeight(swiper.wrapper) + swiper.wrapperTop + swiper.wrapperBottom);
moveDivider = divider * (trackHeight / swiper.height);
dragHeight = trackHeight * divider;
if (dragHeight > trackHeight)
dragHeight = trackHeight
drag.style.height = dragHeight + 'px';
}
if (divider >= 1) {
container.style.display = 'none'
} else {
container.style.display = ''
}
}
var timeout;
var hooks = {
onFirstInit: function(args) {
setScrollBars()
},
onInit: function(args) {
setScrollBars()
},
onTouchMoveEnd: function(args) {
if (params.hide) {
clearTimeout(timeout)
track.style.opacity = 1;
swiper.setTransition(track, 200)
}
},
onTouchEnd: function(args) {
if (params.hide) {
clearTimeout(timeout)
timeout = setTimeout(function() {
track.style.opacity = 0;
swiper.setTransition(track, 400)
}, 1000)
}
},
onSetWrapperTransform: function(pos) {
if (isH) {
var newLeft = pos.x * moveDivider;
var newWidth = dragWidth;
if (newLeft > 0) {
var diff = newLeft;
newLeft = 0;
newWidth = dragWidth - diff;
} else if (( - newLeft + dragWidth) > trackWidth) {
newWidth = trackWidth + newLeft;
}
swiper.setTranslate(drag, {
x: - newLeft
})
drag.style.width = newWidth + 'px';
} else {
var newTop = pos.y * moveDivider;
var newHeight = dragHeight;
if (newTop > 0) {
var diff = newTop;
newTop = 0;
newHeight = dragHeight - diff;
} else if (( - newTop + dragHeight) > trackHeight) {
newHeight = trackHeight + newTop;
}
swiper.setTranslate(drag, {
y: - newTop
})
drag.style.height = newHeight + 'px';
}
if (swiper.params.freeMode && params.hide) {
clearTimeout(timeout)
track.style.opacity = 1;
timeout = setTimeout(function() {
track.style.opacity = 0;
swiper.setTransition(track, 400)
}, 1000)
}
},
onSetWrapperTransition: function(args) {
swiper.setTransition(drag, args.duration)
},
onDestroy: function() {
var lestenEl = swiper.support.touch ? track: document
swiper.h.removeEventListener(track, te.touchStart, dragStart, false)
swiper.h.removeEventListener(lestenEl, te.touchMove, dragMove, false)
swiper.h.removeEventListener(lestenEl, te.touchEnd, dragEnd, false)
}
}
return hooks;
}
// Vars
var jqWin = $(window);
var jqHTML = $('html');
var jqBody = $('body');
var preloadTimer;
var appInfo = {
name: "PRPL.rs",
description: "PRPL.rs powered by Angular and the WordPress JSON API Plugin",
version: {
'name': 'X',
'number': '1.5'
}
};
var glob = {}
glob.canAnimate = false;
/* Angular App Setup (ngPRPL)
************************************************************************ */
var ngPRPL = angular.module('PRPL',
['ngRoute', 'ngAnimate', 'ngResource', 'ngSanitize', 'prplAnimator', 'angulartics', 'angulartics.google.tagmanager']
);
ngPRPL.config([
'$routeProvider',
'$locationProvider',
function($routeProvider, $locationProvider) {
// remove the hashbang from the URL
$locationProvider.html5Mode(true).hashPrefix('!');
// set up routes and associated controllers
$routeProvider
.when('/', {
controller: 'HomeController',
templateUrl: '/views/main.html'
})
.when('/about', {
controller: 'AboutController',
templateUrl: '/views/about.html'
})
.when('/process', {
controller: 'ProcessController',
templateUrl: '/views/process.html'
})
.when('/work', {
controller: 'CaseStudiesController',
templateUrl: '/views/case-studies.html'
})
.when('/work/rmcad', {
controller: 'RMCADController',
templateUrl: '/views/case-studies/rmcad.html'
})
.when('/work/videri', {
controller: 'VideriController',
templateUrl: '/views/case-studies/videri.html'
})
.when('/work/4-rivers', {
controller: 'FourRiversController',
templateUrl: '/views/case-studies/4rivers.html'
})
.when('/work/davidoff', {
controller: 'DavidoffController',
templateUrl: '/views/case-studies/davidoff.html'
})
.when('/work/adu', {
controller: 'ADUController',
templateUrl: '/views/case-studies/adu.html'
})
.when('/work/nasa', {
controller: 'NASAController',
templateUrl: '/views/case-studies/nasa.html'
})
.when('/work/cisco', {
controller: 'CiscoController',
templateUrl: '/views/case-studies/cisco.html'
})
.when('/work/fleetgistics', {
controller: 'FleetgisticsController',
templateUrl: '/views/case-studies/fleetgistics.html'
})
.when('/work/ouc', {
controller: 'OUCController',
templateUrl: '/views/case-studies/ouc.html'
})
.when('/careers', {
controller: 'CareersController',
templateUrl: '/views/careers.html',
reloadOnSearch: false
})
.when('/careers/:slug', {
controller: 'CareersController',
templateUrl: '/views/careers.html'
})
.when('/careers/:slug/:apply', {
controller: 'CareersController',
templateUrl: '/views/careers.html'
})
.when('/contact', {
controller: 'ContactController',
templateUrl: '/views/contact.html'
})
.when('/contact/:slug', {
controller: 'ContactController',
templateUrl: '/views/contact.html',
reloadOnSearch: false
})
.when('/notes', {
controller: 'BlogListController',
templateUrl: '/views/notes.html'
})
.when('/notes/:cat', {
controller: 'BlogListController',
templateUrl: '/views/notes.html'
})
.when('/notes/:id/:slug', {
controller: 'BlogPostController',
templateUrl: '/views/note.html'
})
.when('/privacy', {
controller: 'PrivacyPolicyController',
templateUrl: '/views/privacy.html'
})
.when('/mutual-nda', {
controller: 'NonDisclosureAgreementController',
templateUrl: '/views/nda.html'
})
.when('/master-agreement', {
controller: 'MasterAgreementController',
templateUrl: '/views/msa.html'
})
.when('/fla', {
controller: 'FacilityLicenseAgreementController',
templateUrl: '/views/fla.html'
})
.when('/facility-license-agreement', {
controller: 'FacilityLicenseAgreementController',
templateUrl: '/views/fla.html'
})
.when('/facility-agreement', {
controller: 'FacilityLicenseAgreementController',
templateUrl: '/views/fla.html'
})
.when('/csa', {
controller: 'ConsultingServicesAgreementController',
templateUrl: '/views/csa.html'
})
.when('/consulting-services-agreement', {
controller: 'ConsultingServicesAgreementController',
templateUrl: '/views/csa.html'
})
.when('/consulting-services', {
controller: 'ConsultingServicesAgreementController',
templateUrl: '/views/csa.html'
})
.when('/404', {
controller: 'ErrorController',
templateUrl: '/views/404.html'
})
.when('/x/:shortLink', {
controller: 'ShortLinkController',
templateUrl: '/views/link.html'
})
.otherwise({
redirectTo: '/404'
});
}
]);
ngPRPL.run([
'$rootScope',
'$location',
'$anchorScroll',
'$routeParams',
'$timeout',
function($rootScope, $location, $anchorScroll, $routeParams, $timeout) {
$rootScope.$on('$routeChangeSuccess', function(newRoute, oldRoute) {
// Manual Page Tracking
// console.log(oldRoute);
// force loader to remain on link page
if (oldRoute.loadedTemplateUrl !== "/views/link.html") {
setTimeout(function() {
$('body').removeClass('preloading').addClass('loaded');
}, 1500);
}
// setup scrollTo param and force scroll to top, because for some reason thats not default behavior.
$timeout(function() {
$location.hash($routeParams.scrollTo);
$anchorScroll();
$(window).resize();
if ($('.ng-view-wrap').last().find('[data-prpl-poi]').length == 0) {
// $('#progress-indicator').addClass('none-found');
$.waypoints('destroy')
$('.points-of-interest').removeClass('intro');
} else {
// $.waypoints('refresh');
// $('#progress-indicator').removeClass('none-found');
};
}, 50);
//blacklist for animations
var disallowUrl = {
notes: "notes",
careers: "careers",
about: "about",
process: "process"
},
pathName = window.location.pathname.split("/");
$timeout(function() {
// $('.prpl-bgv').on('canplay', function(){
imagesLoaded('body', function() {
// console.log('images loaded')
// $('body').removeClass('preloading').addClass('loaded');
});
// });
}, 1000);
});
$rootScope.$on('$routeChangeStart', function(newRoute, oldRoute) {
// console.log('show loader');
$.waypoints('destroy')
$('.points-of-interest').removeClass('intro');
// $('#progress-indicator').addClass('none-found');
// $('#progress-indicator .points-of-interest').removeClass('intro').html('');
// $('body').addClass('preloading').removeClass('loaded');
});
}
]);
/* 404 Controller
************************************************************************ */
//
ngPRPL.controller('ErrorController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
var GIFcount = 44;
var random = Math.floor(Math.random() * (GIFcount - 1 + 1)) + 1;
var randomGIF = 'url(../assets/images/404/404_' + random + '.gif)';
$('.hero-404').css('background-image', randomGIF);
var copyDest = $('.page-404 .copy');
var copy404 = "Sorry, we can’t find whatever it is you think you want."
switch (random) {
case 35:
copy404 = "Blerg. Sorry, Charlie, this is really bumming us out.";
break;
case 2:
copy404 = "This page ain't ralph tho.";
break;
case 5:
copy404 = "NOOOOOOOOOOO THE PAGE IS GONEEEEEEE";
break;
case 8:
copy404 = "Uhhhh no way pal, that link is broke."
break;
case 9:
copy404 = "Crap, this is way loose butthole."
break;
case 15:
copy404 = "Your request for this page has been overruled."
break;
case 30:
copy404 = "No way. Like, what are you looking for, again?";
break;
case 28:
copy404 = "Mmm, no. The road to power is paved with hypocrisy and 404 errors.";
break;
case 9:
copy404 = "Sorry dude, you’re gonna have to get weird somewhere else.";
break;
case 17:
copy404 = "Pfffffft, I don't need no pages.";
break;
case 4:
copy404 = "Oh no honey boo boo child, there is no page here.";
break;
case 37:
copy404 = "Sorry dude, you’re gonna have to get weird somewhere else.";
break;
case 36:
copy404 = "Started from a link and now we're here.";
break;
case 27:
copy404 = "Man f@%! yo' page request, I'm Rick James!"
break;
case 22:
copy404 = "This just in — your page cannot be found.";
break;
case 38:
copy404 = "Therez no page here ya dingus"
break;
case 39:
copy404 = "Have you tried turning it off and on again?"
break;
case 44:
copy404 = "Sometimes you gotta work a little, so you can ball a lot."
break;
case 45:
copy404 = "If at first you don’t succeed then maybe you just suck.";
break;
default:
break;
}
copyDest.html(copy404);
$scope.$parent.navFlag = spacesToNBSP('Oh no, a 404!');
$scope.$parent.seo = {
description: 'Purple Rock Scissors / A Digital Creative Agency',
keywords: 'Purple Rock Scissors, Design, Development',
title: '404 | PRPL.rs'
};
// removePreloader();
PRERENDER_READY(); // utils.js
}
]);
/* About Controller
************************************************************************ */
//
ngPRPL.controller('AboutController',
['$scope', '$sanitize', '$resource', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $resource, $location, PRPLEmployee) {
// $scope.$parent.navFlag = spacesToNBSP("About");
$scope.$parent.seo = {
title: 'About | Purple, Rock, Scissors',
description: 'Digital agency PRPL delivers best-in-class experiences and innovation at the forefront of technology. Learn who we are and what we value.',
keywords: 'PRPL, digital creative agency, agency think tank, digital agency, digital agency of record, innovation consulting, digital strategy, agency culture'
};
$scope.$parent.social = {
title: 'PRPL | Purple, Rock, Scissors: A Digital Creative Agency in Orlando',
description: 'Digital agency PRPL delivers best-in-class experiences and innovation at the forefront of technology. Learn who we are and what we value.',
url: defragz(window.location.href),
author: '@prplrckscssrs',
photo: 'http://purplerockscissors.com/assets/images/video-posters/final-hero-about.jpg'
};
// PULL EMPLOYEE POSTS
PRPLEmployee.all(function (res) {
// console.info('whole result', res);
// var arr = res.result;
var arr = $.map(res.result, function (value, key) {
return value;
});
arr = shuffleArray(arr);
// console.info('team array', arr);
var gridArr = [];
if (arr.length > 0) {
var tmp = [];
for (var i = 0; i < arr.length; i++) {
var obj = {};
obj.show = (exists(arr[i]['wpcf-is-employee']) && arr[i]['wpcf-is-employee'] != '0') ? true : false;
if (obj.show !== false) {
obj.fName = (exists(arr[i]['first_name'])) ? arr[i]['first_name'][0] : false;
obj.lName = (exists(arr[i]['last_name'])) ? arr[i]['last_name'][0] : false;
obj.title = (exists(arr[i]['wpcf-job-title'])) ? arr[i]['wpcf-job-title'][0] : false;
obj.gifn = (exists(arr[i]['wpcf-gifn'])) ? arr[i]['wpcf-gifn'][0] : false;
obj.gifn = (exists(arr[i]['wpcf-gifn'])) ? arr[i]['wpcf-gifn'][0] : false;
obj.gifnStatic = (exists(arr[i]['wpcf-gifn-colorized-single-frame'])) ? arr[i]['wpcf-gifn-colorized-single-frame'][0] : false;
obj.twitter = (exists(arr[i]['wpcf-twitter'])) ? arr[i]['wpcf-twitter'][0] : false;
obj.facebook = (exists(arr[i]['wpcf-facebook'])) ? arr[i]['wpcf-facebook'][0] : false;
obj.instagram = (exists(arr[i]['wpcf-instagram'])) ? arr[i]['wpcf-instagram'][0] : false;
obj.linkedin = (exists(arr[i]['wpcf-linkedin'])) ? arr[i]['wpcf-linkedin'][0] : false;
obj.github = (exists(arr[i]['wpcf-github'])) ? arr[i]['wpcf-github'][0] : false;
obj.dribbble = (exists(arr[i]['wpcf-dribbble'])) ? arr[i]['wpcf-dribbble'][0] : false;
tmp.push(obj);
}
};
var arr2 = [];
for (var i = 0; i < tmp.length; i++) {
arr2.push(tmp[i]);
if (i % 3 === 2) {
gridArr.push(arr2);
arr2 = [];
}
// push grouping every 3
else if (i === (tmp.length - 1)) {
gridArr.push(arr2);
}
// push partial grouping at end
};
// make available to view
$scope.gridArray = gridArr;
var didHackReset = false;
var sliderSel = '.prpl-team-slider .iosslider';
$(sliderSel).iosSlider({
snapToChildren: true,
desktopClickDrag: true,
snapSlideCenter: true,
// responsiveSlides: true,
infiniteSlider: true,
keyboardControls: true
});
PRERENDER_READY(); // utils.js
}
// makeTeamSwiper('.prpl-team .swiper-container');
setTimeout(function () {
$(sliderSel).iosSlider('update').iosSlider('goToSlide', 1);
}, 500);
$('.prpl-team-slider .fade-to-red-left a').on({
click: function (e) {
$(sliderSel).iosSlider('prevSlide');
}
});
$('.prpl-team-slider .fade-to-red-right a').on({
click: function (e) {
$(sliderSel).iosSlider('nextSlide');
}
});
// removePreloader(250);
// $scope.htmlReady();
});
}
]);
/* Global Controller
************************************************************************ */
ngPRPL.controller('AppController',
['$scope', '$location', '$cacheFactory', 'PRPLBlog', '$timeout', '$anchorScroll', 'PRPLCareers', 'PRPLEmployee', '$analytics',
function ($scope, $location, $cacheFactory, PRPLBlog, $timeout, $anchorScroll, PRPLCareers, PRPLEmployee, $analytics) {
$scope.activeMenu = false;
$scope.activeSpeechMenu = false;
$scope.seo = {
title: 'PRPL | Purple, Rock, Scissors: A Digital Creative Agency in Orlando',
description: 'Purple, Rock, Scissors, a digital creative agency in Orlando, FL, provides digital strategy consultation, innovation, and goal-driven design.',
keywords: 'digital agency, orlando agency, digital strategy agency, business intelligence services, digital agency of record, goal-driven design'
};
var loc = window.location.href;
// console.log(loc);
$scope.social = {
title: 'PRPL | Purple, Rock, Scissors: A Digital Creative Agency in Orlando',
description: 'Purple, Rock, Scissors, a digital creative agency in Orlando, FL, provides digital strategy consultation, innovation, and goal-driven design.',
url: defragz(window.location.href),
author: '@prplrckscssrs',
photo: 'http://purplerockscissors.com/assets/images/social.jpg'
};
// failback
$timeout(function() {
$('#site-loader em').addClass('show');
}, 8000);
// Globalise parze
Parse.initialize("03qVAe3sC1Gzxc6Llav7qTg2lr1X2IS1N2PaWXf7", "48fUyDNU35jSFbfombXs8tpDWc5T79S0Tt8TGpuW");
// PRPLBlog.getPosts();
// PRPLEmployee.all();
// PRPLCareers.get();
$scope.navFlag = false;
var speechEnabled = false;
if (!('webkitSpeechRecognition' in window) || !speechEnabled) {
$('.microphone').addClass('hidden');
} else {
var create_email = false;
var final_transcript = '';
var recognizing = false;
var ignore_onend;
var start_timestamp;
PRPLrecognition = new webkitSpeechRecognition();
PRPLrecognition.continuous = false;
PRPLrecognition.interimResults = true;
PRPLrecognition.onstart = function () {
recognizing = true;
// console.log('info_speak_now');
};
PRPLrecognition.onerror = function (event) {
// console.log('err');
if (event.error == 'no-speech') {
// console.log('info_no_speech');
ignore_onend = true;
}
if (event.error == 'audio-capture') {
// console.log('info_no_microphone');
ignore_onend = true;
}
if (event.error == 'not-allowed') {
if (event.timeStamp - start_timestamp < 100) {
// console.log('info_blocked');
} else {
// console.log('info_denied');
}
ignore_onend = true;
}
};
PRPLrecognition.onend = function () {
PRPLrecognition.stop();
PRPLrecognition.abort();
recognizing = false;
// console.log(final_transcript);
if (ignore_onend) {
return;
}
if (!final_transcript) {
// console.log('info_start');
return;
}
};
PRPLrecognition.onresult = function (event) {
var interim_transcript = '';
for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
final_transcript += event.results[i][0].transcript;
} else {
interim_transcript += event.results[i][0].transcript;
}
}
var nospacetranscript = interim_transcript;
var caseStudyRoutes = ['work', 'designs', 'case study', 'something cool'];
var aboutRoutes = ['about', 'who', 'labs', 'what'];
var processRoutes = ['process', 'approach', 'structure', 'charts'];
var careersRoutes = ['jobs', 'careers', 'job', 'join the team', 'hire me', 'intern', 'internship'];
var notesRoutes = ['blog', 'notes', 'thoughts'];
var contactRoutes = ['contact', 'say hi', 'email', 'hello'];
var badRoutes = ['*', 'fuck', 'shit', 'cock', 'ass', 'fucker', 'fucking', 'motherfucker'];
caseStudyRoutes.forEach(function (caseStudyRoute) {
if (nospacetranscript.indexOf(caseStudyRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(2).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
aboutRoutes.forEach(function (aboutRoute) {
if (nospacetranscript.indexOf(aboutRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(0).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
processRoutes.forEach(function (processRoute) {
if (nospacetranscript.indexOf(processRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(1).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
careersRoutes.forEach(function (careersRoute) {
if (nospacetranscript.indexOf(careersRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(3).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
notesRoutes.forEach(function (notesRoute) {
if (nospacetranscript.indexOf(notesRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(4).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
processRoutes.forEach(function (processRoute) {
if (nospacetranscript.indexOf(processRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(1).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
contactRoutes.forEach(function (contactRoute) {
if (nospacetranscript.indexOf(contactRoute) != - 1 && foundMatch == false) {
$('.the-links a').eq(5).click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
badRoutes.forEach(function (badRoute) {
if (nospacetranscript.indexOf(badRoute) != - 1 && foundMatch == false) {
$('html').addClass('konami');
$('a.hamburger').click();
PRPLrecognition.stop();
recognizing = false;
foundMatch = true;
return false;
}
})
final_transcript = capitalize(final_transcript);
// final_span.innerHTML = linebreak(final_transcript);
// interim_span.innerHTML = linebreak(interim_transcript);
// console.log(interim_transcript);
};
var two_line = /\n\n/g;
var one_line = /\n/g;
function linebreak(s) {
return s.replace(two_line, '<p></p>').replace(one_line, '<br>');
}
var first_char = /\S/;
function capitalize(s) {
return s.replace(first_char, function (m) {
return m.toUpperCase();
});
}
}
$scope.voiceMenu = function ($timeout) {
// console.log('click');
// console.log(recognizing);
// console.log(PRPLrecognition);
if (recognizing) {
PRPLrecognition.abort();
// return;
}
final_transcript = '';
foundMatch = false;
// PRPLrecognition.abort();
$timeout(function() {
PRPLrecognition.start();
}, 500)
ignore_onend = false;
start_timestamp = event.timeStamp;
};
$scope.pagepush = function(dest) {
// console.log(dest);
var doTrans = true;
if ($(window).width() > 770) {
var aboutProcess = {
paddingTop: 290,
height: 667
}
var work = {
paddingTop: 290,
height: 607
}
var careers = {
paddingTop: 290,
height: 672
}
var notes = {
paddingTop: 290,
height: 672
}
var transHeight = 0;
var transPadding = 0;
} else {
var aboutProcess = {
paddingTop: 125,
height: 428
}
var work = {
paddingTop: 125,
height: 428
}
var careers = {
paddingTop: 125,
height: 428
}
var notes = {
paddingTop: 125,
height: 428
}
var transHeight = 0;
var transPadding = 0;
}
switch (dest) {
case 'about':
case 'process':
// default:
transHeight = aboutProcess.height;
transPadding = aboutProcess.paddingTop;
break;
case 'work':
transHeight = work.height;
transPadding = work.paddingTop;
break;
case 'careers':
transHeight = careers.height;
transPadding = careers.paddingTop;
break;
case 'notes':
transHeight = notes.height;
transPadding = notes.paddingTop;
break;
default:
// console.warn('destination not programmed, falling back');
doTrans = false;
break;
}
if (!doTrans) {
$location.path(dest);
return false;
}
var speed = 500;
var windowHeight = $(window).height();
var windowWidth = $(window).width();
// console.log(windowHeight, transHeight, transPadding);
$('#footerTeaser').addClass('push-now').velocity({
paddingBottom: windowHeight - transHeight
}, speed);
$('#footerTeaser a').velocity({
paddingTop: transPadding,
height: transHeight
}, speed)
$('.page').css({
marginBottom: windowHeight
});
$('.page').velocity({
translateY: - (windowHeight - transPadding + 11)
}, speed);
// $("html, body").animate({ scrollTop: $(document).height()-$(window).height() }, speed);
$('.points-of-interest').removeClass('intro');
$timeout(function() {
$location.path(dest);
// $timemout(function(){$anchorScroll();}, 500)
}, speed + 50);
};
$timeout(function () {
centerFixedPRPLNav('#site-header');
}, 300);
$(window).on({
resize: function (e) {
centerFixedPRPLNav('#site-header');
}
});
$timeout(function () {
$(window).resize();
}, 2000);
// $('body').addClass('viewloading').removeClass('loaded');
}
]);
/* Blog Post List Controller
************************************************************************ */
//
ngPRPL.controller('BlogListController',
['$scope', '$sanitize', '$resource', '$location', '$routeParams', 'PRPLPosts', 'PRPLBlog',
function ($scope, $sanitize, $resource, $location, $routeParams, PRPLPosts, PRPLBlog) {
/////////////
// init(apiData), init is triggered in PRPLBlog callbacks
////////////
// param handling
// if category is specified in url go that route
if (exists($routeParams.cat)) {
// check see if the category is valid then request those posts
var isValid = checkValidCategory($routeParams.cat);
if (isValid) {
$scope.blogFilter = $routeParams.cat;
PRPLBlog.getGroup($routeParams.cat, function (result) {
$.scrollTo('.hero .secondary-nav', 400, {
'easing': 'easeInOutExpo',
'offset': - 50
});
init(result);
});
if ($routeParams.cat === 'projects') {
seo({
'title': 'Projects | Notes | Purple, Rock, Scissors',
'description': 'Follow project updates, website launches, and campaigns from digital creative agency Purple, Rock, Scissors',
'keywords': ''
});
activeSecondaryNav('.secondary-nav [data-cat-group="projects"]');
} else if ($routeParams.cat === 'savvy') {
seo({
'title': 'Savvy | Notes | Purple, Rock, Scissors',
'description': 'Digital creative agency Purple, Rock, Scissors dives into industry news and shares expertise.',
'keywords': ''
});
activeSecondaryNav('.secondary-nav [data-cat-group="savvy"]');
} else if ($routeParams.cat === 'culture') {
seo({
'title': 'Culture | Notes | Purple, Rock, Scissors',
'description': "Follow updates on PRPL's digital agency culture, announcements, and digital industry events.",
'keywords': ''
});
activeSecondaryNav('.secondary-nav [data-cat-group="culture"]');
}
// invalid categories can f off to /404... or /notes?
} else {
$location.path('/notes');
}
} else {
// load all if no category filter is specified
$scope.blogFilter = 'all';
PRPLBlog.getPosts(function (result) {
init(result);
});
seo({});
}
function init(apiData) {
$scope.currentPage = 1;
$scope.totalPosts = apiData.count; //continues counting when paginating (see: loadPageData())
$scope.blogPosts = apiData.posts;
$scope.totalPages = apiData.pages || 1;
// console.info(apiData);
createInfiniteScroll();
// removePreloader(250);
setLoadingPosts(false);
PRERENDER_READY();
}
function activeSecondaryNav(sel) {
$(sel).parent().find('a').removeClass('active');
$(sel).addClass('active');
}
/////////////
// Functions
////////////
function createInfiniteScroll() {
$(window).on({
scroll: function (e) {
var pageHeight = $(document).height();
var scrollPos = e.currentTarget.scrollY + $(window).height();
var predictiveOffset = 300;
var threshold = pageHeight - predictiveOffset;
if (scrollPos >= threshold && $('#pageNotes').length > 0) {
// manage triggering other evt as it makes API call, reset this in the api callback
if (getLoadingPosts() === false) {
setLoadingPosts(true);
$(window).trigger('PRPL_INFINITE_SCROLL');
}
}
}
});
$(window).off('PRPL_INFINITE_SCROLL').on({
'PRPL_INFINITE_SCROLL': function (e, data) {
$scope.currentPage++;
// console.info('next, total', $scope.currentPage, $scope.totalPages);
if ($scope.currentPage > $scope.totalPages) {
removeInfiniteScroll();
} else {
loadPageData($scope.currentPage);
}
}
});
}
function removeInfiniteScroll() {
$(window).off('scroll PRPL_INFINITE_SCROLL');
// console.log('thats all folks!, show everything loaded graphic or message');
}
// $scope.loadingPosts (bool)
function getLoadingPosts() {
return $scope.loadingPosts;
}
function setLoadingPosts(bool) {
if (!exists(bool)) {
return false;
}
if (bool === true) {
$scope.loadingPosts = true;
} else if (bool === false) {
$scope.loadingPosts = false;
}
}
function loadPageData(num) {
var filter = $scope.blogFilter; // all, projects, savvy, culture etc.
PRPLBlog.nextPage(filter, num, function (result) {
// console.info('API CALLBACK', result);
$scope.blogPosts = $scope.blogPosts.concat(result.posts);
$scope.totalPosts = $scope.totalPosts + result.count;
// add these 10 posts to the array not replace******
setLoadingPosts(false);
});
}
function checkValidCategory(slug) {
var groups = ['projects', 'savvy', 'culture'];
var found = false;
for (var i = groups.length - 1; i >= 0; i--) {
if (slug === groups[i]) {
found = true;
}
};
return found;
}
function seo(obj) {
var flagText, pageTitle, pageDescription, pageKeywords;
if (exists(obj)) {
// flagText = (exists(obj.flag)) ? obj.flag : 'Notes | Purple Rock Scissors';
pageTitle = (exists(obj.title)) ? obj.title : 'Notes | Purple Rock Scissors';
pageDescription = (exists(obj.description)) ? obj.description : "Follow PRPL's digital agency culture and expertise, with updates on digital industry news, awards, and more.";
pageKeywords = (exists(obj.keywords)) ? obj.keywords : '';
}
$scope.$parent.seo = {
title: pageTitle,
description: pageDescription,
keywords: pageKeywords
};
$scope.$parent.social = {
title: pageTitle,
description: pageDescription,
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
}
}
]);
/* Single Blog Post Controller
************************************************************************ */
//
ngPRPL.controller('BlogPostController',
['$scope', '$sanitize', '$routeParams', '$resource', '$location', 'PRPLAuthor', 'PRPLPost', 'PRPLBlog', '$sce',
function ($scope, $sanitize, $routeParams, $resource, $location, PRPLAuthor, PRPLPost, PRPLBlog, $sce) {
$scope.disqusReady = false;
PRPLBlog.getPost($routeParams.id, function(result) {
if (result.status === 'error') {
$location.path('/404');
return false;
}
// SEO
var seoTitle = (exists( result.post.meta.seo.title ) && result.post.meta.seo.title !== "") ? result.post.meta.seo.title : 'PRPL Blog';
var seoDescription = (exists( result.post.meta.seo.description ) && result.post.meta.seo.description !== "") ? $(result.post.meta.seo.description).text() : 'Purple Rock Scissors / A Digital Creative Agency';
var seoKeywords = (exists( result.post.meta.seo.keywords ) && result.post.meta.seo.keywords !== "") ? $(result.post.meta.seo.keywords).text() : 'Purple Rock Scissors, Design, Development';
//---------- Work in progress -------------
var seoOriginal = (exists( result.post.meta.seo.original ) && result.post.meta.seo.original !== "") ? result.post.meta.seo.original : 'https://medium.com/purple-rock-scissors';
var seoSyndication = (exists( result.post.meta.seo.syndication ) && result.post.meta.seo.syndication !== "") ? result.post.meta.seo.syndication : 'https://medium.com/purple-rock-scissors';
$scope.$parent.seo = {
description: seoDescription,
keywords: seoKeywords,
title: seoTitle,
original: seoOriginal,
syndication: seoSyndication
};
// THE POST
$scope.thePost = result.post;
// console.info($scope.thePost);
buildHeroHTML($scope.thePost.heroMedia);
$scope.postContent = $sce.trustAsHtml(result.post.contentHTML);
$scope.photoGridContent = $sce.trustAsHtml(result.post.photoGridHTML);
// THE AUTHOR
var authorPhoto = (exists(result.post.author.photo) && result.post.author.photo !== null) ? result.post.author.photo : '/assets/images/prpl-badge.jpg';
var authorLink = (exists(result.post.author.link) && result.post.author.link !== null) ? result.post.author.link : 'http://twitter.com/prplrckscssrs';
var authorFName = (exists(result.post.author.first) && result.post.author.first !== "") ? result.post.author.first : 'PRPL';
var authorLName = (exists(result.post.author.last) && result.post.author.last !== "") ? result.post.author.last : '';
var authorNickname = (exists(result.post.author.nickname) && result.post.author.nickname !== "") ? result.post.author.nickname : 'PRPL';
$scope.authorName = authorFName + ' ' + authorLName;
$scope.authorGIFNStatic = authorPhoto;
$scope.authorURL = authorLink;
// THE FOOTER TEASER
var footerImg = (exists(result.post.previous.hero)) ? result.post.previous.hero : false;
var footerTitle = (exists(result.post.previous.title)) ? result.post.previous.title : false;
var footerURL = '/notes/' + result.post.previous.id + '/' + result.post.previous.sanitized;
$scope.thePrevPost = {
'img': footerImg,
'title': footerTitle,
'url': footerURL
};
// INIT PHOTO GRID
$(window).on({
load: function(e) {
$('.PhotoCollage').removeWhitespace().collagePlus().css('opacity', 1);
$(window).on({
resize: function(e) {
$('.PhotoCollage').removeWhitespace().css('opacity', 0).collagePlus().css('opacity', 1);
}
});
}
});
// SOCIAL
var socialTitle = seoTitle;
var socialDescription = seoDescription;
var socialKeywords = seoKeywords;
$scope.$parent.social = {
title: socialTitle,
description: socialDescription,
url: defragz(window.location.href),
author: authorNickname,
photo: result.post.heroURL
};
addSocialShares();
// remove loader
// removePreloader(250);
$scope.disqusReady = true;
PRERENDER_READY();
// $scope.$apply();
console.info('THAT RESULT THO', result);
});
function addSocialShares() {
// console.info('adding socialz', $scope.social);
$('.inner-author-share .share-link').on({
click: function (e) {
$(e.currentTarget).closest('.author-share').addClass('is-sharing');
}
});
$('.author-share .share-close').on({
click: function (e) {
$(e.currentTarget).closest('.author-share').removeClass('is-sharing');
}
});
$(".share-area .auto-copy-clipboard").on({
click: function (e) {
$(this).select();
}
});
}
function buildHeroHTML(heroObj) {
// console.info(heroObj);
var isVideo = false;
var hasFallback = false;
if (heroObj.vimtube !== '' || heroObj.html5 !== '') {
isVideo = true;
}
if (heroObj.image !== '') {
hasFallback = true;
}
// console.info('isVideo:', isVideo, 'hasFallback:', hasFallback);
// if(!hasFallback){ console.warn('No fallback found set to default?', hasFallback); }
if (isVideo) {
var isVimtube = (heroObj.vimtube !== '') ? heroObj.vimtube : false;
var isHTML5 = (heroObj.html5 !== '') ? heroObj.html5 : false;
// console.log(isVimtube, isHTML5);
if (isHTML5) {
if ($('html').hasClass('touch')) {
buildFallbackHTML(heroObj.image);
} else {
buildHTML5HTML(isHTML5);
}
} else if (isVimtube) {
if (isVimtube.indexOf('vimeo.com') > - 1) {
buildVimeoHTML(isVimtube);
} else if (isVimtube.indexOf('youtube.com') > - 1) {
buildYoutubeHTML(isVimtube);
} else {
buildFallbackHTML(heroObj.image);
}
} else {
buildFallbackHTML(heroObj.image);
}
} else {
// console.log('isnt video, use image hero');
buildFallbackHTML(heroObj.image);
}
}
function buildVimeoHTML(url) {
var el = '';
var arr = url.split('vimeo.com/');
var vimeo_id = arr[arr.length - 1];
// console.info(vimeo_id);
el += '<iframe src="//player.vimeo.com/video/' + vimeo_id + '?title=0&amp;byline=0&amp;portrait=0&amp;color=f26f70" width="800" height="450" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
$('#pageNote .the-note .the-hero').html(el);
}
function buildYoutubeHTML(url) {
var el = '';
var arr = url.split('youtube.com/watch?v=');
var yt_id = arr[arr.length - 1];
el += '<iframe width="800" height="450" src="//www.youtube.com/embed/' + yt_id + '" frameborder="0" allowfullscreen></iframe>';
$('#pageNote .the-note .the-hero').html(el);
}
function buildHTML5HTML(url) {
var el = '';
el += '<video class="note-hero-h5v" id="bgvNoteHero" preload="metadata" loop="true" muted="true" autoplay="true">';
el += '<source src="' + url + '.webmhd.webm" type="video/webm">';
el += '<source src="' + url + '.mp4" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;">';
el += '</video>';
$('#pageNote .the-note .the-hero').html(el);
}
function buildFallbackHTML(url) {
var el = '';
el = "<img src=" + $scope.thePost.heroURL + " alt=" + $scope.thePost.title + " />";
$('#pageNote .the-note .the-hero').html(el);
}
}
]);
/* Careers Controller
************************************************************************ */
//
ngPRPL.controller('CareersController',
[ '$scope', '$sanitize', '$resource', '$location', '$routeParams', 'PRPLCareers', '$analytics',
function ($scope, $sanitize, $resource, $location, $routeParams, PRPLCareers, $analytics) {
$scope.formDebug = false;
// $scope.activeDepartment = false;
// $scope.formState = 'default';
$scope.formValid = false;
$scope.formComplete = false;
var _form = {};
var _dataAPI = false;
var _dataJob = false;
var _activeDeptSlug = false;
var _activeDeptIndex = false;
// var submissionRef = new Firebase("https://prpl-careers.firebaseio.com/submissions");
// var _formSubs = $firebase(submissionRef);
var stageOne = {
// Variables (w/ getters & setters)
_complete: false,
getComplete: function() {
return stageOne._complete;
},
setComplete: function(val) {
stageOne._complete = val;
},
_active: false,
getActive: function() {
return stageOne._active;
},
setActive: function(val) {
stageOne._active = val;
},
_depts: false,
getDepartments: function() {
return stageOne._depts;
},
setDepartments: function(val) {
stageOne._depts = val;
},
init : function(leggo) {
// Some sort of sanitization
if (leggo.length < 1) {
// console.error('we got an API-shaped problem');
return false;
}
// Leg'go
var allDepts = leggo
var deptsHiring = stageOne.filterHiring(allDepts);
stageOne.setDepartments(deptsHiring);
// console.info($routeParams);
if (exists($routeParams.job)) {
if (exists($routeParams.slug) && $routeParams.slug === 'thanks-for-applying') {
utils.showThankYouMessage();
// path dependednt scope html ready (thankyou message)
// $scope.htmlReady();
} else {
stageOne.preSelectedJob($routeParams.job);
}
} else {
utils.seo('page-defaults');
// path dependednt scope html ready (default)
// $scope.htmlReady();
}
stageOne.listDepartments();
// Now HTML is added enable the goal of stage one
stageOne.addListEvents();
stageOne.setActive(true);
PRERENDER_READY(); // utils.js
},
reset : function() {
stageOne.setComplete(false);
stageOne.setActive(false);
},
// Methods
addListEvents : function() {
$('.form-options .massive-li').off('click').on({
click : function(e) {
var selectedDepartment = stageOne.nextStage($(e.currentTarget).text());
if (selectedDepartment !== false) {
stageOne.setComplete(true);
stageTwo.init(selectedDepartment);
$analytics.eventTrack( selectedDepartment.name, {
category: 'Careers CTA',
label: 'Selected Department'
});
}
}
});
},
filterHiring : function(data) {
// Filter by departments that are hiring
var depts = [];
for (var i = 0; i < data.length; i++) {
if (data[i].hiring !== false) {
depts.push(data[i]);
}
};
return (depts);
},
htmlListEntry: function(entry) {
// Make some massive LI's
var el = '';
el += '<li class="massive-li">';
el += '<a href="javascript:;" data-slug="' + entry.name + '">' + entry.name + '</a>';
el += '</li>';
return el;
},
listDepartments: function() {
var data = stageOne.getDepartments();
var el = '';
for (var i = 0; i < data.length; i++) {
el += stageOne.htmlListEntry(data[i]);
};
$('.form-options.massive-ul').html(el);
return el;
},
nextStage : function(cat) {
var depts = stageOne.getDepartments();
var found = false;
for (var i = depts.length - 1; i >= 0; i--) {
if (depts[i].name === cat) {
found = depts[i];
}
};
return found;
},
preSelectedJob : function(jobSlug) {
// console.info(jobSlug);
var data = stageOne.getDepartments();
var found = false;
for (var i = 0; i < data.length; i++) {
var jobz = data[i].jobs;
for (var j = 0; j < jobz.length; j++) {
var sluggish = slugify(jobz[j]['post_title']);
if (jobSlug === sluggish) {
found = data[i];
found.preselect = jobSlug;
// console.info(jobSlug, sluggish, data[i]);
}
}
};
if (found !== false) {
stageTwo.init(found);
}
}
};
// console.log(stageOne);
var stageTwo = {
// Variables, getters/setters
_complete: false,
getComplete: function() {
return stageTwo._complete;
},
setComplete: function(val) {
stageTwo._complete = val;
},
_active: false,
getActive: function() {
return stageTwo._active;
},
setActive: function(val) {
stageTwo._active = val;
},
_dept: false,
getDepartment: function() {
return stageTwo._dept;
},
setDepartment: function(val) {
stageTwo._dept = val;
},
_jobs: false,
getJobs: function() {
return stageTwo._jobs;
},
setJobs: function(val) {
stageTwo._jobs = val;
},
_job: false,
getJob: function() {
return stageTwo._job;
},
setJob: function(val) {
stageTwo._job = val;
},
init: function(deptObj) {
stageTwo.setDepartment(deptObj);
stageTwo.setJobs(deptObj.jobs);
stageTwo.hideDepartmentList();
stageTwo.addFormFocusedToPage();
stageTwo.addDescriptions();
stageTwo.addTitleTabEvents();
if (exists(deptObj.preselect)) {
stageTwo.showSpecificDescription(deptObj.preselect);
// path dependednt scope html ready (pre selected job)
// $scope.htmlReady();
} else {
stageTwo.showFirstDescriptionByDefault();
}
// stageTwo.addApplyNowEvents();
utils.addCloseButton();
utils.addDepartmentNav();
},
// Methods
addApplyNowEvents : function() {
$('.form-area-careers .apply-bar .btn-form-submission').off('click').on({
click: function(e) {
stageTwo.nextStage();
}
});
},
addDescriptions : function() {
var dept = stageTwo.getDepartment();
// HTML NEEDS
// - Department name
var HTMLTitle = stageTwo.titleHTML(dept);
// - Tagline
var HTMLTagline = stageTwo.taglineHTML(dept);
// - H3/A Job Titles
var HTMLJobTabs = stageTwo.jobTabsHTML(dept.jobs);
// - Job Descriptions (for each)
var HTMLJobDescriptions = stageTwo.jobDescriptionsHTML(dept.jobs);
// - Responsibilities Area
// - Sidebar Area
// - Qualifications
// - Bonus Points
// console.info(HTMLTitle, HTMLTagline, HTMLJobTabs, HTMLJobDescriptions);
$('.form-area-careers .detail-buttons .department-name').html(dept.name);
$('.form-area-careers .single-description .title-tabs').html(HTMLTagline + HTMLJobTabs);
$('.form-area-careers .job-details .job-descriptions').html(HTMLJobDescriptions);
$('.form-area-careers .detail-buttons').show();
$('.form-area-careers .job-details').show();
},
addFormFocusedToPage : function() {
$('.page-careers').addClass('form-area-focused');
},
addTitleTabEvents : function() {
$('.form-area-careers .single-description .title-tabs a').on({
click: function(e) {
var data = $(e.currentTarget).data();
var dIndex = data.descriptionIndex;
var sanitized = data.urlSlug;
var jobj = stageTwo.getJobjectBySlug(sanitized);
stageTwo.setButtonURL(jobj.fields["bamboo-link"]);
stageTwo.setJob(jobj);
utils.seo(sanitized);
$('.form-area-careers .title-tabs [data-description-index]').removeClass('active');
$('.form-area-careers .single-description [data-tab-index]').removeClass('active');
$('.form-area-careers .title-tabs [data-description-index="' + dIndex + '"]').addClass('active');
$('.form-area-careers .single-description [data-tab-index="' + dIndex + '"]').addClass('active');
stageTwo.updateURL(sanitized);
}
})
},
getJobjectBySlug: function(mollusk) {
var jobs = stageTwo.getJobs();
var job = false;
for (var i = jobs.length - 1; i >= 0; i--) {
var sluggish = slugify(jobs[i]['post_title']);
if (sluggish === mollusk) {
job = jobs[i];
}
};
return job;
},
hideDepartmentList : function() {
$('.form-area-careers .massive-ul').hide();
},
jobDescriptionsHTML : function(jobs) {
var el = '';
for (var i = 0; i < jobs.length; i++) {
el += '<div class="job-description" data-tab-index="' + i + '">';
el += '<div class="job-resp">';
el += '<div>' + jobs[i].fields.responsibilties + '</div>';
el += '</div>';
el += '<div class="sidebar">';
el += '<aside class="job-qualifications">';
el += '<h4>Qualifications</h4>';
el += '<div>' + jobs[i].fields.qualifications + '</div>';
el += '</aside>';
el += '<aside class="job-bonus-points">';
el += '<h4>Bonus Points</h4>';
el += '<div>' + jobs[i].fields['bonus-points'] + '</div>';
el += '</aside>';
el += '</div>';
el += '</div>';
};
return el;
},
jobSlugToIndex: function(nomme) {
var bangbang = false;
var jobs = stageTwo.getJobs();
for (var i = 0; i < jobs.length; i++) {
var gEazy = slugify(jobs[i]['post_title']);
if (nomme === gEazy) {
bangbang = i;
}
}
return bangbang;
},
jobTabsHTML : function(jobs) {
var el = '';
for (var i = 0; i < jobs.length; i++) {
var purel = slugify(jobs[i]['post_title']);
el += '<h3 class="job-title">';
el += '<a href="javascript:;" data-url-slug="' + purel + '" data-description-index="' + i + '">' + jobs[i]['post_title'] + '</a>';
el += '</h3>';
};
return el;
},
nextStage : function() {
var jobj = stageTwo.getJob();
//console.info('next job › ', jobj);
stageTwo.unload();
stageThree.init(jobj);
},
showSpecificDescription : function(jobSlug) {
var LILDURK = stageTwo.jobSlugToIndex(jobSlug);
$('.form-area-careers .title-tabs [data-description-index="' + LILDURK + '"]').addClass('active');
$('.form-area-careers .single-description [data-tab-index="' + LILDURK + '"]').addClass('active');
$.scrollTo('h1.department-name', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
utils.seo(jobSlug);
var jobj = stageTwo.getJobjectBySlug(jobSlug);
stageTwo.setButtonURL(jobj.fields["bamboo-link"]);
stageTwo.setJob(jobj);
},
showFirstDescriptionByDefault : function() {
var sluggish = $('.form-area-careers .title-tabs [data-description-index="0"]').data().urlSlug;
stageTwo.updateURL(sluggish);
var jobj = stageTwo.getJobjectBySlug(sluggish);
stageTwo.setButtonURL(jobj.fields["bamboo-link"]);
stageTwo.setJob(jobj);
$('.form-area-careers .title-tabs [data-description-index="0"]').click();
// $('.form-area-careers .title-tabs [data-description-index="0"]').addClass('active');
// $('.form-area-careers .single-description [data-tab-index="0"]').addClass('active');
$.scrollTo('h1.department-name', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
// utils.seo(sluggish);
},
setButtonURL : function(url) {
url = url || "https://prpl.bamboohr.com/jobs/";
$('.form-area-careers .apply-bar .btn-form-submission').attr('href', url);
},
taglineHTML : function(dept) {
var el = '<h2 class="tagline">' + dept.tagline + '</h2>';
return el;
},
titleHTML : function(dept) {
var el = '<h1 class="department-name">' + dept.name + '</h1>';
return el;
},
updateURL: function(str) {
$location.search('job', str);
$scope.$apply();
},
unload: function() {
$('.job-details').hide();
},
validateURL : function(params) {
// console.info(params);
}
};
// console.log(stageTwo);
var stageThree = {
// Variables (w/ getters & irish setters)
_complete: false,
getComplete: function() {
return stageThree._complete;
},
setComplete: function(val) {
stageThree._complete = val;
},
_active: false,
getActive: function() {
return stageThree._active;
},
setActive: function(val) {
stageThree._active = val;
},
_dept: false,
getDepartment: function() {
return stageThree._dept;
},
setDepartment: function(val) {
stageThree._dept = val;
},
_job: false,
getJob: function() {
return stageThree._job;
},
setJob: function(val) {
stageThree._job = val;
},
_valid: false,
getValid: function() {
return stageThree._valid;
},
setValid: function(val) {
stageThree._valid = val;
},
init : function(jobject) {
stageThree.setJob(jobject);
stageThree.showForm();
stageThree.addSubmitEvents();
stageThree.addBackButton();
utils.linkedInButton(jobject);
$scope.theJobName = jobject['post_title'];
},
// Methods
addBackButton : function() {
$('.form-area-careers .back-to-description').off('click').on({
click: function(e) {
stageThree.backToStageTwo();
}
})
},
addSubmitEvents: function() {
$('form[name="jobForm"]').off('submit').on({
submit: function (e) {
if ($(e.currentTarget).hasClass('ng-valid')) {
// var passesHoneyPotValidation = $('.verifyName', emailForm).val();
// passesHoneyPotValidation = (passesHoneyPotValidation.length === 0) ? true : false;
// console.info(passesHoneyPotValidation);
if (true) {
// FPO Honeypot Validation
// var postUrl = '/cm-message-form.php';
// var cmListID = '630fe8f9871cf8412a9de87c682792d6';
// var recipient = '[email protected]';
// var subject = 'Job Application: ' + $scope.theJobName;
// var postData = $(e.currentTarget).serialize();
// var siteReferrer = $('#prplSiteReferrer').val();
// postData += '&cmid=' + cmListID + '&recipient=' + recipient + '&subject=' + subject + '&hidden_link_referrer=' + siteReferrer;
// utils.addDataToFirebase($scope.theJobName);
// // console.warn(postData);
// $.ajax({
// type: 'POST',
// url: postUrl,
// data: postData,
// success: function (msg) {
// // console.info(msg);
// var nurl = '/careers/thanks-for-applying?job=' + utils.getJobNameParam() + '&type=default';
// $location.url(nurl);
// $scope.$apply();
// },
// error: function (msg) {
// // console.info(msg);
// }
// });
tmp = {};
tmp.job = $scope.theJobName,
tmp.name = $('.form-area-careers form [name="name"]').val();
tmp.email = $('.form-area-careers form [name="email"]').val();
tmp.phone = $('.form-area-careers form [name="phone"]').val();
tmp.portfolio = $('.form-area-careers form [name="portfolio"]').val();
tmp.twitter = $('.form-area-careers form [name="twitter"]').val();
tmp.music = $('.form-area-careers form [name="music"]').val();
tmp.linkedin = $('.form-area-careers form [name="application_linkedin"]').val();
tmp.video = $('.form-area-careers form [name="application_video"]').val();
tmp.message = $('.form-area-careers form [name="application_message"]').val();
tmp.music = $('.form-area-careers form [name="music"]').val();
tmp.referrer = $('#prplSiteReferrer').val();
var ParseClass = Parse.Object.extend("CareerSubmission");
var parseClass = new ParseClass();
parseClass.save( tmp , {
success: function(object) {
// console.info('dongs', object);
var nurl = '/careers/thanks-for-applying?job=' + utils.getJobNameParam() + '&type=default';
$location.url(nurl);
$scope.$apply();
},
error: function(model, error) {
console.error(model, error);
}
});
} else {
return false;
}
} else {
// console.warn('form contains errors!');
stageThree.showFormErrors();
}
return false;
}
});
},
backToStageTwo: function() {
$('.form-area-careers .the-form').hide();
$('.job-details').show();
$.scrollTo('h1.department-name', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
},
showForm: function() {
$('.form-area-careers .the-form').show();
$.scrollTo('h1.department-name', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
},
showFormErrors: function() {
$('.form-area-careers .the-form .ng-invalid').addClass('form-errors');
},
validateURL : function(params) {
// console.info(params);
}
};
// console.log(stageThree);
var utils = {
reset: function() {
$location.url($location.path());
$location.path('/careers');
utils.seo('page-defaults');
$('.page-careers').removeClass('form-area-focused');
$('.form-area-careers .detail-buttons').hide();
$('.form-area-careers .job-details').hide();
$('.form-area-careers .the-form').hide();
$('.form-area-careers .massive-ul').show();
$scope.$apply();
},
addCloseButton : function() {
$('.form-area-careers .detail-buttons .btn-close').off('click').on({
click: function(e) {
utils.reset();
}
});
},
addDepartmentNav : function() {
$('.form-area-careers .detail-buttons .btn-prev').off('click').on({
click: function(e) {
utils.previousDepartment();
}
});
$('.form-area-careers .detail-buttons .btn-next').off('click').on({
click: function(e) {
utils.nextDepartment();
}
});
},
linkedInButton : function(jobData) {
// console.info(jobData);
// <script src="//platform.linkedin.com/in.js" type="text/javascript">api_key: 77s2y2wb75hodu</script>
// <script type="IN/Apply" data-companyid="215915" data-jobtitle="Architect" data-joblocation="Orlando, FL" data-themecolor="#f26f70" data-phone="required" data-email="[email protected]" data-showtext='false'></script>
//$('.linked-btn').html('');
//var el = '<script class="theLinkedScriptButton" type="IN/Apply" data-companyid="215915" data-jobtitle="' + jobData['post_title'] + '" data-joblocation="Orlando, FL" data-themecolor="#f26f70" data-phone="required" data-email="[email protected]" data-showtext="false" data-size="medium"></script><script src="//platform.linkedin.com/in.js" type="text/javascript">api_key: 77s2y2wb75hodu</script>';
//$('.linked-btn').html(el);
var script = $('<script>')
// add attributes
.attr('type', 'IN/Apply') // make it an Apply with LinkedIn button
.attr('data-jobTitle', jobData['post_title'])
.attr('data-companyid', '215915')
.attr('data-email', '[email protected]')
// .attr('data-joblocation', 'Orlando, FL')
.attr('data-phone', 'required')
.attr('data-showtext', 'false')
.attr('data-size', 'medium')
.attr('data-onsuccess', 'linkedInApplySuccessCallback')
.attr('data-coverLetter', 'required')
.attr('data-themecolor', '#f26f70');
$('#linkedInTop').html(script);
// check if IN.parse exists, if so, call it
if (IN.parse) {
IN.parse();
}
// otherwise, we will register it to fire on the systemReady event
// this is just precaution, but can avoid a special race condition
else {
IN.Event.on(IN, "systemReady", IN.parse);
}
$(window).off("LINKEDIN_APPLY_SUCCESS").one({
LINKEDIN_APPLY_SUCCESS: function(e, data) {
if (data.event === 'success') {
// alert(utils.getJobNameParam());
var nurl = '/careers/thanks-for-applying?job=' + utils.getJobNameParam() + '&type=linkedin';
$location.url(nurl);
$scope.$apply();
}
}
});
},
nextDepartment: function() {
// console.info('next department');
},
previousDepartment: function() {
// console.info('prev department');
},
seo : function(slug) {
var flagText, pageTitle, pageDescription, pageKeywords;
var obj = stageTwo.getJobjectBySlug(slug);
if (obj !== false) {
pageTitle = (exists(obj.fields['seo-title']) && obj.fields['seo-title'] !== '') ? obj.fields['seo-title'] : 'Careers | Purple, Rock, Scissors';
pageDescription = (exists(obj.fields['seo-description']) && obj.fields['seo-description'] !== '') ? obj.fields['seo-description'] : "Interested in a job at PRPL? See what careers are available in digital marketing, web design, ux design, production, and client strategy.";
pageKeywords = (exists(obj.fields['seo-keywords']) && obj.fields['seo-keywords'] !== '') ? obj.fields['seo-keywords'] : 'prpl careers, prpl jobs, digital marketing job, ux jobs, digital marketing careers, digital design jobs, digital design careers, ux design jobs';
// console.info(slug, pageTitle, pageDescription, pageKeywords);
$scope.$parent.seo = {
title: pageTitle,
description: pageDescription,
keywords: pageKeywords
};
$scope.$parent.social = {
title: pageTitle,
description: pageDescription,
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
// $scope.$apply();
} else {
$scope.$parent.seo = {
title: 'Careers | Purple, Rock, Scissors',
description: 'Interested in a job at PRPL? See what careers are available in digital marketing, web design, ux design, production, and client strategy.',
keywords: 'prpl careers, prpl jobs, digital marketing job, ux jobs, digital marketing careers, digital design jobs, digital design careers, ux design jobs'
};
$scope.$parent.social = {
title: 'Careers | Purple, Rock, Scissors',
description: 'Interested in a job at PRPL? See what careers are available in digital marketing, web design, ux design, production, and client strategy.',
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
}
},
showThankYouMessage : function() {
$('.form-area-careers .thankyou-message').show();
$.scrollTo('.form-area-careers .thankyou-message', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
if (exists($routeParams.type)) {
var submissionType = $routeParams.type;
var defaultCode = '6015206741101';
var linkedinCode = '6015206783301';
if (submissionType === 'default') {
utils.addFBPixelCode(defaultCode);
} else if (submissionType === 'linkedin') {
utils.addFBPixelCode(linkedinCode);
}
}
$('.form-area-careers .thankyou-message .little-red-header-link').off('click').on({
click: function() {
$location.url($location.path());
$location.path('/careers');
$scope.$apply();
}
})
},
getJobNameParam: function() {
// console.log($routeParams);
if (exists($routeParams.job)) {
return $routeParams.job
} else {
return false;
}
},
addFBPixelCode: function(theID) {
var el = '';
el += '<div id="fbCareersSubmissionPixel">';
el += '<script type="text/javascript">';
el += '(function() {';
el += '\nvar _fbq = window._fbq || (window._fbq = []);';
el += '\nif (!_fbq.loaded) {';
el += "\n\tvar fbds = document.createElement('script');";
el += "\n\tfbds.async = true;";
el += "\n\tfbds.src = '//connect.facebook.net/en_US/fbds.js';";
el += "\n\tvar s = document.getElementsByTagName('script')[0];";
el += "\n\ts.parentNode.insertBefore(fbds, s);";
el += "\n\t_fbq.loaded = true;";
el += "\n}";
el += "\n})();";
el += "\nwindow._fbq = window._fbq || [];";
el += "\nwindow._fbq.push(['track', " + theID + ", {'value':'0.00','currency':'USD'}]);";
el += "</script>";
el += '<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=' + theID + '&amp;cd[value]=0&amp;cd[currency]=USD&amp;noscript=1" /></noscript>';
el += "</div>";
if ($('#fbCareersSubmissionPixel').length > 0) {
$('#fbCareersSubmissionPixel').remove();
}
$('body').append(el);
// console.log('add fb code', theID, el, $('#fbCareersSubmissionPixel'));
},
addDataToFirebase: function(jobSlug) {
// _formSubs.$add({
// 'job': jobSlug,
// 'name': $('.form-area-careers form [name="name"]').val(),
// 'email': $('.form-area-careers form [name="email"]').val(),
// 'phone': $('.form-area-careers form [name="phone"]').val(),
// 'porftolio': $('.form-area-careers form [name="porftolio"]').val(),
// 'twitter': $('.form-area-careers form [name="twitter"]').val(),
// 'music': $('.form-area-careers form [name="music"]').val(),
// 'application_linkedin': $('.form-area-careers form [name="application_linkedin"]').val(),
// 'application_video': $('.form-area-careers form [name="application_video"]').val(),
// 'application_message': $('.form-area-careers form [name="application_message"]').val(),
// 'music': $('.form-area-careers form [name="music"]').val(),
// 'referrer': $('#prplSiteReferrer').val()
// });
console.log('discontinued')
}
};
// GET DATA AND HANDLE PARAMS
PRPLCareers.get(function (res) {
// console.info('API Result:', res);
$scope.careersData = res.result;
_dataAPI = $.map(res.result, function (value, key) {
return value;
});
$scope.linkedinJobTitle = 'FPO';
$scope.theJobName = 'unknown';
// var deptsHiring = stageOne.filterHiring(_dataAPI);
// stageOne.listDepartments(deptsHiring);
stageOne.init(_dataAPI);
// Param Handling
if (exists($routeParams.slug)) {
// $scope.activeDepartment = strSanitize($routeParams.slug);
// var res = getJobData($routeParams.slug);
// $scope.activeData = res;
if (exists($routeParams.position)) {
var tmp = findJobByName($routeParams.position);
// if (tmp !== false) {
// setTimeout(function () {
// showJobDescriptionByIndex(tmp.index);
// }, 100);
// $scope.activeJob = strSanitize($routeParams.position);
// }
if (exists($routeParams.apply)) {
setFormState('applying');
} else {
setFormState('description');
}
} else {
if ($scope.activeDepartment === 'thanks-for-applying') {
// alert('thankyou!');
} else {
// var tmp = findJobByIndex(0);
// if (tmp !== false) {
// var purel = urlSanitize(tmp.data['post_title']);
// updateURL($scope.activeDepartment + '/' + purel);
// }
}
}
} else {
setFormState('default');
}
// removePreloader(0);
});
function setFormState(state, activeDept) {
if (typeof state === 'undefined') {
return false;
}
if (state === 'default') {
$scope.activeDepartment = false;
$scope.activeJob = false;
$scope.formState = 'default';
// console.warn('removed update form path', state);
} else if (state === 'description') {
$scope.formState = 'description';
if (exists(activeDept)) {
if (activeDept === 'NEXT') {
// console.info('next category', $scope.activeDepartment);
} else if (activeDept === 'PREV') {
// console.info('previous category', $scope.activeDepartment);
} else {
$scope.activeDepartment = activeDept;
// updateURL(activeDept);
// console.warn('removed update form path', state);
}
}
} else if (state === 'applying') {
// updateURL('apply');
// console.warn('removed update form path', state);
$scope.formState = 'applying';
addSubmitButton();
buildLinkedInButton();
} else if (state === 'thanks') {
// updateURL('thanks');
// console.warn('removed update form path', state);
$scope.formState = 'thanks';
}
}
}
]);
/* Contact Controller
************************************************************************ */
//
ngPRPL.controller('ContactController',
[ '$scope', '$sanitize', '$location', '$routeParams',
function ($scope, $sanitize, $location, $routeParams) {
// Controller-wide varz
var _form = new Object();
var _isTouchDevice = $('html').hasClass('touch');
var autoAdvanceTimer;
// var submissionRef = new Firebase("https://prpl-contact.firebaseio.com/submissions");
// var _formSubs = $firebase(submissionRef);
var paramFormState = handleRouteParams($routeParams);
if (paramFormState !== false) {
setFormState(paramFormState);
}
function handleRouteParams(params) {
if (!exists(params)) {
return false;
}
var response = false;
// True if there is a form slug in the url e.g. /careers/wonga
if (exists(params.slug)) {
var sanitized = urlSanitize(params.slug);
var isValid = checkValidSlug(sanitized);
if (isValid) {
// console.info(sanitized);
if (sanitized === 'talk-biz') {
seo({
'title': 'Talk Biz | Contact | Purple, Rock, Scissors',
'description': 'Contact digital agency Purple, Rock, Scissors for new business opportunities in digital strategy, online marketing, web design and development.'
});
} else if (sanitized === 'speaker-event') {
seo({
'title': 'Event Speaker | Contact | Purple, Rock, Scissors',
'description': 'Book an event at Purple, Rock, Scissors or speaking engagement with a member of their digital agency team.'
});
} else if (sanitized === 'say-hi') {
seo({
'title': 'Say Hi | Contact | Purple, Rock, Scissors',
'description': 'Contact Purple, Rock, Scissors, a digital creative agency in Orlando, Florida'
});
}
response = {
state: sanitized
};
} else {
$location.path('/404');
}
// console.info('form pre-selected by url', params.slug);
} else {
// if the url is /careers only
response = {
state: 'default'
}
seo({});
}
// console.info(params);
return response;
}
function setFormState(state_name) {
if (!exists(state_name)) {
return false;
}
var s = (exists(state_name.state)) ? state_name.state : false;
if (!s) {
return false;
}
if (s === 'default') {
$scope.formState = 'default';
} else if (s === 'say-hi' || s === 'speaker-event' || s === 'talk-biz') {
$scope.formState = s;
_form.slug = s;
$('input.auto-size').autosizeInput();
$.scrollTo('.form-area-contact', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
// $('select.jq-select-box').select2();
formHandler(s);
} else if (s === 'thanks-biz' || s === 'thanks-speaker' || s === 'thanks-for-saying-hi') {
var fbCode = false;
if (s === 'thanks-biz') {
fbCode = '6015045364901';
$('.the-form-thanks .biz-nda').addClass('reveal');
$('.the-form-thanks .non-biz').addClass('obfuscate');
} else if (s === 'thanks-speaker') {
fbCode = '6015045399901';
} else if (s === 'thanks-for-saying-hi') {
fbCode = '6015045403901';
}
$scope.formState = 'thankyou-message';
$.scrollTo('.the-form-thanks', 400, {
'easing': 'easeInOutExpo',
'offset': 0
});
addFormClose();
if (fbCode !== false) {
addContactFBConversions(fbCode);
}
addGoogleConversionCode();
}
PRERENDER_READY(); // utils.js
}
$scope.showForm = function (e) {
var eAttrs = e.currentTarget.attributes;
var slug = eAttrs['data-form-name'].value;
updateURL(slug);
}
$scope.submitForm = function (valid, e) {
//console.info(valid, e);
e.preventDefault();
e.stopPropagation();
// var passesHoneyPotValidation = $('.verifyName', emailForm).val();
// passesHoneyPotValidation = (passesHoneyPotValidation.length === 0) ? true : false;
// console.info(passesHoneyPotValidation);
if (true) {
var diffs = submissionDifferences(e.currentTarget);
var formSelector = '.page-contact .the-form-say-hi ';
var siteReferrer = $('#prplSiteReferrer').val();
// console.log(diffs);
var classType = false;
var tmp = {};
var sfObj = {};
var sel = '';
var sf = {
url: "/sfpost.php",
oid: "00Do0000000I0Kp",
retUrl: "http://prpl.rs",
company: "company",
budget: "00No0000003BJSj",
message: "00No0000003AmaBEAS",
first_name: "first_name",
last_name: "last_name",
email: "email",
phone: "phone",
lead_source: "lead_source",
referrer: "00No0000003BJTD",
web_referrer: "00No0000003BJY3"
};
if (diffs.formType === 'say-hi') {
classType = 'Contact_SayHi';
sel = '.page-contact .the-form-say-hi '; // set relevant jq selecta
tmp.reason = $(sel + '[name="reason"]:checked').val();
tmp.name = $(sel + '[name="name"]').val();
tmp.message = $(sel + '[name="message"]').val();
tmp.email = $(sel + '[name="email"]').val();
tmp.phone = $(sel + '[name="phone"]').val();
tmp.referrer = $('#prplSiteReferrer').val();
} else if (diffs.formType === 'speaker-event') {
classType = 'Contact_SpeakerEvent';
sel = '.page-contact .the-form-speaker-event ';
tmp.event = $(sel + '[name="event"]').val();
tmp.name = $(sel + '[name="name"]').val();
tmp.date = $(sel + '[name="evtDate"]').val();
tmp.reason = $(sel + '[name="whatCanWeDo"]').val();
tmp.email = $(sel + '[name="email"]').val();
tmp.referrer = $('#prplSiteReferrer').val();
} else if (diffs.formType === 'talk-biz') {
classType = 'Contact_Business';
sel = '.page-contact .the-form-talk-biz ';
tmp.name = $(sel + '[name="name"]').val(),
tmp.company = $(sel + '[name="company"]').val(),
tmp.message = $(sel + '[name="message"]').val(),
tmp.budget = $(sel + '[name="budgetRange"]').val(),
tmp.email = $(sel + '[name="email"]').val(),
tmp.phone = $(sel + '[name="phone"]').val(),
tmp.stated_referrer = $(sel + '[name="stated_referrer"]').val(),
tmp.referrer = $('#prplSiteReferrer').val();
splitname = tmp.name.split(" ");
sfObj['oid'] = sf.oid;
sfObj['retUrl'] = sf.retUrl;
sfObj[sf.first_name] = splitname[0];
sfObj[sf.last_name] = splitname.length ? splitname[1] : "";
sfObj[sf.company] = $(sel + '[name="company"]').val(),
sfObj[sf.message] = $(sel + '[name="message"]').val(),
sfObj[sf.budget] = $(sel + '[name="budgetRange"]').val(),
sfObj[sf.email] = $(sel + '[name="email"]').val(),
sfObj[sf.phone] = $(sel + '[name="phone"]').val(),
sfObj[sf.referrer] = $(sel + '[name="stated_referrer"]').val(),
sfObj[sf.web_referrer] = $('#prplSiteReferrer').val();
sfObj[sf.lead_source] = "Web";
//sfObj['debug'] = 1;
//sfObj['debugEmail'] = '[email protected]';
// console.log("SF Object: ", sfObj);
//=========== AJAX to Pipedrive ==========
//Takes two Params
// 1.) Type of Request sne to pipedrive. Can be one of the following
// 'newDeal' | creates new Deal
// 'createNote' | creates new Note
//
// 2.) Data to be sent(must be object)
ajaxPipedrive( 'createOrg', tmp );
} else {
console.error('not found, we\'re doomed!');
return false;
}
//...
//;::::;
//;::::; :;
//;:::::' :;
//;:::::; ;.
//,:::::' ; OOO\
//::::::; ; OOOOO\
//;:::::; ; OOOOOOOO
//,;::::::; ;' / OOOOOOO
//;:::::::::`. ,,,;. / / DOOOOOO
//.';:::::::::::::::::;, / / DOOOO
//,::::::;::::::;;;;::::;, / / DOOO
//;`::::::`'::::::;;;::::: ,#/ / DOOO
//:`:::::::`;::::::;;::: ;::# / DOOO
//::`:::::::`;:::::::: ;::::# / DOO
//`:`:::::::`;:::::: ;::::::#/ DOO
//:::`:::::::`;; ;:::::::::## OO
//::::`:::::::`;::::::::;:::# OO
//`:::::`::::::::::::;'`:;::# O
//`:::::`::::::::;' / / `:#
//::::::`:::::;' / / `#
//@@@@@@@ @@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@ @@@@@@ @@@@@@@@
//@@! @@@ @@! @@! @@@ @@! @@@ @@! @@@ @@! @@@ !@@ @@!
//@!@!!@! !!@ @!@@!@! @!@@!@! @!@!@!@! @!@!!@! !@@!! @!!!:!
//!!: :!! !!: !!: !!: !!: !!! !!: :!! !:! !!:
//: : : : : : : : : : : : ::.: : : :: :::
var ParseClass = Parse.Object.extend(classType);
var parseClass = new ParseClass();
parseClass.save( tmp , {
success: function(object) {
// console.info('dongs', object);
$location.path(diffs.tyURL).replace();
$scope.$apply();
},
error: function(model, error) {
console.error(model, error);
}
});
// AJAX out to be sent to Pipedrive
function ajaxPipedrive( requestType, sendData ) {
//Modifies data to conform to pipedrive values
//based on request type. If you have a better
//way of doing this, please do. please. please.
switch ( requestType ) {
case 'createDeal':
var request = {
'param': '/deals',
'value': sendData.budget,
'org_id': sendData.org_id,
'person_id': sendData.person_id,
'title': sendData.company + ' deal'
}
break;
case 'createNote':
var request = {
'param': '/notes',
'content': 'Initial Message: ' + sendData.message + '<br>_____<br>Refered by: ' + sendData.stated_referrer,
'deal_id' : sendData.deal_id
}
break;
case 'createOrg':
var request = {
'param': '/organizations',
'name': sendData.company
}
break;
case 'createPerson':
var request = {
'param': '/persons',
'name': sendData.name,
'org_id': sendData.org_id,
'email': sendData.email,
'phone': sendData.phone
}
break;
default:
return false;
}
$.ajax({
url: '/submit.php',
type: 'POST',
dataType: 'json',
data: request,
success: function( response ) {
//Show success response
if (response.success) {
//This is some bull right here. Bull that works
if ( requestType == 'createOrg' ) {
tmp.org_id = response.data.id;
ajaxPipedrive( 'createPerson', tmp );
} else if ( requestType == 'createPerson' ) {
tmp.person_id = response.data.id;
ajaxPipedrive( 'createDeal', tmp );
} else if ( requestType == 'createDeal' ) {
tmp.deal_id = response.data.id;
ajaxPipedrive( 'createNote', tmp );
} else if ( requestType == 'createNote' ) {}
} else {
// Response failure condition
console.log( "JSON sucess, return failed", response );
}
},
error: function( error, status, thrown ) {
//Show error response
console.log( 'AJAX error' );
console.log( status );
console.log( thrown );
}
});
}
} else {
return false;
}
return false;
}
function addGoogleConversionCode() {
// window.google_trackConversion({
// google_conversion_id: 979906042,
// google_conversion_language: "en",
// google_conversion_format: "3",
// google_conversion_color: "ffffff",
// google_conversion_label: "fJicCP6k3AgQ-tug0wM",
// google_remarketing_only: true
// });
var google_conversion_id = 979906042;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "fJicCP6k3AgQ-tug0wM";
var google_conversion_value = 0;
$.getScript( "http://www.googleadservices.com/pagead/conversion.js" );
// console.log('google conversion-ed');
};
function parseHello() {
console.warn('hello');
}
function parseSpeaker() {
var formSelector = '.page-contact .the-form-speaker-event ';
var siteReferrer = $('#prplSiteReferrer').val();
console.warn('speaker');
}
function parseBiz() {
var formSelector = '.page-contact .the-form-talk-biz';
var siteReferrer = $('#prplSiteReferrer').val();
console.warn('biz');
}
function parseIt(formType) {
// console.log(formType);
var tmp = {};
var sel = '';
}
function submissionDifferences(e_target) {
var bizFormClass = 'the-form-talk-biz';
var bizFormSlug = 'talk-biz';
var bizFormTY = "/contact/thanks-biz";
var bizFormCMID = '27b4e06ae8133bff660a5cea2ae86b73';
var bizFormRecipient = '[email protected]';
var bizSubjectLine = 'PRPL Site: New Business';
var bizFormFBConversionID = '6015045364901';
var speakerFormClass = 'the-form-speaker-event';
var speakerFormSlug = 'speaker-event';
var speakerFormTY = "/contact/thanks-speaker";
var speakerFormCMID = '801385cf4bd4d8c7b2572cd5f0b28e48';
var speakerFormRecipient = '[email protected]';
var speakerSubjectLine = 'PRPL Site: Speaking Inquiry';
var speakerFBConversionID = '6015045399901';
var hiFormClass = 'the-form-say-hi';
var hiFormSlug = 'say-hi';
var hiFormTY = "/contact/thanks-for-saying-hi";
var hiFormCMID = '3779c1502913740363cae49644340f69';
var hiFormRecipient = '[email protected]';
var hiSubjectLine = 'PRPL Site: Saying Hi';
var hiFBConversionID = '6015045403901';
var fSlug = false;
var response = {
'cmID': false,
'tyURL': false,
'fbCode': false,
'recipient': '[email protected]',
'subject': 'PRPL Site Message From /Contact'
};
// so which is it?
if ($(e_target).parent().hasClass(bizFormClass)) {
fSlug = bizFormSlug;
} else if ($(e_target).parent().hasClass(speakerFormClass)) {
fSlug = speakerFormSlug;
} else if ($(e_target).parent().hasClass(hiFormClass)) {
fSlug = hiFormSlug;
}
// prep response now we know where you're going
if (fSlug === false) {
response = false;
} else if (fSlug === bizFormSlug) {
response.cmID = bizFormCMID;
response.tyURL = bizFormTY;
response.recipient = bizFormRecipient;
response.subject = bizSubjectLine;
response.fbCode = bizFormFBConversionID;
response.formType = fSlug;
} else if (fSlug === speakerFormSlug) {
response.cmID = speakerFormCMID;
response.tyURL = speakerFormTY;
response.recipient = speakerFormRecipient;
response.subject = speakerSubjectLine;
response.fbCode = speakerFBConversionID;
response.formType = fSlug;
} else if (fSlug === hiFormSlug) {
response.cmID = hiFormCMID;
response.tyURL = hiFormTY;
response.recipient = hiFormRecipient;
response.subject = hiSubjectLine;
response.fbCode = hiFBConversionID;
response.formType = fSlug;
} else {
response = false;
}
return response;
}
function formHandler(which_str) {
var activeForm = (exists(which_str)) ? which_str : false;
if (!activeForm) {
return false;
}
_form.active = activeForm;
_form.formSelector = '.form-area-contact .the-form-' + activeForm;
_form.panelSelector = _form.formSelector + ' .form-panel';
var jqFormPanels = $(_form.panelSelector);
// _form.totalPanels = $(_form.panelSelector).length;
_form.currentPanel = 0;
if (jqFormPanels.length < 1) {
return false;
}
// no panels found, clearly something went wrong
addFormClose();
addFormNext();
addFormPrev();
addInputEvents(_form.formSelector);
// focus first field unelss touch
if (_isTouchDevice === false) {
setTimeout(function() {
$(_form.formSelector + ' .form-panel.active').find('input.auto-size').first().focus();
}, 500);
}
}
function panelHandler(intent, newVal) {
if (!exists(intent)) {
return false;
}
var change = false;
if (intent === 'NEXT') {
_form.currentPanel++;
if ((_form.currentPanel + 1) >= _form.totalPanels) {
toggleFormNext(false);
$(_form.formSelector + ' > form').submit();
}
change = true;
} else if (intent === 'PREV') {
_form.currentPanel--;
change = true;
} else if (intent === 'RESET') {
_form.currentPanel = 0;
change = true;
} else if (intent === 'GOTO' && exists(newVal)) {
_form.currentPanel = newVal;
change = true;
} else {
return false;
}
if (change === true) {
changePanel(_form.currentPanel);
}
}
function changePanel(toWhat) {
if (!exists(toWhat)) {
return false;
}
if (toWhat > 0) {
toggleFormPrev(true);
} else if (toWhat < 1) {
toggleFormPrev(false);
}
cheekyTrack(toWhat);
var sel = _form.panelSelector + ':eq(' + toWhat + ')';
$(_form.panelSelector).removeClass('active');
$(sel).addClass('active');
clearTimeout(autoAdvanceTimer);
var isTimed = $(sel).hasClass('form-panel-auto-advance');
if (isTimed) {
var dur = $(sel).data().advanceDuration;
startAutoAdvanceTimer(dur);
} else {
var tmpSel = sel + ' input, ' + sel + ' textarea';
// console.log('is touch dvice?', _isTouchDevice);
if (_isTouchDevice === false) {
$(tmpSel).first().focus();
}
validateField(tmpSel);
}
// start hack on page load it sometimes shows the length doubled, no idea why? a DOM hangover?
_form.totalPanels = $(_form.panelSelector).length;
// end hack
showSubmitIfNecessary();
updateProgress();
}
function startAutoAdvanceTimer(dur) {
// console.info('advance timer: ', dur);
if (!exists(dur)) {
dur = 5000;
}
autoAdvanceTimer = setTimeout(function () {
// console.info('timer complete');
panelHandler('NEXT');
}, dur);
}
function stopAutoAdvanceTimer() {
// console.info('timer cancelled');
//clearTimeout(autoAdvanceTimer);
}
function addInputEvents(form_sel) {
// var inputSelector = form_sel + ' .form-panel input, ' + form_sel + ' .form-panel textarea, ' + form_sel + ' .form-panel select';
var inputSelector = form_sel + ' .form-panel input[type="text"], ' + form_sel + ' .form-panel input[type="email"], ' + form_sel + ' .form-panel input[type="tel"]';
var textareaSelector = form_sel + ' .form-panel textarea';
var radioSelector = form_sel + ' .form-panel input[type="radio"]';
var selectSelector = form_sel + ' .form-panel .custom-select select';
var jqInputs = $(inputSelector);
var jqTextAreas = $(textareaSelector);
var jqRadios = $(radioSelector);
var jqSelects = $(selectSelector);
var inputTimer;
jqInputs.off('keyup').on({
keyup: function (e) {
var kPressed = e.keyCode ? e.keyCode : e.charCode;
var enterCode = 13;
if (kPressed === enterCode) {
var validated = validateField(e.currentTarget);
if (validated.isValid) {
panelHandler('NEXT');
$(e.currentTarget).blur();
}
} else {
clearTimeout(inputTimer);
inputTimer = setTimeout(function () {
var validated = validateField(e.currentTarget);
clearTimeout(inputTimer);
}, 300);
}
}
});
jqTextAreas.off('keyup').on({
keyup: function (e) {
clearTimeout(inputTimer);
inputTimer = setTimeout(function () {
var validated = validateField(e.currentTarget);
clearTimeout(inputTimer);
}, 300);
}
});
jqRadios.off('change').on({
change: function (e) {
var jqTarg = $(e.currentTarget).parent().find('input');
setTimeout(function () {
validateField(jqTarg[0]);
// if(validated.isValid){ panelHandler('NEXT'); }
}, 500);
}
});
$scope.budgetRange = 0;
jqSelects.off('change').on({
change: function (e) {
var jqTarg = $(e.currentTarget);
validateField(jqTarg[0]);
// setTimeout(function () {
// validateField(jqTarg[0]);
// if(validated.isValid){ panelHandler('NEXT'); }
// }, 500);
}
});
}
function validateField(c_target) {
var response = {};
var validField = $(c_target).hasClass('ng-valid');
var fieldName = $(c_target).attr('name');
if (fieldName === 'budgetRange') {
// console.info('triggered by budgie', $(c_target).val(), fieldName, validField);
if ($(c_target).val() === "0") {
validField = false;
} else {
validField = true;
}
}
if (validField === true) {
toggleFormNext(true);
response.isValid = true;
} else {
toggleFormNext(false);
response.isValid = false;
}
response.name = fieldName;
return response;
}
function addFormClose() {
$('.form-area-contact .btn-close').off('click').on({
click: function (e) {
updateURL('RESET');
}
});
}
function addFormNext() {
$('.form-area-contact .btn-next').off('click').on({
click: function (e) {
if ($(e.currentTarget).hasClass('disabled')) {
return false;
}
panelHandler('NEXT');
}
});
}
function addFormPrev() {
$('.form-area-contact .btn-prev').off('click').on({
click: function (e) {
if ($(e.currentTarget).hasClass('disabled')) {
return false;
}
panelHandler('PREV');
}
});
}
function toggleFormNext(enabled) {
if (enabled) {
$('.form-area-contact .btn-next').removeClass('disabled');
} else {
$('.form-area-contact .btn-next').addClass('disabled');
}
}
function toggleFormPrev(enabled) {
if (enabled) {
$('.form-area-contact .btn-prev').removeClass('disabled');
} else {
$('.form-area-contact .btn-prev').addClass('disabled');
}
}
function updateProgress() {
// currentPanel is by index so add one to compensate for non-index based totalPanels
var prog = (100 / _form.totalPanels) * (_form.currentPanel + 1);
$('.form-area-contact .form-progress .bar').css({
'width': prog + '%'
});
// console.info(prog, _form);
}
function updateURL(str) {
var purel;
if (exists(str)) {
if (str === 'RESET') {
// http://stackoverflow.com/questions/17376416/angularjs-how-to-clear-query-parameters-in-the-url
$location.search('step', null);
// or $location.url($location.path());
$location.path('/contact');
$scope.$apply();
} else {
purel = urlSanitize(str);
$location.path('/contact/' + purel);
}
} else {
return false;
}
}
function checkValidSlug(slugStr) {
if (!exists(slugStr)) {
return false;
}
var arr = [
'talk-biz', 'speaker-event', 'say-hi',
'thanks-biz', 'thanks-speaker', 'thanks-for-saying-hi'
];
var response = false;
for (var i = arr.length - 1; i >= 0; i--) {
if (arr[i] === slugStr) {
response = true;
}
};
return response;
}
function seo(obj) {
var flagText, pageTitle, pageDescription, pageKeywords;
if (exists(obj)) {
pageTitle = (exists(obj.title)) ? obj.title : 'Contact | Purple, Rock, Scissors';
pageDescription = (exists(obj.description)) ? obj.description : "Contact digital agency Purple, Rock, Scissors for new business, career opportunities, or booking an event speaker.";
pageKeywords = (exists(obj.keywords)) ? obj.keywords : '';
}
// console.info(pageTitle, pageDescription, pageKeywords, window.location.href);
$scope.$parent.seo = {
title: pageTitle,
description: pageDescription,
keywords: pageKeywords
};
$scope.$parent.social = {
title: pageTitle,
description: pageDescription,
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
}
function addContactFBConversions(theID) {
var el = '';
el += '<div id="fbContactSubmissionPixel">';
el += '<script type="text/javascript">';
el += 'var fb_param = {};';
el += '\nfb_param.pixel_id = ' + theID + ';';
el += '\nfb_param.value = "0.00";';
el += '\nfb_param.currency = "USD";';
el += '\n(function(){';
el += "\n\tvar fpw = document.createElement('script');";
el += "\n\tfpw.async = true;";
el += "\n\tfpw.src = '//connect.facebook.net/en_US/fp.js';";
el += "\n\tvar ref = document.getElementsByTagName('script')[0];";
el += "\n\tref.parentNode.insertBefore(fpw, ref);";
el += '\n})();';
el += "</script>";
el += '<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=' + theID + '&amp;value=0&amp;currency=USD" /></noscript>';
el += "</div>";
if ($('#fbContactSubmissionPixel').length > 0) {
$('#fbContactSubmissionPixel').remove();
}
$('body').append(el);
}
function cheekyTrack(indy) {
$location.search('step', indy + 1);
$scope.$apply();
}
function showSubmitIfNecessary() {
// smh, look at this conditional hahah
if ((_form.currentPanel + 1) == (_form.totalPanels - 1)) {
showSubmitButton();
} else {
hideSubmitButton();
}
}
function showSubmitButton() {
$('.shared-form-nav .form-steps .btn-next').addClass('pre-submission');
}
function hideSubmitButton() {
$('.shared-form-nav .form-steps .btn-next').removeClass('pre-submission');
}
// removePreloader();
}
]);
/* CSA ( Consulting Services Agreement ) Controller
************************************************************************ */
//
ngPRPL.controller('ConsultingServicesAgreementController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
PRERENDER_READY(); // utils.js
}
]);
/* FLA ( Facility License Agreement ) Controller
************************************************************************ */
//
ngPRPL.controller('FacilityLicenseAgreementController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
// console.info('master agreement controller');
PRERENDER_READY(); // utils.js
}
]);
/* Home Controller
************************************************************************ */
ngPRPL.controller('HomeController',
['$scope', '$sanitize', '$resource', 'PRPLPosts', 'PRPLInstagram', '$location',
function ($scope, $sanitize, $resource, PRPLPosts, PRPLInstagram, $location) {
// $scope.$parent.navFlag = false;
$scope.$parent.seo = {
description: 'Purple, Rock, Scissors, a digital creative agency in Orlando, FL, provides digital strategy consultation, innovation, and goal-driven design.',
keywords: 'digital agency, orlando agency, digital strategy agency, business intelligence services, digital agency of record, goal-driven design',
title: 'PRPL | Purple, Rock, Scissors: A Digital Creative Agency in Orlando'
};
$scope.$parent.social = {
title: 'PRPL | Purple, Rock, Scissors: A Digital Creative Agency in Orlando',
description: 'Purple, Rock, Scissors, a digital creative agency in Orlando, FL, provides digital strategy consultation, innovation, and goal-driven design.',
url: defragz(window.location.href),
author: '@prplrckscssrs',
photo: 'http://purplerockscissors.com/assets/images/social.jpg'
};
// RECENT POSTS
PRPLPosts.get(function(result) {
$scope.featuredPosts = result.posts;
// removePreloader();
PRERENDER_READY(); // utils.js
});
// RECENT INSTAGRAMS
PRPLInstagram.get(function (result) {
$scope.instaPosts = result.data;
});
}
]);
/* Short Linx Controller
************************************************************************ */
//
ngPRPL.controller('ShortLinkController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
var Short_Link = Parse.Object.extend("Short_Link");
var query = new Parse.Query(Short_Link);
query.equalTo("short_url", $routeParams.shortLink);
query.first({
success: function(result) {
// console.info(result);
if (typeof result !== 'undefined') {
result.increment("views");
result.save(null, {
success: function(result) {
window.location.href = result.get("long_url");
}
});
} else {
$location.path('/404');
}
},
error: function(error) {
// console.info(result);
$location.path('/404');
}
});
}
]);
/* MSA (Master Service Agreement) Controller
************************************************************************ */
//
ngPRPL.controller('MasterAgreementController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
// console.info('master agreement controller');
PRERENDER_READY(); // utils.js
}
]);
/* NDA (Non Disclosure Agreement) Controller
************************************************************************ */
//
ngPRPL.controller('NonDisclosureAgreementController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
// console.info('non disclosure controller');
PRERENDER_READY(); // utils.js
}
]);
/* Privacy Policy Controller
************************************************************************ */
//
ngPRPL.controller('PrivacyPolicyController',
[ '$scope', '$sanitize', '$routeParams', '$location',
function ($scope, $sanitize, $routeParams, $location) {
// console.info('privacy policy controller');
PRERENDER_READY(); // utils.js
}
]);
/* Process Controller
************************************************************************ */
//
ngPRPL.controller('ProcessController',
['$scope', '$sanitize', '$location',
function ($scope, $sanitize, $location) {
// $scope.$parent.navFlag = spacesToNBSP('Approach');
$scope.$parent.seo = {
title: 'Process | Purple, Rock, Scissors',
description: 'PRPL applies omnichannel strategy and business intelligence to design, development, enterprise integration, and marketing to engage tomorrow’s digital consumers.',
keywords: 'digital strategy, experience design, content strategy, data-driven marketing, social media services, video production, digital services, business consultation, business innovation'
};
$scope.$parent.social = {
title: 'Process | Purple, Rock, Scissors',
description: 'PRPL applies omnichannel strategy and business intelligence to design, development, enterprise integration, and marketing to engage tomorrow’s digital consumers.',
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
// removePreloader();
PRERENDER_READY(); // utils.js
}
]);
ngPRPL.controller('FourRiversController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
//social
$scope.$parent.seo = {
title: '4 Rivers | Work | Purple, Rock, Scissors',
description: "4 Rivers Smokehouse sought PRPL’s services to transform their mobile & e-commerce experiences, while conveying their true brand online.",
keywords: 'digital agency, mobile website development, e-commerce development, design agency, web design, 4 rivers website, 4 rivers smokehouse, 4rivers, best restaurant website, ecommerce website, ux design, user experience'
};
$scope.$parent.social = {
title: '4 Rivers | Work | Purple, Rock, Scissors',
description: "4 Rivers Smokehouse sought PRPL’s services to transform their mobile & e-commerce experiences, while conveying their true brand online.",
photo: "http://purplerockscissors.com/assets/images/4r/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('4rivers', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
var fourRiverVariables = {};
fourRiverVariables.sliderExists = false;
fourRiverVariables.sliderSel = '.increased-sales .iosslider';
var fourRiverFunctions = {};
fourRiverFunctions.createGraphSlider = function() {
fourRiverVariables.sliderExists = true;
$(fourRiverVariables.sliderSel).iosSlider({
snapToChildren: true,
desktopClickDrag: true,
snapSlideCenter: true,
responsiveSlides: true,
infiniteSlider: true,
keyboardControls: true,
onSlideChange: function(args) {
fourRiverFunctions.setActiveGraphSliderDot(args.currentSlideNumber);
}
});
};
fourRiverFunctions.removeGraphSlider = function() {
fourRiverVariables.sliderExists = false;
$(fourRiverVariables.sliderSel).iosSlider('destroy');
};
fourRiverFunctions.gotoGraphSlide = function(which) {
$(fourRiverVariables.sliderSel).iosSlider('goToSlide', which);
};
fourRiverFunctions.setActiveGraphSliderDot = function(which) {
$(".increased-sales .pagination-dots [data-slide-ref]").removeClass('active');
$(".increased-sales .pagination-dots [data-slide-ref=" + which + "]").addClass('active');
}
$(".increased-sales .pagination-dots [data-slide-ref]").on({
click: function(e) {
var eSlide = $(e.currentTarget).data().slideRef;
fourRiverFunctions.gotoGraphSlide(eSlide);
}
})
if ($(window).width() < 1000) {
fourRiverFunctions.createGraphSlider();
} else {
fourRiverFunctions.removeGraphSlider();
}
$(window).on({
resize: function () {
if ($(window).width() < 1000) {
fourRiverFunctions.createGraphSlider();
} else {
fourRiverFunctions.removeGraphSlider();
}
}
});
}
]);
ngPRPL.controller('ADUController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'Adventist University (ADU) | Work | Purple, Rock, Scissors',
description: 'Adventist University of Health Sciences partnered with PRPL to define and optimize student lead generation funnels and overhaul their digital experience.',
keywords: 'digital strategy, digital agency, lead generation, business intelligence, KPIs, ADU, adventist university, university websites, purple rock scissors, web development, web design'
};
$scope.$parent.social = {
title: 'Adventist University (ADU) | Work | Purple, Rock, Scissors',
description: 'Adventist University of Health Sciences partnered with PRPL to define and optimize student lead generation funnels and overhaul their digital experience.',
photo: "http://purplerockscissors.com/assets/images/adu/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('adu', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
PRERENDER_READY(); // utils.js
});
// case study variables
var aduVars = {};
var aduFns = {};
aduVars.$pageScope = $('.page-cs-adu');
}
]);
ngPRPL.controller('CiscoController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'Cisco | Work | Purple, Rock, Scissors',
description: 'Cisco partnered with PRPL to overhaul their online application for the Cisco International Internship Program (CIIP) in just 12 weeks',
keywords: 'digital agency, website development, design agency, web design, django development, ux design, user experience, digital strategy, cisco website, cisco international internship program, CIIP'
};
$scope.$parent.social = {
title: 'Cisco | Work | Purple, Rock, Scissors',
description: 'Cisco partnered with PRPL to overhaul their online application for the Cisco International Internship Program (CIIP) in just 12 weeks',
photo: "http://purplerockscissors.com/assets/images/cisco/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('cisco', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
}
]);
ngPRPL.controller('DavidoffController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'Davidoff of Geneva Madison Avenue | Work | Purple, Rock, Scissors',
description: 'Our partnership with Davidoff of Geneva led us to end-to-end social media management and strategy for their flagship store in NYC, and to great results.',
keywords: 'digital agency, digital strategy, social media strategy, social media management, community management, social media agency, Davidoff Madison Avenue, tobacco advertising'
};
$scope.$parent.social = {
title: 'Davidoff of Geneva Madison Avenue | Work | Purple, Rock, Scissors',
description: 'Our partnership with Davidoff of Geneva led us to end-to-end social media management and strategy for their flagship store in NYC, and to great results.',
photo: "http://purplerockscissors.com/assets/images/davidoff/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('davidoff-madison-ave', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
// case study variables
var davidoffVars = {};
var davidoffFns = {};
davidoffVars.$pageScope = $('.page-cs-davidoff')
davidoffVars.$phoneSlider = $('.davidoff-social-platforms .iosslider', davidoffVars.$pageScope);
davidoffVars.phoneSliderCreated = false;
davidoffVars.$barGraphSlider = $('.davidoff-charts-area .graph-group-barz .iosslider', davidoffVars.$pageScope);
davidoffVars.$circleGraphSlider = $('.davidoff-charts-area .graph-group-circlez .iosslider', davidoffVars.$pageScope);
davidoffVars.graphSlidersCreated = false;
davidoffFns.createPhoneSlider = function() {
davidoffVars.phoneSliderCreated = true;
davidoffVars.$phoneSlider.iosSlider({
snapToChildren: true,
desktopClickDrag: true,
snapSlideCenter: true,
responsiveSlides: true,
infiniteSlider: true,
keyboardControls: true,
autoSlide: true
});
};
davidoffFns.removePhoneSlider = function() {
davidoffVars.phoneSliderCreated = false;
davidoffVars.$phoneSlider.iosSlider('destroy');
};
davidoffFns.createGraphSliders = function() {
davidoffVars.graphSlidersCreated = true;
davidoffVars.$barGraphSlider.iosSlider({
snapToChildren: true,
desktopClickDrag: true,
snapSlideCenter: true,
responsiveSlides: true,
infiniteSlider: true,
keyboardControls: true,
onSlideChange: function(args) {
davidoffFns.setActiveBarGraphSliderDot(args.currentSlideNumber);
}
});
davidoffVars.$circleGraphSlider.iosSlider({
snapToChildren: true,
desktopClickDrag: true,
snapSlideCenter: true,
responsiveSlides: true,
infiniteSlider: true,
keyboardControls: true,
onSlideChange: function(args) {
davidoffFns.setActiveCircleGraphSliderDot(args.currentSlideNumber);
}
});
};
davidoffFns.removeGraphSliders = function() {
davidoffVars.graphSlidersCreated = false;
davidoffVars.$barGraphSlider.iosSlider('destroy');
davidoffVars.$circleGraphSlider.iosSlider('destroy');
};
davidoffFns.setActiveCircleGraphSliderDot = function(which) {
$(".graph-group-circlez .pagination-dots [data-slide-ref]").removeClass('active');
$(".graph-group-circlez .pagination-dots [data-slide-ref=" + which + "]").addClass('active');
};
davidoffFns.setActiveBarGraphSliderDot = function(which) {
$(".graph-group-barz .pagination-dots [data-slide-ref]").removeClass('active');
$(".graph-group-barz .pagination-dots [data-slide-ref=" + which + "]").addClass('active');
};
davidoffFns.gotoCircleGraphSlide = function(which) {
davidoffVars.$circleGraphSlider.iosSlider('goToSlide', which);
};
davidoffFns.gotoBarGraphSlide = function(which) {
davidoffVars.$barGraphSlider.iosSlider('goToSlide', which);
};
$(".graph-group-barz .pagination-dots [data-slide-ref]").on({
click: function(e) {
var eSlide = $(e.currentTarget).data().slideRef;
davidoffFns.gotoBarGraphSlide(eSlide);
}
});
$(".graph-group-circlez .pagination-dots [data-slide-ref]").on({
click: function(e) {
var eSlide = $(e.currentTarget).data().slideRef;
davidoffFns.gotoCircleGraphSlide(eSlide);
}
});
// always use phone slider so call it now,
// the mobile only ones are called below
davidoffFns.createPhoneSlider();
$(window).on({
resize: function () {
if ($(window).width() < 1280) {
davidoffFns.createGraphSliders();
} else {
davidoffFns.removeGraphSliders();
}
}
}).trigger('resize');
}
]);
ngPRPL.controller('FleetgisticsController',
['$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'Fleetgistics | Work | Purple, Rock, Scissors',
description: 'PRPL rebranded Fleetgistics with a new lead-generating website with motion graphics and geo-targeted landing pages, and implementing an email marketing campaign.',
keywords: 'fleetgistics, website for fleetgistics, fleetgistics website, conversion funnel, landing page, user experience, prpl'
};
$scope.$parent.social = {
title: 'Fleetgistics | Work | Purple, Rock, Scissors',
description: 'PRPL rebranded Fleetgistics with a new lead-generating website with motion graphics and geo-targeted landing pages, and implementing an email marketing campaign.',
photo: "http://purplerockscissors.com/assets/images/fleetgists/bg-cityscape.png",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('fleetgistics', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
}
]);
ngPRPL.controller('NASAController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'NASA IDEAS Case Study | Work | Purple, Rock, Scissors',
description: 'NASA partnered with PRPL on their new wearable technology, the Integrated Display and Environmental Awareness System (IDEAS), for the Early Career Initiative (ECI) pilot program.',
keywords: 'digital strategy, innovation digital agency, wearable technology, NASA, kennedy space center, NASA digital agency, technology, purple rock scissors'
};
$scope.$parent.social = {
title: 'NASA | Work | Purple, Rock, Scissors',
description: 'NASA partnered with PRPL on their new wearable technology, the Integrated Display and Environmental Awareness System (IDEAS), for the Early Career Initiative (ECI) pilot program.',
photo: "http://purplerockscissors.com/assets/images/nasa/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('nasa', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
PRERENDER_READY(); // utils.js
});
// case study variables
var _nasa = {};
_nasa.$pageScope = $('.page-cs-nasa');
_nasa.innit = function() {
$('.user-card', _nasa.$pageScope).on({
"click" : function(e) {
$(e.currentTarget).toggleClass('is-active');
return false;
}
});
_nasa.$videos = $("[data-auto-video]", _nasa.$pageScope);
if ( _nasa.$videos )
_nasa.initVideos();
_nasa.$cardSlider = $("[data-card-slider]", _nasa.$pageScope);
if ( _nasa.$cardSlider )
_nasa.initCardSlider();
_nasa.$helmet = $("[data-nasa-helmet]", _nasa.$pageScope);
if ( _nasa.$helmet )
_nasa.initHelmet();
_nasa.$signalingServer = $('[data-nasa-signals]', _nasa.$pageScope);
if ( _nasa.$signalingServer )
_nasa.signalDots();
};
_nasa.initVideos = function() {
_nasa.hoverRevealDuration = 3000;
_nasa.videoRevealTimer;
_nasa.$videos.find('a').on({
click: function(e) {
clearTimeout( _nasa.videoRevealTimer );
var targ = e.currentTarget;
$(targ).parent().addClass('reveal');
$(targ).off('mouseenter mouseleave');
setTimeout(function() {
$(targ).hide();
var vid = $(targ).parent().find('video')[0];
vid.play();
}, 500);
},
mouseenter: function(e) {
_nasa.videoRevealTimer = setTimeout(function() {
$(e.currentTarget).click();
}, _nasa.hoverRevealDuration);
},
mouseleave: function(e) {
clearTimeout( _nasa.videoRevealTimer );
}
});
};
_nasa.signalDots = function() {
var type, $dot, timer, count = 0, animTo, animDur = 800;
timer = setInterval(function() {
if ( count === 12 ) {
return
}
type = (Math.round(Math.random())) ? 'top' : 'bottom';
animTo = (type === 'top') ? 1080 : 400;
$dot = _nasa.makeSignalDot(type);
$("#TUBES .nasa-signals__tube--" + type).append( $dot );
$( $dot ).animate({
cx: animTo
}, animDur, function() {
$(this).remove();
count--;
})
count++;
}, (Math.random() * 400) + 300);
};
_nasa.makeSignalDot = function(type) {
var yPos, xPos, fill = 'white';
if (type === 'top') {
yPos = '541.8';
xPos = '400';
} else {
yPos = '573.2';
xPos = '1080';
}
var $c = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
$c.setAttribute('r', '2.5');
$c.setAttribute('cx', xPos);
$c.setAttribute('cy', yPos);
$c.setAttribute('fill', fill);
return $c;
}
_nasa.initCardSlider = function() {
_nasa.cardsSwiper = new Swiper(_nasa.$cardSlider[0], {
slidesPerView: "auto"
});
};
_nasa.initHelmet = function() {
_nasa.$hotspots = _nasa.$helmet.find('[data-helmet-hotspot]');
_nasa.$hotspotDescriptions = _nasa.$helmet.parent().find('[data-helmet-description]');
_nasa.$hotspotNext = _nasa.$helmet.find('[data-helmet-next]');
_nasa.$hotspotPrev = _nasa.$helmet.find('[data-helmet-prev]');
_nasa.hotspotTotal = _nasa.$hotspots.length;
_nasa.hotspotActive = 1;
_nasa.$hotspots.on({
click: function(e) {
var targ = $(e.currentTarget).attr('data-helmet-hotspot');
_nasa.helmetAction('goto', targ);
}
});
_nasa.$hotspotNext.on({
click: function (e) {
_nasa.helmetAction('next');
return false;
}
});
_nasa.$hotspotPrev.on({
click: function (e) {
_nasa.helmetAction('prev');
return false;
}
});
};
_nasa.helmetAction = function(action, id) {
if (action === 'next') {
_nasa.helmetAction('goto', _nasa.getNextHelmetHotspot());
} else if (action === 'prev') {
_nasa.helmetAction('goto', _nasa.getPrevHelmetHotspot());
} else if (action === 'goto' && typeof id !== "undefined") {
_nasa.$hotspots.attr('class', 'hotspot');
$('[data-helmet-hotspot="' + id + '"]').attr('class', 'hotspot is-active');
_nasa.$hotspotDescriptions.removeClass('is-active');
$('[data-helmet-description="' + id + '"]').addClass('is-active');
_nasa.hotspotActive = Number(id);
}
};
_nasa.getNextHelmetHotspot = function() {
var output = _nasa.hotspotActive + 1;
if (output > _nasa.hotspotTotal)
output = 1;
return output;
};
_nasa.getPrevHelmetHotspot = function() {
var output = _nasa.hotspotActive - 1;
if (output < 1)
output = _nasa.hotspotTotal;
return output;
};
_nasa.innit();
}
]);
ngPRPL.controller('OUCController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'OUC | Work | Purple, Rock, Scissors',
description: 'OUC enlisted PRPL to pioneer an innovative digital platform, so we took the downtown powerhouse to a new level with an enterprise solution and complete redesign.',
keywords: 'OUC, website for OUC, OUC website, Enterprise Service Bus, Orlando Utilities Commission, PRPL, MyOuc, Enterprise Solution'
};
$scope.$parent.social = {
title: 'OUC | Work | Purple, Rock, Scissors',
description: 'OUC enlisted PRPL to pioneer an innovative digital platform, so we took the downtown powerhouse to a new level with an enterprise solution and complete redesign.',
photo: "http://purplerockscissors.com/assets/images/ouc/bg-header.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('ouc', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
}
]);
ngPRPL.controller('RMCADController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'RMCAD | Work | Purple, Rock, Scissors',
description: "PRPL redesigned RMCAD's website with a fresh new look and a responsive design. RMCAD also kicked off a digital marketing campaign at site launch.",
keywords: 'rmcad, rmcad website, website for RMCAD, creative branding, responsive design, search engine marketing, display ads, prpl'
};
$scope.$parent.social = {
title: 'RMCAD | Work | Purple, Rock, Scissors',
description: "PRPL redesigned RMCAD's website with a fresh new look and a responsive design. RMCAD also kicked off a digital marketing campaign at site launch.",
url: defragz(window.location.href),
photo: "http://purplerockscissors.com/assets/images/rmcad/hero.jpg",
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('rmcad', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
}
]);
ngPRPL.controller('VideriController',
[ '$scope', '$sanitize', '$routeParams', '$location', 'PRPLEmployee',
function ($scope, $sanitize, $routeParams, $location, PRPLEmployee) {
$scope.$parent.seo = {
title: 'Videri | Work | Purple, Rock, Scissors',
description: 'Videri Chocolate Factory came to PRPL with the challenge of rendering the brand’s in-person feel online, and driving sales outside the factory setting.',
keywords: 'Videri Chocolate Factory, web design, marketing, hoefler & co, typography, PRPL'
};
$scope.$parent.social = {
title: 'Videri | Work | Purple, Rock, Scissors',
description: 'Videri Chocolate Factory came to PRPL with the challenge of rendering the brand’s in-person feel online, and driving sales outside the factory setting.',
photo: "http://purplerockscissors.com/assets/images/videri/hero.jpg",
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
PRPLEmployee.casestudy('videri', function (res) {
var arr = $.map(res.result, function (value, key) {
return value;
});
$scope.creditsArray = arr;
// removePreloader();
PRERENDER_READY(); // utils.js
});
}
]);
/* Case Studies List Controller
************************************************************************ */
//
ngPRPL.controller('CaseStudiesController',
['$scope', '$sanitize', '$location', 'PRPLBlog',
function ($scope, $sanitize, $location, PRPLBlog) {
// $scope.$parent.navFlag = spacesToNBSP('Case Studies');
$scope.$parent.seo = {
title: 'Work | Purple, Rock, Scissors',
description: 'View the PRPL case studies and ROI of our web design, web development, and digital marketing strategy services we provide to our clients',
keywords: 'prpl case studies, prpl clients, digital marketing, social engagement, web design, web development, seo strategy, ppc strategy, branding, digital strategy'
};
$scope.$parent.social = {
title: 'Work | Purple, Rock, Scissors',
description: 'View the PRPL case studies and ROI of our web design, web development, and digital marketing strategy services we provide to our clients',
url: defragz(window.location.href),
author: '@prplrckscssrs'
};
// PRPLBlog.workPageLinks('launches', function (response) {
// console.info('wonga sponsored results:', response);
// var data = response;
// var title = data.prev["post_title"];
// var url = '/notes/' + data.prev["ID"] + '/' + data.prev["post_name"];
// console.info(img, title, url);
// $scope.thePrevPost = { 'img': img, 'title': title, 'url': url };
// var arr = data.posts;
// console.log(arr);
// for (var i = arr.length - 1; i >= 0; i--) {
// console.log(arr[i]["title"]);
// };
// });
// removePreloader(0);
PRERENDER_READY(); // utils.js
}
]);
/* Angular Directives
************************************************************************ */
ngPRPL.directive('prplSeo', [function() {
return {
restrict: 'E',
link: function(scope, element, attrs) {
var target = element[0];
var keywords = $('.keywords', target).text();
var description = $('.description', target).text();
var title = $('.title', target).html();
var jqHead = $('html > head');
$('meta[name="keywords"]', jqHead).attr('content', keywords);
$('meta[name="description"]', jqHead).attr('content', description);
$('title', jqHead).html(title);
$(target).remove();
}
}
}
]);
// ngPRPL.directive('ngBindModel',function($compile){
// return{
// compile:function(tEl,tAtr){
// tEl[0].removeAttribute('ng-bind-model')
// return function(scope){
// tEl[0].setAttribute('ng-model',scope.$eval(tAtr.ngBindModel))
// $compile(tEl[0])(scope)
// console.info('new compiled element:',tEl[0])
// }
// }
// }
// });
ngPRPL.directive('ngBindAttrs', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
scope.$watch(attrs.ngBindAttrs, function(value) {
angular.forEach(value, function(value, key) {
attrs.$set(key, value);
});
}, true);
}
}
}
]);
ngPRPL.directive('toggleAnimate', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
setInterval(function() {
$('.django-image').removeClass('animate-code');
setTimeout(function() {
$('.django-image').addClass('animate-code');
}, 50);
}, 3400);
}
}
}
]);
ngPRPL.directive('mudChartStrategy', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
// var target = element[0];
$('.chart-digital-strategy [data-toggle]').on({
mouseover: function(e) {
$(e.currentTarget).trigger('click', e);
},
click: function(e) {
$('.chart-digital-strategy .is-active').removeClass('is-active');
var dat = $(e.currentTarget).addClass('is-active').data();
var lolsvg = $('.chart-digital-strategy [data-line="' + dat.toggle + '"]')[0];
lolsvg.classList.add('is-active');
}
});
}
}
}
]);
ngPRPL.directive('mudChartScalability', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$('.chart-scalability .c2-wrap .c2-circ').on({
mouseover: function(e) {
var jqTarget = $(e.currentTarget);
var jqPointerCircle = $('.c2-wrap .c2-center');
//jqTarget.addClass('focused');
var data = jqTarget.data();
var targetOrder = (typeof data.order !== 'undefined') ? data.order : 1;
var totalLength = 6;
var targetName = (typeof data.name !== 'undefined') ? data.name : 'strategist';
// var rotation = ((360/totalLength) * (targetOrder-1)) - 90; // subtract 90 due to initial pointer rotation
var bgColor = jqTarget.find('.c2-label').css('color');
// jqPointerCircle.find('svg').css({ '-webkit-transform': 'rotate(' + rotation + 'deg)'});
jqPointerCircle.find('svg path, svg polygon').css({
'fill': bgColor
});
},
click: function(e) {
$(e.currentTarget).trigger('mouseover');
}
});
}
}
}
]);
ngPRPL.directive('prplSpinner', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var el = "";
el += '<div class="spinner">';
el += '<div class="rect1"></div>';
el += '<div class="rect2"></div>';
el += '<div class="rect3"></div>';
el += '<div class="rect4"></div>';
el += '<div class="rect5"></div>';
el += '</div>'
$(element).append(el)
}
}
}
]);
ngPRPL.directive('prplCareersReasons', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var jqContainer = $('.the-reasons');
var jqPanels = $('.the-reasons .reason');
var jqPanelContainer = $('.the-reasons .reason-container > .vertical-child');
// var randomIndex = Math.floor(Math.random() * panelLength);
var currentIndex = 0;
var panelLength = jqPanels.length;
if (panelLength < 1) {
return false;
}
// jqPanels = shuffleArray(jqPanels);
// jqPanelContainer.html(jqPanels);
// jqPanelContainer.children().first().addClass('display');
var vidSrc = $(jqPanels[0]).attr('data-slide-video-src');
var posterSrc = $(jqPanels[0]).attr('data-slide-video-poster');
$('.the-reasons .prpl-bgv').attr('poster', posterSrc);
$('.the-reasons .prpl-bgv .src-mp4').attr('src', vidSrc + '.mp4');
$('.the-reasons .prpl-bgv .src-webm').attr('src', vidSrc + '.webmhd.webm');
var vidRef = $('.the-reasons .prpl-bgv')[0];
if (!$('html').hasClass('touch')) {
vidRef.load();
}
$('.the-reasons .gimme-another').off('click').on({
click: function(e) {
currentIndex++;
if (currentIndex === panelLength) {
currentIndex = 0;
}
jqContainer = $('.the-reasons');
jqPanels = $('.the-reasons .reason');
jqPanelContainer = $('.the-reasons .reason-container > .vertical-child');
jqPanels.removeClass('display');
// console.info(jqPanels[currentIndex])
$(jqPanels[currentIndex]).addClass('display');
vidSrc = $(jqPanels[currentIndex]).attr('data-slide-video-src');
posterSrc = $(jqPanels[currentIndex]).attr('data-slide-video-poster');
$('.the-reasons').css({
'background-image': 'url(' + posterSrc + ')'
});
$('.the-reasons .prpl-bgv').attr('poster', posterSrc);
$('.the-reasons .prpl-bgv .src-mp4').attr('src', vidSrc + '.mp4');
$('.the-reasons .prpl-bgv .src-webm').attr('src', vidSrc + '.webmhd.webm').parent().addClass('intro');
vidRef = $('.the-reasons .prpl-bgv')[0];
if (!$('html').hasClass('touch')) {
vidRef.load();
}
}
});
}
}
}
]);
ngPRPL.directive('prplScrollUp', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
// console.log('only show these elements when scrolling upwards, nav-tag as first')
}
}
}
]);
ngPRPL.directive('prplDisplayRandom', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var jqChildren = $(element).find('.random-option');
var indexRange = jqChildren.length;
var rando = Math.floor(Math.random() * indexRange);
$(jqChildren[rando]).addClass('random-selected');
$(element).addClass('intro');
setInterval(function() {
var next, cur;
for (var i = jqChildren.length - 1; i >= 0; i--) {
if ( $(jqChildren[i]).hasClass('random-selected') ) {
next = i;
cur = i;
}
};
next = (next === (jqChildren.length - 1)) ? 0 : next + 1; // reset or increment
$(jqChildren[cur]).parent().fadeOut(400, function() {
$( jqChildren[cur] ).removeClass('random-selected');
$( jqChildren[next] ).addClass('random-selected').parent().fadeIn(200);
});
}, 5000);
}
}
}
]);
ngPRPL.directive('prplFormTooltip', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
// var jqWrap = $(element);
// var strTooltip = jqWrap.find('.tooltip-content').first().html();
// var jqInput = jqWrap.find('input')[0];
// console.info(strTooltip, jqInput);
// // build html
// var el = '';
// el += '<div class="form-tooltip-wrap">';
// // el += jqInput;
// el += '';
// el += '</div>';
// jqWrap.append(el);
var jqWrap = $(element);
var input = $('input, select, textarea', jqWrap);
var tooltip = $('.tooltip-content');
// tooltip.on({
// hover: function(e){
// $('')
// }
// })
}
}
}
]);
ngPRPL.directive('externalLinkCursor', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
$(element).addClass('external-link').attr('target', '_blank');
};
return {
restrict: 'A',
link: linkFn
}
}
]);
ngPRPL.directive('onscreen', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
$(element).addClass('offscreen');
$(element).waypoint(function(direction) {
// alert('waypoint', direction);
$(this).toggleClass('offscreen').toggleClass('onscreen');
});
};
return {
restrict: 'A',
link: linkFn
}
}
]);
ngPRPL.directive('hopdown', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
$(element).css('cursor', 'pointer').on({
click: function(e) {
$(element).velocity("scroll", {
duration: 750,
easing: "easeInOutCirc",
offset: - 100
})
}
})
};
return {
restrict: 'A',
link: linkFn
}
}
]);
/**
* directive for animating chocolate bars on a conveyor belt
*
* @author: Parker Hutchinson
* @requires: debounce
*/
ngPRPL.directive('prplBars', [function() {
function link(scope, element, attrs) {
var $scope = scope,
glob = {};
var init = function() {
var $container = $(element).find('ul'),
containerW = $(element).outerWidth(),
pageW = 1360,
leftA = Math.floor((pageW - containerW) / 2),
animateA = (640 + leftA) * - 1;
// setup the container
if (containerW < pageW) {
$container.css({
'left': '-' + leftA + 'px'
});
} else {
leftA = 280;
$container.css({
'left': '-260px'
});
}
var animateAfterResize = debounce(function() {
// reset timer after resize
window.clearInterval(glob.timer);
containerW = $(element).outerWidth();
leftA = Math.floor((pageW - containerW) / 2) + 260;
// setup the container after resize
if (containerW < pageW) {
leftA = Math.floor((pageW - containerW) / 2) + 260;
animateA = (640 + leftA) * - 1;
$container.css({
'left': '-' + leftA + 'px'
});
} else {
animateA = (640 + 260) * - 1;
leftA = 260;
$container.css({
'left': '-280px'
});
}
// animate function
animateBars(animateA, element, leftA);
}, 250);
// debounce call
$(window).on('resize', animateAfterResize);
return;
}
var animateBars = function(animateA, element, leftA) {
var count = 0;
// slideshow loop
glob.timer = window.setInterval(function() {
$(element).find('ul').velocity({
left: animateA
}, 1500, "easeInOutBack", function() {
// prepare next slide animation
animateA -= 640;
count++;
// reset the slider to make it appear infinite
if (count == 3) {
count = 0;
animateA = (640 + leftA) * - 1;
$(element).find('ul').css({
"left": "-" + leftA + "px"
});
}
});
return;
}, 2500);
return;
}
//only init after view has loaded
$scope.$on('$viewContentLoaded', function() {
init();
return;
});
}
return {
restrict: 'A',
link: link
};
}
]);
/**
* creates directive to attach to videri png chocolate bar sequence
* iteration occures on scroll.
*
* @author Parker Hutchinson
*
*/
ngPRPL.directive('prplSequence', [function() {
var link = function(scope, element, attrs) {
var $scope = scope;
//main script for animating scroll and png sequence
var init = function() {
var totalImages = 116,
scrollInterval = Math.floor(($(window).height() - $(window).height() * .2) / totalImages),
viewport = $(window),
images = [];
// essentially caches the image location
// for easy access
for (i = 1; i <= 116; i++) {
images.push('http://ffc71bcab7b3b768044d-112878d1308f6723380931f33472aca6.r86.cf1.rackcdn.com/videri/videri_sequence-' + i + '.png');
};
$(images).each(function () {
$('<img />')[0].src = this;
});
// onload intial
$(element).find('img').attr('src', images[1]);
setImage()
// perform image sequence on a tight scroll no debounce
viewport.on('scroll', function () {
setImage();
return;
});
function setImage() {
// animate image only if it is in its section
if ($(window).scrollTop() > $(element).offset().top - 600 && $(window).scrollTop() < ($(element).offset().top + $(element).height())) {
// prepare img
$(element).find('img').addClass("begin");
// iterate over images based on container height
i = Math.floor(($(window).scrollTop() - ($(element).offset().top - 600)) / scrollInterval);
$(element).find('img').attr('src', images[i]);
// animate circles in
if (i > (images.length - 40)) {
$(element).find('.circle').addClass('active');
}
} else {
// set img sequence to display none
// reset circle animation
$(element).find('img').removeClass("begin");
$(element).find('.circle').removeClass('active');
}
return;
}
}
//only init after view has loaded
$scope.$on('$viewContentLoaded', function() {
init();
return;
});
};
return {
restrict: 'A',
link: link
};
}
]);
/**
* just a directive wrapper for a plugin called counter.js
* looks for elements to count based on class 'count-value'
* can use attrs.
*
* @author: Parker Hutchinson
* @requires: prplInview
* @attr: counterStart = integer
* @attr: counterStop = integer
*
*/
ngPRPL.directive('prplCounter', [function() {
var link = function(scope, element, attrs) {
var options = {
useEasing : true,
useGrouping : true,
separator : ',',
decimal : '.'
},
listener,
unlistener,
startAt = parseInt(attrs.counterStart) || 0,
stopAt = parseInt(attrs.counterStop) || 100,
uid = Math.random().toString(36).substr(2, 9);
// do a quick id placement based on element scope id
$(element).find('.count-value').attr("id", "count" + uid);
// create new counter object based on recently created id
// start and stop values from attrs
var counter = new countUp("count" + uid, 0, stopAt, startAt, 2.8, options);
// element enter view listener
var countupListener = function() {
listener = window.setInterval(function() {
if ($(element).hasClass('inviewtop')) {
// run counter
counter.start();
countupUnlistener();
clearInterval(listener);
}
}, 20);
}
// init
countupListener();
// reset
var countupUnlistener = function() {
unlistener = window.setInterval(function() {
if (!$(element).hasClass('inviewtop')) {
countupListener();
counter.reset();
clearInterval(unlistener);
}
}, 20);
}
return;
};
return {
restrict: 'A',
link: link
};
}
]);
/**
* custom adaptation of counter to be used with the footer
* stats on case studies
*
* @author: Parker Hutchinson
* @requires: prplInview
* @attr: startAt = integer
* @attr: stopAt = integer
*
*/
ngPRPL.directive('prplCounterStats', [function() {
var link = function(scope, element, attrs) {
var options = {
useEasing : true,
useGrouping : true,
separator : ',',
decimal : '.'
},
listener,
startAt = parseInt(attrs.counterStart) || 0,
stopAt = parseInt(attrs.counterStop) || 100,
uid = Math.random().toString(36).substr(2, 9),
unlistener;
// console.log(Math.random().toString(36).substr(2,9));
// do a quick id placement based on element scope id
$(element).find('.count-value').attr("id", "count" + uid);
// create new counter object based on recently created id
// start and stop values from attrs
var counter = new countUp("count" + uid, 0, stopAt, startAt, 2.8, options);
// element enter view listener
var countupListener = function() {
listener = window.setInterval(function() {
if ($(element).hasClass('inviewbottom') && $(element).hasClass('step-active')) {
// run counter
counter.start();
countupUnlistener();
clearInterval(listener);
}
}, 20);
}
countupListener();
var countupUnlistener = function() {
unlistener = window.setInterval(function() {
if (!$(element).hasClass('inviewbottom')) {
countupListener();
counter.reset();
clearInterval(unlistener);
}
}, 20);
}
return;
};
return {
restrict: 'A',
link: link
};
}
]);
ngPRPL.directive('prplFsVideo', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
$(element).on({
click: function(e) {
$('body').toggleClass('unlocked').toggleClass('locked');
// CREATION VARS
// var cursorURLClose = "/assets/images/video-cursor-close.png";
var chapterCount = 1;
var el = "";
var isPaused = false;
var fsvLoop;
var fsvLoopDelay = 200;
var fsvProgress = 0;
var fsvDuration = 0;
var fsvHover = false;
// MOBILE REDIRECT
if (jqHTML.hasClass('touch')) {
window.open(attrs.videoMp4);
return false;
}
var randomCacheBuster = '?' + Math.floor(Math.random() * (100 - 1) + 1);
// THE HTML
el += '<aside class="prpl-fsv-wrapper intro">';
el += '<video id="prplFSV" class="prpl-fsv" preload="auto" poster="' + attrs.videoPoster + '" autoplay >';
el += '<source src="' + attrs.videoWebm + randomCacheBuster + '" type="video/webm;">';
el += '<source src="' + attrs.videoMp4 + randomCacheBuster + '" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;">';
el += '</video>';
el += '<div id="fsvVideoControls">';
el += '<div id="fsvSeekBar" class="seek-bar">';
el += '<div id="fsvInnerSeekBar" class="inner-bar">';
el += '<div id="fsvPlayHead" class="play-head">';
el += '<a id="fsvPlayPause" href="javascript:;" class="play-pause"><i class="icon-pause"></i></a>';
el += '<span id="fsvElapsedTime" class="elapsed-time">0:00</span>';
el += '</div>';
el += '</div>';
el += '<div id="fsvChapters" class="chapters">';
el += '<a id="fsvChapter' + chapterCount++ + '" href="javascript:;" class="fsv-chapter chapter-1"></a>';
el += '<a id="fsvChapter' + chapterCount++ + '" href="javascript:;" class="fsv-chapter chapter-2"></a>';
el += '<a id="fsvChapter' + chapterCount++ + '" href="javascript:;" class="fsv-chapter chapter-3"></a>';
el += '<a id="fsvChapter' + chapterCount++ + '" href="javascript:;" class="fsv-chapter chapter-4"></a>';
el += '<a id="fsvChapter' + chapterCount++ + '" href="javascript:;" class="fsv-chapter chapter-5"></a>';
el += '</div>';
el += '</div>';
el += '</div>';
el += '<a id="fsvFullscreen"><i class="icon-popup"></i></a>';
if (attrs.id == "process") {
el += '<div id="fsvTitle" style="display: none;"><span>Bobby Jones</span> <em>Founder & CEO</em></div>'
};
el += '</aside>';
// add to DOM
$(element).parent().append(el);
$('#site-header').addClass('go-away');
// setTimeout(function(){
// $('.prpl-fsv-wrapper').removeClass('intro');
// }, 100)
// start interval loop
fsvEventLoop();
// JS/JQ DOM SELECTORS
// var jqWin // mine is globes
var jqFSVWrapper = $('.prpl-fsv-wrapper');
var jsFSVVideo = document.getElementById('prplFSV');
jsFSVVideo.addEventListener('canplaythrough', function() {
setTimeout(function() {
// console.log('doge video logeded', jsFSVVideo.readyState);
// console.info(jsFSVVideo.videoWidth, jsFSVVideo.videoHeight);
jqWin.trigger('resize');
$('.prpl-fsv-wrapper').removeClass('intro');
}, 250);
}, false);
jsFSVVideo.addEventListener('ended', function() {
fsvExit();
}, false);
// VIDEO EVENT LISTENERS
$('#prplFSV', jqFSVWrapper).on({
click: function(e) {
fsvExit();
}
});
// WINDOW EVENT LISTENERS
jqWin.on({
keyup: function(e) {
var keyCode = e.keyCode;
var esc = (keyCode === 27) ? true : false;
var enter = (keyCode === 13) ? true : false;
var space = (keyCode === 32) ? true : false;
if (esc) {
fsvExit();
}
if (space) {
fsvTogglePause();
}
},
resize: function(e) {
fsvResizeHandler(e);
}
});
var jqChild = $(jsFSVVideo);
var jqParent = jqFSVWrapper;
// CONTROLS EVENT LISTENERS
$('.seek-bar', jqFSVWrapper).on({
click: function(e) {
// console.log(e.target);
var jqTarget = $(e.target);
if ( jqTarget.hasClass('seek-bar') || jqTarget.hasClass('inner-bar') ) {
fsvSeek(e);
} else {
fsvTogglePause();
}
}
});
$('#fsvFullscreen').on({
click: function(e) {
fsvFullscreen();
}
})
function fsvTogglePause() {
if (isPaused) {
fsvPlay();
} else {
fsvPause();
}
}
function fsvPlay() {
jsFSVVideo.play();
fsvUpdateCSS('playing');
fsvSetIsPaused(false);
}
function fsvPause() {
jsFSVVideo.pause();
fsvUpdateCSS('paused');
fsvSetIsPaused(true);
}
function fsvStop() {
jsFSVVideo.pause();
jsFSVVideo.currentTime = 0;
window.clearInterval(fsvLoop);
}
function fsvGoTo(perc) {
if (typeof perc === 'undefined') {
return false;
}
var target = ( fsvDuration / 100 ) * perc ;
fsvSetPlayhead(target);
fsvUpdateCSS('percent', perc);
}
function fsvSetPlayhead(toWhat) {
jsFSVVideo.currentTime = toWhat;
var clean = secondsToHms(toWhat);
$('.elapsed-time', jqFSVWrapper).html(clean);
}
function fsvExit() {
fsvStop();
$('body').toggleClass('unlocked').toggleClass('locked');
jqFSVWrapper.addClass('intro');
setTimeout(function() {
jqFSVWrapper.remove();
$('#site-header').removeClass('go-away');
}, 200);
fsvUpdateCSS('exit');
jqWin.off('keyup');
$('#prplFSV', jqFSVWrapper).off('click');
}
function fsvEventLoop() {
clearInterval(fsvLoop);
fsvLoop = setInterval(function() {
if (!isPaused) {
fsvUpdateDuration();
if (fsvDuration > 0) {
if (attrs.id == "process") {
if (jsFSVVideo.currentTime > 7 && jsFSVVideo.currentTime < 14.5) {
$('#fsvTitle').css({
bottom: '9%',
right: '4%',
display: 'block'
})
}
if (jsFSVVideo.currentTime > 14.5 && jsFSVVideo.currentTime < 15.5) {
$('#fsvTitle').css({
display: 'none'
});
}
if (jsFSVVideo.currentTime > 32 && jsFSVVideo.currentTime < 35) {
$('#fsvTitle span').html('Michael Parler');
$('#fsvTitle em').html('Vice President')
}
if (jsFSVVideo.currentTime > 35.5 && jsFSVVideo.currentTime < 44) {
$('#fsvTitle').css({
bottom: '9%',
left: '4%',
display: 'block'
})
}
if (jsFSVVideo.currentTime > 44.1 && jsFSVVideo.currentTime < 45) {
$('#fsvTitle').css({
display: 'none'
});
}
if (jsFSVVideo.currentTime > 50 && jsFSVVideo.currentTime < 51) {
$('#fsvTitle span').html('Erin Butler');
$('#fsvTitle em').html('Brand & Content Strategist')
}
if (jsFSVVideo.currentTime > 52 && jsFSVVideo.currentTime < 55) {
$('#fsvTitle').css({
bottom: '9%',
left: '4%',
display: 'block'
})
}
if (jsFSVVideo.currentTime > 55.3 && jsFSVVideo.currentTime < 57) {
$('#fsvTitle').css({
display: 'none'
});
}
if (jsFSVVideo.currentTime > 72 && jsFSVVideo.currentTime < 73) {
$('#fsvTitle span').html('Jim Powell');
$('#fsvTitle em').html('Director of Technology')
}
if (jsFSVVideo.currentTime > 73 && jsFSVVideo.currentTime < 77) {
$('#fsvTitle').css({
bottom: '9%',
left: '4%',
display: 'block'
})
}
if (jsFSVVideo.currentTime > 77.1 && jsFSVVideo.currentTime < 78) {
$('#fsvTitle').css({
display: 'none'
});
}
if (jsFSVVideo.currentTime > 91 && jsFSVVideo.currentTime < 93) {
$('#fsvTitle span').html('Kristina Doyle');
$('#fsvTitle em').html('Director of Marketing')
}
if (jsFSVVideo.currentTime > 93 && jsFSVVideo.currentTime < 95) {
$('#fsvTitle').css({
bottom: '9%',
left: '4%',
display: 'block'
})
}
if (jsFSVVideo.currentTime > 95.4 && jsFSVVideo.currentTime < 97) {
$('#fsvTitle').css({
display: 'none'
});
}
}
fsvUpdateProgress(jsFSVVideo.currentTime);
}
}
}, fsvLoopDelay);
}
function fsvUpdateProgress(timeElapsed) {
if (typeof timeElapsed === 'undefined') {
return false;
}
if (fsvProgress !== timeElapsed) {
fsvProgress = timeElapsed;
fsvUpdateCSS('progress');
var clean = secondsToHms(timeElapsed);
$('.elapsed-time', jqFSVWrapper).html(clean);
}
}
function fsvUpdateDuration() {
if (fsvDuration !== jsFSVVideo.duration) {
fsvDuration = jsFSVVideo.duration;
}
}
function fsvSetIsPaused(toWhat) {
if (typeof toWhat === 'undefined') {
return false;
} else {
isPaused = toWhat;
return true;
}
}
function fsvUpdateCSS(state, newVal) {
if (typeof state === 'undefined') {
return false;
} else if ( state === 'progress') {
var newHeight = (100 / fsvDuration) * fsvProgress;
newHeight = Math.round( newHeight * 10) / 10
$('.inner-bar', jqFSVWrapper).css({
height: newHeight + "%"
});
} else if ( state === 'percent' && typeof newVal !== 'undefined') {
newVal = Math.floor(newVal);
$('.inner-bar', jqFSVWrapper).css({
height: newVal + '%'
});
} else if ( state === 'playing') {
$('.play-pause i', jqFSVWrapper).removeClass('icon-play').addClass('icon-pause');
} else if ( state === 'paused') {
$('.play-pause i', jqFSVWrapper).removeClass('icon-pause').addClass('icon-play');
} else if ( state === 'exit') {
jqBody.removeClass('view-no-scroll');
} else if (state === 'height' && newVal !== 'undefined') {
newVal = Math.floor(newVal);
jqChild.css({
'width': 'auto',
'height': '100%',
'margin-left': '-' + newVal / 2 + 'px',
'margin-top': 0
})
} else if (state === 'width' && newVal !== 'undefined') {
newVal = Math.floor(newVal);
jqChild.css({
'width': '100%',
'height': 'auto',
'margin-top': '-' + newVal / 2 + 'px',
'margin-left': 0
});
}
}
function fsvSeek(e) {
if (typeof e === 'undefined') {
return false;
}
var winH = jqWin.height();
var clickH = e.offsetY;
var killaBeez = (100 / winH) * clickH;
fsvGoTo(killaBeez);
// console.log(winH, clickH, killaBeez);
}
function fsvGoToChapter(num) {
// console.info('good luck haha', num, $('.fsv-chapter'));
}
function fsvResizeHandler(e) {
var cw = jqChild.width();
var ch = jqChild.height();
var pw = jqParent.width();
var ph = jqParent.height();
var cr = ch / cw;
var pr = ph / pw;
var diffw = cw - pw;
var diffh = ch - ph;
// console.log('video width', cw, 'video height', ch);
// console.log('container width', pw, 'container height', ph);
// console.log(cr, pr, diffw, diffh);
if (cr < pr) {
// console.info('heighttoo short');
fsvUpdateCSS('height', diffw);
} else {
// console.info('width too short');
// bgvUpdateCSS('reset');
fsvUpdateCSS('width', diffh);
}
}
function fsvFullscreen() {
if (jsFSVVideo.requestFullScreen) {
jsFSVVideo.requestFullScreen();
} else if (jsFSVVideo.webkitRequestFullScreen) {
jsFSVVideo.webkitRequestFullScreen();
} else if (jsFSVVideo.mozRequestFullScreen) {
jsFSVVideo.mozRequestFullScreen();
}
}
}
})
};
return {
restrict: 'A',
link: linkFn
}
}
]);
ngPRPL.directive('prplBgv', ['$timeout', function($timeout) {
return {
restrict: 'E',
link: function(scope, element, attrs) {
// DOM Referneces
var jqTarget = $(element);
var jqChildren = $(element).children(); //appended at the end
// HTML String
var el = '';
// HTML Id for vanilla javascript load listener
var tmpID = 'bgv_';
tmpID += randomString(6);
// Customization
var vidAttrs = {
htmlClass: (exists(attrs.class)) ? attrs.class : false,
id: (exists(attrs.id)) ? attrs.id : false,
poster: (exists(attrs.poster)) ? attrs.poster : false,
preload: (exists(attrs.preload)) ? attrs.preload : false,
loop: (exists(attrs.loop)) ? true : false,
muted: (exists(attrs.muted)) ? true : false,
autoplay: (exists(attrs.autoplay)) ? true : false,
overlay: (exists(attrs.overlay)) ? attrs.overlay : false,
overlayOpacity: (exists(attrs.overlayOpacity)) ? attrs.overlayOpacity : false,
viewportResize: (exists(attrs.viewportResize)) ? attrs.viewportResize : false,
viewportMin: (exists(attrs.viewportMin)) ? attrs.viewportMin : false
};
// console.log(vidAttrs);
// Build customized HTML
el = '<div class="prpl-bgv-container intro"><video ';
// copied attributes
if (vidAttrs.htmlClass !== false) {
el += 'class="' + vidAttrs.htmlClass + ' prpl-bgv-generated" '
}
// if(vidAttrs.id !== false){ el += 'id="' + vidAttrs.id + '" ' }
el += 'id="' + tmpID + '" '
if (vidAttrs.poster !== false) {
el += 'poster="' + vidAttrs.poster + '" '
}
if (vidAttrs.preload !== false) {
el += 'preload="' + vidAttrs.preload + '" '
}
if (vidAttrs.loop !== false) {
el += 'loop="' + vidAttrs.loop + '" '
}
if (vidAttrs.muted !== false) {
el += 'muted="' + vidAttrs.muted + '" '
}
if (vidAttrs.autoplay !== false) {
el += 'autoplay'
}
el += '></video>';
// color overlay if specified
if (vidAttrs.overlay !== false) {
if (vidAttrs.overlayOpacity == false) {
vidAttrs.overlayOpacity = 1;
}
el += '<div class="bgv-color-overlay ' + vidAttrs.overlay + '" style="opacity:' + vidAttrs.overlayOpacity + '"></div>';
}
el += '</div>';
// console.info(el);
// Add to <video> to DOM, remove <prpl-bgv> element
// Don't run on touch devices
if (jqHTML.hasClass('touch')) {
el = '<div class="prpl-bgv-container intro"><div class="prpl-bgv-generated prpl-bgv-mobile"></div></div>'
}
jqTarget.before(el).parent().find('.prpl-bgv-generated').html(jqChildren);
jqTarget.remove();
// Updated DOM Refs with video tag added
var jqGenerated = $('.prpl-bgv-generated');
jqGenerated.removeClass('prpl-bgv-generated');
var jqChild = jqGenerated;
var jqParent = jqGenerated.parent();
var jqCoverParent = jqParent.parent();
var vidRef = jqChild[0];
// vidRef.pause();
// console.info(vidRef);
// cover video stuff
if (vidAttrs.viewportResize !== false) {
bgvUpdateCSS('viewport-height');
}
// RESIZING
$(window).on({
resize: function() {
if (vidAttrs.viewportResize !== false) {
bgvUpdateCSS('viewport-height');
}
resizeHandler();
}
});
function resizeHandler(e) {
var cw = jqChild.width();
var ch = jqChild.height();
var pw = jqParent.width();
var ph = jqParent.height();
if ( ch === 0 || ph === 0) {
// console.log('handler still attached after navigating to another page, using .off(resize) breaks the careers page proper');
return false;
}
// console.log(cw, ch, pw, ph);
var cr = ch / cw;
var pr = ph / pw;
var diffw = cw - pw;
var diffh = ch - ph;
if (cr < pr) {
bgvUpdateCSS('height', diffw);
} else {
bgvUpdateCSS('width', diffh);
}
// console.info('child ratio', cr, 'parent ratio', pr, 'diff w', diffw, 'diff h', diffh);
}
// Load handling
vidRef.addEventListener('durationchange', function() {
// vidRef.play();
$timeout(function() {
jqParent.removeClass('intro');
$('.the-reasons .prpl-bgv').removeClass('intro');
}, 800);
// setTimeout(function(){
// console.info('durationchange');
// jqParent.css({ 'opacity': 1 });
$(window).trigger('resize');
// }, 1000)
}, false);
// Update CSS Settings (on resize only at this point)
function bgvUpdateCSS(state, offset) {
// console.info(state, offset);
if (typeof state === 'undefined') {
return false;
}
if (state === 'height' && offset !== 'undefined') {
jqChild.css({
'width': 'auto',
'height': '100%',
'margin-left': '-' + offset / 2 + 'px',
'margin-top': 0
})
} else if (state === 'width' && offset !== 'undefined') {
jqChild.css({
'width': '100%',
'height': 'auto',
'margin-top': '-' + offset / 2 + 'px',
'margin-left': 0
});
} else if (state === 'viewport-height') {
var winH = $(window).height(),
winW = $(window).width();
if (winW < 770) {
jqCoverParent.css({
'min-height': 'none'
});
return false;
};
if (vidAttrs.viewportMin !== false) {
if (vidAttrs.viewportMin >= winH) {
jqCoverParent.css({
'min-height': vidAttrs.viewportMin + 'px'
});
} else {
jqCoverParent.css({
'min-height': $(window).height() + 'px'
});
}
} else {
jqCoverParent.css({
'min-height': $(window).height() + 'px'
});
}
} else if (state === 'reset') {
jqChild.removeAttr('style');
}
}
}
}
}
]);
ngPRPL.directive('jqScrollTo', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
// console.warn('jqscrollto');
var scrollSelector, scrollDuration, scrollEasing, scrollOffset;
if (typeof attrs.scrollSelector === 'undefined') {
return false;
} else {
scrollSelector = attrs.scrollSelector;
}
if (typeof attrs.scrollDuration === 'undefined') {
scrollDuration = 800;
} else {
scrollDuration = Number(attrs.scrollDuration);
}
if (typeof attrs.scrollEasing === 'undefined') {
scrollEasing = 'easeInOutExpo';
} else {
scrollEasing = attrs.scrollEasing;
}
if (typeof attrs.scrollOffset === 'undefined') {
scrollOffset = 0;
} else {
scrollOffset = attrs.scrollOffset;
}
var $targets = $(element);
$targets.off('click').on({
click: function(e) {
var $e = $(e.currentTarget);
// console.info(scrollSelector, scrollDuration, scrollEasing, scrollOffset);
// if(typeof $e.data().scrollTo === 'undefined'){ return false; }
$.scrollTo(scrollSelector, scrollDuration, {
'easing': scrollEasing,
'offset': scrollOffset
});
return false;
}
});
}
}
}
]);
ngPRPL.directive('prplFixedNav', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
// centerFixedPRPLNav(element);
// jqWin.on({ resize: function(e){ centerFixedPRPLNav(element); } });
};
return {
restrict: 'A',
link: linkFn
}
}
]);
ngPRPL.directive('navImageSwap', [function() {
var linkFn;
linkFn = function(scope, element, attrs) {
// console.info('iran', $(element).find('a'));
$(element).find('a').on({
mouseover: function(e) {
var recentSlug = $(e.currentTarget).data().recentWork || false;
if (recentSlug === false) {
return false;
}
$(e.currentTarget).addClass('in-focus');
$('.case-study-nav .recents ul').addClass('link-focus');
$('.case-study-nav .images-to-swap [data-recent-work="' + recentSlug + '"]').addClass('hovered');
},
mouseout: function(e) {
$('.case-study-nav .recents .hover-nav').removeClass('in-focus');
$('.case-study-nav .recents ul').removeClass('link-focus');
$('.case-study-nav .images-to-swap [data-recent-work]').removeClass('hovered');
}
})
};
return {
restrict: 'A',
link: linkFn
}
}
]);
ngPRPL.directive('hasProgIndicator', [ '$timeout', function($timeout) {
function updateProgBar(perc, dir) {
// console.info(perc, dir);
$("#progress-indicator .bar-highlight").css({
'height': perc + '%'
});
}
return {
restrict: 'A',
link: function() {
$timeout(function() {
var self = this;
self.html = '';
self.customPOI = [];
var jqPOI = $('.ng-view-wrap').last().find('[data-prpl-poi]');
// console.log(jqPOI)
if (jqPOI.length < 2) {
return false;
}
for (var i = 0; i < jqPOI.length; i++) {
var data = $(jqPOI[i]).data();
var tmp = {};
tmp.text = data.prplPoi;
tmp.tooltipText = spacesToNBSP(data.prplPoi);
tmp.selector = $(jqPOI[i]).attr('class');
tmp.selectorAlt = "[data-prpl-poi='" + data.prplPoi + "']";
self.customPOI.push(tmp);
};
var poiLength = self.customPOI.length;
var segmentH = 40;
if (poiLength > 10) {
if (poiLength > 16) {
segmentH = 20;
} else {
segmentH = 30;
}
}
self.cssValues = {
'segmentHeight': segmentH,
'count': poiLength,
'totalHeight': segmentH * (poiLength - 1)
}
var elDefault, elHighlight, elHitbox;
elDefault = '<div class="bar-default">';
elHighlight = '<div class="bar-highlight">';
elHitbox = '<div class="prog-tooltips">';
elDefault += '<span class="prog-bar"></span>';
elHighlight += '<span class="prog-bar"></span>';
elDefault += '<div class="prog-dots">';
elHighlight += '<div class="prog-dots">';
for (var i = 0; i < poiLength; i++) {
elDefault += '<span style="top:' + (self.cssValues.segmentHeight * i) + 'px;" class="prog-dot pd' + (i + 1) + '"></span>';
elHighlight += '<span style="top:' + (self.cssValues.segmentHeight * i) + 'px;" class="prog-dot pd' + (i + 1) + '"></span>';
elHitbox += '<a href="javascript:;" style="height:' + (self.cssValues.segmentHeight) + 'px;" class="hitbox" data-poi-index="' + i + '" data-poi-selector="' + self.customPOI[i].text + '">';
elHitbox += '<span class="text-wrap"><span class="the-text">' + self.customPOI[i].tooltipText + '</span></span>'
elHitbox += '</a>';
};
elDefault += '</div>';
elHighlight += '</div>';
elDefault += '</div>';
elHighlight += '</div>';
elHitbox += '</div>';
self.html = elDefault + elHighlight + elHitbox;
$('#progress-indicator .points-of-interest').html('').html(self.html);
$('#progress-indicator, #progress-indicator .points-of-interest').css({
'height': self.cssValues.totalHeight + 'px'
});
$('#progress-indicator .points-of-interest a.hitbox').off('click').on({
click: function(e) {
var sSelector, sDuration, sEasing, sOffset;
sSelector = '[data-prpl-poi="' + $(e.currentTarget).attr('data-poi-selector') + '"]';
sDuration = 800;
sEasing = 'easeInOutExpo';
sOffset = 0;
// $.scrollTo(sSelector, sDuration, {'easing': sEasing, 'offset': sOffset});
$(sSelector).velocity("scroll", {
duration: 750,
easing: "easeInOutCirc"
})
},
mouseover: function(e) {
$(e.currentTarget).addClass('hovered');
},
mouseout: function(e) {
$(e.currentTarget).removeClass('hovered');
}
});
for (var i = 0; i < self.customPOI.length; i++) {
$(self.customPOI[i].selectorAlt).waypoint('destroy');
$(self.customPOI[i].selectorAlt).waypoint(function(direction) {
// alert('waypointin');
// console.log(this, direction)
if (direction == 'up') {
var target = this;
var data = $(target).data();
var sel = '[data-poi-selector="' + data.prplPoi + '"]';
var selData = $(sel).data();
// console.info(sel, selData);
if (exists(selData)) {
if (exists(selData.poiIndex)) {
var currentPOI = selData.poiIndex;
var totalPOIs = (self.cssValues.count - 1);
var progPercent = (100 / totalPOIs) * currentPOI;
// console.log(currentPOI, totalPOIs, progPercent);
//console.log('update!', this);
$timeout(function() {
updateProgBar(progPercent, direction);
}, 100)
} else {
return false;
}
} else {
return false;
}
} else if (direction == 'down') {
var target = this;
var data = $(target).data();
var sel = '[data-poi-selector="' + data.prplPoi + '"]';
var selData = $(sel).data();
if (exists(selData)) {
if (exists(selData.poiIndex)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment