(function (d) { function r(e, c, l, b, a) { function f() { n.unbind("webkittransitionend transitionend otransitionend otransitionend"); c && x(c, l, b, a); a.startorder = []; a.neworder = []; a.origsort = []; a.checksort = []; v.removestyle(a.prefix + "filter, filter, " + a.prefix + "transform, transform, opacity, display").css(a.clean).removeattr("data-checksum"); window.atob || v.css({ display: "none", opacity: "0" }); n.removestyle(a.prefix + "transition, transition, " + a.prefix + "perspective, perspective, " + a.prefix + "perspective-origin, perspective-origin, " + (a.resizecontainer ? "height" : "")); "list" == a.layoutmode ? (p.css({ display: a.targetdisplaylist, opacity: "1" }), a.origdisplay = a.targetdisplaylist) : (p.css({ display: a.targetdisplaygrid, opacity: "1" }), a.origdisplay = a.targetdisplaygrid); a.origlayout = a.layoutmode; settimeout(function () { v.removestyle(a.prefix + "transition, transition"); a.mixing = !1; if ("function" == typeof a.onmixend) { var b = a.onmixend.call(this, a); a = b ? b : a } }) } clearinterval(a.failsafe); a.mixing = !0; a.filter = e; if ("function" == typeof a.onmixstart) { var g = a.onmixstart.call(this, a); a = g ? g : a } for (var k = a.transitionspeed, g = 0; 2 > g; g++) { var h = 0 == g ? h = a.prefix : ""; a.transition[h + "transition"] = "all " + k + "ms linear"; a.transition[h + "transform"] = h + "translate3d(0,0,0)"; a.perspective[h + "perspective"] = a.perspectivedistance + "px"; a.perspective[h + "perspective-origin"] = a.perspectiveorigin } var w = a.targetselector, v = b.find(w); v.each(function () { this.data = {} }); var n = v.parent(); n.css(a.perspective); a.easingfallback = "ease-in-out"; "smooth" == a.easing && (a.easing = "cubic-bezier(0.25, 0.46, 0.45, 0.94)"); "snap" == a.easing && (a.easing = "cubic-bezier(0.77, 0, 0.175, 1)"); "windback" == a.easing && (a.easing = "cubic-bezier(0.175, 0.885, 0.320, 1.275)", a.easingfallback = "cubic-bezier(0.175, 0.885, 0.320, 1)"); "windup" == a.easing && (a.easing = "cubic-bezier(0.6, -0.28, 0.735, 0.045)", a.easingfallback = "cubic-bezier(0.6, 0.28, 0.735, 0.045)"); g = "list" == a.layoutmode && null != a.listeffects ? a.listeffects : a.effects; array.prototype.indexof && (a.fade = -1 < g.indexof("fade") ? "0" : "", a.scale = -1 < g.indexof("scale") ? "scale(.01)" : "", a.rotatez = -1 < g.indexof("rotatez") ? "rotate(180deg)" : "", a.rotatey = -1 < g.indexof("rotatey") ? "rotatey(90deg)" : "", a.rotatex = -1 < g.indexof("rotatex") ? "rotatex(90deg)" : "", a.blur = -1 < g.indexof("blur") ? "blur(8px)" : "", a.grayscale = -1 < g.indexof("grayscale") ? "grayscale(100%)" : ""); var p = d(), s = d(), t = [], r = !1; "string" === typeof e ? t = z(e) : (r = !0, d.each(e, function (a) { t[a] = z(this) })); "or" == a.filterlogic ? ("" == t[0] && t.shift(), 1 > t.length ? s = s.add(b.find(w + ":visible")) : v.each(function () { var a = d(this); if (r) { var b = 0; d.each(t, function (d) { this.length ? a.is("." + this.join(", .")) && b++ : 0 < b && b++ }); b == t.length ? p = p.add(a) : s = s.add(a) } else a.is("." + t.join(", .")) ? p = p.add(a) : s = s.add(a) })) : (p = p.add(n.find(w + "." + t.join("."))), s = s.add(n.find(w + ":not(." + t.join(".") + "):visible"))); e = p.length; var u = d(), q = d(), m = d(); s.each(function () { var a = d(this); "none" != a.css("display") && (u = u.add(a), m = m.add(a)) }); if (p.filter(":visible").length == e && !u.length && !c) { if (a.origlayout == a.layoutmode) return f(), !1; if (1 == p.length) return "list" == a.layoutmode ? (b.addclass(a.listclass), b.removeclass(a.gridclass), m.css("display", a.targetdisplaylist)) : (b.addclass(a.gridclass), b.removeclass(a.listclass), m.css("display", a.targetdisplaygrid)), f(), !1 } a.origheight = n.height(); if (p.length) { b.removeclass(a.failclass); p.each(function () { var a = d(this); "none" == a.css("display") ? q = q.add(a) : m = m.add(a) }); if (a.origlayout != a.layoutmode && !1 == a.animategridlist) return "list" == a.layoutmode ? (b.addclass(a.listclass), b.removeclass(a.gridclass), m.css("display", a.targetdisplaylist)) : (b.addclass(a.gridclass), b.removeclass(a.listclass), m.css("display", a.targetdisplaygrid)), f(), !1; if (!window.atob) return f(), !1; v.css(a.clean); m.each(function () { this.data.origpos = d(this).offset() }); "list" == a.layoutmode ? (b.addclass(a.listclass), b.removeclass(a.gridclass), q.css("display", a.targetdisplaylist)) : (b.addclass(a.gridclass), b.removeclass(a.listclass), q.css("display", a.targetdisplaygrid)); q.each(function () { this.data.showinterpos = d(this).offset() }); u.each(function () { this.data.hideinterpos = d(this).offset() }); m.each(function () { this.data.preinterpos = d(this).offset() }); "list" == a.layoutmode ? m.css("display", a.targetdisplaylist) : m.css("display", a.targetdisplaygrid); c && x(c, l, b, a); if (c && a(a.origsort, a.checksort)) return f(), !1; u.hide(); q.each(function (a) { this.data.finalpos = d(this).offset() }); m.each(function () { this.data.finalprepos = d(this).offset() }); a.newheight = n.height(); c && x("reset", null, b, a); q.hide(); m.css("display", a.origdisplay); "block" == a.origdisplay ? (b.addclass(a.listclass), q.css("display", a.targetdisplaylist)) : (b.removeclass(a.listclass), q.css("display", a.targetdisplaygrid)); a.resizecontainer && n.css("height", a.origheight + "px"); e = {}; for (g = 0; 2 > g; g++) h = 0 == g ? h = a.prefix : "", e[h + "transform"] = a.scale + " " + a.rotatex + " " + a.rotatey + " " + a.rotatez, e[h + "filter"] = a.blur + " " + a.grayscale; q.css(e); m.each(function () { var b = this.data, c = d(this); c.hasclass("mix_tohide") ? (b.pretx = b.origpos.left - b.hideinterpos.left, b.prety = b.origpos.top - b.hideinterpos.top) : (b.pretx = b.origpos.left - b.preinterpos.left, b.prety = b.origpos.top - b.preinterpos.top); for (var e = {}, k = 0; 2 > k; k++) { var h = 0 == k ? h = a.prefix : ""; e[h + "transform"] = "translate(" + b.pretx + "px," + b.prety + "px)" } c.css(e) }); "list" == a.layoutmode ? (b.addclass(a.listclass), b.removeclass(a.gridclass)) : (b.addclass(a.gridclass), b.removeclass(a.listclass)); settimeout(function () { if (a.resizecontainer) { for (var b = {}, c = 0; 2 > c; c++) { var e = 0 == c ? e = a.prefix : ""; b[e + "transition"] = "all " + k + "ms ease-in-out"; b.height = a.newheight + "px" } n.css(b) } u.css("opacity", a.fade); q.css("opacity", 1); q.each(function () { var b = this.data; b.tx = b.finalpos.left - b.showinterpos.left; b.ty = b.finalpos.top - b.showinterpos.top; for (var c = {}, e = 0; 2 > e; e++) { var h = 0 == e ? h = a.prefix : ""; c[h + "transition-property"] = h + "transform, " + h + "filter, opacity"; c[h + "transition-timing-function"] = a.easing + ", linear, linear"; c[h + "transition-duration"] = k + "ms"; c[h + "transition-delay"] = "0"; c[h + "transform"] = "translate(" + b.tx + "px," + b.ty + "px)"; c[h + "filter"] = "none" } d(this).css("-webkit-transition", "all " + k + "ms " + a.easingfallback).css(c) }); m.each(function () { var b = this.data; b.tx = 0 != b.finalprepos.left ? b.finalprepos.left - b.preinterpos.left : 0; b.ty = 0 != b.finalprepos.left ? b.finalprepos.top - b.preinterpos.top : 0; for (var c = {}, e = 0; 2 > e; e++) { var h = 0 == e ? h = a.prefix : ""; c[h + "transition"] = "all " + k + "ms " + a.easing; c[h + "transform"] = "translate(" + b.tx + "px," + b.ty + "px)" } d(this).css("-webkit-transition", "all " + k + "ms " + a.easingfallback).css(c) }); b = {}; for (c = 0; 2 > c; c++) e = 0 == c ? e = a.prefix : "", b[e + "transition"] = "all " + k + "ms " + a.easing + ", " + e + "filter " + k + "ms linear, opacity " + k + "ms linear", b[e + "transform"] = a.scale + " " + a.rotatex + " " + a.rotatey + " " + a.rotatez, b[e + "filter"] = a.blur + " " + a.grayscale, b.opacity = a.fade; u.css(b); n.bind("webkittransitionend transitionend otransitionend otransitionend", function (a) { if (-1 < a.originalevent.propertyname.indexof("transform") || -1 < a.originalevent.propertyname.indexof("opacity")) - 1 < w.indexof(".") ? d(a.target).hasclass(w.replace(".", "")) && f() : d(a.target).is(w) && f() }) }, 10); a.failsafe = settimeout(function () { a.mixing && f() }, k + 400) } else { a.resizecontainer && n.css("height", a.origheight + "px"); if (!window.atob) return f(), !1; u = s; settimeout(function () { n.css(a.perspective); if (a.resizecontainer) { for (var c = {}, e = 0; 2 > e; e++) { var d = 0 == e ? d = a.prefix : ""; c[d + "transition"] = "height " + k + "ms ease-in-out"; c.height = a.minheight + "px" } n.css(c) } v.css(a.transition); if (s.length) { c = {}; for (e = 0; 2 > e; e++) d = 0 == e ? d = a.prefix : "", c[d + "transform"] = a.scale + " " + a.rotatex + " " + a.rotatey + " " + a.rotatez, c[d + "filter"] = a.blur + " " + a.grayscale, c.opacity = a.fade; u.css(c); n.bind("webkittransitionend transitionend otransitionend otransitionend", function (c) { if (-1 < c.originalevent.propertyname.indexof("transform") || -1 < c.originalevent.propertyname.indexof("opacity")) b.addclass(a.failclass), f() }) } else a.mixing = !1 }, 10) } } function x(e, c, l, b) { function a(a, b) { var c = isnan(1 * a.attr(e)) ? a.attr(e).tolowercase() : 1 * a.attr(e), d = isnan(1 * b.attr(e)) ? b.attr(e).tolowercase() : 1 * b.attr(e); return c < d ? -1 : c > d ? 1 : 0 } function f(a) { "asc" == c ? k.prepend(a).prepend(" ") : k.append(a).append(" ") } function g(a) { a = a.slice(); for (var b = a.length, c = b; c--;) { var e = parseint(math.random() * b), d = a[c]; a[c] = a[e]; a[e] = d } return a } l.find(b.targetselector).wrapall('
'); var k = l.find(".mix_sorter"); b.origsort.length || k.find(b.targetselector + ":visible").each(function () { d(this).wrap(""); b.origsort.push(d(this).parent().html().replace(/\s+/g, "")); d(this).unwrap() }); k.empty(); if ("reset" == e) d.each(b.startorder, function () { k.append(this).append(" ") }); else if ("default" == e) d.each(b.origorder, function () { f(this) }); else if ("random" == e) b.neworder.length || (b.neworder = g(b.startorder)), d.each(b.neworder, function () { k.append(this).append(" ") }); else if ("custom" == e) d.each(c, function () { f(this) }); else { if ("undefined" === typeof b.origorder[0].attr(e)) return console.log("no such attribute found. terminating"), !1; b.neworder.length || (d.each(b.origorder, function () { b.neworder.push(d(this)) }), b.neworder.sort(a)); d.each(b.neworder, function () { f(this) }) } b.checksort = []; k.find(b.targetselector + ":visible").each(function (a) { var c = d(this); 0 == a && c.attr("data-checksum", "1"); c.wrap(""); b.checksort.push(c.parent().html().replace(/\s+/g, "")); c.unwrap() }); l.find(b.targetselector).unwrap() } function b(e) { for (var c = ["webkit", "moz", "o", "ms"], d = 0; d < c.length; d++) if (c[d] + "transition" in e.style) return c[d]; return "transition" in e.style ? "" : !1 } function a(e, c) { if (e.length != c.length) return !1; for (var d = 0; d < c.length; d++) if (e[d].compare && !e[d].compare(c[d]) || e[d] !== c[d]) return !1; return !0 } function z(e) { e = e.replace(/\s{2,}/g, " "); var c = e.split(" "); d.each(c, function (d) { "all" == this && (c[d] = "mix_all") }); "" == c[0] && c.shift(); return c } var y = { init: function (e) { return this.each(function () { var c = window.navigator.appversion.match(/chrome\/(\d+)\./), c = c ? parseint(c[1], 10) : !1, l = function (a) { a = document.getelementbyid(a); var b = a.parentelement, c = document.createelement("div"), d = document.createdocumentfragment(); b.insertbefore(c, a); d.appendchild(a); b.replacechild(a, c) }; (c && 31 == c || 32 == c) && l(this.id); var b = { targetselector: ".mix", filterselector: ".filter", sortselector: ".sort", buttonevent: "click", effects: ["fade", "scale"], listeffects: null, easing: "smooth", layoutmode: "grid", targetdisplaygrid: "inline-block", targetdisplaylist: "block", listclass: "", gridclass: "", transitionspeed: 600, showonload: "all", sortonload: !1, multifilter: !1, filterlogic: "or", resizecontainer: !0, minheight: 0, failclass: "fail", perspectivedistance: "3000", perspectiveorigin: "50% 50%", animategridlist: !0, onwarload: null, onmixstart: null, onmixend: null, container: null, origorder: [], startorder: [], neworder: [], origsort: [], checksort: [], filter: "", mixing: !1, origdisplay: "", origlayout: "", origheight: 0, newheight: 0, istouch: !1, resetdelay: 0, failsafe: null, prefix: "", easingfallback: "ease-in-out", transition: {}, perspective: {}, clean: {}, fade: "1", scale: "", rotatex: "", rotatey: "", rotatez: "", blur: "", grayscale: "" }; e && d.extend(b, e); this.config = b; d.support.touch = "ontouchend" in document; d.support.touch && (b.istouch = !0, b.resetdelay = 350); b.container = d(this); var a = b.container; b.prefix = b(a[0]); b.prefix = b.prefix ? "-" + b.prefix.tolowercase() + "-" : ""; a.find(b.targetselector).each(function () { b.origorder.push(d(this)) }); if (b.sortonload) { var f; d.isarray(b.sortonload) ? (c = b.sortonload[0], f = b.sortonload[1], d(b.sortselector + "[data-sort=" + b.sortonload[0] + "][data-order=" + b.sortonload[1] + "]").addclass("active")) : (d(b.sortselector + "[data-sort=" + b.sortonload + "]").addclass("active"), c = b.sortonload, b.sortonload = "desc"); x(c, f, a, b) } for (f = 0; 2 > f; f++) c = 0 == f ? c = b.prefix : "", b.transition[c + "transition"] = "all " + b.transitionspeed + "ms ease-in-out", b.perspective[c + "perspective"] = b.perspectivedistance + "px", b.perspective[c + "perspective-origin"] = b.perspectiveorigin; for (f = 0; 2 > f; f++) c = 0 == f ? c = b.prefix : "", b.clean[c + "transition"] = "none"; "list" == b.layoutmode ? (a.addclass(b.listclass), b.origdisplay = b.targetdisplaylist) : (a.addclass(b.gridclass), b.origdisplay = b.targetdisplaygrid); b.origlayout = b.layoutmode; f = b.showonload.split(" "); d.each(f, function () { d(b.filterselector + '[data-filter="' + this + '"]').addclass("active") }); a.find(b.targetselector).addclass("mix_all"); "all" == f[0] && (f[0] = "mix_all", b.showonload = "mix_all"); var g = d(); d.each(f, function () { g = g.add(d("." + this)) }); g.each(function () { var a = d(this); "list" == b.layoutmode ? a.css("display", b.targetdisplaylist) : a.css("display", b.targetdisplaygrid); a.css(b.transition) }); settimeout(function () { b.mixing = !0; g.css("opacity", "1"); settimeout(function () { "list" == b.layoutmode ? g.removestyle(b.prefix + "transition, transition").css({ display: b.targetdisplaylist, opacity: 1 }) : g.removestyle(b.prefix + "transition, transition").css({ display: b.targetdisplaygrid, opacity: 1 }); b.mixing = !1; if ("function" == typeof b.onwarload) { var a = b.onwarload.call(this, b); b = a ? a : b } }, b.transitionspeed) }, 10); b.filter = b.showonload; d(b.sortselector).bind(b.buttonevent, function () { if (!b.mixing) { var c = d(this), e = c.attr("data-sort"), f = c.attr("data-order"); if (!c.hasclass("active")) d(b.sortselector).removeclass("active"), c.addclass("active"); else if ("random" != e) return !1; a.find(b.targetselector).each(function () { b.startorder.push(d(this)) }); r(b.filter, e, f, a, b) } }); d(b.filterselector).bind(b.buttonevent, function () { if (!b.mixing) { var c = d(this); if (!1 == b.multifilter) d(b.filterselector).removeclass("active"), c.addclass("active"), b.filter = c.attr("data-filter"), d(b.filterselector + '[data-filter="' + b.filter + '"]').addclass("active"); else { var e = c.attr("data-filter"); c.hasclass("active") ? (c.removeclass("active"), b.filter = b.filter.replace(regexp("(\\s|^)" + e), "")) : (c.addclass("active"), b.filter = b.filter + " " + e) } r(b.filter, null, null, a, b) } }) }) }, togrid: function () { return this.each(function () { var e = this.config; "grid" != e.layoutmode && (e.layoutmode = "grid", r(e.filter, null, null, d(this), e)) }) }, tolist: function () { return this.each(function () { var e = this.config; "list" != e.layoutmode && (e.layoutmode = "list", r(e.filter, null, null, d(this), e)) }) }, filter: function (e) { return this.each(function () { var c = this.config; c.mixing || (d(c.filterselector).removeclass("active"), d(c.filterselector + '[data-filter="' + e + '"]').addclass("active"), r(e, null, null, d(this), c)) }) }, sort: function (e) { return this.each(function () { var c = this.config, l = d(this); if (!c.mixing) { d(c.sortselector).removeclass("active"); if (d.isarray(e)) { var b = e[0], a = e[1]; d(c.sortselector + '[data-sort="' + e[0] + '"][data-order="' + e[1] + '"]').addclass("active") } else d(c.sortselector + '[data-sort="' + e + '"]').addclass("active"), b = e, a = "desc"; l.find(c.targetselector).each(function () { c.startorder.push(d(this)) }); r(c.filter, b, a, l, c) } }) }, multimix: function (e) { return this.each(function () { var c = this.config, l = d(this); multiout = { filter: c.filter, sort: null, order: "desc", layoutmode: c.layoutmode }; d.extend(multiout, e); c.mixing || (d(c.filterselector).add(c.sortselector).removeclass("active"), d(c.filterselector + '[data-filter="' + multiout.filter + '"]').addclass("active"), "undefined" !== typeof multiout.sort && (d(c.sortselector + '[data-sort="' + multiout.sort + '"][data-order="' + multiout.order + '"]').addclass("active"), l.find(c.targetselector).each(function () { c.startorder.push(d(this)) })), c.layoutmode = multiout.layoutmode, r(multiout.filter, multiout.sort, multiout.order, l, c)) }) }, remix: function (e) { return this.each(function () { var c = this.config, l = d(this); c.origorder = []; l.find(c.targetselector).each(function () { var b = d(this); b.addclass("mix_all"); c.origorder.push(b) }); c.mixing || "undefined" === typeof e || (d(c.filterselector).removeclass("active"), d(c.filterselector + '[data-filter="' + e + '"]').addclass("active"), r(e, null, null, l, c)) }) } }; d.fn.themewar = function (d, c) { if (y[d]) return y[d].apply(this, array.prototype.slice.call(arguments, 1)); if ("object" === typeof d || !d) return y.init.apply(this, arguments) }; d.fn.removestyle = function (e) { return this.each(function () { var c = d(this); e = e.replace(/\s+/g, ""); var l = e.split(","); d.each(l, function () { var b = regexp(this.tostring() + "[^;]+;?", "g"); c.attr("style", function (a, c) { if (c) return c.replace(b, "") }) }) }) } })(jquery);