PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | core/any/js/admin-support.js +92 -67 10.10.211.8.4 View file →
@@ -10,8 +10,55 @@
10 10 *
11 11 * @modified 2015-04-09
12 12 */
13 13
14 +function wpbc_parse_url_and_get_params_arr( url ) {
15 +
16 + var url_parameters = url.split( '?' )[1];
17 + var result_params_arr = {};
18 + var url_parameters_arr = url_parameters.split( /\?|&/ );
19 + var param_length = url_parameters_arr.length;
20 + for ( var i = 0; i < param_length; i++ ) {
21 + if ( ! url_parameters_arr[i] ) {
22 + continue;
23 + }
24 + var ary = url_parameters_arr[i].split( '=' );
25 + result_params_arr[ary[0]] = ary[1];
26 + }
27 + return result_params_arr;
28 +}
29 +
30 +function wpbc_ui_settings__menu__click( url, left_vert_nav_menu_a, section_id_to_show, text_for_path ){
31 +
32 + var current_page_params = wpbc_parse_url_and_get_params_arr( window.location.href );
33 + var destination_page_params = wpbc_parse_url_and_get_params_arr( url );
34 +
35 + var is_this_same_page = 0;
36 +
37 + if (current_page_params['page'] === destination_page_params['page']){
38 + is_this_same_page++;
39 + }
40 + if (
41 + ( (typeof( current_page_params['tab'] ) === 'undefined') && (typeof( destination_page_params['tab'] ) === 'undefined') ) ||
42 + ( (current_page_params['tab'] === destination_page_params['tab']) )
43 + ) {
44 + is_this_same_page++;
45 + }
46 + if (
47 + ( (typeof( current_page_params['subtab'] ) === 'undefined') && (typeof( destination_page_params['subtab'] ) === 'undefined') ) ||
48 + ( (current_page_params['subtab'] === destination_page_params['subtab']) )
49 + ) {
50 + is_this_same_page++;
51 + }
52 +
53 + if ( 3 === is_this_same_page ) {
54 + wpbc_ui_settings__panel__click( left_vert_nav_menu_a, section_id_to_show, text_for_path )
55 + } else {
56 + window.location.href = url;
57 + }
58 +
59 +}
60 +
14 61 function wpbc_ui_settings__panel__click( left_vert_nav_menu_a, section_id_to_show, text_for_path ){
15 62
16 63 // Update text in Top Menu.
17 64 jQuery( '.wpbc_settings_path_el_active' ).html(
@@ -20,10 +67,12 @@
20 67
21 68 // Show / Hide section and enable Left Vert Menu item
22 69 wpbc_navigation_click_show_section( left_vert_nav_menu_a, section_id_to_show , '.postbox' , false);
23 70
24 - //wpbc_scroll_to( '.wpbc_settings_path_el_active' ); // Scroll to path
25 - wpbc_scroll_to( '.wpbc_page_top__header_tabs' ); // Scroll to Top
71 + // wpbc_scroll_to( '.wpbc_settings_path_el_active' ); // Scroll to path.
72 + // wpbc_scroll_to( '.wpbc_page_top__header_tabs' ); // Scroll to Top.
73 + wpbc_scroll_to( '.wpbc_settings_page_header_title' ); // Scroll to Top.
74 +
26 75 }
27 76
28 77
29 78 /**
@@ -64,26 +113,40 @@
64 113 *
65 114 * @param {type} object_name
66 115 * @returns {undefined}
67 116 */
68 -function wpbc_scroll_to( object_name ) {
69 - if ( jQuery( object_name ).length > 0 ) {
70 - var targetOffset = jQuery( object_name ).offset().top;
71 - // targetOffset = targetOffset - 50;
72 - if (targetOffset<0) targetOffset = 0;
73 - if ( jQuery('#wpadminbar').length > 0 ) targetOffset = targetOffset - 50;
74 - else targetOffset = targetOffset - 20;
75 - jQuery('html,body').animate({scrollTop: targetOffset}, 500);
76 - return targetOffset;
77 - }
78 - return 0;
117 +function wpbc_scroll_to(object_name) {
118 +
119 + if ( jQuery( object_name ).length > 0 ) {
120 + var targetOffset = jQuery( object_name ).offset().top;
121 + if ( targetOffset < 0 ) {
122 + targetOffset = 0;
123 + }
124 + if ( jQuery( '#wpadminbar' ).length > 0 ) {
125 + targetOffset = targetOffset - 50 - 40;
126 + } else {
127 + targetOffset = targetOffset - 20;
128 + }
129 + jQuery( 'html,body' ).animate( { scrollTop: targetOffset }, 500 );
130 + return targetOffset;
131 + }
132 + return 0;
79 133 }
80 134
81 -jQuery( document ).ready(function(){
82 - setTimeout(function() {
83 - wpbc_scroll_to( window.location.hash );
84 - }, 100)
85 -});
135 +/**
136 + * Auto scroll to unchor after page loaded.
137 + */
138 +jQuery( document ).ready(
139 + function () {
140 + setTimeout(
141 + function () {
142 + // window.location.hash = #section_id / doc: https://developer.mozilla.org/en-US/docs/Web/API/Location .
143 + wpbc_scroll_to( window.location.hash );
144 + },
145 + 100
146 + );
147 + }
148 +);
86 149
87 150 function wpbc_animate_border( element, time, colors, x ) {
88 151
89 152 if ( x >= colors.length ) {
@@ -222,9 +285,10 @@
222 285 function wpbc_close_dropdown_selectbox( selector_id ) {
223 286 jQuery('#' + selector_id + '_container li input[type=checkbox],#' + selector_id + '_container li input[type=radio]').prop('checked', false);
224 287 jQuery('#' + selector_id + '_container').hide();
225 288 }
226 - // Show Container depend from the selected option in dropdown list
289 +
290 + // Show Container depend from the selected option in dropdown list.
227 291 function wpbc_show_selected_in_dropdown( selector_id, title, value ){
228 292 jQuery('#' + selector_id + '_selector .wpbc_selected_in_dropdown').html( title );
229 293 jQuery('#' + selector_id ).val( value );
230 294 jQuery('#' + selector_id ).trigger('change');
@@ -229,10 +293,10 @@
229 293 jQuery('#' + selector_id ).val( value );
230 294 jQuery('#' + selector_id ).trigger('change');
231 295 }
232 296
233 - // Show Container depend from the selected Radio Option and Selectbox value in dropdown list
234 - // Exmaple: wpbc_show_selected_in_dropdown__radio_select_option( 'wh_booking_date', 'wh_booking_date2', 'wh_booking_datedays_interval_Radios' );
297 + // Show Container depend from the selected Radio Option and Selectbox value in dropdown list.
298 + // Exmaple: wpbc_show_selected_in_dropdown__radio_select_option( 'wh_booking_date', 'wh_booking_date2', 'wh_booking_datedays_interval_Radios' );.
235 299 function wpbc_show_selected_in_dropdown__radio_select_option( selector_id, selector_id2, radio_name ){
236 300
237 301 // Get selected value in radio buttons
238 302 var rad_val = jQuery('input:radio[name="' + radio_name + '"]:checked').val();
@@ -288,31 +352,9 @@
288 352
289 353 /**
290 354 * End: Dropdown BS List elements -------------------------------------------------------------------------------- */
291 355
292 -// FixIn: 9.6.3.5.
293 356
294 -/* Mark rows in listing as selected by adding specific CLASS*/
295 -( function( $ ){
296 - $( document ).ready(function(){
297 -
298 -
299 - $('.wpbc-listing-row input[type="checkbox"]').on( 'change', function(){
300 -
301 - $('.wpbc-listing-row').find('.check-column').find(':checkbox').each( function() {
302 - if ( $(this).is(':checked') ) {
303 - $(this).parent().parent().parent().parent().addClass('row_selected_color');
304 - } else {
305 - $(this).parent().parent().parent().parent().removeClass('row_selected_color');
306 - }
307 -
308 - });
309 -
310 - } );
311 -
312 - });
313 -}( jQuery ) );
314 -
315 357 /**
316 358 * Ajax Request
317 359 *
318 360 * @param {type} us_id
@@ -357,11 +399,8 @@
357 399 );
358 400
359 401 }
360 402
361 -
362 -
363 -
364 403 /**
365 404 * Ajax Request - Saving Custom Data for User
366 405 *
367 406 * @param {int} us_id
@@ -376,9 +415,9 @@
376 415 jQuery.ajax({ // Start Ajax Sending
377 416 url: wpbc_url_ajax,
378 417 type:'POST',
379 418 success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
380 - error:function (XMLHttpRequest, textStatus, errorThrown){ window.status = 'Ajax sending Error status:'+ textStatus; alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText); if ( XMLHttpRequest.status == 500 ) { alert('Error: 500'); } } ,
419 + error:function (XMLHttpRequest, textStatus, errorThrown){ window.status = 'Ajax sending Error status:'+ textStatus; console.error( XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText); if ( XMLHttpRequest.status == 500 ) { console.error( 'Error: 500'); } } ,
381 420 // beforeSend: someFunction,
382 421 data:{
383 422 action: 'USER_SAVE_CUSTOM_DATA',
384 423 user_id: us_id,
@@ -389,15 +428,9 @@
389 428 }
390 429 });
391 430 }
392 431
393 -
394 -
395 -
396 -
397 -////////////////////////////////////////////////////////////////////////////////
398 -// Contact Form
399 -////////////////////////////////////////////////////////////////////////////////
432 +// Contact Form.
400 433 function wpbc_submit_client_form( submit_form, wpdev_active_locale ){
401 434
402 435 var count = submit_form.elements.length;
403 436 var formdata = '';
@@ -536,9 +569,8 @@
536 569
537 570 submit_form.submit(); // Submit Form, if previously was no interuptions
538 571 }
539 572
540 -
541 573 /**
542 574 * Show message under specific element
543 575 *
544 576 * @param {type} element - jQuery definition of the element
@@ -567,10 +599,9 @@
567 599 .animate( {opacity: 1}, 10000 )
568 600 .fadeOut( 2000 );
569 601 }
570 602
571 -
572 -// Show Error Message in Booking Form at Front End
603 +// Show Error Message in Booking Form at Front End.
573 604 function wpbc_show_error_message( element , errorMessage) {
574 605
575 606 // Scroll to the element
576 607 wpbc_scroll_to( element );
@@ -647,12 +678,11 @@
647 678 //return parser.href;
648 679 window.location.href = parser.href;
649 680 }
650 681
651 -// jQuery(window).load(function(){
682 +// Deprecated:.
652 683 jQuery( window ).on( "load", function (){ // FixIn: 8.7.9.7.
653 684
654 -
655 685 // Color Text picker ///////////////////////////////////////////////////////
656 686 if ( jQuery('.field-text-color').length > 0 ) {
657 687 jQuery('.field-text-color').iris( {
658 688 change: function(event, ui){
@@ -719,17 +749,12 @@
719 749 jQuery('.wpbc_colorpick' ).on( 'click', function(event){
720 750 event.stopPropagation();
721 751 });
722 752 }
723 -
724 -});
753 +});
725 754
755 +// -- Support Functions ------------------------------------------------------------------------------------------------
726 756
727 -
728 -////////////////////////////////////////////////////////////////////////////
729 -// Support Functions
730 -////////////////////////////////////////////////////////////////////////////
731 -
732 757 /**
733 758 * Reset of WP Editor or TextArea Content
734 759 * @param {string} editor_textarea_id - ID of element
735 760 * @param {string} editor_textarea_content - Content
@@ -769,9 +794,9 @@
769 794 jQuery.ajax({ // Start Ajax Sending
770 795 url: wpbc_url_ajax,
771 796 type:'POST',
772 797 success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
773 - error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' https://wpbookingcalendar.com/faq/#ajax-sending-error');}},
798 + error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;console.error( XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {console.error( 'Please check at this page according this error:' + ' https://wpbookingcalendar.com/faq/#ajax-sending-error');}},
774 799 // beforeSend: someFunction,
775 800 data:{
776 801 //ajax_action : 'USER_SAVE_WINDOW_STATE',
777 802 action : 'USER_SAVE_WINDOW_STATE',