1(function() { 2 var Accordion; 3 4 Accordion = { 5 init: function() { 6 return; 7 this.set(); 8 return this.pos(); 9 }, 10 set: function() { 11 return $('dl.accordion .accordion-navigation > a').on("click", function(event, accordion) { 12 window.location.hash = $(event.currentTarget).attr('href'); 13 return Accordion.get(); 14 }); 15 }, 16 get: function() {}, 17 pos: function() { 18 return $('.accordion.faq').on('toggled', function(event, accordion) { 19 var elm; 20 elm = General.Browser.small ? $('.content') : $(window); 21 return elm.scrollTo($(accordion).parents('.accordion-navigation'), 800, { 22 offset: -80 23 }); 24 }); 25 } 26 }; 27 28 $(document).ready(function() { 29 Accordion.init(); 30 $('.read-more-content').addClass('hide'); 31 return $('.read-more-toggle').on('click', function() { 32 $(this).next('.read-more-content').toggleClass('hide'); 33 if ($(this).html() === 'Lees meer') { 34 $(this).html('Lees minder'); 35 } else { 36 $(this).html('Lees meer'); 37 } 38 }); 39 }); 40 41}).call(this); 42 (function() { 43 var Ads; 44 45 Ads = { 46 init: function() { 47 if (General.Browser.small) { 48 this.mobile(); 49 } 50 this.slick(); 51 this.Analytics.clicks(); 52 return this.copySlots(); 53 }, 54 slick: function() { 55 $('.company-add').slick({ 56 fade: true, 57 autoplay: true, 58 arrows: false, 59 speed: 2000, 60 autoplaySpeed: 3001, 61 pauseOnHover: true 62 }); 63 return $('.company-add').on('afterChange', function(event, slick, key) { 64 var slide; 65 slide = $(slick.$slides[key]).find('a'); 66 return Ads.Analytics.views(slide); 67 }); 68 }, 69 Analytics: { 70 views: function(slide) { 71 return adEvent('view', $(slide).attr('title')); 72 }, 73 clicks: function() { 74 return $('.company-add-item').on('click', 'a', function(e) { 75 return adEvent('click', $(this).attr('title')); 76 }); 77 } 78 }, 79 mobile: function() { 80 return $(".shell-ban-wide-holder").clone().appendTo($('.shell-ban-small-holder')); 81 }, 82 copySlots: function() { 83 var slots; 84 slots = $('[data-slot]'); 85 return slots.each(function(idx, el) { 86 var $el, destination, destinations, selector, slot; 87 $el = $(el); 88 slot = $el.data('slot'); 89 selector = "[data-slot-target='" + slot + "']:visible"; 90 destinations = $(selector); 91 if (!destinations.length) { 92 return; 93 } 94 if (destinations.length > 1) { 95 console.warn('Multiple destinations found:', destinations); 96 return; 97 } 98 destination = destinations.first(); 99 destination.html($el.html()); 100 return $el.hide(); 101 }); 102 } 103 }; 104 105 window.adEvent = function(type, name) { 106 if (typeof ga !== 'undefined') { 107 return ga('send', 'event', 'Advertentie', type, name); 108 } 109 }; 110 111 $(function() { 112 return Ads.init(); 113 }); 114 115}).call(this); 116 (function() { 117 window.Ajax = { 118 init: function() { 119 return; 120 this.back = false; 121 this.loading = false; 122 this.link = false; 123 $(document).on("ajax-check-url", function(e, content) { 124 Ajax.checkUrl(e, content); 125 return $(document).trigger("ajax-update-start"); 126 }); 127 $(document).on("ajax-content", function() { 128 return Ajax.content(); 129 }); 130 $(document).on("ajax-load-page", function() { 131 return Ajax.loadPage(); 132 }); 133 $(document).on("ajax-pushstate", function() { 134 return Ajax.pushState(); 135 }); 136 $(document).on("animation-show-ready", function(e, elm) { 137 return Ajax.iframe(); 138 }); 139 $(document).on("animation-hide-ready", function(e, elm) { 140 return Ajax.updatePage(); 141 }); 142 window.addEventListener('load', function() { 143 return setTimeout((function() { 144 return window.onpopstate = function(popstate) { 145 clearTimeout(Ajax.time); 146 return Ajax.time = setTimeout(function() { 147 Ajax.back = true; 148 if (Ajax.loading) { 149 return false;
150 } 151 return $(document).trigger("ajax-check-url", location.pathname); 152 }, 350); 153 }; 154 }), 0); 155 }); 156 this.checks(); 157 return this.click(); 158 }, 159 checks: function() { 160 var ajax, check, type; 161 return Ajax.check = [[check = /_blank/, type = 'target', ajax = false], [check = /fancybox/, type = 'class', ajax = false], [check = /.doc$/, type = 'href', ajax = false], [check = /.pdf$/, type = 'href', ajax = false], [check = /.zip$/, type = 'href', ajax = false], [check = /#/, type = 'href', ajax = false], [check = /^\//, type = 'href', ajax = true]]; 162 }, 163 click: function() { 164 return $(document.body).on('click', 'a', function(e) { 165 Ajax.link = false; 166 $.each(Ajax.check, function(key, value) { 167 if (value[1] === 'target' && typeof $(e.currentTarget).attr('target') !== 'undefined' && $(e.currentTarget).attr('target').match(value[0])) { 168 Ajax.link = value[2]; 169 } 170 if (value[1] === 'href' && typeof $(e.currentTarget).attr('href') !== 'undefined' && $(e.currentTarget).attr('href').match(value[0])) { 171 Ajax.link = value[2]; 172 } 173 if (value[1] === 'class' && typeof $(e.currentTarget).attr('class') !== 'undefined' && $(e.currentTarget).attr('class').match(value[0])) { 174 Ajax.link = value[2]; 175 } 176 if (Ajax.link === false) { 177 return false; 178 } 179 }); 180 if (Ajax.link === '') { 181 Ajax.link = false; 182 } 183 if (Ajax.link === false) { 184 return; 185 } 186 Ajax.closeSubmenu(e); 187 e.preventDefault(); 188 Ajax.loading = true; 189 Ajax.link = false; 190 return $(document).trigger("ajax-check-url", e); 191 }); 192 }, 193 closeSubmenu: function(e) { 194 var index, item; 195 item = $(e.currentTarget).parents('.has-dropdown'); 196 if (item.length === 0) { 197 return; 198 } 199 item = item[item.length - 1]; 200 $(item).removeClass('hover'); 201 index = $(item).index(); 202 item.remove(); 203 return $(item).insertAfter($('.top-bar-section > ul > li:nth-child(' + index + ')')); 204 }, 205 checkUrl: function(e, data) { 206 if ($.type(data) === 'string') { 207 Ajax.url = data; 208 } else { 209 Ajax.url = $(data.currentTarget).attr('href'); 210 } 211 if ((Ajax.url !== location.pathname) || Ajax.back) { 212 return $(document).trigger("ajax-content"); 213 } else { 214 return Ajax.loading = false; 215 } 216 }, 217 content: function() { 218 var geturl; 219 return; 220 if (Ajax.url === '') { 221 Ajax.url = 'home'; 222 } 223 if (Ajax.url.indexOf('#') > 0) { 224 Ajax.url = ajaxurl.substr(0, Ajax.url.indexOf('#')); 225 } 226 geturl = '/rest/page/content?url=' + Ajax.url.replace('/', '') + '&info=json'; 227 return $.get(geturl, function(data) { 228 Ajax.data = data; 229 return $(document).trigger("ajax-load-page"); 230 }).fail(function() { 231 return $.get('/rest/page/content?url=404&info=json', function(data) { 232 Ajax.data = data; 233 return $(document).trigger("ajax-load-page"); 234 }); 235 }); 236 }, 237 loadPage: function() { 238 $(document).trigger("animation-hide"); 239 Ajax.title = Ajax.data.meta ? Ajax.data.meta.title : ''; 240 $('title').html($('title').data('pre') + Ajax.title); 241 return $(document).trigger("ajax-pushstate"); 242 }, 243 pushState: function() { 244 if (!history.pushState) { 245 return; 246 } 247 if (!Ajax.back) { 248 window.history.pushState(null, Ajax.data.title, Ajax.url); 249 } 250 return Ajax.back = false; 251 }, 252 updatePage: function() { 253 $('.content > .update').html(Ajax.data.html); 254 $(document).trigger("animation-show"); 255 this.analytics(); 256 $('.top-bar').removeClass("expanded fixed"); 257 $('.sticky').removeClass("fixed expanded"); 258 $('body.f-topbar-fixed').removeClass('f-topbar-fixed'); 259 $('.top-bar, .top-bar-section').removeAttr("style"); 260 if (General.Browser.small) { 261 $('.content').scrollTo(0, 0); 262 } else { 263 $.scrollTo($('body')); 264 } 265 Ajax.loading = false;
266 return $(document).trigger("ajax-update-ready"); 267 }, 268 iframe: function() { 269 var a, p; 270 p = $("orgiframe").wrapAll("<div class=\"replace small-h-12\"></div>"); 271 a = $("div.replace").map(function() { 272 return this.innerHTML; 273 }).get().join(" "); 274 $("div.replace").html(a.replace(/<orgiframe/g, "<iframe").replace(/orgiframe>/g, "irame>")); 275 $('div.replace').prev().remove(); 276 return $('iframe').removeClass('hide'); 277 }, 278 analytics: function() { 279 if (typeof ga !== 'undefined') { 280 ga('send', 'pageview', { 281 'page': Ajax.url, 282 'title': Ajax.data.content_title 283 }); 284 } 285 if (typeof ga !== 'undefined') { 286 return ga('global.send', 'pageview', { 287 'page': Ajax.url, 288 'title': Ajax.data.content_title 289 }); 290 } 291 } 292 }; 293 294 Ajax.init(); 295 296}).call(this); 297 (function() { 298 angular.module('frontend', ['ngResource']); 299 300 angular.module('frontend').config(function($locationProvider) { 301 if (Modernizr.history) { 302 return $locationProvider.html5Mode({ 303 enabled: true, 304 requireBase: false 305 }); 306 } 307 }); 308 309 angular.module('frontend').run(function($rootScope, $location) { 310 return $rootScope.$on('$locationChangeStart', function($event, url, old) { 311 if (url === old || !Modernizr.history) { 312 return; 313 } 314 url = url.split('?')[0]; 315 old = old.split('?')[0]; 316 if (url !== old) { 317 $event.preventDefault(); 318 return location.href = url; 319 } 320 }); 321 }); 322 323}).call(this); 324 (function() { 325 window.Animation = { 326 init: function() { 327 $(document).on("animation-show", function() { 328 return Animation.show(); 329 }); 330 $(document).on("animation-hide", function() { 331 return Animation.hide(); 332 }); 333 return this.set(); 334 }, 335 set: function() { 336 this.ct = new TimelineLite({ 337 paused: true, 338 onComplete: function() { 339 return $(document).trigger("animation-hide-ready"); 340 }, 341 onReverseComplete: function() { 342 return $(document).trigger("animation-show-ready"); 343 } 344 }); 345 return this.ct.add(TweenLite.fromTo($('.content'), .3, { 346 opacity: 1 347 }, { 348 opacity: 0 349 })); 350 }, 351 show: function() { 352 return this.ct.reverse(); 353 }, 354 hide: function() { 355 return this.ct.play(); 356 } 357 }; 358 359 Animation.init(); 360 361}).call(this); 362 (function() { 363 $(function() { 364 var $el; 365 $el = $('.module-autos table'); 366 return $el.tablesorter({ 367 sortList: [[0, 0], [1, 0]] 368 }); 369 }); 370 371}).call(this); 372 (function() { 373 var ButtonDropdown; 374 375 ButtonDropdown = { 376 init: function() { 377 this.update(); 378 return $(document).on("ajax-update-ready", function(e, elm) { 379 return ButtonDropdown.update(); 380 }); 381 }, 382 update: function() { 383 return $('.f-dropdown a').on('click', function(elm) { 384 return $(elm.currentTarget).parents('.f-dropdown').siblings('.dropdown').html($(elm.currentTarget).find('span').html()); 385 }); 386 } 387 }; 388 389 ButtonDropdown.init(); 390 391}).call(this); 392 (function() { 393 window.Form = { 394 init: function() { 395 Form.Builder.init(); 396 return setTimeout((function() { 397 return Form.Placeholders.init(); 398 }), 0); 399 }, 400 Builder: { 401 init: function() { 402 Form.Builder.set(); 403 return $(document).on("ajax-update-ready", function() { 404 return Form.Builder.set(); 405 }); 406 }, 407 set: function() { 408 $(document).off('submit'); 409 return $('.fb-form').submit(function(e) { 410 return Form.Builder.send(e); 411 }); 412 }, 413 send: function(e) { 414 var fields, form, params, url; 415 form = $(e.target); 416 Form.Placeholders.remove(form); 417 fields = form.serialize(); 418 url = '/_ajax?module_name=FormBuilder&action=submit'; 419 params = { 420 type: 'POST', 421 url: url, 422 data: fields, 423 dataType: 'json', 424 error: function(jqXHR, textStatus, error) { 425 Form.Placeholders.add(form); 426 return Form.Builder.submitError(jqXHR, textStatus, error); 427 }, 428 success: function(data, textStatus, jqXHR) { 429 return Form.Builder.submitSuccess(form); 430 } 431 }; 432 $.ajax(params); 433 return e.preventDefault(); 434 }, 435 submitError: function(jqXHR, textStatus, error) { 436 if (jqXHR.responseJSON.length) { 437 $('small.error, span.error').addClass('hide'); 438 return $(jqXHR.responseJSON).each(function(index, elm) { 439 error = $('[name="' + elm.id + '"], [data-name="' + elm.id + '"]').parent('label').next(); 440 $(error).text(elm.message); 441 return $(error).removeClass('hide'); 442 }); 443 } 444 }, 445 submitSuccess: function(form) { 446 var id; 447 id = form.data('slotid'); 448 return form.slideUp(500, function() { 449 return $('.fb-text-after-post-' + id).slideDown(); 450 }); 451 } 452 }, 453 Placeholders: { 454 init: function() { 455 Form.Placeholders.add(); 456 return $(document).on("ajax-update-ready", function() { 457 return Form.Placeholders.add(); 458 }); 459 }, 460 add: function(form) { 461 if (!Modernizr.ie9) { 462 return; 463 } 464 if (!form) { 465 form = $('form'); 466 } 467 return form.find("[placeholder]").each(function() { 468 if ($(this).attr('type') === 'hidden' || $(this).val()) { 469 return; 470 } 471 $(this).val($(this).attr("placeholder")); 472 return $(this).focus(function() { 473 if ($(this).attr("placeholder") === $(this).val()) { 474 return $(this).val(""); 475 } 476 }); 477 }); 478 }, 479 remove: function(form) { 480 if (!Modernizr.ie9) { 481 return; 482 } 483 if (!form) { 484 form = $('form'); 485 } 486 return form.find('[placeholder]').each(function() { 487 var $this; 488 $this = $(this); 489 if ($this.val() === $this.attr('placeholder')) { 490 return $this.val(''); 491 } 492 }); 493 } 494 } 495 }; 496
497 Form.init(); 498 499 angular.module('frontend').directive('mediaUploader', function($filter) { 500 var maxSize, t; 501 if (typeof langTableLang !== "undefined" && langTableLang !== null) { 502 t = $filter('translate'); 503 } else { 504 t = function(v) { 505 return v; 506 }; 507 } 508 maxSize = 32 * 1024 * 1024; 509 return { 510 scope: true, 511 restrict: 'A', 512 link: function(scope, elem, attrs, ctrl) { 513 var addData, close, count, data, delData, getFile, showError, showErrorEl, upload; 514 if (attrs.count == null) { 515 count = 5; 516 } else { 517 count = parseInt(attrs.count); 518 } 519 $(document).bind('drop dragover', function(e) { 520 return e.preventDefault(); 521 }); 522 upload = elem.find('.fb-upload'); 523 upload.fileupload({ 524 dataType: 'json', 525 maxNumberOfFiles: count, 526 limitConcurrentUploads: 1, 527 url: '/upload', 528 dropZone: elem.parents('.dropzone'), 529 maxFileSize: maxSize, 530 fail: function(e, data) { 531 var errorCode; 532 errorCode = data.jqXHR.getResponseHeader('x-error'); 533 return window.open('/admin/developer/?action=view-log&key=' + errorCode); 534 }, 535 done: function(e, d) { 536 var el, file, result, _i, _j, _len, _len1, _ref, _ref1, _results; 537 if ('string' === typeof d.result) { 538 result = JSON.parse(d.result); 539 } else { 540 result = d.result; 541 } 542 if ((result.errors != null) && result.errors.length) { 543 _ref = result.errors; 544 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 545 e = _ref[_i]; 546 showError(e); 547 } 548 } 549 scope.$apply(function() { 550 return addData(result); 551 }); 552 _ref1 = result.files; 553 _results = []; 554 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 555 file = _ref1[_j]; 556 el = upload.clone(); 557 el.attr('type', 'hidden'); 558 el.attr('name', el.attr('id') + '[]'); 559 el.attr('value', file.id); 560 _results.push(elem.append(el)); 561 } 562 return _results; 563 }, 564 add: function(e, data) { 565 if (data.files[0].tooBig) { 566 return; 567 } 568 return data.process().done(function() { 569 return data.submit(); 570 }); 571 }, 572 progress: function(e, data) { 573 return scope.$apply(function() { 574 return scope.progress = { 575 name: data.files[0].name, 576 value: parseInt(data.loaded / data.total * 100) 577 }; 578 }); 579 }, 580 change: function(e, data) { 581 var file, _i, _len, _ref, _results; 582 _ref = data.files; 583 _results = []; 584 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 585 file = _ref[_i]; 586 if (file.size > maxSize) { 587 file.tooBig = true; 588 _results.push(showError("" + file.name + " " + (t('is te groot')) + ".")); 589 } else { 590 _results.push(void 0); 591 } 592 } 593 return _results; 594 }, 595 formData: { 596 folder: attrs.folder || '_formbuilder' 597 } 598 }); 599 scope.upload = function() { 600 var d, _i, _len, _results; 601 _results = []; 602 for (_i = 0, _len = data.length; _i < _len; _i++) { 603 d = data[_i]; 604 _results.push(d.submit()); 605 } 606 return _results; 607 }; 608 scope.getFiles = function() { 609 var d, file, files, key, _i, _len; 610 files = {}; 611 key = 0; 612 for (_i = 0, _len = data.length; _i < _len; _i++) { 613 d = data[_i]; 614 file = d.files[0]; 615 files[key++] = file; 616 } 617 return files; 618 }; 619 scope.isValid = function() { 620 if (data.length === 0) { 621 return false;
622 } 623 if (scope.folder === 'images') { 624 return _.some(scope.form.resolutions); 625 } 626 return true; 627 }; 628 close = function() { 629 var data; 630 scope.isOpen = false; 631 data = []; 632 return scope.form.filename = ''; 633 }; 634 getFile = function(key) { 635 var ret; 636 ret = _.find(data, function(d) { 637 return d.files[0].$$hashKey === key; 638 }); 639 if (!ret) { 640 return null; 641 } 642 return ret.files[0]; 643 }; 644 data = []; 645 addData = function(d) { 646 if (!d.files.length || d.files[0].size > maxSize) { 647 return; 648 } 649 return data.push(d); 650 }; 651 scope.delFile = function(id) { 652 $("input[type=hidden][value=" + id + "]").remove(); 653 return data = _.filter(data, function(d) { 654 return d.files[0].id !== id; 655 }); 656 }; 657 delData = function(key) { 658 return data = _.filter(data, function(d) { 659 return d.files[0].$$hashKey !== key; 660 }); 661 }; 662 showErrorEl = elem.find('.error'); 663 return showError = function(msg) { 664 var el, showErrorTimer; 665 el = $("<div>" + msg + "</div>"); 666 showErrorEl.removeClass('hide'); 667 showErrorEl.append(el); 668 return showErrorTimer = setTimeout(function() { 669 el.remove(); 670 if (!showErrorEl.children().length < 2) { 671 return showErrorEl.addClass('hide'); 672 } 673 }, 10000); 674 }; 675 } 676 }; 677 }); 678 679}).call(this); 680 (function() { 681 var Fndtn; 682 683 Fndtn = { 684 init: function() { 685 $(document).foundation({ 686 offcanvas: { 687 open_method: 'move' 688 }, 689 accordion: {} 690 }); 691 return $(document).on("ajax-update-ready", function() { 692 return Fndtn.Offcanvas.close(); 693 }); 694 }, 695 Offcanvas: { 696 close: function() { 697 return $('.off-canvas-wrap').foundation('offcanvas', 'hide', 'move-right'); 698 } 699 } 700 }; 701 702 Fndtn.init(); 703 704}).call(this); 705 (function() { 706 window.General = { 707 init: function() { 708 this.Browser = {}; 709 this.browser(); 710 this.size(); 711 return $(window).resize(function() { 712 return General.size(); 713 }); 714 }, 715 browser: function() { 716 Modernizr.addTest("firefox", function() { 717 return !!navigator.userAgent.match(/firefox/i); 718 }); 719 Modernizr.addTest("ie", function() { 720 return !!navigator.userAgent.match(/msie/i) || (!!navigator.userAgent.match(/windows/i) && navigator.userAgent.match(/rv:11/)); 721 }); 722 Modernizr.addTest("ie9", function() { 723 return !!navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/9/); 724 }); 725 Modernizr.addTest("ie11", function() { 726 return !!navigator.userAgent.match(/windows/i) && navigator.userAgent.match(/rv:11/); 727 }); 728 Modernizr.addTest("android-4", function() { 729 return !!navigator.userAgent.match(/android/i) && navigator.userAgent.match(/4./); 730 }); 731 return General.Browser.touch = $('html.touch').length ? true : false; 732 }, 733 size: function() { 734 this.Browser.dimensions = []; 735 this.Browser.dimensions.width = $(window).width(); 736 this.Browser.dimensions.height = $(window).height(); 737 this.Browser.small = (matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches ? true : false); 738 this.Browser.medium = (matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches ? true : false); 739 this.Browser.large = (matchMedia(Foundation.media_queries.large).matches && !matchMedia(Foundation.media_queries.xlarge).matches ? true : false); 740 return this.Browser.xlarge = ((matchMedia(Foundation.media_queries.xlarge).matches) ? true : false); 741 } 742 }; 743 744 General.init(); 745 746}).call(this); 747 (function() { 748 var IE8; 749 750 IE8 = { 751 init: function() { 752 var msie, ua; 753 ua = window.navigator.userAgent; 754 msie = ua.indexOf("MSIE "); 755 console.log(msie); 756 if (msie > 0) { 757 console.log(ua.substring(msie + 5, ua.indexOf('.', msie))); 758 if (parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) === 8) { 759 return $('body').html('<h1>Uw browser wordt niet ondersteund</h1><p style="max-width:700px; margin: 0 auto;">Geachte bezoeker,<br />Helaas maakt u gebruik van een verouderde versie van Internet Explorer. Derhalve is het niet mogelijk om deze website te bezoeken. We verzoeken u vriendelijk om een meer recentere (versie van uw) browser te downloaden. U kunt deze gratis downloaden op <a href="http://www.alleinternetbrowsers.nl/" target="_blank">deze pagina</a>. <br />Onze excuses voor het ongemak.</p>').css({ 760 'text-align': 'center', 761 'padding-top': '40px' 762 }); 763 } 764 } 765 } 766 }; 767 768}).call(this); 769 (function() { 770 var Lg; 771 772 Lg = { 773 init: function() { 774 this.set(); 775 return $(document).on("ajax-update-ready", function() { 776 return Lg.set(); 777 }); 778 }, 779 set: function() { 780 if (typeof lightGallery !== 'undefined') { 781 return $("#lightGallery").lightGallery({ 782 thumbnail: false 783 }); 784 } 785 } 786 }; 787 788 Lg.init(); 789 790}
790).call(this); 791 (function() { 792 var currentForm, form, showForm, submitForm; 793 794 form = currentForm = null; 795 796 $(function() { 797 var checked, groups; 798 form = $('form#profile'); 799 form.submit(submitForm); 800 groups = form.find('input[type=radio][name=member_group_id]'); 801 if (groups.length) { 802 groups.click(function() { 803 var id; 804 id = $(this).val(); 805 return showForm(id); 806 }); 807 return checked = $('input[name=member_group_id]:checked').click(); 808 } else { 809 return form.find('.group:first').show(); 810 } 811 }); 812 813 submitForm = function(e) { 814 var data, params, url; 815 e.preventDefault(); 816 data = form.serialize(); 817 url = form.attr('action'); 818 params = { 819 type: 'POST', 820 url: url, 821 data: data, 822 dataType: 'json', 823 error: window.submitError, 824 success: function(data, textStatus, jqXHR) { 825 return document.location.href = data.redirect; 826 } 827 }; 828 return $.ajax(params); 829 }; 830 831 showForm = function(id) { 832 var label, labels, nextForm, row, value; 833 nextForm = form.find(".group#group-" + id); 834 if (currentForm) { 835 labels = {}; 836 currentForm.find('.row[data-label]').each(function(idx, el) { 837 var $this, label; 838 $this = $(this); 839 label = $this.data('label'); 840 label = label.replace(/^\s+|(\s|\*)+$/g, ''); 841 return labels[label] = $this.find(':input').val(); 842 }); 843 for (label in labels) { 844 value = labels[label]; 845 row = nextForm.find(".row[data-label='" + label + "']"); 846 row.find("[name^='form']").val(value); 847 } 848 currentForm.hide(); 849 } 850 nextForm.show(); 851 return currentForm = nextForm; 852 }; 853 854}).call(this); 855 (function() { 856 var Menu; 857 858 Menu = { 859 init: function() { 860 return $(document).on("ajax-update-start", function() { 861 return Menu.set(); 862 }); 863 }, 864 set: function() { 865 var aUrl, url; 866 aUrl = Ajax.url.split('/'); 867 aUrl.shift(); 868 $('.top-bar-section, .off-canvas-list, .sub-nav').find('li.active, li.active a, dd.active, dd.active a').removeClass('active'); 869 url = ''; 870 return $.each(aUrl, function(key, value) { 871 var elm; 872 url += '/' + value; 873 elm = $('.top-bar-section, .off-canvas-list, .sub-nav').find('a[href="' + url + '"]'); 874 elm.addClass('active'); 875 return elm.parent('li, dd').addClass('active'); 876 }); 877 } 878 }; 879 880 Menu.init(); 881 882}).call(this); 883 (function() { 884 var Offcanvas; 885 886 Offcanvas = { 887 init: function() { 888 $(document).on("ajax-update-start", function() { 889 return MeOffcanvasnu.set(); 890 }); 891 $(document).foundation(); 892 Offcanvas.set(); 893 return $('.off-canvas-submenu').hide(); 894 }, 895 set: function() { 896 return $('.off-canvas-submenu-call').click(function() { 897 var icon; 898 icon = $(this).parent().next('.off-canvas-submenu').is(':visible') ? '+' : '-'; 899 $(this).parent().next('.off-canvas-submenu').slideToggle('fast'); 900 $(this).find('span').text(icon); 901 }); 902 } 903 }; 904 905 Offcanvas.init(); 906 907}).call(this); 908 (function() { 909 angular.module('frontend').run(function($location, $rootScope) { 910 return $(document).on('click', '.article-widget .pagination a', function(e) { 911 var href, m; 912 e.preventDefault(); 913 href = this.getAttribute('href'); 914 m = /page=([0-9]+)/.exec(href); 915 if (!m) { 916 return; 917 } 918 return $rootScope.$apply(function() { 919 return $location.search('page', m[1]); 920 }); 921 }); 922 }); 923 924}).call(this); 925 (function() { 926 var address, calcRoute, current, directions, display, map, oldDirections, service; 927 928 address = display = map = directions = service = current = null; 929 930 oldDirections = []; 931 932 window.initializeRoute = function() { 933 var coords, form, geocoder; 934 address = document.getElementById('route-end'); 935 if (!address) { 936 return; 937 } 938 coords = address.value; 939 service = new google.maps.DirectionsService(); 940 geocoder = new google.maps.Geocoder(); 941 form = $('form#route-form').submit(function(e) { 942 e.preventDefault(); 943 return calcRoute(); 944 }); 945 return geocoder.geocode({ 946 address: coords 947 }, function(locResult) { 948 var marker, myOptions; 949 myOptions = { 950 zoom: 13, 951 center: new google.maps.LatLng(locResult[0].geometry.location.lat(), locResult[0].geometry.location.lng()), 952 mapTypeId: google.maps.MapTypeId.ROADMAP 953 }; 954 map = new google.maps.Map(document.getElementById("route-map"), myOptions); 955 marker = new google.maps.Marker({ 956 position: map.getCenter(), 957 map: map, 958 title: coords 959 }); 960 display = new google.maps.DirectionsRenderer({ 961 map: map, 962 draggable: true 963 });
964 return display.setPanel(document.getElementById("route-directions")); 965 }); 966 }; 967 968 calcRoute = function() { 969 var end, request, start; 970 start = document.getElementById('route-start').value; 971 end = document.getElementById('route-end').value; 972 request = { 973 origin: start, 974 destination: end, 975 travelMode: google.maps.DirectionsTravelMode.DRIVING 976 }; 977 return service.route(request, function(response, status) { 978 if (status === google.maps.DirectionsStatus.OK) { 979 return display.setDirections(response); 980 } 981 }); 982 }; 983 984 if (typeof google !== "undefined" && google !== null) { 985 google.maps.event.addDomListener(window, 'load', initializeRoute); 986 } 987 988}).call(this); 989 (function() { 990 var ajaxSearch, busy, current, maxitems, resetSearchStatus, search, search_value; 991 992 busy = false; 993 994 maxitems = 0; 995 996 current = search_value = null; 997 998 $(function() { 999 return search(); 1000 }); 1001 1002 search = function() { 1003 return $('#input-search').keyup(function() { 1004 if ($('#input-search').val().length > 2 && busy === false) { 1005 busy = true; 1006 current = this; 1007 return ajaxSearch(); 1008 } 1009 }); 1010 }; 1011 1012 ajaxSearch = function(field) { 1013 var url; 1014 search_value = $('#input-search').val(); 1015 if (maxitems === 0) { 1016 maxitems = $(current).data('maxitems'); 1017 } 1018 url = '/_ajax?module_name=Search&action=search&type=ajax'; 1019 url += "&value=" + search_value + "&max=" + maxitems; 1020 return $.post(url, function(data) { 1021 var results; 1022 if (data.length > 0 && search_value !== '') { 1023 $('#ajax_results').fadeIn(); 1024 } else { 1025 $('#ajax_results').fadeOut(); 1026 } 1027 if (data.length > 0) { 1028 results = '<ul>'; 1029 $.each(data, function(k, v) { 1030 return results += '<li><a href="/' + v.url + '">' + v.title + '</a></li>'; 1031 }); 1032 results += '</ul>'; 1033 $('#ajax_results').html(results); 1034 } 1035 return setTimeout(function() { 1036 return resetSearchStatus(); 1037 }, 300); 1038 }, 'json'); 1039 }; 1040 1041 resetSearchStatus = function() { 1042 busy = false; 1043 if ($('#input-search').val() !== search_value) { 1044 return ajaxSearch(); 1045 } 1046 }; 1047 1048}).call(this); 1049 (function() { 1050 angular.module('frontend').factory('Member', function($resource) { 1051 return $resource('/rest/member/get'); 1052 }).factory('FormFilled', function($resource) { 1053 return $resource('/rest/form-filled/:id'); 1054 }); 1055 1056}).call(this); 1057 (function() { 1058 $(function() { 1059 var $window, len, maxHeight3, width; 1060 $window = $(window); 1061 $window.scroll(function() { 1062 var $scroll_position, header_height; 1063 $scroll_position = $window.scrollTop(); 1064 if ($scroll_position > 390) { 1065 $('.navigation-bar').addClass('sticky'); 1066 header_height = $('.navigation-bar').innerHeight(); 1067 $('body').css('padding-top', header_height); 1068 $('.navigation-bar').css('z-index', '111'); 1069 } else { 1070 $('body').css('padding-top', '0'); 1071 $('.navigation-bar').removeClass('sticky'); 1072 $('.navigation-bar').css('z-index', '11'); 1073 } 1074 }); 1075 width = $(window).width(); 1076 if (width > 666) { 1077 if ($('.ir-item').length !== 0) { 1078 maxHeight3 = 0; 1079 $('.ir-item').each(function() { 1080 console.log($(this).innerHeight()); 1081 if ($(this).innerHeight() > maxHeight3) { 1082 maxHeight3 = $(this).innerHeight(); 1083 } 1084 }); 1085 $('.ir-item').innerHeight(maxHeight3); 1086 } 1087 if ($('.ir-filter').length !== 0) { 1088 len = $('.ir-reg').height() * 2 + 20; 1089 $('.ir-filter').height(len); 1090 } 1091 } 1092 }); 1093 1094}).call(this); 1095 (function() { 1096 angular.module('frontend').controller('StreetViewCtrl', function($scope, $location) { 1097 var load, panorama, parseURL, prepare, urlPattern; 1098 $scope.settings = streetViewSettings; 1099 urlPattern = /@([-0-9.]+),([-0-9.]+),[0-9]+a,([0-9.]+)y,([0-9.]+)h,([0-9.]+)t\/data=!...!...!...!..(.+?)!/; 1100 parseURL = function(url) { 1101 var match; 1102 match = url.match(urlPattern); 1103 return { 1104 pos: new google.maps.LatLng(match[1], match[2]), 1105 pano: match[6], 1106 heading: parseInt(match[4]), 1107 pitch: parseFloat(match[5] - 90), 1108 zoom: parseFloat((match[3] * -1 + 15) / 37.5 + 2.2) 1109 }; 1110 }; 1111 prepare = function(positions) { 1112 return _.map(positions, function(pos) { 1113 pos.url = pos.values.url.value; 1114 pos.pov = parseURL(pos.url); 1115 return pos; 1116 }); 1117 }; 1118 $scope.open = function($event, p) { 1119 var options; 1120 if ($event) { 1121 $event.preventDefault(); 1122 } 1123 options = { 1124 pov: { 1125 heading: p.pov.heading, 1126 pitch: p.pov.pitch 1127 }, 1128 pano: p.pov.pano, 1129 zoom: p.pov.zoom 1130 }; 1131 panorama.setOptions(options); 1132 return $scope.active = p.id; 1133 }; 1134 $scope.positions = prepare(streetViewData); 1135 panorama = null; 1136 load = function() { 1137 var panoCanvas, panoOptions, position; 1138 panoOptions = { 1139 zoomControl: true, 1140 addressControl: false, 1141 disableDefaultUI: false, 1142 panControl: false, 1143 mode: 'html5' 1144 }; 1145 panoCanvas = document.getElementById('pano-canvas'); 1146 panorama = new google.maps.StreetViewPanorama(panoCanvas, panoOptions); 1147 position = _.find($scope.positions, function(p) { 1148 return streetViewPosition === parseInt(p.id); 1149 }); 1150 if (!position) { 1151 position = $scope.positions[0]; 1152 } 1153 return $scope.$apply(function() { 1154 return $scope.open(null, position); 1155 }); 1156 }; 1157 $scope.getMarkerStyle = function(position) { 1158 var x, y; 1159 x = position.values.x.value; 1160 y = position.values.y.value; 1161 return { 1162 left: "" + (x / $scope.settings.map.width * 100) + "%", 1163 top: "" + (y / $scope.settings.map.height * 100) + "%" 1164 }; 1165 }; 1166 return google.maps.event.addDomListener(window, 'load', load); 1167 }); 1168 1169 angular.module('frontend').directive('streetViewMap', function($window) { 1170 var margin, smallSize; 1171 margin = 20; 1172 smallSize = .2; 1173 return { 1174 restrict: 'A', 1175 link: function(scope, elem, attrs, ctrl) { 1176 var img, isBig, recalc, setBig, setSmall, win; 1177 img = win = isBig = null; 1178 recalc = function() { 1179 img = { 1180 w: scope.settings.map.width, 1181 h: scope.settings.map.height, 1182 r: this.w / this.h 1183 }; 1184 img.r = img.w / img.h; 1185 win = { 1186 w: $window.innerWidth - 2 * margin, 1187 h: $window.innerHeight - 2 * margin 1188 }; 1189 win.r = win.w / win.h; 1190 if (isBig) { 1191 return setBig(); 1192 } else { 1193 return setSmall(); 1194 } 1195 }; 1196 setSmall = function() { 1197 var factor, right, top; 1198 elem.css('bottom', margin + 'px'); 1199 elem.css('left', margin + 'px'); 1200 if (win.r > img.r) { 1201 factor = win.h / img.h; 1202 } else { 1203 factor = win.w / img.w; 1204 } 1205 factor *= smallSize; 1206 top = win.h - img.h * factor; 1207 right = win.w - img.w * factor; 1208 elem.css('top', top + 'px'); 1209 elem.css('right', right + 'px'); 1210 elem.removeClass('big'); 1211 return isBig = false;
1212 }; 1213 setBig = function() { 1214 var h, offset, w; 1215 if (win.r > img.r) { 1216 h = win.h; 1217 w = img.w * win.h / img.h; 1218 offset = (win.w - w) / 2 + margin; 1219 elem.css('left', offset + 'px'); 1220 elem.css('right', offset + 'px'); 1221 elem.css('top', margin + 'px'); 1222 elem.css('bottom', margin + 'px'); 1223 } else { 1224 w = win.w; 1225 h = img.h * win.w / img.w; 1226 offset = (win.h - h) / 2 + margin; 1227 elem.css('top', offset + 'px'); 1228 elem.css('bottom', offset + 'px'); 1229 elem.css('left', margin + 'px'); 1230 elem.css('right', margin + 'px'); 1231 } 1232 elem.addClass('big'); 1233 return isBig = true; 1234 }; 1235 elem.on('click', function() { 1236 if (isBig) { 1237 return setSmall(); 1238 } else { 1239 return setBig(); 1240 } 1241 }); 1242 angular.element($window).bind('resize', recalc); 1243 return recalc(); 1244 } 1245 }; 1246 }); 1247 1248}).call(this); 1249 (function() { 1250 angular.module('frontend').controller('SurveyCtrl', function($scope, $http, $sce) { 1251 var prepare; 1252 prepare = function(survey) { 1253 var answer, highest, max, q, score, _i, _j, _len, _len1, _ref, _ref1; 1254 score = max = 0; 1255 _ref = survey.questions; 1256 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1257 q = _ref[_i]; 1258 q.question = $sce.trustAsHtml(q.question); 1259 highest = 0; 1260 _ref1 = q.answers; 1261 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 1262 answer = _ref1[_j]; 1263 answer.score = parseInt(answer.score); 1264 if (answer.answered && answer.answered.length) { 1265 q.answer = answer; 1266 score += answer.score; 1267 } 1268 highest = Math.max(highest, answer.score); 1269 } 1270 max += highest; 1271 } 1272 $scope.maxScore = max; 1273 $scope.score = score; 1274 return $scope.survey = survey; 1275 }; 1276 prepare(surveyData); 1277 $scope.recalcScore = function() { 1278 var q, score, _i, _len, _ref; 1279 score = 0; 1280 _ref = $scope.survey.questions; 1281 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1282 q = _ref[_i]; 1283 if (q.answer) { 1284 score += q.answer.score; 1285 } 1286 } 1287 return $scope.score = score; 1288 }; 1289 $scope.getScorePct = function() { 1290 var decimals, factor, pct; 1291 decimals = 1; 1292 factor = Math.pow(10, decimals); 1293 pct = $scope.score / $scope.maxScore * 100; 1294 pct = Math.round(pct * factor) / factor; 1295 return pct + '%'; 1296 }; 1297 return $scope.submit = function() { 1298 var url; 1299 url = "/rest/survey/" + $scope.survey.id; 1300 return $http.post(url, $scope.survey).then(function() { 1301 var elem; 1302 elem = $('.survey-saved'); 1303 elem.show(); 1304 return setTimeout(function() { 1305 return elem.fadeOut(); 1306 }, 2000); 1307 }); 1308 }; 1309 }); 1310 1311}).call(this); 1312 (function() { 1313 angular.module('frontend').factory('Cart', function($resource) { 1314 return $resource('/rest/webshop-cart/get'); 1315 }); 1316 1317 angular.module('frontend').controller('CartCtrl', function($scope, Cart) { 1318 var extraTimeout, updateCart, updateTimer, updateVAT; 1319 $scope.loading = true; 1320 extraTimeout = null; 1321 $scope.cart = Cart.get({ 1322 action: 'get' 1323 }, function(cart) { 1324 $scope.incl_vat = cart.incl_vat; 1325 if ($scope.incl_vat) { 1326 $scope.priceKey = 'incl'; 1327 } else { 1328 $scope.priceKey = 'excl'; 1329 } 1330 cart.handling = cart.handlings[cart.handling]; 1331 cart.payment = cart.payments[cart.payment]; 1332 if (cart.products.length === 0) { 1333 cart.products = {}; 1334 } 1335 return $scope.loading = false; 1336 }); 1337 $scope.count = function() { 1338 var i, product, ret, _, _ref; 1339 ret = 0; 1340 _ref = $scope.cart.products; 1341 for (_ in _ref) { 1342 product = _ref[_]; 1343 i = parseInt(product.count); 1344 if (i > -1) { 1345 ret += i; 1346 } 1347 } 1348 return ret; 1349 }; 1350 $scope.empty = function() { 1351 return $.isEmptyObject($scope.cart.products); 1352 }; 1353 $scope.isInCart = function(id) { 1354 var product, _, _ref; 1355 _ref = $scope.cart.products; 1356 for (_ in _ref) { 1357 product = _ref[_]; 1358 if (parseInt(product.product_id) === id) { 1359 return product.count; 1360 } 1361 } 1362 return 0; 1363 }; 1364 $scope["delete"] = function(id) { 1365 var params; 1366 $scope.loading = true; 1367 params = { 1368 product: id 1369 }; 1370 Cart.save({ 1371 action: 'delete' 1372 }, params, function(cart) { 1373 updateCart(cart); 1374 return $scope.loading = false;
1375 }); 1376 return $scope.cart.products = _.filter($scope.cart.products, function(p) { 1377 return p.id !== id; 1378 }); 1379 }; 1380 updateTimer = null; 1381 $scope.update = function(id) { 1382 clearTimeout(updateTimer); 1383 return updateTimer = setTimeout(function() { 1384 var params; 1385 $scope.$apply(function() { 1386 return $scope.loading = true; 1387 }); 1388 params = { 1389 product: id, 1390 count: $scope.cart.products[id].count 1391 }; 1392 if (!params.count) { 1393 return; 1394 } 1395 return Cart.save({ 1396 action: 'update' 1397 }, params, function(cart) { 1398 updateCart(cart); 1399 return $scope.loading = false; 1400 }); 1401 }, 300); 1402 }; 1403 $scope.add = function(id) { 1404 var params; 1405 $scope.loading = true; 1406 params = { 1407 id: id, 1408 options: $scope.options, 1409 count: $scope.count[id] || 1 1410 }; 1411 return Cart.save({ 1412 action: 'add' 1413 }, params, function(cart) { 1414 updateCart(cart, ['total', 'vats', 'products']); 1415 return $scope.loading = false; 1416 }); 1417 }; 1418 $scope.del = function(pid, callback) { 1419 var product, _, _ref; 1420 if (callback == null) { 1421 callback = function() {}; 1422 } 1423 _ref = $scope.cart.products; 1424 for (_ in _ref) { 1425 product = _ref[_]; 1426 if (parseInt(product.product_id) === pid) { 1427 $scope["delete"](product.id); 1428 return; 1429 } 1430 } 1431 }; 1432 $scope.options = {}; 1433 updateCart = function(cart, keys) { 1434 var key, _i, _len, _results; 1435 if (keys == null) { 1436 keys = ['total', 'total_discount', 'discount', 'vats']; 1437 } 1438 _results = []; 1439 for (_i = 0, _len = keys.length; _i < _len; _i++) { 1440 key = keys[_i]; 1441 $scope.cart[key] = cart[key]; 1442 if (key === 'vats') { 1443 _results.push(updateVAT()); 1444 } else { 1445 _results.push(void 0); 1446 } 1447 } 1448 return _results; 1449 }; 1450 $scope.$watch('cart.handling.id', function(newVal, oldVal) { 1451 if (!newVal) { 1452 return; 1453 } 1454 return updateVAT(); 1455 }); 1456 $scope.vats = []; 1457 updateVAT = function() { 1458 var cost, handling, vat; 1459 if (!$scope.cart) { 1460 return; 1461 } 1462 $scope.vats = angular.copy($scope.cart.vats); 1463 cost = $scope.getHandlingCost(); 1464 if (cost === 0) { 1465 return; 1466 } 1467 handling = $scope.cart.handling; 1468 cost = handling.cost * handling.vat / 100; 1469 vat = _.find($scope.vats, function(v) { 1470 return v.pct === handling.vat; 1471 }); 1472 if (vat) { 1473 return vat.value += cost; 1474 } else { 1475 return $scope.vats.push({ 1476 pct: handling.vat, 1477 value: cost 1478 }); 1479 } 1480 }; 1481 $scope.getHandlingCost = function(type) { 1482 var factor, handling, total; 1483 if (!$scope.cart.handling) { 1484 return 0; 1485 } 1486 handling = $scope.cart.handling; 1487 if (handling.free_above !== null) { 1488 total = $scope.cart.total_discount[$scope.priceKey]; 1489 if (total >= handling.free_above) { 1490 return 0; 1491 } 1492 } 1493 if (type === 'excl') { 1494 return handling.cost; 1495 } else { 1496 factor = 1 + handling.vat / 100; 1497 return handling.cost * factor; 1498 } 1499 }; 1500 $scope.getPaymentCost = function(type) { 1501 if (!$scope.cart.payment) { 1502 return 0; 1503 } 1504 return $scope.cart.payment.cost; 1505 }; 1506 $scope.getTotalExcl = function() { 1507 if (!$scope.cart || !$scope.cart.total) { 1508 return; 1509 } 1510 return $scope.cart.total_discount.excl + $scope.getHandlingCost('excl') + $scope.getPaymentCost('excl'); 1511 }; 1512 $scope.getTotalIncl = function() { 1513 if (!$scope.cart || !$scope.cart.total) { 1514 return; 1515 } 1516 return $scope.cart.total_discount.incl + $scope.getHandlingCost('incl') + $scope.getPaymentCost('incl'); 1517 }; 1518 return $scope.setDiscountCode = function(code, refresh) { 1519 var params; 1520 if (refresh == null) { 1521 refresh = false; 1522 } 1523 params = { 1524 code: code 1525 }; 1526 return Cart.save({ 1527 action: 'setDiscountCode' 1528 }, params, function(cart) { 1529 if (refresh) { 1530 return document.location.reload(); 1531 } else { 1532 return updateCart(cart); 1533 } 1534 }, function(res) { 1535 return alert(JSON.parse(res.data)); 1536 }); 1537 }; 1538 }); 1539 1540}).call(this); 1541 (function() { 1542 angular.module('frontend').directive('decimalSlider', function() { 1543 return { 1544 restrict: 'A', 1545 require: 'ngModel', 1546 link: function(scope, elem, attrs, ctrl) { 1547 var debounce, max, min, slider; 1548 slider = $(elem); 1549 min = parseFloat(attrs.min); 1550 max = parseFloat(attrs.max); 1551 debounce = null; 1552 slider.slider({ 1553 step: 1, 1554 range: true, 1555 min: min, 1556 max: max, 1557 values: [min, max], 1558 slide: function(event, ui) { 1559 clearTimeout(debounce); 1560 return debounce = setTimeout(function() { 1561 return ctrl.$setViewValue(ui.values); 1562 }, 200); 1563 } 1564 }); 1565 return ctrl.$render = function() { 1566 return slider.slider('values', ctrl.$viewValue); 1567 }; 1568 } 1569 }; 1570 }); 1571 1572 angular.module('frontend').factory('Category', function($resource) { 1573 return $resource('/rest/category/:id', { 1574 id: '@id' 1575 }); 1576 }); 1577 1578 angular.module('frontend').factory('WebshopCategory', function($resource) { 1579 return $resource('/rest/webshop-category/:id', { 1580 id: '@id' 1581 }); 1582 }); 1583 1584 angular.module('frontend').controller('CategoryFilterCtrl', function($scope, $location, $compile, $injector) { 1585 var Category, params, productsEl, slideTimeout, t, valuesFromURL, valuesToURL; 1586 t = function(term) { 1587 return term; 1588 }; 1589 $scope.loading = true; 1590 $scope.id = $('#category').data('id'); 1591 $scope.type = $('#category').data('type'); 1592 if (!$scope.id || !$scope.type) { 1593 console.log('No element "#category" with [data-id] found.'); 1594 return; 1595 } 1596 Category = $injector.get($scope.type); 1597 params = $location.search(); 1598 params.info = 'filters'; 1599 params.id = $scope.id; 1600 Category.get(params, { 1601 id: $scope.id 1602 }, function(data) { 1603 var f, _i, _len, _ref; 1604 _ref = data.filters; 1605 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1606 f = _ref[_i]; 1607 f.v = {}; 1608 if (f.type === 'Checkbox') { 1609 f.mode = 0; 1610 } else if (f.type === 'Decimal') { 1611 f.v = [f.min, f.max]; 1612 } else if (f.type === 'DateRange') { 1613 f.min = new Date(f.min * 1000); 1614 f.max = new Date(f.max * 1000); 1615 } 1616 } 1617 filters.page = 1; 1618 $scope.filters = data.filters; 1619 $scope.options = data.options; 1620 valuesFromURL(); 1621 return $scope.loading = false;
1622 }); 1623 $scope.reset = function() { 1624 return $location.search({}); 1625 }; 1626 $scope.applyFilter = function(resetPage) { 1627 if (resetPage == null) { 1628 resetPage = true; 1629 } 1630 if (resetPage) { 1631 $scope.filters.page = 1; 1632 } 1633 return $location.search(valuesToURL($scope.filters)); 1634 }; 1635 valuesFromURL = function() { 1636 var filter, label, loc, search, values, _i, _len, _ref, _results; 1637 loc = $location.search(); 1638 search = t('zoeken'); 1639 if (search in loc) { 1640 $scope.filters.search = loc[search]; 1641 } else { 1642 $scope.filters.search = ''; 1643 } 1644 _ref = $scope.filters; 1645 _results = []; 1646 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1647 filter = _ref[_i]; 1648 label = filter.slug; 1649 values = label in loc ? loc[label].split('--') : []; 1650 if (filter.type === 'Decimal') { 1651 if (values.length === 2) { 1652 filter.v = [parseInt(values[0]), parseInt(values[1])]; 1653 } else { 1654 filter.v = [filter.min, filter.max]; 1655 } 1656 } 1657 if (filter.type === 'DateRange') { 1658 if (values.length === 2) { 1659 filter.v = [new Date(1000 * parseInt(values[0])), new Date(1000 * parseInt(values[1]))]; 1660 if (filter.v[0] >= filter.v[1]) { 1661 filter.v[1] = null; 1662 } 1663 } else { 1664 filter.v = [filter.min, null]; 1665 } 1666 } 1667 if (filter.type === 'Select') { 1668 filter.v = {}; 1669 if (values.length > 1) { 1670 filter.mode = values.shift(); 1671 } 1672 } 1673 if (filter.type === 'Checkbox') { 1674 if (values.length) { 1675 _results.push(filter.v = values[0]); 1676 } else { 1677 _results.push(filter.v = 'all'); 1678 } 1679 } else { 1680 _results.push(void 0); 1681 } 1682 } 1683 return _results; 1684 }; 1685 productsEl = $('#filtered-products'); 1686 $scope.$on('$locationChangeSuccess', function(event, newLoc, oldLoc) { 1687 if (!$scope.filters) { 1688 return; 1689 } 1690 $scope.loading = true; 1691 params = angular.copy($location.search()); 1692 params.id = $scope.id; 1693 params.info = 'filtered'; 1694 valuesFromURL(); 1695 return Category.get(params, function(data) { 1696 var html; 1697 html = $compile(data.html)($scope); 1698 productsEl.html(html); 1699 $scope.options = data.options; 1700 return $scope.loading = false; 1701 }); 1702 }); 1703 valuesToURL = function(filters) { 1704 var filter, from, key, label, ret, search, to, val, vals, _i, _len, _ref; 1705 ret = {}; 1706 search = t('zoeken'); 1707 if (filters.search) { 1708 ret[search] = filters.search; 1709 } 1710 for (key in filters) { 1711 filter = filters[key]; 1712 label = filter.slug; 1713 if (filter.type === 'Decimal' && (filter.v[0] !== filter.min || filter.v[1] !== filter.max)) { 1714 ret[label] = "" + filter.v[0] + "--" + filter.v[1]; 1715 } 1716 if (filter.type === 'Select') { 1717 vals = []; 1718 _ref = filter.values; 1719 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1720 val = _ref[_i]; 1721 if (val.id in filter.v && filter.v[val.id]) { 1722 vals.push(val.slug); 1723 } 1724 } 1725 if (vals.length) { 1726 ret[label] = vals.sort().join('--'); 1727 } 1728 } 1729 if (filter.type === 'Checkbox') { 1730 if (filter.v !== 'all') { 1731 ret[label] = filter.v; 1732 } 1733 } 1734 if (filter.type === 'DateRange' && filter.v[0] && filter.v[1]) { 1735 from = Math.round(filter.v[0].getTime() / 1000); 1736 to = Math.round(filter.v[1].getTime() / 1000); 1737 ret[label] = "" + from + "--" + to; 1738 } 1739 } 1740 if (filters.page > 1) { 1741 ret.page = filters.page; 1742 } 1743 return ret; 1744 }; 1745 slideTimeout = null; 1746 $scope.$on('sliderChanged', function(event, filter, values) { 1747 clearTimeout(slideTimeout); 1748 return slideTimeout = setTimeout(function() { 1749 return $scope.$apply(function() { 1750 filter.v = values; 1751 return $scope.applyFilter(); 1752 }); 1753 }, 250); 1754 }); 1755 $('#filtered-products').on('click', 'div#nav a', function(e) { 1756 var page; 1757 e.preventDefault(); 1758 page = $(this).attr('href').substring(6); 1759 return $scope.$apply(function() { 1760 $scope.filters.page = page; 1761 return $scope.applyFilter(false); 1762 }); 1763 }); 1764 return $scope.getOptionCount = function(id) { 1765 if (!$scope.options || !$scope.options[id]) { 1766 return 0; 1767 } 1768 return parseInt($scope.options[id]); 1769 }; 1770 }); 1771 1772}).call(this); 1773 (function() { 1774 var addProduct, deleteProduct, form; 1775 1776 form = null; 1777 1778 addProduct = function(e) { 1779 var $this, id, url; 1780 e.preventDefault(); 1781 $this = $(this); 1782 id = $this.data('id'); 1783 url = "/_ajax?module_name=Webshop&action=cartAddProduct"; 1784 return $.get(url, { 1785 id: id 1786 }, function(cart) { 1787 return updateCart(cart); 1788 }); 1789 }; 1790 1791 deleteProduct = function(e) { 1792 var $this, id, url; 1793 e.preventDefault(); 1794 $this = $(this); 1795 id = $this.parents('.product').data('id'); 1796 url = "/_ajax?module_name=Webshop&action=cartDeleteProduct"; 1797 return $.get(url, { 1798 id: id 1799 }, function(cart) { 1800 return updateCart(cart); 1801 }); 1802 }; 1803 1804 $(function() { 1805 return $('table#orders tr.order').click(function() { 1806 var $this, id; 1807 $this = $(this); 1808 id = $this.data('id'); 1809 return document.location.href += "?id=" + id; 1810 }); 1811 }); 1812 1813}).call(this); 1814 (function() { 1815 angular.module('frontend').factory('Order', function($resource) { 1816 return $resource('/rest/webshop-order'); 1817 }); 1818 1819 angular.module('frontend').controller('OrderCtrl', function($scope, Order, Member) { 1820 $scope.loading = true; 1821 $scope.isOrder = true; 1822 $scope.member = Member.get({}, function(member) { 1823 return $scope.loading = false;
1824 }); 1825 return $scope.submit = function() { 1826 var order; 1827 order = { 1828 member: $scope.member, 1829 cart: $scope.cart 1830 }; 1831 return Order.save(order, function(result) { 1832 return location.href += "/view?id=" + result.id; 1833 }, function(result) { 1834 var key, m, message, msg, name, _i, _len, _ref; 1835 if (result.status === 400) { 1836 message = ''; 1837 _ref = result.data; 1838 for (name in _ref) { 1839 msg = _ref[name]; 1840 if (name === 'profile') { 1841 for (key in msg) { 1842 m = msg[key]; 1843 message += "" + m.message + "\n"; 1844 } 1845 } else if (name === 'stock') { 1846 for (_i = 0, _len = msg.length; _i < _len; _i++) { 1847 m = msg[_i]; 1848 message += "" + m.message + "\n"; 1849 $scope.cart.products[m.id].count = m.max; 1850 } 1851 } else { 1852 message += "" + msg + "\n"; 1853 } 1854 } 1855 return alert(message); 1856 } 1857 }); 1858 }; 1859 }); 1860 1861}).call(this);
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.