1$(document).ready(function (e) { 2 3 var eventRequestUri; 4 var eventDirectUri; 5 6 $('.event-preview-mode').on('click', '.event-single-linkwrap', function (e) { 7 return false; 8 }); 9 10 $('.event-preview-mode').on('click', '.event-single', function (e) { 11 if (!$(e.target).is(".fa-sticky-note-o,.fa-trash-o")) { 12 eventRequestUri = jQuery(this).attr('data-ajaxUri'); 13 eventDirectUri = jQuery(this).attr('data-url'); 14 $('#event-preview-modal').modal('show'); 15 } 16 }); 17 18 $('.event-subscriptions').on('click', '.event-preview-link', function (e) { 19 e.preventDefault(); 20 console.log($(this).attr('data-ajaxUri')); 21 22 if (!$(e.target).is(".fa-sticky-note-o,.fa-trash-o")) { 23 eventRequestUri = $(this).attr('data-ajaxUri'); 24 $('#event-preview-modal').modal('show'); 25 } 26 }); 27 28 29 // modal events for opening and closing 30 $('#event-preview-modal').on('shown.bs.modal', function () { 31 $('#event-preview-modal .modal-body').html('<div class="loader text-center"><i class="fa fa-spinner" aria-hidden="true"></i> loading </div>'); 32 $.ajax({
33 url: eventRequestUri, 34 method: 'post', 35 params: {}, 36 success: function (response) { 37 $('#event-preview-modal .modal-body').html(response.content); 38 window.history.pushState(null, response.title, eventDirectUri); 39 }, 40 cache: false, 41 dataType: 'json' 42 }); 43 }); 44 $('#event-preview-modal').on('hidden.bs.modal', function () { 45 $('#event-preview-modal .modal-body').html(''); 46 window.history.back(); 47 48 }); 49 50 $('.event-categories').focus('select', function () { 51 $(this).find('select').toggle(); 52 }); 53 54 55 56 $('.event-reset').on('click', function () { 57 $('.event-categories select, .event-date-type select').prop('selectedIndex', 0); 58 $('.fortbildung, .wettkaempfe, .sitzungen, .turnsportarten').addClass('hidden'); 59 }); 60 61 62 63 $('#event-preview-modal').on('click', '.subscribe', function (e) { 64 65 e.preventDefault(); 66 67 $(this).addClass("done").html('<i class="fa fa-heart"></i> gespeichert'); 68 // $(this).text("gespeichert!"); 69 // $(".downloadCalendar div.text span").text("heruntergeladen!"); 70 71 $.ajax({
72 url: $(this).attr('data-ajaxUri'), 73 method: 'post', 74 params: {}, 75 success: function (response) { 76 console.log(response); 77 }, 78 complete: function () { 79 }, 80 cache: false, 81 dataType: 'json' 82 }); 83 84 }); 85 86 87 $(".event-filter--first-level, .event-filter--second-level").mCustomScrollbar(); 88 89 /* 90 * Filter actions 91 */ 92 93 $('.event-preview-mode').on('click', '.event-filter__trigger', function () { 94 $('.event-filter-wrap, .event-filter--first-level, .event-filter--second-level').addClass('open'); 95 }); 96 97 $('.event-filter__close').click(function () { 98 $('.event-filter-wrap, .event-filter--first-level, .event-filter--second-level').removeClass('open'); 99 }); 100 101 $('.event-filter__preselection .event-filter__selected').each(function (index) { 102 var filterToAdd = $(this).data('key'); 103 $('input[value='+ filterToAdd +']').prop('checked', true); 104 105 if ($('[name="tx_events_standard[section][]"]:checked').length > 1) { 106 $('.checkbox__all-sections').prop('checked', false); 107 } 108 109 if ($('[name="tx_events_standard[type][]"]:checked').length > 1) { 110 $('.checkbox__all-types').prop('checked', false); 111 } 112 113 if ($('.event-filter__bereiche__turnsportarten input:checked').length == 0) { 114 $('.toggle--submenu-turnsportarten').prop('checked', false); 115 } else { 116 $('.toggle--submenu-turnsportarten').prop('checked', true); 117 } 118 119 if ($('.event-filter__bereiche__gymwelt input:checked').length == 0) { 120 $('.toggle--submenu-gymwelt').prop('checked', false); 121 } else { 122 $('.toggle--submenu-gymwelt').prop('checked', true); 123 } 124 125 if ($('.event-filter__bereiche__kinderturnen input:checked').length == 0) { 126 $('.toggle--submenu-kinderturnen').prop('checked', false); 127 } else { 128 $('.toggle--submenu-kinderturnen').prop('checked', true); 129 } 130 131 132 setHiddenFilters(); 133 134 }); 135 136 // toggle filter submenus 137 $('.checkmark__container--submenu').on('click', function (e) { 138 e.preventDefault(); 139 140 target = $(this).data('submenu-target'); 141 if ($(target).hasClass('active')) { 142 $(target).removeClass('active'); 143 $('.event-filter-wrap').removeClass('subfilter--active'); 144 145 } else { 146 $('.event-filter--second-level__item.active').removeClass('active'); 147 $(target).addClass('active'); 148 $('.event-filter-wrap').addClass('subfilter--active'); 149 } 150 }); 151 // toggle filter submenus 152 $('.checkmark__container--close-submenu, .event-categories__types input').on('click', function (e) { 153 $('.event-filter-wrap').removeClass('subfilter--active'); 154 $('.event-filter--second-level__item.active').removeClass('active'); 155 }); 156 157 158 159 /* 160 * Build values of currently selected values 161 */ 162 function setHiddenFilters() { 163 var valSections = []; 164 $('[name="tx_events_standard[section][]"]:checked').each(function (i) { 165 valSections[i] = $(this).val(); 166 }); 167 $('#form-section').val(valSections.join(',')) 168 169 var valTypes = []; 170 $('[name="tx_events_standard[type][]"]:checked').each(function (i) { 171 valTypes[i] = $(this).val(); 172 }); 173 $('#form-type').val(valTypes.join(',')) 174 } 175 176 /* 177 * Reset section with submenus 178 */ 179 function resetSubmenuSection() { 180 if ($('.event-categories__sections input:checked').length === 0) { 181 $('.checkbox__all-sections').prop('checked', true); 182 } 183 } 184 185 186 /* 187 * Selection of 'all' items 188 */ 189 $('.checkbox__all-sections').on('change', function () { 190 if ($(this).prop('checked')) { 191 $('.event-categories__sections input:not(.checkbox__all-sections)').prop('checked', false); 192 $('.event-filter--second-level__item.active').removeClass('active'); 193 $('.event-filter__bereiche__turnsportarten input').prop('checked', false); 194 $('.event-filter__bereiche__gymwelt input').prop('checked', false); 195 $('.event-filter__bereiche__kinderturnen input').prop('checked', false); 196 setHiddenFilters(); 197 } 198 199 if ($('.event-categories__sections input:checked').length === 0) { 200 $('.checkbox__all-sections').prop('checked', true); 201 } 202 });
203 $('.event-categories__sections input:not(.checkbox__all-sections)').on('change', function () { 204 $('.checkbox__all-sections').prop('checked', false); 205 206 if ($('.event-categories__sections input:checked').length === 0) { 207 $('.checkbox__all-sections').prop('checked', true); 208 } 209 210 setHiddenFilters(); 211 }); 212 213 $('.event-filter__bereiche__turnsportarten input').on('change', function () { 214 if ($('.event-filter__bereiche__turnsportarten input:checked').length === 0) { 215 $('.toggle--submenu-turnsportarten').prop('checked', false); 216 } else { 217 $('.toggle--submenu-turnsportarten').prop('checked', true); 218 $('.checkbox__all-sections').prop('checked', false); 219 } 220 setHiddenFilters(); 221 resetSubmenuSection(); 222 }); 223 $('.event-filter__bereiche__gymwelt input').on('change', function () { 224 if ($('.event-filter__bereiche__gymwelt input:checked').length == 0) { 225 $('.toggle--submenu-gymwelt').prop('checked', false); 226 } else { 227 $('.toggle--submenu-gymwelt').prop('checked', true); 228 $('.checkbox__all-sections').prop('checked', false); 229 230 } 231 setHiddenFilters(); 232 resetSubmenuSection(); 233 }); 234 $('.event-filter__bereiche__kinderturnen input').on('change', function () { 235 if ($('.event-filter__bereiche__kinderturnen input:checked').length == 0) { 236 $('.toggle--submenu-kinderturnen').prop('checked', false); 237 } else { 238 $('.toggle--submenu-kinderturnen').prop('checked', true); 239 $('.checkbox__all-sections').prop('checked', false); 240 241 } 242 setHiddenFilters(); 243 resetSubmenuSection(); 244 }); 245 246 247 $('.checkbox__all-types').on('change', function () { 248 if ($(this).prop('checked')) { 249 $('.event-categories__types input:not(.checkbox__all-types)').prop('checked', false); 250 $('.event-filter--second-level__item.active').removeClass('active'); 251 setHiddenFilters(); 252 } 253 254 if ($('.event-categories__types input:checked').length === 0) { 255 $('.checkbox__all-types').prop('checked', true); 256 } 257 258 }); 259 $('.event-categories__types input:not(.checkbox__all-types)').on('change', function () { 260 $('.checkbox__all-types').prop('checked', false); 261 262 if ($('.event-categories__types input:checked').length === 0) { 263 $('.checkbox__all-types').prop('checked', true); 264 } 265 266 setHiddenFilters(); 267 }); 268 269 270 $('.event-filter__button-zuruecksetzen').on('click', function (e) { 271 e.preventDefault(); 272 $(this).closest('.event-filter--second-level__item').find('input').prop('checked', false); 273 if ($(this).closest('.event-filter--second-level__item').hasClass('event-filter__bereiche__turnsportarten')) { 274 $('.toggle--submenu-turnsportarten').prop('checked', false); 275 if ($('[name="tx_events_standard[section][]"]:checked').length == 0) { 276 $('.checkbox__all-sections').prop('checked', true); 277 } 278 } 279 if ($(this).closest('.event-filter--second-level__item').hasClass('event-filter__bereiche__gymwelt')) { 280 $('.toggle--submenu-gymwelt').prop('checked', false); 281 if ($('[name="tx_events_standard[section][]"]:checked').length == 0) { 282 $('.checkbox__all-sections').prop('checked', true); 283 } 284 } 285 if ($(this).closest('.event-filter--second-level__item').hasClass('event-filter__bereiche__kinderturnen')) { 286 $('.toggle--submenu-kinderturnen').prop('checked', false); 287 if ($('[name="tx_events_standard[section][]"]:checked').length == 0) { 288 $('.checkbox__all-sections').prop('checked', true); 289 } 290 } 291 setHiddenFilters(); 292 }); 293 294 295 296 /* 297 * Ajax search actions 298 */ 299 $('.event-filter-wrap').on('click', '.event-submit', function (e) { 300 e.preventDefault(); 301 302 $('.event-filter--message').text('Veranstaltungen werden gesucht'); 303 304 var parameters = {}; 305 parameters['tx_events_standard[searchstring]'] = $('#mySearch').val(); 306 parameters['tx_events_standard[section]'] = $('#form-section').val(); 307 parameters['tx_events_standard[type]'] = $('#form-type').val(); 308 parameters['tx_events_standard[start_date]'] = $('#form-start_date').val(); 309 parameters['tx_events_standard[end_date]'] = $('#form-end_date').val(); 310 parameters['tx_events_standard[location]'] = $('#form-location').val(); 311 parameters['tx_events_standard[offset]'] = 0; 312 313 $.ajax({
314 url: $('.event-filter-wrap').attr('data-ajaxUri'), 315 method: 'post', 316 data: parameters, 317 timeout: 2000, 318 success: function (response) { 319 320 setTimeout(function () { 321 $('.event-preview-mode').html(response.template); 322 $('.event-filter-wrap, .event-filter--first-level, .event-filter--second-level').removeClass('open'); 323 $('.event-filter--second-level__item.active').removeClass('active'); 324 $('.event-filter--message').text(''); 325 326 327 $('.event-list-more button').data('offset', 10); 328 $('.event-list-more button').data('maxevents', response.maxEvents); 329 330 if (response.maxEvents <= 10) { 331 $('.event-list-more button').hide(); 332 } else { 333 $('.event-list-more button').show(); 334 } 335 }, 1000); // 336 337 338 }, 339 complete: function () { 340 341 }, 342 cache: false, 343 dataType: 'json' 344 }); 345 346 }); 347 348 $('.event-preview-mode').on('click', '.event-filter__selected', function () { 349 350 var filterToRemove = $(this).data('key'); 351 var matrix = $(this).data('matrix'); 352 if (filterToRemove == 'searchstring') { 353 $('input[name="tx_events_standard[searchstring]"]').val(''); 354 } else if (filterToRemove == 'location') { 355 $('input[name="tx_events_standard[location]"]').val(''); 356 } else if (filterToRemove == 'start_date') { 357 $('input[name="tx_events_standard[start_date]"]').val(''); 358 } else if (filterToRemove == 'end_date') { 359 $('input[name="tx_events_standard[end_date]"]').val(''); 360 } else if (filterToRemove == 'combined_date') { 361 $('input[name="tx_events_standard[start_date]"]').val(''); 362 $('input[name="tx_events_standard[end_date]"]').val(''); 363 } else { 364 $('input[value='+ filterToRemove +']').prop('checked', false); 365 } 366 367 if (matrix) { 368 $('input[name="tx_events_standard[searchstring]"]').val(''); 369 } 370 371 if ($('.event-filter__bereiche__turnsportarten input:checked').length == 0) { 372 $('.toggle--submenu-turnsportarten').prop('checked', false); 373 } 374 if ($('.event-filter__bereiche__gymwelt input:checked').length == 0) { 375 $('.toggle--submenu-gymwelt').prop('checked', false); 376 } 377 if ($('.event-filter__bereiche__kinderturnen input:checked').length == 0) { 378 $('.toggle--submenu-kinderturnen').prop('checked', false); 379 } 380 381 if ($('[name="tx_events_standard[section][]"]:checked').length == 0) { 382 $('.checkbox__all-sections').prop('checked', true); 383 } 384 if ($('[name="tx_events_standard[type][]"]:checked').length == 0) { 385 $('.checkbox__all-types').prop('checked', true); 386 } 387 388 $('.event-filter--message').text('Veranstaltungen werden gesucht'); 389 $('.event-filter-wrap').addClass('open'); 390 391 392 setHiddenFilters(); 393 394 var parameters = {}; 395 parameters['tx_events_standard[searchstring]'] = $('#mySearch').val(); 396 parameters['tx_events_standard[section]'] = $('#form-section').val(); 397 parameters['tx_events_standard[type]'] = $('#form-type').val(); 398 parameters['tx_events_standard[start_date]'] = $('#form-start_date').val(); 399 parameters['tx_events_standard[end_date]'] = $('#form-end_date').val(); 400 parameters['tx_events_standard[location]'] = $('#form-location').val(); 401 parameters['tx_events_standard[offset]'] = 0; 402 403 $.ajax({
404 url: $('.event-filter-wrap').attr('data-ajaxUri'), 405 method: 'post', 406 data: parameters, 407 timeout: 2000, 408 success: function (response) { 409 410 setTimeout(function () { 411 $('.event-preview-mode').html(response.template); 412 $('.event-filter-wrap, .event-filter--first-level, .event-filter--second-level').removeClass('open'); 413 $('.event-filter--second-level__item.active').removeClass('active'); 414 $('.event-filter--message').text(''); 415 416 $('.event-list-more button').data('offset', 10); 417 $('.event-list-more button').data('maxevents', response.maxEvents); 418 419 if (response.maxEvents <= 10) { 420 $('.event-list-more button').hide(); 421 } else { 422 $('.event-list-more button').show(); 423 } 424 }, 1000); // 425 426 427 }, 428 complete: function () { 429 430 }, 431 cache: false, 432 dataType: 'json' 433 }); 434 435 }); 436 437 438 // modal events for opening and closing 439 $('.event-list-more').on('click', 'button', function () { 440 441 var parameters = {}; 442 parameters['tx_events_standard[searchstring]'] = $('#mySearch').val(); 443 parameters['tx_events_standard[section]'] = $('#form-section').val(); 444 parameters['tx_events_standard[type]'] = $('#form-type').val(); 445 parameters['tx_events_standard[start_date]'] = $('#form-start_date').val(); 446 parameters['tx_events_standard[end_date]'] = $('#form-end_date').val(); 447 parameters['tx_events_standard[location]'] = $('#form-location').val(); 448 parameters['tx_events_standard[offset]'] = $('.event-list-more button').data('offset'); 449 450 $('.event-list-more button').hide(); 451 $('.event-list-more .preloader').show(); 452 453 $.ajax({
454 url: $(this).attr('data-ajaxUri'), 455 method: 'post', 456 data: parameters, 457 success: function (response) { 458 459 setTimeout(function () { 460 $('.event-list-more button').data('offset', parseInt($('.event-list-more button').data('offset')) + 10); 461 $('.event-list-more button').show(); 462 $('.event-list-more .preloader').hide(); 463 $('.event-preview-mode .event-list__container ').append(response); 464 465 if ($('.event-list-more button').data('offset') >= $('.event-list-more button').data('maxevents')) { 466 $('.event-list-more button').hide(); 467 } else { 468 $('.event-list-more button').show(); 469 } 470 471 }, 1000); // 472 473 }, 474 cache: false, 475 dataType: 'json' 476 }); 477 478 }); 479 480 /* 481 * Close filter while clicking on overlay 482 */ 483 $('.event-filter').on('click', '.event-filter-wrap.open .overlay', function (e) { 484 $('.event-filter-wrap, .event-filter--first-level, .event-filter--second-level').removeClass('open'); 485 $('.event-filter--second-level__item.active').removeClass('active'); 486 $('.event-filter--message').text(''); 487 }); 488 489 490}); 491 492
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.