File Editor
Directories:
.. (Back)
admin
app
commerce
v2
Files:
accordion.js
accordion.min.js
move-tickets-dialog.js
move-tickets-dialog.min.js
rsvp-block.js
rsvp-block.min.js
rsvp.js
rsvp.min.js
ticket-details.js
ticket-details.min.js
tickets-attendees.js
tickets-attendees.min.js
tickets-block.js
tickets-block.min.js
tickets-provider.js
tickets-provider.min.js
tickets-registration-page.js
tickets-registration-page.min.js
tickets.js
tickets.min.js
tpp-admin.js
tpp-admin.min.js
Create New File
Create
Edit File: rsvp-block.min.js
/** * This JS file was auto-generated via Terser. * * Contributors should avoid editing this file, but instead edit the associated * non minified file file. For more information, check out our engineering docs * on how we handle JS minification in our engineering docs. * * @see: https://evnt.is/dev-docs-minification */ var tribe_tickets_rsvp_block={events:{}};!function($,my){"use strict";my.state={submitActive:!0},my.tribe_rsvp_toggle_actions=function($button){var sibling=$button.hasClass("tribe-block__rsvp__status-button--going")?".tribe-block__rsvp__status-button--not-going":".tribe-block__rsvp__status-button--going",$siblingEl=$button.closest(".tribe-block__rsvp__status").find(sibling);$button.addClass("tribe-active"),$button.removeClass("tribe-inactive"),$button.attr("disabled","disabled"),$siblingEl.addClass("tribe-inactive"),$siblingEl.removeClass("tribe-active"),$siblingEl.removeAttr("disabled")},my.events.handle_rsvp_response=function(){var $button=$(this),$block=$button.closest(".tribe-block__rsvp"),$ticket=$block.find(".tribe-block__rsvp__ticket"),ticket_id=$ticket.data("rsvp-id"),going=$button.hasClass("tribe-block__rsvp__status-button--going");my.tribe_rsvp_toggle_actions($button);var params={action:"rsvp-form",ticket_id:ticket_id,going:going?"yes":"no"};my.tribe_rsvp_loader_start(),$.post(TribeRsvp.ajaxurl,params,(function(response){$block.find(".tribe-block__rsvp__message__success").remove();var $form=$ticket.find(".tribe-block__rsvp__form");if($form.html(response.data.html),window.tribe_event_tickets_plus){var $input=$form.find("input.tribe-tickets-quantity");window.tribe_event_tickets_plus.meta.block_set_quantity($input,going)}my.validate_submission($form)||($form.find(".tribe-block__rsvp__submit-button").prop("disabled",!0),my.state.submitActive=!1);my.tribe_rsvp_loader_end()}))},my.events.handle_quantity_change=function(e){e.preventDefault();var $input=$(this).parent().find('input[type="number"]'),increase=$(this).hasClass("tribe-block__rsvp__number-input-button--plus"),step=$input[0].step?Number($input[0].step):1,originalValue=Number($input[0].value);if(increase){var max=$input[0].max?Number($input[0].max):-1;if("function"==typeof $input[0].stepUp)try{if(max<originalValue+step)return;$input[0].stepUp()}catch(ex){$input[0].value=-1===max||max>=originalValue+step?originalValue+step:max}else $input[0].value=-1===max||max>=originalValue+step?originalValue+step:max}else{var min=$input[0].min?Number($input[0].min):0;if("function"==typeof $input[0].stepDown)try{$input[0].stepDown()}catch(ex){$input[0].value=min<=originalValue-step?originalValue-step:min}else $input[0].value=min<=originalValue-step?originalValue-step:min}originalValue!==$input[0].value&&$input.trigger("change")},my.events.handle_quantity_change_value=function(e){e.preventDefault();const $this=$(e.target),max=$this.attr("max");let newQuantity=parseInt($this.val(),10);newQuantity=isNaN(newQuantity)?0:newQuantity,max<newQuantity&&(newQuantity=max,$this.val(max)),e.preventDefault()},my.events.handle_input_focus=function(e){my.state.submitActive||($(e.target).siblings(".tribe-block__rsvp__submit-button").attr("disabled",!1),my.state.submitActive=!0)},my.tribe_rsvp_loader_start=function($ticket){$(".tribe-block__rsvp").find(".tribe-block__rsvp__loading").removeClass("tribe-common-a11y-hidden")},my.tribe_rsvp_loader_end=function($ticket){$(".tribe-block__rsvp").find(".tribe-block__rsvp__loading").addClass("tribe-common-a11y-hidden")},my.validate_submission=function($form){var $qty=$form.find("input.tribe-tickets-quantity"),$name=$form.find("input.tribe-tickets-full-name"),$email=$form.find("input.tribe-tickets-email");return $name.val().trim().length&&$email.val().trim().length&&parseInt($qty.val(),10)>0},my.events.handle_submission=function(e){e.preventDefault();var $ticket=$(this).closest(".tribe-block__rsvp__ticket"),ticket_id=$ticket.data("rsvp-id"),$form=$ticket.find("form"),is_rsvp_valid=my.validate_submission($form),is_meta_valid=!0,has_tickets_plus=!!window.tribe_event_tickets_plus;if(has_tickets_plus&&(is_meta_valid=window.tribe_event_tickets_plus.meta.validate_meta($form)),is_rsvp_valid&&is_meta_valid){var params=$form.serializeArray();params.push({name:"action",value:"rsvp-process"}),params.push({name:"ticket_id",value:ticket_id}),my.tribe_rsvp_loader_start(),$.post(TribeRsvp.ajaxurl,params,(function(response){var remaining=response.data.remaining;$ticket.find(".tribe-block__rsvp__details .tribe-block__rsvp__availability").replaceWith(response.data.remaining_html),$ticket.find(".tribe-block__rsvp__form").empty(),$ticket.closest(".tribe-block__rsvp").append(response.data.html),0===remaining&&$ticket.find(".tribe-block__rsvp__status").replaceWith(response.data.status_html),my.tribe_rsvp_loader_end()}))}else is_rsvp_valid?$form.find(".tribe-block__rsvp__message__error").hide():$form.find(".tribe-block__rsvp__message__error").show(),has_tickets_plus&&is_meta_valid?$form.find(".tribe-event-tickets-meta-required-message").hide():$form.find(".tribe-event-tickets-meta-required-message").show(),$("html, body").animate({scrollTop:$form.offset().top-100},300)},my.bind_events=function(){$(".tribe-block__rsvp__ticket").on("click",".tribe-block__rsvp__status-button--going, .tribe-block__rsvp__status-button--not-going",my.events.handle_rsvp_response).on("click",'button[type="submit"]',my.events.handle_submission).on("click",".tribe-block__rsvp__number-input-button--minus, .tribe-block__rsvp__number-input-button--plus",my.events.handle_quantity_change).on("change keyup",".tribe-tickets-quantity",my.events.handle_quantity_change_value).on("focus",".tribe-tickets-full-name, .tribe-tickets-email",my.events.handle_input_focus)},my.init=function(){$(".tribe-block__rsvp").length&&my.bind_events()},my.init()}(jQuery,tribe_tickets_rsvp_block);
Save Changes
Rename File
Rename