"
);
});
$container.append($htmlUl).append($htmlPane);
$j(this).before($container);
$j(this).remove();
});
$j(".theme-tabs").tabs();
}
// jump to hash in url
function jumpToUrlHash() {
if (window.location.hash != "" && /q=|fq=/.test(window.location.hash)) {
var hash = window.location.hash,
element = $j(hash)[0];
element.scrollIntoView();
}
}
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
var vars = [],
hash;
var hashes = window.location.href
.slice(window.location.href.indexOf("?") + 1)
.split("&");
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split("=");
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
// append search parameter to urls
function appendSearchQuery($links) {
var urlParameters = getUrlVars();
if ($j.inArray("query", urlParameters) !== -1) {
var queryValue = urlParameters["query"];
$links.each(function () {
var $link = $j(this);
$link.attr("href", $link.attr("href") + "?query=" + queryValue);
});
}
}
// Cut Quicklinks dynamically
function cutQuickLinks() {
if (!$j(".lt-ie9").length) {
$j(".buehne .quicklinks, #content-buehne .quicklinks").each(function () {
var $this = $j(this),
$module = $this.find("> div"),
$moduleInside = $this.find(".bottom"),
moduleHeight = parseInt($module.outerHeight()),
insideHeight = 0;
$this.find("ul li").css("display", "block");
if (!isMobile) {
insideHeight = parseInt($moduleInside.outerHeight());
while (moduleHeight < insideHeight) {
$this.find("ul li:visible:last").css("display", "none");
insideHeight = parseInt($moduleInside.outerHeight());
}
}
});
}
}
//function to add url parameter without reloading - has to be modified if parameter should be added to another parameter
function addUrlParameter(paramterName, value) {
window.history.replaceState(
{},
"",
window.location.pathname + "?" + paramterName + "=" + value
);
}
/***
** Plugins for Encasa
***/
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
var Mustache = (typeof module !== "undefined" && module.exports) || {};
(function (exports) {
exports.name = "mustache.js";
exports.version = "0.5.1-dev";
exports.tags = ["{{", "}}"];
exports.parse = parse;
exports.clearCache = clearCache;
exports.compile = compile;
exports.compilePartial = compilePartial;
exports.render = render;
exports.Scanner = Scanner;
exports.Context = Context;
exports.Renderer = Renderer;
// This is here for backwards compatibility with 0.4.x.
exports.to_html = function (template, view, partials, send) {
var result = render(template, view, partials);
if (typeof send === "function") {
send(result);
} else {
return result;
}
};
var whiteRe = /\s*/;
var spaceRe = /\s+/;
var nonSpaceRe = /\S/;
var eqRe = /\s*=/;
var curlyRe = /\s*\}/;
var tagRe = /#|\^|\/|>|\{|&|=|!/;
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
// See https://github.com/janl/mustache.js/issues/189
function testRe(re, string) {
return RegExp.prototype.test.call(re, string);
}
function isWhitespace(string) {
return !testRe(nonSpaceRe, string);
}
var isArray =
Array.isArray ||
function (obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
};
// OSWASP Guidlines: escape all non alphanumeric characters in ASCII space.
var jsCharsRe = /[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\xFF\u2028\u2029]/gm;
function quote(text) {
var escaped = text.replace(jsCharsRe, function (c) {
return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);
});
return '"' + escaped + '"';
}
function escapeRe(string) {
return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
var entityMap = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"/": "/",
};
function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s];
});
}
// Export these utility functions.
exports.isWhitespace = isWhitespace;
exports.isArray = isArray;
exports.quote = quote;
exports.escapeRe = escapeRe;
exports.escapeHtml = escapeHtml;
function Scanner(string) {
this.string = string;
this.tail = string;
this.pos = 0;
}
/**
* Returns `true` if the tail is empty (end of string).
*/
Scanner.prototype.eos = function () {
return this.tail === "";
};
/**
* Tries to match the given regular expression at the current position.
* Returns the matched text if it can match, `null` otherwise.
*/
Scanner.prototype.scan = function (re) {
var match = this.tail.match(re);
if (match && match.index === 0) {
this.tail = this.tail.substring(match[0].length);
this.pos += match[0].length;
return match[0];
}
return null;
};
/**
* Skips all text until the given regular expression can be matched. Returns
* the skipped string, which is the entire tail of this scanner if no match
* can be made.
*/
Scanner.prototype.scanUntil = function (re) {
var match,
pos = this.tail.search(re);
switch (pos) {
case -1:
match = this.tail;
this.pos += this.tail.length;
this.tail = "";
break;
case 0:
match = null;
break;
default:
match = this.tail.substring(0, pos);
this.tail = this.tail.substring(pos);
this.pos += pos;
}
return match;
};
function Context(view, parent) {
this.view = view;
this.parent = parent;
this.clearCache();
}
Context.make = function (view) {
return view instanceof Context ? view : new Context(view);
};
Context.prototype.clearCache = function () {
this._cache = {};
};
Context.prototype.push = function (view) {
return new Context(view, this);
};
Context.prototype.lookup = function (name) {
var value = this._cache[name];
if (!value) {
if (name === ".") {
value = this.view;
} else {
var context = this;
//support current context only search: ".children"
var noBubble = name && name[0] === ".";
while (context) {
if (name.indexOf(".") > -1) {
var names = name.split("."),
i = 0;
if (noBubble) {
names.shift();
}
value = context.view;
while (value && i < names.length) {
value = value[names[i++]];
}
} else {
value = context.view[name];
}
if (value != null || noBubble) {
break;
}
context = context.parent;
}
}
this._cache[name] = value;
}
if (typeof value === "function") {
value = value.call(this.view);
}
return value;
};
function Renderer() {
this.clearCache();
}
Renderer.prototype.clearCache = function () {
this._cache = {};
this._partialCache = {};
};
Renderer.prototype.compile = function (tokens, tags) {
var fn = compileTokens(tokens),
self = this;
return function (view) {
return fn(Context.make(view), self);
};
};
Renderer.prototype.compilePartial = function (name, tokens, tags) {
this._partialCache[name] = this.compile(tokens, tags);
return this._partialCache[name];
};
Renderer.prototype.render = function (template, view) {
var fn = this._cache[template];
if (!fn) {
fn = this.compile(template);
this._cache[template] = fn;
}
return fn(view);
};
Renderer.prototype._section = function (name, context, callback) {
var value = context.lookup(name);
switch (typeof value) {
case "object":
if (isArray(value)) {
var buffer = "";
for (var i = 0, len = value.length; i < len; ++i) {
buffer += callback(context.push(value[i]), this);
}
return buffer;
} else {
return callback(context.push(value), this);
}
break;
case "function":
var sectionText = callback(context, this),
self = this;
var scopedRender = function (template) {
return self.render(template, context);
};
return value.call(context.view, sectionText, scopedRender) || "";
break;
default:
if (value) {
return callback(context, this);
}
}
return "";
};
Renderer.prototype._inverted = function (name, context, callback) {
var value = context.lookup(name);
// From the spec: inverted sections may render text once based on the
// inverse value of the key. That is, they will be rendered if the key
// doesn't exist, is false, or is an empty list.
if (
value == null ||
value === false ||
(isArray(value) && value.length === 0)
) {
return callback(context, this);
}
return "";
};
Renderer.prototype._partial = function (name, context) {
var fn = this._partialCache[name];
if (fn) {
return fn(context, this);
}
return "";
};
Renderer.prototype._name = function (name, context, escape) {
var value = context.lookup(name);
if (typeof value === "function") {
value = value.call(context.view);
}
var string = value == null ? "" : String(value);
if (escape) {
return escapeHtml(string);
}
return string;
};
/**
* Low-level function that compiles the given `tokens` into a
* function that accepts two arguments: a Context and a
* Renderer. Returns the body of the function as a string if
* `returnBody` is true.
*/
function compileTokens(tokens, returnBody) {
if (typeof tokens === "string") {
tokens = parse(tokens);
}
var body = ['""'];
var token, method, escape;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
switch (token.type) {
case "#":
case "^":
method = token.type === "#" ? "_section" : "_inverted";
body.push(
"r." +
method +
"(" +
quote(token.value) +
", c, function (c, r) {\n" +
" " +
compileTokens(token.tokens, true) +
"\n" +
"})"
);
break;
case "{":
case "&":
case "name":
escape = token.type === "name" ? "true" : "false";
body.push("r._name(" + quote(token.value) + ", c, " + escape + ")");
break;
case ">":
body.push("r._partial(" + quote(token.value) + ", c)");
break;
case "text":
body.push(quote(token.value));
break;
}
}
// Convert to a string body.
body = "return " + body.join(" + ") + ";";
// Good for debugging.
// console.log(body);
if (returnBody) {
return body;
}
// For great evil!
return new Function("c, r", body);
}
function escapeTags(tags) {
if (tags.length === 2) {
return [
new RegExp(escapeRe(tags[0]) + "\\s*"),
new RegExp("\\s*" + escapeRe(tags[1])),
];
}
throw new Error("Invalid tags: " + tags.join(" "));
}
/**
* Forms the given linear array of `tokens` into a nested tree structure
* where tokens that represent a section have a "tokens" array property
* that contains all tokens that are in that section.
*/
function nestTokens(tokens) {
var tree = [];
var collector = tree;
var sections = [];
var token, section;
for (var i = 0; i < tokens.length; ++i) {
token = tokens[i];
switch (token.type) {
case "#":
case "^":
token.tokens = [];
sections.push(token);
collector.push(token);
collector = token.tokens;
break;
case "/":
if (sections.length === 0) {
throw new Error("Unopened section: " + token.value);
}
section = sections.pop();
if (section.value !== token.value) {
throw new Error("Unclosed section: " + section.value);
}
if (sections.length > 0) {
collector = sections[sections.length - 1].tokens;
} else {
collector = tree;
}
break;
default:
collector.push(token);
}
}
// Make sure there were no open sections when we're done.
section = sections.pop();
if (section) {
throw new Error("Unclosed section: " + section.value);
}
return tree;
}
/**
* Combines the values of consecutive text tokens in the given `tokens` array
* to a single token.
*/
function squashTokens(tokens) {
var lastToken;
for (var i = 0; i < tokens.length; ++i) {
token = tokens[i];
if (lastToken && lastToken.type === "text" && token.type === "text") {
lastToken.value += token.value;
tokens.splice(i--, 1); // Remove this token from the array.
} else {
lastToken = token;
}
}
}
/**
* Breaks up the given `template` string into a tree of token objects. If
* `tags` is given here it must be an array with two string values: the
* opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
* course, the default is to use mustaches (i.e. Mustache.tags).
*/
function parse(template, tags) {
tags = tags || exports.tags;
tagRes = escapeTags(tags);
var scanner = new Scanner(template);
var tokens = [], // Buffer to hold the tokens
spaces = [], // Indices of whitespace tokens on the current line
hasTag = false, // Is there a {{tag}} on the current line?
nonSpace = false; // Is there a non-space char on the current line?
// Strips all whitespace tokens array for the current line
// if there was a {{#tag}} on it and otherwise only space.
var stripSpace = function () {
if (hasTag && !nonSpace) {
while (spaces.length) {
tokens.splice(spaces.pop(), 1);
}
} else {
spaces = [];
}
hasTag = false;
nonSpace = false;
};
var type, value, chr;
while (!scanner.eos()) {
value = scanner.scanUntil(tagRes[0]);
if (value) {
for (var i = 0, len = value.length; i < len; ++i) {
chr = value[i];
if (isWhitespace(chr)) {
spaces.push(tokens.length);
} else {
nonSpace = true;
}
tokens.push({ type: "text", value: chr });
if (chr === "\n") {
stripSpace(); // Check for whitespace on the current line.
}
}
}
// Match the opening tag.
if (!scanner.scan(tagRes[0])) {
break;
}
hasTag = true;
type = scanner.scan(tagRe) || "name";
// Skip any whitespace between tag and value.
scanner.scan(whiteRe);
// Extract the tag value.
if (type === "=") {
value = scanner.scanUntil(eqRe);
scanner.scan(eqRe);
scanner.scanUntil(tagRes[1]);
} else if (type === "{") {
var closeRe = new RegExp("\\s*" + escapeRe("}" + tags[1]));
value = scanner.scanUntil(closeRe);
scanner.scan(curlyRe);
scanner.scanUntil(tagRes[1]);
} else {
value = scanner.scanUntil(tagRes[1]);
}
// Match the closing tag.
if (!scanner.scan(tagRes[1])) {
throw new Error("Unclosed tag at " + scanner.pos);
}
tokens.push({ type: type, value: value });
if (type === "name" || type === "{" || type === "&") {
nonSpace = true;
}
// Set the tags for the next time around.
if (type === "=") {
tags = value.split(spaceRe);
tagRes = escapeTags(tags);
}
}
squashTokens(tokens);
return nestTokens(tokens);
}
// The high-level clearCache, compile, compilePartial, and render functions
// use this default renderer.
var _renderer = new Renderer();
/**
* Clears all cached templates and partials.
*/
function clearCache() {
_renderer.clearCache();
}
/**
* High-level API for compiling the given `tokens` down to a reusable
* function. If `tokens` is a string it will be parsed using the given `tags`
* before it is compiled.
*/
function compile(tokens, tags) {
return _renderer.compile(tokens, tags);
}
/**
* High-level API for compiling the `tokens` for the partial with the given
* `name` down to a reusable function. If `tokens` is a string it will be
* parsed using the given `tags` before it is compiled.
*/
function compilePartial(name, tokens, tags) {
return _renderer.compilePartial(name, tokens, tags);
}
/**
* High-level API for rendering the `template` using the given `view`. The
* optional `partials` object may be given here for convenience, but note that
* it will cause all partials to be re-compiled, thus hurting performance. Of
* course, this only matters if you're going to render the same template more
* than once. If so, it is best to call `compilePartial` before calling this
* function and to leave the `partials` argument blank.
*/
function render(template, view, partials) {
if (partials) {
for (var name in partials) {
compilePartial(name, partials[name]);
}
}
return _renderer.render(template, view);
}
})(Mustache);
/**
*
*
* VALIDATION
*
*
*/
/**
* A namespace for shared validators.
*/
$j.validator = {};
/**
* Checks if there is a value in a field.
*
* Options:
* 'field': The name of the field.
*
* @param {jQuery} $container jQuery element.
* @param {Object} options Options object.
* @param {Function} callback Is called with true on success and false on failure.
*/
$j.validator.checkNotEmpty = function ($container, options, callback) {
var $field;
if (options.field) {
$field = $container.find('[name="' + options.field + '"]');
} else if (options.possibleField) {
$field = options.possibleField;
} else {
callback(false);
}
callback($j.trim($field.val()).length > 0);
};
/**
* Checks if the value is a valid email address according to the W3C HTML5 Spec:
* http://www.w3.org/TR/html5/forms.html#valid-e-mail-address
*
* The regex of this validator does adhere to RFC 5322.
*
* Options:
* 'field': The name of the field.
*
* @param {jQuery} $container jQuery element.
* @param {Object} options Options object.
* @param {Function} callback Is called with true on success and false on failure.
*/
$j.validator.checkEmailFormat = function ($container, options, callback) {
var $field;
if (options.field) {
$field = $container.find('[name="' + options.field + '"]');
} else if (options.possibleField) {
$field = options.possibleField;
} else {
callback(false);
}
var regex = new RegExp("^.{1,}@.{2,}..{2,}");
callback(regex.test($field.val()));
};
/**
* Returns true if a checkbox is checked and false otherwise.
*
* Options:
* 'field': The name of the field.
*
* @param {jQuery} $container jQuery element.
* @param {Object} options Options object.
* @param {Function} callback Is called with true on success and false on failure.
*/
$j.validator.isCheckboxChecked = function ($container, options, callback) {
var field = options.possibleField;
callback(field.prop("checked"));
};
/* Postal/Zip Code validation */
$j.validator.checkZipCode = function ($container, options, callback) {
/* var $field;
TODO Implement Validation for different Countries
if (options.field) {
$field = $container.find('[name="' + options.field + '"]');
} else if (options.possibleField) {
$field = options.possibleField;
} else {
callback(false);
}
//Check if a special Ziplength is set
var zipLength = $field.attr('data-ziplength');
if(typeof zipLength != "undefined"){
var regex = new RegExp("^[0-9]{" + zipLength + "}$");
}else{
//Default is 5
var regex = new RegExp("^[0-9]{5}$");
}
callback(regex.test($field.val())); */
return true;
};
/* Phone number validation */
$j.validator.checkPhoneNumber = function ($container, options, callback) {
var $field;
if (options.field) {
$field = $container.find('[name="' + options.field + '"]');
} else if (options.possibleField) {
$field = options.possibleField;
} else {
callback(false);
}
var regex = new RegExp("^[0-9-+()/.]+$");
callback(regex.test($field.val()));
};
/* sql injection validation */
$j.validator.checkInjection = function ($container, options, callback) {
var $field;
if (options.field) {
$field = $container.find('[name="' + options.field + '"]');
} else if (options.possibleField) {
$field = options.possibleField;
} else {
callback(false);
}
var regex = new RegExp("^$|^[^<>&]+$");
callback(regex.test($field.val()));
};
/**
* A simple validation plugin.
* This function is called recursively until all fields are valid.
*
* @param {Object} options
*/
$j.fn.validate = function (options) {
$element = this;
var validationMessages = $element.find(".error-txt");
var resultCount = 0;
var isValid = true;
function evaluateResult(result) {
resultCount++;
if (result === false) {
isValid = false;
}
if (resultCount == validationMessages.length) {
// validation is done
if (isValid && options.success) {
return options.success();
}
if (!isValid && options.failure) {
return options.failure();
}
}
}
// clear previous error highlights
$element.find(".error").removeClass("error");
validationMessages.css("display", "none");
// invoke the validators
validationMessages.each(function () {
var $messageElement = $j(this);
var attributes = this.attributes;
var validatorId = $messageElement.attr("data-validator");
// retrieve the validator function
var validator = $j.validator[validatorId];
if (!validator) {
return evaluateResult(true);
}
// prepare the validator options
var validatorOptions = {};
var validatorOptionRegex = new RegExp("data-validator-(.*)");
$j.each(attributes, function (index, attr) {
var match = validatorOptionRegex.exec(attr.name);
if (match !== null) {
validatorOptions[match[1]] = attr.value;
}
});
var $possibleField = $messageElement
.parents(".row")
.find("input, textarea, select");
if ($possibleField.length) {
validatorOptions.possibleField = $possibleField;
}
// invoke!
validator($element, validatorOptions, function (result) {
if (!result) {
$messageElement.css("display", "block");
if ($messageElement.attr("data-highlight")) {
var sel = $messageElement.attr("data-highlight");
$element.find(sel).addClass("error");
if ($element.closest(".cta-kit-test-drive").length) {
$element.closest(".cta-kit-test-drive").ctaTeaserHeightOneImage();
}
} else {
$messageElement.parents(".row").addClass("error");
if ($element.closest(".cta-kit-test-drive").length) {
$element.closest(".cta-kit-test-drive").ctaTeaserHeightOneImage();
}
}
}
evaluateResult(result);
});
});
};
/**
* Formular Pane function
* Three pane formular with validation and AJAX Submit and thank you page
**/
$j.fn.initFormTeaser = function (opts) {
return $j(this).each(function () {
var $teaser = $j(this),
$panes = $teaser.find(".form");
/* Validation and switching panes */
$panes
.filter(".pane-1")
.find(".button[type=button]")
.on("click", function () {
var $pane = $j(this).parents(".form");
//Jump Back to Top of Container
$j("html,body").scrollTop($teaser.offset().top);
/* Validation */
$pane.validate({
success: function () {
$pane.addClass("hide");
$pane.next(".form").removeClass("hide");
//GTM Tracking of 5-Step Wizard
if (typeof dataLayer != "undefined") {
if ($teaser.hasClass("cta-config-wizard")) {
//Tracking for Wizard
var index = $teaser.find(".config .config-pane").length + 2;
dataLayer.push({
event: "page",
pageName: "widget/configurator/step" + index + ".html",
});
} else {
//Tracking for Callback-Teaser
dataLayer.push({
event: "page",
pageName: "Callback/step2.html",
});
}
}
if (opts && typeof opts.afterValid == "function") {
opts.afterValid();
}
},
failure: function () {
if (opts && typeof opts.afterFailure == "function") {
opts.afterFailure();
}
},
});
});
/* Validation and sending content */
$teaser.find("form").on("submit", function (e) {
e.preventDefault();
var $form = $j(this),
$pane = $form.find(".pane-2"),
clientId = Date.now();
//Jump Back to Top of Container
$j("html,body").scrollTop($teaser.offset().top);
//Random Number for every User
if (!$j.cookie("internetLeadID")) {
//Random Number per User
var internetLeadID = Math.random();
$j.cookie("internetLeadID", internetLeadID, {
expires: 365,
path: "/",
});
//Write InternetLead in dataLayer
/* dataLayer[0].internetLeadID = internetLeadID; */
} else {
var internetLeadID = $j.cookie("internetLeadID");
}
/**
* Check for Affilliate ID and write it into a hidden Inputfield
*/
if (
getUrlVars() &&
getUrlVars()["aff_id"] &&
getUrlVars()["aff_id"] !== ""
) {
var affID = getUrlVars()["aff_id"];
var orderId = affID + "_" + internetLeadID;
clientId = affID + "_" + clientId;
if (!$teaser.find("form input[name=publisherID]").length) {
$teaser
.find("form")
.append(
''
);
}
if (!$teaser.find("form input[name=orderID]").length) {
$teaser
.find("form")
.append(
''
);
}
}
if (!$teaser.find("form input[name=clientID]").length) {
$teaser
.find("form")
.append(
''
);
}
$pane.validate({
success: function () {
$j.ajax({
method: "POST",
url: $form.attr("action"),
data: $form.serialize(),
success: function (data, textStatus, jqXHR) {
if (data == "success") {
//Get Timestamp
var clientId = Date.now();
//Combine Timestamp with Affiliate ID
if (
getUrlVars() &&
getUrlVars()["aff_id"] &&
getUrlVars()["aff_id"] !== ""
) {
var affID = getUrlVars()["aff_id"];
clientId = affID + "_" + clientId;
}
$teaser.find(".pane-2").addClass("hide");
$teaser.find(".pane-3").removeClass("hide");
if (opts && typeof opts.afterValid == "function") {
opts.afterValid();
}
// GTM - Tracking
if (typeof dataLayer != "undefined") {
//Check if CTA Callback or Config Wizard
if ($teaser.hasClass("cta-callback")) {
//Create Tracking
dataLayer.push({
event: "page",
pageName: "callback/step3.html",
});
dataLayer.push({
event: "event",
eventCategory: "lead-status",
eventAction: clientId,
eventLabel: internetLeadID,
cm1: "1",
});
} else {
//Track Wizard
var index = $teaser.find(".config .config-pane").length + 3;
//Create Tracking
dataLayer.push({
event: "page",
pageName: "widget/configurator/step" + index + ".html",
});
dataLayer.push({
event: "event",
eventCategory: "lead-status",
eventAction: clientId,
eventLabel: internetLeadID,
cm1: "1",
});
dataLayer.push({
event: "productDetail",
ecommerce: {
detail: {
actionField: { list: "widget" },
products: [
{
name: resultProductTeaserVal.name,
id: resultProductTeaserVal.id,
price: resultProductTeaserVal.price,
category: resultProductTeaserVal.clickPath,
},
],
},
},
});
}
}
} else {
$form.find(".error-message").removeClass("hidden");
$form.closest(".cta-callback").ctaTeaserHeight();
}
},
error: function (errortxt, label, txt) {
$form.find(".error-message").removeClass("hidden");
$form.closest(".cta-callback").ctaTeaserHeight();
console.log("Error: " + txt);
console.log(label);
},
});
},
failure: function () {
if (opts && typeof opts.afterFailure == "function") {
opts.afterFailure();
}
},
});
return false;
});
});
};
function scrollTo(hash) {
location.hash = "#" + hash;
}
$j.fn.ctaTeaserHeight = function () {
return $j(this).each(function () {
var $this = $j(this);
if (
$this.parents("#content").length &&
!Modernizr.mq("screen and (max-width: " + mediaqueries.maxMobile + "px)")
) {
var $forms = $this.find(".form"),
$hiddenForms = $this.find(".form.hide"),
height = 0;
$this.find("figure, .form").css("height", "auto");
$hiddenForms.show();
$forms.each(function () {
if ($j(this).outerHeight() > height) {
height = $j(this).outerHeight();
}
});
$hiddenForms.removeAttr("style");
$this.find("figure, .form").css("height", height);
} else {
$this.find("figure, .form").css("height", "auto");
}
});
};
$j.fn.ctaTeaserHeightOneImage = function () {
return $j(this).each(function () {
var $this = $j(this);
if (
$this.parents("#content, #full-width").length &&
!Modernizr.mq("screen and (max-width: " + mediaqueries.maxTablet + "px)")
) {
var $panes = $this.find(".pane"),
$hiddenPanes = $this.find(".pane.pane-hidden"),
height = 0;
$this.find(".pane").css("height", "auto");
$hiddenPanes.show();
$panes.each(function () {
if ($j(this).outerHeight() > height) {
height = $j(this).outerHeight();
}
});
$hiddenPanes.removeAttr("style");
$panes.css("height", height);
} else {
$this.find(".pane").css("height", "auto");
}
});
};
/***
** END Plugins for Encasa
***/
/***
** Plugins for TK-AG
***/
/*!
* Packery PACKAGED v1.4.3
* bin-packing layout library
*
* Licensed GPLv3 for open source use
* or Flickity Commercial License for commercial use
*
* http://packery.metafizzy.co
* Copyright 2015 Metafizzy
*/
!(function (a) {
function b() {}
function c(a) {
function c(b) {
b.prototype.option ||
(b.prototype.option = function (b) {
a.isPlainObject(b) && (this.options = a.extend(!0, this.options, b));
});
}
function e(b, c) {
a.fn[b] = function (e) {
if ("string" == typeof e) {
for (
var g = d.call(arguments, 1), h = 0, i = this.length;
i > h;
h++
) {
var j = this[h],
k = a.data(j, b);
if (k)
if (a.isFunction(k[e]) && "_" !== e.charAt(0)) {
var l = k[e].apply(k, g);
if (void 0 !== l) return l;
} else f("no such method '" + e + "' for " + b + " instance");
else
f(
"cannot call methods on " +
b +
" prior to initialization; attempted to call '" +
e +
"'"
);
}
return this;
}
return this.each(function () {
var d = a.data(this, b);
d
? (d.option(e), d._init())
: ((d = new c(this, e)), a.data(this, b, d));
});
};
}
if (a) {
var f =
"undefined" == typeof console
? b
: function (a) {
console.error(a);
};
return (
(a.bridget = function (a, b) {
c(b), e(a, b);
}),
a.bridget
);
}
}
var d = Array.prototype.slice;
"function" == typeof define && define.amd
? define("jquery-bridget/jquery.bridget", ["jquery"], c)
: c("object" == typeof exports ? require("jquery") : a.jQuery);
})(window),
(function (a) {
function b(a) {
return new RegExp("(^|\\s+)" + a + "(\\s+|$)");
}
function c(a, b) {
var c = d(a, b) ? f : e;
c(a, b);
}
var d, e, f;
"classList" in document.documentElement
? ((d = function (a, b) {
return a.classList.contains(b);
}),
(e = function (a, b) {
a.classList.add(b);
}),
(f = function (a, b) {
a.classList.remove(b);
}))
: ((d = function (a, c) {
return b(c).test(a.className);
}),
(e = function (a, b) {
d(a, b) || (a.className = a.className + " " + b);
}),
(f = function (a, c) {
a.className = a.className.replace(b(c), " ");
}));
var g = {
hasClass: d,
addClass: e,
removeClass: f,
toggleClass: c,
has: d,
add: e,
remove: f,
toggle: c,
};
"function" == typeof define && define.amd
? define("classie/classie", g)
: "object" == typeof exports
? (module.exports = g)
: (a.classie = g);
})(window),
(function (a) {
function b(a) {
if (a) {
if ("string" == typeof d[a]) return a;
a = a.charAt(0).toUpperCase() + a.slice(1);
for (var b, e = 0, f = c.length; f > e; e++)
if (((b = c[e] + a), "string" == typeof d[b])) return b;
}
}
var c = "Webkit Moz ms Ms O".split(" "),
d = document.documentElement.style;
"function" == typeof define && define.amd
? define("get-style-property/get-style-property", [], function () {
return b;
})
: "object" == typeof exports
? (module.exports = b)
: (a.getStyleProperty = b);
})(window),
(function (a, b) {
function c(a) {
var b = parseFloat(a),
c = -1 === a.indexOf("%") && !isNaN(b);
return c && b;
}
function d() {}
function e() {
for (
var a = {
width: 0,
height: 0,
innerWidth: 0,
innerHeight: 0,
outerWidth: 0,
outerHeight: 0,
},
b = 0,
c = h.length;
c > b;
b++
) {
var d = h[b];
a[d] = 0;
}
return a;
}
function f(b) {
function d() {
if (!m) {
m = !0;
var d = a.getComputedStyle;
if (
((j = (function () {
var a = d
? function (a) {
return d(a, null);
}
: function (a) {
return a.currentStyle;
};
return function (b) {
var c = a(b);
return (
c ||
g(
"Style returned " +
c +
". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"
),
c
);
};
})()),
(k = b("boxSizing")))
) {
var e = document.createElement("div");
(e.style.width = "200px"),
(e.style.padding = "1px 2px 3px 4px"),
(e.style.borderStyle = "solid"),
(e.style.borderWidth = "1px 2px 3px 4px"),
(e.style[k] = "border-box");
var f = document.body || document.documentElement;
f.appendChild(e);
var h = j(e);
(l = 200 === c(h.width)), f.removeChild(e);
}
}
}
function f(a) {
if (
(d(),
"string" == typeof a && (a = document.querySelector(a)),
a && "object" == typeof a && a.nodeType)
) {
var b = j(a);
if ("none" === b.display) return e();
var f = {};
(f.width = a.offsetWidth), (f.height = a.offsetHeight);
for (
var g = (f.isBorderBox = !(!k || !b[k] || "border-box" !== b[k])),
m = 0,
n = h.length;
n > m;
m++
) {
var o = h[m],
p = b[o];
p = i(a, p);
var q = parseFloat(p);
f[o] = isNaN(q) ? 0 : q;
}
var r = f.paddingLeft + f.paddingRight,
s = f.paddingTop + f.paddingBottom,
t = f.marginLeft + f.marginRight,
u = f.marginTop + f.marginBottom,
v = f.borderLeftWidth + f.borderRightWidth,
w = f.borderTopWidth + f.borderBottomWidth,
x = g && l,
y = c(b.width);
y !== !1 && (f.width = y + (x ? 0 : r + v));
var z = c(b.height);
return (
z !== !1 && (f.height = z + (x ? 0 : s + w)),
(f.innerWidth = f.width - (r + v)),
(f.innerHeight = f.height - (s + w)),
(f.outerWidth = f.width + t),
(f.outerHeight = f.height + u),
f
);
}
}
function i(b, c) {
if (a.getComputedStyle || -1 === c.indexOf("%")) return c;
var d = b.style,
e = d.left,
f = b.runtimeStyle,
g = f && f.left;
return (
g && (f.left = b.currentStyle.left),
(d.left = c),
(c = d.pixelLeft),
(d.left = e),
g && (f.left = g),
c
);
}
var j,
k,
l,
m = !1;
return f;
}
var g =
"undefined" == typeof console
? d
: function (a) {
console.error(a);
},
h = [
"paddingLeft",
"paddingRight",
"paddingTop",
"paddingBottom",
"marginLeft",
"marginRight",
"marginTop",
"marginBottom",
"borderLeftWidth",
"borderRightWidth",
"borderTopWidth",
"borderBottomWidth",
];
"function" == typeof define && define.amd
? define(
"get-size/get-size",
["get-style-property/get-style-property"],
f
)
: "object" == typeof exports
? (module.exports = f(require("desandro-get-style-property")))
: (a.getSize = f(a.getStyleProperty));
})(window),
(function (a) {
function b(b) {
var c = a.event;
return (c.target = c.target || c.srcElement || b), c;
}
var c = document.documentElement,
d = function () {};
c.addEventListener
? (d = function (a, b, c) {
a.addEventListener(b, c, !1);
})
: c.attachEvent &&
(d = function (a, c, d) {
(a[c + d] = d.handleEvent
? function () {
var c = b(a);
d.handleEvent.call(d, c);
}
: function () {
var c = b(a);
d.call(a, c);
}),
a.attachEvent("on" + c, a[c + d]);
});
var e = function () {};
c.removeEventListener
? (e = function (a, b, c) {
a.removeEventListener(b, c, !1);
})
: c.detachEvent &&
(e = function (a, b, c) {
a.detachEvent("on" + b, a[b + c]);
try {
delete a[b + c];
} catch (d) {
a[b + c] = void 0;
}
});
var f = { bind: d, unbind: e };
"function" == typeof define && define.amd
? define("eventie/eventie", f)
: "object" == typeof exports
? (module.exports = f)
: (a.eventie = f);
})(window),
function () {
function a() {}
function b(a, b) {
for (var c = a.length; c--; ) if (a[c].listener === b) return c;
return -1;
}
function c(a) {
return function () {
return this[a].apply(this, arguments);
};
}
var d = a.prototype,
e = this,
f = e.EventEmitter;
(d.getListeners = function (a) {
var b,
c,
d = this._getEvents();
if (a instanceof RegExp) {
b = {};
for (c in d) d.hasOwnProperty(c) && a.test(c) && (b[c] = d[c]);
} else b = d[a] || (d[a] = []);
return b;
}),
(d.flattenListeners = function (a) {
var b,
c = [];
for (b = 0; b < a.length; b += 1) c.push(a[b].listener);
return c;
}),
(d.getListenersAsObject = function (a) {
var b,
c = this.getListeners(a);
return c instanceof Array && ((b = {}), (b[a] = c)), b || c;
}),
(d.addListener = function (a, c) {
var d,
e = this.getListenersAsObject(a),
f = "object" == typeof c;
for (d in e)
e.hasOwnProperty(d) &&
-1 === b(e[d], c) &&
e[d].push(f ? c : { listener: c, once: !1 });
return this;
}),
(d.on = c("addListener")),
(d.addOnceListener = function (a, b) {
return this.addListener(a, { listener: b, once: !0 });
}),
(d.once = c("addOnceListener")),
(d.defineEvent = function (a) {
return this.getListeners(a), this;
}),
(d.defineEvents = function (a) {
for (var b = 0; b < a.length; b += 1) this.defineEvent(a[b]);
return this;
}),
(d.removeListener = function (a, c) {
var d,
e,
f = this.getListenersAsObject(a);
for (e in f)
f.hasOwnProperty(e) &&
((d = b(f[e], c)), -1 !== d && f[e].splice(d, 1));
return this;
}),
(d.off = c("removeListener")),
(d.addListeners = function (a, b) {
return this.manipulateListeners(!1, a, b);
}),
(d.removeListeners = function (a, b) {
return this.manipulateListeners(!0, a, b);
}),
(d.manipulateListeners = function (a, b, c) {
var d,
e,
f = a ? this.removeListener : this.addListener,
g = a ? this.removeListeners : this.addListeners;
if ("object" != typeof b || b instanceof RegExp)
for (d = c.length; d--; ) f.call(this, b, c[d]);
else
for (d in b)
b.hasOwnProperty(d) &&
(e = b[d]) &&
("function" == typeof e
? f.call(this, d, e)
: g.call(this, d, e));
return this;
}),
(d.removeEvent = function (a) {
var b,
c = typeof a,
d = this._getEvents();
if ("string" === c) delete d[a];
else if (a instanceof RegExp)
for (b in d) d.hasOwnProperty(b) && a.test(b) && delete d[b];
else delete this._events;
return this;
}),
(d.removeAllListeners = c("removeEvent")),
(d.emitEvent = function (a, b) {
var c,
d,
e,
f,
g = this.getListenersAsObject(a);
for (e in g)
if (g.hasOwnProperty(e))
for (d = g[e].length; d--; )
(c = g[e][d]),
c.once === !0 && this.removeListener(a, c.listener),
(f = c.listener.apply(this, b || [])),
f === this._getOnceReturnValue() &&
this.removeListener(a, c.listener);
return this;
}),
(d.trigger = c("emitEvent")),
(d.emit = function (a) {
var b = Array.prototype.slice.call(arguments, 1);
return this.emitEvent(a, b);
}),
(d.setOnceReturnValue = function (a) {
return (this._onceReturnValue = a), this;
}),
(d._getOnceReturnValue = function () {
return this.hasOwnProperty("_onceReturnValue")
? this._onceReturnValue
: !0;
}),
(d._getEvents = function () {
return this._events || (this._events = {});
}),
(a.noConflict = function () {
return (e.EventEmitter = f), a;
}),
"function" == typeof define && define.amd
? define("eventEmitter/EventEmitter", [], function () {
return a;
})
: "object" == typeof module && module.exports
? (module.exports = a)
: (e.EventEmitter = a);
}.call(this),
(function (a) {
function b(a) {
"function" == typeof a && (b.isReady ? a() : g.push(a));
}
function c(a) {
var c = "readystatechange" === a.type && "complete" !== f.readyState;
b.isReady || c || d();
}
function d() {
b.isReady = !0;
for (var a = 0, c = g.length; c > a; a++) {
var d = g[a];
d();
}
}
function e(e) {
return (
"complete" === f.readyState
? d()
: (e.bind(f, "DOMContentLoaded", c),
e.bind(f, "readystatechange", c),
e.bind(a, "load", c)),
b
);
}
var f = a.document,
g = [];
(b.isReady = !1),
"function" == typeof define && define.amd
? define("doc-ready/doc-ready", ["eventie/eventie"], e)
: "object" == typeof exports
? (module.exports = e(require("eventie")))
: (a.docReady = e(a.eventie));
})(window),
(function (a) {
function b(a, b) {
return a[g](b);
}
function c(a) {
if (!a.parentNode) {
var b = document.createDocumentFragment();
b.appendChild(a);
}
}
function d(a, b) {
c(a);
for (
var d = a.parentNode.querySelectorAll(b), e = 0, f = d.length;
f > e;
e++
)
if (d[e] === a) return !0;
return !1;
}
function e(a, d) {
return c(a), b(a, d);
}
var f,
g = (function () {
if (a.matches) return "matches";
if (a.matchesSelector) return "matchesSelector";
for (
var b = ["webkit", "moz", "ms", "o"], c = 0, d = b.length;
d > c;
c++
) {
var e = b[c],
f = e + "MatchesSelector";
if (a[f]) return f;
}
})();
if (g) {
var h = document.createElement("div"),
i = b(h, "div");
f = i ? b : e;
} else f = d;
"function" == typeof define && define.amd
? define("matches-selector/matches-selector", [], function () {
return f;
})
: "object" == typeof exports
? (module.exports = f)
: (window.matchesSelector = f);
})(Element.prototype),
(function (a, b) {
"function" == typeof define && define.amd
? define(
"fizzy-ui-utils/utils",
["doc-ready/doc-ready", "matches-selector/matches-selector"],
function (c, d) {
return b(a, c, d);
}
)
: "object" == typeof exports
? (module.exports = b(
a,
require("doc-ready"),
require("desandro-matches-selector")
))
: (a.fizzyUIUtils = b(a, a.docReady, a.matchesSelector));
})(window, function (a, b, c) {
var d = {};
(d.extend = function (a, b) {
for (var c in b) a[c] = b[c];
return a;
}),
(d.modulo = function (a, b) {
return ((a % b) + b) % b;
});
var e = Object.prototype.toString;
(d.isArray = function (a) {
return "[object Array]" == e.call(a);
}),
(d.makeArray = function (a) {
var b = [];
if (d.isArray(a)) b = a;
else if (a && "number" == typeof a.length)
for (var c = 0, e = a.length; e > c; c++) b.push(a[c]);
else b.push(a);
return b;
}),
(d.indexOf = Array.prototype.indexOf
? function (a, b) {
return a.indexOf(b);
}
: function (a, b) {
for (var c = 0, d = a.length; d > c; c++) if (a[c] === b) return c;
return -1;
}),
(d.removeFrom = function (a, b) {
var c = d.indexOf(a, b);
-1 != c && a.splice(c, 1);
}),
(d.isElement =
"function" == typeof HTMLElement || "object" == typeof HTMLElement
? function (a) {
return a instanceof HTMLElement;
}
: function (a) {
return (
a &&
"object" == typeof a &&
1 == a.nodeType &&
"string" == typeof a.nodeName
);
}),
(d.setText = (function () {
function a(a, c) {
(b =
b ||
(void 0 !== document.documentElement.textContent
? "textContent"
: "innerText")),
(a[b] = c);
}
var b;
return a;
})()),
(d.getParent = function (a, b) {
for (; a != document.body; )
if (((a = a.parentNode), c(a, b))) return a;
}),
(d.getQueryElement = function (a) {
return "string" == typeof a ? document.querySelector(a) : a;
}),
(d.handleEvent = function (a) {
var b = "on" + a.type;
this[b] && this[b](a);
}),
(d.filterFindElements = function (a, b) {
a = d.makeArray(a);
for (var e = [], f = 0, g = a.length; g > f; f++) {
var h = a[f];
if (d.isElement(h))
if (b) {
c(h, b) && e.push(h);
for (
var i = h.querySelectorAll(b), j = 0, k = i.length;
k > j;
j++
)
e.push(i[j]);
} else e.push(h);
}
return e;
}),
(d.debounceMethod = function (a, b, c) {
var d = a.prototype[b],
e = b + "Timeout";
a.prototype[b] = function () {
var a = this[e];
a && clearTimeout(a);
var b = arguments,
f = this;
this[e] = setTimeout(function () {
d.apply(f, b), delete f[e];
}, c || 100);
};
}),
(d.toDashed = function (a) {
return a
.replace(/(.)([A-Z])/g, function (a, b, c) {
return b + "-" + c;
})
.toLowerCase();
});
var f = a.console;
return (
(d.htmlInit = function (c, e) {
b(function () {
for (
var b = d.toDashed(e),
g = document.querySelectorAll(".js-" + b),
h = "data-" + b + "-options",
i = 0,
j = g.length;
j > i;
i++
) {
var k,
l = g[i],
m = l.getAttribute(h);
try {
k = m && JSON.parse(m);
} catch (n) {
f &&
f.error(
"Error parsing " +
h +
" on " +
l.nodeName.toLowerCase() +
(l.id ? "#" + l.id : "") +
": " +
n
);
continue;
}
var o = new c(l, k),
p = a.jQuery;
p && p.data(l, e, o);
}
});
}),
d
);
}),
(function (a, b) {
"function" == typeof define && define.amd
? define(
"outlayer/item",
[
"eventEmitter/EventEmitter",
"get-size/get-size",
"get-style-property/get-style-property",
"fizzy-ui-utils/utils",
],
function (c, d, e, f) {
return b(a, c, d, e, f);
}
)
: "object" == typeof exports
? (module.exports = b(
a,
require("wolfy87-eventemitter"),
require("get-size"),
require("desandro-get-style-property"),
require("fizzy-ui-utils")
))
: ((a.Outlayer = {}),
(a.Outlayer.Item = b(
a,
a.EventEmitter,
a.getSize,
a.getStyleProperty,
a.fizzyUIUtils
)));
})(window, function (a, b, c, d, e) {
function f(a) {
for (var b in a) return !1;
return (b = null), !0;
}
function g(a, b) {
a &&
((this.element = a),
(this.layout = b),
(this.position = { x: 0, y: 0 }),
this._create());
}
function h(a) {
return a.replace(/([A-Z])/g, function (a) {
return "-" + a.toLowerCase();
});
}
var i = a.getComputedStyle,
j = i
? function (a) {
return i(a, null);
}
: function (a) {
return a.currentStyle;
},
k = d("transition"),
l = d("transform"),
m = k && l,
n = !!d("perspective"),
o = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "otransitionend",
transition: "transitionend",
}[k],
p = [
"transform",
"transition",
"transitionDuration",
"transitionProperty",
],
q = (function () {
for (var a = {}, b = 0, c = p.length; c > b; b++) {
var e = p[b],
f = d(e);
f && f !== e && (a[e] = f);
}
return a;
})();
e.extend(g.prototype, b.prototype),
(g.prototype._create = function () {
(this._transn = { ingProperties: {}, clean: {}, onEnd: {} }),
this.css({ position: "absolute" });
}),
(g.prototype.handleEvent = function (a) {
var b = "on" + a.type;
this[b] && this[b](a);
}),
(g.prototype.getSize = function () {
this.size = c(this.element);
}),
(g.prototype.css = function (a) {
var b = this.element.style;
for (var c in a) {
var d = q[c] || c;
b[d] = a[c];
}
}),
(g.prototype.getPosition = function () {
var a = j(this.element),
b = this.layout.options,
c = b.isOriginLeft,
d = b.isOriginTop,
e = a[c ? "left" : "right"],
f = a[d ? "top" : "bottom"],
g = this.layout.size,
h =
-1 != e.indexOf("%")
? (parseFloat(e) / 100) * g.width
: parseInt(e, 10),
i =
-1 != f.indexOf("%")
? (parseFloat(f) / 100) * g.height
: parseInt(f, 10);
(h = isNaN(h) ? 0 : h),
(i = isNaN(i) ? 0 : i),
(h -= c ? g.paddingLeft : g.paddingRight),
(i -= d ? g.paddingTop : g.paddingBottom),
(this.position.x = h),
(this.position.y = i);
}),
(g.prototype.layoutPosition = function () {
var a = this.layout.size,
b = this.layout.options,
c = {},
d = b.isOriginLeft ? "paddingLeft" : "paddingRight",
e = b.isOriginLeft ? "left" : "right",
f = b.isOriginLeft ? "right" : "left",
g = this.position.x + a[d];
(c[e] = this.getXValue(g)), (c[f] = "");
var h = b.isOriginTop ? "paddingTop" : "paddingBottom",
i = b.isOriginTop ? "top" : "bottom",
j = b.isOriginTop ? "bottom" : "top",
k = this.position.y + a[h];
(c[i] = this.getYValue(k)),
(c[j] = ""),
this.css(c),
this.emitEvent("layout", [this]);
}),
(g.prototype.getXValue = function (a) {
var b = this.layout.options;
return b.percentPosition && !b.isHorizontal
? (a / this.layout.size.width) * 100 + "%"
: a + "px";
}),
(g.prototype.getYValue = function (a) {
var b = this.layout.options;
return b.percentPosition && b.isHorizontal
? (a / this.layout.size.height) * 100 + "%"
: a + "px";
}),
(g.prototype._transitionTo = function (a, b) {
this.getPosition();
var c = this.position.x,
d = this.position.y,
e = parseInt(a, 10),
f = parseInt(b, 10),
g = e === this.position.x && f === this.position.y;
if ((this.setPosition(a, b), g && !this.isTransitioning))
return void this.layoutPosition();
var h = a - c,
i = b - d,
j = {};
(j.transform = this.getTranslate(h, i)),
this.transition({
to: j,
onTransitionEnd: { transform: this.layoutPosition },
isCleaning: !0,
});
}),
(g.prototype.getTranslate = function (a, b) {
var c = this.layout.options;
return (
(a = c.isOriginLeft ? a : -a),
(b = c.isOriginTop ? b : -b),
n
? "translate3d(" + a + "px, " + b + "px, 0)"
: "translate(" + a + "px, " + b + "px)"
);
}),
(g.prototype.goTo = function (a, b) {
this.setPosition(a, b), this.layoutPosition();
}),
(g.prototype.moveTo = m ? g.prototype._transitionTo : g.prototype.goTo),
(g.prototype.setPosition = function (a, b) {
(this.position.x = parseInt(a, 10)),
(this.position.y = parseInt(b, 10));
}),
(g.prototype._nonTransition = function (a) {
this.css(a.to), a.isCleaning && this._removeStyles(a.to);
for (var b in a.onTransitionEnd) a.onTransitionEnd[b].call(this);
}),
(g.prototype._transition = function (a) {
if (!parseFloat(this.layout.options.transitionDuration))
return void this._nonTransition(a);
var b = this._transn;
for (var c in a.onTransitionEnd) b.onEnd[c] = a.onTransitionEnd[c];
for (c in a.to)
(b.ingProperties[c] = !0), a.isCleaning && (b.clean[c] = !0);
if (a.from) {
this.css(a.from);
var d = this.element.offsetHeight;
d = null;
}
this.enableTransition(a.to),
this.css(a.to),
(this.isTransitioning = !0);
});
var r = "opacity," + h(q.transform || "transform");
(g.prototype.enableTransition = function () {
this.isTransitioning ||
(this.css({
transitionProperty: r,
transitionDuration: this.layout.options.transitionDuration,
}),
this.element.addEventListener(o, this, !1));
}),
(g.prototype.transition =
g.prototype[k ? "_transition" : "_nonTransition"]),
(g.prototype.onwebkitTransitionEnd = function (a) {
this.ontransitionend(a);
}),
(g.prototype.onotransitionend = function (a) {
this.ontransitionend(a);
});
var s = {
"-webkit-transform": "transform",
"-moz-transform": "transform",
"-o-transform": "transform",
};
(g.prototype.ontransitionend = function (a) {
if (a.target === this.element) {
var b = this._transn,
c = s[a.propertyName] || a.propertyName;
if (
(delete b.ingProperties[c],
f(b.ingProperties) && this.disableTransition(),
c in b.clean &&
((this.element.style[a.propertyName] = ""), delete b.clean[c]),
c in b.onEnd)
) {
var d = b.onEnd[c];
d.call(this), delete b.onEnd[c];
}
this.emitEvent("transitionEnd", [this]);
}
}),
(g.prototype.disableTransition = function () {
this.removeTransitionStyles(),
this.element.removeEventListener(o, this, !1),
(this.isTransitioning = !1);
}),
(g.prototype._removeStyles = function (a) {
var b = {};
for (var c in a) b[c] = "";
this.css(b);
});
var t = { transitionProperty: "", transitionDuration: "" };
return (
(g.prototype.removeTransitionStyles = function () {
this.css(t);
}),
(g.prototype.removeElem = function () {
this.element.parentNode.removeChild(this.element),
this.css({ display: "" }),
this.emitEvent("remove", [this]);
}),
(g.prototype.remove = function () {
if (!k || !parseFloat(this.layout.options.transitionDuration))
return void this.removeElem();
var a = this;
this.once("transitionEnd", function () {
a.removeElem();
}),
this.hide();
}),
(g.prototype.reveal = function () {
delete this.isHidden, this.css({ display: "" });
var a = this.layout.options,
b = {},
c = this.getHideRevealTransitionEndProperty("visibleStyle");
(b[c] = this.onRevealTransitionEnd),
this.transition({
from: a.hiddenStyle,
to: a.visibleStyle,
isCleaning: !0,
onTransitionEnd: b,
});
}),
(g.prototype.onRevealTransitionEnd = function () {
this.isHidden || this.emitEvent("reveal");
}),
(g.prototype.getHideRevealTransitionEndProperty = function (a) {
var b = this.layout.options[a];
if (b.opacity) return "opacity";
for (var c in b) return c;
}),
(g.prototype.hide = function () {
(this.isHidden = !0), this.css({ display: "" });
var a = this.layout.options,
b = {},
c = this.getHideRevealTransitionEndProperty("hiddenStyle");
(b[c] = this.onHideTransitionEnd),
this.transition({
from: a.visibleStyle,
to: a.hiddenStyle,
isCleaning: !0,
onTransitionEnd: b,
});
}),
(g.prototype.onHideTransitionEnd = function () {
this.isHidden &&
(this.css({ display: "none" }), this.emitEvent("hide"));
}),
(g.prototype.destroy = function () {
this.css({
position: "",
left: "",
right: "",
top: "",
bottom: "",
transition: "",
transform: "",
});
}),
g
);
}),
(function (a, b) {
"function" == typeof define && define.amd
? define(
"outlayer/outlayer",
[
"eventie/eventie",
"eventEmitter/EventEmitter",
"get-size/get-size",
"fizzy-ui-utils/utils",
"./item",
],
function (c, d, e, f, g) {
return b(a, c, d, e, f, g);
}
)
: "object" == typeof exports
? (module.exports = b(
a,
require("eventie"),
require("wolfy87-eventemitter"),
require("get-size"),
require("fizzy-ui-utils"),
require("./item")
))
: (a.Outlayer = b(
a,
a.eventie,
a.EventEmitter,
a.getSize,
a.fizzyUIUtils,
a.Outlayer.Item
));
})(window, function (a, b, c, d, e, f) {
function g(a, b) {
var c = e.getQueryElement(a);
if (!c)
return void (
h &&
h.error(
"Bad element for " + this.constructor.namespace + ": " + (c || a)
)
);
(this.element = c),
i && (this.$element = i(this.element)),
(this.options = e.extend({}, this.constructor.defaults)),
this.option(b);
var d = ++k;
(this.element.outlayerGUID = d),
(l[d] = this),
this._create(),
this.options.isInitLayout && this.layout();
}
var h = a.console,
i = a.jQuery,
j = function () {},
k = 0,
l = {};
return (
(g.namespace = "outlayer"),
(g.Item = f),
(g.defaults = {
containerStyle: { position: "relative" },
isInitLayout: !0,
isOriginLeft: !0,
isOriginTop: !0,
isResizeBound: !0,
isResizingContainer: !0,
transitionDuration: "0.4s",
hiddenStyle: { opacity: 0, transform: "scale(0.001)" },
visibleStyle: { opacity: 1, transform: "scale(1)" },
}),
e.extend(g.prototype, c.prototype),
(g.prototype.option = function (a) {
e.extend(this.options, a);
}),
(g.prototype._create = function () {
this.reloadItems(),
(this.stamps = []),
this.stamp(this.options.stamp),
e.extend(this.element.style, this.options.containerStyle),
this.options.isResizeBound && this.bindResize();
}),
(g.prototype.reloadItems = function () {
this.items = this._itemize(this.element.children);
}),
(g.prototype._itemize = function (a) {
for (
var b = this._filterFindItemElements(a),
c = this.constructor.Item,
d = [],
e = 0,
f = b.length;
f > e;
e++
) {
var g = b[e],
h = new c(g, this);
d.push(h);
}
return d;
}),
(g.prototype._filterFindItemElements = function (a) {
return e.filterFindElements(a, this.options.itemSelector);
}),
(g.prototype.getItemElements = function () {
for (var a = [], b = 0, c = this.items.length; c > b; b++)
a.push(this.items[b].element);
return a;
}),
(g.prototype.layout = function () {
this._resetLayout(), this._manageStamps();
var a =
void 0 !== this.options.isLayoutInstant
? this.options.isLayoutInstant
: !this._isLayoutInited;
this.layoutItems(this.items, a), (this._isLayoutInited = !0);
}),
(g.prototype._init = g.prototype.layout),
(g.prototype._resetLayout = function () {
this.getSize();
}),
(g.prototype.getSize = function () {
this.size = d(this.element);
}),
(g.prototype._getMeasurement = function (a, b) {
var c,
f = this.options[a];
f
? ("string" == typeof f
? (c = this.element.querySelector(f))
: e.isElement(f) && (c = f),
(this[a] = c ? d(c)[b] : f))
: (this[a] = 0);
}),
(g.prototype.layoutItems = function (a, b) {
(a = this._getItemsForLayout(a)),
this._layoutItems(a, b),
this._postLayout();
}),
(g.prototype._getItemsForLayout = function (a) {
for (var b = [], c = 0, d = a.length; d > c; c++) {
var e = a[c];
e.isIgnored || b.push(e);
}
return b;
}),
(g.prototype._layoutItems = function (a, b) {
if ((this._emitCompleteOnItems("layout", a), a && a.length)) {
for (var c = [], d = 0, e = a.length; e > d; d++) {
var f = a[d],
g = this._getItemLayoutPosition(f);
(g.item = f), (g.isInstant = b || f.isLayoutInstant), c.push(g);
}
this._processLayoutQueue(c);
}
}),
(g.prototype._getItemLayoutPosition = function () {
return { x: 0, y: 0 };
}),
(g.prototype._processLayoutQueue = function (a) {
for (var b = 0, c = a.length; c > b; b++) {
var d = a[b];
this._positionItem(d.item, d.x, d.y, d.isInstant);
}
}),
(g.prototype._positionItem = function (a, b, c, d) {
d ? a.goTo(b, c) : a.moveTo(b, c);
}),
(g.prototype._postLayout = function () {
this.resizeContainer();
}),
(g.prototype.resizeContainer = function () {
if (this.options.isResizingContainer) {
var a = this._getContainerSize();
a &&
(this._setContainerMeasure(a.width, !0),
this._setContainerMeasure(a.height, !1));
}
}),
(g.prototype._getContainerSize = j),
(g.prototype._setContainerMeasure = function (a, b) {
if (void 0 !== a) {
var c = this.size;
c.isBorderBox &&
(a += b
? c.paddingLeft +
c.paddingRight +
c.borderLeftWidth +
c.borderRightWidth
: c.paddingBottom +
c.paddingTop +
c.borderTopWidth +
c.borderBottomWidth),
(a = Math.max(a, 0)),
(this.element.style[b ? "width" : "height"] = a + "px");
}
}),
(g.prototype._emitCompleteOnItems = function (a, b) {
function c() {
e.dispatchEvent(a + "Complete", null, [b]);
}
function d() {
g++, g === f && c();
}
var e = this,
f = b.length;
if (!b || !f) return void c();
for (var g = 0, h = 0, i = b.length; i > h; h++) {
var j = b[h];
j.once(a, d);
}
}),
(g.prototype.dispatchEvent = function (a, b, c) {
var d = b ? [b].concat(c) : c;
if ((this.emitEvent(a, d), i))
if (((this.$element = this.$element || i(this.element)), b)) {
var e = i.Event(b);
(e.type = a), this.$element.trigger(e, c);
} else this.$element.trigger(a, c);
}),
(g.prototype.ignore = function (a) {
var b = this.getItem(a);
b && (b.isIgnored = !0);
}),
(g.prototype.unignore = function (a) {
var b = this.getItem(a);
b && delete b.isIgnored;
}),
(g.prototype.stamp = function (a) {
if ((a = this._find(a))) {
this.stamps = this.stamps.concat(a);
for (var b = 0, c = a.length; c > b; b++) {
var d = a[b];
this.ignore(d);
}
}
}),
(g.prototype.unstamp = function (a) {
if ((a = this._find(a)))
for (var b = 0, c = a.length; c > b; b++) {
var d = a[b];
e.removeFrom(this.stamps, d), this.unignore(d);
}
}),
(g.prototype._find = function (a) {
return a
? ("string" == typeof a && (a = this.element.querySelectorAll(a)),
(a = e.makeArray(a)))
: void 0;
}),
(g.prototype._manageStamps = function () {
if (this.stamps && this.stamps.length) {
this._getBoundingRect();
for (var a = 0, b = this.stamps.length; b > a; a++) {
var c = this.stamps[a];
this._manageStamp(c);
}
}
}),
(g.prototype._getBoundingRect = function () {
var a = this.element.getBoundingClientRect(),
b = this.size;
this._boundingRect = {
left: a.left + b.paddingLeft + b.borderLeftWidth,
top: a.top + b.paddingTop + b.borderTopWidth,
right: a.right - (b.paddingRight + b.borderRightWidth),
bottom: a.bottom - (b.paddingBottom + b.borderBottomWidth),
};
}),
(g.prototype._manageStamp = j),
(g.prototype._getElementOffset = function (a) {
var b = a.getBoundingClientRect(),
c = this._boundingRect,
e = d(a),
f = {
left: b.left - c.left - e.marginLeft,
top: b.top - c.top - e.marginTop,
right: c.right - b.right - e.marginRight,
bottom: c.bottom - b.bottom - e.marginBottom,
};
return f;
}),
(g.prototype.handleEvent = function (a) {
var b = "on" + a.type;
this[b] && this[b](a);
}),
(g.prototype.bindResize = function () {
this.isResizeBound ||
(b.bind(a, "resize", this), (this.isResizeBound = !0));
}),
(g.prototype.unbindResize = function () {
this.isResizeBound && b.unbind(a, "resize", this),
(this.isResizeBound = !1);
}),
(g.prototype.onresize = function () {
function a() {
b.resize(), delete b.resizeTimeout;
}
this.resizeTimeout && clearTimeout(this.resizeTimeout);
var b = this;
this.resizeTimeout = setTimeout(a, 100);
}),
(g.prototype.resize = function () {
this.isResizeBound && this.needsResizeLayout() && this.layout();
}),
(g.prototype.needsResizeLayout = function () {
var a = d(this.element),
b = this.size && a;
return b && a.innerWidth !== this.size.innerWidth;
}),
(g.prototype.addItems = function (a) {
var b = this._itemize(a);
return b.length && (this.items = this.items.concat(b)), b;
}),
(g.prototype.appended = function (a) {
var b = this.addItems(a);
b.length && (this.layoutItems(b, !0), this.reveal(b));
}),
(g.prototype.prepended = function (a) {
var b = this._itemize(a);
if (b.length) {
var c = this.items.slice(0);
(this.items = b.concat(c)),
this._resetLayout(),
this._manageStamps(),
this.layoutItems(b, !0),
this.reveal(b),
this.layoutItems(c);
}
}),
(g.prototype.reveal = function (a) {
this._emitCompleteOnItems("reveal", a);
for (var b = a && a.length, c = 0; b && b > c; c++) {
var d = a[c];
d.reveal();
}
}),
(g.prototype.hide = function (a) {
this._emitCompleteOnItems("hide", a);
for (var b = a && a.length, c = 0; b && b > c; c++) {
var d = a[c];
d.hide();
}
}),
(g.prototype.revealItemElements = function (a) {
var b = this.getItems(a);
this.reveal(b);
}),
(g.prototype.hideItemElements = function (a) {
var b = this.getItems(a);
this.hide(b);
}),
(g.prototype.getItem = function (a) {
for (var b = 0, c = this.items.length; c > b; b++) {
var d = this.items[b];
if (d.element === a) return d;
}
}),
(g.prototype.getItems = function (a) {
a = e.makeArray(a);
for (var b = [], c = 0, d = a.length; d > c; c++) {
var f = a[c],
g = this.getItem(f);
g && b.push(g);
}
return b;
}),
(g.prototype.remove = function (a) {
var b = this.getItems(a);
if ((this._emitCompleteOnItems("remove", b), b && b.length))
for (var c = 0, d = b.length; d > c; c++) {
var f = b[c];
f.remove(), e.removeFrom(this.items, f);
}
}),
(g.prototype.destroy = function () {
var a = this.element.style;
(a.height = ""), (a.position = ""), (a.width = "");
for (var b = 0, c = this.items.length; c > b; b++) {
var d = this.items[b];
d.destroy();
}
this.unbindResize();
var e = this.element.outlayerGUID;
delete l[e],
delete this.element.outlayerGUID,
i && i.removeData(this.element, this.constructor.namespace);
}),
(g.data = function (a) {
a = e.getQueryElement(a);
var b = a && a.outlayerGUID;
return b && l[b];
}),
(g.create = function (a, b) {
function c() {
g.apply(this, arguments);
}
return (
Object.create
? (c.prototype = Object.create(g.prototype))
: e.extend(c.prototype, g.prototype),
(c.prototype.constructor = c),
(c.defaults = e.extend({}, g.defaults)),
e.extend(c.defaults, b),
(c.prototype.settings = {}),
(c.namespace = a),
(c.data = g.data),
(c.Item = function () {
f.apply(this, arguments);
}),
(c.Item.prototype = new f()),
e.htmlInit(c, a),
i && i.bridget && i.bridget(a, c),
c
);
}),
(g.Item = f),
g
);
}),
(function (a, b) {
"function" == typeof define && define.amd
? define("packery/js/rect", b)
: "object" == typeof exports
? (module.exports = b())
: ((a.Packery = a.Packery || {}), (a.Packery.Rect = b()));
})(window, function () {
function a(b) {
for (var c in a.defaults) this[c] = a.defaults[c];
for (c in b) this[c] = b[c];
}
var b = (window.Packery = function () {});
return (
(b.Rect = a),
(a.defaults = { x: 0, y: 0, width: 0, height: 0 }),
(a.prototype.contains = function (a) {
var b = a.width || 0,
c = a.height || 0;
return (
this.x <= a.x &&
this.y <= a.y &&
this.x + this.width >= a.x + b &&
this.y + this.height >= a.y + c
);
}),
(a.prototype.overlaps = function (a) {
var b = this.x + this.width,
c = this.y + this.height,
d = a.x + a.width,
e = a.y + a.height;
return this.x < d && b > a.x && this.y < e && c > a.y;
}),
(a.prototype.getMaximalFreeRects = function (b) {
if (!this.overlaps(b)) return !1;
var c,
d = [],
e = this.x + this.width,
f = this.y + this.height,
g = b.x + b.width,
h = b.y + b.height;
return (
this.y < b.y &&
((c = new a({
x: this.x,
y: this.y,
width: this.width,
height: b.y - this.y,
})),
d.push(c)),
e > g &&
((c = new a({
x: g,
y: this.y,
width: e - g,
height: this.height,
})),
d.push(c)),
f > h &&
((c = new a({ x: this.x, y: h, width: this.width, height: f - h })),
d.push(c)),
this.x < b.x &&
((c = new a({
x: this.x,
y: this.y,
width: b.x - this.x,
height: this.height,
})),
d.push(c)),
d
);
}),
(a.prototype.canFit = function (a) {
return this.width >= a.width && this.height >= a.height;
}),
a
);
}),
(function (a, b) {
if ("function" == typeof define && define.amd)
define("packery/js/packer", ["./rect"], b);
else if ("object" == typeof exports) module.exports = b(require("./rect"));
else {
var c = (a.Packery = a.Packery || {});
c.Packer = b(c.Rect);
}
})(window, function (a) {
function b(a, b, c) {
(this.width = a || 0),
(this.height = b || 0),
(this.sortDirection = c || "downwardLeftToRight"),
this.reset();
}
(b.prototype.reset = function () {
(this.spaces = []), (this.newSpaces = []);
var b = new a({ x: 0, y: 0, width: this.width, height: this.height });
this.spaces.push(b),
(this.sorter = c[this.sortDirection] || c.downwardLeftToRight);
}),
(b.prototype.pack = function (a) {
for (var b = 0, c = this.spaces.length; c > b; b++) {
var d = this.spaces[b];
if (d.canFit(a)) {
this.placeInSpace(a, d);
break;
}
}
}),
(b.prototype.placeInSpace = function (a, b) {
(a.x = b.x), (a.y = b.y), this.placed(a);
}),
(b.prototype.placed = function (a) {
for (var b = [], c = 0, d = this.spaces.length; d > c; c++) {
var e = this.spaces[c],
f = e.getMaximalFreeRects(a);
f ? b.push.apply(b, f) : b.push(e);
}
(this.spaces = b), this.mergeSortSpaces();
}),
(b.prototype.mergeSortSpaces = function () {
b.mergeRects(this.spaces), this.spaces.sort(this.sorter);
}),
(b.prototype.addSpace = function (a) {
this.spaces.push(a), this.mergeSortSpaces();
}),
(b.mergeRects = function (a) {
for (var b = 0, c = a.length; c > b; b++) {
var d = a[b];
if (d) {
var e = a.slice(0);
e.splice(b, 1);
for (var f = 0, g = 0, h = e.length; h > g; g++) {
var i = e[g],
j = b > g ? 0 : 1;
d.contains(i) && (a.splice(g + j - f, 1), f++);
}
}
}
return a;
});
var c = {
downwardLeftToRight: function (a, b) {
return a.y - b.y || a.x - b.x;
},
rightwardTopToBottom: function (a, b) {
return a.x - b.x || a.y - b.y;
},
};
return b;
}),
(function (a, b) {
"function" == typeof define && define.amd
? define(
"packery/js/item",
[
"get-style-property/get-style-property",
"outlayer/outlayer",
"./rect",
],
b
)
: "object" == typeof exports
? (module.exports = b(
require("desandro-get-style-property"),
require("outlayer"),
require("./rect")
))
: (a.Packery.Item = b(a.getStyleProperty, a.Outlayer, a.Packery.Rect));
})(window, function (a, b, c) {
var d = a("transform"),
e = function () {
b.Item.apply(this, arguments);
};
e.prototype = new b.Item();
var f = e.prototype._create;
return (
(e.prototype._create = function () {
f.call(this), (this.rect = new c()), (this.placeRect = new c());
}),
(e.prototype.dragStart = function () {
this.getPosition(),
this.removeTransitionStyles(),
this.isTransitioning && d && (this.element.style[d] = "none"),
this.getSize(),
(this.isPlacing = !0),
(this.needsPositioning = !1),
this.positionPlaceRect(this.position.x, this.position.y),
(this.isTransitioning = !1),
(this.didDrag = !1);
}),
(e.prototype.dragMove = function (a, b) {
this.didDrag = !0;
var c = this.layout.size;
(a -= c.paddingLeft), (b -= c.paddingTop), this.positionPlaceRect(a, b);
}),
(e.prototype.dragStop = function () {
this.getPosition();
var a = this.position.x != this.placeRect.x,
b = this.position.y != this.placeRect.y;
(this.needsPositioning = a || b), (this.didDrag = !1);
}),
(e.prototype.positionPlaceRect = function (a, b, c) {
(this.placeRect.x = this.getPlaceRectCoord(a, !0)),
(this.placeRect.y = this.getPlaceRectCoord(b, !1, c));
}),
(e.prototype.getPlaceRectCoord = function (a, b, c) {
var d = b ? "Width" : "Height",
e = this.size["outer" + d],
f = this.layout[b ? "columnWidth" : "rowHeight"],
g = this.layout.size["inner" + d];
b ||
((g = Math.max(g, this.layout.maxY)),
this.layout.rowHeight || (g -= this.layout.gutter));
var h;
if (f) {
(f += this.layout.gutter),
(g += b ? this.layout.gutter : 0),
(a = Math.round(a / f));
var i;
i = this.layout.options.isHorizontal
? b
? "ceil"
: "floor"
: b
? "floor"
: "ceil";
var j = Math[i](g / f);
(j -= Math.ceil(e / f)), (h = j);
} else h = g - e;
return (a = c ? a : Math.min(a, h)), (a *= f || 1), Math.max(0, a);
}),
(e.prototype.copyPlaceRectPosition = function () {
(this.rect.x = this.placeRect.x), (this.rect.y = this.placeRect.y);
}),
(e.prototype.removeElem = function () {
this.element.parentNode.removeChild(this.element),
this.layout.packer.addSpace(this.rect),
this.emitEvent("remove", [this]);
}),
e
);
}),
(function (a, b) {
"function" == typeof define && define.amd
? define(
[
"classie/classie",
"get-size/get-size",
"outlayer/outlayer",
"packery/js/rect",
"packery/js/packer",
"packery/js/item",
],
b
)
: "object" == typeof exports
? (module.exports = b(
require("desandro-classie"),
require("get-size"),
require("outlayer"),
require("./rect"),
require("./packer"),
require("./item")
))
: (a.Packery = b(
a.classie,
a.getSize,
a.Outlayer,
a.Packery.Rect,
a.Packery.Packer,
a.Packery.Item
));
})(window, function (a, b, c, d, e, f) {
function g(a, b) {
return a.position.y - b.position.y || a.position.x - b.position.x;
}
function h(a, b) {
return a.position.x - b.position.x || a.position.y - b.position.y;
}
d.prototype.canFit = function (a) {
return this.width >= a.width - 1 && this.height >= a.height - 1;
};
var i = c.create("packery");
return (
(i.Item = f),
(i.prototype._create = function () {
c.prototype._create.call(this),
(this.packer = new e()),
this.stamp(this.options.stamped);
var a = this;
(this.handleDraggabilly = {
dragStart: function () {
a.itemDragStart(this.element);
},
dragMove: function () {
a.itemDragMove(this.element, this.position.x, this.position.y);
},
dragEnd: function () {
a.itemDragEnd(this.element);
},
}),
(this.handleUIDraggable = {
start: function (b, c) {
c && a.itemDragStart(b.currentTarget);
},
drag: function (b, c) {
c &&
a.itemDragMove(
b.currentTarget,
c.position.left,
c.position.top
);
},
stop: function (b, c) {
c && a.itemDragEnd(b.currentTarget);
},
});
}),
(i.prototype._resetLayout = function () {
this.getSize(), this._getMeasurements();
var a = this.packer;
this.options.isHorizontal
? ((a.width = Number.POSITIVE_INFINITY),
(a.height = this.size.innerHeight + this.gutter),
(a.sortDirection = "rightwardTopToBottom"))
: ((a.width = this.size.innerWidth + this.gutter),
(a.height = Number.POSITIVE_INFINITY),
(a.sortDirection = "downwardLeftToRight")),
a.reset(),
(this.maxY = 0),
(this.maxX = 0);
}),
(i.prototype._getMeasurements = function () {
this._getMeasurement("columnWidth", "width"),
this._getMeasurement("rowHeight", "height"),
this._getMeasurement("gutter", "width");
}),
(i.prototype._getItemLayoutPosition = function (a) {
return this._packItem(a), a.rect;
}),
(i.prototype._packItem = function (a) {
this._setRectSize(a.element, a.rect),
this.packer.pack(a.rect),
this._setMaxXY(a.rect);
}),
(i.prototype._setMaxXY = function (a) {
(this.maxX = Math.max(a.x + a.width, this.maxX)),
(this.maxY = Math.max(a.y + a.height, this.maxY));
}),
(i.prototype._setRectSize = function (a, c) {
var d = b(a),
e = d.outerWidth,
f = d.outerHeight;
(e || f) &&
((e = this._applyGridGutter(e, this.columnWidth)),
(f = this._applyGridGutter(f, this.rowHeight))),
(c.width = Math.min(e, this.packer.width)),
(c.height = Math.min(f, this.packer.height));
}),
(i.prototype._applyGridGutter = function (a, b) {
if (!b) return a + this.gutter;
b += this.gutter;
var c = a % b,
d = c && 1 > c ? "round" : "ceil";
return (a = Math[d](a / b) * b);
}),
(i.prototype._getContainerSize = function () {
return this.options.isHorizontal
? { width: this.maxX - this.gutter }
: { height: this.maxY - this.gutter };
}),
(i.prototype._manageStamp = function (a) {
var b,
c = this.getItem(a);
if (c && c.isPlacing) b = c.placeRect;
else {
var e = this._getElementOffset(a);
b = new d({
x: this.options.isOriginLeft ? e.left : e.right,
y: this.options.isOriginTop ? e.top : e.bottom,
});
}
this._setRectSize(a, b), this.packer.placed(b), this._setMaxXY(b);
}),
(i.prototype.sortItemsByPosition = function () {
var a = this.options.isHorizontal ? h : g;
this.items.sort(a);
}),
(i.prototype.fit = function (a, b, c) {
var d = this.getItem(a);
d &&
(this._getMeasurements(),
this.stamp(d.element),
d.getSize(),
(d.isPlacing = !0),
(b = void 0 === b ? d.rect.x : b),
(c = void 0 === c ? d.rect.y : c),
d.positionPlaceRect(b, c, !0),
this._bindFitEvents(d),
d.moveTo(d.placeRect.x, d.placeRect.y),
this.layout(),
this.unstamp(d.element),
this.sortItemsByPosition(),
(d.isPlacing = !1),
d.copyPlaceRectPosition());
}),
(i.prototype._bindFitEvents = function (a) {
function b() {
d++, 2 == d && c.dispatchEvent("fitComplete", null, [a]);
}
var c = this,
d = 0;
a.on("layout", function () {
return b(), !0;
}),
this.on("layoutComplete", function () {
return b(), !0;
});
}),
(i.prototype.resize = function () {
var a = b(this.element),
c = this.size && a,
d = this.options.isHorizontal ? "innerHeight" : "innerWidth";
(c && a[d] == this.size[d]) || this.layout();
}),
(i.prototype.itemDragStart = function (a) {
this.stamp(a);
var b = this.getItem(a);
b && b.dragStart();
}),
(i.prototype.itemDragMove = function (a, b, c) {
function d() {
f.layout(), delete f.dragTimeout;
}
var e = this.getItem(a);
e && e.dragMove(b, c);
var f = this;
this.clearDragTimeout(), (this.dragTimeout = setTimeout(d, 40));
}),
(i.prototype.clearDragTimeout = function () {
this.dragTimeout && clearTimeout(this.dragTimeout);
}),
(i.prototype.itemDragEnd = function (b) {
var c,
d = this.getItem(b);
if (
(d && ((c = d.didDrag), d.dragStop()),
!d || (!c && !d.needsPositioning))
)
return void this.unstamp(b);
a.add(d.element, "is-positioning-post-drag");
var e = this._getDragEndLayoutComplete(b, d);
d.needsPositioning
? (d.on("layout", e), d.moveTo(d.placeRect.x, d.placeRect.y))
: d && d.copyPlaceRectPosition(),
this.clearDragTimeout(),
this.on("layoutComplete", e),
this.layout();
}),
(i.prototype._getDragEndLayoutComplete = function (b, c) {
var d = c && c.needsPositioning,
e = 0,
f = d ? 2 : 1,
g = this;
return function () {
return (
e++,
e != f
? !0
: (c &&
(a.remove(c.element, "is-positioning-post-drag"),
(c.isPlacing = !1),
c.copyPlaceRectPosition()),
g.unstamp(b),
g.sortItemsByPosition(),
d && g.dispatchEvent("dragItemPositioned", null, [c]),
!0)
);
};
}),
(i.prototype.bindDraggabillyEvents = function (a) {
a.on("dragStart", this.handleDraggabilly.dragStart),
a.on("dragMove", this.handleDraggabilly.dragMove),
a.on("dragEnd", this.handleDraggabilly.dragEnd);
}),
(i.prototype.bindUIDraggableEvents = function (a) {
a.on("dragstart", this.handleUIDraggable.start)
.on("drag", this.handleUIDraggable.drag)
.on("dragstop", this.handleUIDraggable.stop);
}),
(i.Rect = d),
(i.Packer = e),
i
);
});
/***
** END Plugins for TK-AG
***/
/* Accordion */
function initAccordion() {
$j("#main .accordion, #full-width .accordion").each(function () {
var $accordion = $j(this);
if ($accordion.data("single-open")) {
$accordion.accordion({
header: ".label",
active: $accordion.data("first-open") ? 0 : false,
collapsible: true,
heightStyle: "content",
beforeActivate: function (event, ui) {
if (
ui.newPanel.find(".footable").length &&
Modernizr.mq(
"screen and (max-width: " + mediaqueries.maxTablet + "px)"
)
) {
$j(window).trigger("resize");
}
},
activate: function (event, ui) {
//Jump to just activated header
if (
$j(event.target).find(".ui-accordion-header.ui-state-active").length
) {
$j("html, body").scrollTop(ui.newHeader.offset().top);
}
$j(".owl-carousel", $accordion)
.owlCarousel("invalidate", "all")
.trigger("refresh.owl.carousel");
$j(".image-gallery", $accordion)
.find(".image-holder .image")
.setEqualHeight("auto");
$j(".pdf-gallery", $accordion)
.find(".download .image")
.setEqualHeight("auto");
$j(".linklist li a", $accordion).setEqualHeight(2);
$j(".textteaser-wrapper", $accordion).initTextteaser();
$j(".teaserwrapper", $accordion).initHeadlineTeaserDev();
$j(".teaserwrapper", $accordion)
.find(".imageteaser")
.setEqualHeight("auto");
setTimeout(function () {
$j(".image-gallery", $accordion)
.find(".image-holder .caption")
.setEqualHeight("auto");
$j(".pdf-gallery", $accordion)
.find(".download .caption")
.setEqualHeight("auto");
}, 501);
},
});
}
// open multiple
else {
$accordion
.find(".label")
.off()
.on("click", function () {
$j(this).next().slideToggle();
$j(this).toggleClass("ui-state-active");
if ($j(this).next().find(".linklist").length > 0) {
$j(window).trigger("resize");
}
});
$accordion.find(".pane").css("display", "none");
if ($accordion.data("first-open")) {
$accordion.find(".label:eq(0)").trigger("click");
}
}
});
}
/* Dropdown */
$j.fn.initQuickAccess = function () {
return $j(this).each(function () {
var $this = $j(this),
$label = $this.find(".label"),
$ul = $this.find("ul");
$ul
.find("li")
.add($label)
.on("click", function () {
$label.toggleClass("open");
$ul.toggleClass("open").slideToggle();
});
});
};
/* AutoComplete */
function initAutoComplete() {
// Array nur für Clickdummy
var tags = [
"Thyssen",
"Thyssenkrupp",
"Stahl",
"Aufzug",
"Werk",
"Kantine",
"Kantinenplan",
"Werksführung",
"Bereiche",
"Standorte",
"Telefonbuch",
"Urlaub",
"Urlaubsantrag",
"Verpackung",
"Downloads",
"Termine",
"Yellow Pages",
"Applikationen",
"Kooperationen",
"Weissblech",
"Produkte",
"Dokumente",
];
var $autocompleteSearch = $j('#header .search-input input[type="text"]')
.autocomplete({
appendTo: ".theme-suggestions-autocomplete",
minLength: 3,
search: function (event, ui) {
var input = $j(event.target);
input.autocomplete(
"option",
"source",
"/suggest?site=" +
$j(".search-flyout .theme-autocomplete-wrapper").data("site") +
"&lang=" +
$j("html").attr("lang")
);
},
open: function () {
$j(".theme-autocomplete-wrapper").addClass("open");
//close on outside click
if ($j("html").hasClass("touch")) {
$j(document).on("touchstart", function (event) {
if (
!$j(event.target).closest(".theme-autocomplete-wrapper.open")
.length
) {
$j(".theme-autocomplete-wrapper.open").removeClass("open");
$j(document).off("touchstart");
}
});
} else {
$j(document).on("click", function (event) {
if (
!$j(event.target).closest(".theme-autocomplete-wrapper.open")
.length
) {
$j(".theme-autocomplete-wrapper.open").removeClass("open");
$j(document).off("click");
}
});
}
},
close: function () {
$j(".theme-autocomplete-wrapper").removeClass("open");
},
select: function () {
$autocompleteSearch.autocomplete("originalClose");
},
})
.on("keydown", function () {
if ($j(this).val().length <= 3) {
$autocompleteSearch.autocomplete("originalClose");
}
});
if (typeof $autocompleteSearch.data("ui-autocomplete") != "undefined") {
$autocompleteSearch.data("ui-autocomplete").originalClose =
$autocompleteSearch.data("ui-autocomplete").close;
$autocompleteSearch.data("ui-autocomplete").close = function (event) {};
$autocompleteSearch.data("ui-autocomplete")._renderItem = function (
ul,
item
) {
var regex = new RegExp(this.term, "i");
var result = item.label.replace(regex, "" + this.term + "");
return $j("")
.data("item.autocomplete", item)
.append("" + result + "")
.appendTo(ul);
};
}
//last search terms
if (lastSearches === null) {
$j(".theme-last-searches-autocomplete").remove();
} else {
var $lastSearchesList = $j(".theme-last-searches-autocomplete ul");
$j.each(JSON.parse(lastSearches), function (index, value) {
var listEntry = '