vendor: 6,021 bytes, lines 1-11
1 2/*! SmoothScroll v16.1.4 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ 3!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SmoothScroll=t()}(this,(function(){"use strict";window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;--t>=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(), 4/** 5 * requestAnimationFrame() polyfill 6 * By Erik Möller. Fixes from Paul Irish and Tino Zijdel. 7 * @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 8 * @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 9 * @license MIT 10 */ 11function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var o=(new Date).getTime(),i=Math.max(0,16-(o-e)),a=window.setTimeout((function(){t(o+i)}),i);return e=o+i,a}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}();var e={ignore:"[data-scroll-ignore]",header:null,topOnEmptyHash:!0,speed:500,speedAsDuration:!1,durationMax:null,durationMin:null,clip:!0,offset:0,easing:"easeInOutCubic",customEasing:null,updateURL:!0,popstate:!0,emitEvents:!0},t=function(){var e={};return Array.prototype.forEach.call(arguments,(function(t){for(var n in t){if(!t.hasOwnProperty(n))return;e[n]=t[n]}})),e},n=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,i=-1,a="",r=n.charCodeAt(0);++i<o;){if(0===(t=n.charCodeAt(i)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");t>=1&&t<=31||127==t||0===i&&t>=48&&t<=57||1===i&&t>=48&&t<=57&&45===r?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(i):"\\"+n.charAt(i)}return"#"+a},o=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},i=function(e){return e?(t=e,parseInt(window.getComputedStyle(t).height,10)+e.offsetTop):0;var t},a=function(e,t,n){0===e&&document.body.focus(),n||(e.focus(),document.activeElement!==e&&(e.setAttribute("tabindex","-1"),e.focus(),e.style.outline="none"),window.scrollTo(0,t))},r=function(e,t,n,o){if(t.emitEvents&&"function"==typeof window.CustomEvent){var i=new CustomEvent(e,{bubbles:!0,detail:{anchor:n,toggle:o}});document.dispatchEvent(i)}};return function(c,u){var s,l,d,m,f={};f.cancelScroll=function(e){cancelAnimationFrame(m),m=null,e||r("scrollCancel",s)},f.animateScroll=function(n,c,u){f.cancelScroll();var l=t(s||e,u||{}),w="[object Number]"===Object.prototype.toString.call(n),h=w||!n.tagName?null:n;if(w||h){var p=window.pageYOffset;l.header&&!d&&(d=document.querySelector(l.header));var g,y,v,S=i(d),E=w?n:function(e,t,n,i){var a=0;if(e.offsetParent)do{a+=e.offsetTop,e=e.offsetParent}while(e);return a=Math.max(a-t-n,0),i&&(a=Math.min(a,o()-window.innerHeight)),a}(h,S,parseInt("function"==typeof l.offset?l.offset(n,c):l.offset,10),l.clip),b=E-p,A=o(),O=0,C=function(e,t){var n=t.speedAsDuration?t.speed:Math.abs(e/1e3*t.speed);return t.durationMax&&n>t.durationMax?t.durationMax:t.durationMin&&n<t.durationMin?t.durationMin:parseInt(n,10)}(b,l),M=function(e){g||(g=e),O+=e-g,v=p+b*function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(n=e.customEasing(t)),n||t}(l,y=(y=0===C?0:O/C)>1?1:y),window.scrollTo(0,Math.floor(v)),function(e,t){var o=window.pageYOffset;if(e==t||o==t||(p<t&&window.innerHeight+o)>=A)return f.cancelScroll(!0),a(n,t,w),r("scrollStop",l,n,c),g=null,m=null,!0}(v,E)||(m=window.requestAnimationFrame(M),g=e)};0===window.pageYOffset&&window.scrollTo(0,0),function(e,t,n){t||history.pushState&&n.updateURL&&history.pushState({smoothScroll:JSON.stringify(n),anchor:e.id},document.title,e===document.documentElement?"#top":"#"+e.id)}(n,w,l),"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches?a(n,Math.floor(E),!1):(r("scrollStart",l,n,c),f.cancelScroll(!0),window.requestAnimationFrame(M))}};var w=function(e){if(!e.defaultPrevented&&!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey)&&"closest"in e.target&&(l=e.target.closest(c))&&"a"===l.tagName.toLowerCase()&&!e.target.closest(s.ignore)&&l.hostname===window.location.hostname&&l.pathname===window.location.pathname&&/#/.test(l.href)){var t,o;try{t=n(decodeURIComponent(l.hash))}catch(e){t=n(l.hash)}if("#"===t){if(!s.topOnEmptyHash)return;o=document.documentElement}else o=document.querySelector(t);(o=o||"#top"!==t?o:document.documentElement)&&(e.preventDefault(),function(e){if(history.replaceState&&e.updateURL&&!history.state){var t=window.location.hash;t=t||"",history.replaceState({smoothScroll:JSON.stringify(e),anch
11or:t||window.pageYOffset},document.title,t||window.location.href)}}(s),f.animateScroll(o,l))}},h=function(){if(null!==history.state&&history.state.smoothScroll&&history.state.smoothScroll===JSON.stringify(s)){var e=history.state.anchor;"string"==typeof e&&e&&!(e=document.querySelector(n(history.state.anchor)))||f.animateScroll(e,null,{updateURL:!1})}};f.destroy=function(){s&&(document.removeEventListener("click",w,!1),window.removeEventListener("popstate",h,!1),f.cancelScroll(),s=null,l=null,d=null,m=null)};return function(){if(!("querySelector"in document&&"addEventListener"in window&&"requestAnimationFrame"in window&&"closest"in window.Element.prototype))throw"Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.";f.destroy(),s=t(e,u||{}),d=s.header?document.querySelector(s.header):null,document.addEventListener("click",w,!1),s.updateURL&&s.popstate&&window.addEventListener("popstate",h,!1)}(),f}})); 12 13/** 14* jquery-match-height master by @liabru 15* http://brm.io/jquery-match-height/ 16* License: MIT 17*/ 18 19;(function(factory) { // eslint-disable-line no-extra-semi 20 'use strict'; 21 if (typeof define === 'function' && define.amd) { 22 // AMD 23 define(['jquery'], factory); 24 } else if (typeof module !== 'undefined' && module.exports) { 25 // CommonJS 26 module.exports = factory(require('jquery')); 27 } else { 28 // Global 29 factory(jQuery); 30 } 31})(function($) { 32 /* 33 * internal 34 */ 35 36 var _previousResizeWidth = -1, 37 _updateTimeout = -1; 38 39 /* 40 * _parse 41 * value parse utility function 42 */ 43 44 var _parse = function(value) { 45 // parse value and convert NaN to 0 46 return parseFloat(value) || 0; 47 }; 48 49 /* 50 * _rows 51 * utility function returns array of jQuery selections representing each row 52 * (as displayed after float wrapping applied by browser) 53 */ 54 55 var _rows = function(elements) { 56 var tolerance = 1, 57 $elements = $(elements), 58 lastTop = null, 59 rows = []; 60 61 // group elements by their top position 62 $elements.each(function(){ 63 var $that = $(this), 64 top = $that.offset().top - _parse($that.css('margin-top')), 65 lastRow = rows.length > 0 ? rows[rows.length - 1] : null; 66 67 if (lastRow === null) { 68 // first item on the row, so just push it 69 rows.push($that); 70 } else { 71 // if the row top is the same, add to the row group 72 if (Math.floor(Math.abs(lastTop - top)) <= tolerance) { 73 rows[rows.length - 1] = lastRow.add($that); 74 } else { 75 // otherwise start a new row group 76 rows.push($that); 77 } 78 } 79 80 // keep track of the last row top 81 lastTop = top; 82 }); 83 84 return rows; 85 }; 86 87 /* 88 * _parseOptions 89 * handle plugin options 90 */ 91 92 var _parseOptions = function(options) { 93 var opts = { 94 byRow: true, 95 property: 'height', 96 target: null, 97 remove: false 98 }; 99 100 if (typeof options === 'object') { 101 return $.extend(opts, options); 102 } 103 104 if (typeof options === 'boolean') { 105 opts.byRow = options; 106 } else if (options === 'remove') { 107 opts.remove = true; 108 } 109 110 return opts; 111 }; 112 113 /* 114 * matchHeight 115 * plugin definition 116 */ 117 118 var matchHeight = $.fn.matchHeight = function(options) { 119 var opts = _parseOptions(options); 120 121 // handle remove 122 if (opts.remove) { 123 var that = this; 124 125 // remove fixed height from all selected elements 126 this.css(opts.property, ''); 127 128 // remove selected elements from all groups 129 $.each(matchHeight._groups, function(key, group) { 130 group.elements = group.elements.not(that); 131 }); 132 133 // TODO: cleanup empty groups 134 135 return this; 136 } 137 138 if (this.length <= 1 && !opts.target) { 139 return this; 140 } 141 142 // keep track of this group so we can re-apply later on load and resize events 143 matchHeight._groups.push({ 144 elements: this, 145 options: opts 146 }); 147 148 // match each element's height to the tallest element in the selection 149 matchHeight._apply(this, opts); 150 151 return this; 152 }; 153 154 /* 155 * plugin global options 156 */ 157 158 matchHeight.version = 'master'; 159 matchHeight._groups = []; 160 matchHeight._throttle = 80; 161 matchHeight._maintainScroll = false;
162 matchHeight._beforeUpdate = null; 163 matchHeight._afterUpdate = null; 164 matchHeight._rows = _rows; 165 matchHeight._parse = _parse; 166 matchHeight._parseOptions = _parseOptions; 167 168 /* 169 * matchHeight._apply 170 * apply matchHeight to given elements 171 */ 172 173 matchHeight._apply = function(elements, options) { 174 var opts = _parseOptions(options), 175 $elements = $(elements), 176 rows = [$elements]; 177 178 // take note of scroll position 179 var scrollTop = $(window).scrollTop(), 180 htmlHeight = $('html').outerHeight(true); 181 182 // get hidden parents 183 var $hiddenParents = $elements.parents().filter(':hidden'); 184 185 // cache the original inline style 186 $hiddenParents.each(function() { 187 var $that = $(this); 188 $that.data('style-cache', $that.attr('style')); 189 }); 190 191 // temporarily must force hidden parents visible 192 $hiddenParents.css('display', 'block'); 193 194 // get rows if using byRow, otherwise assume one row 195 if (opts.byRow && !opts.target) { 196 197 // must first force an arbitrary equal height so floating elements break evenly 198 $elements.each(function() { 199 var $that = $(this), 200 display = $that.css('display'); 201 202 // temporarily force a usable display value 203 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 204 display = 'block'; 205 } 206 207 // cache the original inline style 208 $that.data('style-cache', $that.attr('style')); 209 210 $that.css({ 211 'display': display, 212 'padding-top': '0', 213 'padding-bottom': '0', 214 'margin-top': '0', 215 'margin-bottom': '0', 216 'border-top-width': '0', 217 'border-bottom-width': '0', 218 'height': '100px', 219 'overflow': 'hidden' 220 }); 221 }); 222 223 // get the array of rows (based on element top position) 224 rows = _rows($elements); 225 226 // revert original inline styles 227 $elements.each(function() { 228 var $that = $(this); 229 $that.attr('style', $that.data('style-cache') || ''); 230 }); 231 } 232 233 $.each(rows, function(key, row) { 234 var $row = $(row), 235 targetHeight = 0; 236 237 if (!opts.target) { 238 // skip apply to rows with only one item 239 if (opts.byRow && $row.length <= 1) { 240 $row.css(opts.property, ''); 241 return; 242 } 243 244 // iterate the row and find the max height 245 $row.each(function(){ 246 var $that = $(this), 247 style = $that.attr('style'), 248 display = $that.css('display'); 249 250 // temporarily force a usable display value 251 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 252 display = 'block'; 253 } 254 255 // ensure we get the correct actual height (and not a previously set height value) 256 var css = { 'display': display }; 257 css[opts.property] = ''; 258 $that.css(css); 259 260 // find the max height (including padding, but not margin) 261 if ($that.outerHeight(false) > targetHeight) { 262 targetHeight = $that.outerHeight(false); 263 } 264 265 // revert styles 266 if (style) { 267 $that.attr('style', style); 268 } else { 269 $that.css('display', ''); 270 } 271 }); 272 } else { 273 // if target set, use the height of the target element 274 targetHeight = opts.target.outerHeight(false); 275 } 276 277 // iterate the row and apply the height to all elements 278 $row.each(function(){ 279 var $that = $(this), 280 verticalPadding = 0; 281 282 // don't apply to a target 283 if (opts.target && $that.is(opts.target)) { 284 return; 285 } 286 287 // handle padding and border correctly (required when not using border-box) 288 if ($that.css('box-sizing') !== 'border-box') { 289 verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); 290 verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); 291 } 292 293 // set the height (accounting for padding and border) 294 $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); 295 }); 296 }); 297 298 // revert hidden parents 299 $hiddenParents.each(function() { 300 var $that = $(this); 301 $that.attr('style', $that.data('style-cache') || null); 302 }); 303 304 // restore scroll position if enabled 305 if (matchHeight._maintainScroll) { 306 $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true)); 307 } 308 309 return this; 310 }; 311 312 /* 313 * matchHeight._applyDataApi 314 * applies matchHeight to all elements with a data-match-height attribute 315 */ 316 317 matchHeight._applyDataApi = function() { 318 var groups = {}; 319 320 // generate groups by their groupId set by elements using data-match-height 321 $('[data-match-height], [data-mh]').each(function() { 322 var $this = $(this), 323 groupId = $this.attr('data-mh') || $this.attr('data-match-height'); 324 325 if (groupId in groups) { 326 groups[groupId] = groups[groupId].add($this); 327 } else { 328 groups[groupId] = $this; 329 } 330 }); 331 332 // apply matchHeight to each group 333 $.each(groups, function() { 334 this.matchHeight(true); 335 }); 336 }; 337 338 /* 339 * matchHeight._update 340 * updates matchHeight on all current groups with their correct options 341 */ 342 343 var _update = function(event) { 344 if (matchHeight._beforeUpdate) { 345 matchHeight._beforeUpdate(event, matchHeight._groups); 346 } 347 348 $.each(matchHeight._groups, function() { 349 matchHeight._apply(this.elements, this.options); 350 }); 351 352 if (matchHeight._afterUpdate) { 353 matchHeight._afterUpdate(event, matchHeight._groups); 354 } 355 }; 356 357 matchHeight._update = function(throttle, event) { 358 // prevent update if fired from a resize event 359 // where the viewport width hasn't actually changed 360 // fixes an event looping bug in IE8 361 if (event && event.type === 'resize') { 362 var windowWidth = $(window).width(); 363 if (windowWidth === _previousResizeWidth) { 364 return; 365 } 366 _previousResizeWidth = windowWidth; 367 } 368 369 // throttle updates 370 if (!throttle) { 371 _update(event); 372 } else if (_updateTimeout === -1) { 373 _updateTimeout = setTimeout(function() { 374 _update(event); 375 _updateTimeout = -1; 376 }, matchHeight._throttle); 377 } 378 }; 379 380 /* 381 * bind events 382 */ 383 384 // apply on DOM ready event 385 $(matchHeight._applyDataApi); 386 387 // use on or bind where supported 388 var on = $.fn.on ? 'on' : 'bind'; 389 390 // update heights on load and resize events 391 $(window)[on]('load', function(event) { 392 matchHeight._update(false, event); 393 }); 394 395 // throttled update heights on resize events 396 $(window)[on]('resize orientationchange', function(event) { 397 matchHeight._update(true, event); 398 }); 399 400}); 401 402// Generated by CoffeeScript 1.12.3 403 404/** 405@license Sticky-kit v1.1.4 | MIT | Leaf Corcoran 2015 | http://leafo.net 406 */ 407 408(function() { 409 var $, doc, win; 410 411 $ = window.jQuery; 412 413 win = $(window); 414 doc = $(document); 415 416 $.fn.stick_in_parent = function(opts) { 417 var doc_height, elm, enable_bottoming, fn, i, inner_scrolling, len, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, ref, sticky_class, win_height; 418 if (opts == null) { 419 opts = {}; 420 } 421 sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming; 422 win_height = win.height(); 423 doc_height = doc.height(); 424 if (offset_top == null) { 425 offset_top = 0; 426 } 427 if (parent_selector == null) { 428 parent_selector = void 0; 429 } 430 if (inner_scrolling == null) { 431 inner_scrolling = true; 432 } 433 if (sticky_class == null) { 434 sticky_class = "is_stuck"; 435 } 436 if (enable_bottoming == null) { 437 enable_bottoming = true; 438 } 439 outer_width = function(el) { 440 var _el, computed, w; 441 if (window.getComputedStyle) { 442 _el = el[0]; 443 computed = window.getComputedStyle(el[0]); 444 w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right")); 445 if (computed.getPropertyValue("box-sizing") !== "border-box") { 446 w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right")); 447 } 448 return w; 449 } else { 450 return el.outerWidth(true); 451 } 452 }; 453 ref = this; 454 fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) { 455 var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick; 456 if (elm.data("sticky_kit")) { 457 return; 458 } 459 elm.data("sticky_kit", true); 460 last_scroll_height = doc_height; 461 parent = elm.parent(); 462 if (parent_selector != null) { 463 parent = parent.closest(parent_selector); 464 } 465 if (!parent.length) { 466 throw "failed to find stick parent"; 467 } 468 fixed = false;
vendor: 6,252 bytes, lines 469-672
469 bottomed = false; 470 spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />"); 471 if (spacer) { 472 spacer.css('position', elm.css('position')); 473 } 474 recalc = function() { 475 var border_top, padding_top, restore; 476 if (detached) { 477 return; 478 } 479 win_height = win.height(); 480 doc_height = doc.height(); 481 last_scroll_height = doc_height; 482 border_top = parseInt(parent.css("border-top-width"), 10); 483 padding_top = parseInt(parent.css("padding-top"), 10); 484 padding_bottom = parseInt(parent.css("padding-bottom"), 10); 485 parent_top = parent.offset().top + border_top + padding_top; 486 parent_height = parent.height(); 487 if (fixed) { 488 fixed = false; 489 bottomed = false; 490 if (manual_spacer == null) { 491 elm.insertAfter(spacer); 492 spacer.detach(); 493 } 494 elm.css({ 495 position: "", 496 top: "", 497 width: "", 498 bottom: "" 499 }).removeClass(sticky_class); 500 restore = true; 501 } 502 top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top; 503 height = elm.outerHeight(true); 504 el_float = elm.css("float"); 505 if (spacer) { 506 spacer.css({ 507 width: outer_width(elm), 508 height: height, 509 display: elm.css("display"), 510 "vertical-align": elm.css("vertical-align"), 511 "float": el_float 512 }); 513 } 514 if (restore) { 515 return tick(); 516 } 517 }; 518 recalc(); 519 if (height === parent_height) { 520 return; 521 } 522 last_pos = void 0; 523 offset = offset_top; 524 recalc_counter = recalc_every; 525 tick = function() { 526 var css, delta, recalced, scroll, will_bottom; 527 if (detached) { 528 return; 529 } 530 recalced = false; 531 if (recalc_counter != null) { 532 recalc_counter -= 1; 533 if (recalc_counter <= 0) { 534 recalc_counter = recalc_every; 535 recalc(); 536 recalced = true; 537 } 538 } 539 if (!recalced && doc_height !== last_scroll_height) { 540 recalc(); 541 recalced = true; 542 } 543 scroll = win.scrollTop(); 544 if (last_pos != null) { 545 delta = scroll - last_pos; 546 } 547 last_pos = scroll; 548 if (fixed) { 549 if (enable_bottoming) { 550 will_bottom = scroll + height + offset > parent_height + parent_top; 551 if (bottomed && !will_bottom) { 552 bottomed = false; 553 elm.css({ 554 position: "fixed", 555 bottom: "", 556 top: offset 557 }).trigger("sticky_kit:unbottom"); 558 } 559 } 560 if (scroll < top) { 561 fixed = false; 562 offset = offset_top; 563 if (manual_spacer == null) { 564 if (el_float === "left" || el_float === "right") { 565 elm.insertAfter(spacer); 566 } 567 spacer.detach(); 568 } 569 css = { 570 position: "", 571 width: "", 572 top: "" 573 }; 574 elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick"); 575 } 576 if (inner_scrolling) { 577 if (height + offset_top > win_height) { 578 if (!bottomed) { 579 offset -= delta; 580 offset = Math.max(win_height - height, offset); 581 offset = Math.min(offset_top, offset); 582 if (fixed) { 583 elm.css({ 584 top: offset + "px" 585 }); 586 } 587 } 588 } 589 } 590 } else { 591 if (scroll > top) { 592 fixed = true; 593 css = { 594 position: "fixed", 595 top: offset 596 }; 597 css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px"; 598 elm.css(css).addClass(sticky_class); 599 if (manual_spacer == null) { 600 elm.after(spacer); 601 if (el_float === "left" || el_float === "right") { 602 spacer.append(elm); 603 } 604 } 605 elm.trigger("sticky_kit:stick"); 606 } 607 } 608 if (fixed && enable_bottoming) { 609 if (will_bottom == null) { 610 will_bottom = scroll + height + offset > parent_height + parent_top; 611 } 612 if (!bottomed && will_bottom) { 613 bottomed = true; 614 if (parent.css("position") === "static") { 615 parent.css({ 616 position: "relative" 617 }); 618 } 619 return elm.css({ 620 position: "absolute", 621 bottom: padding_bottom, 622 top: "auto" 623 }).trigger("sticky_kit:bottom"); 624 } 625 } 626 }; 627 recalc_and_tick = function() { 628 recalc(); 629 return tick(); 630 }; 631 detach = function() { 632 detached = true; 633 win.off("touchmove", tick); 634 win.off("scroll", tick); 635 win.off("resize", recalc_and_tick); 636 $(document.body).off("sticky_kit:recalc", recalc_and_tick); 637 elm.off("sticky_kit:detach", detach); 638 elm.removeData("sticky_kit"); 639 elm.css({ 640 position: "", 641 bottom: "", 642 top: "", 643 width: "" 644 }); 645 parent.position("position", ""); 646 if (fixed) { 647 if (manual_spacer == null) { 648 if (el_float === "left" || el_float === "right") { 649 elm.insertAfter(spacer); 650 } 651 spacer.remove(); 652 } 653 return elm.removeClass(sticky_class); 654 } 655 }; 656 win.on("touchmove", tick); 657 win.on("scroll", tick); 658 win.on("resize", recalc_and_tick); 659 $(document.body).on("sticky_kit:recalc", recalc_and_tick); 660 elm.on("sticky_kit:detach", detach); 661 return setTimeout(tick, 0); 662 }; 663 for (i = 0, len = ref.length; i < len; i++) { 664 elm = ref[i]; 665 fn($(elm)); 666 } 667 return this; 668 }; 669 670}).call(this); 671 672/*! Magnific Popup - v1.1.0 - 2016-02-20
vendor: 37,682 bytes, lines 673-2364
673* http://dimsemenov.com/plugins/magnific-popup/ 674* Copyright (c) 2016 Dmitry Semenov; */ 675;(function (factory) { 676if (typeof define === 'function' && define.amd) { 677 // AMD. Register as an anonymous module. 678 define(['jquery'], factory); 679 } else if (typeof exports === 'object') { 680 // Node/CommonJS 681 factory(require('jquery')); 682 } else { 683 // Browser globals 684 factory(window.jQuery || window.Zepto); 685 } 686 }(function($) { 687 688/*>>core*/ 689/** 690 * 691 * Magnific Popup Core JS file 692 * 693 */ 694 695 696/** 697 * Private static constants 698 */ 699var CLOSE_EVENT = 'Close', 700 BEFORE_CLOSE_EVENT = 'BeforeClose', 701 AFTER_CLOSE_EVENT = 'AfterClose', 702 BEFORE_APPEND_EVENT = 'BeforeAppend', 703 MARKUP_PARSE_EVENT = 'MarkupParse', 704 OPEN_EVENT = 'Open', 705 CHANGE_EVENT = 'Change', 706 NS = 'mfp', 707 EVENT_NS = '.' + NS, 708 READY_CLASS = 'mfp-ready', 709 REMOVING_CLASS = 'mfp-removing', 710 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 711 712 713/** 714 * Private vars 715 */ 716/*jshint -W079 */ 717var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 718 MagnificPopup = function(){}, 719 _isJQ = !!(window.jQuery), 720 _prevStatus, 721 _window = $(window), 722 _document, 723 _prevContentType, 724 _wrapClasses, 725 _currPopupType; 726 727 728/** 729 * Private functions 730 */ 731var _mfpOn = function(name, f) { 732 mfp.ev.on(NS + name + EVENT_NS, f); 733 }, 734 _getEl = function(className, appendTo, html, raw) { 735 var el = document.createElement('div'); 736 el.className = 'mfp-'+className; 737 if(html) { 738 el.innerHTML = html; 739 } 740 if(!raw) { 741 el = $(el); 742 if(appendTo) { 743 el.appendTo(appendTo); 744 } 745 } else if(appendTo) { 746 appendTo.appendChild(el); 747 } 748 return el; 749 }, 750 _mfpTrigger = function(e, data) { 751 mfp.ev.triggerHandler(NS + e, data); 752 753 if(mfp.st.callbacks) { 754 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 755 e = e.charAt(0).toLowerCase() + e.slice(1); 756 if(mfp.st.callbacks[e]) { 757 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 758 } 759 } 760 }, 761 _getCloseBtn = function(type) { 762 if(type !== _currPopupType || !mfp.currTemplate.closeBtn) { 763 mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) ); 764 _currPopupType = type; 765 } 766 return mfp.currTemplate.closeBtn; 767 }, 768 // Initialize Magnific Popup only when called at least once 769 _checkInstance = function() { 770 if(!$.magnificPopup.instance) { 771 /*jshint -W020 */ 772 mfp = new MagnificPopup(); 773 mfp.init(); 774 $.magnificPopup.instance = mfp; 775 } 776 }, 777 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 778 supportsTransitions = function() { 779 var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist 780 v = ['ms','O','Moz','Webkit']; // 'v' for vendor 781 782 if( s['transition'] !== undefined ) { 783 return true; 784 } 785 786 while( v.length ) { 787 if( v.pop() + 'Transition' in s ) { 788 return true; 789 } 790 } 791 792 return false; 793 }; 794 795 796 797/** 798 * Public functions 799 */ 800MagnificPopup.prototype = { 801 802 constructor: MagnificPopup, 803 804 /** 805 * Initializes Magnific Popup plugin. 806 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 807 */ 808 init: function() { 809 var appVersion = navigator.appVersion; 810 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 811 mfp.isAndroid = (/android/gi).test(appVersion); 812 mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); 813 mfp.supportsTransition = supportsTransitions(); 814 815 // We disable fixed positioned lightbox on devices that don't handle it nicely. 816 // If you know a better way of detecting this - let me know. 817 mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) ); 818 _document = $(document); 819 820 mfp.popupsCache = {}; 821 }, 822 823 /** 824 * Opens popup 825 * @param data [description] 826 */ 827 open: function(data) { 828 829 var i; 830 831 if(data.isObj === false) { 832 // convert jQuery collection to array to avoid conflicts later 833 mfp.items = data.items.toArray(); 834 835 mfp.index = 0; 836 var items = data.items, 837 item; 838 for(i = 0; i < items.length; i++) { 839 item = items[i]; 840 if(item.parsed) { 841 item = item.el[0]; 842 } 843 if(item === data.el[0]) { 844 mfp.index = i; 845 break; 846 } 847 } 848 } else { 849 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 850 mfp.index = data.index || 0; 851 } 852 853 // if popup is already opened - we just update the content 854 if(mfp.isOpen) { 855 mfp.updateItemHTML(); 856 return; 857 } 858 859 mfp.types = []; 860 _wrapClasses = ''; 861 if(data.mainEl && data.mainEl.length) { 862 mfp.ev = data.mainEl.eq(0); 863 } else { 864 mfp.ev = _document; 865 } 866 867 if(data.key) { 868 if(!mfp.popupsCache[data.key]) { 869 mfp.popupsCache[data.key] = {}; 870 } 871 mfp.currTemplate = mfp.popupsCache[data.key]; 872 } else { 873 mfp.currTemplate = {}; 874 } 875 876 877 878 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 879 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 880 881 if(mfp.st.modal) { 882 mfp.st.closeOnContentClick = false; 883 mfp.st.closeOnBgClick = false; 884 mfp.st.showCloseBtn = false; 885 mfp.st.enableEscapeKey = false; 886 } 887 888 889 // Building markup 890 // main containers are created only once 891 if(!mfp.bgOverlay) { 892 893 // Dark overlay 894 mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() { 895 mfp.close(); 896 }); 897 898 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) { 899 if(mfp._checkIfClose(e.target)) { 900 mfp.close(); 901 } 902 }); 903 904 mfp.container = _getEl('container', mfp.wrap); 905 } 906 907 mfp.contentContainer = _getEl('content'); 908 if(mfp.st.preloader) { 909 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 910 } 911 912 913 // Initializing modules 914 var modules = $.magnificPopup.modules; 915 for(i = 0; i < modules.length; i++) { 916 var n = modules[i]; 917 n = n.charAt(0).toUpperCase() + n.slice(1); 918 mfp['init'+n].call(mfp); 919 } 920 _mfpTrigger('BeforeOpen'); 921 922 923 if(mfp.st.showCloseBtn) { 924 // Close button 925 if(!mfp.st.closeBtnInside) { 926 mfp.wrap.append( _getCloseBtn() ); 927 } else { 928 _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) { 929 values.close_replaceWith = _getCloseBtn(item.type); 930 }); 931 _wrapClasses += ' mfp-close-btn-in'; 932 } 933 } 934 935 if(mfp.st.alignTop) { 936 _wrapClasses += ' mfp-align-top'; 937 } 938 939 940 941 if(mfp.fixedContentPos) { 942 mfp.wrap.css({ 943 overflow: mfp.st.overflowY, 944 overflowX: 'hidden', 945 overflowY: mfp.st.overflowY 946 }); 947 } else { 948 mfp.wrap.css({ 949 top: _window.scrollTop(), 950 position: 'absolute' 951 }); 952 } 953 if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) { 954 mfp.bgOverlay.css({ 955 height: _document.height(), 956 position: 'absolute' 957 }); 958 } 959 960 961 962 if(mfp.st.enableEscapeKey) { 963 // Close on ESC key 964 _document.on('keyup' + EVENT_NS, function(e) { 965 if(e.keyCode === 27) { 966 mfp.close(); 967 } 968 }); 969 } 970 971 _window.on('resize' + EVENT_NS, function() { 972 mfp.updateSize(); 973 }); 974 975 976 if(!mfp.st.closeOnContentClick) { 977 _wrapClasses += ' mfp-auto-cursor'; 978 } 979 980 if(_wrapClasses) 981 mfp.wrap.addClass(_wrapClasses); 982 983 984 // this triggers recalculation of layout, so we get it once to not to trigger twice 985 var windowHeight = mfp.wH = _window.height(); 986 987 988 var windowStyles = {}; 989 990 if( mfp.fixedContentPos ) { 991 if(mfp._hasScrollBar(windowHeight)){ 992 var s = mfp._getScrollbarSize(); 993 if(s) { 994 windowStyles.marginRight = s; 995 } 996 } 997 } 998 999 if(mfp.fixedContentPos) { 1000 if(!mfp.isIE7) { 1001 windowStyles.overflow = 'hidden'; 1002 } else { 1003 // ie7 double-scroll bug 1004 $('body, html').css('overflow', 'hidden'); 1005 } 1006 } 1007 1008 1009 1010 var classesToadd = mfp.st.mainClass; 1011 if(mfp.isIE7) { 1012 classesToadd += ' mfp-ie7'; 1013 } 1014 if(classesToadd) { 1015 mfp._addClassToMFP( classesToadd ); 1016 } 1017 1018 // add content 1019 mfp.updateItemHTML(); 1020 1021 _mfpTrigger('BuildControls'); 1022 1023 // remove scrollbar, add margin e.t.c 1024 $('html').css(windowStyles); 1025 1026 // add everything to DOM 1027 mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) ); 1028 1029 // Save last focused element 1030 mfp._lastFocusedEl = document.activeElement; 1031 1032 // Wait for next cycle to allow CSS transition 1033 setTimeout(function() { 1034 1035 if(mfp.content) { 1036 mfp._addClassToMFP(READY_CLASS); 1037 mfp._setFocus(); 1038 } else { 1039 // if content is not defined (not loaded e.t.c) we add class only for BG 1040 mfp.bgOverlay.addClass(READY_CLASS); 1041 } 1042 1043 // Trap the focus in popup 1044 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 1045 1046 }, 16); 1047 1048 mfp.isOpen = true; 1049 mfp.updateSize(windowHeight); 1050 _mfpTrigger(OPEN_EVENT); 1051 1052 return data; 1053 }, 1054 1055 /** 1056 * Closes the popup 1057 */ 1058 close: function() { 1059 if(!mfp.isOpen) return; 1060 _mfpTrigger(BEFORE_CLOSE_EVENT); 1061 1062 mfp.isOpen = false; 1063 // for CSS3 animation 1064 if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) { 1065 mfp._addClassToMFP(REMOVING_CLASS); 1066 setTimeout(function() { 1067 mfp._close(); 1068 }, mfp.st.removalDelay); 1069 } else { 1070 mfp._close(); 1071 } 1072 }, 1073 1074 /** 1075 * Helper for close() function 1076 */ 1077 _close: function() { 1078 _mfpTrigger(CLOSE_EVENT); 1079 1080 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 1081 1082 mfp.bgOverlay.detach(); 1083 mfp.wrap.detach(); 1084 mfp.container.empty(); 1085 1086 if(mfp.st.mainClass) { 1087 classesToRemove += mfp.st.mainClass + ' '; 1088 } 1089 1090 mfp._removeClassFromMFP(classesToRemove); 1091 1092 if(mfp.fixedContentPos) { 1093 var windowStyles = {marginRight: ''}; 1094 if(mfp.isIE7) { 1095 $('body, html').css('overflow', ''); 1096 } else { 1097 windowStyles.overflow = ''; 1098 } 1099 $('html').css(windowStyles); 1100 } 1101 1102 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 1103 mfp.ev.off(EVENT_NS); 1104 1105 // clean up DOM elements that aren't removed 1106 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 1107 mfp.bgOverlay.attr('class', 'mfp-bg'); 1108 mfp.container.attr('class', 'mfp-container'); 1109 1110 // remove close button from target element 1111 if(mfp.st.showCloseBtn && 1112 (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 1113 if(mfp.currTemplate.closeBtn) 1114 mfp.currTemplate.closeBtn.detach(); 1115 } 1116 1117 1118 if(mfp.st.autoFocusLast && mfp._lastFocusedEl) { 1119 $(mfp._lastFocusedEl).focus(); // put tab focus back 1120 } 1121 mfp.currItem = null; 1122 mfp.content = null; 1123 mfp.currTemplate = null; 1124 mfp.prevHeight = 0; 1125 1126 _mfpTrigger(AFTER_CLOSE_EVENT); 1127 }, 1128 1129 updateSize: function(winHeight) { 1130 1131 if(mfp.isIOS) { 1132 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 1133 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 1134 var height = window.innerHeight * zoomLevel; 1135 mfp.wrap.css('height', height); 1136 mfp.wH = height; 1137 } else { 1138 mfp.wH = winHeight || _window.height(); 1139 } 1140 // Fixes #84: popup incorrectly positioned with position:relative on body 1141 if(!mfp.fixedContentPos) { 1142 mfp.wrap.css('height', mfp.wH); 1143 } 1144 1145 _mfpTrigger('Resize'); 1146 1147 }, 1148 1149 /** 1150 * Set content of popup based on current index 1151 */ 1152 updateItemHTML: function() { 1153 var item = mfp.items[mfp.index]; 1154 1155 // Detach and perform modifications 1156 mfp.contentContainer.detach(); 1157 1158 if(mfp.content) 1159 mfp.content.detach(); 1160 1161 if(!item.parsed) { 1162 item = mfp.parseEl( mfp.index ); 1163 } 1164 1165 var type = item.type; 1166 1167 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 1168 // BeforeChange event works like so: 1169 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 1170 1171 mfp.currItem = item; 1172 1173 if(!mfp.currTemplate[type]) { 1174 var markup = mfp.st[type] ? mfp.st[type].markup : false; 1175 1176 // allows to modify markup 1177 _mfpTrigger('FirstMarkupParse', markup); 1178 1179 if(markup) { 1180 mfp.currTemplate[type] = $(markup); 1181 } else { 1182 // if there is no markup found we just define that template is parsed 1183 mfp.currTemplate[type] = true; 1184 } 1185 } 1186 1187 if(_prevContentType && _prevContentType !== item.type) { 1188 mfp.container.removeClass('mfp-'+_prevContentType+'-holder'); 1189 } 1190 1191 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 1192 mfp.appendContent(newContent, type); 1193 1194 item.preloaded = true; 1195 1196 _mfpTrigger(CHANGE_EVENT, item); 1197 _prevContentType = item.type; 1198 1199 // Append container back after its content changed 1200 mfp.container.prepend(mfp.contentContainer); 1201 1202 _mfpTrigger('AfterChange'); 1203 }, 1204 1205 1206 /** 1207 * Set HTML content of popup 1208 */ 1209 appendContent: function(newContent, type) { 1210 mfp.content = newContent; 1211 1212 if(newContent) { 1213 if(mfp.st.showCloseBtn && mfp.st.closeBtnInside && 1214 mfp.currTemplate[type] === true) { 1215 // if there is no markup, we just append close button element inside 1216 if(!mfp.content.find('.mfp-close').length) { 1217 mfp.content.append(_getCloseBtn()); 1218 } 1219 } else { 1220 mfp.content = newContent; 1221 } 1222 } else { 1223 mfp.content = ''; 1224 } 1225 1226 _mfpTrigger(BEFORE_APPEND_EVENT); 1227 mfp.container.addClass('mfp-'+type+'-holder'); 1228 1229 mfp.contentContainer.append(mfp.content); 1230 }, 1231 1232 1233 /** 1234 * Creates Magnific Popup data object based on given data 1235 * @param {int} index Index of item to parse 1236 */ 1237 parseEl: function(index) { 1238 var item = mfp.items[index], 1239 type; 1240 1241 if(item.tagName) { 1242 item = { el: $(item) }; 1243 } else { 1244 type = item.type; 1245 item = { data: item, src: item.src }; 1246 } 1247 1248 if(item.el) { 1249 var types = mfp.types; 1250 1251 // check for 'mfp-TYPE' class 1252 for(var i = 0; i < types.length; i++) { 1253 if( item.el.hasClass('mfp-'+types[i]) ) { 1254 type = types[i]; 1255 break; 1256 } 1257 } 1258 1259 item.src = item.el.attr('data-mfp-src'); 1260 if(!item.src) { 1261 item.src = item.el.attr('href'); 1262 } 1263 } 1264 1265 item.type = type || mfp.st.type || 'inline'; 1266 item.index = index; 1267 item.parsed = true; 1268 mfp.items[index] = item; 1269 _mfpTrigger('ElementParse', item); 1270 1271 return mfp.items[index]; 1272 }, 1273 1274 1275 /** 1276 * Initializes single popup or a group of popups 1277 */ 1278 addGroup: function(el, options) { 1279 var eHandler = function(e) { 1280 e.mfpEl = this; 1281 mfp._openClick(e, el, options); 1282 }; 1283 1284 if(!options) { 1285 options = {}; 1286 } 1287 1288 var eName = 'click.magnificPopup'; 1289 options.mainEl = el; 1290 1291 if(options.items) { 1292 options.isObj = true; 1293 el.off(eName).on(eName, eHandler); 1294 } else { 1295 options.isObj = false; 1296 if(options.delegate) { 1297 el.off(eName).on(eName, options.delegate , eHandler); 1298 } else { 1299 options.items = el; 1300 el.off(eName).on(eName, eHandler); 1301 } 1302 } 1303 }, 1304 _openClick: function(e, el, options) { 1305 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 1306 1307 1308 if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) { 1309 return; 1310 } 1311 1312 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 1313 1314 if(disableOn) { 1315 if($.isFunction(disableOn)) { 1316 if( !disableOn.call(mfp) ) { 1317 return true; 1318 } 1319 } else { // else it's number 1320 if( _window.width() < disableOn ) { 1321 return true; 1322 } 1323 } 1324 } 1325 1326 if(e.type) { 1327 e.preventDefault(); 1328 1329 // This will prevent popup from closing if element is inside and popup is already opened 1330 if(mfp.isOpen) { 1331 e.stopPropagation(); 1332 } 1333 } 1334 1335 options.el = $(e.mfpEl); 1336 if(options.delegate) { 1337 options.items = el.find(options.delegate); 1338 } 1339 mfp.open(options); 1340 }, 1341 1342 1343 /** 1344 * Updates text on preloader 1345 */ 1346 updateStatus: function(status, text) { 1347 1348 if(mfp.preloader) { 1349 if(_prevStatus !== status) { 1350 mfp.container.removeClass('mfp-s-'+_prevStatus); 1351 } 1352 1353 if(!text && status === 'loading') { 1354 text = mfp.st.tLoading; 1355 } 1356 1357 var data = { 1358 status: status, 1359 text: text 1360 }; 1361 // allows to modify status 1362 _mfpTrigger('UpdateStatus', data); 1363 1364 status = data.status; 1365 text = data.text; 1366 1367 mfp.preloader.html(text); 1368 1369 mfp.preloader.find('a').on('click', function(e) { 1370 e.stopImmediatePropagation(); 1371 }); 1372 1373 mfp.container.addClass('mfp-s-'+status); 1374 _prevStatus = status; 1375 } 1376 }, 1377 1378 1379 /* 1380 "Private" helpers that aren't private at all 1381 */ 1382 // Check to close popup or not 1383 // "target" is an element that was clicked 1384 _checkIfClose: function(target) { 1385 1386 if($(target).hasClass(PREVENT_CLOSE_CLASS)) { 1387 return; 1388 } 1389 1390 var closeOnContent = mfp.st.closeOnContentClick; 1391 var closeOnBg = mfp.st.closeOnBgClick; 1392 1393 if(closeOnContent && closeOnBg) { 1394 return true; 1395 } else { 1396 1397 // We close the popup if click is on close button or on preloader. Or if there is no content. 1398 if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) { 1399 return true; 1400 } 1401 1402 // if click is outside the content 1403 if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) { 1404 if(closeOnBg) { 1405 // last check, if the clicked element is in DOM, (in case it's removed onclick) 1406 if( $.contains(document, target) ) { 1407 return true; 1408 } 1409 } 1410 } else if(closeOnContent) { 1411 return true; 1412 } 1413 1414 } 1415 return false; 1416 }, 1417 _addClassToMFP: function(cName) { 1418 mfp.bgOverlay.addClass(cName); 1419 mfp.wrap.addClass(cName); 1420 }, 1421 _removeClassFromMFP: function(cName) { 1422 this.bgOverlay.removeClass(cName); 1423 mfp.wrap.removeClass(cName); 1424 }, 1425 _hasScrollBar: function(winHeight) { 1426 return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); 1427 }, 1428 _setFocus: function() { 1429 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 1430 }, 1431 _onFocusIn: function(e) { 1432 if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { 1433 mfp._setFocus(); 1434 return false; 1435 } 1436 }, 1437 _parseMarkup: function(template, values, item) { 1438 var arr; 1439 if(item.data) { 1440 values = $.extend(item.data, values); 1441 } 1442 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] ); 1443 1444 $.each(values, function(key, value) { 1445 if(value === undefined || value === false) { 1446 return true; 1447 } 1448 arr = key.split('_'); 1449 if(arr.length > 1) { 1450 var el = template.find(EVENT_NS + '-'+arr[0]); 1451 1452 if(el.length > 0) { 1453 var attr = arr[1]; 1454 if(attr === 'replaceWith') { 1455 if(el[0] !== value[0]) { 1456 el.replaceWith(value); 1457 } 1458 } else if(attr === 'img') { 1459 if(el.is('img')) { 1460 el.attr('src', value); 1461 } else { 1462 el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) ); 1463 } 1464 } else { 1465 el.attr(arr[1], value); 1466 } 1467 } 1468 1469 } else { 1470 template.find(EVENT_NS + '-'+key).html(value); 1471 } 1472 }); 1473 }, 1474 1475 _getScrollbarSize: function() { 1476 // thx David 1477 if(mfp.scrollbarSize === undefined) { 1478 var scrollDiv = document.createElement("div"); 1479 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 1480 document.body.appendChild(scrollDiv); 1481 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 1482 document.body.removeChild(scrollDiv); 1483 } 1484 return mfp.scrollbarSize; 1485 } 1486 1487}; /* MagnificPopup core prototype end */ 1488 1489 1490 1491 1492/** 1493 * Public static functions 1494 */ 1495$.magnificPopup = { 1496 instance: null, 1497 proto: MagnificPopup.prototype, 1498 modules: [], 1499 1500 open: function(options, index) { 1501 _checkInstance(); 1502 1503 if(!options) { 1504 options = {}; 1505 } else { 1506 options = $.extend(true, {}, options); 1507 } 1508 1509 options.isObj = true; 1510 options.index = index || 0; 1511 return this.instance.open(options); 1512 }, 1513 1514 close: function() { 1515 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 1516 }, 1517 1518 registerModule: function(name, module) { 1519 if(module.options) { 1520 $.magnificPopup.defaults[name] = module.options; 1521 } 1522 $.extend(this.proto, module.proto); 1523 this.modules.push(name); 1524 }, 1525 1526 defaults: { 1527 1528 // Info about options is in docs: 1529 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 1530 1531 disableOn: 0, 1532 1533 key: null, 1534 1535 midClick: false, 1536 1537 mainClass: '', 1538 1539 preloader: true, 1540 1541 focus: '', // CSS selector of input to focus after popup is opened 1542 1543 closeOnContentClick: false, 1544 1545 closeOnBgClick: true, 1546 1547 closeBtnInside: true, 1548 1549 showCloseBtn: true, 1550 1551 enableEscapeKey: true, 1552 1553 modal: false, 1554 1555 alignTop: false, 1556 1557 removalDelay: 0, 1558 1559 prependTo: null, 1560 1561 fixedContentPos: 'auto', 1562 1563 fixedBgPos: 'auto', 1564 1565 overflowY: 'auto', 1566 1567 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 1568 1569 tClose: 'Close (Esc)', 1570 1571 tLoading: 'Loading...', 1572 1573 autoFocusLast: true 1574 1575 } 1576}; 1577 1578 1579 1580$.fn.magnificPopup = function(options) { 1581 _checkInstance(); 1582 1583 var jqEl = $(this); 1584 1585 // We call some API method of first param is a string 1586 if (typeof options === "string" ) { 1587 1588 if(options === 'open') { 1589 var items, 1590 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 1591 index = parseInt(arguments[1], 10) || 0; 1592 1593 if(itemOpts.items) { 1594 items = itemOpts.items[index]; 1595 } else { 1596 items = jqEl; 1597 if(itemOpts.delegate) { 1598 items = items.find(itemOpts.delegate); 1599 } 1600 items = items.eq( index ); 1601 } 1602 mfp._openClick({mfpEl:items}, jqEl, itemOpts); 1603 } else { 1604 if(mfp.isOpen) 1605 mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 1606 } 1607 1608 } else { 1609 // clone options obj 1610 options = $.extend(true, {}, options); 1611 1612 /* 1613 * As Zepto doesn't support .data() method for objects 1614 * and it works only in normal browsers 1615 * we assign "options" object directly to the DOM element. FTW! 1616 */ 1617 if(_isJQ) { 1618 jqEl.data('magnificPopup', options); 1619 } else { 1620 jqEl[0].magnificPopup = options; 1621 } 1622 1623 mfp.addGroup(jqEl, options); 1624 1625 } 1626 return jqEl; 1627}; 1628 1629/*>>core*/ 1630 1631/*>>inline*/ 1632 1633var INLINE_NS = 'inline', 1634 _hiddenClass, 1635 _inlinePlaceholder, 1636 _lastInlineElement, 1637 _putInlineElementsBack = function() { 1638 if(_lastInlineElement) { 1639 _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach(); 1640 _lastInlineElement = null; 1641 } 1642 }; 1643 1644$.magnificPopup.registerModule(INLINE_NS, { 1645 options: { 1646 hiddenClass: 'hide', // will be appended with `mfp-` prefix 1647 markup: '', 1648 tNotFound: 'Content not found' 1649 }, 1650 proto: { 1651 1652 initInline: function() { 1653 mfp.types.push(INLINE_NS); 1654 1655 _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() { 1656 _putInlineElementsBack(); 1657 }); 1658 }, 1659 1660 getInline: function(item, template) { 1661 1662 _putInlineElementsBack(); 1663 1664 if(item.src) { 1665 var inlineSt = mfp.st.inline, 1666 el = $(item.src); 1667 1668 if(el.length) { 1669 1670 // If target element has parent - we replace it with placeholder and put it back after popup is closed 1671 var parent = el[0].parentNode; 1672 if(parent && parent.tagName) { 1673 if(!_inlinePlaceholder) { 1674 _hiddenClass = inlineSt.hiddenClass; 1675 _inlinePlaceholder = _getEl(_hiddenClass); 1676 _hiddenClass = 'mfp-'+_hiddenClass; 1677 } 1678 // replace target inline element with placeholder 1679 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 1680 } 1681 1682 mfp.updateStatus('ready'); 1683 } else { 1684 mfp.updateStatus('error', inlineSt.tNotFound); 1685 el = $('<div>'); 1686 } 1687 1688 item.inlineElement = el; 1689 return el; 1690 } 1691 1692 mfp.updateStatus('ready'); 1693 mfp._parseMarkup(template, {}, item); 1694 return template; 1695 } 1696 } 1697}); 1698 1699/*>>inline*/ 1700 1701/*>>ajax*/ 1702var AJAX_NS = 'ajax', 1703 _ajaxCur, 1704 _removeAjaxCursor = function() { 1705 if(_ajaxCur) { 1706 $(document.body).removeClass(_ajaxCur); 1707 } 1708 }, 1709 _destroyAjaxRequest = function() { 1710 _removeAjaxCursor(); 1711 if(mfp.req) { 1712 mfp.req.abort(); 1713 } 1714 }; 1715 1716$.magnificPopup.registerModule(AJAX_NS, { 1717 1718 options: { 1719 settings: null, 1720 cursor: 'mfp-ajax-cur', 1721 tError: '<a href="%url%">The content</a> could not be loaded.' 1722 }, 1723 1724 proto: { 1725 initAjax: function() { 1726 mfp.types.push(AJAX_NS); 1727 _ajaxCur = mfp.st.ajax.cursor; 1728 1729 _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest); 1730 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 1731 }, 1732 getAjax: function(item) { 1733 1734 if(_ajaxCur) { 1735 $(document.body).addClass(_ajaxCur); 1736 } 1737 1738 mfp.updateStatus('loading'); 1739 1740 var opts = $.extend({ 1741 url: item.src, 1742 success: function(data, textStatus, jqXHR) { 1743 var temp = { 1744 data:data, 1745 xhr:jqXHR 1746 }; 1747 1748 _mfpTrigger('ParseAjax', temp); 1749 1750 mfp.appendContent( $(temp.data), AJAX_NS ); 1751 1752 item.finished = true; 1753 1754 _removeAjaxCursor(); 1755 1756 mfp._setFocus(); 1757 1758 setTimeout(function() { 1759 mfp.wrap.addClass(READY_CLASS); 1760 }, 16); 1761 1762 mfp.updateStatus('ready'); 1763 1764 _mfpTrigger('AjaxContentAdded'); 1765 }, 1766 error: function() { 1767 _removeAjaxCursor(); 1768 item.finished = item.loadError = true; 1769 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 1770 } 1771 }, mfp.st.ajax.settings); 1772 1773 mfp.req = $.ajax(opts); 1774 1775 return ''; 1776 } 1777 } 1778}); 1779 1780/*>>ajax*/ 1781 1782/*>>image*/ 1783var _imgInterval, 1784 _getTitle = function(item) { 1785 if(item.data && item.data.title !== undefined) 1786 return item.data.title; 1787 1788 var src = mfp.st.image.titleSrc; 1789 1790 if(src) { 1791 if($.isFunction(src)) { 1792 return src.call(mfp, item); 1793 } else if(item.el) { 1794 return item.el.attr(src) || ''; 1795 } 1796 } 1797 return ''; 1798 }; 1799 1800$.magnificPopup.registerModule('image', { 1801 1802 options: { 1803 markup: '<div class="mfp-figure">'+ 1804 '<div class="mfp-close"></div>'+ 1805 '<figure>'+ 1806 '<div class="mfp-img"></div>'+ 1807 '<figcaption>'+ 1808 '<div class="mfp-bottom-bar">'+ 1809 '<div class="mfp-title"></div>'+ 1810 '<div class="mfp-counter"></div>'+ 1811 '</div>'+ 1812 '</figcaption>'+ 1813 '</figure>'+ 1814 '</div>', 1815 cursor: 'mfp-zoom-out-cur', 1816 titleSrc: 'title', 1817 verticalFit: true, 1818 tError: '<a href="%url%">The image</a> could not be loaded.' 1819 }, 1820 1821 proto: { 1822 initImage: function() { 1823 var imgSt = mfp.st.image, 1824 ns = '.image'; 1825 1826 mfp.types.push('image'); 1827 1828 _mfpOn(OPEN_EVENT+ns, function() { 1829 if(mfp.currItem.type === 'image' && imgSt.cursor) { 1830 $(document.body).addClass(imgSt.cursor); 1831 } 1832 }); 1833 1834 _mfpOn(CLOSE_EVENT+ns, function() { 1835 if(imgSt.cursor) { 1836 $(document.body).removeClass(imgSt.cursor); 1837 } 1838 _window.off('resize' + EVENT_NS); 1839 }); 1840 1841 _mfpOn('Resize'+ns, mfp.resizeImage); 1842 if(mfp.isLowIE) { 1843 _mfpOn('AfterChange', mfp.resizeImage); 1844 } 1845 }, 1846 resizeImage: function() { 1847 var item = mfp.currItem; 1848 if(!item || !item.img) return; 1849 1850 if(mfp.st.image.verticalFit) { 1851 var decr = 0; 1852 // fix box-sizing in ie7/8 1853 if(mfp.isLowIE) { 1854 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); 1855 } 1856 item.img.css('max-height', mfp.wH-decr); 1857 } 1858 }, 1859 _onImageHasSize: function(item) { 1860 if(item.img) { 1861 1862 item.hasSize = true; 1863 1864 if(_imgInterval) { 1865 clearInterval(_imgInterval); 1866 } 1867 1868 item.isCheckingImgSize = false; 1869 1870 _mfpTrigger('ImageHasSize', item); 1871 1872 if(item.imgHidden) { 1873 if(mfp.content) 1874 mfp.content.removeClass('mfp-loading'); 1875 1876 item.imgHidden = false; 1877 } 1878 1879 } 1880 }, 1881 1882 /** 1883 * Function that loops until the image has size to display elements that rely on it asap 1884 */ 1885 findImageSize: function(item) { 1886 1887 var counter = 0, 1888 img = item.img[0], 1889 mfpSetInterval = function(delay) { 1890 1891 if(_imgInterval) { 1892 clearInterval(_imgInterval); 1893 } 1894 // decelerating interval that checks for size of an image 1895 _imgInterval = setInterval(function() { 1896 if(img.naturalWidth > 0) { 1897 mfp._onImageHasSize(item); 1898 return; 1899 } 1900 1901 if(counter > 200) { 1902 clearInterval(_imgInterval); 1903 } 1904 1905 counter++; 1906 if(counter === 3) { 1907 mfpSetInterval(10); 1908 } else if(counter === 40) { 1909 mfpSetInterval(50); 1910 } else if(counter === 100) { 1911 mfpSetInterval(500); 1912 } 1913 }, delay); 1914 }; 1915 1916 mfpSetInterval(1); 1917 }, 1918 1919 getImage: function(item, template) { 1920 1921 var guard = 0, 1922 1923 // image load complete handler 1924 onLoadComplete = function() { 1925 if(item) { 1926 if (item.img[0].complete) { 1927 item.img.off('.mfploader'); 1928 1929 if(item === mfp.currItem){ 1930 mfp._onImageHasSize(item); 1931 1932 mfp.updateStatus('ready'); 1933 } 1934 1935 item.hasSize = true; 1936 item.loaded = true; 1937 1938 _mfpTrigger('ImageLoadComplete'); 1939 1940 } 1941 else { 1942 // if image complete check fails 200 times (20 sec), we assume that there was an error. 1943 guard++; 1944 if(guard < 200) { 1945 setTimeout(onLoadComplete,100); 1946 } else { 1947 onLoadError(); 1948 } 1949 } 1950 } 1951 }, 1952 1953 // image error handler 1954 onLoadError = function() { 1955 if(item) { 1956 item.img.off('.mfploader'); 1957 if(item === mfp.currItem){ 1958 mfp._onImageHasSize(item); 1959 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 1960 } 1961 1962 item.hasSize = true; 1963 item.loaded = true; 1964 item.loadError = true; 1965 } 1966 }, 1967 imgSt = mfp.st.image; 1968 1969 1970 var el = template.find('.mfp-img'); 1971 if(el.length) { 1972 var img = document.createElement('img'); 1973 img.className = 'mfp-img'; 1974 if(item.el && item.el.find('img').length) { 1975 img.alt = item.el.find('img').attr('alt'); 1976 } 1977 item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); 1978 img.src = item.src; 1979 1980 // without clone() "error" event is not firing when IMG is replaced by new IMG 1981 // TODO: find a way to avoid such cloning 1982 if(el.is('img')) { 1983 item.img = item.img.clone(); 1984 } 1985 1986 img = item.img[0]; 1987 if(img.naturalWidth > 0) { 1988 item.hasSize = true; 1989 } else if(!img.width) { 1990 item.hasSize = false; 1991 } 1992 } 1993 1994 mfp._parseMarkup(template, { 1995 title: _getTitle(item), 1996 img_replaceWith: item.img 1997 }, item); 1998 1999 mfp.resizeImage(); 2000 2001 if(item.hasSize) { 2002 if(_imgInterval) clearInterval(_imgInterval); 2003 2004 if(item.loadError) { 2005 template.addClass('mfp-loading'); 2006 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 2007 } else { 2008 template.removeClass('mfp-loading'); 2009 mfp.updateStatus('ready'); 2010 } 2011 return template; 2012 } 2013 2014 mfp.updateStatus('loading'); 2015 item.loading = true; 2016 2017 if(!item.hasSize) { 2018 item.imgHidden = true; 2019 template.addClass('mfp-loading'); 2020 mfp.findImageSize(item); 2021 } 2022 2023 return template; 2024 } 2025 } 2026}); 2027 2028/*>>image*/ 2029 2030/*>>zoom*/ 2031var hasMozTransform, 2032 getHasMozTransform = function() { 2033 if(hasMozTransform === undefined) { 2034 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 2035 } 2036 return hasMozTransform; 2037 }; 2038 2039$.magnificPopup.registerModule('zoom', { 2040 2041 options: { 2042 enabled: false, 2043 easing: 'ease-in-out', 2044 duration: 300, 2045 opener: function(element) { 2046 return element.is('img') ? element : element.find('img'); 2047 } 2048 }, 2049 2050 proto: { 2051 2052 initZoom: function() { 2053 var zoomSt = mfp.st.zoom, 2054 ns = '.zoom', 2055 image; 2056 2057 if(!zoomSt.enabled || !mfp.supportsTransition) { 2058 return; 2059 } 2060 2061 var duration = zoomSt.duration, 2062 getElToAnimate = function(image) { 2063 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 2064 transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing, 2065 cssObj = { 2066 position: 'fixed', 2067 zIndex: 9999, 2068 left: 0, 2069 top: 0, 2070 '-webkit-backface-visibility': 'hidden' 2071 }, 2072 t = 'transition'; 2073 2074 cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition; 2075 2076 newImg.css(cssObj); 2077 return newImg; 2078 }, 2079 showMainContent = function() { 2080 mfp.content.css('visibility', 'visible'); 2081 }, 2082 openTimeout, 2083 animatedImg; 2084 2085 _mfpOn('BuildControls'+ns, function() { 2086 if(mfp._allowZoom()) { 2087 2088 clearTimeout(openTimeout); 2089 mfp.content.css('visibility', 'hidden'); 2090 2091 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 2092 2093 image = mfp._getItemToZoom(); 2094 2095 if(!image) { 2096 showMainContent(); 2097 return; 2098 } 2099 2100 animatedImg = getElToAnimate(image); 2101 2102 animatedImg.css( mfp._getOffset() ); 2103 2104 mfp.wrap.append(animatedImg); 2105 2106 openTimeout = setTimeout(function() { 2107 animatedImg.css( mfp._getOffset( true ) ); 2108 openTimeout = setTimeout(function() { 2109 2110 showMainContent(); 2111 2112 setTimeout(function() { 2113 animatedImg.remove(); 2114 image = animatedImg = null; 2115 _mfpTrigger('ZoomAnimationEnded'); 2116 }, 16); // avoid blink when switching images 2117 2118 }, duration); // this timeout equals animation duration 2119 2120 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 2121 2122 2123 // Lots of timeouts... 2124 } 2125 }); 2126 _mfpOn(BEFORE_CLOSE_EVENT+ns, function() { 2127 if(mfp._allowZoom()) { 2128 2129 clearTimeout(openTimeout); 2130 2131 mfp.st.removalDelay = duration; 2132 2133 if(!image) { 2134 image = mfp._getItemToZoom(); 2135 if(!image) { 2136 return; 2137 } 2138 animatedImg = getElToAnimate(image); 2139 } 2140 2141 animatedImg.css( mfp._getOffset(true) ); 2142 mfp.wrap.append(animatedImg); 2143 mfp.content.css('visibility', 'hidden'); 2144 2145 setTimeout(function() { 2146 animatedImg.css( mfp._getOffset() ); 2147 }, 16); 2148 } 2149 2150 }); 2151 2152 _mfpOn(CLOSE_EVENT+ns, function() { 2153 if(mfp._allowZoom()) { 2154 showMainContent(); 2155 if(animatedImg) { 2156 animatedImg.remove(); 2157 } 2158 image = null; 2159 } 2160 }); 2161 }, 2162 2163 _allowZoom: function() { 2164 return mfp.currItem.type === 'image'; 2165 }, 2166 2167 _getItemToZoom: function() { 2168 if(mfp.currItem.hasSize) { 2169 return mfp.currItem.img; 2170 } else { 2171 return false; 2172 } 2173 }, 2174 2175 // Get element postion relative to viewport 2176 _getOffset: function(isLarge) { 2177 var el; 2178 if(isLarge) { 2179 el = mfp.currItem.img; 2180 } else { 2181 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 2182 } 2183 2184 var offset = el.offset(); 2185 var paddingTop = parseInt(el.css('padding-top'),10); 2186 var paddingBottom = parseInt(el.css('padding-bottom'),10); 2187 offset.top -= ( $(window).scrollTop() - paddingTop ); 2188 2189 2190 /* 2191 2192 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 2193 2194 */ 2195 var obj = { 2196 width: el.width(), 2197 // fix Zepto height+padding issue 2198 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 2199 }; 2200 2201 // I hate to do this, but there is no another option 2202 if( getHasMozTransform() ) { 2203 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 2204 } else { 2205 obj.left = offset.left; 2206 obj.top = offset.top; 2207 } 2208 return obj; 2209 } 2210 2211 } 2212}); 2213 2214 2215 2216/*>>zoom*/ 2217 2218/*>>iframe*/ 2219 2220var IFRAME_NS = 'iframe', 2221 _emptyPage = '//about:blank', 2222 2223 _fixIframeBugs = function(isShowing) { 2224 if(mfp.currTemplate[IFRAME_NS]) { 2225 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 2226 if(el.length) { 2227 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 2228 if(!isShowing) { 2229 el[0].src = _emptyPage; 2230 } 2231 2232 // IE8 black screen bug fix 2233 if(mfp.isIE8) { 2234 el.css('display', isShowing ? 'block' : 'none'); 2235 } 2236 } 2237 } 2238 }; 2239 2240$.magnificPopup.registerModule(IFRAME_NS, { 2241 2242 options: { 2243 markup: '<div class="mfp-iframe-scaler">'+ 2244 '<div class="mfp-close"></div>'+ 2245 '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+ 2246 '</div>', 2247 2248 srcAction: 'iframe_src', 2249 2250 // we don't care and support only one default type of URL by default 2251 patterns: { 2252 youtube: { 2253 index: 'youtube.com', 2254 id: 'v=', 2255 src: '//www.youtube.com/embed/%id%?autoplay=1' 2256 }, 2257 vimeo: { 2258 index: 'vimeo.com/', 2259 id: '/', 2260 src: '//player.vimeo.com/video/%id%?autoplay=1' 2261 }, 2262 gmaps: { 2263 index: '//maps.google.', 2264 src: '%id%&output=embed' 2265 } 2266 } 2267 }, 2268 2269 proto: { 2270 initIframe: function() { 2271 mfp.types.push(IFRAME_NS); 2272 2273 _mfpOn('BeforeChange', function(e, prevType, newType) { 2274 if(prevType !== newType) { 2275 if(prevType === IFRAME_NS) { 2276 _fixIframeBugs(); // iframe if removed 2277 } else if(newType === IFRAME_NS) { 2278 _fixIframeBugs(true); // iframe is showing 2279 } 2280 }// else { 2281 // iframe source is switched, don't do anything 2282 //} 2283 }); 2284 2285 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() { 2286 _fixIframeBugs(); 2287 }); 2288 }, 2289 2290 getIframe: function(item, template) { 2291 var embedSrc = item.src; 2292 var iframeSt = mfp.st.iframe; 2293 2294 $.each(iframeSt.patterns, function() { 2295 if(embedSrc.indexOf( this.index ) > -1) { 2296 if(this.id) { 2297 if(typeof this.id === 'string') { 2298 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length); 2299 } else { 2300 embedSrc = this.id.call( this, embedSrc ); 2301 } 2302 } 2303 embedSrc = this.src.replace('%id%', embedSrc ); 2304 return false; // break; 2305 } 2306 }); 2307 2308 var dataObj = {}; 2309 if(iframeSt.srcAction) { 2310 dataObj[iframeSt.srcAction] = embedSrc; 2311 } 2312 mfp._parseMarkup(template, dataObj, item); 2313 2314 mfp.updateStatus('ready'); 2315 2316 return template; 2317 } 2318 } 2319}); 2320 2321 2322 2323/*>>iframe*/ 2324 2325/*>>gallery*/ 2326/** 2327 * Get looped index depending on number of slides 2328 */ 2329var _getLoopedId = function(index) { 2330 var numSlides = mfp.items.length; 2331 if(index > numSlides - 1) { 2332 return index - numSlides; 2333 } else if(index < 0) { 2334 return numSlides + index; 2335 } 2336 return index; 2337 }, 2338 _replaceCurrTotal = function(text, curr, total) { 2339 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 2340 }; 2341 2342$.magnificPopup.registerModule('gallery', { 2343 2344 options: { 2345 enabled: false, 2346 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 2347 preload: [0,2], 2348 navigateByImgClick: true, 2349 arrows: true, 2350 2351 tPrev: 'Previous (Left arrow key)', 2352 tNext: 'Next (Right arrow key)', 2353 tCounter: '%curr% of %total%' 2354 }, 2355 2356 proto: { 2357 initGallery: function() { 2358 2359 var gSt = mfp.st.gallery, 2360 ns = '.mfp-gallery'; 2361 2362 mfp.direction = true; // true - next, false - prev 2363 2364 if(!gSt || !gSt.enabled ) return false;
2365 2366 _wrapClasses += ' mfp-gallery'; 2367 2368 _mfpOn(OPEN_EVENT+ns, function() { 2369 2370 if(gSt.navigateByImgClick) { 2371 mfp.wrap.on('click'+ns, '.mfp-img', function() { 2372 if(mfp.items.length > 1) { 2373 mfp.next(); 2374 return false; 2375 } 2376 }); 2377 } 2378 2379 _document.on('keydown'+ns, function(e) { 2380 if (e.keyCode === 37) { 2381 mfp.prev(); 2382 } else if (e.keyCode === 39) { 2383 mfp.next(); 2384 } 2385 }); 2386 }); 2387 2388 _mfpOn('UpdateStatus'+ns, function(e, data) { 2389 if(data.text) { 2390 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 2391 } 2392 }); 2393 2394 _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) { 2395 var l = mfp.items.length; 2396 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 2397 }); 2398 2399 _mfpOn('BuildControls' + ns, function() { 2400 if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 2401 var markup = gSt.arrowMarkup, 2402 arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS), 2403 arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS); 2404 2405 arrowLeft.click(function() { 2406 mfp.prev(); 2407 }); 2408 arrowRight.click(function() { 2409 mfp.next(); 2410 }); 2411 2412 mfp.container.append(arrowLeft.add(arrowRight)); 2413 } 2414 }); 2415 2416 _mfpOn(CHANGE_EVENT+ns, function() { 2417 if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 2418 2419 mfp._preloadTimeout = setTimeout(function() { 2420 mfp.preloadNearbyImages(); 2421 mfp._preloadTimeout = null; 2422 }, 16); 2423 }); 2424 2425 2426 _mfpOn(CLOSE_EVENT+ns, function() { 2427 _document.off(ns); 2428 mfp.wrap.off('click'+ns); 2429 mfp.arrowRight = mfp.arrowLeft = null; 2430 }); 2431 2432 }, 2433 next: function() { 2434 mfp.direction = true; 2435 mfp.index = _getLoopedId(mfp.index + 1); 2436 mfp.updateItemHTML(); 2437 }, 2438 prev: function() { 2439 mfp.direction = false; 2440 mfp.index = _getLoopedId(mfp.index - 1); 2441 mfp.updateItemHTML(); 2442 }, 2443 goTo: function(newIndex) { 2444 mfp.direction = (newIndex >= mfp.index); 2445 mfp.index = newIndex; 2446 mfp.updateItemHTML(); 2447 }, 2448 preloadNearbyImages: function() { 2449 var p = mfp.st.gallery.preload, 2450 preloadBefore = Math.min(p[0], mfp.items.length), 2451 preloadAfter = Math.min(p[1], mfp.items.length), 2452 i; 2453 2454 for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 2455 mfp._preloadItem(mfp.index+i); 2456 } 2457 for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 2458 mfp._preloadItem(mfp.index-i); 2459 } 2460 }, 2461 _preloadItem: function(index) { 2462 index = _getLoopedId(index); 2463 2464 if(mfp.items[index].preloaded) { 2465 return; 2466 } 2467 2468 var item = mfp.items[index]; 2469 if(!item.parsed) { 2470 item = mfp.parseEl( index ); 2471 } 2472 2473 _mfpTrigger('LazyLoad', item); 2474 2475 if(item.type === 'image') { 2476 item.img = $('<img class="mfp-img" />').on('load.mfploader', function() { 2477 item.hasSize = true; 2478 }).on('error.mfploader', function() { 2479 item.hasSize = true; 2480 item.loadError = true; 2481 _mfpTrigger('LazyLoadError', item); 2482 }).attr('src', item.src); 2483 } 2484 2485 2486 item.preloaded = true; 2487 } 2488 } 2489}); 2490 2491/*>>gallery*/ 2492 2493/*>>retina*/ 2494 2495var RETINA_NS = 'retina'; 2496 2497$.magnificPopup.registerModule(RETINA_NS, { 2498 options: { 2499 replaceSrc: function(item) { 2500 return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; }); 2501 }, 2502 ratio: 1 // Function or number. Set to 1 to disable. 2503 }, 2504 proto: { 2505 initRetina: function() { 2506 if(window.devicePixelRatio > 1) { 2507 2508 var st = mfp.st.retina, 2509 ratio = st.ratio; 2510 2511 ratio = !isNaN(ratio) ? ratio : ratio(); 2512 2513 if(ratio > 1) { 2514 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) { 2515 item.img.css({ 2516 'max-width': item.img[0].naturalWidth / ratio, 2517 'width': '100%' 2518 }); 2519 }); 2520 _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) { 2521 item.src = st.replaceSrc(item, ratio); 2522 }); 2523 } 2524 } 2525 2526 } 2527 } 2528}); 2529 2530/*>>retina*/ 2531 _checkInstance(); })); 2532//global functions helpers for frontend 2533if (!Element.prototype.matches) { 2534 Element.prototype.matches = 2535 Element.prototype.matchesSelector || 2536 Element.prototype.mozMatchesSelector || 2537 Element.prototype.msMatchesSelector || 2538 Element.prototype.oMatchesSelector || 2539 Element.prototype.webkitMatchesSelector || 2540 function (s) { 2541 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 2542 i = matches.length; 2543 while (--i >= 0 && matches.item(i) !== this) { } 2544 return i > -1; 2545 }; 2546} 2547if (!String.prototype.endsWith) { 2548 String.prototype.endsWith = function (search, this_len) { 2549 if (this_len === undefined || this_len > this.length) { 2550 this_len = this.length; 2551 } 2552 return this.substring(this_len - search.length, this_len) === search; 2553 }; 2554} 2555 2556 2557 2558(function ($) { 2559 $.fn.isBrowserEdge = function () { 2560 var $this = $(this); 2561 return typeof CSS !== 'undefined' && CSS.supports("(-ms-ime-align:auto)"); 2562 }; 2563})(jQuery); 2564 2565function setDataUserAgent() { 2566 var b = document.documentElement; 2567 b.className = b.className.replace('no-js', 'js'); 2568 b.setAttribute("data-useragent", navigator.userAgent); 2569 b.setAttribute("data-platform", navigator.platform); 2570} 2571 2572$.fn.isInViewport = function () { 2573 var elementTop = $(this).offset().top; 2574 var elementBottom = elementTop + $(this).outerHeight(); 2575 var viewportTop = $(window).scrollTop(); 2576 var viewportBottom = viewportTop + $(window).height(); 2577 return elementBottom > viewportTop && elementTop < viewportBottom; 2578}; 2579 2580//-- Verwijder alle klasses met bepaald voorvoegsel 2581$.fn.removeClassLike = function (name) { 2582 return this.removeClass(function (index, css) { 2583 return (css.match(new RegExp('\\b(' + name + '\\S*)\\b', 'g')) || []).join(' '); 2584 }); 2585}; 2586 2587var IcordisFrontent = { 2588 //--check hasScrollHorizontal 2589 hasScrollHorizontal: function (elm) { 2590 return Math.round(elm[0].scrollWidth) > Math.round(elm.outerWidth()); 2591 }, 2592 //--check hasScrollVertical 2593 hasScrollVertical: function (elm) { 2594 return elm[0].scrollHeight > Math.round(elm.outerHeight()); 2595 }, 2596 //Check overflow horizontal en vertical 2597 hasOverflow: function (elm) { 2598 return elm[0].scrollHeight > Math.round(elm.outerHeight()) || 2599 elm[0].scrollWidth > Math.round(elm.outerWidth()); 2600 } 2601} 2602//-- check items op verschillende rijen op basis van matchHeight plugin js/jquery-match-height-master/jquery.matchHeight.js 2603function checkRow(container, items) { 2604 var el = $(container), 2605 rowCount = 0, 2606 classPrefix = 'row-'; 2607 2608 $(window).on('load resize', function (e) { 2609 var elItems = el.find(items); 2610 //clear 2611 el.removeClass('has-rows'); 2612 elItems.removeClass('new-row end-row even odd').removeClassLike(classPrefix); 2613 2614 var rows = $.fn.matchHeight._rows(elItems); 2615 // console.log(rows); 2616 2617 //clear 2618 rowCount = 0; 2619 2620 if (rows.length > 1) { 2621 el.addClass('has-rows'); 2622 rows = $.fn.matchHeight._rows(elItems); 2623 } else { 2624 el.removeClass('has-rows'); 2625 elItems.removeClassLike(classPrefix); 2626 } 2627 2628 $.each(rows, function (i, row) { 2629 rowCount++; 2630 if (i % 2 === 0) { 2631 /* we are even */ 2632 row.addClass('odd'); 2633 2634 } else { 2635 /* we are odd */ 2636 row.addClass('even'); 2637 } 2638 row.addClass(classPrefix + rowCount); 2639 row.first().addClass('new-row'); 2640 row.last().addClass('end-row'); 2641 }); 2642 }); 2643} 2644 2645//--Check floatcollapse 2646function checkFloats(container, items, screenWidth) { 2647 var $this = $(container), 2648 currentRowStart = 0, 2649 topPosition = 0, 2650 currentItems = $this.find(items); 2651 // console.log(currentItems.length); 2652 2653 if (screenWidth === undefined || screenWidth === null) { 2654 screenWidth = gridFloatBreakpoint; //grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px 2655 } 2656 if (currentItems.length >= 1) { 2657 $('#inner-wrap, .navbar-default').removeClass('has-hamburger'); 2658 2659 currentItems.each(function (teller) { 2660 currentElement = $(this); 2661 topPostion = Math.ceil(currentElement.position().top); 2662 // if ($(document).width() >= screenWidth) { 2663 if (currentRowStart !== topPostion) { 2664 $('#inner-wrap, .navbar-default').addClass('has-hamburger'); 2665 } 2666 // } 2667 }); 2668 } 2669} 2670 2671//-- accessibility tabben enkel in modal open 2672disableTabModalShown = function (el) { 2673 var modal = el, 2674 focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]').not(':hidden'),
2675 numElements = focusableChildren.length, 2676 currentIndex; 2677 2678 currentIndex = -1; 2679 // $(document.activeElement).blur(); 2680 // if (modal.hasClass('header-search')) { 2681 // currentIndex = 1; 2682 // } 2683 // } else { 2684 // $(document.activeElement).blur(); 2685 // } 2686 // if ( $('#search').hasClass('selected')) { 2687 // currentIndex = focusableChildren[currentIndex]; 2688 // } else { 2689 // currentIndex = -1; 2690 // } 2691 // console.log(modal); 2692 // console.log(focusableChildren,numElements); 2693 2694 var focus = function () { 2695 var focusableElement = focusableChildren[currentIndex]; 2696 if (focusableElement) 2697 focusableElement.focus(); 2698 }; 2699 2700 var focusPrevious = function () { 2701 currentIndex--; 2702 if (currentIndex < 0) 2703 currentIndex = numElements - 1; 2704 2705 focus(); 2706 return false; 2707 }; 2708 2709 var focusNext = function () { 2710 currentIndex++; 2711 if (currentIndex >= numElements) 2712 currentIndex = 0; 2713 2714 focus(); 2715 return false; 2716 }; 2717 2718 $(document).on('keydown', function (e) { 2719 if (e.keyCode === 9 && e.shiftKey) { 2720 e.preventDefault(); 2721 focusPrevious(); 2722 } 2723 else if (e.keyCode === 9) { 2724 e.preventDefault(); 2725 focusNext(); 2726 } 2727 }); 2728} 2729 2730//easing geplukt van jquery easing gebruikt voor de scrollto functie 2731$.easing.elasout = function (x, t, b, c, d) { 2732 var s = 1.70158; var p = 0; var a = c; 2733 if (t === 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; 2734 if (a < Math.abs(c)) { a = c; var s = p / 4; } 2735 else var s = p / (2 * Math.PI) * Math.asin(c / a); 2736 return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; 2737}; 2738 2739//-- Functions 2740//-- Check als het een nummer is 2741function isNumeric(n) { 2742 return !isNaN(parseFloat(n)) && isFinite(n); 2743} 2744 2745 2746//probeersel focus-within 2747// function checkFocuswithin() { 2748// var $focus = $('.check-focus-within'); 2749// if ($focus.length > 0) { 2750// $focus.find('a, button').focus(function() { 2751// $(this).parents('.check-focus-within').removeClass('focus-within') 2752// var className = $(this).attr('class').match(/\S*__link\b/i); 2753// console.log(className); 2754// if (!className) { 2755// $(this).parents('.check-focus-within').addClass('focus-within'); 2756// } else { 2757// $(this).parents('.check-focus-within').removeClass('focus-within') 2758// } 2759// }); 2760// } 2761// } 2762 2763 2764 2765var Scroller = { 2766 scrollers: null, 2767 timer: null, 2768 init: function () { 2769 var that = this; 2770 that.scrollers = $("[data-scroller]"); 2771 if (that.scrollers.length > 0 && that.scrollers.children().length > 2) { 2772 that.checkHorizontalScroll(); 2773 $(window).on('resize', function (e) { 2774 if (that.timer != null) { 2775 clearTimeout(that.timer); 2776 } 2777 that.timer = setTimeout(function () { that.checkHorizontalScroll(); }, 300); 2778 }); 2779 $(document).on('click', 'button[data-scroll]', function (e) { 2780 e.preventDefault(); 2781 var btn = $(this); 2782 that.goTo(btn); 2783 }); 2784 } 2785 }, 2786 checkHorizontalScroll: function () { 2787 var that = this; 2788 that.scrollers.each(function (i) { 2789 var scrollZone = $(this), 2790 elFade = scrollZone.parents('.' + that.scrollers.attr('data-scroller')); 2791 2792 // console.log(scrollZone, scrollZone.hasScrollHorizontal()); 2793 2794 if (IcordisFrontent.hasScrollHorizontal(scrollZone)) { 2795 // console.log("hasscrollbar overflow"); 2796 var scrollLeftPos = scrollZone.scrollLeft(); 2797 2798 if (scrollLeftPos > 0) { 2799 elFade 2800 .addClass('fade-left') 2801 .find('.btn-scroll.prev') 2802 .removeClass('hidden'); 2803 } else { 2804 elFade 2805 .removeClass('fade-left') 2806 .find('.btn-scroll.prev') 2807 .addClass('hidden'); 2808 } 2809 2810 if ( 2811 scrollLeftPos + scrollZone.innerWidth() === 2812 scrollZone[0].scrollWidth 2813 ) { 2814 elFade 2815 .removeClass('fade-right') 2816 .find('.btn-scroll.next') 2817 .addClass('hidden'); 2818 } else { 2819 elFade 2820 .addClass(' fade-right') 2821 .find('.btn-scroll.next') 2822 .removeClass('hidden'); 2823 } 2824 } else { 2825 // console.log("NO scrollbar overflow"); 2826 elFade.removeClass('fade-left fade-right').find('.btn-scroll').addClass('hidden'); 2827 } 2828 }); 2829 }, 2830 goTo: function (btn) { 2831 var that = this; 2832 var scrollzone = btn.parent().find('[data-scroller]'); 2833 var currentScrollPos = scrollzone.scrollLeft(); 2834 var width = scrollzone.innerWidth() / 2 ; 2835 var scroll = btn.hasClass('prev') ? width : - width; 2836 2837 scrollzone.stop().animate({ 2838 scrollLeft: currentScrollPos - scroll 2839 }, { 2840 duration: 250, 2841 complete: function () { Scroller.checkHorizontalScroll(); } 2842 }); 2843 } 2844} 2845 2846var Breadcrumb = { 2847 breadcrumbs: null, 2848 timer: null, 2849 breadcrumbNavWith: 0, 2850 breadcrumbLast: 0, 2851 btnMore: null, 2852 currentWidth: window.innerWidth, 2853 eclipseOverflowWidth: 18, 2854 lastItemText: null, 2855 lastItemTextTrim: null, 2856 2857 init: function () { 2858 var that = this; 2859 that.breadcrumbs = $("[data-breadcrumb]"); 2860 that.breadcrumbLast = Math.round(that.breadcrumbs.children().last(
2860).width()) - Math.round(that.breadcrumbs.children().last().width() * .80); 2861 // that.breadcrumbLast = Math.round(that.breadcrumbs.children().last().width()) - Math.round(that.breadcrumbs.children().last().width() * .75); 2862 that.btnMore = $('.btn-showall'); 2863 2864 if (that.breadcrumbs.length > 0 && that.breadcrumbs.children().length > 2) { 2865 if (that.timer != null) { 2866 clearTimeout(that.timer); 2867 } 2868 that.initBreadcrumb(that.breadcrumbs); 2869 that.checkBreadcrumbOverflow(); 2870 that.timer = setTimeout(function () { 2871 that.checkBreadcrumbOverflow(); 2872 }, 500); 2873 2874 window.addEventListener('resize', () => { 2875 if (window.innerWidth !== that.currentWidth) { 2876 that.currentWidth = window.innerWidth; 2877 if (that.timer != null) { 2878 clearTimeout(that.timer); 2879 } 2880 that.timer = setTimeout(function () { that.checkBreadcrumbOverflow(); }, 500); 2881 } 2882 }); 2883 2884 that.btnMore.on('click',function(e){ 2885 e.preventDefault(); 2886 var btn = $(this); 2887 btn.addClass('active hidden toggled').next().children().removeClass('hidden'); 2888 that.breadcrumbs.removeAttr('style'); 2889 that.breadcrumbs.children().removeClass('invisible'); 2890 }); 2891 } 2892 }, 2893 initBreadcrumb: function (el) { 2894 var that = this; 2895 var items = el.children('li'); 2896 // calcBreadcrumbNavWidth 2897 items.each(function () { 2898 var breadcrumbNav = $(this); 2899 breadcrumbNav.attr( 2900 'data-width', 2901 Math.ceil(breadcrumbNav.width()) 2902 ); 2903 2904 that.breadcrumbNavWith += breadcrumbNav.data('width'); 2905 }); 2906 2907 // var clone = el.parents('.breadcrumb__wrapper').clone().addClass('hide-breadcrumb'); 2908 // el.parents('.breadcrumb').prepend(clone); 2909 }, 2910 2911 checkBreadcrumbOverflow: function () { 2912 var that = this; 2913 if(!that.btnMore.hasClass('toggled')) { 2914 that.breadcrumbs.each(function (i) { 2915 // console.log(that.breadcrumbNavWith); 2916 var breadcrumbWrapper = $(this), 2917 overflowWidth = (Math.round(breadcrumbWrapper[0].scrollWidth) - Math.round(breadcrumbWrapper.outerWidth())), 2918 move = 0, 2919 t = 0, 2920 tLast = breadcrumbWrapper.children().length - 1; 2921 //clear 2922 breadcrumbWrapper.removeAttr('style'); 2923 breadcrumbWrapper.children().removeClass('invisible'); 2924 // recalc 2925 overflowWidth = (Math.round(breadcrumbWrapper[0].scrollWidth) - Math.round(breadcrumbWrapper.outerWidth())); 2926 2927 if ( overflowWidth > that.breadcrumbLast) { 2928 $('.btn-showall').removeClass('hidden'); 2929 breadcrumbWrapper.parents('.breadcrumb').addClass('has-more'); 2930 2931 breadcrumbWrapper.children().each(function () { 2932 overflowWidth = (Math.round(breadcrumbWrapper[0].scrollWidth) - Math.round(breadcrumbWrapper.outerWidth())); 2933 2934 var breadcrumbNav = $(this); 2935 var checkLeft = Math.round(breadcrumbNav.offset().left); 2936 2937 // console.log('leftpos: ' + checkLeft, 'overflow: ' + overflowWidth); 2938 2939 if (checkLeft < overflowWidth) { 2940 // console.log(t, tLast); 2941 if (t < tLast) { 2942 breadcrumbNav.addClass('invisible'); 2943 move += Math.round($(this).width()); 2944 } 2945 } else { 2946 breadcrumbNav.removeClass('invisible'); 2947 } 2948 t ++; 2949 }); 2950 } 2951 else { 2952 breadcrumbWrapper.removeAttr('style'); 2953 $('.btn-showall').addClass('hidden').removeClass('active'); 2954 breadcrumbWrapper.parents('.breadcrumb').removeClass('has-more'); 2955 } 2956 2957 // console.log('move: ' + move); 2958 if (move == 0) { 2959 breadcrumbWrapper.removeAttr('style'); 2960 $('.btn-showall').addClass('hidden').removeClass('active'); 2961 breadcrumbWrapper.parents('.breadcrumb').removeClass('has-more'); 2962 } else { 2963 breadcrumbWrapper.css({ 2964 marginLeft: -(move) 2965 }); 2966 } 2967 }); 2968 } 2969 }, 2970 2971 checkBreadcrumbInvisible: function () { }, 2972 2973 showAllBreadcrumbItems: function (btn) { 2974 var btn = this; 2975 }, 2976 add3Dots(string, limit) 2977 { 2978 var dots = "..."; 2979 if(string.length > limit) 2980 { 2981 // you can also use substr instead of substring 2982 string = string.substring(0,limit) + dots; 2983 } 2984 return string; 2985 }, 2986} 2987 2988// Scroller.init(); 2989$(function () { 2990 Breadcrumb.init(); 2991}); 2992 2993 2994var Cookie = { 2995 set: function (cookiename, noOfDays, value) { 2996 2997 var c_value = escape(value) + ";Path=/;samesite=lax;"; 2998 2999 if (noOfDays !== null) { 3000 3001 var exdate = new Date(); 3002 exdate.setDate(exdate.getDate() + parseInt(noOfDays)); 3003 c_value += " expires=" + exdate.toUTCString(); 3004 } 3005 if (window.location.protocol.indexOf('https') > -1) { 3006 c_value += ";secure" 3007 } 3008 3009 document.cookie = cookiename + "=" + c_value; 3010 }, 3011 get: function (cookiename) { 3012 var name = cookiename + "="; 3013 var decodedCookie = decodeURIComponent(document.cookie); 3014 var ca = decodedCookie.split(';'); 3015 for (var i = 0; i < ca.length; i++) { 3016 var c = ca[i]; 3017 while (c.charAt(0) === ' ') { 3018 c = c.substring(1); 3019 } 3020 if (c.indexOf(name) === 0) { 3021 return c.substring(name.length, c.length); 3022 } 3023 } 3024 return ""; 3025 }, 3026 remove: function (cookiename) { 3027 document.cookie = cookiename + "=;Path=/;SameSite=Lax;expires=Thu, 01 Jan 1970 00:00:01 GMT;"; 3028 } 3029}; 3030var listAnchorsItems = null; 3031var isScrolling = false;
3032var scrollTimer = null; 3033var scrollTimerClick = null; 3034 3035function scrollto() { 3036 /* 3037 //:: oldskool deprecated: niet werken op ie, edge :: animate scrolltop geeft een jump met offset 3038 $(document).on('click', '[data-scrollto]', function (e) { 3039 e.preventDefault(); 3040 var el = $(this), 3041 elGoto = $(el.attr('href')), 3042 top = elGoto.offset().top; //-- base not sticky header 3043 3044 // if (el.data('scrollto') === "totop") { } 3045 if (el.data('scrollto') === "az") { 3046 top = elGoto.offset().top - stickySpacing; 3047 } 3048 3049 $("body, html").scrollTop(top); 3050 }); 3051 */ 3052 3053 //check totop bij het laden 3054 checkTopposition(); 3055 3056 // Show or hide the sticky footer button 3057 $window.on('scroll', checkTopposition); 3058 3059 $(document).on("scroll", onScroll).on('click', 'a[data-scrollto]', function () { 3060 isScrolling = true; 3061 // console.log('click', isScrolling); 3062 var li = $(this).parent(); 3063 $('.side-bar .box__block .list li, .list-anchors li, .side-bar .box__block .nav-az li').not(li).removeClass('active'); 3064 3065 li.addClass('active'); 3066 3067 if (scrollTimerClick !== null) 3068 clearInterval(scrollTimerClick); 3069 3070 scrollTimerClick = setTimeout(function () { isScrolling = false; }, 500); 3071 }); 3072 3073 listAnchorsItems = $('.page-content h2[id]'); 3074 CheckActiveAnchors(); 3075 3076 //documentation zie: https://github.com/cferdinandi/smooth-scroll 3077 var scroll = new SmoothScroll('[data-scrollto], a[href*="#"]', { 3078 emitEvents: true, 3079 speed: 500, 3080 speedAsDuration: true, 3081 updateURL: false, // Update the URL on scroll = e.preventdefault 3082 // Easing 3083 easing: 'EaseIn', // Easing pattern to use 3084 // header: '[data-scroll-header]', 3085 offset: function (anchor, toggle) { 3086 // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels 3087 // This example is a function, but you could do something as simple as `offset: 25` 3088 // console.log(anchor, toggle); 3089 // console.log(toggle.getAttribute('data-scrollto')); 3090 3091 if ( toggle.getAttribute('data-scrollto') === 'az' || toggle.getAttribute('data-scrollto') === 'filter' || toggle.getAttribute('href').startsWith('#') ) { 3092 return stickySpacing; 3093 } else { 3094 return 0; 3095 } 3096 }, 3097 }); 3098 3099 // Listen for scroll events 3100 document.addEventListener('scrollStop', logScrollEvent, false); 3101 document.addEventListener('scrollStart', logScrollEvent, false); 3102 // document.addEventListener('scrollCancel', logScrollEvent, false); 3103} 3104 3105function onScroll(event) { 3106 checkTopposition(); 3107 // console.log(isScrolling); 3108 //-- scrollspy check 3109 if (isScrolling === false) { 3110 if (scrollTimer !== null) 3111 clearTimeout(scrollTimer); 3112 scrollTimer = setTimeout(function () { CheckActiveAnchors(); }, 100); 3113 } 3114} 3115 3116// Log scroll events 3117var logScrollEvent = function (event) { 3118 // console.log(event.detail.anchor.classList); 3119 3120 if (event.type === 'scrollStop') { 3121 event.detail.anchor.removeAttribute('style'); 3122 event.detail.anchor.removeAttribute('tabindex'); 3123 // console.log(event.detail.anchor.classList); 3124 // console.log('toggle:', event.detail.toggle); 3125 // console.log('anchor:', event.detail.anchor); 3126 if (event.detail.anchor.getAttribute('ID') === 'content-main' && $('section.atoz').length > 0) { 3127 $(event.detail.anchor) 3128 .find('.page-content') 3129 .attr('tabindex', -1) 3130 .trigger('focus') 3131 .removeAttr('tabindex'); 3132 } 3133 } else if (event.type === 'scrollStart') { 3134 isScrolling = true; 3135 if (scrollTimerClick !== null) 3136 clearInterval(scrollTimerClick); 3137 3138 scrollTimerClick = setTimeout(function () { isScrolling = false; }, 600); 3139 } 3140}; 3141 3142function CheckActiveAnchors() { 3143 if (listAnchorsItems.length > 0) { 3144 var fromTop = $(window).scrollTop(); 3145 3146 listAnchorsItems.each(function () { 3147 var top = $(this).offset().top - 10; 3148 var li = $('.side-bar .box__block .list li a[href="#' + $(this).attr('id') + '"]').parent(); 3149 if (fromTop >= top) { 3150 3151 $('.side-bar .box__block .list li').not(li).removeClass('active'); 3152 3153 li.addClass('active'); 3154 3155 } else { 3156 li.removeClass('active'); 3157 } 3158 }); 3159 } 3160} 3161//-- Check wanneer totop knop getoond mag worden 3162function checkTopposition() { 3163 var totop = $('#totop'); 3164 3165 if (!$('html.no-scroll').length > 0) { 3166 checkScrollposition(totop); 3167 } 3168} 3169 3170//-- Functionaliteit wanneer totop knop getoond is 3171function checkScrollposition(elShowhide) { 3172 var elShowcheck = $('.brand').innerHeight(), 3173 elFooter = $('#footer');
3174 footerCheck = $(document).height() - elFooter.innerHeight(), 3175 totop = $('.toppos'); 3176 3177 if ($(this).scrollTop() > elShowcheck) { 3178 elShowhide.fadeIn('fast'); 3179 $('.scroll-down').addClass('hidden').hide(); 3180 // icordisBtn.css({ 3181 // 'top': '-100%' 3182 // }); 3183 } else { 3184 elShowhide.fadeOut('fast'); 3185 //icordisBtn.removeAttr('style'); 3186 if ($('body.home').length > 0) { 3187 $('.scroll-down').removeClass('hidden').show(); 3188 } 3189 } 3190 3191 if (Math.round($(window).scrollTop()) + $(window).height() > footerCheck) { 3192 totop.addClass('animate'); 3193 totop.css({ 3194 bottom: Math.round($(window).scrollTop()) + $(window).height() - footerCheck + 15, // position boven de footer met spacing 3195 // bottom: elFooter.innerHeight() + 30 / 2, // position boven de footer met spacing 3196 }); 3197 } else { 3198 totop.removeAttr('style').removeClass('animate'); 3199 } 3200 3201 // else { 3202 // if ($(document).width() >= gridFloatBreakpoint) { 3203 // totop.addClass('animate'); 3204 3205 // totop.removeAttr('style'); 3206 // } 3207 // } else { 3208 // totop.removeAttr('style').removeClass('animate');; 3209 // } 3210}; 3211 3212 3213 3214//Hoogte van de banner berekenen 3215function checkElVh(el, screenWidth) { 3216 if (el === undefined || el === null) { 3217 el = $('.header'); 3218 } 3219 if (screenWidth === undefined || screenWidth === null) { 3220 screenWidth = gridFloatBreakpoint; //grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px 3221 } 3222 3223 if ($('body.home').length > 0) { 3224 $(window).on("load resize", checkBannerheight); 3225 } 3226 3227 function checkBannerheight() { 3228 if ($(document).width() >= screenWidth) { 3229 el.css({ 3230 'minHeight': $(window).height() 3231 }); 3232 // $('.header-right').css({ 3233 // 'top': ( $(window).height() - $('.header-right').innerHeight() ) / 2 3234 // }) 3235 3236 } else { 3237 el.removeAttr('style'); 3238 // $('.header-right').removeAttr('style'); 3239 } 3240 } 3241} 3242 3243 3244function setOffcanvasHeaderOffset() { 3245 var offcanvasHeaderOffset = 3246 $('.header-main').offset().top + 3247 $('.header-main').innerHeight() - 3248 Math.ceil($(window).scrollTop()); 3249 3250 $('.header-nav-overlay, .header-nav').css({ 3251 top: offcanvasHeaderOffset, 3252 }); 3253} 3254var isFooterParallax = false; 3255 3256//-- Bij minder content footer onderaan de pagina houden 3257// ! let op isFooterParallax true of false 3258function footerFixedBottom(el) { 3259 var elFooter = $('#footer'), 3260 footerHeight = elFooter.outerHeight(), 3261 windowHeight = $(window).height(), 3262 filterMoved = false; 3263 3264 // $('#inner-wrap').css({ 3265 3266 if (!el) { 3267 if ($('#inner-wrap').height() < windowHeight) { 3268 $('#footer').css({ 3269 'position': 'absolute', 3270 'bottom': 0, 3271 'width': '100%' 3272 }); 3273 3274 if ($('div[data-filter="fixed"]').length > 0) { 3275 var elf = $('div[data-filter="fixed"]'); 3276 3277 if (!filterMoved) { 3278 var elReadytomove = elf.detach(); 3279 $('<div/>', { 3280 class: 'container', 3281 html: elReadytomove 3282 }).prependTo(elFooter); 3283 } 3284 filterMoved = true; 3285 } 3286 3287 $('#inner-wrap').css({ 3288 'minHeight': windowHeight, 3289 'paddingBottom': footerHeight 3290 }); 3291 $('.toppos').css({ 3292 'bottom': footerHeight + 30 3293 }); 3294 } else { 3295 $('#footer, #inner-wrap').removeAttr('style'); 3296 } 3297 } else { 3298 // console.log(windowHeight + "--" + footerHeight); 3299 if (footerHeight < windowHeight) { 3300 $('#footer').css({ 3301 'position': 'fixed', 3302 'bottom': 0, 3303 'left': 0, 3304 'width': '100%' 3305 }); 3306 $('#inner-wrap').css({ 3307 'marginBottom': footerHeight 3308 }); 3309 } else { 3310 $('#footer, #inner-wrap').removeAttr('style'); 3311 } 3312 } 3313} 3314 3315var Menu = { 3316 menuType: null, 3317 metaType: null, 3318 resizeTimer: null, 3319 dropdownNavMenuWith: 0, 3320 dropdownMetaMenuWith: 0, 3321 countNavMenuWidth: 0, 3322 navMain: null, 3323 navMeta: null, 3324 overlayActive: false, 3325 hasMenuMore: false, 3326 init: function () { 3327 var that = this; 3328 that.menuType = $('body').attr('data-menu'); 3329 that.metaType = $('[data-dropdown]'); 3330 that.navMain = $('.nav-main'); 3331 if (that.menuType === 'dropdown') { 3332 if (that.hasMenuMore) { 3333 that.doMenuMore(); 3334 } 3335 that.calcMenuWidth(that.navMain); 3336 that.doDropdown(); 3337 that.checkDropDownSubMenuPosition(($('nav:not(.has-hamburger)'))); 3338 that.doCheckDropdownOrHamburger(); 3339 3340 $(window).on('resize', function (e) { 3341 Menu.dowindowResize(); 3342 }); 3343 } 3344 3345 if (that.metaType.length > 0) { 3346 that.navMeta = $('.nav-meta'); 3347 that.calcMetaWidth(that.navMeta);
3348 that.doMetaMore(); 3349 that.checkMetanav(); 3350 that.doDropdownToggle(); 3351 3352 $(window).on('resize', function (e) { 3353 if (that.timer != null) { 3354 clearTimeout(that.timer); 3355 } 3356 that.timer = setTimeout(function () { 3357 that.checkMetanav(); 3358 }, 20); 3359 }); 3360 } 3361 3362 3363 that.doHamburgerMenu(); 3364 that.checkActiveState(); 3365 }, 3366 3367 calcMenuWidth: function (el) { 3368 var that = this; 3369 var items = el.children('li'); 3370 items.each(function () { 3371 var li = $(this); 3372 li.attr( 3373 'data-width', 3374 Math.ceil( 3375 li.width() - 3376 (li.find('a').width() - li.find('span').width()) 3377 ) 3378 ); 3379 3380 that.dropdownNavMenuWith += li.data('width'); 3381 }); 3382 // console.log(that.dropdownNavMenuWith); 3383 }, 3384 3385 calcMetaWidth: function (el) { 3386 var that = this; 3387 var items = el.children('li'); 3388 // console.log(items); 3389 items.each(function () { 3390 var li = $(this); 3391 /* 3392 li.attr( 3393 'data-width', 3394 Math.ceil( 3395 li.width() - 3396 (li.find('a').width() - li.find('span').width()) 3397 ) 3398 ); 3399 */ 3400 li.attr( 3401 'data-width', 3402 Math.ceil( 3403 li.width() 3404 ) 3405 ); 3406 3407 that.dropdownMetaMenuWith += li.data('width'); 3408 }); 3409 // console.log(that.dropdownMetaMenuWith); 3410 }, 3411 3412 doMetaMore: function () { 3413 var that = this; 3414 var items = that.navMeta.children('li'); 3415 var elContainer = that.navMeta.parent(); 3416 // console.log('domenumore'); 3417 3418 var menuMetamore = $('<div/>') // creates a div element 3419 .addClass('dropdown dropdown-meta'); // add a class 3420 var menuMetamoreLink = $('<button/>', { 3421 // text: 'Meer', 3422 class: 'dropdown--toggle', 3423 }) 3424 .attr('toggle-dropdown', 'true') 3425 .html('<span>Meer</span><svg class="nav__icon more__icon" aria-hidden="true"><use href="/global/icons/global-line.svg#arrow-drop-down" style="fill:var(--icon-color-primary,var(--icon-color));transition:fill var(--transition-duration-base) var(--transition-timing-function)"></use></svg>') 3426 .appendTo(menuMetamore); 3427 3428 var menuMetamoreSub = $('<div/>').addClass('dropdown__menu'); 3429 3430 if (items.length > 0) { 3431 elContainer.prepend(menuMetamore); 3432 menuMetamoreSub.insertAfter(menuMetamoreLink); 3433 menuMetamoreSub.prepend(that.navMeta); 3434 // $('.dropdown-meta > .dropdown__menu').append(items); 3435 } 3436 }, 3437 3438 doMetaMoreReset: function () { 3439 var that = this; 3440 var elContainer = $('.meta__container-wrapper'); 3441 elContainer.prepend(that.navMeta); 3442 $('.dropdown-meta').remove(); 3443 }, 3444 3445 checkMetanav: function () { 3446 var that = this; 3447 var availablespace = $('.header__main div:first').width(); //voor fullwidth nav 3448 // availablespace = $('.header__container-wrapper').width() - $('.header__brand').outerWidth(true) - $('.header__search').width(); // nav in header-right 3449 3450 if (that.dropdownMetaMenuWith >= availablespace) { 3451 $('.header__meta').addClass('has-dropdown'); 3452 if (!$('.dropdown-meta').length > 0) { 3453 that.doMetaMore(); 3454 } 3455 } else { 3456 $('.header__meta').removeClass('has-dropdown');
3457 that.doMetaMoreReset(); 3458 } 3459 }, 3460 3461 doMenuMore: function () { 3462 var that = this; 3463 var t = 1; 3464 var count = 4; 3465 var items = that.navContainer.children('li'); 3466 // console.log('domenumore'); 3467 3468 var menuMainmore = $('<div/>') // creates a div element 3469 .addClass('nav-main nav-main--more dropdown'); // add a class 3470 var menuMainmoreLink = $('<a/>', { 3471 href: '#', 3472 class: 'nav__link btn-more', 3473 // tabindex: '-1', 3474 }).html('<span>Meer</span><svg class="nav__icon more__icon" aria-hidden="true"><use href="/global/icons/global-line.svg#arrow-drop-down" style="fill:var(--icon-color-primary,var(--icon-color));transition:fill var(--transition-duration-base) var(--transition-timing-function)"></use></svg>').appendTo(menuMainmore); 3475 3476 var menuMainmoreSub = $('<ul/>').addClass('dropdown__menu'); 3477 3478 items.each(function () { 3479 var li = $(this); 3480 if (t > 0 && t <= count) { 3481 li.attr( 3482 'data-width', 3483 Math.ceil( 3484 li.width() - 3485 (li.find('a').width() - li.find('span').width()) 3486 ) 3487 ); 3488 that.countNavMenuWidth += li.data('width'); 3489 // console.log('teller: ' + t + '= ' + that.countNavMenuWidth); 3490 } 3491 t++; 3492 }); 3493 3494 if (items.length > count) { 3495 menuMainmore.insertAfter($('.nav-main')); 3496 menuMainmoreSub.insertAfter(menuMainmoreLink); 3497 $('.nav-main--more > .dropdown__menu').append(items.slice(count)); 3498 } 3499 }, 3500 3501 doMenuMoreReset: function () { 3502 var items = $('.nav-main--more > .dropdown__menu').children('li'); 3503 $('ul.nav-main').append(items); 3504 $('.nav-main--more').remove(); 3505 }, 3506 3507 doCheckDropdownOrHamburger: function () { 3508 var that = this; 3509 var availablespace = 0; 3510 if ($('.header__compact').length == 0) { 3511 availablespace = $('.header__main div:first').width(); //voor fullwidth nav 3512 } else { 3513 availablespace = $('.header__container-wrapper').width() - $('.header__brand').outerWidth(true); 3514 } 3515 // availablespace = $('.header__container-wrapper').width() - $('.header__brand').outerWidth(true) - $('.header__search').width(); // nav in header-right 3516 // console.log('available: ' + availablespace, 'menu width: ' + that.dropdownNavMenuWith); 3517 3518 if (that.dropdownNavMenuWith >= availablespace) { 3519 $('.navigation-main, .header').addClass('has-hamburger'); 3520 $('.navigation__container-wrapper').addClass('container'); 3521 if (that.hasMenuMore) { 3522 that.doMenuMoreReset(); 3523 } 3524 } else { 3525 $('.navigation-main, .header').removeClass('has-hamburger'); 3526 $('.navigation__container-wrapper').removeClass('container'); 3527 if (that.hasMenuMore) { 3528 if (!$('.nav-main--more').length > 0) { 3529 that.doMenuMore(); 3530 } 3531 } 3532 } 3533 }, 3534 3535 doDropdown: function () { 3536 var that = this; 3537 $(document) 3538 .on('mouseenter', 'nav:not(.has-hamburger) li.dropdown', function () { 3539 var li = $(this); 3540 li.addClass('open'); 3541 3542 var a = li.find('a'); 3543 a.attr('aria-expanded', 'true'); 3544 }) 3545 .on('mouseleave', 'nav:not(.has-hamburger) li.dropdown', function () { 3546 var li = $(this); 3547 li.removeClass('open'); 3548 3549 var a = li.find('a'); 3550 a.attr('aria-expanded', 'false'); 3551 }); 3552 }, 3553 3554 doDropdownToggle: function () { 3555 var that = this; 3556 $(document) 3557 .on('click', '[toggle-dropdown]', function () { 3558 var btn = $(this); 3559 btn.toggleClass('active').parent().toggleClass('open toggle--open'); 3560 var open = btn.hasClass('active'); 3561 btn.attr('aria-expanded', open ? 'true' : 'false'); 3562 Menu.checkDropDownSubMenuPosition($('.dropdown-meta')); 3563 }); 3564 var btn = $('[toggle-dropdown]'); 3565 if (btn.length > 0) { 3566 $(document).on('click', function (e) { 3567 3568 if (btn.hasClass('active')) { 3569 3570 if (btn.has(e.target).length === 0) { 3571 3572 btn.attr('aria-expanded', 'false'); 3573 btn.removeClass('active'); 3574 btn.parent().removeClass('open toggle--open'); 3575 } 3576 } 3577 }); 3578 } 3579 }, 3580 3581 checkDropDownSubMenuPosition: function (dropdownEl) { 3582 var windowWidth = $(window).width(); 3583 var dropdownItems = dropdownEl.find('.dropdown__menu'); 3584 dropdownItems 3585 .removeClass('dropdown__menu--left') 3586 .removeClass('dropdown__menu--right') 3587 .removeClass('dropdown__menu--center'); 3588 dropdownItems.each(function (e) { 3589 var dropdownMenu = $(this); 3590 var parentPosition = dropdownMenu.parent().offset().left; 3591 var dropDownMenuWidth = parentPosition + dropdownMenu.outerWidth(); 3592 if (dropDownMenuWidth > windowWidth) { 3593 dropdownMenu.addClass( 3594 dropDownMenuWidth - dropdownMenu.outerWidth() < 0 3595 ? 'dropdown__menu--center' 3596 : 'dropdown__menu--right' 3597 ); 3598 } else { 3599 dropdownMenu.addClass('dropdown__menu--left'); 3600 } 3601 }); 3602 }, 3603 3604 doHamburgerMenu: function () { 3605 var that = this; 3606 3607 var positionElement = $('[data-menu-position]'); 3608 3609 $(window).on('resize', function (e) { 3610 Menu.setHamburgerMenuPosition(positionElement); 3611 Menu.setOffcanvasMaxHeight(positionElement); 3612 3613 }); 3614 3615 $(document).on('click', '[data-toggle="offcanvas"]', function () { 3616 that.setHamburgerMenuPosition(positionElement); 3617 var HamburgerTriggers = $('[data-toggle="offcanvas"]'); 3618 3619 //active class op body wanneer menu openstaat. 3620 //$('body').toggleClass('active'); 3621 3622 if (that.overlayActive === false) { 3623 that.overlayActive = true; 3624 HamburgerTriggers.not('[class*="-overlay"]') 3625 .attr('aria-expanded', 'true') 3626 .addClass('is-active'); 3627 3628 $('.header__nav') 3629 .addClass('is-active') 3630 .attr('tabindex', -1) 3631 .trigger('focus'); 3632 3633 $('html').addClass('no-scroll'); 3634 3635 if ($('[data-readspeaker]') && that.navMain != null) { 3636 $('[data-readspeaker]').find($('.header-readspeaker').insertAfter(that.navMain)); 3637 } 3638 that.setOffcanvasMaxHeight(positionElement); 3639 disableTabModalShown($('.header__nav')); 3640 } else { 3641 that.overlayActive = false;
3642 HamburgerTriggers.not('[class*="-overlay"]') 3643 .attr('aria-expanded', 'false') 3644 .removeClass('is-active'); 3645 3646 $('.header__nav') 3647 .removeClass('is-active') 3648 .delay(100) 3649 .queue(function () { 3650 $(this).removeAttr('tabindex').dequeue(); 3651 HamburgerTriggers.css('pointer-events', ''); 3652 $('.nav__container-wrapper').removeAttr('style'); 3653 }); 3654 3655 if ($('[data-readspeaker]')) { 3656 if ($('body.home').length > 0) { 3657 $('[data-readspeaker]').find($('.header-readspeaker').insertAfter($('.header-main'))); 3658 } else { 3659 $('[data-readspeaker]').find($('.header-readspeaker').insertAfter($('.page-heading'))); 3660 } 3661 } 3662 3663 $('html').removeClass('no-scroll'); 3664 $(document).off('keydown'); 3665 } 3666 }); 3667 }, 3668 3669 setHamburgerMenuPosition: function (positionElement) { 3670 if (positionElement.length > 0) { 3671 var pos = positionElement.attr('data-menu-position'); 3672 if (pos === 'under') { 3673 var root = document.documentElement; 3674 if (!$('.is_stuck').length > 0) { 3675 var positionTop = 3676 positionElement.offset().top - 3677 window.scrollY + 3678 positionElement.outerHeight(true); 3679 } else { 3680 var positionTop = $('.is_stuck').height(); 3681 } 3682 document 3683 // .getElementsByTagName('header')[0] 3684 .querySelectorAll('header.header')[0] 3685 .style.setProperty( 3686 '--overlay-top-position', 3687 positionTop + 'px' 3688 ); 3689 } 3690 } 3691 }, 3692 3693 dowindowResize: function () { 3694 var that = this; 3695 if (that.currentWidth !== $(window).width()) { 3696 that.currentWidth = $(window).width(); 3697 if (that.resizeTimer != null) { 3698 clearTimeout(that.resizeTimer); 3699 } 3700 that.resizeTimer = setTimeout(function () { 3701 Menu.doCheckDropdownOrHamburger(); 3702 Menu.checkDropDownSubMenuPosition(($('nav:not(.has-hamburger)'))); 3703 // Menu.setMenuPosition(); 3704 }, 20); 3705 } 3706 }, 3707 3708 checkActiveState: function () { 3709 var that = this; 3710 if ($('.navigation-main li.active').length == 0) { 3711 var nav = $('.navigation-main'); 3712 $( 3713 '.breadcrumb__container-wrapper.main > ol.nav-breadcrumb > li > a' 3714 ).each(function () { 3715 var el = $(this); 3716 var url = el 3717 .attr('href') 3718 .replace( 3719 window.location.protocol + 3720 '//' + 3721 window.location.hostname, 3722 '' 3723 ) 3724 .toLowerCase(); 3725 3726 var m = nav.find('a[href="' + url + '"]'); 3727 // console.log(url,m); 3728 if (m.length > 0) { 3729 m.parent().addClass('active'); 3730 } 3731 }); 3732 if (that.navMain != null) { 3733 var m = that.navMain.find( 3734 'a[href="' + window.location.pathname.toLowerCase() + '"]' 3735 ); 3736 if (m.length > 0) { 3737 m.parent().addClass('active'); 3738 m.attr('aria-current', 'page'); 3739 } 3740 } 3741 } 3742 }, 3743 3744 setOffcanvasMaxHeight: function (positionElement) { 3745 var that = this; 3746 var menu = that.navMain; 3747 if (menu != null && positionElement.length > 0) { 3748 var pos = positionElement.attr('data-menu-position'); 3749 if (pos === 'under') { 3750 var ncw = $('.nav__container-wrapper'); 3751 if (ncw.length > 0) { 3752 var navWrapperTop = 3753 $(window).height() - 3754 Math.round(ncw.offset().top) + 3755 window.scrollY; 3756 $('.nav__container-wrapper').css({ 3757 maxHeight: navWrapperTop, 3758 }); 3759 3760 if (IcordisFrontent.hasScrollVertical(ncw)) { 3761 // console.log('has-scroll') 3762 // console.log(menu); 3763 menu.parents('.container').addClass('has-overflow-vertical'); 3764 } else { 3765 menu.parents('.container').removeClass('has-overflow-vertical'); 3766 // console.log('no-scroll') 3767 } 3768 } 3769 } 3770 } 3771 } 3772}; 3773 3774$(function () { 3775 Menu.init(); 3776}); 3777 3778//-- needed html for suggestionsearch ==> <ul id="suggestionsearch" class="list" style="display:none"></ul> 3779var searchCounter = 0; 3780var searchKeyPressTimer = null; 3781function suggestionsearch(c) { 3782 var keyword = $('#lcp-searchbox-keyword').val(); 3783 var searchtype = ''; 3784 var allwords = keyword.split(' '); 3785 var lastsearchterm = allwords[allwords.length - 1]; 3786 if (keyword.length > 2 && lastsearchterm.length > 2) { 3787 var lang = $('html').attr('lang').split('-')[0]; 3788 if (lang === 'nl') { lang = ''; } else { 3789 lang = '/' + lang; 3790 } 3791 $("#lcp-searchbox-keyword").addClass("is-loading"); 3792 $('#lcp-suggestion-search').hide().addClass('invisibility'); 3793 $('#search').removeClass('selected').parents('.header__search').removeClass('focus-within'); 3794 keyword = encodeURI(keyword); 3795 var dataPost = { q: keyword }; 3796 $.ajax({ 3797 async: true, 3798 data: dataPost, 3799 url: lang + '/zoeken/suggestie' 3800 }).done(function (partialView) { 3801 var scrollSearchselected = $('[data-scrolltop-suggestionsearch="True"]').length > 0; 3802 if (scrollSearchselected) { 3803 var searchTopPosition = $('[data-scrolltop-suggestionsearch="True"]').offset().top - 30; 3804 } 3805 if (c === searchCounter) { 3806 $("#lcp-suggestion-search").html(partialView); 3807 // if (isOverlay) { 3808 if (partialView !== '') { 3809 if ($("#lcp-searchbox-keyword").is(":focus")) { 3810 $("#lcp-suggestion-search").show().removeClass('hide').removeClass('invisibility'); 3811 } 3812 $('#search') 3813 .addClass('selected') 3814 .parents('.header__search') 3815 .addClass('focus-within'); 3816 if (scrollSearchselected) { 3817 // console.log('toppos: ' + searchTopPosition); 3818 $('html,body').scrollTop(searchTopPosition); 3819 } 3820 } else { 3821 $("#lcp-suggestion-search").hide().addClass('hide').addClass('invisibility'); 3822 $('#search') 3823 .removeClass('selected') 3824 .parents('.header__search') 3825 .removeClass('focus-within'); 3826 } 3827 // disableTabModalShown($('.header-search')); 3828 // } 3829 3830 $("#lcp-searchbox-keyword").removeClass("is-loading"); 3831 } 3832 }); 3833 } else { 3834 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3835 $('#search') 3836 .removeClass('selected') 3837 .parents('.header__search') 3838 .removeClass('focus-within'); 3839 $("#lcp-searchbox-keyword").removeClass("is-loading"); 3840 } 3841}; 3842function HideSearchSuggestions(e) { 3843 if ($(e.target).closest("#search").length == 0 && !$('#lcp-suggestion-search').hasClass('hide')) { 3844 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3845 $('#search') 3846 .removeClass('selected') 3847 .parents('.header__search') 3848 .removeClass('focus-within'); 3849 } 3850} 3851//-- Bindings voor suggestionsearch 3852function BindSearch() { 3853 $(document).on('click', function (e) { 3854 HideSearchSuggestions(e); 3855 }).on('keyup', function (e) { 3856 if (e.which == 9) { 3857 HideSearchSuggestions(e); 3858 } 3859 }); 3860 3861 $('#lcp-searchbox-keyword').on('keypress', function (e) { 3862 if (e.which === 13) { e.preventDefault(); $('#lcp-searchbox-btn').trigger('click'); } 3863 }) 3864 .on('keyup',function (e) { 3865 if (e.which !== 38 && e.which !== 40 && e.which !== 13 && e.which !== 32) { 3866 3867 3868 searchCounter++; 3869 if (searchKeyPressTimer !== null) { 3870 clearTimeout(searchKeyPressTimer); 3871 } 3872 3873 searchKeyPressTimer = setTimeout(function () { suggestionsearch(searchCounter); }, 210); 3874 3875 3876 } else if (e.which == 40) { 3877 $('.search-suggestion__list .search-suggestion__item:first a').trigger('focus'); 3878 } 3879 }); 3880 //} 3881 $('#lcp-searchbox-keyword').on('focus', function () { 3882 $('.search__group').addClass('focus'); 3883 if ($('.header__nav').hasClass('is-active')) { 3884 offcanvasClose($('[data-toggle="offcanvas"]')); 3885 } 3886 }).on('blur',function () { 3887 $('.search__group') 3888 .removeClass('focus') 3889 }); 3890 3891} 3892 3893$("#lcp-searchbox-keyword").on('keydown', function (e) { 3894 var keyCode = e.keyCode || e.which; 3895 if (keyCode === 9) { 3896 if (e.shiftKey) { 3897 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3898 } 3899 } 3900}); 3901 3902$(document).on('keydown', '#lcp-suggestion-search .search__suggestion-btn', function (e) { 3903 var keyCode = e.keyCode || e.which; 3904 if (keyCode === 9) { 3905 if (!e.shiftKey) { 3906 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3907 setTimeout(function () { $('#lcp-searchbox-btn').trigger('focus'); }, 1); 3908 } 3909 } 3910}); 3911 3912//-- Unbindings voor suggestionsearch 3913function UnBindSearch() { 3914 $("#search").off(); 3915 $('#lcp-searchbox-keyword').off(); 3916 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3917} 3918 3919BindSearch(); 3920 3921//-- Classes toevoegen bij headersearch 3922function initSearchOverlay(el) { 3923 var headerSearch = $(el), 3924 elSearchfield = $(el).find('input.txt'); 3925 3926 elSearchfield.on('keyup', function () { 3927 if ($(this).val().length > 1) { 3928 if (!headerSearch.hasClass('is-active')) { 3929 $('[data-toggle="searchbtn"]').addClass('is-active') 3930 .attr('aria-expanded', 'true').show(); 3931 3932 headerSearch.addClass('is-active'); 3933 disableTabModalShown(headerSearch); 3934 3935 $('html').addClass('no-scroll'); 3936 $('.scroll-down').hide(); 3937 isOverlay = true; 3938 } 3939 } 3940 }); 3941} 3942 3943$('[data-toggle="searchbtn"]').on('click', function () { 3944 var elSearchbtn = $('[data-toggle="searchbtn"]'), 3945 headerSearch = $('.header-search'); 3946 elSearchbtn.toggleClass('is-active'); 3947 headerSearch.toggleClass('is-active'); 3948 if (elSearchbtn.hasClass('is-active')) { 3949 elSearchbtn.attr('aria-expanded', 'true').show(); 3950 disableTabModalShown(headerSearch); 3951 $('html').addClass('no-scroll'); 3952 $('.scroll-down').hide(); 3953 isOverlay = true; 3954 } else { 3955 $('#lcp-suggestion-search').hide().addClass('hide').addClass('invisibility'); 3956 elSearchbtn.attr('aria-expanded', 'false').blur().hide(); 3957 $('html').removeClass('no-scroll'); 3958 $(document).off('keydown'); 3959 $('.scroll-down').removeAttr('style'); 3960 $("#lcp-searchbox-keyword").val('').removeClass("is-loading"); 3961 isOverlay = false;
3962 } 3963}); 3964 3965//-- Set Placeholder text on input field / text area field 3966function initPlaceholder() { 3967 setSearchPlaceholder(); 3968 // $('input[data-toggle-placeholder="1"],textarea[data-toggle-placeholder="1"]').focus(function () { 3969 // $(this).attr('placeholder', ''); 3970 // }).blur(function () { 3971 // $(this).attr('placeholder', $(this).attr('title')); 3972 // }); 3973} 3974 3975//-- Placeholder tekst veranderen naar andere tekst bij kleinere schermen 3976function setSearchPlaceholder(screenWidthMax) { 3977 if (screenWidthMax === undefined || screenWidthMax === null) { 3978 screenWidthMax = gridFloatBreakpointMax; //grid float breakpoints: 480px, 768px, 992px, 1200px 3979 } 3980 var txt = $('#lcp-searchbox-keyword'); 3981 if ($('#lcp-search-form').length > 0) { 3982 if ($(document).width() <= screenWidthMax) { 3983 txt.attr('placeholder', txt.attr('data-placeholder-mobile')); 3984 } else { 3985 txt.attr('placeholder', txt.attr('title')); 3986 } 3987 } 3988} 3989 3990$(document).ready(function () { 3991 // Search.init(); 3992 initPlaceholder(); 3993}).on( 3994 'keydown', 3995 '#lcp-suggestion-search > .search-suggestion__list > .search-suggestion__item a', 3996 function (e) { 3997 if (e.which === 40 || e.which === 38) { 3998 e.stopPropagation(); 3999 e.preventDefault(); 4000 4001 var li = $(this).parent(); 4002 var items = $( 4003 '#lcp-suggestion-search > .search-suggestion__list > .search-suggestion__item' 4004 ); 4005 var index = items.index(li); 4006 4007 if (e.which === 40) { 4008 index += 1; 4009 } else if (e.which === 38) { 4010 index -= 1; 4011 } 4012 4013 if (index < 0) { 4014 $('#lcp-searchbox-keyword').trigger('focus'); 4015 } else if (index < items.length) { 4016 $( 4017 '#lcp-suggestion-search > .search-suggestion__list > .search-suggestion__item:eq(' + 4018 index + 4019 ') a' 4020 ).trigger('focus'); 4021 } else { 4022 $('.search__suggestion-btn').trigger('focus'); 4023 // $('.list-suggestionsearch li:eq(0) a').focus(); 4024 } 4025 } 4026 } 4027).on('click', '[data-toggle="offsearch_open"]', function (e) { 4028 var btn = $(this); 4029 btn.addClass('active'); 4030 4031 $('.header__search').addClass('active').find('input.txt').trigger('focus').addClass('focus'); 4032 $('.main').addClass('active'); 4033 $('html').addClass('no-scroll'); 4034 4035 if (btn.attr('aria-expanded') == "true") { 4036 btn.attr('aria-expanded', false); 4037 } 4038 else if (btn.attr('aria-expanded') == "false") { 4039 btn.attr('aria-expanded', true); 4040 } 4041}) 4042 .on('click', '[data-toggle="offsearch_close"]', function (e) { 4043 $('.header__search').removeClass('active').find('input.txt').trigger('blur').removeClass('focus'); 4044 $('.searchbtn').removeClass('active'); 4045 $('.main').removeClass('active'); 4046 $('html').removeClass('no-scroll'); 4047 }) 4048 .on('click', '[data-toggle="searchbtn"]', function (e) { 4049 $('.header__search').removeClass('active').find('input.txt').trigger('blur').removeClass('focus'); 4050 $('.searchbtn').removeClass('active'); 4051 $('.main').removeClass('active'); 4052 $('html').removeClass('no-scroll'); 4053 }); 4054 4055var Search = { 4056 init: function() { 4057 var that = this; 4058 that.searchType = $('body').attr('data-search'); 4059 if (that.searchType === 'search-home-on-banner' && $('body.home.has-headerbanner').length > 0) { 4060 that.bindEventsSearchboxCheck(); 4061 that.checkSearchBoxPosition(); 4062 } 4063 }, 4064 4065 bindEventsSearchboxCheck: function() { 4066 var that = this; 4067 window.addEventListener('resize', that.checkSearchBoxPosition); 4068 }, 4069 4070 checkSearchBoxPosition: function() { 4071 const headerSearch = document.querySelector('.header__search'); 4072 const bannerPhoto = document.querySelector('.header__media-photo'); 4073 const searchGroup = document.querySelector('.search__group'); 4074 const bannerPhotoRect = bannerPhoto.getBoundingClientRect(); 4075 const bannerPhotoHeight = bannerPhotoRect.height; 4076 const searchRect = searchGroup.getBoundingClientRect(); 4077 const searchHeight = searchRect.height; 4078 4079 // do something with the element height 4080 const topPosition = Math.round((bannerPhotoHeight/2) - (searchHeight/2)); 4081 4082 //do the magic you want 4083 if (window.innerWidth <= gridFloatBreakpoint) { 4084 headerSearch.removeAttribute('style'); 4085 headerSearch.classList.remove('in-header'); 4086 } else { 4087 headerSearch.classList.add('in-header'); 4088 headerSearch.style.setProperty('--position-search', `${topPosition}px`); 4089 } 4090 }, 4091} 4092 4093var Ajaxify = { 4094 ajaxContainer: null, 4095 keyTimer: null, 4096 timer: null, 4097 refreshTime: null, 4098 lang: '', 4099 init: function () { 4100 var that = this; 4101 4102 var lang = $('html').attr('lang').split('-')[0]; 4103 lang = lang === 'nl' ? '' : ('/' + lang); 4104 that.lang = lang; 4105 4106 that.ajaxContainer = $('#ajax-container'); 4107 if (that.ajaxContainer.length > 0) { 4108 $('[data-hide-for-ajax="1"]').addClass('hidden'); 4109 $(document).ready(function () { 4110 $(this).on('change', 'input[data-do-viewmode],select[data-do-ajax="1"]', function (e) { 4111 e.stopPropagation(); 4112 e.stopImmediatePropagation(); 4113 e.preventDefault(); 4114 var rbtn = $(this); 4115 Cookie.set(rbtn.attr('data-do-viewmode'), 30, rbtn.val()); 4116 that.doRequest(rbtn); 4117 }).on('change', 'input[data-do-qry]', function (e) { 4118 e.stopPropagation(); 4119 e.stopImmediatePropagation(); 4120 e.preventDefault(); 4121 var rbtn = $(this); 4122 $('.side-bar form input[name="' + rbtn.attr('data-do-qry') + '"]').val(rbtn.val()); 4123 that.doRequest(rbtn); 4124 }) 4125 .on('change', 'input[data-do-ajax="1"]', function (e) { 4126 e.stopPropagation(); 4127 e.stopImmediatePropagation(); 4128 e.preventDefault(); 4129 var chk = $(this); 4130 4131 var form = chk.closest('form'); 4132 if (form.attr('id') === 'activefilterform') { 4133 4134 $('input[type="checkbox"][name="' + chk.attr('name') + '"][value="' + chk.attr('value') + '"]').prop('checked', false); 4135 $('input[type="hidden"][name="' + chk.attr('name') + '"],input[type="text"][name="' + chk.attr('name') + '"]').val(''); 4136 } 4137 that.doRequest(chk); 4138 4139 }).on('click', '[data-hide-for-ajax="1"]', function (e) { 4140 e.preventDefault(); 4141 that.doRequest($(this)); 4142 }).on('click', 'button[data-do-ajax="1"][data-to][data-from]', function (e) { 4143 e.preventDefault(); 4144 var btn = $(this); 4145 $('#to').val(btn.attr('data-to')); 4146 $('#from').val(btn.attr('data-from')); 4147 that.doRequest(btn); 4148 }).on('keyup', 'input[type="text"][data-do-ajax-blur="1"]', function (e) { 4149 if (that.keyTimer !== null) { 4150 clearTimeout(that.keyTimer); 4151 } 4152 var input = $(this); 4153 4154 if (e.keyCode !== 13) { 4155 4156 that.keyTimer = setTimeout(function () { that.doRequest(input); }, 350); 4157 } else { 4158 e.preventDefault(); 4159 that.doRequest(input); 4160 } 4161 4162 }); 4163 4164 that.checkActiveFilters(); 4165 }).on('click', 'button[data-remove-filter]', function (e) { 4166 e.preventDefault(); 4167 var id = $(this).attr('data-remove-filter'); 4168 var item = $('#' + id); 4169 if (item.attr('type') === 'text' || item.attr('type') === 'date') { 4170 item.val(''); 4171 } else if (item[0].localName === 'select') { 4172 item.val(''); 4173 item.find("option:selected").prop("selected", false) 4174 } else { 4175 var isChecked = item.prop('checked'); 4176 item.prop('checked', !isChecked); 4177 } 4178 4179 that.doRequest(item); 4180 }) 4181 } 4182 4183 if ($('button[data-load-more-ajax-url]').length > 0) { 4184 $(document).on('click', 'button[data-load-more-ajax-url]', function (e) { 4185 e.preventDefault(); 4186 var btn = $(this); 4187 that.loadMoreAjax(btn); 4188 }); 4189 } 4190 that.checkAZVisible(); 4191 that.checkRefreshTime(); 4192 4193 },
4194 loadMoreAjax: function (btn) { 4195 var ajaxContainer = $('#' + btn.attr('data-target')); 4196 var url = btn.attr('data-load-more-ajax-url') + "&offset=" + ajaxContainer.find('article').length; 4197 var noOfRecords = parseInt(btn.attr('data-total-records')); 4198 $.ajax({ 4199 async: true, 4200 type: 'GET', 4201 url: url 4202 }).done(function (partialview) { 4203 4204 ajaxContainer.append(partialview); 4205 4206 if (noOfRecords === ajaxContainer.find('li,article').length) { 4207 btn.addClass('hidden'); 4208 } 4209 }); 4210 }, 4211 doRequest: function (input) { 4212 4213 var that = this; 4214 that.setLoadingScreen(); 4215 var url = window.location.pathname; 4216 var form = input.closest('form'); 4217 4218 if (form.length === 0) { form = $('.side-bar form,.top-bar form') }; 4219 4220 var arr; 4221 if (form.length === 0) { 4222 arr = [{ name: input.attr('name'), value: input.val() }]; 4223 } else { 4224 arr = form.serializeArray(); 4225 } 4226 4227 var q = ''; 4228 4229 for (var i = 0; i < arr.length; i++) { 4230 var p = arr[i]; 4231 if (p.value !== null && p.value !== '' && !p.name.endsWith('_submit') && p.value !== 'on') { 4232 if (q !== '') { q += '&'; } 4233 q += p.name + '=' + p.value; 4234 } 4235 } 4236 if (q !== '') { url += '?' + q; } 4237 window.history.replaceState(null, null, url); 4238 4239 url += (url.indexOf('?') === -1 ? '?' : '&') + 'ajax=1'; 4240 4241 $.ajax({ 4242 async: true, 4243 type: 'GET', 4244 url: url 4245 }).done(function (partialview) { 4246 clearTimeout(that.timer); 4247 4248 that.ajaxContainer.html(partialview); 4249 that.ajaxContainer.removeAttr('style'); 4250 that.updateAZ(); 4251 that.checkActiveFilters(); 4252 that.setTotalItems(); 4253 var datael = document.querySelector('[data-mh]'); 4254 if (datael !== null) { 4255 // $('.list > li').matchHeight(); 4256 $(datael).matchHeight({ remove: true }); 4257 $.fn.matchHeight._maintainScroll = true; 4258 $.fn.matchHeight._applyDataApi(); 4259 //console.log("ajaxify update"); 4260 } 4261 4262 if (typeof Website !== "undefined" && typeof Website.Streetmap !== "undefined" && $('.streetmap').length > 0) { 4263 if (!$('.streetmap').hasClass('leaflet-container')) { 4264 Website.Streetmap.reset(); 4265 } 4266 4267 4268 } 4269 4270 if (typeof (Website) !== "undefined" && typeof (Website.MyInterests) !== "undefined") { 4271 Website.MyInterests.bindButtons(); 4272 } 4273 4274 stickify('.alertbox-filter', 0, '.page-container', gridFloatBreakpoint); 4275 footerFixedBottom(); 4276 }).fail(function () { 4277 that.ajaxContainer.html('<class="alertbox-error">error</div>'); 4278 }); 4279 4280 that.reloadFacet(form, arr, input); 4281 4282 }, 4283 setTotalItems: function () { 4284 var totalText = $('#total-items-data'); 4285 if (totalText.length > 0) { 4286 $('#total-items').html(totalText.html()); 4287 } 4288 }, 4289 reloadFacet: function (form, arr, input) { 4290 var that = this; 4291 // update facet navigation 4292 var facets = $('.facet-navigation:not([data-facet="' + input.attr('data-facet') + '"]'); 4293 if (facets.length > 0) { 4294 4295 var q = ''; 4296 for (var i = 0; i < arr.length; i++) { 4297 var p = arr[i]; 4298 if (p.value !== null && p.value !== '' && !p.name.endsWith('_submit') && p.value !== 'on') { 4299 q += '&' + p.name + '=' + p.value; 4300 } 4301 } 4302 4303 4304 facets.each(function () { 4305 var fieldset = $(this); 4306 4307 var facetkey = fieldset.attr('data-facet'); 4308 4309 $.ajax({ 4310 async: true, 4311 type: 'GET', 4312 url: fieldset.attr('data-facet-ajax-url') + '?fieldname=' + facetkey + q 4313 }).done(function (json) { 4314 for (var i = 0; i < json.length; i++) { 4315 var item = json[i]; 4316 var hasItems = item.noOfItems > 0; 4317 var chk = $('.facet-search-item[data-facet="' + facetkey + '"][value="' + item.value + '"]'); 4318 chk.prop('disabled', !hasItems); 4319 var li = chk.parent(); 4320 if (hasItems) { 4321 li.removeClass('is-readonly'); 4322 } else { 4323 li.addClass('is-readonly'); 4324 } 4325 li.find(' span .search-count').html(item.noOfItems); 4326 } 4327 }); 4328 4329 }); 4330 4331 } 4332 },
4333 setLoadingScreen: function () { 4334 var that = this; 4335 that.ajaxContainer.height(that.ajaxContainer.height() + 'px'); 4336 that.ajaxContainer.html('<div aria-hidden="true" class="loading"><svg class="loading__icon" data-icon="icon-search-loading" aria-hidden="true"><use href="/images/search-loading.svg#icon-search-loading" style="fill: var(--icon-color-primary, var(--icon-color)); transition:fill var(--transition-duration-base) var(--transition-timing-function);"></use></svg></div>'); 4337 }, 4338 updateAZ: function () { 4339 var that = this; 4340 var az = $('.nav-az'); 4341 if (az.length > 0) { 4342 4343 var li = []; 4344 $('.alphabet-item .keywords').each(function () { 4345 var l = this.id; 4346 li.push('<li><a rel="nofollow" href="#' + l + '" data-scrollto="az">' + l.substring(2) + '</a></li>'); 4347 }); 4348 az.html(li.join('')); 4349 } else { 4350 4351 } 4352 4353 that.checkAZVisible(); 4354 }, 4355 checkAZVisible: function () { 4356 if ($('.alphabet__item').length > 0) { 4357 $('#az-filter').removeClass('hidden'); 4358 } else { 4359 $('#az-filter').addClass('hidden'); 4360 } 4361 }, 4362 checkRefreshTime: function () { 4363 var that = this; 4364 var div = $('[data-refreshtime]'); 4365 if (div.length == 0) 4366 return; 4367 4368 that.refreshTime = null; 4369 div.each(function () { 4370 var el = $(this); 4371 var rf = el.data('refreshtime'); 4372 4373 if (that.refreshTime == null || that.refreshTime == 0 || rf < that.refreshTime) { 4374 that.refreshTime = rf; 4375 } 4376 }); 4377 that.refreshContactStatusNeeded(); 4378 }, 4379 refreshContactStatus: function () { 4380 var that = this; 4381 var div = $('[data-refresh-open-status]'); 4382 4383 if (div.length == 0) 4384 return; 4385 4386 that.refreshTime = 0; 4387 var noOfChecks = div.length; 4388 var updateDone = 0; 4389 4390 div.each(function () { 4391 var div = $(this); 4392 var statusSpan = div.find('span[data-hourid]'); 4393 var hourID = statusSpan.attr('data-hourid'); 4394 if (typeof (hourID) != 'undefined') { 4395 $.ajax({ 4396 async: true, 4397 type: 'GET', 4398 data: { hourID: hourID }, 4399 url: that.lang + '/contact/status' 4400 }).done(function (json) { 4401 4402 statusSpan.attr('class', 'contact__hours-status-box ' + json.cssclass).html('<span>' + json.statusText + '</span>'); 4403 4404 div.find('.txt-hours').html(json.hoursToday); 4405 $('[data-tomorrow-hourid="' + hourID + '"] .txt-hours').html(json.hoursTomorrow); 4406 4407 if (that.refreshTime == 0 || json.nextRefresh < that.refreshTime) { 4408 that.refreshTime = json.nextRefresh; 4409 } 4410 updateDone++; 4411 if (noOfChecks == updateDone) { 4412 that.refreshContactStatusNeeded(); 4413 } 4414 }); 4415 } 4416 }); 4417 }, 4418 refreshContactStatusNeeded: function () { 4419 var that = this; 4420 if (that.refreshTime > 0) { 4421 setTimeout(function () { that.refreshContactStatus(); }, that.refreshTime); 4422 } 4423 }, 4424 checkActiveFilters: function () { 4425 var templateTag = $('#header-filter-template'); 4426 if (templateTag.length > 0) { 4427 4428 var items = $('input[data-do-ajax="1"]:checked:not([name="SorteerType"],[name="sort"],input[name="viewmode"]),input[type="text"],input[type="date"],select[data-do-ajax="1"] option:selected'); 4429 4430 var div = $('.header-filters'); 4431 var ul = div.find('.list-filter'); 4432 var hasItems = false; 4433 if (items !== undefined && items.length > 0) { 4434 div.removeClass('hidden'); 4435 var html = ''; 4436 var noOfFilters = 0; 4437 var template = templateTag.html(); 4438 4439 items.each(function () { 4440 var i = $(this); 4441 var title = ''; 4442 var id = ''; 4443 if (i.parent().hasClass('ddl-group')) { 4444 4445 id = i.parent().attr('id'); 4446 if (i.parent().val() !== '') { 4447 4448 title = i.text(); 4449 } 4450 } 4451 else if (i.val() !== '') { 4452 id = i.attr('id'); 4453 title = $('label[for="' + i.attr('id') + '"] > span').text(); 4454 if (i.attr('type') === 'date') { 4455 var date = Date.parse(i.val()); 4456 title = Intl.DateTimeFormat().format(date); 4457 } else if (i.attr('type') === 'text') { 4458 title = i.val(); 4459 } 4460 } 4461 4462 if (title !== '') { 4463 4464 html += template.replace('{id}', id).replace("{title}", title); 4465 hasItems = true; 4466 noOfFilters++; 4467 } 4468 }); 4469 if (noOfFilters > 1) { 4470 html += $('#header-filter-template-delete-all').html(); 4471 } 4472 4473 ul.html(html); 4474 } 4475 4476 if (!hasItems) { 4477 div.addClass('hidden'); 4478 ul.html(''); 4479 } 4480 } 4481 } 4482}; 4483 4484Ajaxify.init(); 4485 4486 4487//-- Stickify functionality toevoeging met combinatie van de plugin js\sticky-kit 4488function stickify(el, posSpacing, parent, screenWidth, elPosition) { 4489 var container = $(el); 4490 4491 if (posSpacing === undefined || posSpacing === null) { 4492 posSpacing = 0; 4493 } 4494 4495 if (parent === undefined || parent === null) { 4496 parent = container.parent(); 4497 } 4498 4499 if (screenWidth === undefined || screenWidth === null) { 4500 screenWidth = gridFloatBreakpoint; //grid float breakpoints: 480px, 768px, 992px, 1200px 4501 } 4502
4503 if (elPosition === undefined || elPosition === null) { 4504 elPosition = 'top'; 4505 } 4506 4507 checkStickyposition(elPosition); 4508 4509 $(window).on('resize',function () { 4510 checkStickyposition(elPosition); 4511 }); 4512 4513 function checkStickyposition(el) { 4514 if (el === 'top') { 4515 if ($(document).width() >= screenWidth) { 4516 if (!container.siblings('.box-filter').length) { 4517 container 4518 .stick_in_parent({ 4519 offset_top: posSpacing, 4520 parent: parent, 4521 recalc_every: 1 4522 }) 4523 .on('sticky_kit:stick', function(e) { 4524 if ($('.box-anchor-links').length > 0) { 4525 var el = container.find('.box__block'), 4526 scroll = $(window).scrollTop(); 4527 el.css({ 4528 maxHeight: 4529 $(window).height() - 4530 ($(el).offset().top - scroll) - 4531 posSpacing, 4532 overflowY: 'auto' //eventueel in commentaar als je styled @pieter 4533 }); 4534 } 4535 }); 4536 // .on('sticky_kit:bottom ', function(e) { 4537 // console.log('bottom!', e.target); 4538 // }); 4539 } 4540 } else { 4541 container.trigger("sticky_kit:detach"); 4542 } 4543 } else { 4544 // container.on("sticky_kit:unstick ", function() { 4545 // } 4546 } 4547 }; 4548} 4549 4550 4551/**************** 4552* sticky header * 4553****************/ 4554function stickyheader() { 4555 var elHeader = $('.header'),
4556 headerStickspacer = $('<div/>') // creates a div element 4557 .attr('id', 'header-stick-spacer') // adds the id 4558 .addClass('header-stick-spacer'); // add a class 4559 checkHeaderposition(); 4560 $(window).on('resize scroll', checkHeaderposition); 4561 4562 function checkHeaderposition() { 4563 if ($('.widget-vlw-placeholder').length > 0 || $('.vlw').length > 0) { 4564 var stickyOffset = 43; 4565 } else { 4566 var stickyOffset = 0; 4567 } 4568 4569 var headerOffset = Math.round(elHeader.offset().top - stickyOffset), 4570 headerCheck = elHeader.innerHeight(), 4571 scrollPos = Math.round($(window).scrollTop()); 4572 4573 4574 // console.log(scrollPos, headerCheck, headerTop); 4575 // console.log(headerTop, scrollPos); 4576 4577 if (scrollPos > 0 && scrollPos >= headerOffset) { 4578 elHeader 4579 .css({ 4580 position: 'fixed', 4581 top: stickyOffset, 4582 left: 0, 4583 width: '100%', 4584 }) 4585 .addClass('is_stuck'); 4586 $('.search-top').addClass('in-header'); 4587 if (!$('#header-stick-spacer').length > 0) { 4588 headerStickspacer.insertAfter(elHeader).css({ 4589 height: headerCheck, 4590 }); 4591 } else { 4592 $('#header-stick-spacer').css({ 4593 height: headerCheck, 4594 }); 4595 } 4596 } else { 4597 unstickHeader(); 4598 } 4599 4600 if ($('#header-stick-spacer').length > 0) { 4601 var headerStickyspacer = $('#header-stick-spacer').offset().top; 4602 if (scrollPos <= headerStickyspacer) { 4603 unstickHeader(); 4604 } 4605 // console.log('is sticky: ' + headerStickyspacer, scrollPos); 4606 } 4607 } 4608 4609 function unstickHeader() { 4610 elHeader.removeAttr('style').removeClass('is_stuck'); 4611 $('#header-stick-spacer').remove(); 4612 $('.search-top').removeClass('in-header'); 4613 } 4614} 4615 4616var icordis = icordis || {}; 4617icordis.Tabs = { 4618 init: function () { 4619 var that = this; 4620 4621 $('#tablist a').on('click',function (e) { 4622 e.preventDefault(); 4623 var el = $(this); 4624 var id = el.attr('id'); 4625 var tabPosition = id.indexOf('algemeen') == -1 ? '?tab=' + id : ''; 4626 if (window.location.href.toLowerCase().indexOf('/aanpassen') == -1) { 4627 window.history.replaceState(null, null, window.location.pathname + tabPosition); 4628 } 4629 $('#tablist a').attr('aria-selected', 'false').attr('tabindex', -1).parent().removeClass('active'); 4630 el.attr('aria-selected', 'true').attr('tabindex', 0).parent().addClass('active'); 4631 4632 $('.tab-item').addClass('hidden'); 4633 $('#' + el.attr('aria-controls')).removeClass('hidden'); 4634 4635 $('#current-active-tab').val(id); 4636 4637 if (el.html().toLowerCase().indexOf('stratenplan') > -1 && typeof (Icordis.StreetmapControl) !== "undefined" && Icordis.StreetmapControl.map !== null) { 4638 Icordis.StreetmapControl.updateMap(); 4639 } 4640 }); 4641 4642 if (window.location.hash.indexOf('tabs-')>-1) { 4643 var hash = window.location.hash; 4644 window.addEventListener('load', function () { 4645 setTimeout(function () { 4646 $('a[href="' + hash + '"]').trigger('click'); 4647 }, 0); 4648 }); 4649 } else if (window.location.search.indexOf('tab') > -1) { 4650 var searchParams = new URLSearchParams(window.location.search); 4651 // console.log($('a[href="' + searchParams.get('tab') + '"]')); 4652 var tabId = searchParams.get('tab'); 4653 window.addEventListener('load', function () { 4654 setTimeout(function () { 4655 $('#' + tabId).trigger('click'); 4656 }, 0); 4657 }); 4658 } 4659 } 4660 4661 4662} 4663icordis.Tabs.init(); 4664 4665 4666//-- Tab toegankelijkheid voor de share mogelijkheid 4667function boxShareAccessible(el) { 4668 var elBtn = $(el), 4669 isClicked = false; 4670 4671 4672 elBtn.on('click',function () { 4673 var $this = $(this); 4674 expandSharebox($this); 4675 }); 4676 4677 function expandSharebox(el) { 4678 el.parent().toggleClass('is-active'); 4679 if (!isClicked) { 4680 el.attr('aria-expanded', 'true') 4681 .next().removeClass('invisibility').find('.list-social > li:last() > a') 4682 .blur(function () { 4683 el.attr('aria-expanded', 'false') 4684 .parent().removeClass('is-active'); 4685 isClicked = false; 4686 }); 4687 isClicked = true; 4688 } else { 4689 el.attr('aria-expanded', 'false').next().addClass('invisibility'); 4690 isClicked = false; 4691 } 4692 } 4693} 4694$(document).ready(function () { 4695 //-- maak box share toegankelijk 4696 boxShareAccessible('[data-toggle="socialsharebtn"]'); 4697}); 4698 4699//jQuery.fn.center = function () { 4700// this.css("position", "absolute"); 4701// this.css("top", ($(window).height() - this.outerHeight()) / 2 + "px"); 4702// this.css("left", ($(window).width() - this.outerWidth()) / 2 + "px"); 4703// return this; 4704//}; 4705 4706//// if ($('.popup-container').length > 0) { 4707//if ($('[data-popup=1]').length > 0) { 4708// // disableTabModalShown($('.popup-container')); 4709// disableTabModalShown($('.alertbanner')); 4710// $('html').addClass('no-scroll'); 4711// $('#outer-wrap').attr('aria-hidden', 'true'); 4712// isOverlay = true; 4713//} 4714 4715// $('.popup-overlay, .popup-close,.popup-content a').on('click',function (e) { 4716$('[data-alertbanner=close], [data-alertbanner=close] a').on('click', function (e) { 4717 var el = $(this); 4718 // var container = $('.popup-container,.sticky-container'); 4719 var container = $('.alertbanner'); 4720 container.hide(); 4721 var cookievalue = Cookie.get('Hidepopup'); 4722 var id = 4723 (typeof cookievalue !== 'undefined' && cookievalue !== '' 4724 ? cookievalue + ';' 4725 : '') + container.attr('data-id'); 4726 4727 Cookie.set('Hidepopup', container.attr('data-snooze'), id); 4728// $('html').removeClass('no-scroll'); 4729// $('#outer-wrap').removeAttr('aria-hidden'); 4730// $(document).off('keydown');
4731 // $('#inner-wrap').attr('tabindex', -1).focus(); 4732// $('body').children(':first-child').attr('tabindex', -1).trigger('focus'); 4733// isOverlay = false; 4734}); 4735 4736/***************** 4737 * Magnific-Popup * 4738 *****************/ 4739//readme: dimsemenov.com/plugins/magnific-popup/documentation.html 4740 4741//Magnific-Popup 4742 4743$('a[data-popup="imagelist"]').magnificPopup({ 4744 type: 'image', 4745 gallery: { 4746 enabled: true, 4747}, image: { 4748// // options for image content type 4749titleSrc: function (item) { 4750 var title = item.el.next().find('.photo__title'); 4751 var copyright = item.el.next().find('.copyright__name'); 4752 4753 if (title.length==0 ) { 4754 title = item.el.find('span.title'); 4755 } 4756 4757 var info=''; 4758 if (title.length > 0) { 4759 info = '<span>' + title.text() + '</span>' ; 4760 } 4761 if (copyright.length > 0) { 4762 info += '<span>© ' + copyright.text() + '</span>'; 4763 } 4764 4765 4766 4767 return info; 4768} 4769} 4770}); 4771 4772$(document).on('click','[data-popup="showall"]',function(e){ 4773 e.preventDefault(); 4774 $('a[data-popup="imagelist"]').magnificPopup('open'); 4775}); 4776 4777$('[data-popup="oneimage"]').magnificPopup({ 4778 type: 'image', 4779 // disableOn: function () { 4780 // var mobile = $('[data-popup="oneimage"] ~ .photo__info.find(.photo__showall').is(':visible'); 4781 // return !mobile; 4782 // }, 4783 image: { 4784 // // options for image content type 4785 titleSrc: function (item) { 4786 var title = item.el.next().find('.photo__title'); 4787 var copyright = item.el.next().find('.copyright__name'); 4788 4789 if (title.length == 0) { 4790 title = item.el.find('span.title'); 4791 } 4792 var info=''; 4793 if (title.length > 0) { 4794 info = '<span>' + title.text() + '</span>' ; 4795 } 4796 if (copyright.length > 0) { 4797 info += '<span>© ' + copyright.text() + '</span>'; 4798 } 4799 return info; 4800 } 4801 } 4802 // other options 4803}); 4804 4805$('[data-popup*="shadowbox"]').magnificPopup({ 4806 type: 'iframe', 4807 iframe: { 4808 markup: 4809 '<div class="mfp-iframe-scaler">' + 4810 '<div class="mfp-close"></div>' + 4811 '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' + 4812 '</div>', // HTML markup of popup, `mfp-close` will be replaced by the close button 4813 4814 patterns: null, 4815 srcAction: 'iframe_src', // Templating object key. First part defines CSS selector, second attribute. "iframe_src" means: find "iframe" and set attribute "src". 4816 }, 4817}); 4818 4819var lang = $('html').attr('lang').split('-')[0]; 4820if (lang === 'nl') { 4821 $.extend(true, $.magnificPopup.defaults, { 4822 tClose: 'Sluiten (Esc)', // Alt text on close button 4823 tLoading: 'Laden...', // Text that is displayed during loading. Can contain %curr% and %total% keys 4824 gallery: { 4825 tPrev: 'Vorige (Pijl toets links)', // Alt text on left arrow 4826 tNext: 'Next (Pijl toets rechts)', // Alt text on right arrow 4827 tCounter: '%curr% van %total%', // Markup for "1 of 7" counter 4828 }, 4829 }); 4830} else if (lang === 'fr') { 4831 $.extend(true, $.magnificPopup.defaults, { 4832 tClose: 'Fermez (Esc)', // Alt text on close button 4833 tLoading: 'Charge...', // Text that is displayed during loading. Can contain %curr% and %total% keys 4834 gallery: { 4835 tPrev: 'précédent (Touche fléchée gauche)', // Alt text on left arrow 4836 tNext: 'suivante (Touche fléchée droite)', // Alt text on right arrow 4837 tCounter: '%curr% de %total%', // Markup for "1 of 7" counter 4838 }, 4839 }); 4840} else if (lang === 'de') { 4841 $.extend(true, $.magnificPopup.defaults, { 4842 tClose: 'SchlieÃen (Esc)', // Alt text on close button 4843 tLoading: 'Wird geladen...', // Text that is displayed during loading. Can contain %curr% and %total% keys 4844 gallery: { 4845 tPrev: 'Zurück (linke Pfeiltaste)', // Alt text on left arrow 4846 tNext: 'Weiter (rechte Pfeiltaste)', // Alt text on right arrow 4847 tCounter: '%curr% von %total%', // Markup for "1 of 7" counter 4848 }, 4849 }); 4850} else if (lang === 'en') { 4851 $.extend(true, $.magnificPopup.defaults, { 4852 tClose: 'Close (Esc)', // Alt text on close button 4853 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys 4854 gallery: { 4855 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow 4856 tNext: 'Next (Right arrow key)', // Alt text on right arrow 4857 tCounter: '%curr% of %total%', // Markup for "1 of 7" counter 4858 }, 4859 }); 4860} 4861
4862$(document).on('mouseover', '[data-popover]', function () { 4863 $(this).addClass('active'); 4864}) 4865 .on('mouseleave', '[data-popover]', function () { 4866 $(this).removeClass('active'); 4867 }).on('click', '[data-popover]', function () { 4868 $(this).toggleClass('active'); 4869 }); 4870 4871 4872var SpeechRecognition = { 4873 recognition: null, 4874 init: function () { 4875 var that = this; 4876 var hasSpeechRecognition = false; 4877 if (window.hasOwnProperty('webkitSpeechRecognition')) { 4878 that.recognition = new webkitSpeechRecognition(); 4879 hasSpeechRecognition = true; 4880 4881 } 4882 //else if (window.hasOwnProperty('SpeechRecognition')) { 4883 // that.recognition = new speechRecognition(); 4884 // hasSpeechRecognition = true; 4885 //} 4886 4887 4888 if (hasSpeechRecognition) { 4889 4890 $('#btn-speech-recognition').removeClass('hidden'); 4891 $(document).on('click', '#btn-speech-recognition', function () { 4892 var btn = $(this); 4893 that.listen(btn); 4894 }); 4895 } 4896 }, 4897 listen: function (btn) { 4898 var that = this; 4899 var txt = $('#lcp-searchbox-keyword'); 4900 $('#speech-error-msg').addClass('hidden'); 4901 $('#lcp-search-form').removeClass('speech-error'); 4902 txt.attr('placeholder', txt.attr('data-speak-text')); 4903 txt.val(''); 4904 btn.prop('disabled', true); 4905 4906 4907 that.recognition.continuous = false; 4908 that.recognition.interimResults = false; 4909 var lang = document.getElementsByTagName("html")[0].getAttribute("lang"); 4910 var langMap = { 4911 'nl': 'nl-BE', 4912 'fr': 'fr-BE', 4913 'en': 'en-GB', 4914 'de': 'de-DE' 4915 }; 4916 console.log(langMap[lang.substring(0, 2)] || 'en-US'); 4917 that.recognition.lang = langMap[lang.substring(0, 2)] || 'en-US'; 4918 4919 that.recognition.start(); 4920 that.recognition.onstart = function () { 4921 $('#lcp-search-form').addClass('listening'); 4922 4923 } 4924 that.recognition.onspeechstart = function () { 4925 4926 var text = txt.attr('data-listening-text'); 4927 txt.attr('placeholder', text); 4928 } 4929 that.recognition.onresult = function (e) { 4930 4931 if (typeof (e.results) == 'undefined') { 4932 that.clearSearch(btn,txt); 4933 return; 4934 } 4935 4936 var transcript = e.results[0][0].transcript.replace(/\./g, '') 4937 4938 4939 txt.val(transcript); 4940 that.clearSearch(btn,txt); 4941 $("#lcp-searchbox-keyword").trigger('focus'); 4942 searchCounter = 0; 4943 suggestionsearch(0); 4944 4945 4946 }; 4947 4948 that.recognition.onerror = function (e) { 4949 console.log(e); 4950 $('#lcp-search-form').addClass('speech-error'); 4951 $('#speech-error-msg').removeClass('hidden'); 4952 that.recognition.stop(); 4953 that.clearSearch(btn, txt); 4954 4955 4956 } 4957 4958 }, 4959 clearSearch: function (btn,txt) { 4960 var that = this; 4961 4962 $('#lcp-search-form').removeClass('listening'); 4963 var text = txt.attr('data-tooltip'); 4964 txt.attr('placeholder', text); 4965 btn.prop('disabled', false); 4966 } 4967 4968} 4969SpeechRecognition.init(); 4970//-- Variables 4971 4972var $window = $(window), 4973 gridFloatBreakpoint = 768 - getScrollbarWidth(), // grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px 4974 gridFloatBreakpointMax = gridFloatBreakpoint - 1, 4975 isOverlay = false, 4976 stickySpacing = 0; 4977 4978//gebruikt om de scrollbar width te vinden toepasbaar om een goeie gridfloatbreakpoint berekening in javascript zie startup 4979 4980function getScrollbarWidth() { 4981 return window.innerWidth - document.documentElement.clientWidth; 4982} 4983 4984// $(document) 4985// .ready(function () { 4986$(function () { 4987 showVideo(); 4988 4989 4990 4991 //get focus class when inside searchfield 4992 // $('#lcp-searchbox-keyword') 4993 // .focus(function () { 4994 // $('.search__group').addClass('focus') 4995 // }) 4996 // .blur(function () { 4997 // $('.search__group') 4998 // .removeClass('focus') 4999 // }); 5000 5001 5002 // grid check van iconen op home op bais van de helper functie checkRow() in js\website\helpers\frontend.js 5003 /* 5004 if ($('.spotlight').find('.list.icons-big').length > 0) { 5005 checkRow('.list.icons-big', 'li'); 5006 } 5007 if ($('.spotlight').find('.list.icons-small').length > 0) { 5008 checkRow('.list.icons-small', 'li'); 5009 } 5010 */ 5011 5012 5013 5014}) 5015 .on('mouseover', '[data-tooltip]', function () { 5016 var btn = $(this); 5017 btn.attr('title', btn.attr('data-tooltip')); 5018 }) 5019 .on('mouseleave', '[data-tooltip]', function () { 5020 var btn = $(this); 5021 btn.removeAttr('title'); 5022 }) 5023 .on('click', 'button[data-toggle-items="1"]', function (e) { 5024 e.preventDefault(); 5025 var el = $(this); 5026 if (el.hasClass('active')) { 5027 el.attr('aria-expanded', 'false'); 5028 el.parent().removeClass('active'); 5029 $('#' + el.attr('data-id') + ' li.tohide').addClass('hidden'); 5030 el.removeClass('active').find('span').html(el.attr('data-show')); 5031 } else { 5032 el.parent().addClass('active'); 5033 $('#' + el.attr('data-id') + ' li.tohide').removeClass('hidden'); 5034 el.addClass('active').find('span').html(el.attr('data-hide')); 5035 el.attr('aria-expanded', 'true'); 5036 } 5037 }) 5038 .on('click', '[data-toggle-panel]', function (e) { 5039 e.preventDefault(); 5040 var btn = $(this); 5041 btn.toggleClass('active'); 5042 var open = btn.hasClass('active'); 5043 btn.attr('aria-expanded', open ? 'true' : 'false'); 5044 var txt = btn.attr('data-toggle-panel' + (open ? 'hide' : 'show')); 5045 btn.attr('data-tooltip', txt); 5046 btn.find('span.txt').html(txt); 5047 var panel = $('#' + btn.attr('data-toggle-panel')); 5048 panel.toggleClass('hidden'); 5049 panel.closest('fieldset').toggleClass('open'); 5050 5051 }) 5052 .on('click', '#btn-toggle-contrast', function (e) { 5053 var el = $(this); 5054 5055 var css = $('#skin-stylesheet'); 5056 if (el.hasClass('is-active')) { 5057 Cookie.remove(css.attr('data-css')); 5058 } else { 5059 Cookie.set(css.attr('data-css'), 1000, '1'); 5060 } 5061 window.location.reload(); 5062 }) 5063 .on('click', '[data-toggle-accordion]', function (e) { 5064 var btn = $(this); 5065 var accordion = $('#' + btn.attr('aria-controls')); 5066 var expanded = btn.attr('aria-expanded') === 'true'; 5067 5068 accordion.toggleClass('hidden'); 5069 btn.attr('aria-expanded', expanded ? 'false' : 'true'); 5070 if (btn.attr('data-icon-active') !== undefined) { 5071 if (expanded) { 5072 btn.parent('li').removeClass('active'); 5073 btn.find('use').attr('href', btn.attr('data-icon-inactive')); 5074 } else { 5075 btn.parent('li').addClass('active'); 5076 btn.find('use').attr('href', btn.attr('data-icon-active')); 5077 } 5078 } 5079 if (btn.attr('data-toggle-hide') !== undefined) { 5080 var txt = btn.attr('data-toggle-' + (expanded ? 'hide' : 'show')); 5081 btn.find('span').html(txt); 5082 btn.attr('data-tooltip', txt); 5083 } 5084 }) 5085 .on('change', '.checkboxlist-item input[data-parentid]', function () { 5086 var chk = $(this); 5087 var id = chk.val(); 5088 var checked = chk.is(':checked'); 5089 var parentid = chk.attr('data-parentid'); 5090 if (parentid == 0) { 5091 $('.checkboxlist-item input[data-parentid="' + id + '"]').prop( 5092 'checked', 5093 checked 5094 ); 5095 } else if (checked == false) { 5096 $('.checkboxlist-item input[value="' + parentid + '"]').prop( 5097 'checked', 5098 false 5099 ); 5100 } 5101 }) 5102 .on('click', 'button.btn-chklist-toggle', function (e) { 5103 var btn = $(this); 5104 btn.toggleClass('active'); 5105 var open = btn.hasClass('active'); 5106 btn.attr('aria-expanded', open ? 'true' : 'false'); 5107 var txt = btn.attr('data-toggle-' + (open ? 'hide' : 'show')); 5108 btn.find('span').html(txt); 5109 btn.attr('data-tooltip', txt); 5110 var control = btn.attr('aria-controls'); 5111 var panel = $('#' + control); 5112 panel.toggleClass('hidden'); 5113 panel.attr('aria-hidden', open ? 'false' : 'true'); 5114 }).on('click', 'button[data-readmore]', function (e) { 5115 var btn = $(this); 5116 btn.toggleClass('active'); 5117 var active = btn.hasClass('active'); 5118 btn.find('span').html(btn.attr('data-' + (active ? 'close' : 'open'))); 5119 $('#' + btn.attr('data-readmore')).attr('data-read-more', active ? 'false' : 'true'); 5120 }).on('click', "#playpausevideo", function () { 5121 // var videoelement = $(this).parent().closest('video'); 5122 var myVideo = document.getElementById("video-to-play"); 5123 if (myVideo.paused) { 5124 myVideo.play(); 5125 $("#playpausevideo").addClass("active"); 5126 } else { 5127 myVideo.pause(); 5128 $("#playpausevideo").removeClass("active"); 5129 } 5130 }); 5131 5132$(window).on('resize', function (e) { 5133 setSearchPlaceholder(); 5134 showVideo(); 5135}); 5136 5137function showVideo() { 5138 var v = $('#video-source'); 5139 if (v.length > 0) { 5140 if ( $(window).width() >= gridFloatBreakpoint && !v.hasClass('video-loaded')) { 5141 var src = v.attr('data-src'); 5142 if (src != '') { 5143 v.addClass('video-loaded'); 5144 v.html('<video id="video-to-play" loop muted autoplay><source src="' + src + '" type="video/mp4" />Your browser does not support the video tag.</video>'); 5145 try { 5146 document.getElementById("video-to-play").play(); 5147 $("#playpausevideo").addClass("active"); 5148 } catch (e) { } 5149 } 5150 } 5151 else if ($(window).width() <= gridFloatBreakpointMax) { 5152 try { 5153 $("#playpausevideo").removeClass("active "); 5154 v.removeClass('video-loaded').children().remove(); 5155 } catch (e) { } 5156 } 5157 } 5158}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.