(function ($, root, undefined) { $(function () { 'use strict'; // DOM ready, take it away console.log("DOM ready") //settings //change the speed in css as well in .wrapper!! 1s const menuSpeed = 300 const filterspeed = 200 const pressPageSpeed = 300 // global variables var isMobile var isUltrawide var menuopen = false var menuClosedLeft // var logoWidth // var logoPadding = $(".logo").css("padding") var teamnr = 0 var homeArticlePos = 0 var homeArticleNr = 0 const wrapperWidth = $(".wrapper").outerWidth() // const templateUrl = '= get_bloginfo("template_url"); ?>'; const templateUrl = object_name.templateUrl; /* ======================== */ /* FUNCTIONS */ /* ======================== */ $.fn.scrollStopped = function (callback) { var that = this, $this = $(that); $this.scroll(function (ev) { clearTimeout($this.data('scrollTimeout')); $this.data('scrollTimeout', setTimeout(callback.bind(that), 500, ev)); }); }; function convertRemToPixels(rem) { return rem * parseFloat(getComputedStyle(document.documentElement).fontSize); } function showMenu() { // logoWidth = $(".logo")[0].getBoundingClientRect().width; $("#menuopen").hide() // // if mobile, move the motto left // if (isMobile) { // $(".logo").css({ // width: 0, // padding: 0 // }) // } if (isMobile) { $(".logo").hide() } // show the menu $("header .topnav") .show() .animate({ left: 0 }, menuSpeed, "linear", function () { //then show the motto: menuopen = true; if (isMobile) { $(".logo").addClass("inverted") $(".logo").fadeIn() } $(".header-top #motto, #menuclose").fadeIn(function(){ $("#menuclose").css({ display: "inline-block" }) }) }) } function hideMenu() { // if (isMobile) { // $(".logo").css({ // width: logoWidth, // padding: logoPadding // }) // } $(".header-top #motto, #menuclose").hide() if (isMobile) { $(".logo").hide() $(".logo").removeClass("inverted") } $("header .topnav") .animate({ left: menuClosedLeft }, menuSpeed, "linear", function () { $("#menuopen").fadeIn() $("header .topnav").hide() menuopen = false if (isMobile) { $(".logo").fadeIn() } }) } //-----------------// // --- loading --- // //-----------------// // check if mobile if ($(window).width() < 1024) { isMobile = true; } else { isMobile = false; if ($(window).width() < 1921) { isUltrawide = false } else { isUltrawide = true } } //css tricks $("header .topnav") .hide() .css({ // width: "0%" }) //--------// // footer // //--------// // add date to copyright var today = new Date(); var year = today.getFullYear(); $(".footer .copyright").append(" " + year) //add hr after address if (!isMobile) { $("#footerbottom #info p br").replaceWith(" ") $("#footerbottom #info p:nth-child(2)").wrapInner('
') $("#footerbottom #info p:nth-child(2)").append('') } //------// // home // //------// //------// // menu // //------// //settings for mobile: // menuWidth = "100%" // menuBorderLeft = "0%" // menuLeft = 0 menuClosedLeft = "100%" if (!isMobile) { //if desktop: // menuBorderLeft = "9rem" // menuWidth = (wrapperWidth - convertRemToPixels(parseInt(menuBorderLeft))) + "px" if (isUltrawide) { } } //Overwrite text for slug $("#menu-language-selector>li").each(function () { var theanchor = $(this).children("a") var langstring = theanchor.attr("lang").split("-") theanchor.html(langstring[0]) }) //-------// // about // //-------// //wrapper for the secondary title of the about page $(".page.about article h2:first-of-type").wrap("") //wrapper for the "our team" section on about page $(".page.about article hr:nth-of-type(odd)").addClass("begin") $(".page.about article hr:nth-of-type(even)").addClass("end") $('.page.about hr.begin').each(function () { var $set = $(); var nxt = this.nextSibling; while (nxt) { if (!$(nxt).is('hr.end')) { $set.push(nxt); nxt = nxt.nextSibling; } else break; } $set.wrapAll(''); teamnr++ }); if (!isMobile) { $(".page.about article>p, .page.about article>blockquote").addClass("aligned-text") $(".page.about article>h3").each(function () { var $set = $(this); var nxt = this.nextSibling; while (nxt) { if (!$(nxt).is('h3') & !$(nxt).is('h2')) { $set.push(nxt); nxt = nxt.nextSibling; } else break; } $set.wrapAll(''); }) } //-------// // team // //-------// //remove hrs if (!isMobile) { $(".page.about article hr").remove(); $(".page.about article>h2, .page.about .team").wrapAll(''); } //wrap team members $(".page.about .team").each(function () { $(this).children("h3, h4, p").wrapAll(''); $(this).children(".team-text").children("h3, h4").wrapAll(''); $(this).children(".team-text").children("p").wrapAll(''); }) //hide team member texts $(".page.about article .team .team-text").hide(); //-------// // press // //-------// //create vertical $("body.category-press article.tag-publication").wrapAll("") $("body.category-press article.tag-award").wrapAll("") var pressPublCount = $(".category-press .publication-wrapper article").length var pressAwardCount = $(".category-press .award-wrapper article").length var pressArtHeight = pressPublCount if (pressAwardCount > pressPublCount) { pressArtHeight = pressAwardCount } $(".category-press article").css({ height: (100 / parseInt(pressArtHeight)) + "%" }) if (isMobile) { $(".category-press .tag-publication .project-tags").addClass("active"); } else { $(".category-press article .project-tags").addClass("active") } $(".category-press .article-wrapper").each(function () { var nr = 0 $(this).children("article").each(function () { $(this).addClass("art" + nr) nr++ }) }) //move date on desktop if (!isMobile) { $(".category-press section").prepend('') } $(".category-press .award-wrapper article .project-date").prependTo(".dateWrapper") //---------// // process // //---------// //add classes for wrapall var titleNr = -1 var h3contents = []; $(".page-template-template-process article>h3").each(function () { titleNr++ $(this).addClass("process-title-" + titleNr) $(this).next("h2").addClass("process-title-" + titleNr) h3contents.push($(this).html()) }) var pNr = -1 $(".page-template-template-process article>p").each(function () { pNr++ $(this).addClass("process-page-" + pNr) $(this).prev("blockquote").addClass("process-page-" + pNr) }) //wrap them in divs for (let i = 0; i < titleNr + 1; i++) { $(".process-title-" + i).wrapAll("") } for (let i = 0; i < pNr + 1; i++) { $(".process-page-" + i).wrapAll("") } //contents at the bottom $(".process-page-wrapper").append("