Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

108 Zeilen
2.8 KiB

  1. const $ = require('jquery');
  2. import 'jquery.easing';
  3. class SearchTiles {
  4. constructor(tileWrapper) {
  5. this.tiles = tileWrapper.find('.tile a');
  6. this.tiles.each((i, el) => {
  7. const tile = $(el);
  8. if (tile.text().length > 48) {
  9. tile.text( tile.text().substr(0, 48) + '…' );
  10. }
  11. })
  12. }
  13. }
  14. class ExtendedSearch {
  15. constructor(section) {
  16. this.section = section.addClass('initiated');
  17. $('#search-expand-collapse').on('click', (e) => {
  18. e.preventDefault();
  19. $(e.currentTarget).toggleClass('open');
  20. this.section.stop().slideToggle(500, 'swing');
  21. });
  22. section.find('.ev-search-btn').on('click', (e) => {
  23. e.preventDefault();
  24. $(e.currentTarget).toggleClass('open').next('.ev-filter').stop().slideToggle(400, 'easeOutQuad');
  25. });
  26. section.find('label.acc a').each((i, el) => {
  27. new FormAccordion($(el));
  28. });
  29. section.find('.reset').on('click', (e) => {
  30. e.preventDefault();
  31. const form = $(e.currentTarget).closest('form');
  32. form[0].reset();
  33. form.find('.half-checked').removeClass('half-checked');
  34. $('html, body').animate({
  35. scrollTop: form.offset().top - 120
  36. }, 500, 'easeOutQuad');
  37. });
  38. $('.datepicker').each((i, el) => {
  39. $(el).datepicker({ changeYear: true, changeMonth: true});
  40. });
  41. }
  42. }
  43. class FormAccordion{
  44. constructor(toggle) {
  45. const t = this;
  46. this.toggle = toggle;
  47. this.label = this.toggle.parent('label');
  48. this.checkbox = this.label.prev('input[type="checkbox"]');
  49. this.subs = this.label.next('.ev-filter');
  50. this.toggle.on('click', (e) => {
  51. e.preventDefault();
  52. e.stopPropagation();
  53. this.label.toggleClass('open');
  54. this.subs.stop().slideToggle(400, 'swing');
  55. })
  56. this.subs.find('input[type="checkbox"]').on('change', () => {
  57. this.checkSelection();
  58. })
  59. this.checkbox.on('change', (e) => {
  60. const isChecked = $(e.currentTarget).removeClass('half-checked').prop('checked');
  61. this.subs.find('input[type="checkbox"]').prop('checked', isChecked);
  62. })
  63. this.checkSelection();
  64. }
  65. checkSelection() {
  66. const checked = this.subs.find('input[type="checkbox"]:checked').length;
  67. const unchecked = this.subs.find('input[type="checkbox"]:not(:checked)').length;
  68. if (checked === 0) {
  69. this.checkbox.prop('checked', false).removeClass('half-checked');
  70. }
  71. else if (unchecked === 0) {
  72. this.checkbox.prop('checked', true).removeClass('half-checked');
  73. }
  74. else {
  75. this.checkbox.prop('checked', false).addClass('half-checked');
  76. }
  77. }
  78. }
  79. $('body').on('ihk-init dynamic-component-loaded', function () {
  80. $('.extended-search:not(.initiated)').each(function(i) {
  81. new ExtendedSearch($(this));
  82. });
  83. $('.search:not(.initiated) .tiles').each(function () {
  84. new SearchTiles($(this));
  85. })
  86. })