"use strict"; var $, $body, $document, $html, $main, $nav, $wrapper, customFileInput, floatingLabel, groups, i, j, len, ref, responsiveMenu, responsiveVideo, rv, slideToggler, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; $ = jQuery.noConflict(); $html = $('html'); $body = $('body'); $main = $('#main'); $nav = $('#nav'); $wrapper = $('#wrapper'); $document = $(document); floatingLabel = (function() { function floatingLabel(labels, classes) { var event, input, j, k, label, len, len1, ref, ref1, span; if (classes == null) { classes = {}; } classes.focus || (classes.focus = "focus"); classes.active || (classes.active = "active"); classes.error || (classes.error = "error"); for (j = 0, len = labels.length; j < len; j++) { label = labels[j]; if (!(input = label.control)) { return; } if (label.querySelector('input, textarea')) { span = document.createElement('span'); span.appendChild(document.createTextNode(label.firstChild.nodeValue)); label.replaceChild(span, label.firstChild); label = label.firstChild; } label.classList.add('floating-label'); while ((ref = (input.parent || (input.parent = input)).tagName) !== 'DIV' && ref !== 'P' && ref !== 'LI') { input.parent = input.parent.parentNode; } ref1 = ['keyup', 'input', 'change']; for (k = 0, len1 = ref1.length; k < len1; k++) { event = ref1[k]; input.addEventListener(event, function() { this.parent.classList.remove(classes.error); return this.parent.classList.toggle(classes.active, !!this.value); }); } input.addEventListener('focus', function() { return this.parent.classList.add(classes.focus); }); input.addEventListener('blur', function() { return this.parent.classList.remove(classes.focus); }); input.parent.classList.toggle(classes.active, !!input.value); } } return floatingLabel; })(); new floatingLabel(document.querySelectorAll('form label')); customFileInput = (function() { function customFileInput(fileInputs) { var fileInput, j, len; for (j = 0, len = fileInputs.length; j < len; j++) { fileInput = fileInputs[j]; fileInput.classList.add('custom-file-input'); fileInput.addEventListener('change', function() { var file, files, k, len1, ref; files = []; ref = this.files; for (k = 0, len1 = ref.length; k < len1; k++) { file = ref[k]; files.push(file.name); } if (this.parentNode.lastChild.nodeValue) { return this.parentNode.lastChild.nodeValue = files.join(', '); } else { return this.parentNode.appendChild(document.createTextNode(files.join(', '))); } }); } } return customFileInput; })(); new customFileInput(document.querySelectorAll('[type=file]')); responsiveVideo = (function() { function responsiveVideo(video) { this.video = video; this.update = bind(this.update, this); if (!this.video) { return; } this.img = new Image(this.video.width, this.video.height); this.img.onload = this.update; this.img.className = "rv-img rv-img-" + (document.querySelectorAll('.rv-img').length + 1); this.img.src = "data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width%3D'" + this.video.width + "' height%3D'" + this.video.height + "' %2F%3E"; this.img.setAttribute('style', 'position:absolute; top:0; left:0; opacity:0; pointer-events:none; width: auto; height: auto; max-width: 100%;'); this.video.parentNode.setAttribute('style', 'position:relative; padding:0;'); this.video.parentNode.appendChild(this.img); window.addEventListener('resize', this.update); } responsiveVideo.prototype.update = function() { var ref; return ref = [this.img.width, this.img.height], this.video.width = ref[0], this.video.height = ref[1], ref; }; return responsiveVideo; })(); ref = document.querySelectorAll('iframe'); for (i = j = 0, len = ref.length; j < len; i = ++j) { rv = ref[i]; window["rv" + i] = new responsiveVideo(rv); } slideToggler = (function() { function slideToggler(el1) { this.el = el1; this.toggle = bind(this.toggle, this); this.getHeight = bind(this.getHeight, this); if (!this.el) { return; } window.addEventListener('resize', this.getHeight); } slideToggler.prototype.getHeight = function() { var clone; clone = this.el.cloneNode(true); clone.style.cssText = 'visibility: hidden; display: block; margin: -999px 0'; this.height = (this.el.parentNode.appendChild(clone)).clientHeight; this.el.parentNode.removeChild(clone); return this.height; }; slideToggler.prototype.toggle = function(time) { var currHeight, disp, el, end, init, ref1, repeat, start; this.getHeight(); time || (time = this.height / 3 + 150); currHeight = this.el.clientHeight * (getComputedStyle(this.el).display !== 'none'); ref1 = currHeight > this.height / 2 ? [this.height, 0] : [0, this.height], start = ref1[0], end = ref1[1]; disp = end - start; el = this.el; this.el.classList[end === 0 ? 'remove' : 'add']('open'); this.el.style.cssText = "overflow: hidden; display: block;"; init = (new Date).getTime(); repeat = function() { var instance, k, ref2, repeatLoop, results, step; instance = (new Date).getTime() - init; step = start + disp * instance / time; if (instance <= time) { el.style.height = step + 'px'; } else { el.style.cssText = "display: " + (end === 0 ? 'none' : 'block'); } repeatLoop = requestAnimationFrame(repeat); if (ref2 = Math.floor(step), indexOf.call((function() { results = []; for (var k = start; start <= end ? k <= end : k >= end; start <= end ? k++ : k--){ results.push(k); } return results; }).apply(this), ref2) < 0) { return cancelAnimationFrame(repeatLoop); } }; return repeat(); }; return slideToggler; })(); responsiveMenu = (function() { function responsiveMenu(nav, opt) { var base, k, l, len1, len2, len3, m, menu, menuToggle, ref1, ref2, ref3, sub, subMenu, subMenuToggle; this.opt = opt; this.breaking = bind(this.breaking, this); this.createToggle = bind(this.createToggle, this); (base = this.opt).breaking || (base.breaking = '640px'); this.opt.maxBreaking = parseInt(this.opt.maxBreaking) || 1040; menu = nav.querySelector('.menu'); if (!slideToggler) { slideToggler = (function() { function slideToggler(el1) { this.el = el1; this.toggle = bind(this.toggle, this); if (!this.el) { return; } } slideToggler.prototype.toggle = function() { this.el.classList.toggle('open'); return this.el.style.cssText = "display: " + (this.el.classList.contains('open') ? 'block' : 'none'); }; return slideToggler; })(); } ref1 = menu.querySelectorAll('ul'); for (k = 0, len1 = ref1.length; k < len1; k++) { sub = ref1[k]; sub.toggler = new slideToggler(sub); } menuToggle = this.createToggle(nav, 'menu-toggle', 'Menu'); menuToggle.addEventListener('click', function() { document.documentElement.classList.toggle('nav-open'); return menuToggle.menu.classList.toggle('open', document.documentElement.classList.contains('nav-open')); }); ref2 = menu.querySelectorAll('ul'); for (l = 0, len2 = ref2.length; l < len2; l++) { subMenu = ref2[l]; subMenu.parentNode.classList.add('has-children'); subMenuToggle = this.createToggle(subMenu, 'sub-menu-toggle', '+'); subMenuToggle.addEventListener('click', function() { var len3, m, open, ref3, results; this.menu.toggler.toggle(); ref3 = this.parentNode.parentNode.querySelectorAll('ul.open'); results = []; for (m = 0, len3 = ref3.length; m < len3; m++) { open = ref3[m]; if (open !== this.menu) { results.push(open.toggler.toggle()); } else { results.push(void 0); } } return results; }); } ref3 = menu.querySelectorAll('.has-children[class*=current] > ul'); for (m = 0, len3 = ref3.length; m < len3; m++) { sub = ref3[m]; sub.classList.add('open'); } document.addEventListener('DOMContentLoaded', this.breaking); window.addEventListener('resize', this.breaking); setTimeout(this.breaking, 3000); } responsiveMenu.prototype.createToggle = function(menu, klass, label) { var toggle; toggle = menu.parentNode.querySelector("." + klass) || document.createElement("button"); toggle.classList.add(klass); toggle.appendChild(document.createTextNode(label)); toggle.menu = menu.nodeName === 'UL' ? menu : menu.querySelector('.menu'); return menu.parentNode.insertBefore(toggle, menu.nextSibling); }; responsiveMenu.prototype.breaking = function() { var div, el, isMobile, k, len1, ref1, windowWidth; document.body.classList.remove('menu-mobile'); document.body.classList.add('menu-desktop'); div = document.createElement('div'); div.style.cssText = "position: absolute; width: " + this.opt.breaking; document.body.appendChild(div); this.menuBreak = div.clientWidth || 0; document.body.removeChild(div); ref1 = document.querySelectorAll("" + this.opt.breaking); for (k = 0, len1 = ref1.length; k < len1; k++) { el = ref1[k]; this.menuBreak += this.getWidth(el); } isMobile = (windowWidth = document.body.clientWidth) <= Math.min(this.menuBreak, this.opt.maxBreaking); document.body.classList.toggle('menu-mobile', isMobile); document.body.classList.toggle('menu-desktop', !isMobile); if (!isMobile) { return document.documentElement.classList.remove('nav-open'); } }; responsiveMenu.prototype.getWidth = function(el) { var clone, width; if (el.clientWidth > 0) { return el.clientWidth; } clone = el.cloneNode(true); clone.style.cssText = 'position: absolute; visibility: hidden; display: block;'; el.parentNode.appendChild(clone); width = clone.clientWidth; el.parentNode.removeChild(clone); return width; }; return responsiveMenu; })(); new responsiveMenu(document.querySelector('#nav'), { breaking: '.logo, .tagline, .menu' }); $('.caption-outside').each(function() { return $(this).parents('.gallery-item').width($(this).parents('.gallery-item').find('img').width()); }); groups = {}; $('.gallery a').filter('[href$=".gif"], [href$=".jpg"], [href$=".png"], [href$=".bmp"]').each(function() { var id; id = $(this).parents('[id*="gallery"]').first().prop('id') || Math.random(100); if (!groups[id]) { groups[id] = []; } return groups[id].push(this); }); $.each(groups, function() { return $(this).magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-with-zoom mfp-img-mobile', removalDelay: 0, overflowY: 'scroll', image: { verticalFit: true, titleSrc: function(item) { return item.el.parents('figure').find('figcaption').text() || item.el.attr('title'); } }, zoom: { enabled: true }, gallery: { enabled: true, navigateByImgClick: false, tCounter: '' }, callbacks: { open: function() { return this.currItem.el.parents('article').addClass('active'); }, close: function() {}, afterClose: function() { return setTimeout(function() { return $('article.active').removeClass('active'); }, 300); } } }); }); $('.gallery').each(function() { var g; g = $(this); if (!(g.is('.gallery-size-thumbnail') || g.parents('.wp-article-list').length)) { g.packery({ gutter: 0, itemSelector: '.gallery-item', percentPosition: true }); g.imagesLoaded().progress(function(instance) { return g.packery(); }); g.imagesLoaded().done(function(instance) { var fig, figure, image, k, len1, n, ref1, results, w; ref1 = instance.images; results = []; for (k = 0, len1 = ref1.length; k < len1; k++) { image = ref1[k]; figure = $(image.img).parents('figure'); fig = figure[0]; n = parseFloat(fig.style.left); w = 100 * parseFloat(figure.css('width')) / parseFloat(figure.parent().css('width')); results.push(fig.style.left = 100 * Math.round(n / w) / Math.round(100 / w) + '%'); } return results; }); return g.on('layoutComplete', function(event, items) { var fig, figure, item, k, len1, n, results, w; results = []; for (k = 0, len1 = items.length; k < len1; k++) { item = items[k]; fig = item.element; figure = $(fig); n = parseFloat(fig.style.left); w = 100 * parseFloat(figure.css('width')) / parseFloat(figure.parent().css('width')); results.push(fig.style.left = 100 * Math.round(n / w) / Math.round(100 / w) + '%'); } return results; }); } }); $('html:not(.touchevents) [class*=article-list] article').hover((function() { var content, contentBottom, difference, nextTop, space, title; space = parseInt($(this).next().css('marginTop') || 0); if (!(content = $(this).find('[class*=content]')).length) { return; } contentBottom = content.offset().top + content.innerHeight(); if ($(this).next().length) { if (!(title = $(this).next().find('[class*=title], .gallery').first()).length) { return; } nextTop = title.offset().top; } else { nextTop = $(this).parent().offset().top + $(this).parent().innerHeight(); } difference = nextTop - space * 2 - contentBottom; if (difference >= -space) { return; } if ($(this).next().length) { return $(this).next().css({ marginTop: -difference }); } else { return $(this).parent().css({ paddingBottom: -difference }); } }), function() { var el; el = $(this); el.next().add(el.parent()).removeAttr('style'); return $('.search-form').submit(function(e) { var s; s = $(this).find('.search-field'); if (!$.trim(s.val())) { e.preventDefault(); return s.focus(); } }); }); document.addEventListener("DOMContentLoaded", function() { var hContMax, hHeight, header, headroom, offset, tolerance; if (header = document.querySelector('#header')) { hHeight = (document.querySelector('.wp-custom-header') || header).clientHeight; hContMax = Math.max(header.querySelector('.brand').clientHeight, header.querySelector('nav').clientHeight); offset = document.querySelector('#wrapper').offsetTop; tolerance = { up: 5, down: 0 }; if (document.querySelector('#wp-custom-header')) { offset = document.querySelector('#wrapper').offsetTop - hContMax; tolerance = { up: 5, down: 20 }; } document.querySelector('#wrapper').style.marginTop = header.clientHeight + 'px'; headroom = new Headroom(header, { offset: offset, tolerance: tolerance, onTop: function() {}, onNotTop: function() {}, onPin: function() {}, onUnpin: function() { return $('#nav:not(.open)').trigger('menu:close'); } }); return headroom.init(); } }); $(window).on('resize', function() { return document.querySelector('#wrapper').style.marginTop = header.clientHeight + 'px'; }); $(function() { return $('select').customSelect(); }); $('a').on('click', function(e) { var current, ports; if (this.pathname !== window.location.pathname) { return; } ports = ['4567', '4568']; current = ports.indexOf(e.target.port); if (current > -1) { ports.splice(current, 1); } if (ports.length === 1) { return e.target.port = ports[0]; } });