1var w2dc_maps = []; 2var w2dc_maps_attrs = []; 3var w2dc_infoWindows = []; 4var w2dc_drawCircles = []; 5var w2dc_searchAddresses = []; 6var w2dc_polygons = []; 7var w2dc_fullScreens = []; 8var w2dc_global_markers_array = []; 9var w2dc_global_locations_array = []; 10var w2dc_markerClusters = []; 11var w2dc_directions_display = []; 12var w2dc_stop_touchmove_listener = function(e){ 13 e.preventDefault(); 14} 15var w2dc_glocation = (function(id, point, map_icon_file, map_icon_color, listing_title, listing_logo, listing_url, content_fields, anchor, nofollow, show_summary_button, show_readmore_button, map_id, is_ajax_markers) { 16 this.id = id; 17 this.point = point; 18 this.map_icon_file = map_icon_file; 19 this.map_icon_color = map_icon_color; 20 this.listing_title = listing_title; 21 this.listing_logo = listing_logo; 22 this.listing_url = listing_url; 23 this.content_fields = content_fields; 24 this.anchor = anchor; 25 this.nofollow = nofollow; 26 this.show_summary_button = show_summary_button; 27 this.show_readmore_button = show_readmore_button; 28 this.w2dc_placeMarker = function(map_id) { 29 this.marker = w2dc_placeMarker(this, map_id); 30 return this.marker; 31 }; 32 this.is_ajax_markers = is_ajax_markers; 33}); 34var _w2dc_map_markers_attrs_array; 35var w2dc_dragended; 36var ZOOM_FOR_SINGLE_MARKER = 17; 37 38var w2dc_map_backend = null; 39var w2dc_allow_map_zoom_backend = true; // allow/disallow map zoom in listener, this option needs because w2dc_map_backend.setZoom() also calls this listener 40var w2dc_geocoder_backend = null; 41var w2dc_infoWindow_backend = null; 42var w2dc_markersArray_backend = []; 43var w2dc_glocation_backend = (function(index, point, location, address_line_1, address_line_2, zip_or_postal_index, map_icon_file) { 44 this.index = index; 45 this.point = point; 46 this.location = location; 47 this.address_line_1 = address_line_1; 48 this.address_line_2 = address_line_2; 49 this.zip_or_postal_index = zip_or_postal_index; 50 this.map_icon_file = map_icon_file; 51 this.w2dc_placeMarker = function() { 52 return w2dc_placeMarker_backend(this); 53 }; 54 this.compileAddress = function() { 55 var address = this.address_line_1; 56 if (this.address_line_2) 57 address += ", "+this.address_line_2; 58 if (this.location) { 59 if (address) 60 address += " "; 61 address += this.location; 62 } 63 if (w2dc_maps_objects.default_geocoding_location) { 64 if (address) 65 address += " "; 66 address += w2dc_maps_objects.default_geocoding_location; 67 } 68 if (this.zip_or_postal_index) { 69 if (address) 70 address += " "; 71 address += this.zip_or_postal_index; 72 } 73 return address; 74 }; 75 this.compileHtmlAddress = function() { 76 var address = this.address_line_1; 77 if (this.address_line_2) 78 address += ", "+this.address_line_2; 79 if (this.location) { 80 if (this.address_line_1 || this.address_line_2) 81 address += "<br />"; 82 address += this.location; 83 } 84 if (this.zip_or_postal_index) 85 address += " "+this.zip_or_postal_index; 86 return address; 87 }; 88 this.setPoint = function(point) { 89 this.point = point; 90 }; 91}); 92 93/* Stack-based Douglas Peucker line simplification routine 94returned is a reduced GLatLng array 95After code by Dr. Gary J. Robinson, 96Environmental Systems Science Centre, 97University of Reading, Reading, UK 98*/ 99function w2dc_GDouglasPeucker(source, kink) { 100 var n_source, n_stack, n_dest, start, end, i, sig; 101 var dev_sqr, max_dev_sqr, band_sqr; 102 var x12, y12, d12, x13, y13, d13, x23, y23, d23; 103 var F = ((Math.PI / 180.0) * 0.5 ); 104 var index = new Array(); 105 var sig_start = new Array(); 106 var sig_end = new Array(); 107 108 if ( source.length < 3 ) 109 return(source); 110 111 n_source = source.length; 112 band_sqr = kink * 360.0 / (2.0 * Math.PI * 6378137.0); 113 band_sqr *= band_sqr; 114 n_dest = 0; 115 sig_start[0] = 0; 116 sig_end[0] = n_source-1; 117 n_stack = 1; 118 119 while ( n_stack > 0 ) { 120 start = sig_start[n_stack-1]; 121 end = sig_end[n_stack-1]; 122 n_stack--; 123 124 if ( (end - start) > 1 ) { 125 x12 = (source[end].lng() - source[start].lng()); 126 y12 = (source[end].lat() - source[start].lat()); 127 if (Math.abs(x12) > 180.0) 128 x12 = 360.0 - Math.abs(x12); 129 x12 *= Math.cos(F * (source[end].lat() + source[start].lat())); 130 d12 = (x12*x12) + (y12*y12); 131 132 for ( i = start + 1, sig = start, max_dev_sqr = -1.0; i < end; i++ ) { 133 x13 = (source[i].lng() - source[start].lng()); 134 y13 = (source[i].lat() - source[start].lat()); 135 if (Math.abs(x13) > 180.0) 136 x13 = 360.0 - Math.abs(x13); 137 x13 *= Math.cos (F * (source[i].lat() + source[start].lat())); 138 d13 = (x13*x13) + (y13*y13); 139 140 x23 = (source[i].lng() - source[end].lng()); 141 y23 = (source[i].lat() - source[end].lat()); 142 if (Math.abs(x23) > 180.0) 143 x23 = 360.0 - Math.abs(x23); 144 x23 *= Math.cos(F * (source[i].lat() + source[end].lat())); 145 d23 = (x23*x23) + (y23*y23); 146 147 if ( d13 >= ( d12 + d23 ) ) 148 dev_sqr = d23; 149 else if ( d23 >= ( d12 + d13 ) ) 150 dev_sqr = d13; 151 else 152 dev_sqr = (x13 * y12 - y13 * x12) * (x13 * y12 - y13 * x12) / d12;// solve triangle 153 154 if ( dev_sqr > max_dev_sqr ){ 155 sig = i; 156 max_dev_sqr = dev_sqr; 157 } 158 } 159
160 if ( max_dev_sqr < band_sqr ) { 161 index[n_dest] = start; 162 n_dest++; 163 } else { 164 n_stack++; 165 sig_start[n_stack-1] = sig; 166 sig_end[n_stack-1] = end; 167 n_stack++; 168 sig_start[n_stack-1] = start; 169 sig_end[n_stack-1] = sig; 170 } 171 } else { 172 index[n_dest] = start; 173 n_dest++; 174 } 175 } 176 index[n_dest] = n_source-1; 177 n_dest++; 178 179 var r = new Array(); 180 for(var i=0; i < n_dest; i++) 181 r.push(source[index[i]]); 182 183 return r; 184} 185 186(function($) { 187 "use strict"; 188 189 $(function() { 190 w2dc_check_support(); 191 w2dc_add_body_classes(); 192 w2dc_get_rid_of_select2_choosen(); 193 w2dc_custom_input_controls(); 194 w2dc_my_location_buttons(); 195 w2dc_tokenizer(); 196 w2dc_equalColumnsHeight(); 197 w2dc_equalColumnsHeightEvent(); 198 w2dc_listings_carousel(); 199 w2dc_radius_slider(); 200 w2dc_hint(); 201 w2dc_favourites(); 202 w2dc_week_day_input(); 203 w2dc_check_is_week_day_closed(); 204 w2dc_listing_tabs(); 205 w2dc_dashboard_tabs(); 206 w2dc_sticky_scroll(); 207 w2dc_tooltips(); 208 w2dc_ratings(); 209 w2dc_hours_content_field(); 210 w2dc_full_height_maps(); 211 w2dc_load_comments(); 212 w2dc_content_fields_metabox(); 213 w2dc_upload_image(); 214 w2dc_media_metabox(); 215 w2dc_locations_metabox(); 216 w2dc_datetime_input(); 217 w2dc_expiration_date_metabox(); 218 w2dc_order_date_metabox(); 219 w2dc_add_term_links(); 220 w2dc_sort_terms(); 221 w2dc_show_on_map_click_default(); 222 }); 223 224 window.w2dc_show_on_map_click_default = function() { 225 $('body').on('click', '.w2dc-show-on-map', function() { 226 if (!w2dc_js_objects.is_maps_used) { 227 var lat = $(this).data("coordinate-lat"); 228 var lng = $(this).data("coordinate-lng"); 229 if (lat && lng) { 230 window.open("https://www.google.com/maps/place/"+lat+","+lng, "_blank"); 231 } 232 } 233 }); 234 } 235 236 window.w2dc_check_support = function() { 237 238 $(".w2dc-license-support-checker").each(function() { 239 240 var el = $(this); 241 var nonce = el.data("nonce"); 242 243 $.ajax({ 244 type: 'POST', 245 url: w2dc_js_objects.ajaxurl, 246 data: { 247 'action': 'w2dc_license_support_checker', 248 'security': nonce 249 }, 250 success: function(response) { 251 252 if (response) { 253 el.html(response); 254 } 255 } 256 }); 257 }); 258 } 259 260 window.w2dc_sort_terms = function() { 261 if (typeof w2dc_order_term_data != 'undefined') { 262 var base_index = parseInt(w2dc_order_term_data.paged) > 0 ? (parseInt(w2dc_order_term_data.paged) - 1) * parseInt($('#'+w2dc_order_term_data.per_page_id).val()) : 0; 263 var tax_table = $('#the-list'); 264 265 // If the tax table contains items. 266 if (tax_table.length && !tax_table.find('tr:first-child').hasClass('no-items')) { 267 268 tax_table.sortable({ 269 placeholder: "w2dc-drag-drop-tax-placeholder", 270 axis: "y", 271 272 // On start, set a height for the placeholder to prevent table jumps. 273 start: function(event, ui) { 274 const item = $(ui.item[0]); 275 const index = item.index(); 276 const colspan = item.children('th,td').filter(':visible').length; 277 $('.w2dc-drag-drop-tax-placeholder') 278 .css('height', item.css('height')) 279 .css('display', 'flex') 280 .css('width', '0'); 281 }, 282 update: function(event, ui) { 283 var item = $(ui.item[0]); 284 var taxonomy_ordering_data = []; 285 286 tax_table.find('tr.ui-sortable-handle').each(function() { 287 var ele = $(this); 288 var term_data = { 289 term_id: ele.attr('id').replace('tag-', ''), 290 order: parseInt(ele.index()) + 1 291 } 292 taxonomy_ordering_data.push(term_data); 293 }); 294 295 var data = { 296 'action': 'w2dc_update_tax_order', 297 'taxonomy_ordering_data': taxonomy_ordering_data, 298 'base_index': base_index, 299 'term_order_nonce': w2dc_order_term_data.term_order_nonce 300 }; 301 302 $.ajax({
303 type: 'POST', 304 url: w2dc_js_objects.ajaxurl, 305 data: data, 306 dataType: 'JSON', 307 success: function(response) { 308 item.find('input[type="checkbox"]').show(); 309 } 310 }); 311 } 312 }); 313 } 314 } 315 } 316 317 window.w2dc_upload_image = function() { 318 $(document).on("click", ".w2dc-reset-image-button", function(e) { 319 e.preventDefault(); 320 321 var form = $(this).parents(".w2dc-upload-image-form"); 322 form.parent().find(".w2dc-upload-image").css("background-image", ""); 323 form.parent().find('.w2dc-upload-image-input-' + form.data('name')).val(""); 324 }); 325 if (w2dc_js_objects.is_admin) { 326 $(document).on('click', '.w2dc-upload-image-button', function(event) { 327 event.preventDefault(); 328 329 var form = $(this).parents(".w2dc-upload-image-form"); 330 var frame = wp.media({ 331 title : w2dc_js_objects.media_dialog_title, 332 multiple : false, 333 library : { type : 'image'}, 334 button : { text : w2dc_js_objects.media_dialog_button_text}, 335 }); 336 frame.on('select', function() { 337 var selected_images = []; 338 var selection = frame.state().get('selection'); 339 selection.each(function(attachment) { 340 attachment = attachment.toJSON(); 341 if (attachment.type == 'image') { 342 343 var image_url = attachment.sizes.full.url; 344 var attachment_id = attachment.id; 345 form.find('.w2dc-upload-image').css("background-image", "url(" + image_url + ")"); 346 form.find('.w2dc-upload-image-input-' + form.data('name')).val(attachment_id); 347 } 348 349 }); 350 }); 351 frame.open(); 352 }); 353 } else { 354 $(document).on("click", ".w2dc-upload-image-button", function(e) { 355 e.preventDefault(); 356 357 $(this).parent().find("input").trigger('click'); 358 }); 359 $('.w2dc-upload-image-form').each(function() { 360 var form = $(this); 361 var action_url = form.data('action-url'); 362 form.fileupload({ 363 dataType: 'json', 364 url: action_url, 365 send: function (e, data) { 366 w2dc_add_iloader_on_element(form); 367 }, 368 done: function(e, data) { 369 var result = data.result; 370 if (result.uploaded_file) { 371 var size = result.metadata.size; 372 var width = result.metadata.width; 373 var height = result.metadata.height; 374 form.find('.w2dc-upload-image').css("background-image", "url(" + result.uploaded_file + ")"); 375 form.find('.w2dc-upload-image-input-' + form.data('name')).val(result.attachment_id); 376 } else { 377 form.find('.w2dc-upload-image').append("<p>"+result.error_msg+"</p>"); 378 } 379 w2dc_delete_iloader_from_element(form); 380 } 381 }); 382 }); 383 } 384 } 385 386 window.w2dc_add_term_links = function() { 387 $(document).on("click", ".w2dc-add-term-link", function(e) { 388 e.preventDefault(); 389 390 var el = $(this); 391 var tax = el.data('tax'); 392 var uid = el.data('uid'); 393 var exact_terms = el.data('exact-terms'); 394 var parent_id = el.data('parent'); 395 var nonce = el.data('nonce'); 396 var label = el.html(); 397 var saved_html = el[0].outerHTML; 398 399 var add_form = $('<form class="w2dc-add-term-form"><input name="w2dc_add_term_input" class="w2dc-form-control w2dc-add-term-input" value="" /><a class="w2dc-btn w2dc-btn-primary w2dc-add-term-button">'+label+'</a> <a class="w2dc-btn w2dc-btn-primary w2dc-add-term-cancel">'+w2dc_js_objects.cancel_button+'</a></form>'); 400 add_form.on("submit", function(e) { 401 e.preventDefault(); 402 403 $(add_form).find('.w2dc-add-term-button').trigger('click'); 404 }); 405 el.replaceWith(add_form); 406 407 $(add_form).find('.w2dc-add-term-input').focus(); 408 409 $(add_form).on("click", ".w2dc-add-term-cancel", function(e) { 410 e.preventDefault(); 411 412 $(this).parent().replaceWith(saved_html); 413 }); 414 415 $(add_form).on("click", ".w2dc-add-term-button", function(e) { 416 e.preventDefault(); 417 418 var input = $(this).parent().find('.w2dc-add-term-input'); 419 if (input.val()) { 420 w2dc_ajax_loader_show(); 421 422 $.ajax({
423 type: "POST", 424 url: w2dc_js_objects.ajaxurl, 425 data: { 426 'action': 'w2dc_add_term', 427 'tax': tax, 428 'parent_id': parent_id, 429 'val': input.val(), 430 'security': nonce 431 }, 432 success: function(term_id){ 433 434 term_id = $.trim(term_id); 435 436 if (term_id != 0) { 437 $(add_form).find('.w2dc-add-term-cancel').trigger('click'); 438 439 w2dc_update_tax_wrapper(tax, uid, exact_terms, term_id); 440 } 441 }, 442 complete: function() { 443 444 } 445 }); 446 } 447 }); 448 }); 449 } 450 451 window.w2dc_update_tax_wrapper = function(tax, uid, exact_terms, selected_term) { 452 var wrapper = $('div.'+tax); 453 454 $.ajax({ 455 type: "POST", 456 url: w2dc_js_objects.ajaxurl, 457 data: { 'action': 'w2dc_update_tax_wrapper', 'tax': tax, 'exact_terms': exact_terms, 'selected_term': selected_term, 'uid': uid }, 458 success: function(response_from_the_action_function){ 459 if (response_from_the_action_function != 0) { 460 wrapper.html('').append(response_from_the_action_function); 461 } 462 }, 463 complete: function() { 464 w2dc_ajax_loader_hide(); 465 } 466 }); 467 } 468 469 window.w2dc_expiration_date_metabox = function() { 470 if (typeof w2dc_expiration_date_metabox_attrs != 'undefined') { 471 $("#expiration_date").datepicker({ 472 changeMonth: true, 473 changeYear: true, 474 isRTL: w2dc_expiration_date_metabox_attrs.isRTL, 475 showButtonPanel: true, 476 dateFormat: w2dc_expiration_date_metabox_attrs.dateFormat, 477 firstDay: w2dc_expiration_date_metabox_attrs.firstDay, 478 onSelect: function(dateText) { 479 var tmstmp_str; 480 var sDate = $("#expiration_date").datepicker("getDate"); 481 if (sDate) { 482 sDate.setMinutes(sDate.getMinutes() - sDate.getTimezoneOffset()); 483 tmstmp_str = $.datepicker.formatDate('@', sDate)/1000; 484 } else { 485 tmstmp_str = 0; 486 } 487 488 $("input[name=expiration_date_tmstmp]").val(tmstmp_str); 489 } 490 }); 491 if (w2dc_expiration_date_metabox_attrs.lang_code) { 492 $("#expiration_date").datepicker($.datepicker.regional[w2dc_expiration_date_metabox_attrs.lang_code]); 493 } 494 495 $("#expiration_date").datepicker('setDate', $.datepicker.parseDate('dd/mm/yy', w2dc_expiration_date_metabox_attrs.expiration_date_formatted)); 496 } 497 } 498 499 window.w2dc_order_date_metabox = function() { 500 if (typeof w2dc_order_date_metabox_attrs != 'undefined') { 501 $("#order_date").datepicker({ 502 changeMonth: true, 503 changeYear: true, 504 isRTL: w2dc_order_date_metabox_attrs.isRTL, 505 showButtonPanel: true, 506 dateFormat: w2dc_order_date_metabox_attrs.dateFormat, 507 firstDay: w2dc_order_date_metabox_attrs.firstDay, 508 onSelect: function(dateText) { 509 var tmstmp_str; 510 var sDate = $("#order_date").datepicker("getDate"); 511 if (sDate) { 512 sDate.setMinutes(sDate.getMinutes() - sDate.getTimezoneOffset()); 513 tmstmp_str = $.datepicker.formatDate('@', sDate)/1000; 514 } else { 515 tmstmp_str = 0; 516 } 517 518 $("input[name=order_date_tmstmp]").val(tmstmp_str); 519 } 520 }); 521 if (w2dc_order_date_metabox_attrs.lang_code) { 522 $("#order_date").datepicker($.datepicker.regional[w2dc_order_date_metabox_attrs.lang_code]); 523 } 524 525 $("#order_date").datepicker('setDate', $.datepicker.parseDate('dd/mm/yy', w2dc_order_date_metabox_attrs.order_date_formatted)); 526 } 527 } 528 529 window.w2dc_datetime_input = function() { 530 if (typeof w2dc_datetime_input_attrs != 'undefined') { 531 532 $.each(w2dc_datetime_input_attrs, function (index, field_attrs) { 533 var field_id = field_attrs.field_id; 534 535 $("#w2dc-field-input-" + field_id + "-start").datepicker({ 536 changeMonth: true, 537 changeYear: true, 538 isRTL: field_attrs.isRTL, 539 showButtonPanel: true, 540 dateFormat: field_attrs.dateFormat, 541 firstDay: field_attrs.firstDay, 542 onSelect: function(dateText) { 543 var tmstmp_str; 544 var sDate = $("#w2dc-field-input-" + field_id + "-start").datepicker("getDate"); 545 var set_min_date = $("#w2dc-field-input-" + field_id + "-start").datepicker("getDate"); 546 if (sDate) { 547 sDate.setMinutes(sDate.getMinutes() - sDate.getTimezoneOffset()); 548 tmstmp_str = $.datepicker.formatDate('@', sDate)/1000; 549 } else { 550 tmstmp_str = 0; 551 } 552 $("#w2dc-field-input-" + field_id + "-end").datepicker('option', 'minDate', set_min_date); 553 554 $("input[name=w2dc-field-input-" + field_id + "-start]").val(tmstmp_str); 555 }, 556 onClose: function() { 557 // this is workaround to prevent an issue when changing year-month on the end datepicker 558 setTimeout(function() { 559 $("#w2dc-field-input-" + field_id + "-end").focus(); 560 }, 0); 561 } 562 }); 563 if (field_attrs.lang_code) { 564 $("#w2dc-field-input-" + field_id + "-start").datepicker($.datepicker.regional[field_attrs.lang_code]); 565 } 566 567 $("#w2dc-field-input-" + field_id + "-end").datepicker({ 568 changeMonth: true, 569 changeYear: true, 570 isRTL: field_attrs.isRTL, 571 showButtonPanel: true, 572 dateFormat: field_attrs.dateFormat, 573 firstDay: field_attrs.firstDay, 574 onSelect: function(dateText) { 575 var tmstmp_str; 576 var sDate = $("#w2dc-field-input-" + field_id + "-end").datepicker("getDate"); 577 var set_max_date = $("#w2dc-field-input-" + field_id + "-end").datepicker("getDate"); 578 if (sDate) { 579 sDate.setMinutes(sDate.getMinutes() - sDate.getTimezoneOffset()); 580 tmstmp_str = $.datepicker.formatDate('@', sDate)/1000; 581 } else { 582 tmstmp_str = 0; 583 } 584 $("#w2dc-field-input-" + field_id + "-start").datepicker('option', 'maxDate', set_max_date); 585 586 $("input[name=w2dc-field-input-" + field_id + "-end]").val(tmstmp_str); 587 } 588 }); 589 if (field_attrs.lang_code) { 590 $("#w2dc-field-input-" + field_id + "-end").datepicker($.datepicker.regional[field_attrs.lang_code]); 591 } 592 593 if (field_attrs.date_end) { 594 $("#w2dc-field-input-" + field_id + "-end").datepicker('setDate', $.datepicker.parseDate('dd/mm/yy', field_attrs.date_end_formatted)); 595 $("#w2dc-field-input-" + field_id + "-start").datepicker('option', 'maxDate', $("#w2dc-field-input-" + field_id + "-end").datepicker('getDate')); 596 } 597 $('body').on('click', "#w2dc-reset-date-" + field_id + "-end", function() { 598 $.datepicker._clearDate("#w2dc-field-input-" + field_id + "-end"); 599 }) 600 601 if (field_attrs.date_start) { 602 $("#w2dc-field-input-" + field_id + "-start").datepicker('setDate', $.datepicker.parseDate('dd/mm/yy', field_attrs.date_start_formatted)); 603 $("#w2dc-field-input-" + field_id + "-end").datepicker('option', 'minDate', $("#w2dc-field-input-" + field_id + "-start").datepicker('getDate')); 604 } 605 $('body').on('click', "#w2dc-reset-date-" + field_id + "-start", function() { 606 $.datepicker._clearDate("#w2dc-field-input-" + field_id + "-start"); 607 }) 608 }); 609 } 610 } 611 612 window.w2dc_locations_metabox = function() { 613 if (typeof w2dc_locations_metabox_attrs != 'undefined') { 614 if (w2dc_locations_metabox_attrs.is_map_markers) { 615 if (w2dc_maps_objects.map_markers_type == 'images') { 616 var map_icon_file_input; 617 $(document).on("click", ".w2dc-select-map-icon", function() { 618 map_icon_file_input = $(this).parents(".w2dc-location-input").find('.w2dc-map-icon-file'); 619 620 var dialog = $('<div id="w2dc-select-map-icon-dialog"></div>').dialog({ 621 dialogClass: 'w2dc-content', 622 width: ($(window).width()*0.5), 623 height: ($(window).height()*0.8), 624 modal: true, 625 resizable: false, 626 draggable: false, 627 title: w2dc_locations_metabox_attrs.images_dialog_title, 628 open: function() { 629 w2dc_ajax_loader_show(); 630 $.ajax({
631 type: "POST", 632 url: w2dc_js_objects.ajaxurl, 633 data: {'action': 'w2dc_select_map_icon'}, 634 dataType: 'html', 635 success: function(response_from_the_action_function){ 636 if (response_from_the_action_function != 0) { 637 $('#w2dc-select-map-icon-dialog').html(response_from_the_action_function); 638 if (map_icon_file_input.val()) 639 $(".w2dc-icon[icon_file='"+map_icon_file_input.val()+"']").addClass("w2dc-selected-icon"); 640 } 641 }, 642 complete: function() { 643 w2dc_ajax_loader_hide(); 644 } 645 }); 646 $(document).on("click", ".ui-widget-overlay", function() { $('#w2dc-select-map-icon-dialog').remove(); }); 647 }, 648 close: function() { 649 $('#w2dc-select-map-icon-dialog').remove(); 650 } 651 }); 652 }); 653 $(document).on("click", ".w2dc-icon", function() { 654 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 655 if (map_icon_file_input) { 656 map_icon_file_input.val($(this).attr('icon_file')); 657 map_icon_file_input = false; 658 $(this).addClass("w2dc-selected-icon"); 659 $('#w2dc-select-map-icon-dialog').remove(); 660 w2dc_generateMap_backend(); 661 } 662 }); 663 $(document).on("click", "#reset_icon", function() { 664 if (map_icon_file_input) { 665 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 666 map_icon_file_input.val(''); 667 map_icon_file_input = false; 668 $('#w2dc-select-map-icon-dialog').remove(); 669 w2dc_generateMap_backend(); 670 } 671 }); 672 } else { 673 var map_icon_file_input; 674 $(document).on("click", ".w2dc-select-map-icon", function() { 675 map_icon_file_input = $(this).parents(".w2dc-location-input").find('.w2dc-map-icon-file'); 676 677 var dialog = $('<div id="select_marker_icon_dialog"></div>').dialog({ 678 dialogClass: 'w2dc-content', 679 width: ($(window).width()*0.5), 680 height: ($(window).height()*0.8), 681 modal: true, 682 resizable: false, 683 draggable: false, 684 title: w2dc_locations_metabox_attrs.icons_dialog_title, 685 open: function() { 686 w2dc_ajax_loader_show(); 687 $.ajax({
688 type: "POST", 689 url: w2dc_js_objects.ajaxurl, 690 data: {'action': 'w2dc_select_fa_icon'}, 691 dataType: 'html', 692 success: function(response_from_the_action_function){ 693 if (response_from_the_action_function != 0) { 694 $('#select_marker_icon_dialog').html(response_from_the_action_function); 695 if (map_icon_file_input.val()) 696 $("#"+map_icon_file_input.val()).addClass("w2dc-selected-icon"); 697 } 698 }, 699 complete: function() { 700 w2dc_ajax_loader_hide(); 701 } 702 }); 703 $(document).on("click", ".ui-widget-overlay", function() { $('#select_marker_icon_dialog').remove(); }); 704 }, 705 close: function() { 706 $('#select_marker_icon_dialog').remove(); 707 } 708 }); 709 }); 710 $(document).on("click", ".w2dc-fa-icon", function() { 711 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 712 if (map_icon_file_input) { 713 map_icon_file_input.val($(this).attr('id')); 714 map_icon_file_input = false; 715 $(this).addClass("w2dc-selected-icon"); 716 $('#select_marker_icon_dialog').remove(); 717 w2dc_generateMap_backend(); 718 } 719 }); 720 $(document).on("click", "#w2dc-reset-fa-icon", function() { 721 if (map_icon_file_input) { 722 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 723 map_icon_file_input.val(''); 724 map_icon_file_input = false; 725 $('#select_marker_icon_dialog').remove(); 726 w2dc_generateMap_backend(); 727 } 728 }); 729 } 730 } 731 732 $('body').on('click', ".add_address", function() { 733 w2dc_ajax_loader_show(); 734 $.ajax({
735 type: "POST", 736 url: w2dc_js_objects.ajaxurl, 737 data: { 'action': 'w2dc_add_location_in_metabox', 'post_id': w2dc_locations_metabox_attrs.post_id }, 738 success: function(response_from_the_action_function){ 739 if (response_from_the_action_function != 0) { 740 $("#w2dc-locations-wrapper").append(response_from_the_action_function); 741 $(".w2dc-delete-address").show(); 742 if (w2dc_locations_metabox_attrs.locations_number == $(".w2dc-location-in-metabox").length) { 743 $(".add_address").hide(); 744 } 745 if (w2dc_maps_objects.address_autocomplete && w2dc_js_objects.is_maps_used) { 746 w2dc_setupAutocomplete(); 747 } 748 } 749 }, 750 complete: function() { 751 w2dc_ajax_loader_hide(); 752 } 753 }); 754 }); 755 $(document).on("click", ".w2dc-delete-address", function() { 756 $(this).parents(".w2dc-location-in-metabox").remove(); 757 if ($(".w2dc-location-in-metabox").length == 1) 758 $(".w2dc-delete-address").hide(); 759 760 if (w2dc_locations_metabox_attrs.is_map) { 761 w2dc_generateMap_backend(); 762 } 763 764 if (w2dc_locations_metabox_attrs.locations_number > $(".w2dc-location-in-metabox").length) 765 $(".add_address").show(); 766 }); 767 768 $(document).on("click", ".w2dc-manual-coords", function() { 769 if ($(this).is(":checked")) 770 $(this).parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").slideDown(200); 771 else 772 $(this).parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").slideUp(200); 773 }); 774 775 if (w2dc_locations_metabox_attrs.locations_number > $(".w2dc-location-in-metabox").length) { 776 $(".add_address").show(); 777 } 778 } 779 } 780 781 window.w2dc_media_metabox = function() { 782 if ($('#w2dc-images-upload-wrapper').length) { 783 784 window.w2dc_image_attachment_tpl = function(attachment_id, uploaded_file, title, size, width, height) { 785 var image_attachment_tpl = '<div class="w2dc-attached-item w2dc-move-label">' + 786 '<input type="hidden" name="attached_image_id[]" class="w2dc-attached-item-id" value="'+attachment_id+'" />' + 787 '<a href="'+uploaded_file+'" data-w2dc_lightbox="listing_images" class="w2dc-attached-item-img" style="background-image: url('+uploaded_file+')"></a>' + 788 '<div class="w2dc-attached-item-input">' + 789 '<input type="text" name="attached_image_title[]" class="w2dc-form-control" value="" placeholder="' + w2dc_media_metabox_attrs.images_input_placeholder + '" />' + 790 '</div>'; 791 if (w2dc_media_metabox_attrs.images_logo_enabled) { 792 image_attachment_tpl = image_attachment_tpl + '<div class="w2dc-attached-item-logo w2dc-radio">' + 793 '<label>' + 794 '<input type="radio" name="attached_image_as_logo" value="'+attachment_id+'"> ' + w2dc_media_metabox_attrs.images_input_label + 795 '</label>' + 796 '</div>'; 797 } 798 image_attachment_tpl = image_attachment_tpl + '<div class="w2dc-attached-item-delete w2dc-fa w2dc-fa-trash-o" title="' + w2dc_media_metabox_attrs.images_remove_title + '"></div>' + 799 '<div class="w2dc-attached-item-metadata">'+size+' ('+width+' x '+height+')</div>' + 800 '</div>'; 801 802 return image_attachment_tpl; 803 }; 804 805 window.w2dc_update_images_attachments_order = function() { 806 $("#w2dc-attached-images-order").val($(".w2dc-attached-item-id").map(function() { 807 return $(this).val(); 808 }).get()); 809 } 810 window.w2dc_check_images_attachments_number = function() { 811 if (w2dc_media_metabox_attrs.images_number > $("#w2dc-images-upload-wrapper .w2dc-attached-item").length) { 812 if (w2dc_js_objects.is_admin) { 813 $("#w2dc-admin-upload-functions").show(); 814 } else { 815 $(".w2dc-upload-item").show(); 816 } 817 return true; 818 } else { 819 if (w2dc_js_objects.is_admin) { 820 $("#w2dc-admin-upload-functions").hide(); 821 } else { 822 $(".w2dc-upload-item").hide(); 823 } 824 return false; 825 } 826 } 827 828 829 var sortable_images = $("#w2dc-attached-images-wrapper").sortable({ 830 delay: 50, 831 placeholder: "ui-sortable-placeholder", 832 items: ".w2dc-attached-item", 833 helper: function(e, ui) { 834 ui.children().each(function() { 835 $(this).width($(this).width()); 836 });
837 return ui; 838 }, 839 start: function(e, ui){ 840 ui.placeholder.width(ui.item.width()); 841 ui.placeholder.height(ui.item.height()); 842 }, 843 update: function( event, ui ) { 844 w2dc_update_images_attachments_order(); 845 } 846 }); 847 848 // disable sortable on android, otherwise it breaks click events on image, radio and delete button 849 var ua = navigator.userAgent.toLowerCase(); 850 if (ua.indexOf("android") > -1) { 851 sortable_images.sortable("disable"); 852 }; 853 854 w2dc_check_images_attachments_number(); 855 856 $("#w2dc-attached-images-wrapper").on("click", ".w2dc-attached-item-delete", function() { 857 $(this).parents(".w2dc-attached-item").remove(); 858 859 $.ajax({ 860 url: w2dc_js_objects.ajaxurl, 861 type: "POST", 862 dataType: "json", 863 data: { 864 action: 'w2dc_remove_image', 865 post_id: w2dc_media_metabox_attrs.object_id, 866 attachment_id: $(this).parent().find(".w2dc-attached-item-id").val(), 867 _wpnonce: w2dc_media_metabox_attrs.images_remove_image_nonce 868 } 869 }); 870 871 w2dc_check_images_attachments_number(); 872 w2dc_update_images_attachments_order(); 873 }); 874 875 if (!w2dc_js_objects.is_admin) { 876 $(document).on("click", ".w2dc-upload-item-button", function(e){ 877 e.preventDefault(); 878 879 $(this).parent().find("input").trigger('click'); 880 }); 881 882 $('.w2dc-upload-item').fileupload({ 883 sequentialUploads: true, 884 dataType: 'json', 885 url: w2dc_media_metabox_attrs.images_fileupload_url, 886 dropZone: $('.w2dc-drop-attached-item'), 887 add: function (e, data) { 888 if (w2dc_check_images_attachments_number()) { 889 var jqXHR = data.submit(); 890 } else { 891 return false; 892 } 893 }, 894 send: function (e, data) { 895 w2dc_add_iloader_on_element($(this).find(".w2dc-drop-attached-item")); 896 }, 897 done: function(e, data) { 898 var result = data.result; 899 if (result.uploaded_file) { 900 var size = result.metadata.size; 901 var width = result.metadata.width; 902 var height = result.metadata.height; 903 $(this).before(w2dc_image_attachment_tpl(result.attachment_id, result.uploaded_file, data.files[0].name, size, width, height)); 904 w2dc_custom_input_controls(); 905 } else { 906 $(this).find(".w2dc-drop-attached-item").append("<p>"+result.error_msg+"</p>"); 907 } 908 $(this).find(".w2dc-drop-zone").show(); 909 w2dc_delete_iloader_from_element($(this).find(".w2dc-drop-attached-item")); 910 911 w2dc_check_images_attachments_number(); 912 w2dc_update_images_attachments_order(); 913 } 914 }); 915 } 916 917 if (w2dc_media_metabox_attrs.images_is_admin) { 918 $('body').on('click', '#w2dc-admin-upload-image', function(event) { 919 event.preventDefault(); 920 921 var frame = wp.media({ 922 title : w2dc_media_metabox_attrs.images_upload_image_title, 923 multiple : true, 924 library : { type : 'image'}, 925 button : { text : w2dc_media_metabox_attrs.images_upload_image_button}, 926 }); 927 frame.on('select', function() { 928 var selected_images = []; 929 var selection = frame.state().get('selection'); 930 selection.each(function(attachment) { 931 attachment = attachment.toJSON(); 932 if (attachment.type == 'image') { 933 934 if (w2dc_check_images_attachments_number()) { 935 w2dc_ajax_loader_show(); 936 937 $.ajax({
938 type: "POST", 939 async: false, 940 url: w2dc_js_objects.ajaxurl, 941 data: { 942 'action': 'w2dc_upload_media_image', 943 'attachment_id': attachment.id, 944 'post_id': w2dc_media_metabox_attrs.object_id, 945 '_wpnonce': w2dc_media_metabox_attrs.images_upload_image_nonce, 946 }, 947 attachment_id: attachment.id, 948 attachment_url: attachment.sizes.full.url, 949 attachment_title: attachment.title, 950 dataType: "json", 951 success: function (response_from_the_action_function) { 952 if (response_from_the_action_function != 0) { 953 var size = response_from_the_action_function.metadata.size; 954 var width = response_from_the_action_function.metadata.width; 955 var height = response_from_the_action_function.metadata.height; 956 $("#w2dc-attached-images-wrapper").append(w2dc_image_attachment_tpl(this.attachment_id, this.attachment_url, this.attachment_title, size, width, height)); 957 w2dc_check_images_attachments_number(); 958 w2dc_update_images_attachments_order(); 959 } 960 961 w2dc_ajax_loader_hide(); 962 } 963 }); 964 } 965 } 966 967 }); 968 }); 969 frame.open(); 970 }); 971 } 972 } 973 974 if ($('#w2dc-attach-videos-functions').length) { 975 window.w2dc_video_attachment_tpl = function(video_id, image_url) { 976 var video_attachment_tpl = '<div class="w2dc-attached-item">' + 977 '<input type="hidden" name="attached_video_id[]" value="'+video_id+'" />' + 978 '<div class="w2dc-attached-item-img" style="background-image: url('+image_url+')"></div>' + 979 '<div class="w2dc-attached-item-delete w2dc-fa w2dc-fa-trash-o" title="' + w2dc_media_metabox_attrs.videos_delete_title + '"></div>' + 980 '</div>'; 981 982 return video_attachment_tpl; 983 }; 984 985 window.w2dc_check_videos_attachments_number = function() { 986 if (w2dc_media_metabox_attrs.videos_number > $("#w2dc-attached-videos-wrapper .w2dc-attached-item").length) { 987 $("#w2dc-attach-videos-functions").show(); 988 } else { 989 $("#w2dc-attach-videos-functions").hide(); 990 } 991 } 992 993 w2dc_check_videos_attachments_number(); 994 995 $("#w2dc-attached-videos-wrapper").on("click", ".w2dc-attached-item-delete", function() { 996 $(this).parents(".w2dc-attached-item").remove(); 997 998 w2dc_check_videos_attachments_number(); 999 }); 1000 1001 window.attachVideo = function() { 1002 if ($("#w2dc-attach-video-input").val()) { 1003 var regExp_youtube = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; 1004 var regExp_vimeo = /https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/; 1005 var matches_youtube = $("#w2dc-attach-video-input").val().match(regExp_youtube); 1006 var matches_vimeo = $("#w2dc-attach-video-input").val().match(regExp_vimeo); 1007 if (matches_youtube && matches_youtube[2].length == 11) { 1008 var video_id = matches_youtube[2]; 1009 var image_url = 'http://i.ytimg.com/vi/'+video_id+'/0.jpg'; 1010 $("#w2dc-attached-videos-wrapper").append(w2dc_video_attachment_tpl(video_id, image_url)); 1011 1012 w2dc_check_videos_attachments_number(); 1013 } else if (matches_vimeo && (matches_vimeo[3].length == 8 || matches_vimeo[3].length == 9)) { 1014 var video_id = matches_vimeo[3]; 1015 var url = "//vimeo.com/api/v2/video/" + video_id + ".json?callback=showVimeoThumb"; 1016 var script = document.createElement('script'); 1017 script.src = url; 1018 $("#w2dc-attach-videos-functions").before(script); 1019 } else { 1020 alert(w2dc_media_metabox_attrs.videos_error_alert); 1021 } 1022 } 1023 }; 1024 1025 window.showVimeoThumb = function(data){ 1026 var video_id = data[0].id; 1027 var image_url = data[0].thumbnail_medium; 1028 $("#w2dc-attached-videos-wrapper").append(w2dc_video_attachment_tpl(video_id, image_url)); 1029 1030 w2dc_check_videos_attachments_number(); 1031 }; 1032 } 1033 } 1034 1035 window.w2dc_my_location_buttons = function() { 1036 if (w2dc_maps_objects.enable_my_location_button) { 1037 $(".w2dc-get-location").attr("title", w2dc_maps_objects.my_location_button); 1038 $("body").on("click", ".w2dc-get-location", function() { 1039 if (!$(this).hasClass('w2dc-search-input-reset')) { 1040 var input = $(this).parent().find("input"); 1041 w2dc_geocodeField(input, w2dc_maps_objects.my_location_button_error); 1042 } else { 1043 $(this).removeClass('w2dc-search-input-reset'); 1044 } 1045 }); 1046 } 1047 } 1048 1049 window.w2dc_tokenizer = function() { 1050 function getUnique(value, index, self) { 1051 return self.indexOf(value) === index; 1052 } 1053 1054 var tokenizer = $(".w2dc-tokenizer").tokenize({ 1055 onAddToken: function(value, text, e) { 1056 if (!w2dc_tags_metabox_attrs.unlimited_tags && tokenizer.toArray().filter(getUnique).length > w2dc_tags_metabox_attrs.tags_number) { 1057 tokenizer.tokenRemove(value); 1058 alert(w2dc_tags_metabox_attrs.tags_limit_message); 1059 } 1060 } 1061 }); 1062 } 1063 1064 window.w2dc_add_body_classes = function() { 1065 if ("ontouchstart" in document.documentElement) 1066 $("body").addClass("w2dc-touch"); 1067 else 1068 $("body").addClass("w2dc-no-touch"); 1069 } 1070 1071 window.w2dc_listing_tabs = function() { 1072 var el = $('.w2dc-listing-tabs'); 1073 var map = {}; 1074 1075 if (el.length) { 1076 $('.w2dc-listing-tabs li').each(function() { 1077 var el = $(this); 1078 map[el.find('a').data('tab')] = el; 1079 }); 1080 1081 if (w2dc_js_objects.listing_tabs_order.length) { 1082 for (var i = 0, l = w2dc_js_objects.listing_tabs_order.length; i < l; i ++) { 1083 var tab = w2dc_js_objects.listing_tabs_order[i]; 1084 1085 if (map['#'+tab]) { 1086 el.append(map['#'+tab]); 1087 } 1088 } 1089 1090 for (var i = 0, l = w2dc_js_objects.listing_tabs_order.length; i < l; i ++) { 1091 var tab = w2dc_js_objects.listing_tabs_order[i]; 1092 1093 if ($('#'+tab).length) { 1094 w2dc_show_tab($('.w2dc-listing-tabs a[data-tab="#'+tab+'"]')); 1095 break; 1096 } 1097 } 1098 } else { 1099 w2dc_show_tab($('.w2dc-listing-tabs a:first')); 1100 } 1101 1102 $(document).on('click', '.w2dc-listing-tabs a', function(e) { 1103 e.preventDefault(); 1104 w2dc_show_tab($(this)); 1105 history.replaceState({}, "", $(this).data('tab'));
1106 }); 1107 var hash = window.location.hash.substring(1); 1108 var searchParams = new URLSearchParams(window.location.search) 1109 if (hash == 'respond' || hash == 'comments' || searchParams.has('reviews_order_by') || hash.indexOf('comment-', 0) >= 0) { 1110 w2dc_show_tab($('.w2dc-listing-tabs a[data-tab="#comments-tab"]')); 1111 } else if (hash && $('.w2dc-listing-tabs a[data-tab="#'+hash+'"]').length) { 1112 w2dc_show_tab($('.w2dc-listing-tabs a[data-tab="#'+hash+'"]')); 1113 } 1114 } 1115 } 1116 // open reviews on click on reviews counter link 1117 $("a.w2rr-counter-reviews-link").on("click", function() { 1118 var anchor; 1119 if (anchor = $(this).attr("href").split("#").pop()) { 1120 if (anchor == "comments-tab" && $('.w2dc-listing-tabs a[data-tab="#'+anchor+'"]').length) { 1121 w2dc_show_tab($('.w2dc-listing-tabs a[data-tab="#'+anchor+'"]')); 1122 } 1123 } 1124 }); 1125 window.w2dc_show_tab = function(tab) { 1126 $('.w2dc-listing-tabs li').removeClass('w2dc-active'); 1127 tab.parent().addClass('w2dc-active'); 1128 $('.w2dc-tab-content .w2dc-tab-pane').removeClass('w2dc-in w2dc-active'); 1129 $('.w2dc-tab-content '+tab.data('tab')).addClass('w2dc-in w2dc-active'); 1130 if (tab.data('tab') == '#addresses-tab') { 1131 w2dc_reload_maps(); 1132 } 1133 tab.trigger("w2dc:show_tab"); 1134 }; 1135 window.w2dc_reload_maps = function() { 1136 for (var key in w2dc_maps) { 1137 if (typeof w2dc_maps[key] == 'object') { 1138 w2dc_reloadMap(key); 1139 } 1140 } 1141 }; 1142 1143 window.w2dc_radius_slider = function () { 1144 $('.w2dc-radius-slider').each(function() { 1145 var id = $(this).data("id"); 1146 $('#radius_slider_'+id).slider({ 1147 isRTL: w2dc_js_objects.is_rtl, 1148 min: parseInt(slider_params.min), 1149 max: parseInt(slider_params.max), 1150 range: "min", 1151 value: $("#radius_"+id).val(), 1152 slide: function(event, ui) { 1153 $("#radius_label_"+id).html(ui.value); 1154 }, 1155 stop: function(event, ui) { 1156 $("#radius_"+id).val(ui.value); 1157 if ( 1158 $("#radius_"+id).val() > 0 && 1159 $(this).parents("form").find("input[name='address']").length && 1160 $(this).parents("form").find("input[name='address']").val() 1161 ) { 1162 $("#radius_"+id).trigger("change"); 1163 } 1164 } 1165 }); 1166 }); 1167 } 1168 1169 window.w2dc_hint = function () { 1170 $("a.w2dc-hint-icon").each(function() { 1171 $(this).w2dc_popover({ 1172 trigger: "hover", 1173 container: $(this).parents(".w2dc-content") 1174 }); 1175 }); 1176 } 1177 1178 window.w2dc_favourites = function () { 1179 // Place listings to/from favourites list 1180 if ($(".add_to_favourites").length) { 1181 $('body').on('click', ".add_to_favourites", function() { 1182 var listing_id = $(this).attr("listingid"); 1183 1184 if ($.cookie("favourites") != null) { 1185 var favourites_array = $.cookie("favourites").split('*'); 1186 } else { 1187 var favourites_array = new Array(); 1188 } 1189 if (w2dc_in_array(listing_id, favourites_array) === false) { 1190 favourites_array.push(listing_id); 1191 $(this).find('span.w2dc-glyphicon').removeClass(w2dc_js_objects.not_in_favourites_icon).addClass(w2dc_js_objects.in_favourites_icon); 1192 $(this).find('span.w2dc-bookmark-button').text(w2dc_js_objects.not_in_favourites_msg); 1193 } else { 1194 for (var count=0; count<favourites_array.length; count++) {
1195 if (favourites_array[count] == listing_id) { 1196 delete favourites_array[count]; 1197 } 1198 } 1199 $(this).find('span.w2dc-glyphicon').removeClass(w2dc_js_objects.in_favourites_icon).addClass(w2dc_js_objects.not_in_favourites_icon); 1200 $(this).find('span.w2dc-bookmark-button').text(w2dc_js_objects.in_favourites_msg); 1201 } 1202 $.cookie("favourites", favourites_array.join('*'), {expires: 365, path: "/"}); 1203 return false; 1204 }); 1205 } 1206 } 1207 1208 window.w2dc_week_day_input = function () { 1209 // Set the same hours for all further selectboxes 1210 $('.w2dc-week-day-input-from-hour, .w2dc-week-day-input-to-hour, .w2dc-week-day-input-from-am-pm, .w2dc-week-day-input-to-am-pm').on('change', function() { 1211 var select_class = $(this).attr('class').replace('w2dc-week-day-input ', ''); 1212 var index = $(this).index('.'+select_class); 1213 var val = $(this).val(); 1214 1215 $('.'+select_class).each(function(i, select) { 1216 if ($(this).index('.'+select_class) > index && !$(this).attr('disabled') && $(select).val() == "00:00") { 1217 $(this).val(val); 1218 } 1219 }); 1220 }); 1221 } 1222 1223 window.w2dc_check_is_week_day_closed = function () { 1224 $('.closed_cb').each(function() { 1225 _w2dc_check_is_week_day_closed($(this)); 1226 }); 1227 $('body').on('click', '.closed_cb', function() { 1228 _w2dc_check_is_week_day_closed($(this)); 1229 }); 1230 } 1231 1232 window._w2dc_check_is_week_day_closed = function (cb) { 1233 if (cb.is(":checked")) 1234 cb.parent().find(".w2dc-week-day-input").attr('disabled', 'disabled'); 1235 else 1236 cb.parent().find(".w2dc-week-day-input").removeAttr('disabled'); 1237 } 1238 1239 if (!(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))) { 1240 // refresh page on page back button (except safari) 1241 $(window).on('popstate', function() { 1242 1243 }); 1244 } 1245 1246 window.w2dc_dashboard_tabs = function() { 1247 $('body').on('click', ".w2dc-dashboard-tabs.nav-tabs li", function(e) { 1248 window.location = $(this).find("a").attr("href"); 1249 }); 1250 } 1251 1252 window.w2dc_sticky_scroll = function() { 1253 $('.w2dc-sticky-scroll').each(function() { 1254 var element = $(this); 1255 var id = element.data("id"); 1256 var toppadding = (element.data("toppadding")) ? element.data("toppadding") : 0; 1257 var height = (element.data("height")) ? element.data("height") : null; 1258 1259 if (toppadding == 0 && $("body").hasClass("admin-bar")) { 1260 toppadding = 32; 1261 } 1262 1263 if ($('.site-header.header-fixed').length) { 1264 var headerHeight = $('.site-header.header-fixed').outerHeight(); 1265 toppadding = toppadding + headerHeight; 1266 } 1267 1268 if (!$("#w2dc-scroller-anchor-"+id).length) { 1269 var anchor = $("<div>", { 1270 id: 'w2dc-scroller-anchor-'+id 1271 }); 1272 element.before(anchor); 1273 1274 var background = $("<div>", { 1275 id: 'w2dc-sticky-scroll-background-'+id, 1276 style: {position: 'relative'} 1277 }); 1278 element.after(background); 1279 } 1280 1281 window["w2dc_sticky_scroll_toppadding_"+id] = toppadding; 1282 1283 $("#w2dc-sticky-scroll-background-"+id).position().left = element.position().left; 1284 $("#w2dc-sticky-scroll-background-"+id).position().top = element.position().top; 1285 $("#w2dc-sticky-scroll-background-"+id).width(element.width()); 1286 $("#w2dc-sticky-scroll-background-"+id).height(element.height()); 1287 1288 var w2dc_scroll_function = function(e) { 1289 var id = e.data.id; 1290 var toppadding = e.data.toppadding; 1291 var b = $(document).scrollTop(); 1292 var d = $("#w2dc-scroller-anchor-"+id).offset().top - toppadding; 1293 var c = e.data.obj; 1294 var e = $("#w2dc-sticky-scroll-background-"+id); 1295 1296 c.width(c.parent().width()).css({ 'z-index': 2 }); 1297 1298 // .w2dc-scroller-bottom - this is special class used to restrict the area of scroll of map canvas 1299 if ($(".w2dc-scroller-bottom").length) { 1300 var f = $(".w2dc-scroller-bottom").offset().top - (c.height() + toppadding); 1301 } else { 1302 var f = $(document).height(); 1303 } 1304 1305 if (f > c.height()) { 1306 if (b >= d && b < f) { 1307 c.css({ position: "fixed", top: toppadding }); 1308 e.css({ position: "relative" }); 1309 } else { 1310 if (b <= d) { 1311 c.stop().css({ position: "relative", top: "" }); 1312 e.css({ position: "absolute" }); 1313 } 1314 if (b >= f) { 1315 c.css({ position: "absolute" });
1316 c.stop().offset({ top: f + toppadding }); 1317 e.css({ position: "relative" }); 1318 } 1319 } 1320 } else { 1321 c.css({ position: "relative", top: "" }); 1322 e.css({ position: "absolute" }); 1323 } 1324 }; 1325 if ($(document).width() >= 768) { 1326 var args = {id: id, obj: $(this), toppadding: toppadding}; 1327 $(window).scroll(args, w2dc_scroll_function); 1328 w2dc_scroll_function({data: args}); 1329 } 1330 1331 $("#w2dc-sticky-scroll-background-"+id).css({ position: "relative" }); 1332 }); 1333 } 1334 1335 window.w2dc_full_height_maps = function() { 1336 $('.w2dc-map-canvas-wrapper').each(function() { 1337 var element = $(this); 1338 var height = (element.data("height")) ? element.data("height") : null; 1339 1340 if (height == '100%') { 1341 var toppadding = (element.data("toppadding")) ? element.data("toppadding") : 0; 1342 1343 if (toppadding == 0 && $("body").hasClass("admin-bar")) { 1344 toppadding = 32; 1345 } 1346 1347 if ($('.site-header.header-fixed').length) { 1348 var headerHeight = $('.site-header.header-fixed').outerHeight(); 1349 toppadding = toppadding + headerHeight; 1350 } 1351 1352 element.height(function(index, height) { 1353 return window.innerHeight - toppadding; 1354 }); 1355 $(window).on('resize', function() { 1356 element.height(function(index, height) { 1357 return window.innerHeight - toppadding; 1358 }); 1359 }); 1360 } 1361 }); 1362 } 1363 1364 window.w2dc_tooltips = function() { 1365 $('[data-toggle="w2dc-tooltip"]').w2dc_tooltip({ 1366 trigger : 'hover' 1367 }); 1368 } 1369 1370 window.w2dc_ratings = function() { 1371 $('body').on('click', '.w2dc-rating-active .w2dc-rating-icon', function() { 1372 var rating = $(this).parent(".w2dc-rating-stars"); 1373 var rating_wrapper = $(this).parents(".w2dc-rating"); 1374 1375 if (!rating.hasClass('w2dc-rating-active-noajax')) { 1376 rating_wrapper.fadeTo(2000, 0.3); 1377 1378 $.ajax({
1379 url: w2dc_js_objects.ajaxurl, 1380 type: "POST", 1381 dataType: "json", 1382 data: { 1383 action: 'w2dc_save_rating', 1384 rating: $(this).data("rating"), 1385 post_id: rating.data("listing"), 1386 _wpnonce: rating.data("nonce") 1387 }, 1388 rating_wrapper: rating_wrapper, 1389 success: function(response_from_the_action_function){ 1390 if (response_from_the_action_function != 0 && response_from_the_action_function.html) { 1391 this.rating_wrapper 1392 .replaceWith(response_from_the_action_function.html) 1393 .fadeIn("fast"); 1394 } 1395 } 1396 }); 1397 } else { 1398 var rating_value = $(this).data("rating"); 1399 rating.find('.w2dc-rating-noajax-value').val(rating_value); 1400 rating.find('.w2dc-rating-icon').each(function() { 1401 $(this).removeClass('w2dc-fa-star w2dc-fa-star-o') 1402 if ($(this).data("rating") <= rating_value) { 1403 $(this).addClass('w2dc-fa-star'); 1404 } else { 1405 $(this).addClass('w2dc-fa-star-o'); 1406 } 1407 }); 1408 } 1409 }); 1410 } 1411 1412 window.w2dc_hours_content_field = function() { 1413 function close_option(option) { 1414 if (option.is(":checked")) { 1415 option.parents(".w2dc-week-day-wrap").find("select").attr("disabled", "disabled"); 1416 } else { 1417 option.parents(".w2dc-week-day-wrap").find("select").removeAttr("disabled"); 1418 } 1419 } 1420 $(".w2dc-closed-day-option").each(function() { 1421 close_option($(this)); 1422 }); 1423 $("body").on("change", ".w2dc-closed-day-option", function() { 1424 close_option($(this)); 1425 }); 1426 1427 $("body").on("click", ".w2dc-clear-hours", function() { 1428 $(this).parents(".w2dc-field-input-block").find("select").each( function() { $(this).val($(this).find("option:first").val()).removeAttr('disabled'); }); 1429 $(this).parents(".w2dc-field-input-block").find('input[type="checkbox"]').each( function() { $(this).prop("checked", false); }); 1430 return false; 1431 }); 1432 } 1433 1434 window.w2dc_custom_input_controls = function() { 1435 // Custom input controls 1436 $(".w2dc-checkbox label, .w2dc-radio label").each(function() { 1437 if (!$(this).find(".w2dc-control-indicator").length) { 1438 $(this).append($("<div>").addClass("w2dc-control-indicator")); 1439 } 1440 }); 1441 } 1442 $(document).ajaxComplete(function(event, xhr, settings) { 1443 if (settings.url === w2dc_js_objects.ajaxurl) { 1444 w2dc_custom_input_controls(); 1445 } 1446 }); 1447 1448 window.w2dc_get_rid_of_select2_choosen = function() { 1449 $("select.w2dc-form-control, select.vp-input, select.w2dc-week-day-input, select.w2dc-tokenizer").each(function (i, obj) { 1450 // get rid of select2 1451 if ($(obj).hasClass('select2-hidden-accessible') || $('#s2id_' + $(obj).attr('id')).length) { 1452 $(obj).select2('destroy'); 1453 } 1454 // get rid of chosen 1455 if ($('#' + $(obj).attr('id') + '_chosen').length) { 1456 $(obj).chosen('destroy'); 1457 } 1458 }); 1459 } 1460 1461 window.w2dc_equalColumnsHeightEvent = function() { 1462 $(window).on('orientationchange resize', w2dc_equalColumnsHeight); 1463 } 1464 1465 window.w2dc_equalColumnsHeight = function() { 1466 setTimeout(function(){ 1467 $(".w2dc-listings-grid .w2dc-listing, .w2dc-mobile-listings-grid-2 .w2dc-listing").css('height', ''); 1468 1469 var currentTallest = 0; 1470 var currentRowStart = 0; 1471 var rowDivs = new Array(); 1472 var $el; 1473 var topPosition = 0; 1474 $(".w2dc-listings-grid .w2dc-listing, .w2dc-mobile-listings-grid-2 .w2dc-listing").each(function() { 1475 $el = $(this); 1476 if ($(document).width() >= 768 && !$el.hasClass("w2dc-mobile-listings-grid-1")) { 1477 var topPostion = $el.position().top; 1478 if (currentRowStart != topPostion) { 1479 for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 1480 rowDivs[currentDiv].height(currentTallest); 1481 } 1482 rowDivs.length = 0; 1483 currentRowStart = topPostion; 1484 currentTallest = $el.height(); 1485 rowDivs.push($el); 1486 } else { 1487 rowDivs.push($el); 1488 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 1489 } 1490 for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 1491 rowDivs[currentDiv].height(currentTallest); 1492 } 1493 } 1494 }); 1495 }, 500); 1496 } 1497 1498 window.w2dc_isSidebarOpen = function(map_id) { 1499 return ($("#w2dc-map-wrapper-"+map_id).length && $("#w2dc-map-wrapper-"+map_id).hasClass("w2dc-map-sidebar-open")); 1500 } 1501 1502 $.fn.swipeDetector = function (options) { 1503 // States: 0 - no swipe, 1 - swipe started, 2 - swipe released 1504 var swipeState = 0; 1505 // Coordinates when swipe started 1506 var startX = 0; 1507 var startY = 0; 1508 // Distance of swipe 1509 var pixelOffsetX = 0; 1510 var pixelOffsetY = 0; 1511 // Target element which should detect swipes. 1512 var swipeTarget = this; 1513 var defaultSettings = { 1514 // Amount of pixels, when swipe don't count. 1515 swipeThreshold: 70, 1516 // Flag that indicates that plugin should react only on touch events. 1517 // Not on mouse events too. 1518 useOnlyTouch: false 1519 }; 1520 1521 // Initializer
1522 (function init() { 1523 options = $.extend(defaultSettings, options); 1524 // Support touch and mouse as well. 1525 swipeTarget.on('mousedown touchstart', swipeStart); 1526 $('html').on('mouseup touchend', swipeEnd); 1527 $('html').on('mousemove touchmove', swiping); 1528 })(); 1529 1530 function swipeStart(event) { 1531 if (options.useOnlyTouch && !event.originalEvent.touches) 1532 return; 1533 1534 if (event.originalEvent.touches) 1535 event = event.originalEvent.touches[0]; 1536 1537 if (swipeState === 0) { 1538 swipeState = 1; 1539 startX = event.clientX; 1540 startY = event.clientY; 1541 } 1542 } 1543 1544 function swipeEnd(event) { 1545 if (swipeState === 2) { 1546 swipeState = 0; 1547 1548 if (Math.abs(pixelOffsetX) > Math.abs(pixelOffsetY) && 1549 Math.abs(pixelOffsetX) > options.swipeThreshold) { // Horizontal Swipe 1550 if (pixelOffsetX < 0) { 1551 swipeTarget.trigger($.Event('swipeLeft.sd')); 1552 } else { 1553 swipeTarget.trigger($.Event('swipeRight.sd')); 1554 } 1555 } else if (Math.abs(pixelOffsetY) > options.swipeThreshold) { // Vertical swipe 1556 if (pixelOffsetY < 0) { 1557 swipeTarget.trigger($.Event('swipeUp.sd')); 1558 } else { 1559 swipeTarget.trigger($.Event('swipeDown.sd')); 1560 } 1561 } 1562 } 1563 } 1564 1565 function swiping(event) { 1566 // If swipe don't occuring, do nothing. 1567 if (swipeState !== 1) 1568 return; 1569 1570 if (event.originalEvent.touches) { 1571 event = event.originalEvent.touches[0]; 1572 } 1573 1574 var swipeOffsetX = event.clientX - startX; 1575 var swipeOffsetY = event.clientY - startY; 1576 1577 if ((Math.abs(swipeOffsetX) > options.swipeThreshold) || 1578 (Math.abs(swipeOffsetY) > options.swipeThreshold)) { 1579 swipeState = 2; 1580 pixelOffsetX = swipeOffsetX; 1581 pixelOffsetY = swipeOffsetY; 1582 } 1583 } 1584 1585 return swipeTarget; // Return element available for chaining. 1586 } 1587 1588 var w2dc_animation_finished = true; 1589 window.w2dc_listings_carousel = function() { 1590 1591 $(".w2dc-listings-carousel-wrapper").each(function() { 1592 var id = $(this).data("controller-hash"); 1593 var currentTallest = 0; 1594 $(this).find("article.w2dc-listing").each(function() { 1595 currentTallest = (currentTallest < $(this).height()) ? ($(this).height()) : (currentTallest); 1596 }); 1597 $(this).height(currentTallest); 1598 1599 var content = $("#w2dc-controller-"+id+" .w2dc-listings-block-content"); 1600 var carousel = $("#w2dc-controller-"+id+" .w2dc-listings-carousel"); 1601 var button_prev = $("#w2dc-controller-"+id+" .w2dc-listings-carousel-button-left"); 1602 var button_next = $("#w2dc-controller-"+id+" .w2dc-listings-carousel-button-right"); 1603 var slide_width = content.find("article.w2dc-listing").outerWidth(true); 1604 1605 button_prev.on("click", function() { 1606 w2dc_prev_slide(content, slide_width); 1607 }); 1608 1609 button_next.on("click", function() { 1610 w2dc_next_slide(content, slide_width); 1611 }); 1612 1613 carousel.on("mousewheel", function(event, delta, deltaX, deltaY) { 1614 1615 event.stopPropagation(); 1616 event.preventDefault(); 1617 1618 if (delta > 0) { 1619 w2dc_prev_slide(content, slide_width); 1620 } 1621 if (deltaY < 0) { 1622 w2dc_next_slide(content, slide_width); 1623 } 1624 }); 1625 1626 $("#w2dc-controller-"+id+" .w2dc-listings-carousel") 1627 .swipeDetector({ swipeThreshold: 30 }) 1628 .on("swipeRight.sd", function() { 1629 w2dc_prev_slide(content, slide_width); 1630 }) 1631 .on("swipeLeft.sd", function() { 1632 w2dc_next_slide(content, slide_width); 1633 }); 1634 }); 1635 } 1636 window.w2dc_prev_slide = function(content, slide_width) { 1637 if (w2dc_animation_finished) { 1638 var listing = content.find("article.w2dc-listing:last"); 1639 content 1640 .css({ "margin-left": -slide_width }) 1641 .prepend(listing.clone()); 1642 1643 w2dc_animation_finished = false; 1644 content.animate({ 1645 "margin-left": 0 1646 }, 300, function () { 1647 listing.remove(); 1648 w2dc_animation_finished = true; 1649 }); 1650 } 1651 } 1652 window.w2dc_next_slide = function(content, slide_width) { 1653 if (w2dc_animation_finished) { 1654 var listing = content.find("article.w2dc-listing:first"); 1655 content.append(listing.clone()); 1656 1657 w2dc_animation_finished = false; 1658 content.animate({ 1659 "margin-left": -slide_width 1660 }, 300, function () { 1661 listing.remove(); 1662 content.css({ "margin-left": 0 }) 1663 w2dc_animation_finished = true; 1664 }); 1665 } 1666 } 1667 1668 // AJAX Comments scripts 1669 window.w2dc_comments_ajax_load_template = function(params, my_global) { 1670 var my_global; 1671 var request_in_process = false; 1672 1673 params.action = "w2dc_comments_load_template"; 1674 1675 $.ajax({
1676 url: w2dc_js_objects.ajaxurl, 1677 type: "POST", 1678 dataType: "html", 1679 data: params, 1680 global: my_global, 1681 success: function( msg ){ 1682 $(params.target_div).fadeIn().html(msg); 1683 request_in_process = false; 1684 if (typeof params.callback === "function") { 1685 params.callback(); 1686 } 1687 } 1688 }); 1689 } 1690 $(document).on('submit', '#w2dc_default_add_comment_form', function(e) { 1691 e.preventDefault(); 1692 1693 var $this = $(this); 1694 $this.css('opacity', '0.5'); 1695 1696 var data = { 1697 action: "w2dc_comments_add_comment", 1698 post_id: $('#w2dc_comments_ajax_handle').data('post_id'), 1699 user_name: $('#w2dc_comments_user_name').val(), 1700 user_email: $('#w2dc_comments_user_email').val(), 1701 user_url: $('#w2dc_comments_user_url').val(), 1702 comment: $('#comment').val(), 1703 comment_parent: $('#comment_parent').val(), 1704 security: $('#w2dc_comments_nonce').val() 1705 }; 1706 1707 $.ajax({
1708 url: w2dc_js_objects.ajaxurl, 1709 type: "POST", 1710 dataType: "html", 1711 data: data, 1712 global: false, 1713 success: function( msg ){ 1714 w2dc_comments_ajax_load_template({ 1715 "target_div": "#w2dc_comments_ajax_target", 1716 "template": $('#w2dc_comments_ajax_handle').attr('data-template'), 1717 "post_id": $('#w2dc_comments_ajax_handle').attr('data-post_id'), 1718 "security": $('#w2dc_comments_nonce').val() 1719 }, false ); 1720 $('textarea').val(''); 1721 $this.css('opacity', '1'); 1722 } 1723 }); 1724 }); 1725 $(document).on('keypress', '#w2dc_default_add_comment_form textarea, #w2dc_default_add_comment_form input', function(e) { 1726 if (e.keyCode == '13') { 1727 e.preventDefault(); 1728 $('#w2dc_default_add_comment_form').trigger('submit'); 1729 } 1730 }); 1731 window.w2dc_load_comments = function() { 1732 if ($('#w2dc_comments_ajax_handle').length) { 1733 1734 var data = { 1735 "action": "w2dc_comments_load_template", 1736 "target_div": "#w2dc_comments_ajax_target", 1737 "template": $('#w2dc_comments_ajax_handle').data('template'), 1738 "post_id": $('#w2dc_comments_ajax_handle').data('post_id'), 1739 "security": $('#w2dc_comments_nonce').val() 1740 }; 1741 1742 $.ajax({
1743 url: w2dc_js_objects.ajaxurl, 1744 type: "POST", 1745 dataType: "html", 1746 data: data, 1747 success: function(msg){ 1748 $("#w2dc_comments_ajax_target").fadeIn().html(msg); // Give a smooth fade in effect 1749 if (window.location.hash && $(window.location.hash).length){ 1750 $('html, body').animate({ 1751 scrollTop: $(window.location.hash).offset().top 1752 }); 1753 $(window.location.hash).addClass('w2dc-comments-highlight'); 1754 } 1755 } 1756 }); 1757 1758 $(document).on('click', '.w2dc-comments-time-handle', function(e) { 1759 $('.w2dc-comments-content').removeClass('w2dc-comments-highlight') 1760 comment_id = '#comment-' + $(this).attr('data-comment_id'); 1761 $(comment_id).addClass('w2dc-comments-highlight'); 1762 }); 1763 } 1764 }; 1765 $(document).on('click', '#w2dc_cancel_reply', function(e) { 1766 $('#comment_parent').val(0); 1767 $('#w2dc-comments-leave-comment-label').html(w2dc_js_objects.leave_comment); 1768 }); 1769 $(document).on('click', '.w2dc-comment-reply', function(e) { 1770 var comment_id = $(this).data("comment-id"); 1771 var comment_author = $(this).data("comment-author"); 1772 $('#comment_parent').val(comment_id); 1773 $('#w2dc-comments-leave-comment-label').html(w2dc_js_objects.leave_reply+" "+comment_author+". <a id='w2dc_cancel_reply' href='javascript: void(0);'>"+w2dc_js_objects.cancel_reply+"</a>"); 1774 }); 1775 $(document).on('click', '.w2dc-comments-more-handle', function(e) { 1776 e.preventDefault(); 1777 if ($(this).hasClass('w2dc-comments-more-open')) { 1778 $('a', this).html(w2dc_js_objects.more); 1779 $('#comment').css('height', '0'); 1780 } else { 1781 $('a', this).html(w2dc_js_objects.less); 1782 $('#comment').css('height', '150'); 1783 } 1784 $(this).toggleClass('w2dc-comments-more-open'); 1785 $('.w2dc-comments-more-container').toggle(); 1786 }); 1787 1788 window.w2dc_content_fields_metabox = function() { 1789 hideShowFields_init(); 1790 1791 $("input[name='tax_input\\[w2dc-category\\]\\[\\]']").change(function() { hideShowFields_onclick($(this)) }); 1792 $("#w2dc-category-pop input[type=checkbox]").change(function() { hideShowFields_onclick($(this)) }); 1793 1794 function hideShowFields_init() { 1795 var selected_categories_ids = []; 1796 $.each($("input[name='tax_input\\[w2dc-category\\]\\[\\]']:checked"), function() { 1797 selected_categories_ids.push($(this).val()); 1798 }); 1799 1800 $(".w2dc-content-fields-metabox").show(); 1801 $(".w2dc-field-input-block").hide(); 1802 $.each(w2dc_js_objects.fields_in_categories, function(index, value) { 1803 var show_field = false; 1804 if (value != undefined) { 1805 if (value.length > 0) { 1806 var key; 1807 for (key in value) { 1808 var key2; 1809 for (key2 in selected_categories_ids) { 1810 if (value[key] == selected_categories_ids[key2]) { 1811 show_field = true; 1812 } 1813 } 1814 } 1815 } 1816 1817 if ((value.length == 0 || show_field) && $(".w2dc-field-input-block-"+index).length) { 1818 $(".w2dc-field-input-block-"+index).show(); 1819 } 1820 } 1821 }); 1822 $.each($(".w2dc-content-fields-metabox"), function() { 1823 if ($(this).find(".w2dc-field-input-block").filter(function() { return $(this).css("display") != "none"; }).length) { 1824 $(this).show(); 1825 } else { 1826 $(this).hide(); 1827 } 1828 }); 1829 } 1830 1831 function hideShowFields_onclick(input) { 1832 var checked = input.prop('checked'); 1833 var id = input.val(); 1834 1835 var fields_to_apply = []; 1836 $.each(w2dc_js_objects.fields_in_categories, function(index, value) { 1837 if (value != undefined) { 1838 if (value.length > 0) { 1839 var key; 1840 for (key in value) { 1841 if (value[key] == id) { 1842 fields_to_apply.push(index); 1843 } 1844 } 1845 } 1846 } 1847 }); 1848 1849 for (var key in fields_to_apply) { 1850 var index = fields_to_apply[key]; 1851 if (checked) { 1852 $(".w2dc-field-input-block-"+index).parents(".w2dc-content-fields-metabox").slideDown(500); 1853 $(".w2dc-field-input-block-"+index).slideDown(500); 1854 } else { 1855 $(".w2dc-field-input-block-"+index).slideUp(300, function() { 1856 var metabox = $(this).parents(".w2dc-content-fields-metabox"); 1857 if (!metabox.find(".w2dc-field-input-block:visible").length) { 1858 metabox.slideUp(500); 1859 } 1860 });
1861 } 1862 } 1863 } 1864 }; 1865 1866 window.w2dc_scroll_to_anchor = function(scroll_to_anchor, offest_top) { 1867 if (typeof scroll_to_anchor != 'undefined' && scroll_to_anchor) { 1868 if (typeof offest_top == 'undefined' || !offest_top) { 1869 var offest_top = 0; 1870 } 1871 $('html,body').animate({scrollTop: scroll_to_anchor.offset().top - offest_top}, 'slow'); 1872 } 1873 } 1874 1875 window.w2dc_ajax_loader_target_show = function(target, scroll_to_anchor, offest_top) { 1876 if (typeof scroll_to_anchor != 'undefined' && scroll_to_anchor) { 1877 if (typeof offest_top == 'undefined' || !offest_top) { 1878 var offest_top = 0; 1879 } 1880 $('html,body').animate({scrollTop: scroll_to_anchor.offset().top - offest_top}, 'slow'); 1881 } 1882 var id = target.attr("id"); 1883 if (!$("[data-loader-id='"+id+"']").length) { 1884 var loader = $('<div data-loader-id="'+id+'" class="w2dc-ajax-target-loading"><div class="w2dc-loader"></div></div>'); 1885 target.prepend(loader); 1886 loader.css({ 1887 width: target.outerWidth()+10, 1888 height: target.outerHeight()+10 1889 }); 1890 if (target.outerHeight() > 600) { 1891 loader.find(".w2dc-loader").addClass("w2dc-loader-max-top"); 1892 } 1893 } 1894 } 1895 window.w2dc_ajax_loader_target_hide = function(id) { 1896 $("[data-loader-id='"+id+"']").remove(); 1897 } 1898 1899 window.w2dc_ajax_loader_show = function(msg) { 1900 var overlay = $('<div id="w2dc-ajax-loader-overlay"><div class="w2dc-loader"></div></div>'); 1901 $('body').append(overlay); 1902 } 1903 1904 window.w2dc_ajax_loader_hide = function() { 1905 $("#w2dc-ajax-loader-overlay").remove(); 1906 } 1907 1908 window.w2dc_get_controller_args_array = function(hash) { 1909 if (typeof w2dc_controller_args_array != 'undefined' && Object.keys(w2dc_controller_args_array)) { 1910 for (var controller_hash in w2dc_controller_args_array) { 1911 if (controller_hash == hash) { 1912 return w2dc_controller_args_array[controller_hash]; 1913 } 1914 } 1915 } 1916 } 1917 1918 window.w2dc_get_map_markers_attrs_array = function(hash) { 1919 if (typeof w2dc_map_markers_attrs_array != 'undefined' && Object.keys(w2dc_map_markers_attrs_array)) { 1920 for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) { 1921 if (hash == w2dc_map_markers_attrs_array[i].map_id) { 1922 return w2dc_map_markers_attrs_array[i]; 1923 } 1924 } 1925 } 1926 } 1927 1928 window.w2dc_get_original_map_markers_attrs_array = function(hash) { 1929 if (typeof _w2dc_map_markers_attrs_array != 'undefined' && Object.keys(_w2dc_map_markers_attrs_array)) { 1930 for (var i=0; i<_w2dc_map_markers_attrs_array.length; i++) { 1931 if (hash == _w2dc_map_markers_attrs_array[i].map_id) { 1932 return _w2dc_map_markers_attrs_array[i]; 1933 } 1934 } 1935 } 1936 } 1937 1938 window.w2dc_map_sidebar_scrollto = function(map_id, location_id) { 1939 if ($('#w2dc-map-listings-panel-'+map_id).length) { 1940 1941 if ($('#w2dc-map-sidebar-'+map_id).hasClass('w2dc-map-sidebar-fixed')) { 1942 var sidebar_listings = $('#w2dc-map-sidebar-listings-wrapper-'+map_id); 1943 } else { 1944 var sidebar_listings = $('#w2dc-map-sidebar-'+map_id); 1945 } 1946 1947 if (sidebar_listings.find('#post-'+location_id).length) { 1948 sidebar_listings.scrollTop( 1949 sidebar_listings.scrollTop() 1950 + 1951 sidebar_listings.find('#post-'+location_id).offset().top 1952 - 1953 sidebar_listings.offset().top 1954 ); 1955 } 1956 } 1957 } 1958 1959 window.w2dc_process_listings_ajax_response = function(response_from_the_action_function, do_replace, remove_shapes, do_replace_markers) { 1960 var response_hash = response_from_the_action_function.hash; 1961 if (response_from_the_action_function) { 1962 var listings_block = $('#w2dc-controller-'+response_hash); 1963 if (do_replace) { 1964 listings_block.replaceWith(response_from_the_action_function.html); 1965 } else { 1966 listings_block.find(".w2dc-listings-block-content").append(response_from_the_action_function.html); 1967 } 1968 1969 w2dc_listings_carousel(); 1970 1971 if (response_from_the_action_function.map_markers && typeof w2dc_maps[response_hash] != 'undefined') { 1972 if (do_replace) { 1973 w2dc_clearMarkers(response_hash); 1974 } 1975 if (remove_shapes) { 1976 w2dc_removeShapes(response_hash); 1977 w2dc_removeCircles(response_hash); 1978 } 1979 w2dc_closeInfoWindow(response_hash); 1980 1981 var markers_array = response_from_the_action_function.map_markers; 1982
1983 var enable_radius_circle = 0; 1984 var enable_clusters = 0; 1985 var show_summary_button = 1; 1986 var show_readmore_button = 1; 1987 var is_ajax_markers = 0; 1988 var attrs_array; 1989 if (attrs_array = w2dc_get_map_markers_attrs_array(response_hash)) { 1990 var enable_radius_circle = attrs_array.enable_radius_circle; 1991 var enable_clusters = attrs_array.enable_clusters; 1992 var show_summary_button = attrs_array.show_summary_button; 1993 var show_readmore_button = attrs_array.show_readmore_button; 1994 var map_attrs = attrs_array.map_attrs; 1995 var is_ajax_markers = attrs_array.map_attrs.ajax_markers_loading; 1996 1997 if (do_replace_markers) { 1998 attrs_array.markers_array = eval(response_from_the_action_function.map_markers); 1999 } 2000 } 2001 2002 var map_id = response_hash; 2003 var existing_locations = []; 2004 if (typeof w2dc_global_locations_array[map_id] != 'undefined') { 2005 for (var i=0; i<w2dc_global_locations_array[map_id].length; i++) { 2006 if (typeof w2dc_global_locations_array[map_id][i] == 'object') { 2007 existing_locations.push(w2dc_global_locations_array[map_id][i].id); 2008 } 2009 } 2010 } 2011 2012 for (var j=0; j<markers_array.length; j++) { 2013 if (!existing_locations.includes(markers_array[j][0])) { 2014 var map_coords_1 = markers_array[j][1]; 2015 var map_coords_2 = markers_array[j][2]; 2016 if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) { 2017 var point = w2dc_buildPoint(map_coords_1, map_coords_2); 2018 2019 var location_obj = new w2dc_glocation(markers_array[j][0], point, 2020 markers_array[j][3], 2021 markers_array[j][4], 2022 markers_array[j][6], 2023 markers_array[j][7], 2024 markers_array[j][8], 2025 markers_array[j][9], 2026 markers_array[j][10], 2027 markers_array[j][11], 2028 show_summary_button, 2029 show_readmore_button, 2030 response_hash, 2031 is_ajax_markers 2032 ); 2033 var marker = location_obj.w2dc_placeMarker(response_hash); 2034 w2dc_global_locations_array[response_hash].push(location_obj); 2035 } 2036 } 2037 } 2038 2039 // fit bounds only when no AJAX map 2040 if (typeof attrs_array.map_attrs.ajax_map_loading == 'undefined' || attrs_array.map_attrs.ajax_map_loading == 0) { 2041 if (w2dc_global_markers_array[response_hash].length) { 2042 var bounds = w2dc_buildBounds(); 2043 for (var j=0; j<w2dc_global_markers_array[response_hash].length; j++) { 2044 var marker = w2dc_global_markers_array[response_hash][j]; 2045 var marker_position = w2dc_getMarkerPosition(marker); 2046 w2dc_extendBounds(bounds, marker_position); 2047 } 2048 w2dc_mapFitBounds(response_hash, bounds); 2049 2050 if (w2dc_global_markers_array[response_hash].length == 1) { 2051 w2dc_setMapZoom(response_hash, ZOOM_FOR_SINGLE_MARKER); 2052 } 2053 } 2054 } 2055 2056 w2dc_setClusters(enable_clusters, response_hash, w2dc_global_markers_array[response_hash]); 2057 2058 w2dc_removeCircles(response_hash); 2059 if (enable_radius_circle && typeof response_from_the_action_function.radius_params != 'undefined') { 2060 var radius_params = response_from_the_action_function.radius_params; 2061 2062 // PanTo only on AJAX Map 2063 if (w2dc_hasChangedGeocodedCoordinates(radius_params, response_hash)) { 2064 var map_coords_1 = radius_params.map_coords_1; 2065 var map_coords_2 = radius_params.map_coords_2; 2066 2067 w2dc_panTo(response_hash, map_coords_1, map_coords_2); 2068 } 2069 2070 w2dc_saveGeocodedCoordinates(radius_params, response_hash); 2071 2072 w2dc_drawRadius(radius_params, response_hash); 2073 } 2074 } 2075 if (typeof response_from_the_action_function.map_listings != 'undefined' && typeof w2dc_maps[response_hash] != 'undefined') { 2076 var map_listings_block = $('#w2dc-map-listings-panel-'+response_hash); 2077 if (map_listings_block.length) { 2078 if (do_replace) { 2079 map_listings_block.html(response_from_the_action_function.map_listings); 2080 } else { 2081 map_listings_block.append(response_from_the_action_function.map_listings); 2082 } 2083 } 2084 } 2085 } 2086 w2dc_equalColumnsHeight(); 2087 if (w2dc_js_objects.is_maps_used) { 2088 w2dc_show_on_map_links(); 2089 } 2090 w2dc_sticky_scroll(); 2091 } 2092 2093 window.w2dc_load_ajax_initial_elements = function() { 2094 // We have to wait while Google Maps API will be completely loaded 2095 if (typeof w2dc_controller_args_array != 'undefined' && Object.keys(w2dc_controller_args_array)) { 2096 for (var controller_hash in w2dc_controller_args_array) { 2097 2098 var post_params = { hash: controller_hash, from_ajax_map: 1 }; 2099 post_params = w2dc_collectAJAXParams(post_params); 2100 post_params.ajax_action = 'ajax_initial_load'; 2101 2102 // ajax_map_loading=1 means that a map follows listings controller 2103 if ( 2104 !(typeof post_params.ajax_map_loading != 'undefined' && post_params.ajax_map_loading == 1) && 2105 (typeof post_params.ajax_initial_load != 'undefined' && post_params.ajax_initial_load == 1) 2106 ) { 2107 post_params.ajax_initial_load = 0; 2108 2109 $.post( 2110 w2dc_js_objects.ajaxurl, 2111 post_params, 2112 function(response_from_the_action_function) { 2113 w2dc_process_listings_ajax_response(response_from_the_action_function, true, true, true); 2114 2115 var response_hash = response_from_the_action_function.hash; 2116 if (response_from_the_action_function.map_markers && typeof w2dc_maps[response_hash] != 'undefined') { 2117 if (typeof _w2dc_map_markers_attrs_array != 'undefined' && _w2dc_map_markers_attrs_array.length) { 2118 for (var i=0; i<_w2dc_map_markers_attrs_array.length; i++) { 2119 if (response_hash == _w2dc_map_markers_attrs_array[i].map_id) { 2120 _w2dc_map_markers_attrs_array[i].markers_array = eval(response_from_the_action_function.map_markers); 2121 } 2122 } 2123 } 2124 } 2125 }, 2126 'json' 2127 ); 2128 } 2129 } 2130 } 2131 } 2132 2133 window.w2dc_ajax_iloader = $("<div>", { class: 'w2dc-ajax-iloader' }).html('<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div>'); 2134 window.w2dc_add_iloader_on_element = function(button) { 2135 button 2136 .attr('disabled', 'disabled') 2137 .wrapInner('<div class="w2dc-hidden"></div>') 2138 .append(w2dc_ajax_iloader); 2139 } 2140 window.w2dc_delete_iloader_from_element = function(button) { 2141 button.find(".w2dc-hidden").contents().unwrap(); 2142 button.removeAttr('disabled').find(".w2dc-ajax-iloader").remove(); 2143 } 2144 2145 var w2dc_show_more_button_processing = false; 2146 $(window).scroll(function() { 2147 $('.w2dc-show-more-button.w2dc-scrolling-paginator:visible').each(function() { 2148 if ($(window).scrollTop() + $(window).height() > $(this).position().top) { 2149 if (!w2dc_show_more_button_processing) { 2150 w2dc_callShowMoreListings($(this)); 2151 } 2152 } 2153 }); 2154 }); 2155 $('body').on('click', '.w2dc-show-more-button', function(e) { 2156 e.preventDefault(); 2157 w2dc_callShowMoreListings($(this)); 2158 }); 2159 var w2dc_callShowMoreListings = function(button) { 2160
2161 if (button.data("controller-hash")) { 2162 2163 w2dc_add_iloader_on_element(button); 2164 2165 var controller_hash = button.data("controller-hash"); 2166 var post_params = w2dc_collectAJAXParams({ hash: controller_hash }); 2167 post_params.ajax_action = 'show_more'; 2168 2169 if (typeof post_params.paged != 'undefined') { 2170 var paged = parseInt(post_params.paged)+1; 2171 } else { 2172 var paged = 2; 2173 } 2174 post_params.paged = paged; 2175 post_params.page = paged; 2176 post_params.do_append = 1; 2177 2178 w2dc_show_more_button_processing = true; 2179 $.post( 2180 w2dc_js_objects.ajaxurl, 2181 post_params, 2182 w2dc_completeAJAXShowMore(button), 2183 'json' 2184 ); 2185 } 2186 } 2187 var w2dc_completeAJAXShowMore = function(button) { 2188 return function(response_from_the_action_function) { 2189 var controller_hash = response_from_the_action_function.hash; 2190 2191 w2dc_process_listings_ajax_response(response_from_the_action_function, false, false, false); 2192 2193 if (typeof w2dc_controller_args_array[controller_hash].paged != 'undefined') { 2194 var paged = parseInt(w2dc_controller_args_array[controller_hash].paged)+1; 2195 } else { 2196 var paged = 2; 2197 } 2198 w2dc_controller_args_array[controller_hash].paged = paged; 2199 2200 w2dc_show_more_button_processing = false; 2201 w2dc_delete_iloader_from_element(button); 2202 if (response_from_the_action_function.hide_show_more_listings_button) { 2203 button.hide(); 2204 } 2205 } 2206 } 2207 2208 window.w2dc_collectAJAXParams = function(post_params) { 2209 2210 post_params.action = "w2dc_controller_request"; 2211 2212 var controller_hash = false; 2213 if (post_params.hash) { 2214 controller_hash = post_params.hash; 2215 } else { 2216 if ($(".w2dc-controller").length) { 2217 post_params.hash = $(".w2dc-controller").data("controller-hash"); 2218 controller_hash = post_params.hash; 2219 } else { 2220 return post_params; 2221 } 2222 } 2223 2224 w2dc_checkGeocodedCoordinates(controller_hash); 2225 2226 // collect needed params from map FIRST OF ALL, then from listings, listings params can overwrite map's params 2227 var map_args_array; 2228 if (map_args_array = w2dc_get_map_markers_attrs_array(controller_hash)) { 2229 2230 post_params = $.extend({}, post_params, map_args_array); 2231 post_params = $.extend({}, post_params, map_args_array.map_attrs); 2232 2233 delete post_params.markers_array; 2234 delete post_params.map_attrs; 2235 2236 post_params.with_map = 1; 2237 2238 if (typeof map_args_array.map_attrs.ajax_map_loading != 'undefined' && map_args_array.map_attrs.ajax_map_loading == 1) { 2239 if (typeof post_params.from_ajax_map == 'undefined' || post_params.from_ajax_map == 0) { 2240 w2dc_setAjaxMarkers(w2dc_maps[controller_hash], controller_hash); 2241 } 2242 } 2243 2244 if ($("#w2dc-map-listings-panel-"+controller_hash).length) { 2245 post_params.map_listings = 1; 2246 } 2247 } 2248 2249 if ($("#w2dc-controller-"+controller_hash).length) { 2250 // collect needed params from listing block 2251 var listings_args_array; 2252 if (listings_args_array = w2dc_get_controller_args_array(controller_hash)) { 2253 post_params = $.extend({}, post_params, listings_args_array); 2254 2255 var existing_listings = ""; 2256 $("#w2dc-controller-"+controller_hash+" .w2dc-listings-block-content article[id^='post-']").each(function(index) { 2257 existing_listings = $(this).attr("id").replace("post-", "") + "," + existing_listings; 2258 }); 2259 post_params.existing_listings = existing_listings; 2260 } 2261 } else { 2262 post_params.without_listings = 1; 2263 } 2264 2265 // query string from wcsearch 2266 if (typeof wcsearch_query_string != "undefined") { 2267 post_params.query_string = wcsearch_query_string; 2268 } 2269 2270 return post_params; 2271 } 2272 2273 window.w2dc_callAJAXSearch = function(post_params) { 2274 post_params.from_ajax_map = 1; 2275 post_params = w2dc_collectAJAXParams(post_params); 2276 post_params.ajax_action = 'search'; 2277 2278 // set to first page after collection 2279 post_params.paged = 1; 2280 2281 w2dc_startAJAXSearch(post_params); 2282 } 2283 2284 window.w2dc_sendGeoPolyAJAX = function(map_id, geo_poly_ajax) { 2285 2286 var post_params = { hash: map_id }; 2287 post_params = w2dc_collectAJAXParams(post_params); 2288 post_params.geo_poly = geo_poly_ajax; 2289 // set to first page after collection 2290 post_params.paged = 1; 2291 post_params.ajax_action = 'geo_poly'; 2292 2293 $.post( 2294 w2dc_js_objects.ajaxurl, 2295 post_params, 2296 function(response_from_the_action_function) { 2297 w2dc_process_listings_ajax_response(response_from_the_action_function, true, false, false); 2298 }, 2299 'json' 2300 ); 2301 } 2302 2303 var w2dc_search_requests_counter = 0; 2304 var w2dc_startAJAXSearch = function(post_params) { 2305 w2dc_search_requests_counter++; 2306 $.post( 2307 w2dc_js_objects.ajaxurl, 2308 post_params, 2309 w2dc_completeAJAXSearch(post_params), 2310 'json' 2311 ); 2312 } 2313 2314 var wcsearch_recount_attempts = 0; 2315 var wcsearch_max_counters = 200; 2316 var w2dc_completeAJAXSearch = function(post_params) { 2317 return function(response_from_the_action_function) { 2318 w2dc_search_requests_counter--; 2319 if (w2dc_search_requests_counter == 0) { 2320 2321 if (typeof post_params.geo_poly != 'undefined' && post_params.geo_poly) { 2322 var remove_shapes = false; 2323 } else { 2324 var remove_shapes = true; 2325 } 2326 2327 w2dc_process_listings_ajax_response(response_from_the_action_function, true, remove_shapes, true); 2328 2329 var wcsearch_request_processing = false; 2330 2331 // paginator clicked - do not need to recount 2332 var page = wcsearch_get_query_string_param('page'); 2333 if (!page) { 2334 wcsearch_recount_attempts = 0; 2335 wcsearch_recount(); 2336 } 2337 } 2338 } 2339 } 2340 2341 if (w2dc_js_objects.ajax_load) { 2342 2343 $('body').on('click', '.w2dc-listings-orderby-link', function(e) { 2344 e.preventDefault(); 2345 2346 var href = $(this).attr('href'); 2347 window.history.pushState("", "", href); 2348 2349 var controller_hash = $(this).data('controller-hash'); 2350 var order_by = $(this).data('orderby'); 2351 var order = $(this).data('order'); 2352 2353 wcsearch_extend_query_string_params({ 'order_by': order_by, 'order': order }); 2354 2355 var post_params = w2dc_collectAJAXParams({ hash: controller_hash }); 2356 post_params.order_by = order_by; 2357 post_params.order = order; 2358 post_params.paged = 1; 2359 post_params.ajax_action = 'order'; 2360 2361 $.post( 2362 w2dc_js_objects.ajaxurl, 2363 post_params, 2364 function(response_from_the_action_function) { 2365 w2dc_process_listings_ajax_response(response_from_the_action_function, true, false, true); 2366 }, 2367 'json' 2368 ); 2369 }); 2370 2371 $('body').on('click', '.w2dc-pagination li.w2dc-active a', function(e) { 2372 e.preventDefault(); 2373 }); 2374 $('body').on('click', '.w2dc-listings-block .w2dc-pagination li a', function(e) { 2375 if ($(this).data('controller-hash')) { 2376 e.preventDefault(); 2377 2378 var href = $(this).attr('href'); 2379 window.history.pushState("", "", href); 2380 2381 var controller_hash = $(this).data('controller-hash'); 2382 2383 var anchor = $('#w2dc-controller-'+controller_hash); 2384 if (typeof window["w2dc_sticky_scroll_toppadding_"+controller_hash] != 'undefined') { 2385 var sticky_scroll_toppadding = window["w2dc_sticky_scroll_toppadding_"+controller_hash]; 2386 } else { 2387 var sticky_scroll_toppadding = 0; 2388 } 2389 w2dc_scroll_to_anchor(anchor, sticky_scroll_toppadding); 2390 2391 var post_params = w2dc_collectAJAXParams({ hash: controller_hash }); 2392 post_params.paged = $(this).data('page'); 2393 post_params.ajax_action = 'paginator'; 2394 2395 $.post( 2396 w2dc_js_objects.ajaxurl, 2397 post_params, 2398 function(response_from_the_action_function) { 2399 w2dc_process_listings_ajax_response(response_from_the_action_function, true, false, true); 2400 }, 2401 'json' 2402 ); 2403 } 2404 }); 2405 } 2406 2407 $('body').on('click', '.w2dc-map-search-toggle, .w2dc-map-sidebar-toggle-container, .w2dc-map-sidebar-toggle-container-mobile', function(e) { 2408 e.preventDefault(); 2409 var id = $(this).data('id'); 2410 2411 if ($("#w2dc-map-wrapper-"+id).hasClass("w2dc-map-sidebar-open")) { 2412 w2dc_close_listings_sidebar(id); 2413 } else { 2414 w2dc_open_listings_sidebar(id); 2415 } 2416 }); 2417 $('body').on('click', '.w2dc-map-directions-sidebar-close-button', function(e) { 2418 e.preventDefault(); 2419 var id = $(this).data('id'); 2420 2421 w2dc_open_listings_sidebar(id); 2422 }); 2423 2424 window.w2dc_open_listings_sidebar = function(map_id) { 2425 $("#w2dc-map-wrapper-"+map_id).addClass("w2dc-map-sidebar-open"); 2426 2427 $("body").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { 2428 w2dc_callMapResize(map_id); 2429 }); 2430 } 2431 window.w2dc_close_listings_sidebar = function(map_id) { 2432 $("#w2dc-map-wrapper-"+map_id).removeClass("w2dc-map-sidebar-open"); 2433 2434 $("body").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { 2435 w2dc_callMapResize(map_id); 2436 }); 2437 } 2438 2439 window.w2dc_hasChangedGeocodedCoordinates = function(radius_params, map_id) {
2440 var map_coords_1 = radius_params.map_coords_1; 2441 var map_coords_2 = radius_params.map_coords_2; 2442 2443 if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) { 2444 if (typeof w2dc_map_markers_attrs_array != 'undefined' && Object.keys(w2dc_map_markers_attrs_array)) { 2445 for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) { 2446 if (w2dc_map_markers_attrs_array[i].map_id == map_id) { 2447 if (typeof w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params != 'undefined') { 2448 if ( 2449 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_1 == map_coords_1 && 2450 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_2 == map_coords_2 2451 ) { 2452 return false; 2453 } 2454 } 2455 } 2456 } 2457 } 2458 } 2459 2460 return true; 2461 } 2462 window.w2dc_saveGeocodedCoordinates = function(radius_params, map_id) { 2463 var map_coords_1 = radius_params.map_coords_1; 2464 var map_coords_2 = radius_params.map_coords_2; 2465 2466 if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2) && wcsearch_get_query_string_param('address')) { 2467 if (typeof w2dc_map_markers_attrs_array != 'undefined' && Object.keys(w2dc_map_markers_attrs_array)) { 2468 for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) { 2469 if (w2dc_map_markers_attrs_array[i].map_id == map_id) { 2470 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params = {}; 2471 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_1 = map_coords_1; 2472 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_2 = map_coords_2; 2473 w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.address = wcsearch_get_query_string_param('address'); 2474 } 2475 } 2476 } 2477 } 2478 } 2479 window.w2dc_checkGeocodedCoordinates = function(map_id) { 2480 2481 if (typeof w2dc_map_markers_attrs_array != 'undefined' && Object.keys(w2dc_map_markers_attrs_array)) { 2482 for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) { 2483 if (map_id == w2dc_map_markers_attrs_array[i].map_id) { 2484 if (typeof w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params != 'undefined') { 2485 var address_string = wcsearch_get_query_string_param('address'); 2486 2487 if (w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.address != address_string) { 2488 delete w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.address; 2489 delete w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_1; 2490 delete w2dc_map_markers_attrs_array[i].map_attrs.geocoded_params.map_coords_2; 2491 } 2492 } 2493 } 2494 } 2495 } 2496 } 2497 2498 $('body').on('click', '.w2dc-list-view-btn', function() { 2499 var button = $(this); 2500 var hash = button.data('shortcode-hash'); 2501 var listings_block = $('#w2dc-controller-'+hash).find('.w2dc-listings-block'); 2502 if (listings_block.hasClass('w2dc-listings-grid')) { 2503 listings_block.find('.w2dc-listings-block-content').fadeTo("fast", 0, function() { 2504 button.removeClass('w2dc-btn-default').addClass('w2dc-btn-primary'); 2505 button.parents('.w2dc-views-links').find('.w2dc-grid-view-btn').removeClass('w2dc-btn-primary').addClass('w2dc-btn-default'); 2506 listings_block.removeClass('w2dc-listings-grid w2dc-listings-grid-1 w2dc-listings-grid-2 w2dc-listings-grid-3 w2dc-listings-grid-4'); 2507 listings_block.addClass('w2dc-listings-list-view'); 2508 listings_block.find('article.w2dc-listing').each(function() { 2509 $(this).css('height', 'auto'); 2510 }); 2511 $.cookie("w2dc_listings_view_"+hash, 'list', {expires: 365, path: "/"}); 2512 }); 2513 listings_block.find('.w2dc-listings-block-content').fadeTo("fast", 1); 2514 } 2515 }); 2516 $('body').on('click', '.w2dc-grid-view-btn', function() { 2517 var button = $(this); 2518 var hash = button.data('shortcode-hash'); 2519 var listings_block = $('#w2dc-controller-'+hash).find('.w2dc-listings-block'); 2520 if (!listings_block.hasClass('w2dc-listings-grid')) { 2521 listings_block.find('.w2dc-listings-block-content').fadeTo("fast", 0, function() { 2522 button.removeClass('w2dc-btn-default').addClass('w2dc-btn-primary'); 2523 button.parents('.w2dc-views-links').find('.w2dc-list-view-btn').removeClass('w2dc-btn-primary').addClass('w2dc-btn-default'); 2524 listings_block.removeClass('w2dc-listings-list-view'); 2525 listings_block.addClass('w2dc-listings-grid').addClass('w2dc-listings-grid-'+button.data('grid-columns')); 2526 w2dc_equalColumnsHeight(); 2527 $.cookie("w2dc_listings_view_"+hash, 'grid', {expires: 365, path: "/"}); 2528 }); 2529 listings_block.find('.w2dc-listings-block-content').fadeTo("fast", 1); 2530 } 2531 }); 2532 2533 $('body').on('click', ".w2dc-remove-from-favourites-list", function() { 2534 var listing_id = $(this).attr("listingid"); 2535 2536 if ($.cookie("favourites") != null) { 2537 var favourites_array = $.cookie("favourites").split('*'); 2538 } else { 2539 var favourites_array = new Array(); 2540 } 2541 2542 for (var count=0; count<favourites_array.length; count++) {
2543 if (favourites_array[count] == listing_id) { 2544 delete favourites_array[count]; 2545 } 2546 } 2547 2548 $(".w2dc-listing#post-"+listing_id).remove(); 2549 2550 $.cookie("favourites", favourites_array.join('*'), {expires: 365, path: "/"}); 2551 return false; 2552 }); 2553 2554 // Select FA icon dialog 2555 $(document).on("click", ".w2dc-select-fa-icon", function() { 2556 var dialog_title = $(this).text(); 2557 var icon_image_name = $(this).data("icon-image-name"); 2558 var icon_image_name_obj = $("#"+icon_image_name); 2559 var icon_tag = $(this).data("icon-tag"); 2560 var icon_tag_obj = $("."+icon_tag); 2561 2562 var icon_click_event; 2563 var reset_icon_click_event; 2564 2565 var dialog_obj = $('<div id="w2dc-select-fa-icon-dialog"></div>'); 2566 dialog_obj.dialog({ 2567 dialogClass: 'w2dc-content', 2568 width: ($(window).width()*0.5), 2569 height: ($(window).height()*0.8), 2570 modal: true, 2571 resizable: false, 2572 draggable: false, 2573 title: dialog_title, 2574 open: function() { 2575 w2dc_ajax_loader_show(); 2576 $.ajax({ 2577 type: "POST", 2578 url: w2dc_js_objects.ajaxurl, 2579 data: {'action': 'w2dc_select_fa_icon'}, 2580 dataType: 'html', 2581 success: function(response_from_the_action_function){ 2582 if (response_from_the_action_function != 0) { 2583 dialog_obj.html(response_from_the_action_function); 2584 if (icon_image_name_obj.val()) { 2585 $("#"+icon_image_name_obj.val()).addClass("w2dc-selected-icon"); 2586 } 2587 2588 icon_click_event = $(document).one("click", ".w2dc-fa-icon", function() { 2589 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 2590 icon_image_name_obj.val($(this).attr('id')); 2591 icon_tag_obj.removeClass().addClass(icon_tag+' w2dc-icon-tag w2dc-fa '+icon_image_name_obj.val()); 2592 icon_tag_obj.show(); 2593 $(this).addClass("w2dc-selected-icon"); 2594 reset_icon_click_event.off("click", "#w2dc-reset-fa-icon"); 2595 dialog_obj.remove(); 2596 }); 2597 reset_icon_click_event = $(document).one("click", "#w2dc-reset-fa-icon", function() { 2598 $(".w2dc-selected-icon").removeClass("w2dc-selected-icon"); 2599 icon_tag_obj.removeClass().addClass(icon_tag+' w2dc-icon-tag'); 2600 icon_tag_obj.hide(); 2601 icon_image_name_obj.val(''); 2602 icon_click_event.off("click", ".w2dc-fa-icon"); 2603 dialog_obj.remove(); 2604 }); 2605 } 2606 }, 2607 complete: function() { 2608 w2dc_ajax_loader_hide(); 2609 } 2610 }); 2611 $(document).on("click", ".ui-widget-overlay", function() { 2612 icon_click_event.off("click", ".w2dc-fa-icon"); 2613 reset_icon_click_event.off("click", "#w2dc-reset-fa-icon"); 2614 dialog_obj.remove(); 2615 }); 2616 }, 2617 close: function() { 2618 icon_click_event.off("click", ".w2dc-fa-icon"); 2619 reset_icon_click_event.off("click", "#w2dc-reset-fa-icon"); 2620 dialog_obj.remove(); 2621 } 2622 }); 2623 }); 2624 2625 // AJAX Contact form 2626 $(document).on('submit', '#w2dc_contact_form, #w2dc_report_form', function(e) { 2627 e.preventDefault(); 2628 2629 var $this = $(this); 2630 2631 if ($this.attr('id') == 'w2dc_contact_form') { 2632 var type = 'contact'; 2633 } else if ($this.attr('id') == 'w2dc_report_form') { 2634 var type = 'report'; 2635 } 2636 var warning = $this.find('#'+type+'_warning'); 2637 var listing_id = $this.find('#'+type+'_listing_id'); 2638 var nonce = $this.find('#'+type+'_nonce'); 2639 var name = $this.find('#'+type+'_name'); 2640 var email = $this.find('#'+type+'_email'); 2641 var message = $this.find('#'+type+'_message'); 2642 var button = $this.find('.w2dc-send-message-button'); 2643 var recaptcha = ($this.find('#g-recaptcha-response').length ? $this.find('#g-recaptcha-response').val() : ''); 2644 2645 $this.css('opacity', '0.5'); 2646 warning.hide(); 2647 button.val(w2dc_js_objects.send_button_sending).attr('disabled', 'disabled'); 2648 2649 var data = { 2650 action: "w2dc_contact_form", 2651 type: type, 2652 listing_id: listing_id.val(), 2653 name: name.val(), 2654 email: email.val(), 2655 message: message.val(), 2656 security: nonce.val(), 2657 'g-recaptcha-response': recaptcha 2658 }; 2659 2660 $.ajax({ 2661 url: w2dc_js_objects.ajaxurl, 2662 type: "POST", 2663 dataType: "json", 2664 data: data, 2665 global: false, 2666 success: function(response_from_the_action_function) { 2667 if (response_from_the_action_function != 0) { 2668 if (response_from_the_action_function.error == '') { 2669 name.val(''), 2670 email.val(''), 2671 message.val(''), 2672 warning.html(response_from_the_action_function.success).show(); 2673 } else { 2674 var error; 2675 if (typeof response_from_the_action_function.error == 'object') { 2676 error = '<ul>'; 2677 $.each(response_from_the_action_function.error, function(key, value) { 2678 error = error + '<li>' + value + '</li>'; 2679 });
2680 error = error + '</ul>'; 2681 } else { 2682 error = response_from_the_action_function.error; 2683 } 2684 warning.html(error).show(); 2685 } 2686 $this.css('opacity', '1'); 2687 button.val(w2dc_js_objects.send_button_text).removeAttr('disabled'); 2688 } 2689 } 2690 }); 2691 }); 2692})(jQuery); 2693 2694 2695function w2dc_make_slug(name) { 2696 name = name.toLowerCase(); 2697 2698 var defaultDiacriticsRemovalMap = [ 2699 {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g}, 2700 {'base':'AA','letters':/[\uA732]/g}, 2701 {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g}, 2702 {'base':'AO','letters':/[\uA734]/g}, 2703 {'base':'AU','letters':/[\uA736]/g}, 2704 {'base':'AV','letters':/[\uA738\uA73A]/g}, 2705 {'base':'AY','letters':/[\uA73C]/g}, 2706 {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g}, 2707 {'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g}, 2708 {'base':'D', 'letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g}, 2709 {'base':'DZ','letters':/[\u01F1\u01C4]/g}, 2710 {'base':'Dz','letters':/[\u01F2\u01C5]/g}, 2711 {'base':'E', 'letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g}, 2712 {'base':'F', 'letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g}, 2713 {'base':'G', 'letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g}, 2714 {'base':'H', 'letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g}, 2715 {'base':'I', 'letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g}, 2716 {'base':'J', 'letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g}, 2717 {'base':'K', 'letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g}, 2718 {'base':'L', 'letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g}, 2719 {'base':'LJ','letters':/[\u01C7]/g}, 2720 {'base':'Lj','letters':/[\u01C8]/g}, 2721 {'base':'M', 'letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g}, 2722 {'base':'N', 'letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g}, 2723 {'base':'NJ','letters':/[\u01CA]/g}, 2724 {'base':'Nj','letters':/[\u01CB]/g}, 2725 {'base':'O', 'letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g}, 2726 {'base':'OI','letters':/[\u01A2]/g}, 2727 {'base':'OO','letters':/[\uA74E]/g}, 2728 {'base':'OU','letters':/[\u0222]/g}, 2729 {'base':'P', 'letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g}, 2730 {'base':'Q', 'letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g}, 2731 {'base':'R', 'letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g}, 2732 {'base':'S', 'letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u
2732015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g}, 2733 {'base':'T', 'letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g}, 2734 {'base':'TZ','letters':/[\uA728]/g}, 2735 {'base':'U', 'letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g}, 2736 {'base':'V', 'letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g}, 2737 {'base':'VY','letters':/[\uA760]/g}, 2738 {'base':'W', 'letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g}, 2739 {'base':'X', 'letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g}, 2740 {'base':'Y', 'letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g}, 2741 {'base':'Z', 'letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g}, 2742 {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g}, 2743 {'base':'aa','letters':/[\uA733]/g}, 2744 {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g}, 2745 {'base':'ao','letters':/[\uA735]/g}, 2746 {'base':'au','letters':/[\uA737]/g}, 2747 {'base':'av','letters':/[\uA739\uA73B]/g}, 2748 {'base':'ay','letters':/[\uA73D]/g}, 2749 {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g}, 2750 {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g}, 2751 {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g}, 2752 {'base':'dz','letters':/[\u01F3\u01C6]/g}, 2753 {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g}, 2754 {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g}, 2755 {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g}, 2756 {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g}, 2757 {'base':'hv','letters':/[\u0195]/g}, 2758 {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g}, 2759 {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g}, 2760 {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g}, 2761 {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g}, 2762 {'base':'lj','letters':/[\u01C9]/g}, 2763 {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g}, 2764 {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g}, 2765 {'base':'nj','letters':/[\u01CC]/g}, 2766 {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u
27661ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g}, 2767 {'base':'oi','letters':/[\u01A3]/g}, 2768 {'base':'ou','letters':/[\u0223]/g}, 2769 {'base':'oo','letters':/[\uA74F]/g}, 2770 {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g}, 2771 {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g}, 2772 {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g}, 2773 {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g}, 2774 {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g}, 2775 {'base':'tz','letters':/[\uA729]/g}, 2776 {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g}, 2777 {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g}, 2778 {'base':'vy','letters':/[\uA761]/g}, 2779 {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g}, 2780 {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g}, 2781 {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g}, 2782 {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g} 2783 ]; 2784 for(var i=0; i<defaultDiacriticsRemovalMap.length; i++) 2785 name = name.replace(defaultDiacriticsRemovalMap[i].letters, defaultDiacriticsRemovalMap[i].base); 2786 2787 //change spaces and other characters by '_' 2788 name = name.replace(/\W/gi, "_"); 2789 // remove double '_' 2790 name = name.replace(/(\_)\1+/gi, "_"); 2791 2792 return name; 2793} 2794 2795function w2dc_in_array(val, arr) 2796{ 2797 for (var i = 0; i < arr.length; i++) { 2798 if (arr[i] == val) 2799 return i; 2800 } 2801 return false; 2802} 2803 2804function w2dc_find_get_parameter(parameterName) { 2805 var result = null, 2806 tmp = []; 2807 var items = location.search.substr(1).split("&"); 2808 for (var index = 0; index < items.length; index++) { 2809 tmp = items[index].split("="); 2810 if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); 2811 } 2812 return result; 2813} 2814 2815 2816/*! 2817 * jQuery Mousewheel 3.1.13 ------------------------------------------------------------------------------------------------------------------------------------------- 2818 * 2819 * Copyright 2015 jQuery Foundation and other contributors 2820 * Released under the MIT license. 2821 * http://jquery.org/license 2822 */ 2823!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>
2823n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.on("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); 2824 2825 2826// tax_dropdowns.js ------------------------------------------------------------------------------------------------------------------------------------------- 2827(function($) { 2828 "use strict"; 2829 2830 $(document).on('change', '.w2dc-tax-dropdowns-wrap select', function() { 2831 var select_box = $(this).attr('id').split('_'); 2832 var parent = $(this).val(); 2833 var current_level = select_box[1]; 2834 var uID = select_box[2]; 2835 2836 var divclass = $(this).parents('.w2dc-tax-dropdowns-wrap').attr('class').split(' '); 2837 var tax = divclass[0]; 2838 var count = divclass[1]; 2839 var hide_empty = divclass[2]; 2840 2841 w2dc_update_tax(parent, tax, current_level, count, hide_empty, uID, function() {}); 2842 }); 2843 2844 function w2dc_update_tax(parent, tax, current_level, count, hide_empty, uID, callback) { 2845 var current_level = parseInt(current_level); 2846 var next_level = current_level + 1; 2847 var prev_level = current_level - 1; 2848 var selects_length = $('#w2dc-tax-dropdowns-wrap-'+uID+' .w2dc-location-chainlist').length; 2849 2850 if (parent) 2851 $('#selected_tax\\['+uID+'\\]').val(parent).trigger('change'); 2852 else if (current_level > 1) 2853 $('#selected_tax\\['+uID+'\\]').val($('#chainlist_'+prev_level+'_'+uID).val()).trigger('change'); 2854 else 2855 $('#selected_tax\\['+uID+'\\]').val(0).trigger('change'); 2856 2857 var exact_terms = $('#exact_terms\\['+uID+'\\]').val(); 2858 2859 for (var i=next_level; i<=selects_length; i++) { 2860 $('#wrap_chainlist_'+i+'_'+uID).remove(); 2861 } 2862 2863 if (parent && typeof w2dc_js_objects['tax_dropdowns_'+uID][uID] != undefined) { 2864 var labels_source = w2dc_js_objects['tax_dropdowns_'+uID][uID]; 2865 2866 if (labels_source.labels[current_level] != undefined) 2867 var label = labels_source.labels[current_level]; 2868 else 2869 var label = ''; 2870 if (labels_source.titles[current_level] != undefined) 2871 var title = labels_source.titles[current_level]; 2872 else 2873 var title = ''; 2874 if (labels_source.allow_add_term[current_level] != undefined) 2875 var allow_add_term = labels_source.allow_add_term[current_level]; 2876 else 2877 var allow_add_term = ''; 2878 2879 $('#chainlist_'+current_level+'_'+uID).addClass('w2dc-ajax-loading').attr('disabled', 'disabled'); 2880 $.post( 2881 w2dc_js_objects.ajaxurl, 2882 { 2883 'action': 'w2dc_tax_dropdowns_hook', 2884 'parentid': parent, 2885 'next_level': next_level, 2886 'tax': tax, 2887 'count': count, 2888 'hide_empty': hide_empty, 2889 'label': label, 2890 'title': title, 2891 'allow_add_term': allow_add_term, 2892 'exact_terms': exact_terms, 2893 'uID': uID 2894 }, 2895 function(response_from_the_action_function){ 2896 if (response_from_the_action_function != 0) 2897 $('#w2dc-tax-dropdowns-wrap-'+uID).append(response_from_the_action_function); 2898 2899 $('#chainlist_'+current_level+'_'+uID).removeClass('w2dc-ajax-loading').removeAttr('disabled'); 2900 2901 callback(); 2902 } 2903 ); 2904 } 2905 } 2906 2907 function first(p){for(var i in p)return p[i];} 2908}(jQuery)); 2909 2910 2911 2912// jquery.coo_kie.js ------------------------------------------------------------------------------------------------------------------------------------------- 2913jQuery.cookie=function(e,i,o){if("undefined"==typeof i){var n=null;if(document.cookie&&""!=document.cookie)for(var r=document.cookie.split(";"),t=0;t<r.length;t++){var p=jQuery.trim(r[t]);if(p.substring(0,e.length+1)==e+"="){n=decodeURIComponent(p.substring(e.length+1));break}}return n}o=o||{},null===i&&(i="",o.expires=-1);var u="";if(o.expires&&("number"==typeof o.expires||o.expires.toUTCString)){var s;"number"==typeof o.expires?(s=new Date,s.setTime(s.getTime()+24*o.expires*60*60*1e3)):s=o.expires,u="; expires="+s.toUTCString()}var a=o.path?"; path="+o.path:"",c=o.domain?"; domain="+o.domain:"",m=o.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(i),u,a,c,m].join("")}; 2914 2915 2916 2917// jquery.w2dc_bxslider.min.js ------------------------------------------------------------------------------------------------------------------------------------------- 2918/** 2919 * w2dc_bxslider v4.2.1d 2920 * Copyright 2013-2017 Steven Wanderski 2921 * Written while drinking Belgian ales and listening to jazz 2922 * Licensed under MIT (http://opensource.org/licenses/MIT) 2923 * 2924 * 22.09.2020 - added condition in if (slider.viewport.get(0).releasePointerCapture && typeof w2dc_lightbox == "undefined") { 2925 */ 2926!function(R){var Z={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"w2dc-bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,ariaLive:!0,ariaHidden:!0,keyboardEnabled:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",stopAutoOnClick:!1,autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSli
vendor: 14,479 bytes, line 2926
2926des:1,maxSlides:1,moveSlides:0,slideWidth:0,shrinkItems:!1,onSliderLoad:function(){return!0},onSlideBefore:function(){return!0},onSlideAfter:function(){return!0},onSlideNext:function(){return!0},onSlidePrev:function(){return!0},onSliderResize:function(){return!0},onAutoChange:function(){return!0}};R.fn.w2dc_bxslider=function(e){if(0===this.length)return this;if(1<this.length)return this.each(function(){R(this).w2dc_bxslider(e)}),this;var g={},p=this,n=R(window).width(),s=R(window).height();if(!R(p).data("w2dc_bxslider")){function o(){R(p).data("w2dc_bxslider")||(g.settings=R.extend({},Z,e),g.settings.slideWidth=parseInt(g.settings.slideWidth),g.children=p.children(g.settings.slideSelector),g.children.length<g.settings.minSlides&&(g.settings.minSlides=g.children.length),g.children.length<g.settings.maxSlides&&(g.settings.maxSlides=g.children.length),g.settings.randomStart&&(g.settings.startSlide=Math.floor(Math.random()*g.children.length)),g.active={index:g.settings.startSlide},g.carousel=1<g.settings.minSlides||1<g.settings.maxSlides,g.carousel&&(g.settings.preloadImages="all"),g.minThreshold=g.settings.minSlides*g.settings.slideWidth+(g.settings.minSlides-1)*g.settings.slideMargin,g.maxThreshold=g.settings.maxSlides*g.settings.slideWidth+(g.settings.maxSlides-1)*g.settings.slideMargin,g.working=!1,g.controls={},g.interval=null,g.animProp="vertical"===g.settings.mode?"top":"left",g.usingCSS=g.settings.useCSS&&"fade"!==g.settings.mode&&function(){for(var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"],i=0;i<e.length;i++)if(void 0!==t.style[e[i]])return g.cssPrefix=e[i].replace("Perspective","").toLowerCase(),g.animProp="-"+g.cssPrefix+"-transform",!0;return!1}(),"vertical"===g.settings.mode&&(g.settings.maxSlides=g.settings.minSlides),p.data("origStyle",p.attr("style")),p.children(g.settings.slideSelector).each(function(){R(this).data("origStyle",R(this).attr("style"))}),d())}function r(){var t=1,e=null;return"horizontal"===g.settings.mode&&0<g.settings.slideWidth?t=g.viewport.width()<g.minThreshold?g.settings.minSlides:g.viewport.width()>g.maxThreshold?g.settings.maxSlides:(e=g.children.first().width()+g.settings.slideMargin,Math.floor((g.viewport.width()+g.settings.slideMargin)/e)||1):"vertical"===g.settings.mode&&(t=g.settings.minSlides),t}function t(){for(var t="",e="",i=w(),n=0;n<i;n++)e="",g.settings.buildPager&&R.isFunction(g.settings.buildPager)||g.settings.pagerCustom?(e=g.settings.buildPager(n),g.pagerEl.addClass("w2dc-bx-custom-pager")):(e=n+1,g.pagerEl.addClass("w2dc-bx-default-pager")),t+='<div class="w2dc-bx-pager-item"><a href="" data-slide-index="'+n+'" class="w2dc-bx-pager-link">'+e+"</a></div>";g.pagerEl.html(t)}function a(){p.startAuto()}function l(){p.stopAuto()}function u(t){var e=r();g.settings.ariaHidden&&!g.settings.ticker&&(g.children.attr("aria-hidden","true"),g.children.slice(t,t+e).attr("aria-hidden","false"))}var d=function(){var t=g.children.eq(g.settings.startSlide);p.wrap('<div class="'+g.settings.wrapperClass+'"><div class="w2dc-bx-viewport"></div></div>'),g.viewport=p.parent(),g.settings.ariaLive&&!g.settings.ticker&&g.viewport.attr("aria-live","polite"),g.loader=R('<div class="w2dc-bx-loading" />'),g.viewport.prepend(g.loader),p.css({width:"horizontal"===g.settings.mode?1e3*g.children.length+215+"%":"auto",position:"relative"}),g.usingCSS&&g.settings.easing?p.css("-"+g.cssPrefix+"-transition-timing-function",g.settings.easing):g.settings.easing||(g.settings.easing="swing"),g.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),g.viewport.parent().css({maxWidth:f()}),g.children.css({float:"horizontal"===g.settings.mode?"left":"none",listStyle:"none",position:"relative"}),g.children.css("width",m()),"horizontal"===g.settings.mode&&0<g.settings.slideMargin&&g.children.css("marginRight",g.settings.slideMargin),"vertical"===g.settings.mode&&0<g.settings.slideMargin&&g.children.css("marginBottom",g.settings.slideMargin),"fade"===g.settings.mode&&(g.children.css({position:"absolute",zIndex:0,display:"none"}),g.children.eq(g.settings.startSlide).css({zIndex:g.settings.slideZIndex,display:"block"})),g.controls.el=R('<div class="w2dc-bx-controls" />'),g.settings.captions&&P(),g.active.last=g.settings.startSlide===w()-1,g.settings.video&&p.fitVids(),"none"===g.settings.preloadImages?t=null:"all"!==g.settings.preloadImages&&!g.settings.ticker||(t=g.children),g.settings.ticker?g.settings.pager=!1:(g.settings.controls&&T(),g.settings.auto&&g.settings.autoControls&&k(),g.settings.pager&&b(),(g.settings.controls||g.settings.autoControls||g.settings.pager)&&g.viewport.after(g.controls.el)),null===t?h():c(t,h)},c=function(t,e){var i=t.find('img:not([src=""]), iframe').length,n=0;0!==i?t.find('img:not([src=""]), iframe').each(function(){R(this).one("load error",function(){++n===i&&e()}).each(function(){!this.complete&&""!=this.src||R(this).trigger("load")})}):e()},h=function(){var t,e,i;g.settings.infiniteLoop&&"fade"!==g.settings.mode&&!g.settings.ticker&&(t="vertical"===g.settings.mode?g.settings.minSlides:g.settings.maxSlides,e=g.children.slice(0,t).clone(!0).addClass("w2dc-bx-clone"),i=g.children.slice(-t).clone(!0).addClass("w2dc-bx-clone"),g.settings.ariaHidden&&(e.attr("aria-hidden",!0),i.attr("aria-hidden",!0)),p.append(e).prepend(i)),g.loader.remove(),S(),"vertical"===g.settings.mode&&(g.settings.adaptiveHeight=!0),g.viewport.height(v()),p.redrawSlider(),g.settings.onSliderLoad.call(p,g.active.index),g.initialized=!0,g.settings.responsive&&R(window).on("resize",V),g.settings.auto&&g.settings.autoStart&&(1<w()||g.settings.autoSlideForOnePage)&&W(),g.settings.ticker&&L(),g.settings.pager&&A(g.settings.startSlide),g.settings.controls&&H(),g.settings.touchEnabled&&!g.settings.ticker&&_(),g.settings.keyboardEnabled&&!g.settings.ticker&&R(document).keydown(F)},v=function(){var e=0,t=R();if("vertical"===g.settings.mode||g.settings.adaptiveHeight)if(g.carousel){var n=1===g.settings.moveSlides?g.active.index:g.active.index*x(),t=g.children.eq(n);for(i=1;i<=g.settings.maxSlides-1;i++)t=n+i>=g.children.length?t.add(g.children.eq(i-1)):t.add(g.children.eq(n+i))}else t=g.children.eq(g.active.index);else t=g.children;return"vertical"===g.settings.mode?(t.each(function(t){e+=R(this).outerHeight()}),0<g.settings.slideMargin&&(e+=g.settings.slideMargin*(g.settings.minSlides-1))):e=Math.max.apply(Math,t.map(function(){return R(this).outerHeight(!1)}).get()),"border-box"===g.viewport.css("box-sizing")?e+=parseFloat(g.viewport.css("padding-top"))+parseFloat(g.viewport.css("padding-bottom"))+parseFloat(g.viewport.css("border-top-width"))+parseFloat(g.viewport.css("border-bottom-width")):"padding-box"===g.viewport.css("box-sizing")&&(e+=parseFloat(g.viewport.css("padding-top"))+parseFloat(g.viewport.css("padding-bottom"))),e},f=function(){var t="100%";return 0<g.settings.slideWidth&&(t="horizontal"===g.settings.mode?g.settings.maxSlides*g.settings.slideWidth+(g.settings.maxSlides-1)*g.settings.slideMargin:g.settings.slideWidth),t},m=function(){var t=g.settings.slideWidth,e=g.viewport.width();if(0===g.settings.slideWidth||g.settings.slideWidth>e&&!g.carousel||"vertical"===g.settings.mode)t=e;else if(1<g.settings.maxSlides&&"horizontal"===g.settings.mode){if(e>g.maxThreshold)return t;e<g.minThreshold?t=(e-g.settings.slideMargin*(g.settings.minSlides-1))/g.settings.minSlides:g.settings.shrinkItems&&(t=Math.floor((e+g.settings.slideMargin)/Math.ceil((e+g.settings.slideMargin)/(t+g.settings.slideMargin))-g.settings.slideMargin))}return t},w=function(){var t=0,e=0,i=0;if(0<g.settings.moveSlides){if(!g.settings.infiniteLoop){for(;e<g.children.length;)++t,e=i+r(),i+=g.settings.moveSlides<=r()?g.settings.moveSlides:r();return i}t=Math.ceil(g.children.length/x())}else t=Math.ceil(g.children.length/r());return t},x=function(){return 0<g.settings.moveSlides&&g.settings.moveSlides<=r()?g.settings.moveSlides:r()},S=function(){var t,e,i;g.children.length>g.settings.maxSlides&&g.active.last&&!g.settings.infiniteLoop?"horizontal"===g.settings.mode?(t=(e=g.children.last()).position(),C(-(t.left-(g.viewport.width()-e.outerWidth())),"reset",0)):"vertical"===g.settings.mode&&(i=g.children.length-g.settings.minSlides,t=g.children.eq(i).position(),C(-t.top,"reset",0)):(t=g.children.eq(g.active.index*x()).position(),g.active.index===w()-1&&(g.active.last=!0),void 0!==t&&("horizontal"===g.settings.mode?C(-t.left,"reset",0):"vertical"===g.settings.mode&&C(-t.top,"reset",0)))},C=function(t,e,i,n){var s,o;g.usingCSS?(o="vertical"===g.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)",p.css("-"+g.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"===e?(p.css(g.animProp,o),0!==i?p.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(t){R(t.target).is(p)&&(p.off("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),q())}):q()):"reset"===e?p.css(g.animProp,o):"ticker"===e&&(p.css("-"+g.cssPrefix+"-transition-timing-function","linear"),p.css(g.animProp,o),0!==i?p.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(t){R(t.target).is(p)&&(p.off("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),C(n.resetValue,"reset",0),O())}):(C(n.resetValue,"reset",0),O()))):((s={})[g.animProp]=t,"slide"===e?p.animate(s,i,g.settings.easing,function(){q()}):"reset"===e?p.css(g.animProp,t):"ticker"===e&&p.animate(s,i,"linear",function(){C(n.resetValue,"reset",0),O()}))},b=function(){g.settings.pagerCustom?g.pagerEl=R(g.settings.pagerCustom):(g.pagerEl=R('<div class="w2dc-bx-pager" />'),g.settings.pagerSelector?R(g.settings.pagerSelector).html(g.pagerEl):g.controls.el.addClass("w2dc-bx-has-pager").append(g.pagerEl),t()),g.pagerEl.on("click touchend","a",z)},T=function(){g.controls.next=R('<a class="w2dc-bx-next" href="">'+g.settings.nextText+"</a>"),g.controls.prev=R('<a class="w2dc-bx-prev" href="">'+g.settings.prevText+"</a>"),g.controls.next.on("click touchend",E),g.controls.prev.on("click touchend",M),g.settings.nextSelector&&R(g.settings.nextSelector).append(g.controls.next),g.settings.prevSelector&&R(g.settings.prevSelector).append(g.controls.prev),g.settings.nextSelector||g.settings.prevSelector||(g.controls.directionEl=R('<div class="w2dc-bx-controls-direction" />'),g.controls.directionEl.append(g.controls.prev).append(g.controls.next),g.controls.el.addClass("w2dc-bx-has-controls-direction").append(g.controls.directionEl))},k=function(){g.controls.start=R('<div class="w2dc-bx-controls-auto-item"><a class="w2dc-bx-start" href="">'+g.settings.startText+"</a></div>"),g.controls.stop=R('<div class="w2dc-bx-controls-auto-item"><a class="w2dc-bx-stop" href="">'+g.settings.stopText+"</a></div>"),g.controls.autoEl=R('<div class="w2dc-bx-controls-auto" />'),g.controls.autoEl.on("click",".w2dc-bx-start",y),g.controls.autoEl.on("click",".w2dc-bx-stop",I),g.settings.autoControlsCombine?g.controls.autoEl.append(g.controls.start):g.controls.autoEl.append(g.controls.start).append(g.controls.stop),g.settings.autoControlsSelector?R(g.settings.autoControlsSelector).html(g.controls.autoEl):g.controls.el.addClass("w2dc-bx-has-controls-auto").append(g.controls.autoEl),D(g.settings.autoStart?"stop":"start")},P=function(){g.children.each(function(t){var e=R(this).find("img:first").attr("title");void 0!==e&&(""+e).length&&R(this).append('<div class="w2dc-bx-caption"><span>'+e+"</span></div>")})},E=function(t){t.preventDefault(),g.controls.el.hasClass("disabled")||(g.settings.auto&&g.settings.stopAutoOnClick&&p.stopAuto(),p.goToNextSlide())},M=function(t){t.preventDefault(),g.controls.el.hasClass("disabled")||(g.settings.auto&&g.settings.stopAutoOnClick&&p.stopAuto(),p.goToPrevSlide())},y=function(t){p.startAuto(),t.preventDefault()},I=function(t){p.stopAuto(),t.preventDefault()},z=function(t){var e,i;t.preventDefault(),g.controls.el.hasClass("disabled")||(g.settings.auto&&g.settings.stopAutoOnClick&&p.stopAuto(),void 0!==(e=R(t.currentTarget)).attr("data-slide-index")&&(i=parseInt(e.attr("data-slide-index")))!==g.active.index&&p.goToSlide(i))},A=function(i){var t=g.children.length;if("short"===g.settings.pagerType)return 1<g.settings.maxSlides&&(t=Math.ceil(g.children.length/g.settings.maxSlides)),void g.pagerEl.html(i+1+g.settings.pagerShortSeparator+t);g.pagerEl.find("a").removeClass("active"),g.pagerEl.each(function(t,e){R(e).find("a").eq(i).addClass("active")})},q=function(){var t;g.settings.infiniteLoop&&(t="",0===g.active.index?t=g.children.eq(0).position():g.active.index===w()-1&&g.carousel?t=g.children.eq((w()-1)*x()).position():g.active.index===g.children.length-1&&(t=g.children.eq(g.children.length-1).position()),t&&("horizontal"===g.settings.mode?C(-t.left,"reset",0):"vertical"===g.settings.mode&&C(-t.top,"reset",0))),g.working=!1,g.settings.onSlideAfter.call(p,g.children.eq(g.active.index),g.oldIndex,g.active.index)},D=function(t){g.settings.autoControlsCombine?g.controls.autoEl.html(g.controls[t]):(g.controls.autoEl.find("a").removeClass("active"),g.controls.autoEl.find("a:not(.w2dc-bx-"+t+")").addClass("active"))},H=function(){1===w()?(g.controls.prev.addClass("disabled"),g.controls.next.addClass("disabled")):!g.settings.infiniteLoop&&g.settings.hideControlOnEnd&&(0===g.active.index?(g.controls.prev.addClass("disabled"),g.controls.next.removeClass("disabled")):g.active.index===w()-1?(g.controls.next.addClass("disabled"),g.controls.prev.removeClass("disabled")):(g.controls.prev.removeClass("disabled"),g.controls.next.removeClass("disabled")))},W=function(){0<g.settings.autoDelay?setTimeout(p.startAuto,g.settings.autoDelay):(p.startAuto(),R(window).focus(a).blur(l)),g.settings.autoHover&&p.on("mouseenter", function(){g.interval&&(p.stopAuto(!0),g.autoPaused=!0)},function(){g.autoPaused&&(p.startAuto(!0),g.autoPaused=null)})},L=function(){var t,e,i,n,s,o,r,a,l=0;"next"===g.settings.autoDirection?p.append(g.children.clone().addClass("w2dc-bx-clone")):(p.prepend(g.children.clone().addClass("w2dc-bx-clone")),t=g.children.first().position(),l="horizontal"===g.settings.mode?-t.left:-t.top),C(l,"reset",0),g.settings.pager=!1,g.settings.controls=!1,g.settings.autoControls=!1,g.settings.tickerHover&&(g.usingCSS?(n="horizontal"===g.settings.mode?4:5,g.viewport.on("mouseenter", function(){e=p.css("-"+g.cssPrefix+"-transform"),i=parseFloat(e.split(",")[n]),C(i,"reset",0)},function(){a=0,g.children.each(function(t){a+="horizontal"===g.settings.mode?R(this).outerWidth(!0):R(this).outerHeight(!0)}
2926),s=g.settings.speed/a,o="horizontal"===g.settings.mode?"left":"top",r=s*(a-Math.abs(parseInt(i))),O(r)})):g.viewport.on("mouseenter", function(){p.stop()},function(){a=0,g.children.each(function(t){a+="horizontal"===g.settings.mode?R(this).outerWidth(!0):R(this).outerHeight(!0)}),s=g.settings.speed/a,o="horizontal"===g.settings.mode?"left":"top",r=s*(a-Math.abs(parseInt(p.css(o)))),O(r)})),O()},O=function(t){var e,i,n=t||g.settings.speed,s={left:0,top:0},o={left:0,top:0};"next"===g.settings.autoDirection?s=p.find(".w2dc-bx-clone").first().position():o=g.children.first().position(),e="horizontal"===g.settings.mode?-s.left:-s.top,i="horizontal"===g.settings.mode?-o.left:-o.top,C(e,"ticker",n,{resetValue:i})},F=function(t){var e,i,n,s,o=document.activeElement.tagName.toLowerCase();if(null==new RegExp(o,["i"]).exec("input|textarea")&&(e=p,i=R(window),n={top:i.scrollTop(),left:i.scrollLeft()},s=e.offset(),n.right=n.left+i.width(),n.bottom=n.top+i.height(),s.right=s.left+e.outerWidth(),s.bottom=s.top+e.outerHeight(),!(n.right<s.left||n.left>s.right||n.bottom<s.top||n.top>s.bottom))){if(39===t.keyCode)return E(t),!1;if(37===t.keyCode)return M(t),!1}},_=function(){g.touch={start:{x:0,y:0},end:{x:0,y:0}},g.viewport.on("touchstart MSPointerDown pointerdown",N),g.viewport.on("click",".w2dc_bxslider a",function(t){g.viewport.hasClass("click-disabled")&&(t.preventDefault(),g.viewport.removeClass("click-disabled"))})},N=function(t){if("touchstart"===t.type||0===t.button)if(t.preventDefault(),g.controls.el.addClass("disabled"),g.working)g.controls.el.removeClass("disabled");else{g.touch.originalPos=p.position();var e=t.originalEvent,i=void 0!==e.changedTouches?e.changedTouches:[e];if("function"==typeof PointerEvent&&void 0===e.pointerId)return;g.touch.start.x=i[0].pageX,g.touch.start.y=i[0].pageY,g.viewport.get(0).setPointerCapture&&(g.pointerId=e.pointerId,g.viewport.get(0).setPointerCapture(g.pointerId)),g.originalClickTarget=e.originalTarget||e.target,g.originalClickButton=e.button,g.originalClickButtons=e.buttons,g.originalEventType=e.type,g.hasMove=!1,g.viewport.on("touchmove MSPointerMove pointermove",X),g.viewport.on("touchend MSPointerUp pointerup",Y),g.viewport.on("MSPointerCancel pointercancel",B)}},B=function(t){t.preventDefault(),C(g.touch.originalPos.left,"reset",0),g.controls.el.removeClass("disabled"),g.viewport.off("MSPointerCancel pointercancel",B),g.viewport.off("touchmove MSPointerMove pointermove",X),g.viewport.off("touchend MSPointerUp pointerup",Y),g.viewport.get(0).releasePointerCapture&&"undefined"==typeof w2dc_lightbox&&g.viewport.get(0).releasePointerCapture(g.pointerId)},X=function(t){var e=t.originalEvent,i=void 0!==e.changedTouches?e.changedTouches:[e],n=Math.abs(i[0].pageX-g.touch.start.x),s=Math.abs(i[0].pageY-g.touch.start.y),o=0,r=0;g.hasMove=!0,(s<3*n&&g.settings.preventDefaultSwipeX||n<3*s&&g.settings.preventDefaultSwipeY)&&t.preventDefault(),"touchmove"!==t.type&&t.preventDefault(),"fade"!==g.settings.mode&&g.settings.oneToOneTouch&&(o="horizontal"===g.settings.mode?(r=i[0].pageX-g.touch.start.x,g.touch.originalPos.left+r):(r=i[0].pageY-g.touch.start.y,g.touch.originalPos.top+r),C(o,"reset",0))},Y=function(t){t.preventDefault(),g.viewport.off("touchmove MSPointerMove pointermove",X),g.controls.el.removeClass("disabled");var e=t.originalEvent,i=void 0!==e.changedTouches?e.changedTouches:[e],n=0,s=0;g.touch.end.x=i[0].pageX,g.touch.end.y=i[0].pageY,"fade"===g.settings.mode?(s=Math.abs(g.touch.start.x-g.touch.end.x))>=g.settings.swipeThreshold&&(g.touch.start.x>g.touch.end.x?p.goToNextSlide():p.goToPrevSlide(),p.stopAuto()):(n="horizontal"===g.settings.mode?(s=g.touch.end.x-g.touch.start.x,g.touch.originalPos.left):(s=g.touch.end.y-g.touch.start.y,g.touch.originalPos.top),(g.settings.infiniteLoop||!(0===g.active.index&&0<s||g.active.last&&s<0))&&Math.abs(s)>=g.settings.swipeThreshold?(s<0?p.goToNextSlide():p.goToPrevSlide(),p.stopAuto()):C(n,"reset",200)),g.viewport.off("touchend MSPointerUp pointerup",Y),g.viewport.get(0).releasePointerCapture&&"undefined"==typeof w2dc_lightbox&&g.viewport.get(0).releasePointerCapture(g.pointerId),!1!==g.hasMove||0!==g.originalClickButton&&"touchstart"!==g.originalEventType||R(g.originalClickTarget).trigger({type:"click",button:g.originalClickButton,buttons:g.originalClickButtons})},V=function(t){var e,i;g.initialized&&(g.working?window.setTimeout(V,10):(e=R(window).width(),i=R(window).height(),n===e&&s===i||(n=e,s=i,p.redrawSlider(),g.settings.onSliderResize.call(p,g.active.index))))};return p.goToSlide=function(t,e){var i,n,s,o,r,a=!0,l=0,d={left:0,top:0},c=null;if(g.oldIndex=g.active.index,g.active.index=(r=t)<0?g.settings.infiniteLoop?w()-1:g.active.index:r>=w()?g.settings.infiniteLoop?0:g.active.index:r,!g.working&&g.active.index!==g.oldIndex){if(g.working=!0,void 0!==(a=g.settings.onSlideBefore.call(p,g.children.eq(g.active.index),g.oldIndex,g.active.index))&&!a)return g.active.index=g.oldIndex,void(g.working=!1);"next"===e?g.settings.onSlideNext.call(p,g.children.eq(g.active.index),g.oldIndex,g.active.index)||(a=!1):"prev"===e&&(g.
2926settings.onSlidePrev.call(p,g.children.eq(g.active.index),g.oldIndex,g.active.index)||(a=!1)),g.active.last=g.active.index>=w()-1,(g.settings.pager||g.settings.pagerCustom)&&A(g.active.index),g.settings.controls&&H(),"fade"===g.settings.mode?(g.settings.adaptiveHeight&&g.viewport.height()!==v()&&g.viewport.animate({height:v()},g.settings.adaptiveHeightSpeed),g.children.filter(":visible").fadeOut(g.settings.speed).css({zIndex:0}),g.children.eq(g.active.index).css("zIndex",g.settings.slideZIndex+1).fadeIn(g.settings.speed,function(){R(this).css("zIndex",g.settings.slideZIndex),q()})):(g.settings.adaptiveHeight&&g.viewport.height()!==v()&&g.viewport.animate({height:v()},g.settings.adaptiveHeightSpeed),!g.settings.infiniteLoop&&g.carousel&&g.active.last?"horizontal"===g.settings.mode?(d=(c=g.children.eq(g.children.length-1)).position(),l=g.viewport.width()-c.outerWidth()):(i=g.children.length-g.settings.minSlides,d=g.children.eq(i).position()):g.carousel&&g.active.last&&"prev"===e?(n=1===g.settings.moveSlides?g.settings.maxSlides-x():(w()-1)*x()-(g.children.length-g.settings.maxSlides),d=(c=p.children(".w2dc-bx-clone").eq(n)).position()):"next"===e&&0===g.active.index?(d=p.find("> .w2dc-bx-clone").eq(g.settings.maxSlides).position(),g.active.last=!1):0<=t&&(o=t*parseInt(x()),d=g.children.eq(o).position()),void 0!==d&&(s="horizontal"===g.settings.mode?-(d.left-l):-d.top,C(s,"slide",g.settings.speed)),g.working=!1),g.settings.ariaHidden&&u(g.active.index*x())}},p.goToNextSlide=function(){var t;!g.settings.infiniteLoop&&g.active.last||!0!==g.working&&(t=parseInt(g.active.index)+1,p.goToSlide(t,"next"))},p.goToPrevSlide=function(){var t;!g.settings.infiniteLoop&&0===g.active.index||!0===g.working||(t=parseInt(g.active.index)-1,p.goToSlide(t,"prev"))},p.startAuto=function(t){g.interval||(g.interval=setInterval(function(){"next"===g.settings.autoDirection?p.goToNextSlide():p.goToPrevSlide()},g.settings.pause),g.settings.onAutoChange.call(p,!0),g.settings.autoControls&&!0!==t&&D("stop"))},p.stopAuto=function(t){g.autoPaused&&(g.autoPaused=!1),g.interval&&(clearInterval(g.interval),g.interval=null,g.settings.onAutoChange.call(p,!1),g.settings.autoControls&&!0!==t&&D("start"))},p.getCurrentSlide=function(){return g.active.index},p.getCurrentSlideElement=function(){return g.children.eq(g.active.index)},p.getSlideElement=function(t){return g.children.eq(t)},p.getSlideCount=function(){return g.children.length},p.isWorking=function(){return g.working},p.redrawSlider=function(){g.children.add(p.find(".w2dc-bx-clone")).outerWidth(m()),g.viewport.css("height",v()),g.settings.ticker||S(),g.active.last&&(g.active.index=w()-1),g.active.index>=w()&&(g.active.last=!0),g.settings.pager&&!g.settings.pagerCustom&&(t(),A(g.active.index)),g.settings.ariaHidden&&u(g.active.index*x())},p.destroySlider=function(){g.initialized&&(g.initialized=!1,R(".w2dc-bx-clone",this).remove(),g.children.each(function(){void 0!==R(this).data("origStyle")?R(this).attr("style",R(this).data("origStyle")):R(this).removeAttr("style")}),void 0!==R(this).data("origStyle")?this.attr("style",R(this).data("origStyle")):R(this).removeAttr("style"),R(this).unwrap().unwrap(),g.controls.el&&g.controls.el.remove(),g.controls.next&&g.controls.next.remove(),g.controls.prev&&g.controls.prev.remove(),g.pagerEl&&g.settings.controls&&!g.settings.pagerCustom&&g.pagerEl.remove(),R(".w2dc-bx-caption",this).remove(),g.controls.autoEl&&g.controls.autoEl.remove(),clearInterval(g.interval),g.settings.responsive&&R(window).off("resize",V),g.settings.keyboardEnabled&&R(document).off("keydown",F),R(this).removeData("w2dc_bxslider"),R(window).off("blur",l).off("focus",a))},p.reloadSlider=function(t){void 0!==t&&(e=t),p.destroySlider(),o(),R(p).data("w2dc_bxslider",this)},o(),R(p).data("w2dc_bxslider",this),this}}}(jQuery); 2927 2928 2929 2930 2931 2932 2933/* ======================================================================== 2934 * Bootstrap: tooltip.js v3.3.5 2935 * http://getbootstrap.com/javascript/#tooltip 2936 * Inspired by the original jQuery.tipsy by Jason Frame 2937 * ======================================================================== 2938 * Copyright 2011-2015 Twitter, Inc. 2939 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2940 * ======================================================================== */ 2941+function ($) { 2942 'use strict'; 2943 2944 // TOOLTIP PUBLIC CLASS DEFINITION 2945 // =============================== 2946 2947 var Tooltip = function (element, options) { 2948 this.type = null 2949 this.options = null 2950 this.enabled = null 2951 this.timeout = null 2952 this.hoverState = null 2953 this.$element = null 2954 this.inState = null 2955 2956 this.init('w2dc_tooltip', element, options) 2957 } 2958 2959 Tooltip.VERSION = '3.3.5' 2960 2961 Tooltip.TRANSITION_DURATION = 150 2962 2963 Tooltip.DEFAULTS = { 2964 animation: true, 2965 placement: 'top', 2966 selector: false, 2967 template: '<div class="w2dc-tooltip" role="tooltip"><div class="w2dc-tooltip-arrow"></div><div class="w2dc-tooltip-inner"></div></div>', 2968 trigger: 'hover focus', 2969 title: '', 2970 delay: 0, 2971 html: false, 2972 container: false, 2973 viewport: { 2974 selector: 'body', 2975 padding: 0 2976 } 2977 } 2978 2979 Tooltip.prototype.init = function (type, element, options) { 2980 this.enabled = true 2981 this.type = type 2982 this.$element = $(element) 2983 this.options = this.getOptions(options) 2984 this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) 2985 this.inState = { click: false, hover: false, focus: false } 2986 2987 if (this.$element[0] instanceof document.constructor && !this.options.selector) { 2988 throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') 2989 } 2990 2991 var triggers = this.options.trigger.split(' ') 2992 2993 for (var i = triggers.length; i--;) { 2994 var trigger = triggers[i] 2995 2996 if (trigger == 'click') { 2997 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 2998 } else if (trigger != 'manual') { 2999 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 3000 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 3001 3002 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 3003 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 3004 } 3005 } 3006 3007 this.options.selector ? 3008 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 3009 this.fixTitle() 3010 } 3011 3012 Tooltip.prototype.getDefaults = function () { 3013 return Tooltip.DEFAULTS 3014 } 3015 3016 Tooltip.prototype.getOptions = function (options) { 3017 options = $.extend({}, this.getDefaults(), this.$element.data(), options) 3018 3019 if (options.delay && typeof options.delay == 'number') { 3020 options.delay = { 3021 show: options.delay, 3022 hide: options.delay 3023 } 3024 } 3025 3026 return options 3027 } 3028 3029 Tooltip.prototype.getDelegateOptions = function () { 3030 var options = {} 3031 var defaults = this.getDefaults() 3032 3033 this._options && $.each(this._options, function (key, value) { 3034 if (defaults[key] != value) options[key] = value 3035 }) 3036 3037 return options 3038 } 3039 3040 Tooltip.prototype.enter = function (obj) { 3041 var self = obj instanceof this.constructor ? 3042 obj : $(obj.currentTarget).data('bs.' + this.type) 3043 3044 if (!self) { 3045 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 3046 $(obj.currentTarget).data('bs.' + this.type, self) 3047 } 3048 3049 if (obj instanceof $.Event) {
vendor: 17,930 bytes, lines 3050-3554
3050 self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true 3051 } 3052 3053 if (self.tip().hasClass('w2dc-in') || self.hoverState == 'in') { 3054 self.hoverState = 'in' 3055 return 3056 } 3057 3058 clearTimeout(self.timeout) 3059 3060 self.hoverState = 'in' 3061 3062 if (!self.options.delay || !self.options.delay.show) return self.show() 3063 3064 self.timeout = setTimeout(function () { 3065 if (self.hoverState == 'in') self.show() 3066 }, self.options.delay.show) 3067 } 3068 3069 Tooltip.prototype.isInStateTrue = function () { 3070 for (var key in this.inState) { 3071 if (this.inState[key]) return true 3072 } 3073 3074 return false 3075 } 3076 3077 Tooltip.prototype.leave = function (obj) { 3078 var self = obj instanceof this.constructor ? 3079 obj : $(obj.currentTarget).data('bs.' + this.type) 3080 3081 if (!self) { 3082 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 3083 $(obj.currentTarget).data('bs.' + this.type, self) 3084 } 3085 3086 if (obj instanceof $.Event) { 3087 self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false 3088 } 3089 3090 if (self.isInStateTrue()) return 3091 3092 clearTimeout(self.timeout) 3093 3094 self.hoverState = 'out' 3095 3096 if (!self.options.delay || !self.options.delay.hide) return self.hide() 3097 3098 self.timeout = setTimeout(function () { 3099 if (self.hoverState == 'out') self.hide() 3100 }, self.options.delay.hide) 3101 } 3102 3103 Tooltip.prototype.show = function () { 3104 var e = $.Event('show.bs.' + this.type) 3105 3106 if (this.hasContent() && this.enabled) { 3107 this.$element.trigger(e) 3108 3109 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 3110 if (e.isDefaultPrevented() || !inDom) return 3111 var that = this 3112 3113 var $tip = this.tip() 3114 3115 var tipId = this.getUID(this.type) 3116 3117 this.setContent() 3118 $tip.attr('id', tipId) 3119 this.$element.attr('aria-describedby', tipId) 3120 3121 if (this.options.animation) $tip.addClass('w2dc-fade') 3122 3123 var placement = typeof this.options.placement == 'function' ? 3124 this.options.placement.call(this, $tip[0], this.$element[0]) : 3125 this.options.placement 3126 3127 var autoToken = /\s?auto?\s?/i 3128 var autoPlace = autoToken.test(placement) 3129 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 3130 3131 $tip 3132 .detach() 3133 .css({ top: 0, left: 0, display: 'block' }) 3134 .addClass('w2dc-'+placement) 3135 .data('bs.' + this.type, this) 3136 3137 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) 3138 this.$element.trigger('inserted.bs.' + this.type) 3139 3140 var pos = this.getPosition() 3141 var actualWidth = $tip[0].offsetWidth 3142 var actualHeight = $tip[0].offsetHeight 3143 3144 if (autoPlace) { 3145 var orgPlacement = placement 3146 var viewportDim = this.getPosition(this.$viewport) 3147 3148 placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : 3149 placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : 3150 placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : 3151 placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : 3152 placement 3153 3154 $tip 3155 .removeClass(orgPlacement) 3156 .addClass(placement) 3157 } 3158 3159 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 3160 3161 this.applyPlacement(calculatedOffset, placement) 3162 3163 var complete = function () { 3164 var prevHoverState = that.hoverState 3165 that.$element.trigger('shown.bs.' + that.type) 3166 that.hoverState = null 3167 3168 if (prevHoverState == 'out') that.leave(that) 3169 } 3170 3171 $.support.transition && this.$tip.hasClass('w2dc-fade') ? 3172 $tip 3173 .one('bsTransitionEnd', complete) 3174 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 3175 complete() 3176 } 3177 } 3178 3179 Tooltip.prototype.applyPlacement = function (offset, placement) { 3180 var $tip = this.tip() 3181 var width = $tip[0].offsetWidth 3182 var height = $tip[0].offsetHeight 3183 3184 // manually read margins because getBoundingClientRect includes difference 3185 var marginTop = parseInt($tip.css('margin-top'), 10) 3186 var marginLeft = parseInt($tip.css('margin-left'), 10) 3187 3188 // we must check for NaN for ie 8/9 3189 if (isNaN(marginTop)) marginTop = 0 3190 if (isNaN(marginLeft)) marginLeft = 0 3191 3192 offset.top += marginTop 3193 offset.left += marginLeft 3194 3195 // $.fn.offset doesn't round pixel values 3196 // so we use setOffset directly with our own function B-0 3197 $.offset.setOffset($tip[0], $.extend({ 3198 using: function (props) { 3199 $tip.css({ 3200 top: Math.round(props.top), 3201 left: Math.round(props.left) 3202 }) 3203 } 3204 }, offset), 0) 3205 3206 $tip.addClass('w2dc-in') 3207 3208 // check to see if placing tip in new offset caused the tip to resize itself 3209 var actualWidth = $tip[0].offsetWidth 3210 var actualHeight = $tip[0].offsetHeight 3211 3212 if (placement == 'top' && actualHeight != height) { 3213 offset.top = offset.top + height - actualHeight 3214 } 3215 3216 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 3217 3218 if (delta.left) offset.left += delta.left 3219 else offset.top += delta.top 3220 3221 var isVertical = /top|bottom/.test(placement) 3222 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 3223 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 3224 3225 $tip.offset(offset) 3226 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 3227 } 3228 3229 Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { 3230 this.arrow() 3231 .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 3232 .css(isVertical ? 'top' : 'left', '') 3233 } 3234 3235 Tooltip.prototype.setContent = function () { 3236 var $tip = this.tip() 3237 var title = this.getTitle() 3238 3239 $tip.find('.w2dc-tooltip-inner')[this.options.html ? 'html' : 'text'](title) 3240 $tip.removeClass('w2dc-fade w2dc-in w2dc-top w2dc-bottom w2dc-left w2dc-right') 3241 } 3242 3243 Tooltip.prototype.hide = function (callback) { 3244 var that = this 3245 var $tip = $(this.$tip) 3246 var e = $.Event('hide.bs.' + this.type) 3247 3248 function complete() { 3249 if (that.hoverState != 'in') $tip.detach() 3250 that.$element 3251 .removeAttr('aria-describedby') 3252 .trigger('hidden.bs.' + that.type) 3253 callback && callback() 3254 } 3255 3256 this.$element.trigger(e) 3257 3258 if (e.isDefaultPrevented()) return 3259 3260 $tip.removeClass('w2dc-in') 3261 3262 $.support.transition && $tip.hasClass('w2dc-fade') ? 3263 $tip 3264 .one('bsTransitionEnd', complete) 3265 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 3266 complete() 3267 3268 this.hoverState = null 3269 3270 return this 3271 } 3272 3273 Tooltip.prototype.fixTitle = function () { 3274 var $e = this.$element 3275 if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { 3276 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 3277 } 3278 } 3279 3280 Tooltip.prototype.hasContent = function () { 3281 return this.getTitle() 3282 } 3283 3284 Tooltip.prototype.getPosition = function ($element) { 3285 $element = $element || this.$element 3286 3287 var el = $element[0] 3288 var isBody = el.tagName == 'BODY' 3289 3290 var elRect = el.getBoundingClientRect() 3291 if (elRect.width == null) { 3292 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 3293 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 3294 } 3295 var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() 3296 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 3297 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 3298 3299 return $.extend({}, elRect, scroll, outerDims, elOffset) 3300 } 3301 3302 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 3303 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 3304 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 3305 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 3306 { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 3307 3308 } 3309 3310 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 3311 var delta = { top: 0, left: 0 } 3312 if (!this.$viewport) return delta 3313 3314 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 3315 var viewportDimensions = this.getPosition(this.$viewport) 3316 3317 if (/right|left/.test(placement)) { 3318 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 3319 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 3320 if (topEdgeOffset < viewportDimensions.top) { // top overflow 3321 delta.top = viewportDimensions.top - topEdgeOffset 3322 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 3323 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset 3324 } 3325 } else { 3326 var leftEdgeOffset = pos.left - viewportPadding 3327 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 3328 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 3329 delta.left = viewportDimensions.left - leftEdgeOffset 3330 } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow 3331 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 3332 } 3333 } 3334 3335 return delta 3336 } 3337 3338 Tooltip.prototype.getTitle = function () { 3339 var title 3340 var $e = this.$element 3341 var o = this.options 3342 3343 title = $e.attr('data-original-title') 3344 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 3345 3346 return title 3347 } 3348 3349 Tooltip.prototype.getUID = function (prefix) { 3350 do prefix += ~~(Math.random() * 1000000) 3351 while (document.getElementById(prefix)) 3352 return prefix 3353 } 3354 3355 Tooltip.prototype.tip = function () { 3356 if (!this.$tip) { 3357 this.$tip = $(this.options.template) 3358 if (this.$tip.length != 1) { 3359 throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') 3360 } 3361 } 3362 return this.$tip 3363 } 3364 3365 Tooltip.prototype.arrow = function () { 3366 return (this.$arrow = this.$arrow || this.tip().find('.w2dc-tooltip-arrow')) 3367 } 3368 3369 Tooltip.prototype.enable = function () { 3370 this.enabled = true 3371 } 3372 3373 Tooltip.prototype.disable = function () { 3374 this.enabled = false 3375 } 3376 3377 Tooltip.prototype.toggleEnabled = function () { 3378 this.enabled = !this.enabled 3379 } 3380 3381 Tooltip.prototype.toggle = function (e) { 3382 var self = this 3383 if (e) { 3384 self = $(e.currentTarget).data('bs.' + this.type) 3385 if (!self) { 3386 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 3387 $(e.currentTarget).data('bs.' + this.type, self) 3388 } 3389 } 3390 3391 if (e) { 3392 self.inState.click = !self.inState.click 3393 if (self.isInStateTrue()) self.enter(self) 3394 else self.leave(self) 3395 } else { 3396 self.tip().hasClass('w2dc-in') ? self.leave(self) : self.enter(self) 3397 } 3398 } 3399 3400 Tooltip.prototype.destroy = function () { 3401 var that = this 3402 clearTimeout(this.timeout) 3403 this.hide(function () { 3404 that.$element.off('.' + that.type).removeData('bs.' + that.type) 3405 if (that.$tip) { 3406 that.$tip.detach() 3407 } 3408 that.$tip = null 3409 that.$arrow = null 3410 that.$viewport = null 3411 }) 3412 } 3413 3414 3415 // TOOLTIP PLUGIN DEFINITION 3416 // ========================= 3417 3418 function Plugin(option) { 3419 return this.each(function () { 3420 var $this = $(this) 3421 var data = $this.data('bs.w2dc_tooltip') 3422 var options = typeof option == 'object' && option 3423 3424 if (!data && /destroy|hide/.test(option)) return 3425 if (!data) $this.data('bs.w2dc_tooltip', (data = new Tooltip(this, options))) 3426 if (typeof option == 'string') data[option]() 3427 }) 3428 } 3429 3430 var old = $.fn.w2dc_tooltip 3431 3432 $.fn.w2dc_tooltip = Plugin 3433 $.fn.w2dc_tooltip.Constructor = Tooltip 3434 3435 3436 // TOOLTIP NO CONFLICT 3437 // =================== 3438 3439 $.fn.w2dc_tooltip.noConflict = function () { 3440 $.fn.w2dc_tooltip = old 3441 return this 3442 } 3443 3444}(jQuery); 3445 3446/* ======================================================================== 3447 * Bootstrap: popover.js v3.3.5 3448 * http://getbootstrap.com/javascript/#popovers 3449 * ======================================================================== 3450 * Copyright 2011-2015 Twitter, Inc. 3451 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 3452 * ======================================================================== */ 3453+function ($) { 3454 'use strict'; 3455 3456 // POPOVER PUBLIC CLASS DEFINITION 3457 // =============================== 3458 3459 var Popover = function (element, options) { 3460 this.init('w2dc_popover', element, options) 3461 } 3462 3463 if (!$.fn.w2dc_tooltip) throw new Error('Popover requires tooltip.js') 3464 3465 Popover.VERSION = '3.3.5' 3466 3467 Popover.DEFAULTS = $.extend({}, $.fn.w2dc_tooltip.Constructor.DEFAULTS, { 3468 placement: 'right', 3469 trigger: 'click', 3470 content: '', 3471 template: '<div class="w2dc-popover" role="tooltip"><div class="w2dc-arrow"></div><h3 class="w2dc-popover-title"></h3><div class="w2dc-popover-content"></div></div>' 3472 }) 3473 3474 3475 // NOTE: POPOVER EXTENDS tooltip.js 3476 // ================================ 3477 3478 Popover.prototype = $.extend({}, $.fn.w2dc_tooltip.Constructor.prototype) 3479 3480 Popover.prototype.constructor = Popover 3481 3482 Popover.prototype.getDefaults = function () { 3483 return Popover.DEFAULTS 3484 } 3485 3486 Popover.prototype.setContent = function () { 3487 var $tip = this.tip() 3488 var title = this.getTitle() 3489 var content = this.getContent() 3490 3491 $tip.find('.w2dc-popover-title')[this.options.html ? 'html' : 'text'](title) 3492 $tip.find('.w2dc-popover-content').children().detach().end()[ // we use append for html objects to maintain js events 3493 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' 3494 ](content) 3495 3496 $tip.removeClass('w2dc-fade w2dc-top w2dc-bottom w2dc-left w2dc-right w2dc-in') 3497 3498 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 3499 // this manually by checking the contents. 3500 if (!$tip.find('.w2dc-popover-title').html()) $tip.find('.w2dc-popover-title').hide() 3501 } 3502 3503 Popover.prototype.hasContent = function () { 3504 return this.getTitle() || this.getContent() 3505 } 3506 3507 Popover.prototype.getContent = function () { 3508 var $e = this.$element 3509 var o = this.options 3510 3511 return $e.attr('data-content') 3512 || (typeof o.content == 'function' ? 3513 o.content.call($e[0]) : 3514 o.content) 3515 } 3516 3517 Popover.prototype.arrow = function () { 3518 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 3519 } 3520 // POPOVER PLUGIN DEFINITION 3521 // ========================= 3522 3523 function Plugin(option) { 3524 return this.each(function () { 3525 var $this = $(this) 3526 var data = $this.data('bs.w2dc_popover') 3527 var options = typeof option == 'object' && option 3528 3529 if (!data && /destroy|hide/.test(option)) return 3530 if (!data) $this.data('bs.w2dc_popover', (data = new Popover(this, options))) 3531 if (typeof option == 'string') data[option]() 3532 }) 3533 } 3534 3535 var old = $.fn.w2dc_popover 3536 3537 $.fn.w2dc_popover = Plugin 3538 $.fn.w2dc_popover.Constructor = Popover 3539 3540 3541 // POPOVER NO CONFLICT 3542 // =================== 3543 3544 $.fn.w2dc_popover.noConflict = function () { 3545 $.fn.popover = old 3546 return this 3547 } 3548 3549}(jQuery); 3550 3551 3552 3553// jquery.tokenize.js ------------------------------------------------------------------------------------------------------------------------------------------- 3554!function(e){var t={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,ARROW_UP:38,ARROW_DOWN:40},n=null,o="tokenize",s=function(t,n){if(!n.data(o)){var s=new e.tokenize(e.extend({},e.fn.tokenize.defaults,t));n.data(o,s),s.init(n)}return n.data(o)};e.tokenize=function(t){void 0==t&&(t=e.fn.tokenize.defaults),this.options=t},e.extend(e.tokenize.prototype,{init:function(t){var n=this;this.select=t.attr("multiple","multiple").css({margin:0,padding:0,border:0}).hide(),this.container=e("<div />").attr("class",this.select.attr("class")).addClass("Tokenize"),1==this.options.maxElements&&this.container.addClass("OnlyOne"),this.dropdown=e("<ul />").addClass("Dropdown"),this.tokensContainer=e("<ul />").addClass("TokensContainer"),this.options.autosize&&this.tokensContainer.addClass("Autosize"),this.searchToken=e("<li />").addClass("TokenSearch").appendTo(this.tokensContainer),this.searchInput=e("<input />").appendTo(this.searchToken),this.options.searchMaxLength>0&&this.searchInput.attr("maxlength",this.options.searchMaxLength),this.select.prop("disabled")&&this.disable(),this.options.sortable&&("undefined"!=typeof e.ui?this.tokensContainer.sortable({items:"li.Token",cursor:"move",placeholder:"Token MovingShadow",forcePlaceholderSize:!0,update:function(){n.updateOrder()},start:function(){n.searchToken.hide()},stop:function(){n.searchToken.show()}}
3554).disableSelection():(this.options.sortable=!1,console.log("jQuery UI is not loaded, sortable option has been disabled"))),this.container.append(this.tokensContainer).append(this.dropdown).insertAfter(this.select),this.tokensContainer.on("click",function(e){e.stopImmediatePropagation(),n.searchInput.get(0).focus(),n.updatePlaceholder(),n.dropdown.is(":hidden")&&""!=n.searchInput.val()&&n.search()}),this.searchInput.on("blur",function(){n.tokensContainer.removeClass("Focused")}),this.searchInput.on("focus click",function(){n.tokensContainer.addClass("Focused"),n.options.displayDropdownOnFocus&&"select"==n.options.datas&&n.search()}),this.searchInput.on("keydown",function(e){n.resizeSearchInput(),n.keydown(e)}),this.searchInput.on("keyup",function(e){n.keyup(e)}),this.searchInput.on("keypress",function(e){n.keypress(e)}),this.searchInput.on("paste",function(){setTimeout(function(){n.resizeSearchInput()},10),setTimeout(function(){var t=n.searchInput.val().split(",");t.length>1&&e.each(t,function(e,t){n.tokenAdd(t.trim(),"")})},20)}),e(document).on("click",function(){n.dropdownHide(),1==n.options.maxElements&&n.searchInput.val()&&n.tokenAdd(n.searchInput.val(),"")}),this.resizeSearchInput(),this.remap(!0),this.updatePlaceholder()},updateOrder:function(){if(this.options.sortable){var t,n,o=this;e.each(this.tokensContainer.sortable("toArray",{attribute:"data-value"}),function(s,i){n=e('option[value="'+i+'"]',o.select),void 0==t?n.prependTo(o.select):t.after(n),t=n}),this.options.onReorder(this)}},updatePlaceholder:function(){0!=this.options.placeholder&&(void 0==this.placeholder&&(this.placeholder=e("<li />").addClass("Placeholder").html(this.options.placeholder),this.placeholder.insertBefore(e("li:first-child",this.tokensContainer))),0==this.searchInput.val().length&&0==e("li.Token",this.tokensContainer).length?this.placeholder.show():this.placeholder.hide())},dropdownShow:function(){this.dropdown.show()},dropdownPrev:function(){e("li.Hover",this.dropdown).length>0?e("li.Hover",this.dropdown).is("li:first-child")?(e("li.Hover",this.dropdown).removeClass("Hover"),e("li:last-child",this.dropdown).addClass("Hover")):e("li.Hover",this.dropdown).removeClass("Hover").prev().addClass("Hover"):e("li:first",this.dropdown).addClass("Hover")},dropdownNext:function(){e("li.Hover",this.dropdown).length>0?e("li.Hover",this.dropdown).is("li:last-child")?(e("li.Hover",this.dropdown).removeClass("Hover"),e("li:first-child",this.dropdown).addClass("Hover")):e("li.Hover",this.dropdown).removeClass("Hover").next().addClass("Hover"):e("li:first",this.dropdown).addClass("Hover")},dropdownAddItem:function(t,n,o){if(void 0==o&&(o=n),!e('li[data-value="'+t+'"]',this.tokensContainer).length){var s=this,i=e("<li />").attr("data-value",t).attr("data-text",n).html(o).on("click",function(t){t.stopImmediatePropagation(),s.tokenAdd(e(this).attr("data-value"),e(this).attr("data-text"))}).on("mouseover",function(){e(this).addClass("Hover")}).on("mouseout",function(){e("li",s.dropdown).removeClass("Hover")});this.dropdown.append(i),this.options.onDropdownAddItem(t,n,o,this)}return this},dropdownHide:function(){this.dropdownReset(),this.dropdown.hide()},dropdownReset:function(){this.dropdown.html("")},resizeSearchInput:function(){this.searchInput.attr("size",Number(this.searchInput.val().length)+5),this.updatePlaceholder()},resetSearchInput:function(){this.searchInput.val(""),this.resizeSearchInput()},resetPendingTokens:function(){e("li.PendingDelete",this.tokensContainer).removeClass("PendingDelete")},keypress:function(e){String.fromCharCode(e.which)==this.options.delimiter&&(e.preventDefault(),this.tokenAdd(this.searchInput.val(),""))},keydown:function(n){switch(n.keyCode){case t.BACKSPACE:0==this.searchInput.val().length&&(n.preventDefault(),e("li.Token.PendingDelete",this.tokensContainer).length?this.tokenRemove(e("li.Token.PendingDelete").attr("data-value")):e("li.Token:last",this.tokensContainer).addClass("PendingDelete"),this.dropdownHide());break;case t.TAB:case t.ENTER:if(e("li.Hover",this.dropdown).length){var o=e("li.Hover",this.dropdown);n.preventDefault(),this.tokenAdd(o.attr("data-value"),o.attr("data-text"))}else this.searchInput.val()&&(n.preventDefault(),this.tokenAdd(this.searchInput.val(),""));this.resetPendingTokens();break;case t.ESCAPE:this.resetSearchInput(),this.dropdownHide(),this.resetPendingTokens();break;case t.ARROW_UP:n.preventDefault(),this.dropdownPrev();break;case t.ARROW_DOWN:n.preventDefault(),this.dropdownNext();break;default:this.resetPendingTokens()}},keyup:function(e){switch(this.updatePlaceholder(),e.keyCode){case t.TAB:case t.ENTER:case t.ESCAPE:case t.ARROW_UP:case t.ARROW_DOWN:break;case t.BACKSPACE:this.searchInput.val()?this.search():this.dropdownHide();break;default:this.searchInput.val()&&this.search()}},search:function(){var t=this,n=1;if(this.options.maxElements>0&&e("li.Token",this.tokensContainer).length>=this.options.maxElements)return!1;if("select"==this.options.datas){var o=!1,s=new RegExp(this.searchInput.val().replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");this.dropdownReset(),e("option",this.select).not(":selected, :disabled").each(function(){return n<=t.options.nbDropdownElements?void(s.test(e(this).html())&&(t.dropdownAddItem(e(this).attr("value"),e(this).html()),o=!0,n++)):!1}),o?(e("li:first",this.dropdown).addClass("Hover"),this.dropdownShow()):this.dropdownHide()}else this.debounce(function(){e.ajax({url:t.options.datas,data:t.options.searchParam+"="+t.searchInput.val(),dataType:t.options.dataType,success:function(o){return o&&(t.dropdownReset(),e.each(o,function(e,o){if(!(n<=t.options.nbDropdownElements))return!1;var s=void 0;o[t.options.htmlField]&&(s=o[t.options.htmlField]),t.dropdownAddItem(o[t.options.valueField],o[t.options.textField],s),n++}),e("li",t.dropdown).length)?(e("li:first",t.dropdown).addClass("Hover"),t.dropdownShow(),!0):void t.dropdownHide()},error:function(e,t){console.log("Error : "+t)}})},this.options.debounce)},debounce:function(e,t){var o=this,s=arguments,i=function(){e.apply(o,s),n=null};n&&clearTimeout(n),n=setTimeout(i,t||this.options.debounce)},tokenAdd:function(t,n,o){if(t=this.escape(t),void 0==t||""==t)return this;if((void 0==n||""==n)&&(n=t),void 0==o&&(o=!1),this.options.maxElements>0&&e("li.Token",this.tokensContainer).length>=this.options.maxElements)return this.resetSearchInput(),this;var s=this,i=e("<a />").addClass("Close").html("×").on("click",function(e){e.stopImmediatePropagation(),s.tokenRemove(t)});if(e('option[value="'+t+'"]',this.select).length)e('option[value="'+t+'"]',this.select).attr("selected",!0).prop("selected",!0);else{if(!(this.options.newElements||!this.options.newElements&&e('li[data-value="'+t+'"]',this.dropdown).length>0))return this.resetSearchInput(),this;var a=e("<option />").attr("selected",!0).attr("value",t).attr("data-type","custom").prop("selected",!0).html(n);this.select.append(a)}return e('li.Token[data-value="'+t+'"]',this.tokensContainer).length>0?this:(e("<li />").addClass("Token").attr("data-value",t).append("<span>"+n+"</span>").prepend(i).insertBefore(this.searchToken),o||this.options.onAddToken(t,n,this),this.resetSearchInput(),this.dropdownHide(),this.updateOrder(),this)},tokenRemove:function(t){var n=e('option[value="'+t+'"]',this.select);return"custom"==n.attr("data-type")?n.remove():n.removeAttr("selected").prop("selected",!1),e('li.Token[data-value="'+t+'"]',this.tokensContainer).remove(),this.options.onRemoveToken(t,this),this.resizeSearchInput(),this.dropdownHide(),this.updateOrder(),this},clear:function(){var t=this;return e("li.Token",this.tokensContainer).each(function(){t.tokenRemove(e(this).attr("data-value"))}),this.options.onClear(this),this.dropdownHide(),this},disable:function(){return this.select.prop("disabled",!0),this.searchInput.prop("disabled",!0),this.container.addClass("Disabled"),this.options.sortable&&this.tokensContainer.sortable("disable"),this},enable:function(){return this.select.prop("disabled",!1),this.searchInput.prop("disabled",!1),this.container.removeClass("Disabled"),this.options.sortable&&this.tokensContainer.sortable("enable"),this},remap:function(t){var n=this,o=e("option:selected",this.select);return void 0==t&&(t=!1),this.clear(),o.each(function(){n.tokenAdd(e(this).val(),e(this).html(),t)}),this},toArray:function(){var t=[];return e("option:selected",this.select).each(function(){t.push(e(this).val())}),t},escape:function(e){return String(e).replace(/["]/g,function(){return""})}}),e.fn.tokenize=function(t){void 0==t&&(t={});var n=this.filter("select");return n.length>1?(n.each(function(){s(t,e(this))}),n):s(t,e(this))},e.fn.tokenize.defaults={datas:"select",placeholder:!1,searchParam:"search",searchMaxLength:0,debounce:0,delimiter:",",newElements:!0,autosize:!1,nbDropdownElements:10,displayDropdownOnFocus:!1,maxElements:0,sortable:!1,dataType:"json",valueField:"value",textField:"text",htmlField:"html",onAddToken:function(){},onRemoveToken:function(){},onClear:function(){},onReorder:function(){},onDropdownAddItem:function(){}}}(jQuery,"tokenize");
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.