1var wpcs_theme_division = null; 2var wpcs_theme_tabs = null; 3var wpcs_theme_accordion = null; 4var wpcs_theme_model = null; 5var wpcs_theme_offer_group = null; 6var wpcs_theme = null; 7var wpcs_theme_person = null; 8var wpcs_theme_filter = null; 9 10(function($) { 11 12 $(function() { 13 14 wpcs_theme_division = new WPCSThemeDivision(); 15 16 wpcs_theme_tabs = new WPCSThemeTabs(); 17 18 wpcs_theme_accordion = new WPCSThemeAccordion(); 19 20 wpcs_theme_model = new WPCSThemeModel(); 21 22 wpcs_theme_offer_group = new WPCSThemeOfferGroup(); 23 24 wpcs_theme = new WPCSTheme(); 25 26 wpcs_theme_filter = new WPCSThemeFilter(); 27 28 wpcs_theme_person = new WPCSThemePerson(); 29 30 // Leasing Matrix Logic 31 if ($('.wpcs-leasing-matrix').length) { 32 $('.wpcs-leasing-matrix').each(function() { 33 var container = $(this); 34 var monthSelect = container.find('.leasing-months-select'); 35 var kmSelect = container.find('.leasing-km-select'); 36 var rateDisplay = container.find('.rate-value'); 37 var rateSpinner = container.find('.rate-spinner'); 38 39 function updateLeasingRate() { 40 var vehicleId = container.data('vehicle-id'); 41 var selectedMonths = monthSelect.find('.wpcs_select_value').val(); 42 var selectedKm = kmSelect.find('.wpcs_select_value').val(); 43 44 rateDisplay.hide(); 45 rateSpinner.show(); 46 47 $.post(wpcs_ajax_url, { 48 action: 'wpcs_get_leasing_rate', 49 vehicle_id: vehicleId, 50 months: selectedMonths, 51 km: selectedKm 52 }, function(response) { 53 rateSpinner.hide(); 54 if (response.success) { 55 rateDisplay.html(response.data.rate).show(); 56 } else { 57 rateDisplay.text('n.v.').show(); 58 } 59 }).fail(function() { 60 rateSpinner.hide(); 61 rateDisplay.text('Fehler').show(); 62 }); 63 } 64 65 monthSelect.wpcsselect({ onSelect: updateLeasingRate, no_deselect: true }); 66 kmSelect.wpcsselect({ onSelect: updateLeasingRate, no_deselect: true }); 67 68 // Initial update 69 updateLeasingRate(); 70 }); 71 } 72 73 }); // domready 74 75 76 function WPCSTheme() { 77 78 var that = this; 79 this.footnotesDiv = $('#wpcs_footnotes'); 80 this.generated_footnotes_div = $('#wpcs_generated_footnotes'); 81 82 this._construct = function() { 83 that._initFootnotes(); 84 } 85 86 this._initFootnotes = function() { 87 let html = that.generated_footnotes_div.html(); 88 if (this.footnotesDiv.length < 1 && html != "") { 89 that.generated_footnotes_div.removeClass('wpcs_hidden'); 90 } else { 91 this.footnotesDiv.html(html); 92 } 93 94 } 95 96 this._construct(); 97 } 98 99 /** 100 * 101 * @constructor 102 */ 103 function WPCSThemeFilter() { 104 var that = this; 105 this.filters = {}; 106 107 this._construct = function() { 108 109 $('.wpcsselect.wpcs_filter_select').wpcsselect({ 110 onSelect: function() { 111 that._submitForm(); 112 } 113 }); 114 115 $('.theme_filter.button').each(function() { 116 let container = this; 117 $('a.wpcs_filter_button', container).click(function(e) { 118 e.preventDefault(); 119 let btn = $(this); 120 btn.toggleClass('active'); 121 122 let value = $(this).data('value'); 123 let is_active = btn.hasClass('active'); 124 125 $('input', container).prop('checked', is_active); 126 127 that._submitForm(e); 128 }); 129 130 }); 131 132 133 $('.theme_filter input').click(function(e) {
134 that._submitForm(); 135 }); 136 137 if ($('[data-jsfilter=1]').length) { 138 that._submitForm(); 139 } 140 141 } 142 143 this._submitForm = function() { 144 let data = $('.theme_filter input').serialize(); 145 let $grid = $('[data-jsfilter=1]'); 146 147 if ($grid.length) { 148 let active_filters = new URLSearchParams(data); 149 150 let filterGroups = {}; 151 152 for (let [key, value] of active_filters.entries()) { 153 if (!filterGroups[key]) { 154 filterGroups[key] = []; 155 } 156 filterGroups[key].push(value); 157 } 158 159 $grid.find('article, .wpcs-offer-card').each(function() { 160 let $article = $(this); 161 let tags = $article.data('tags'); 162 if (!Array.isArray(tags)) tags = []; 163 164 let matchesAllGroups = true; 165 166 for (let groupKey in filterGroups) { 167 let groupValues = filterGroups[groupKey]; 168 let matchesThisGroup = groupValues.some(val => tags.includes(parseInt(val)) || tags.includes(val)); 169 170 if (!matchesThisGroup) { 171 matchesAllGroups = false; 172 break; 173 } 174 } 175 176 let $container = $article.closest('.wpcs_2slides_container'); 177 let $target = $container.length ? $container : $article; 178 if (matchesAllGroups) { 179 $target.show(); 180 } else { 181 $target.hide(); 182 } 183 }); 184 185 } else { 186 let cleanedUrl = wpcs_current_url.replace(/\/page\/\d+\/?/, '/'); 187 window.location.href = cleanedUrl + '?' + data; 188 } 189 } 190 191 192 this.filterPage = function() { 193 194 } 195 196 197 this._construct(); 198 199 } 200 201 202 /** 203 * 204 * @constructor 205 */ 206 function WPCSThemeModel() { 207 208 var that = this; 209 210 this._construct = function() { 211 $('.wpcsselect.model_single_model_select').wpcsselect({ 212 target: '#wpcs_select_value_wpcs_model', 213 onSelect: function() { 214 let val = $('#wpcs_select_value_wpcs_model').val(); 215 window.location.href = val; 216 } 217 }); 218 } 219 220 this.load = function(target_selector, settings) { 221 $.ajax({
222 method: 'POST', 223 url: wpcs_ajax_url, 224 data: { action: 'wpcs_theme_load', 'do': 'load_models', settings: settings }, 225 success: function(data) { 226 if (data.code == 1) $(target_selector).html(data.result); 227 } 228 }); 229 } 230 231 this._construct(); 232 } 233 234 function WPCSThemeOfferGroup() { 235 // Skip Legacy-Filter wenn aktion-detail.js (Modern) geladen wurde â 236 // dort übernimmt der moderne Handler das Filter-Verhalten. 237 // Doppeltes toggleClass('active') würde sich sonst aufheben. 238 if (window.wpcsAktionDetailFilterHandled === true) return; 239 240 var activeFilters = []; 241 242 $('#wpcs_offer_group_filter_buttons').on('click', '.wpcs_offer_group_filter_button', function(e) { 243 e.preventDefault(); 244 $(this).toggleClass('active'); 245 var filter = 'wpcs_filter_' + $(this).attr('data-offer-filter'); 246 if (activeFilters.includes(filter)) { 247 activeFilters = activeFilters.filter(function(item) { 248 return item !== filter; 249 }); 250 } else { 251 activeFilters.push(filter); 252 } 253 254 if (activeFilters.length === 0) { 255 $('.wpcs_offer').closest('.wpcs_2slides_container').show(); 256 } else { 257 $('.wpcs_offer').closest('.wpcs_2slides_container').hide(); 258 activeFilters.forEach(function(activeFilter) { 259 $('.wpcs_offer.' + activeFilter).closest('.wpcs_2slides_container').show(); 260 }); 261 } 262 }); 263 } 264 265 /** 266 * 267 * @constructor 268 */ 269 function WPCSThemePerson() { 270 271 var that = this; 272 this.person_search_timout_id = null; 273 274 this._construct = function() { 275 this.initWPCSSelect(); 276 // this.initPersonSearch(); 277 } 278 279 this.initWPCSSelect = function() { 280 $('.wpcsselect.locations_persons_select').wpcsselect({ 281 onSelect: function() { 282 let val = $('.wpcsselect.locations_persons_select input').val(); 283 $('#wpcs_locations_persons_select .location_wrapper').addClass('wpcs_hidden'); 284 let current = $('#wpcs_locations_persons_select .location_wrapper[data-location=' + val + ']'); 285 current.removeClass('wpcs_hidden'); 286 if (typeof $.fn.slick !== 'undefined') { 287 $('.dxim_vehicle_carousel.slick-slider', current).slick('refresh'); 288 } 289 } 290 }); 291 } 292 293 this._construct(); 294 } 295 296 297 /** 298 * 299 * @constructor 300 */ 301 function WPCSThemeDivision() { 302 303 var that = this; 304 305 this._construct = function() { 306 this.initWPCSSelect(); 307 } 308 309 this.initWPCSSelect = function() { 310 $('.wpcsselect.division_select').wpcsselect({ 311 //target:'#wpcs_select_value_wpcs_division', 312 onSelect: function() { 313 let division_id = jQuery('.wpcsselect.division_select input').val(); 314 jQuery('#location_team .wpcs_team').addClass('wpcs_hidden'); 315 jQuery('#location_team .wpcs_team[data-division=' + division_id + ']').removeClass('wpcs_hidden'); 316 } 317 }); 318 } 319 320 this._construct(); 321 } 322 323 /** 324 * 325 * @constructor 326 */ 327 function WPCSThemeTabs() { 328 var that = this; 329 330 this._construct = function() { 331 this.init(); 332 } 333 334 this.init = function() { 335 $('.wpcs_tabs').each(function() { 336 let wrapper = this; 337 $('.wpcs_tab_control', wrapper).each(function(index) { 338 $(this).click(function(e) { 339 e.preventDefault(); 340 that.changeTab(index, wrapper); 341 }) 342 }); 343 }); 344 } 345
346 this.changeTab = function(index, tabObj) { 347 $('.wpcs_tab_control', tabObj).removeClass('active'); 348 $('.wpcs_tab_control', tabObj).eq(index).addClass('active'); 349 350 $('.wpcs_tab_content', tabObj).removeClass('active'); 351 $('.wpcs_tab_content', tabObj).eq(index).addClass('active'); 352 } 353 354 this._construct(); 355 } 356 357 /** 358 * 359 * @constructor 360 */ 361 function WPCSThemeAccordion() { 362 var that = this; 363 364 this._construct = function() { 365 this.init(); 366 } 367 368 this.init = function() { 369 $('.wpcs_accordion').each(function() { 370 let wrapper = this; 371 $('.wpcs_accordion_control', wrapper).each(function(index) { 372 $(this).click(function(e) { 373 e.preventDefault(); 374 that.changeTab(index, wrapper); 375 }) 376 }); 377 }); 378 } 379 380 this.changeTab = function(index, tabObj) { 381 let target = $('.wpcs_accordion_control', tabObj).eq(index); 382 let target_is_active = target.hasClass('active'); 383 384 $('.wpcs_accordion_control', tabObj).removeClass('active'); 385 if (!target_is_active) $('.wpcs_accordion_control', tabObj).eq(index).addClass('active'); 386 387 $('.wpcs_accordion_content', tabObj).removeClass('active'); 388 if (!target_is_active) $('.wpcs_accordion_content', tabObj).eq(index).addClass('active'); 389 } 390 391 this._construct(); 392 } 393 394})(jQuery);
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.