Skip to content

Instantly share code, notes, and snippets.

@neftaly
Created February 18, 2015 11:53
Show Gist options
  • Select an option

  • Save neftaly/5495d07d70c0b664c946 to your computer and use it in GitHub Desktop.

Select an option

Save neftaly/5495d07d70c0b664c946 to your computer and use it in GitHub Desktop.
Hydro (1.0.0)? - unminified
/*! HYDRO 1.0.0 (2014-10-27) | (c) 2014 hydroweb.co.nz */
Array.prototype.forEach || (Array.prototype.forEach = function(a, b) {
var c, d;
if (null == this) throw new TypeError(" this is null or not defined");
var e = Object(this),
f = e.length >>> 0;
if ("function" != typeof a) throw new TypeError(a + " is not a function");
for (arguments.length > 1 && (c = b), d = 0; f > d;) {
var g;
d in e && (g = e[d], a.call(c, g, d, e)), d++
}
}), Array.prototype.indexOf || (Array.prototype.indexOf = function(a, b) {
var c;
if (null == this) throw new TypeError('"this" is null or not defined');
var d = Object(this),
e = d.length >>> 0;
if (0 === e) return -1;
var f = +b || 0;
if (1 / 0 === Math.abs(f) && (f = 0), f >= e) return -1;
for (c = Math.max(f >= 0 ? f : e - Math.abs(f), 0); e > c;) {
if (c in d && d[c] === a) return c;
c++
}
return -1
}), window.matchMedia || (window.matchMedia = function() {
"use strict";
var a = window.styleMedia || window.media;
if (!a) {
var b = document.createElement("style"),
c = document.getElementsByTagName("script")[0],
d = null;
b.type = "text/css", b.id = "matchmediajs-test", c.parentNode.insertBefore(b, c), d = "getComputedStyle" in window && window.getComputedStyle(b, null) || b.currentStyle, a = {
matchMedium: function(a) {
var c = "@media " + a + "{ #matchmediajs-test { width: 1px; } }";
return b.styleSheet ? b.styleSheet.cssText = c : b.textContent = c, "1px" === d.width
}
}
}
return function(b) {
return {
matches: a.matchMedium(b || "all"),
media: b || "all"
}
}
}()),
function() {
if (window.matchMedia && window.matchMedia("all").addListener) return !1;
var a = window.matchMedia,
b = a("only all").matches,
c = !1,
d = 0,
e = [],
f = function() {
clearTimeout(d), d = setTimeout(function() {
for (var b = 0, c = e.length; c > b; b++) {
var d = e[b].mql,
f = e[b].listeners || [],
g = a(d.media).matches;
if (g !== d.matches) {
d.matches = g;
for (var h = 0, i = f.length; i > h; h++) f[h].call(window, d)
}
}
}, 30)
};
window.matchMedia = function(d) {
var g = a(d),
h = [],
i = 0;
return g.addListener = function(a) {
b && (c || (c = !0, window.addEventListener("resize", f, !0)), 0 === i && (i = e.push({
mql: g,
listeners: h
})), h.push(a))
}, g.removeListener = function(a) {
for (var b = 0, c = h.length; c > b; b++) h[b] === a && h.splice(b, 1)
}, g
}
}(), String.prototype.trim || (String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "")
}),
function() {
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var a = document.createElement("style");
a.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")), document.getElementsByTagName("head")[0].appendChild(a)
}
}(), window.Class = function() {
var a = 0,
b = 0,
c = !0,
d = function() {},
e = function() {
return !0
},
f = function() {
return !1
};
return function(g) {
var h = function() {
if (c) {
if (l) throw new Error("Base class cannot be instantiated");
this.classID = h.classID, this.instanceID = b++, this.init.apply(this, arguments)
}
};
switch (typeof g) {
case "object":
break;
case "function":
var i = {};
g.call(i, h), g = i, i = null;
break;
default:
throw new TypeError("Class may only be created from a plain object or function")
}
var j, k = null,
l = g.Base === !0,
m = g.Final === !0;
if (delete g.Base, delete g.Final, "function" == typeof g.Extends) {
if (k = g.Extends, k.isFinalClass()) throw new Error("Extending class is marked as final and may not be extended");
c = !1, j = new k, c = !0
} else j = h.prototype || {};
delete g.Extends;
for (var n in g) g.hasOwnProperty(n) && (j[n] = g[n]);
return "function" != typeof j.init && (j.init = d), h.classID = a++, j.constructor = h, h.prototype = j, h.fn = j, h.superClass = k, h.isBaseClass = l ? e : f, h.isFinalClass = m ? e : f, h
}
}(), window.Emitter = Class({
on: function(a, b) {
this._events || (this._events = {}), this._events.hasOwnProperty(a) || (this._events[a] = []);
var c = this._events[a];
c.push(b)
},
one: function(a, b) {
b._one = !0, this.on(a, b)
},
off: function(a, b) {
if (this._events && this._events[a]) {
if (!b) return void delete this._events[a];
for (var c = this._events[a], d = [], e = 0; e < c.length; e++) c[e] !== b && d.push(c[e]);
this._events[a] = d
}
},
trigger: function(a) {
if (this._events && this._events[a]) {
var b = Array.prototype.slice.call(arguments, 1),
c = this._events[a],
d = [];
this._events[a] = d;
for (var e = 0; e < c.length; e++) {
var f = c[e].apply(this, b);
c[e]._one || f === !1 || d.push(c[e])
}
}
}
}), window.hydro = {
version: "2.0.0"
}, window.system = {}, window.modules = {}, window.info = new Emitter, window.support = {}, window.utility = {}, window.context = new Emitter, window.classes = {}, modules.Interface = {
refresh: Function,
reset: Function,
setup: Function
},
function() {
var a = document.documentElement;
a.className = a.className.replace(/\bno-js\b/, "js")
}(), window.readyFunctions = [], window.$ = function(a) {
readyFunctions.push(a)
}, window.settings = {
debug: !0,
baseURL: "//" + location.host,
dateFormat: "ll",
theme: "default",
delimiters: ["[", "]"],
vuePrefix: "data-v",
notifyTypes: ["message", "warning", "error", "success"],
scrollDuration: 600,
scrollTiming: "ease-in-out",
classPrefixes: {
state: "is-",
option: "opt-"
}
}, utility.camelCase = function(a) {
return a.replace(/-([a-z])/gi, function(a, b) {
return b.toUpperCase()
})
}, utility.compare = function(a, b, c) {
if (a === !1) return c;
var d = a;
"string" == typeof b && (b = " " + b + " ", d = " " + a + " ");
var e = b.indexOf(d);
return e > -1 ? a : c
}, utility.each = function(a, b, c) {
var d, e = 0,
f = a.length;
if (c)
if (void 0 === f) {
for (d in a)
if (b.apply(a[d], c) === !1) break
} else
for (; f > e && b.apply(a[e++], c) !== !1;);
else if (void 0 === f) {
for (d in a)
if (b.call(a[d], d, a[d]) === !1) break
} else
for (var g = a[0]; f > e && b.call(g, e, g) !== !1; g = a[++e]);
return a
}, utility.eventOptions = function(a, b, c, d, e) {
var f = b + "-" + c;
$("[data-" + f + "]", a).each(function() {
var a = $(this),
g = utility.parseOptions(a.attr("data-" + f) || "@this");
utility.each(g, function(f, g) {
g = g || "click", g && "object" == typeof g && g.length && (g = g.join(" "));
var h;
"@this" == f ? e ? h = e : (h = a.data(b), h || (h = a.closest("[data-" + b + "]").data(b))) : h = $("#" + f).data(b), h && a.on(g, d ? function(b) {
d.call(a, b, h, f, g)
} : function(a) {
a.preventDefault();
var b = utility.camelCase(c);
h[b]()
})
})
})
},
function() {
var a, b;
if (window.requestAnimationFrame) a = window.requestAnimationFrame, b = window.cancelAnimationFrame || window.cancelRequestAnimationFrame;
else {
for (var c = ["ms", "moz", "webkit", "o"], d = 0; d < c.length && !a; ++d) a = window[c[d] + "RequestAnimationFrame"], b = window[c[d] + "CancelAnimationFrame"] || window[c[d] + "CancelRequestAnimationFrame"];
if (!a) {
var e = 0;
a = function(a) {
var b = (new Date).getTime(),
c = Math.max(0, 16 - (b - e)),
d = setTimeout(function() {
a(b + c)
}, c);
return e = b + c, d
}, b = function(a) {
clearTimeout(a)
}
}
}
utility.frame = function(b) {
return a(b)
}, utility.frames = function(a) {
var b, c = !0,
d = function() {
c && (b = utility.frame(d)), a()
};
return d(), {
cancel: function() {
c = !1, utility.unframe(b)
}
}
}, utility.unframe = function(a) {
return b(a)
}
}(), utility.htmlAddClass = function(a) {
for (var b = document.documentElement, c = b.className.split(/\s+/), d = 0; d < c.length; d++)
if (c[d] == a) return;
c.push(a), b.className = c.join(" ")
}, utility.htmlHasClass = function(a) {
for (var b = document.documentElement, c = b.className.split(/\s+/), d = 0; d < c.length; d++)
if (c[d] == a) return !0;
return !1
}, utility.htmlReplaceClass = function(a, b) {
for (var c = document.documentElement, d = c.className.split(/\s+/), e = 0; e < d.length; e++)
if (d[e] == a) {
d[e] = b;
break
}
c.className = d.join(" ")
}, utility.htmlRemoveClass = function(a) {
utility.htmlReplaceClass(a, "")
}, utility.moduleContext = function(a, b, c, d) {
context.on("load", function(e) {
if ($("[data-" + b + "]", e.contextElement).each(function() {
var c = $(this),
d = utility.parseOptions(c.attr("data-" + b)),
e = new a(c, d);
c.data(b, e)
}), c && c.length)
for (var f = 0; f < c.length; f++) utility.eventOptions(e.contextElement, b, c[f]);
"function" == typeof d && d(e.contextElement)
})
}, utility.optionFilters = {
em: function(a) {
return a instanceof utility.UnitNumber ? a.toEm() : a
}
},
function() {
utility.parseOptions = function(a) {
var b = {};
if (!a) return b;
var c = [];
a = a.replace(/(["'])(\\?.)*?\1/g, function(a) {
return a = a.replace(/\\(["'])/g, "$1"), a = a.substring(1, a.length - 1), c.push(a), '"'
});
for (var d = a.split(/\s*;\s*/), e = 0; e < d.length; e++) {
var f, g = d[e].split(/\s*:\s*/),
h = g[0],
i = g[1] || "",
j = [];
if (i.indexOf("|") > -1 && (j = i.split(/\s*\|\s*/), i = j.shift()), /[,\s]/.test(i))
for (i = i.split(/\s*[,\s]\s*/g), f = 0; f < i.length; f++) i[f] = utility.parseOptionValue(i[f], c);
else i = utility.parseOptionValue(i, c);
for (f = 0; f < j.length; f++) {
var k = j[f];
k && utility.optionFilters[k] && (i = utility.optionFilters[k](i))
}
h && (b[h] = i)
}
return b
}, utility.parseOptionValue = function(a, b) {
if (!a) return null;
if (!isNaN(a)) return parseFloat(a);
switch (a) {
case "true":
case "on":
case "yes":
return !0;
case "false":
case "off":
case "no":
return !1
}
if (a.indexOf('"') > -1 && "object" == typeof b) return a.replace(/"/g, function() {
return b.length > 0 ? b.shift() : '"'
});
var c = utility.getUnitNumber(a);
return c ? c : a
}
}(),
function() {
var a, b, c = settings.delimiters[0] + settings.delimiters[0],
d = settings.delimiters[1] + settings.delimiters[1];
utility.parseTemplate = function(e, f) {
a || (a = utility.regexpEscape(c) + "\\s*"), b || (b = "\\s*" + utility.regexpEscape(d));
for (var g in f)
if (f.hasOwnProperty(g)) {
var h = new RegExp(a + utility.regexpEscape(g) + b, "g");
e = e.replace(h, f[g])
}
return e
}
}(),
function() {
var a = /[^\s]+/g;
utility.prefixClass = function(b, c) {
var d = settings.classPrefixes[b];
return d ? c.replace(a, d + "$&") : c
}
}(), utility.regexpEscape = function(a) {
return a.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
}, utility.test = {
CSS: {
el: document.createElement("div"),
vendors: "webkit moz ms o".split(" "),
value: function(a, b) {
var c;
if ("string" == typeof b) c = a + ":" + b + ";";
else {
c = [];
for (var d = 0; d < b.length; d++) c.push(a, ":", b[d], ";");
c = c.join("")
}
this.el.style.cssText = c;
var e = !!this.el.style.length;
return this.el.style.cssText = "", e
},
property: function(a, b) {
var c, d, e = this.el.style,
f = [a];
if (b)
for (c = 0; c < this.vendors.length; c++) {
var g = this.vendors[c];
d = g + "-" + a, f.push(d, "-" + d)
}
for (c = 0; c < f.length; c++)
if (d = utility.camelCase(f[c]), "string" == typeof e[d]) return d;
return !1
}
}
},
function() {
utility.UnitNumber = function(a, b) {
this.number = a, this.unit = b
};
var a = utility.UnitNumber.prototype;
a.toString = function() {
return this.number + "" + this.unit
}, a.toNumber = function() {
return "%" == this.unit ? this.number / 100 : this.number
}, a.is = function(a) {
return this.unit == a
}, a.toEm = function() {
switch (this.unit) {
case "px":
var a = Math.round(parseFloat($.html.css("font-size")));
return new utility.UnitNumber(this.number / a, "em");
case "%":
return new utility.UnitNumber(this.number / 100, "em");
default:
throw new Error("Cannot convert unit of type " + this.unit + " to em.")
}
};
var b = "px em rem % s ms deg rad dpi dppx".split(" "),
c = new RegExp("([0-9.]+)(" + b.join("|") + ")$");
utility.getUnitNumber = function(a) {
if (a instanceof utility.UnitNumber) return a;
var b = a.match(c);
if (!b) return !1;
var d = b[2],
e = b[1];
return isNaN(e) ? !1 : ("s" == d && (e *= 1e3, d = "ms"), new utility.UnitNumber(e, d))
}
}(), utility.viewport = function() {
return {
width: utility.viewportWidth(),
height: utility.viewportHeight()
}
}, utility.viewportWidth = function() {
return document.documentElement.clientWidth || window.innerWidth || document.body.clientWidth
}, utility.viewportHeight = function() {
return document.documentElement.clientHeight || window.innerHeight || document.body.clientHeight
},
function() {
if (window.console && console.log) window.log = function() {
settings.debug && console.log.apply(console, arguments)
};
else {
var a = document.createElement("div"),
b = a.style;
b.position = "fixed", b.bottom = "0", b.left = "0", b.right = "0", b.height = "250px", b.overflow = "auto", b.backgroundColor = "black", b.color = "white", b.fontFamily = "monospace", b.fontSize = "12px", b.padding = "12px", b.zIndex = "9999", b.whiteSpace = "pre-wrap", b.lineHeight = "100%";
var c = !1;
window.log = function() {
if (settings.debug) {
c || ($(function() {
$.body.append(a)
}), c = !0);
for (var b = 0; b < arguments.length; b++) {
var d, e = arguments[b];
if ("object" == typeof e) {
d = [];
for (var f in e) d.push("<br> " + f + ': "' + String(e) + '"');
d = "{ " + d.join(", ") + " }"
}
a.innerHTML += "<p>" + d + "</p>"
}
} else c = !1, a.parentNode && a.parentNode.removeChild(a)
}
}
log.time = function() {
log(+new Date)
}
}(), window.onerror = function() {},
function() {
window.notify = new Emitter, utility.each(settings.notifyTypes, function(a, b) {
notify[b] = function(a, c) {
var d = {
type: b,
message: a,
about: c || "*"
};
this.trigger("all", d), this.trigger(b, d), c && (this.trigger("all." + c, d), this.trigger(b + "." + c, d))
}
}), notify.on("all", function(a) {
log(a.message + " -- " + a.about)
})
}(), info.isTouch = "ontouchstart" in document.documentElement, info.isTouch && utility.htmlAddClass("touch"), info.isIE7 = utility.htmlHasClass("lt-ie8"), info.isIE8 = !info.isIE7 && utility.htmlHasClass("lt-ie9"),
function() {
var a = navigator.userAgent.toLowerCase();
info.isAndroid = a.indexOf("android") > -1, info.isMobile = a.indexOf("mobile") > -1, info.isTablet = a.indexOf("tablet") > -1, info.isDesktop = !info.isMobile && !info.isTablet, info.isChrome = !!window.chrome
}(), info.isAndroid && utility.htmlAddClass("android"), info.isMobile && utility.htmlAddClass("mobile"), info.isTablet && utility.htmlAddClass("tablet"), info.isDesktop && utility.htmlAddClass("desktop"), info.isChrome && utility.htmlAddClass("chrome"), info.language = document.documentElement.lang || "en", info.getResolution = function() {
return window.devicePixelRatio || 1
},
function() {
var a = info.getResolution();
utility.frames(function() {
var b = info.getResolution();
if (b != a) {
var c = {
oldDensity: a,
density: b
};
info.trigger("zoom", c), a > b && info.trigger("zoomOut", c), b > a && info.trigger("zoomIn", c), a = b
}
})
}(), $(function() {
var a = document.createElement("div");
a.style.visibility = "hidden", a.style.width = "100px", document.body.appendChild(a);
var b = a.offsetWidth;
a.style.overflow = "scroll";
var c = document.createElement("div");
c.style.width = "100%", a.appendChild(c);
var d = c.offsetWidth;
a.parentNode.removeChild(a), info.scrollbarWidth = b - d
}), support.calc = utility.test.CSS.value("width", ["-webkit-calc(1px)", "-moz-calc(1px)", "calc(1px)"]), support.calc || utility.htmlAddClass("no-calc"), support.flexbox = utility.test.CSS.value("display", ["-webkit-flex", "-moz-flex", "-ms-flexbox", "flex"]), support.flexbox || utility.htmlAddClass("no-flex"), support.pointerEvents = utility.test.CSS.value("pointer-events", "auto"), support.pushState = !(!window.history || !history.pushState), support.pushState || utility.htmlAddClass("no-push-state"), support.transform = utility.test.CSS.property("transform", !0), support.transform || utility.htmlAddClass("no-transform"), support.transition = utility.test.CSS.property("transition", !0), support.transitionEnd = support.transition && function(a) {
var b, c = document.documentElement,
d = {
transition: "transitionend",
OTransition: "otransitionend",
MozTransition: "transitionend",
WebkitTransition: "webkitTransitionEnd"
};
for (b in d)
if (d.hasOwnProperty(b) && c.style[b] !== a) return d[b];
return !1
}(), support.transition || utility.htmlAddClass("no-transition"), support.validity = !!window.ValidityState;
/*! HYDRO 1.0.0 (2014-10-27) | (c) 2014 hydroweb.co.nz */ ! function() {
function a(a) {
return "string" == typeof a && a.indexOf("*") > -1
}
var b = jQuery.fn.removeClass,
c = jQuery.fn.hasClass,
d = /([a-z0-9\-_]*\*[a-z0-9\-_]*)+/gi,
e = "[a-z0-9\\-_]+";
jQuery.fn.removeClass = function(c) {
if (a(c)) {
var f = [],
g = [];
c = c.replace(d, function(a) {
return g.push(a), ""
});
for (var h = 0; h < g.length; h++) {
var i = g[h];
f.push("(" + i.replace("*", e) + ")")
}
f = new RegExp(f.join("|"), "ig"), this.each(function() {
this.className = this.className.replace(f, "")
})
}
return b.call(this, c)
}, jQuery.fn.hasClass = function(b) {
if (a(b)) {
var d = new RegExp(b.replace("*", e), "ig"),
f = !1;
return this.each(function() {
d.test(this.className) && (f = !0)
}), f
}
return c.call(this, b)
}
}(), jQuery.easing.jswing = jQuery.easing.swing, jQuery.extend(jQuery.easing, {
def: "easeOutQuad",
swing: function(a, b, c, d, e) {
return jQuery.easing[jQuery.easing.def](a, b, c, d, e)
},
easeInQuad: function(a, b, c, d, e) {
return d * (b /= e) * b + c
},
easeOutQuad: function(a, b, c, d, e) {
return -d * (b /= e) * (b - 2) + c
},
easeInOutQuad: function(a, b, c, d, e) {
return (b /= e / 2) < 1 ? d / 2 * b * b + c : -d / 2 * (--b * (b - 2) - 1) + c
},
easeIn: function(a, b, c, d, e) {
return d * (b /= e) * b * b + c
},
easeOut: function(a, b, c, d, e) {
return d * ((b = b / e - 1) * b * b + 1) + c
},
easeInOut: function(a, b, c, d, e) {
return (b /= e / 2) < 1 ? d / 2 * b * b * b + c : d / 2 * ((b -= 2) * b * b + 2) + c
},
easeInElastic: function(a, b, c, d, e) {
var f = 1.70158,
g = 0,
h = d;
if (0 == b) return c;
if (1 == (b /= e)) return c + d;
if (g || (g = .3 * e), h < Math.abs(d)) {
h = d;
var f = g / 4
} else var f = g / (2 * Math.PI) * Math.asin(d / h);
return -(h * Math.pow(2, 10 * (b -= 1)) * Math.sin(2 * (b * e - f) * Math.PI / g)) + c
},
easeOutElastic: function(a, b, c, d, e) {
var f = 1.70158,
g = 0,
h = d;
if (0 == b) return c;
if (1 == (b /= e)) return c + d;
if (g || (g = .3 * e), h < Math.abs(d)) {
h = d;
var f = g / 4
} else var f = g / (2 * Math.PI) * Math.asin(d / h);
return h * Math.pow(2, -10 * b) * Math.sin(2 * (b * e - f) * Math.PI / g) + d + c
},
easeInOutElastic: function(a, b, c, d, e) {
var f = 1.70158,
g = 0,
h = d;
if (0 == b) return c;
if (2 == (b /= e / 2)) return c + d;
if (g || (g = .3 * e * 1.5), h < Math.abs(d)) {
h = d;
var f = g / 4
} else var f = g / (2 * Math.PI) * Math.asin(d / h);
return 1 > b ? -.5 * h * Math.pow(2, 10 * (b -= 1)) * Math.sin(2 * (b * e - f) * Math.PI / g) + c : h * Math.pow(2, -10 * (b -= 1)) * Math.sin(2 * (b * e - f) * Math.PI / g) * .5 + d + c
},
easeInBack: function(a, b, c, d, e, f) {
return void 0 == f && (f = 1.70158), d * (b /= e) * b * ((f + 1) * b - f) + c
},
easeOutBack: function(a, b, c, d, e, f) {
return void 0 == f && (f = 1.70158), d * ((b = b / e - 1) * b * ((f + 1) * b + f) + 1) + c
},
easeInOutBack: function(a, b, c, d, e, f) {
return void 0 == f && (f = 1.70158), (b /= e / 2) < 1 ? d / 2 * b * b * (((f *= 1.525) + 1) * b - f) + c : d / 2 * ((b -= 2) * b * (((f *= 1.525) + 1) * b + f) + 2) + c
}
}), jQuery.fn.isVisible = function() {
var a = this[0];
return !!(a && a.offsetWidth && a.offsetHeight)
}, jQuery.fn.isOnPage = function() {
var a = this[0];
return document.body.contains(a)
}, $.fn.message = function() {
var a = $(this[0]),
b = a.css("content");
if (!b || "=" != b.charAt(0)) {
if (b = a.css("list-style-image"), !b || b.indexOf("?m=") < 0) return !1;
var c = /(\?m=)(.*)(\))/,
d = b.match(c)[2];
return /("|')$/.test(d) && (d = d.substring(0, d.length - 1)), d
}
return b.substr(1)
}, jQuery.fn.outerHTML = function() {
var a = this[0].outerHTML;
if (!a) {
var b = $(this[0]);
a = b.wrap("<div>").parent().html(), b.unwrap()
}
return a
},
function(a, b, c) {
"$:nomunge";
function d(d, e) {
function f(b) {
a(g).each(function() {
var c = a(this);
this === b.target || c.has(b.target).length || c.triggerHandler(e, [b.target])
})
}
e = e || d + c;
var g = a(),
h = d + "." + e + "-special-event";
a.event.special[e] = {
setup: function() {
g = g.add(this), 1 === g.length && a(b).bind(h, f)
},
teardown: function() {
g = g.not(this), 0 === g.length && a(b).unbind(h)
},
add: function(a) {
var b = a.handler;
a.handler = function(a, c) {
a.target = c, b.apply(this, arguments)
}
}
}
}
a.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "), function(a) {
d(a)
}), d("focusin", "focus" + c), d("focusout", "blur" + c), a.addOutsideEvent = d
}(jQuery, document, "outside"),
function(a) {
var b = $.fn.position;
$.fn.position = function(c, d) {
return c != a && d != a && this.css(support.transform ? {
left: 0,
top: 0,
transform: "translate3d(" + c + "," + d + ",0)"
} : {
left: c,
top: d
}), b.call(this)
}
}(),
function() {
function a() {
this.offsetWidth
}
jQuery.fn.repaint = function() {
return this.each(a)
}
}(),
function() {
$.fn.watch = function(a, b, c) {
var d = document.createElement("div"),
e = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
f = window.CustomEvent || function() {
return arguments || {}
},
g = function(a, b) {
a = "on" + a;
var c = a in b;
return c || (b.setAttribute(a, "return;"), c = "function" == typeof b[a]), c
};
"function" == typeof b && (c = b, b = {}), "function" != typeof c && (c = function() {}), b = $.extend({}, {
throttle: 10
}, b);
var h = function(a) {
var b = this;
$.each(this.watching, function() {
for (var c, d = this, e = !1, g = 0; g < d.props.length; g++)
if (c = a[0].attributes[d.props[g]] || a.css(d.props[g]), d.vals[g] != c) {
d.vals[g] = c, e = !0;
break
}
e && d.callback && d.callback.call(b, new f("AttrChange"))
})
};
return this.each(function() {
var f = this,
i = $(this),
j = {
props: a.split(" "),
vals: [],
changed: [],
callback: c
};
if ($.each(j.props, function(a) {
j.vals[a] = i[0].attributes[j.props[a]] || i.css(j.props[a]), j.changed[a] = !1
}), this.watching || (this.watching = []), this.watching.push(j), e) {
var k = new e(function(a) {
a.forEach(function(a) {
c.call(f, a)
})
});
k.observe(this, {
subtree: !1,
attributes: !0
})
} else g("DOMAttrModified", d) ? i.on("DOMAttrModified", c) : g("propertychange", d) ? i.on("propertychange", c) : setInterval(function() {
h.call(f, i)
}, b.throttle)
})
}
}(), window.Vue && Vue.config({
prefix: settings.vuePrefix,
delimiters: settings.delimiters
}), window.Vue && function() {
var a = Vue.options.directives["if"],
b = a.update;
a.update = function(a) {
var c = a && !this.childVM;
if (b.call(this, a), c) {
var d = this.childVM.$el;
context.trigger(d)
}
}
}(), window.Vue && function() {
Vue.directive("submodel", {
bind: function() {
this.template = this.el.innerHTML;
var a = this.raw = this.el,
b = a.parentNode;
if (b) {
var c = this.ref = document.createComment("v-submodel");
b.insertBefore(c, a), b.removeChild(a);
for (var d, e = this.inner = document.createElement("div"); d = a.firstChild;) e.appendChild(d)
}
},
update: function(a) {
if (this.inner && (this.unbind(), a = HP.models[a])) {
a.isInitialized() || a.update();
var b = $.extend({}, a.viewOptions, {
el: this.raw.cloneNode(!0),
template: this.template,
parent: this.vm,
data: $.extend({}, a.data),
compilerOptions: {
rawContent: this.inner.cloneNode(!0)
}
});
a.isUsed = !0, this.childVM = new Vue(b), this.el = this.childVM.$el, this.compiler.init ? this.ref.parentNode.insertBefore(this.el, this.ref) : this.childVM.$before(this.ref)
}
},
unbind: function() {
this.childVM && this.childVM.$destroy()
}
})
}(), window.Vue && function() {
Vue.filter("dateFormat", function(a, b) {
a = 0 | a;
var c = moment.unix(a);
return c.format(b || settings.dateFormat)
}), Vue.filter("dateFromNow", function(a) {
a = 0 | a;
var b = moment.unix(a);
return b.fromNow()
})
}(), $.window = $(window), $.document = $(document), $.html = $(document.documentElement), $(function() {
$.head = $(document.head || document.getElementsByTagName("head")[0]), $.body = $(document.body), $.components = $("#components"), $.components.length || ($.components = $(document.createElement("div")), $.components.prop("id", "components"), $.body.append($.components)), $.html.removeClass("loading").addClass("ready"), context.trigger("load", {
contextElement: $.document
})
}),
function() {
var a = utility.test.CSS.property("transition-duration", !0),
b = support.transitionEnd + ".toggler",
c = {
states: utility.prefixClass("state", "open opening closing closed"),
open: utility.prefixClass("state", "open"),
opening: utility.prefixClass("state", "opening"),
closed: utility.prefixClass("state", "closed"),
closing: utility.prefixClass("state", "closing"),
animate: "animate-"
},
d = classes.Toggler = Class({
Extends: Emitter,
init: function(a, b) {
switch (this.element = a, typeof b.animate) {
case "string":
this.setAnimate(b.animate);
break;
case "object":
this.setAnimate(b.animate[0], b.animate[1], b.animate[2])
}
this.element.removeClass(c.states), this.toggle(b.open, !1)
},
setAnimate: function(a, b, d) {
var f = [];
for (var g in e) e.hasOwnProperty(g) && f.push(g);
support.transitionEnd && utility.compare(a, f) ? (this.animate = {
property: a,
duration: b,
timing: d
}, this.element.removeClass(c.animate + "*").addClass(c.animate + a), this.animate.duration && this.element.css("transitionDuration", this.animate.duration.toString()), this.animate.timing && this.element.css("transitionTimingFunction", this.animate.timing)) : (this.animate = !1, this.element.off(".toggler")), this.trigger("setAnimate")
},
open: function(a) {
if (this._open !== !0) {
this._open = !0;
var d = this.animate ? e[this.animate.property] : null;
if (this.element.css("display", "").off(".toggler"), a !== !1 && this.animate && this.element.isOnPage()) {
this.element.removeClass(c.states).addClass(c.opening), d.openStart.call(this.element[0], this.element, this);
var f = this;
this.element.on(b, function(a) {
a.target == this && (f.element.removeClass(c.states).addClass(c.open).off(b), d.openComplete.call(this, f.element, f), f.trigger("open"))
})
} else this.element.removeClass(c.states).addClass(c.open), d && d.open.call(this.element[0], this.element, this), this.trigger("open")
}
},
close: function(a) {
if (this._open !== !1) {
this._open = !1;
var d = this.animate ? e[this.animate.property] : null;
if (this.element.off(".toggler"), a !== !1 && this.animate && this.element.isVisible()) {
this.element.removeClass(c.states).addClass(c.closing), d.closeStart.call(this.element[0], this.element, this);
var f = this;
this.element.on(b, function(a) {
a.target == this && (f.element.removeClass(c.states).addClass(c.closed).css("display", "none").off(b), d.closeComplete.call(this, f.element, f), f.trigger("close"))
})
} else this.element.removeClass(c.states).addClass(c.closed).css("display", "none"), d && d.close.call(this.element[0], this.element, this), this.trigger("close")
}
},
toggle: function(a, b) {
"boolean" != typeof a && (a = !this.isOpen()), a ? this.open(b) : this.close(b)
},
clear: function() {
if (this.element.removeClass(c.states).removeClass(c.animate + "*").css("display", ""), this.animate) {
var a = e[this.animate.property];
a.open.call(this.element[0], this.element, this)
}
},
unclear: function() {
var a = this._open;
this._open = null, this.toggle(a, !1), this.animate && this.element.addClass(c.animate + this.animate.property)
},
isOpen: function() {
return this._open
},
state: function() {
return this.isState("open") ? "open" : this.isState("opening") ? "opening" : this.isState("closing") ? "closing" : "closed"
},
isState: function(a) {
return c[a] && this.element.hasClass(c[a])
}
}),
e = d.properties = {
opacity: {
open: function(a) {
a.css("opacity", "")
},
openStart: function(a) {
a.repaint().css("opacity", "")
},
openComplete: function() {},
close: function(a) {
a.css("opacity", 0)
},
closeStart: function(a) {
a.css("opacity", 0)
},
closeComplete: function() {}
},
width: {
open: function(a) {
a.css({
width: "",
paddingLeft: "",
paddingRight: ""
})
},
openStart: function(b) {
var c = getComputedStyle(this),
d = this.offsetWidth,
e = c.paddingLeft,
f = c.paddingRight,
g = c[a];
this.style[a] = "0s", b.css({
width: "",
paddingLeft: "",
paddingRight: ""
});
var h = this.offsetWidth;
b.css({
width: d,
paddingLeft: e,
paddingRight: f
}).repaint().css({
width: h,
paddingLeft: "",
paddingRight: ""
}), this.style[a] = g
},
openComplete: function(a) {
a.css("width", "")
},
close: function(a) {
a.css({
width: 0,
paddingLeft: 0,
paddingRight: 0
})
},
closeStart: function(a) {
var b = getComputedStyle(this);
a.css({
width: this.offsetWidth,
paddingLeft: b.paddingLeft,
paddingRight: b.paddingRight
}).repaint().css({
width: 0,
paddingLeft: 0,
paddingRight: 0
})
},
closeComplete: function() {}
},
height: {
open: function(a) {
a.css({
height: "",
paddingTop: "",
paddingBottom: ""
})
},
openStart: function(b) {
var c = getComputedStyle(this),
d = this.offsetHeight,
e = c.paddingTop,
f = c.paddingBottom,
g = c[a];
this.style[a] = "0s", b.css({
height: "",
paddingTop: "",
paddingBottom: ""
});
var h = this.offsetHeight;
b.css({
height: d,
paddingTop: e,
paddingBottom: f
}).repaint().css({
height: h,
paddingTop: "",
paddingBottom: ""
}), this.style[a] = g
},
openComplete: function(a) {
a.css("height", "")
},
close: function(a) {
a.css({
height: 0,
paddingTop: 0,
paddingBottom: 0
})
},
closeStart: function(a) {
var b = getComputedStyle(this);
a.css({
height: this.offsetHeight,
paddingTop: b.paddingTop,
paddingBottom: b.paddingBottom
}).repaint().css({
height: 0,
paddingTop: 0,
paddingBottom: 0
})
},
closeComplete: function() {}
},
flip: {
open: function(a) {
a.css("transform", "perspective(43.75em)")
},
openStart: function(a) {
a.repaint().css("transform", "perspective(43.75em)")
},
openComplete: function() {},
close: function(a) {
a.css("transform", "perspective(43.75em) rotateY(179.9deg)")
},
closeStart: function(a) {
a.css("transform", "perspective(43.75em) rotateY(180deg)")
},
closeComplete: function(a) {
a.css("transform", "perspective(43.75em) rotateY(179.9deg)")
}
}
}
}(),
function() {
var a = {
selected: utility.prefixClass("state", "selected")
};
classes.Selector = Class({
Extends: Emitter,
init: function(a, b) {
this.element = a, this.setChain(b.chain)
},
setTogglers: function(a, b) {
this.togglers = [];
for (var c = 0; c < a.length; c++) this.addToggler(a[c], b)
},
addToggler: function(b, c) {
c = c || {}, c.open = !1;
var d = $(b);
d.removeClass(a.selected);
var e = utility.parseOptions(d.data("tab-panel"));
c = $.extend({}, c, e);
var f = new classes.Toggler(d, c);
this.togglers.push(f), this.trigger("addToggler")
},
setAnimate: function(a, b, c) {
for (var d = 0; d < this.togglers.length; d++) this.togglers[d].setAnimate(a, b, c);
this.trigger("setAnimate")
},
setChain: function(a) {
this.chain = !!a
},
hasToggler: function(a) {
if (!a) return !1;
for (var b = 0; b < this.togglers.length; b++)
if (this.togglers[b].element.is(a)) return !0;
return !1
},
select: function(b, c) {
if (this.togglers && this.togglers.length) {
var d, e, f = this.selected,
g = this.togglers[f];
if (isNaN(b)) {
for (d = 0; d < this.togglers.length; d++)
if (this.togglers[d].element.is(b)) {
b = d;
break
}
if (isNaN(b)) return
}
if (f != b) {
this.selected = b;
var h = this.togglers[this.selected],
i = function() {
h.open(c), h.element.addClass(a.selected)
},
j = g;
if (this.chain && c !== !1)
for (d = 0; d < this.togglers.length; d++) e = this.togglers[d], e.off("close"), e.isState("closed") || (j = e);
g ? (this.chain && c !== !1 ? j.one("close", i) : i(), g.close(c), g.element.removeClass(a.selected)) : i(), this.trigger("select", {
oldSelected: f,
oldElement: isNaN(f) ? null : this.togglers[f].element,
selected: this.selected,
selectedElement: this.togglers[this.selected].element
})
}
}
},
isSelected: function(a) {
if (isNaN(a))
for (var b = 0; b < this.togglers.length; b++)
if (this.togglers[b].element.is(a)) {
a = b;
break
}
return this.selected == a
}
})
}(),
function() {
function a() {
b = c, c = location.hash.slice(1);
var a = {
hash: c,
oldHash: b
};
system.hash.trigger("change", a), system.hash.trigger("#" + a.hash, a)
}
var b = null,
c = location.hash.slice(1);
window.addEventListener ? window.addEventListener("hashchange", a, !1) : window.attachEvent && window.attachEvent("onhashchange", a), system.hash = new Emitter, system.hash.get = function() {
return c
}, system.hash.set = function(a) {
location.hash = a
}
}(), window.Vue && function() {
function a(a) {
return a.replace(/\/$/, "")
}
function b(a) {
return a.replace(/(^\/)|(\/$)/g, "")
}
system.models = {}, system.Model = Class({
Extends: Emitter,
init: function(b, c) {
this._queryData = {}, this._initStage = 0, this._isOpen = !1, this._merge = {}, this._queued = [], this.url = a(b), this.viewOptions = c || {}, this.data = this.viewOptions.data || {}, this.isUsed = !1, this.data.x = {}, this.data.model = {
active: !1
}, this.data._model = this, delete this.viewOptions.data
},
isOpen: function() {
return this._isOpen
},
createView: function(a, b) {
if (this.isUsed = !0, 0 == this._initStage) this._initStage = 1, this._setupViews = [{
options: a,
viewObj: b
}], this.one("complete", this._firstHandler), this.update();
else if (1 == this._initStage) this._setupViews.push({
options: a,
viewObj: b
});
else {
b = b || Vue, a = $.extend({}, this.viewOptions, a), a.data = $.extend({}, this.data); {
new b(a)
}
}
},
isInitialized: function() {
return this._initStage >= 1
},
_firstHandler: function() {
var a = this._setupViews;
this._initStage = 2;
for (var b = 0; b < a.length; b++) {
var c = a[b];
this.createView(c.options, c.viewObj)
}
delete this._setupViews
},
update: function(a) {
this.query(a || "json")
},
sync: function(a, b) {
b && this.on(a, function() {
for (var a = 0; a < b.length; a++) {
var c = b[a];
if (system.models.hasOwnProperty(c)) {
var d = system.models[c];
d.isUsed && d.update()
}
}
})
},
updateData: function(a, b) {
b = b !== !1, this.data.x ? this.data.x.$add ? this._updateData(a, this.data.x, b) : $.extend(!0, this.data.x, a) : this.data.x = a
},
_updateData: function(a, b, c) {
b = b || this.data.x;
for (var d in a) a.hasOwnProperty(d) && "model" != d && (b.hasOwnProperty(d) ? "object" == $.type(a[d]) && "object" == $.type(b[d]) ? this._updateData(a[d], b[d]) : b[d] != a[d] && (b[d] = a[d]) : b.$add(d, a[d]));
if (!c)
for (d in b) b.hasOwnProperty(d) && "model" != d && !a.hasOwnProperty(d) && b.$delete(d)
},
urlMergeData: function(a) {
a = b(a), this._merge[a] = !0
},
query: function(a, c) {
a = b(a), c = c || {}, c && (this._queryData[a] || (this._queryData[a] = {}), $.extend(!0, this._queryData[a], c)), this._isOpen ? this._queued.push(a) : (this._isOpen = !0, this._query(a), this.data.model.active = !0)
},
_query: function(a) {
var b = this.url + "/" + a;
this.trigger("query", {
url: b,
method: a
}), this.trigger("query." + a, {
url: b,
method: a
});
var c = {
url: b,
type: "POST",
data: {}
};
this._queryData[a] && (c.data = this._queryData[a], this._queryData[a] = null);
var d = this;
$.ajax(c).done(function(b) {
d._queryHandler(a, b)
}).fail(function() {
d._queryHandler(a, null, !0)
})
},
_queryHandler: function(a, b, c) {
var d = this.url + "/" + a;
if (this._queued.length) {
var e = this._queued.shift();
this._query(e)
} else {
if (this._isOpen = !1, this.data.model.active = !1, b) {
if ("string" == typeof b) try {
b = $.parseJSON(b)
} catch (f) {
system.log("Not JSON", f, b)
}
this.updateData(b, this._merge.hasOwnProperty(a))
}
this.trigger("complete", {
url: d,
method: a
})
}
this._queryData[a] || this.trigger("complete." + a, {
url: d,
method: a
}), this.trigger("return", {
url: d,
method: a,
error: !!c
}), this.trigger("return." + a, {
url: d,
method: a,
error: !!c
}), c ? (this.trigger("error", {
url: d,
method: a
}), this.trigger("error." + a, {
url: d,
method: a
})) : (this.trigger("success", {
url: d,
method: a
}), this.trigger("success." + a, {
url: d,
method: a
}))
}
}), context.on("load", function(a) {
$("[data-model], [data-model-loader]", a.contextElement).each(function() {
var a = $(this),
b = a.attr("data-model"),
c = a.attr("data-model-loader"),
d = a.attr("data-template"),
e = a.attr("data-template-el"),
f = (a.attr("data-template-file"), a.attr("data-model-active") || "active");
a.removeAttr("data-model"), a.removeAttr("data-model-loader"), a.removeAttr("data-view"), a.removeAttr("data-template"), a.removeAttr("data-template-el"), a.removeAttr("data-template-file"), a.removeAttr("data-model-active"), e ? d = "#" + e : "" == d && (d = a.html());
var g = !b && c;
b = g ? system.models[c] : system.models[b], b && (b.on("query", function() {
a.addClass(f)
}), b.on("complete", function() {
a.removeClass(f)
}), g || b.createView({
el: this,
template: d || "",
ready: function() {
context.trigger(a)
}
}))
})
});
var c;
$.window.on("blur focus", function(a) {
if (c != a.type && "focus" == a.type)
for (var b in system.models)
if (system.models.hasOwnProperty(b)) {
var d = system.models[b];
d.isUsed && d.update()
}
c = a.type
})
}(),
function() {
function a(b, c) {
if ("function" == typeof b) return a("*", b);
if ("function" == typeof c)
for (var e = new d(b), f = 1; f < arguments.length; ++f) a.callbacks.push(e.middleware(arguments[f]));
else "string" == typeof b ? a.show(b, c) : a.start(b)
}
function b(b) {
var c = window.location.pathname + window.location.search;
c != b.canonicalPath && (a.stop(), b.unhandled = !0, window.location = b.canonicalPath)
}
function c(a, b) {
"/" == a[0] && 0 != a.indexOf(l) && (a = l + a);
var c = a.indexOf("?");
if (this.canonicalPath = a, this.path = a.replace(l, "") || "/", this.title = document.title, this.state = b || {}, this.state.path = a, this.querystring = ~c ? a.slice(c + 1) : "", this.pathname = ~c ? a.slice(0, c) : a, this.params = [], this.hash = "", ~this.path.indexOf("#")) {
var d = this.path.split("#");
this.path = d[0], this.hash = d[1] || "", this.querystring = this.querystring.split("#")[0]
}
}
function d(a, b) {
b = b || {}, this.path = a, this.method = "GET", this.regexp = e(a, this.keys = [], b.sensitive, b.strict)
}
function e(a, b, c, d) {
return a instanceof RegExp ? a : (a instanceof Array && (a = "(" + a.join("|") + ")"), a = a.concat(d ? "" : "/?").replace(/\/\(/g, "(?:/").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(a, c, d, e, f, g) {
return b.push({
name: e,
optional: !!g
}), c = c || "", "" + (g ? "" : c) + "(?:" + (g ? c : "") + (d || "") + (f || d && "([^/.]+?)" || "([^/]+?)") + ")" + (g || "")
}).replace(/([\/.])/g, "\\$1").replace(/\*/g, "(.*)"), new RegExp("^" + a + "$", c ? "" : "i"))
}
function f(b) {
if (b.state) {
var c = b.state.path;
a.replace(c, b.state)
}
}
function g(b) {
if (1 == h(b) && !(b.metaKey || b.ctrlKey || b.shiftKey || b.defaultPrevented)) {
for (var c = b.target; c && "A" != c.nodeName;) c = c.parentNode;
if (c && "A" == c.nodeName) {
var d = c.getAttribute("href");
if (!(c.pathname == location.pathname && (c.hash || "#" == d) || d.indexOf("mailto:") > -1 || c.target || !i(c.href))) {
var e = c.pathname + c.search + (c.hash || ""),
f = e + c.hash;
e = e.replace(l, ""), l && f == e || (b.preventDefault(), a.show(f))
}
}
}
}
function h(a) {
return a = a || window.event, null == a.which ? a.button : a.which
}
function i(a) {
var b = location.protocol + "//" + location.hostname;
return location.port && (b += ":" + location.port), 0 == a.indexOf(b)
}
if (support.pushState) {
var j, k = !0,
l = "";
a.callbacks = [], a.base = function(a) {
return 0 == arguments.length ? l : void(l = a)
}, a.start = function(b) {
if (b = b || {}, !j && (j = !0, !1 === b.dispatch && (k = !1), !1 !== b.popstate && window.addEventListener("popstate", f, !1), !1 !== b.click && window.addEventListener("click", g, !1), k)) {
var c = location.pathname + location.search + location.hash;
a.replace(c, null, !0, k)
}
}, a.stop = function() {
j = !1, removeEventListener("click", g, !1), removeEventListener("popstate", f, !1)
}, a.show = function(b, d, e) {
var f = new c(b, d);
return !1 !== e && a.dispatch(f), f.unhandled || f.pushState(), f
}, a.replace = function(b, d, e, f) {
var g = new c(b, d);
return g.init = e, null == f && (f = !0), f && a.dispatch(g), g.save(), g
}, a.dispatch = function(c) {
function d() {
var f = a.callbacks[e++];
return f ? void f(c, d) : b(c)
}
var e = 0;
d()
}, a.Context = c, c.prototype.pushState = function() {
history.pushState(this.state, this.title, this.canonicalPath)
}, c.prototype.save = function() {
history.replaceState(this.state, this.title, this.canonicalPath)
}, a.Route = d, d.prototype.middleware = function(a) {
var b = this;
return function(c, d) {
return b.match(c.path, c.params) ? a(c, d) : void d()
}
}, d.prototype.match = function(a, b) {
var c = this.keys,
d = a.indexOf("?"),
e = ~d ? a.slice(0, d) : a,
f = this.regexp.exec(decodeURIComponent(e));
if (!f) return !1;
for (var g = 1, h = f.length; h > g; ++g) {
var i = c[g - 1],
j = "string" == typeof f[g] ? decodeURIComponent(f[g]) : f[g];
i ? b[i.name] = void 0 !== b[i.name] ? b[i.name] : j : b.push(j)
}
return !0
}, system.page = a
}
}(), $(function() {
var a = system.scroll = new modules.Scroller($.window);
a._getElement = function() {
return document.body
}, a._getWrappedElement = function() {
return $.body
}, a.viewWidth = utility.viewportWidth, a.viewHeight = utility.viewportHeight, a.setAnimate(settings.scrollDuration, settings.scrollTiming)
}), window.Vue && function() {
var a = new system.Model(settings.baseURL + "/cart", {
data: {
isAdding: !1,
isAdded: !1,
noStock: !1
},
computed: {
count: {
$get: function() {
var a = this.$data.x.contents,
b = 0;
for (var c in a) a.hasOwnProperty(c) && (b += parseInt(a[c].qty));
return b
}
},
isEmpty: {
$get: function() {
var a = this.$data.x.contents;
for (var b in a)
if (a.hasOwnProperty(b)) return !1;
return !0
}
}
},
methods: {
prevent: function(a) {
a && a.preventDefault()
},
add: function(b, c, d) {
function e(d) {
if (f.isAdding = !1, d.error) notify.error("There was a problem adding to the cart. Please try again.", "store.cart");
else {
f.isAdded = !0;
var e, g = f.x.contents;
for (var h in g) g.hasOwnProperty(h) && g[h].id == b && (e = g[h]);
f.noStock = !e || e.qty - n != k, a.trigger("productAdded", {
id: b,
qty: c
})
}
}
this.prevent(d);
var f = this.$data;
c = Math.abs(0 | c || 1);
var g, h = "item[" + b + "][add]",
i = a._queryData.update,
j = i && i[h] ? i[h] : 0,
k = j + c,
l = f.x.contents;
for (var m in l) l.hasOwnProperty(m) && l[m].id == b && (g = l[m]);
var n = g ? g.qty : 0,
o = {};
o[h] = k, a.query("update", o), a.trigger("productAdding", {
id: b,
qty: c
}), f.isAdding = !0, f.isAdded = !1, a.one("complete", e)
},
qtyOf: function(a, b) {
this.prevent(b);
var c = this.$data,
d = c.x.contents;
for (var e in d)
if (d.hasOwnProperty(e) && d[e].id == a) return 0 | d[e].qty;
return 0
},
empty: function(b) {
this.prevent(b);
var c = this.x.contents,
d = {};
for (var e in c) c.hasOwnProperty(e) && (c.$delete(e), d["item[" + e + "][remove]"] = 1);
a.query("update", d)
},
remove: function(b, c) {
this.prevent(c), this.x.contents.$delete(b);
var d = {};
d["item[" + b + "][remove]"] = 1, a.query("update", d)
},
removeById: function(a, b) {
this.prevent(b);
var c = this.$data,
d = c.x.contents;
for (var e in d)
if (d.hasOwnProperty(e) && d[e].id == a) {
this.remove(e);
break
}
},
updateQty: function(b, c, d) {
if ("object" == typeof c) {
d = c;
var e = d.srcElement;
c = parseInt(e.value), isNaN(c) && (c = 1)
}
this.prevent(d);
var f = this.x.contents[b];
f.qty = c;
var g = {};
g["item[" + b + "][qty]"] = c, a.query("update", g)
},
setupImage: function(a, b, c) {
var d = settings.baseURL + "/files/thumb";
return a ? d + "/" + a + "/" + b + "/" + c : settings.baseURL + "/addons/default/themes/" + settings.theme + "/img/products/no-image.jpg"
}
},
filters: {}
});
system.models["store.cart"] = a
}(), window.Vue && function() {
var a = new system.Model(settings.baseURL + "/users", {
data: {
editing: !1
},
computed: {},
methods: {
edit: function(a, b) {
b ? b.preventDefault() : 0, this.editing = a
},
login: function(b, c, d) {
d ? d.preventDefault() : 0, a.query("login", {
email: b,
password: c
})
},
logout: function(b) {
b ? b.preventDefault() : 0, a.query("logout")
},
post: function(b, c) {
c ? c.preventDefault() : 0;
var d = {},
e = c instanceof HTMLElement ? c : c.target;
if ("FORM" != e.nodeName) {
if (e = $(e).closest("form"), !e.length) return;
e = e[0]
}
for (var f = e.elements, g = 0; g < f.length; g++) {
var h = f[g],
i = h.name;
i && (d[i] = h.value)
}
a.query(b, d)
}
},
filters: {}
}),
b = ["my-profile"];
a.on("success.logout", function() {
for (var a = 0; a < b.length; a++) {
var c = b[a],
d = system.baseURL + "/" + c;
if (window.location.pathname == d) {
window.location.href = system.baseURL;
break
}
}
}), a.sync("success.logout", ["store.cart"]), system.models.user = a
}(),
function() {
var a = {
position: utility.prefixClass("option", "position-")
};
modules.AnchorPanel = Class({
Extends: classes.Toggler,
init: function(a, b) {
classes.Toggler.fn.init.call(this, a, b), b.align || (b.align = "left"), "string" == typeof b.align && (b.align = [b.align, b.align]), (!b.offset || b.offset.length < 2) && (b.offset = [0, 0]), this.setTarget(b.target), this.setPosition(b.position), this.setAlignment(b.align[0], b.align[1]), this.setOffset(b.offset[0], b.offset[1]), this.ready = !0, this.setup()
},
reset: function() {
this.ready && this.updater.cancel()
},
setup: function() {
if (this.ready) {
var a = this;
this.updater = utility.frames(function() {
a.updatePosition()
})
}
},
refresh: function() {
this.reset(), this.setup(), this.trigger("refresh")
},
updatePosition: function(a, b) {
if (this.element.isVisible() && this.target.isVisible()) {
var c = this.target.offset(),
d = c.left,
e = c.top,
f = this.target.outerWidth(),
g = this.target.outerHeight(),
h = this.element.outerWidth(),
i = this.element.outerHeight(),
j = d + this.offsetX + (0 | a),
k = e + this.offsetY + (0 | b),
l = "top" == this.position || "bottom" == this.position,
m = this.elementAlign.toNumber() * (l ? h : i),
n = this.targetAlign.toNumber() * (l ? f : g);
switch (l ? j += n - m : k += n - m, this.position) {
case "top":
k -= i;
break;
case "bottom":
k += g;
break;
case "left":
j -= h;
break;
case "right":
j += f
}
this.element.position(Math.round(j) + "px", Math.round(k) + "px");
var o = this.element.offset(),
p = o.left,
q = o.top;
(Math.abs(p - j) > 1 || Math.abs(q - k) > 1) && (j += j - p, k += k - q, this.element.position(Math.round(j) + "px", Math.round(k) + "px"))
}
},
setTarget: function(a) {
a instanceof $ ? this.target = a : "string" == typeof a && (this.target = $("#" + a)), this.refresh(), this.trigger("setTarget")
},
setPosition: function(b) {
this.position = utility.compare(b, "right top bottom", "left"), this.element.removeClass(a.position + "*").addClass(a.position + this.position), this.refresh(), this.trigger("setPosition")
},
setAlignment: function(a, b) {
if (!(a instanceof utility.UnitNumber)) switch (a) {
case "start":
a = new utility.UnitNumber(0, "%");
break;
case "end":
a = new utility.UnitNumber(100, "%");
break;
default:
a = new utility.UnitNumber(50, "%")
}
if (!(b instanceof utility.UnitNumber)) switch (b) {
case "start":
b = new utility.UnitNumber(0, "%");
break;
case "end":
b = new utility.UnitNumber(100, "%");
break;
default:
b = new utility.UnitNumber(50, "%")
}
this.elementAlign = a, this.targetAlign = b, this.refresh(), this.trigger("setAlignment")
},
setOffset: function(a, b) {
this.offsetX = 0 | (a instanceof utility.UnitNumber ? a.toNumber() : a), this.offsetY = 0 | (b instanceof utility.UnitNumber ? b.toNumber() : b), this.refresh(), this.trigger("setOffset")
}
}), utility.moduleContext(modules.AnchorPanel, "anchor-panel", ["toggle", "open", "close"])
}(),
function() {
modules.Modal = Class({
Extends: classes.Toggler
})
}(), utility.moduleContext(modules.Modal, "modal", ["toggle", "open", "close"]),
function() {
var a = {
expanded: utility.prefixClass("state", "expanded"),
contracted: utility.prefixClass("state", "contracted")
};
modules.NavBar = new Class({
Extends: classes.Toggler,
init: function(b, c) {
this.navbar = b, this.logo = this.navbar.children(".logo"), this.content = this.navbar.children(".content"), this.control = this.navbar.children(".control"), c.open = !1, classes.Toggler.fn.init.call(this, this.content, c);
var d = this;
this.queryListener = function(b) {
d.navbar.toggleClass(a.contracted, !b.matches).toggleClass(a.expanded, b.matches), b.matches ? d.clear() : d.unclear()
}, this.setBreakpoint(c.breakpoint)
},
setBreakpoint: function(a) {
a instanceof utility.UnitNumber || (a = new utility.UnitNumber(0 | a, "px")), this.breakpoint = a, this.query && this.query.removeListener(this.queryListener), this.query = matchMedia("(min-width:" + this.breakpoint.toString() + ")"), this.query.addListener(this.queryListener), this.queryListener(this.query)
}
}), utility.moduleContext(modules.NavBar, "nav-bar", ["toggle", "open", "close"])
}(), modules.Notify = Class({
Extends: Emitter,
init: function(a, b) {
this.element = a;
var c = this.element.children("[data-notify-template]");
c.removeAttr("data-notify-template"), this.template = c.outerHTML(), this.element.empty(), this.animate = b.animate;
var d = this;
notify.on(b.listen || "all", function(a) {
d.addNote(a)
})
},
addNote: function(a, b) {
var c = $(utility.parseTemplate(this.template, a));
b === !1 ? this.element.prepend(c) : this.element.append(c);
var d = new classes.Toggler(c, {
animate: this.animate,
open: !1
});
utility.eventOptions(c, "notify", "close", null, d), d.open(), d.on("close", function() {
c.remove()
})
}
}), utility.moduleContext(modules.Notify, "notify"),
function() {
var a = {
inView: utility.prefixClass("state", "in-view")
};
modules.ScrollTrigger = Class({
Extends: Emitter,
init: function(a, b) {
b = b || {}, this.element = a, this.setDirection(b.direction), this.setClasses(b.classes)
},
setDirection: function(a) {
this.direction = [], "object" == typeof a && a.length || (a = [a]);
for (var b = 0; b < a.length; b++) {
var c = utility.compare(a[b], "up down left right");
c && this.direction.push(c)
}
},
setClasses: function(b) {
this.classes = "object" == typeof b && b.length ? b.join(" ") : b || a.inView
},
setTop: function() {}
})
}(),
function() {
var a = {
scrollTarget: utility.prefixClass("state", "scroll-target")
};
modules.Scroller = Class({
Extends: Emitter,
init: function(a, b) {
if (this.element = a, this.element[0] != window && this.element[0] != document && this.element[0] != document.body && "static" == this.element.css("position") && this.element.css("position", "relative"), this.animate = {
duration: 0,
timing: "linear"
}, b) {
var c = b.animate;
$.isArray(c) || (c = [c]), this.setAnimate(c[0], c[1])
}
var d = this,
e = "scroll mousedown DOMMouseScroll mousewheel wheel keyup touchstart".split(" ");
this.element.on(e.join(".scroller ") + ".scroller", function(a) {
(a.which > 0 || "mousedown" == a.type || "mousewheel" == a.type || "touchstart" == a.type) && (a.scroller = d, d.trigger("humanScroll", a), d.cancel())
}), this.element.on("scroll.scroller", function(a) {
a.scroller = d, d.trigger("scroll", a)
})
},
_getElement: function() {
return this.element[0]
},
_getWrappedElement: function() {
return this.element
},
left: function(a) {
var b = this._getElement();
return isNaN(a) || (b.scrollLeft = a), b.scrollLeft
},
width: function() {
return this._getElement().scrollWidth
},
viewWidth: function() {
return this._getElement().clientWidth
},
top: function(a) {
var b = this._getElement();
return isNaN(a) || (b.scrollTop = a), b.scrollTop
},
height: function() {
return this._getElement().scrollHeight
},
viewHeight: function() {
return this._getElement().clientHeight
},
maxH: function() {
return this.width() - this.viewWidth()
},
maxV: function() {
return this.height() - this.viewHeight()
},
setAnimate: function(a, b) {
a instanceof utility.UnitNumber ? this.animate.duration = a.toNumber() : isNaN(a) || (this.animate.duration = 0 | a), "string" == typeof b && (this.animate.timing = utility.camelCase(b))
},
isHScrollable: function() {
return this.width() > this.viewWidth()
},
isVScrollable: function() {
return this.height() > this.viewHeight()
},
isScrollable: function() {
return this.isHScrollable() || this.isVScrollable()
},
toV: function(a, b) {
if (this.isVScrollable()) {
{
this._getElement()
}
if (b !== !1 && this.cancel(), "string" == typeof a || a instanceof utility.UnitNumber) {
var c = utility.getUnitNumber(a);
if (!c) return;
a = (this.height() - this.viewHeight()) * c.toNumber()
}
isNaN(a) || (this.animate.duration > 0 ? this._getWrappedElement().animate({
scrollTop: a
}, {
duration: this.animate.duration,
easing: this.animate.timing,
queue: !1
}) : this.top(a))
}
},
toH: function(a, b) {
if (this.isHScrollable()) {
{
this._getElement()
}
if (b !== !1 && this.cancel(), "string" == typeof a || a instanceof utility.UnitNumber) {
var c = utility.getUnitNumber(a);
if (!c) return;
a = (this.width() - this.viewWidth()) * c.toNumber()
}
isNaN(a) || (this.animate.duration > 0 ? this._getWrappedElement().animate({
scrollLeft: a
}, {
duration: this.animate.duration,
easing: this.animate.timing,
queue: !1
}) : this.left(a))
}
},
to: function(a, b, c) {
c !== !1 && this.cancel(), void 0 != a && this.toV(a, !1), void 0 != b && this.toH(b, !1)
},
toElement: function(a, b) {
b = b || {}, this.cancel();
var c = this._getElement();
if ("string" == typeof a) a = $(a, c);
else if (a.length && !c.contains(a instanceof $ ? a[0] : a)) return;
if (a.length) {
this._setTarget(a);
for (var d = 0 + (0 | b.offsetH), e = 0 + (0 | b.offsetV), f = a[0]; f != c;) d += f.offsetLeft, e += f.offsetTop, f = f.offsetParent;
var g;
if (b.alignH || (b.alignH = b.align), b.alignV || (b.alignV = b.align), b.alignH) {
var h = this.viewWidth() - a.outerWidth();
switch (b.alignH) {
case "start":
case "left":
break;
case "center":
d -= h / 2;
break;
case "end":
case "right":
d -= h;
break;
default:
g = utility.getUnitNumber(b.alignH), g && (d -= h * g.toNumber())
}
}
if (b.alignV) {
var i = this.viewHeight() - a.outerHeight();
switch (b.alignV) {
case "start":
case "top":
break;
case "center":
e -= i / 2;
break;
case "end":
case "bottom":
e -= i;
break;
default:
g = utility.getUnitNumber(b.alignV), g && (e -= i * g.toNumber())
}
}
this.to(e, d, !1)
}
},
_setTarget: function(b) {
this._unsetTarget(), this._target = b, b.addClass(a.scrollTarget)
},
_unsetTarget: function() {
this._target && (this._target.removeClass(a.scrollTarget), this._target = null)
},
cancel: function() {
this._unsetTarget(), this._getWrappedElement().stop()
}
}), utility.moduleContext(modules.Scroller, "scroller"), context.on("load", function(a) {
$("[data-scroll]", a.contextElement).each(function() {
var a, b = $(this),
c = utility.parseOptions(b.attr("data-scroll")),
d = document,
e = c.event || "click";
$.isArray(e) && (e = e.join(".scroll ")), e += ".scroll", c.target && (d = $("#" + c.target), a = d.data("scroller"));
var f, g, h, i = {};
c.element ? (h = "@this" == c.element ? b : $("#" + c.element, d), $.isArray(c.align) ? (i.alignV = c.align[0], i.alignH = c.align[1]) : i.align = c.align, $.isArray(c.offset) || (c.offset = [c.offset]), i.offsetV = c.offset[0], i.offsetH = c.offset[1]) : c.to && ($.isArray(c.to) || (c.to = [c.to]), f = c.to[0], g = c.to[1]), b.on(e, function(b) {
b.preventDefault();
var c = a || system.scroll;
if (h) c.toElement(h, i);
else {
if (f) switch (f) {
case "top":
case "start":
f = 0;
break;
case "bottom":
case "end":
f = c.maxV()
}
if (g) switch (g) {
case "left":
case "start":
g = 0;
break;
case "right":
case "end":
g = c.maxH()
}
c.to(f, g)
}
})
})
})
}(),
function() {
var a = {
expand: utility.prefixClass("option", "expand-"),
height: utility.prefixClass("option", "height-"),
menuOpen: "menu-open",
menuExpand: "menu-expand",
selected: utility.prefixClass("state", "selected"),
menu: "menu",
hasMenu: "has-menu",
hasSelected: "has-selected"
};
modules.SideMenu = Class({
Extends: Emitter,
init: function(b, c) {
this.element = b, this.element.addClass(a.menuOpen).addClass(a.hasMenu), this.setHeight(c.height), this.setExpansion(c.expand)
},
reset: function() {
this.element.off(".sideMenu")
},
setup: function() {
var b = this;
"none" != this.expand && (this.element.on("click.sideMenu", "[data-side-menu-open]", function(c) {
c.preventDefault(); {
var d = $(this),
e = d.parent().closest("." + a.hasMenu),
f = e.parent().closest("." + a.hasMenu);
f.children("." + a.menu)
}
f.removeClass(a.menuOpen).addClass(a.menuExpand), e.addClass(a.menuOpen), b.matchHeight()
}), this.element.on("click.sideMenu", "[data-side-menu-close]", function(c) {
c.preventDefault();
var d = $(this),
e = d.parent().closest("." + a.hasMenu),
f = e.parent().closest("." + a.hasMenu),
g = f.children("." + a.menu);
f.removeClass(a.menuExpand).addClass(a.menuOpen), support.transitionEnd ? g.one(support.transitionEnd, function() {
f.hasClass(a.menuOpen) && e.removeClass(a.menuOpen)
}) : e.removeClass(a.menuOpen), b.matchHeight()
})), this.matchHeight()
},
refresh: function() {
this.reset(), this.setup(), this.trigger("refresh")
},
matchHeight: function() {
var b = "fit" == this.height;
if (b && "across" == this.expand) {
var c = this.element.hasClass(a.menuOpen) ? this.element.children("." + a.menu) : this.element.find("." + a.menuOpen + ">." + a.menu),
d = c.outerHeight(!0);
d > 0 && this.element.height(d)
} else this.element.css("height", "")
},
setExpansion: function(b) {
this.expand = utility.compare(b, "across below float", "none"), this.element.removeClass(a.expand + "*").addClass(a.expand + this.expand), this.refresh(), this.trigger("setExpansion")
},
setHeight: function(b) {
this.height = utility.compare(b, "fit", "fixed"), this.element.removeClass(a.height + "*").addClass(a.height + this.height), this.refresh(), this.trigger("setHeight")
}
}), utility.moduleContext(modules.SideMenu, "side-menu")
}(),
function() {
var a = {
panel: "panel",
content: "content",
position: utility.prefixClass("option", "position-"),
slide: utility.prefixClass("option", "slide-"),
open: utility.prefixClass("state", "open")
};
modules.SlidePanel = Class({
Extends: Emitter,
init: function(b, c) {
this._open = !1, this.element = b, this.panel = b.children("." + a.panel + ", [data-slide-panel-panel]"), this.content = b.children("." + a.content + ", [data-slide-panel-content]"), this.setPosition(c.position), this.setSize(c.size || "200px"), this.setSlide(c.slide)
},
reset: function() {
this.element.removeClass(a.position + "*").removeClass(a.slide + "*").removeClass(a.open), this.panel.css({
width: "",
height: ""
})
},
setup: function() {
if (this.size && this.position && this.slide) {
var b = "left" == this.position || "right" == this.position,
c = "left" == this.position || "top" == this.position,
d = {},
e = {};
d[b ? "width" : "height"] = this.size;
var f = this.isOpen() || "expose" == this.slide ? 0 : (c ? "-" : "") + this.size,
g = this.isOpen() && "overlay" != this.slide ? (c ? "" : "-") + this.size : 0;
switch (this.position) {
case "left":
case "right":
support.transform ? (d.transform = f ? "translate3d(" + f + ",0,0)" : "", e.transform = g ? "translate3d(" + g + ",0,0)" : "") : (d.top = "", d.left = f || "", e.top = "", e.left = g || "");
break;
case "top":
case "bottom":
support.transform ? (d.transform = f ? "translate3d(0," + f + ",0)" : "", e.transform = g ? "translate3d(0," + g + ",0)" : "") : (d.left = "", d.top = f || "", e.left = "", e.top = g || "")
}
this.panel.css(d), this.content.css(e), this.element.addClass(a.position + this.position).addClass(a.slide + this.slide).toggleClass(a.open, this.isOpen())
}
},
refresh: function() {
this.reset(), this.setup(), this.trigger("refresh")
},
setSize: function(a) {
this.size = a, this.refresh(), this.trigger("setSize")
},
setPosition: function(a) {
this.position = a in {
right: 0,
top: 0,
bottom: 0
} ? a : "left", this.refresh(), this.trigger("setPosition")
},
setSlide: function(a) {
this.slide = a in {
expose: 0,
overlay: 0
} ? a : "push", this.refresh(), this.trigger("setSlide")
},
open: function() {
this._open || (this._open = !0, this.refresh(), this.trigger("open"))
},
close: function() {
this._open && (this._open = !1, this.refresh(), this.trigger("close"))
},
toggle: function(a) {
a === !1 || this.isOpen() ? this.close() : this.open()
},
isOpen: function() {
return this._open
}
}), utility.moduleContext(modules.SlidePanel, "slide-panel", ["toggle", "open", "close"])
}(),
function() {
({
stuck: utility.prefixClass("state", "stuck")
});
modules.Sticky = Class({
Extends: modules.ScrollTrigger,
init: function(a) {
this.element = a
}
})
}(),
function() {
var a = {
selected: utility.prefixClass("state", "selected")
};
modules.Tabs = Class({
Extends: classes.Selector,
init: function(b, c) {
classes.Selector.fn.init.call(this, b, c), this.buttons = this.element.find("a"), this.on("select", function(b) {
var c = b.selectedElement,
d = c.attr("id");
this.buttons.removeClass(a.selected).parent().removeClass(a.selected), this.buttons.filter('[href="#' + d + '"]').addClass(a.selected).parent().addClass(a.selected)
}), this.setTarget(c.target, {
animate: c.animate
}), this.setHash(c.hash);
var d = system.hash.get();
if (!(c.hash && d && this.hasToggler("#" + d))) {
var e = this.element.find("." + a.selected + " > a"),
f = e.attr("href");
this.select(f, !1)
}
},
setTarget: function(a, b) {
this.target = $("#" + a), this.setTogglers(this.target.children(), b), this.trigger("setTarget")
},
setHash: function(a) {
this.useHash = !!a, this.trigger("setHash");
var b = this;
if (this.useHash) {
this._hashCaller = function(a) {
a.hash && b.select("#" + a.hash)
}, this.buttons.off(".tabs"), system.hash.on("change", this._hashCaller);
var c = system.hash.get();
c && this.select("#" + c, !1)
} else this.buttons.on("click.tabs", function(a) {
a.preventDefault(), b.select($(this).attr("href"))
}), system.hash.off("change", this._hashCaller)
}
}), utility.moduleContext(modules.Tabs, "tabs")
}(),
function() {
function a(a, d) {
var e = $(document.createElement("div"));
e.addClass(c.tooltip), e.text(a);
var f = $(document.createElement("span"));
switch (f.addClass(c.arrow), typeof d) {
case "string":
e.addClass(d);
break;
case "object":
d.length && e.addClass(d.join(" "))
}
return e.append(f), b.append(e), e
}
var b = $(document.createElement("div"));
b.prop("id", "component-tooltips");
var c = {
tooltip: "tooltip",
arrow: "arrow"
};
modules.Tooltip = Class({
Extends: modules.AnchorPanel,
init: function(b, d) {
var e = a(d.message, d.classes);
this.arrow = e.children("." + c.arrow), d.target = b, modules.AnchorPanel.fn.init.call(this, e, d)
},
updatePosition: function(a, b) {
switch (a = 0 | a, b = 0 | b, this.position) {
case "top":
b -= this.arrow.outerHeight();
break;
case "bottom":
b += this.arrow.outerHeight();
break;
case "left":
a -= this.arrow.outerWidth();
break;
case "right":
a += this.arrow.outerWidth()
}
modules.AnchorPanel.fn.updatePosition.call(this, a, b)
}
}), $(function() {
$.components.append(b)
})
}(), utility.moduleContext(modules.Tooltip, "tooltip", ["toggle", "open", "close"]), context.on("load", function(a) {
$("[data-change]", a.contextElement).each(function() {
var a = $(this),
b = utility.parseOptions(a.attr("data-change"));
if (b.navigate) {
var c = b.ajax;
a.on("change", function() {
var b = c.replace("$", a.val());
window.location.href = b
})
} else if (b.ajax) {
var d, c = b.ajax;
a.on("change", function() {
d && d.abort();
var b = c.replace("$", a.val());
d = $.ajax(b)
})
}
})
}), context.on("load", function(a) {
function b(a) {
a.preventDefault();
var b = $(this).next()[0];
b.disabled || (b.checked = !b.checked, c.call(b))
}
function c() {
var a = $(this).prev(),
b = this.parentNode;
"LABEL" == b.nodeName && $(b).toggleClass(d, this.checked), a.toggleClass(d, this.checked)
}
var d = utility.prefixClass("state", "checked");
$('input[type="checkbox"].switch', a.contextElement).each(function() {
var a = $(this),
d = a.prev(".switch-control");
if (!d.length) {
var e = a.prop("class");
e = e.replace(/\s*switch\s*/, ""), e || (e = "checkbox"), e += " switch-control", d = $(document.createElement("button")), d.addClass(e), a.before(d)
}
var f = function() {
d.toggleClass("disabled", a.prop("disabled"))
};
f(), a.watch("disabled", f), d.on("click", b), a.on("change", c), c.call(a[0])
}), $("form", a.contextElement).on("reset", function() {
var a = this;
setTimeout(function() {
$('input[type="checkbox"]', a).each(c)
}, 0)
})
}),
function() {
var a = function(a) {
$("[src][data-density]").each(function() {
var b = $(this),
c = b.attr("data-src");
c || (c = b.attr("src"), b.attr("data-src", c));
var d = utility.parseOptions(b.attr("data-density")),
e = Math.abs(1 - a.density),
f = "1";
for (var g in d)
if (d.hasOwnProperty(g)) {
var h = parseFloat(g),
i = Math.abs(h - a.density);
e >= i && (e = i, f = g)
}
if ("1" != f && d.hasOwnProperty(f)) {
var j = d[f];
j ? j.indexOf("//") < 0 && "/" != j.charAt(0) && (j = c.replace(/[^/]+$/, j)) : j = c.replace(/([^/]+)\.([^/]+)$/, "$1@" + f + "x.$2"), b.attr("src", j)
} else b.attr("src", c)
})
};
info.on("zoom", a), $(function() {
a({
density: info.getResolution()
})
})
}(), $(function() {
if (info.isIE7 || info.isIE8) {
var a = $("<style>i:before,i:after{content:none !important}</style>");
$.head.append(a), setTimeout(function() {
a.remove()
}, 0)
}
}), support.pointerEvents || context.on("load", function(a) {
$(".field-icon", a.contextElement).on("mousedown", function(a) {
a.preventDefault(), $(this).children(".field").trigger("focus")
})
}),
function() {
var a = {
loading: utility.prefixClass("state", "loading"),
ready: utility.prefixClass("state", "ready")
};
context.on("load", function(b) {
$("img", b.contextElement).one("load", function() {
$(this).removeClass(a.loading).addClass(a.ready)
}).each(function() {
this.complete ? $(this).trigger("load") : $(this).addClass(a.loading)
}).filter("[data-fallback]").one("error", function() {
var a = $(this);
a.attr("src", a.data("fallback"))
})
})
}(), context.on(function(a) {
$("label", a.contextElement).click(function() {})
}),
function() {
var a = {
progress: "progress",
progressBar: "progress-bar"
};
context.on("load", function(b) {
$("progress." + a.progress, b.contextElement).each(function() {
function b() {
var a = parseFloat(c.val()),
b = a / d * 100;
0 > b ? b = 0 : b > 100 && (b = 100), h.html(utility.parseTemplate(e, {
value: a,
max: d,
percentage: b
})), h.css("width", b + "%")
}
var c = $(this),
d = parseFloat(c.prop("max")),
e = c.html(),
f = c.prop("class"),
g = $(document.createElement("div")).addClass(f),
h = $(document.createElement("div")).addClass(a.progressBar);
c.watch("value max", b), b(), g.append(h), c.before(g)
})
})
}(), context.on("load", function(a) {
function b(a) {
a.preventDefault();
var b = $(this).next();
b[0].disabled || (b[0].checked = !0, f = !1, b.trigger("change"), f = !0, c.call(b[0]))
}
function c() {
f && $('input[name="' + this.name + '"]').each(d)
}
function d() {
var a = $(this).prev(),
b = this.parentNode;
"LABEL" == b.nodeName && $(b).toggleClass(e, this.checked), a.toggleClass(e, this.checked)
}
var e = utility.prefixClass("state", "checked"),
f = !0;
$('input[type="radio"].switch', a.contextElement).each(function() {
var a = $(this),
e = a.prev(".switch-control");
if (!e.length) {
var f = a.prop("class");
f = f.replace(/\s*switch\s*/, ""), f || (f = "radio"), f += " switch-control", e = $(document.createElement("button")), e.addClass(f), a.before(e)
}
var g = function() {
e.toggleClass("disabled", a.prop("disabled"))
};
g(), a.watch("disabled", g), e.on("click", b), a.on("change", c), d.call(a[0])
}), $("form", a.contextElement).on("reset", function() {
var a = this;
setTimeout(function() {
$('input[type="radio"]', a).each(d)
}, 0)
})
}), info.isIE7 || (context.on("load", function(a) {
$(".side-graphic.graphic-right", a.contextElement).each(function() {
var a = $(this),
b = a.children(".graphic"),
c = "",
d = function() {
var d = a.css("position");
d != c && (c = d, "relative" == c ? a.append(b) : a.prepend(b))
};
d(), $.window.on("resize.sideGraphic", d)
})
}), context.on("unload", function() {})), context.on("load", function(a) {
$(".table", a.contextElement).each(function() {
var a = this;
$("col", this).each(function(b) {
var c = ($(this).attr("class") || "").replace(/width\-[^\s]*/i, "");
/^\s*$/.test(c) || $("tr > :nth-child(" + (b + 1) + "):not([colspan])", a).addClass(c)
})
})
}),
function() {
function a(a) {
a.removeClass(g.invalid).addClass(g.valid)
}
function b(a) {
a.removeClass(g.valid).addClass(g.invalid)
}
function c(c, d) {
d ? a(c) : b(c)
}
var d, e, f, g = {
valid: utility.prefixClass("state", "valid"),
invalid: utility.prefixClass("state", "invalid")
};
support.validity && (e = function() {
var a = $(this),
b = a.prop("type");
switch (b) {
case "checkbox":
case "radio":
case "button":
case "submit":
case "reset":
case "image":
case "hidden":
return
}
c(a, this.validity.valid)
}, f = function() {
log("hey"), $("input, select, textarea", this).each(e)
}, d = function(a) {
$("form[data-validate]", a.contextElement).on("change keyup", "input, select, textarea", e).on("submit", f)
}), context.on("load", d)
}(),
function() {
var a = function(a, b) {
var c = $('[name="' + b + '"]'),
d = c.val();
c.length > 1 && c.each(function() {
return "checkbox" != this.type && "radio" != this.type || !this.checked ? void 0 : (d = this.value, !1)
}), "object" == typeof d && d.length && (d = d.join(" ")), a.addClass(d), c.on("change", function() {
a.removeClass(d), d = $(this).val(), "object" == typeof d && d.length && (d = d.join(" ")), a.addClass(d)
})
},
b = function(a, b, c) {
var d = $('[name="' + c + '"]'),
e = d.val();
d.length > 1 && d.each(function() {
return "checkbox" != this.type && "radio" != this.type || !this.checked ? void 0 : (e = this.value, !1)
}), "object" == typeof e && e.length && (e = e.join(", ")), a.attr(b, e), d.on("change", function() {
e = $(this).val(), "object" == typeof e && e.length && (e = e.join(", ")), a.attr(b, e)
})
};
context.on("load", function(c) {
$("[data-watch]", c.contextElement).each(function() {
var c = $(this),
d = utility.parseOptions(c.attr("data-watch"));
for (var e in d)
if (d.hasOwnProperty(e)) {
var f = d[k];
if ("class" == e)
if ("object" == typeof f && f.length)
for (var g = 0; g < f.length; g++) a(c, f[g]);
else a(c, f);
else "string" == typeof f && b(c, e, f)
}
})
})
}(),
function() {
for (var a = 0; a < readyFunctions.length; a++) $(readyFunctions[a])
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment