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: tickets.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 */ void 0===tribe.tickets&&(tribe.tickets={}),"undefined"==typeof ajaxurl&&(ajaxurl=TribeTickets.ajaxurl),tribe.tickets.editor={};var ticketHeaderImage=window.ticketHeaderImage||{};!function(window,$,_,obj){"use strict";var $document=$(document),$tribe_tickets=$(document.getElementById("tribetickets"));const ticket_button_selectors="#rsvp_form_toggle, #ticket_form_toggle, #settings_form_toggle",noTicketsOnRecurring=document.body.classList.contains("tec-no-tickets-on-recurring");if(0===$tribe_tickets.length)return;var $tickets_container=$(document.getElementById("event_tickets")),$post_id=$(document.getElementById("post_ID")),$publish=$(document.getElementById("publish")),$metaboxBlocker=$tribe_tickets.find(".tribe-tickets-editor-blocker"),$spinner=$tribe_tickets.find(".spinner"),$base_panel=$(document.getElementById("tribe_panel_base")),$edit_panel=$(document.getElementById("tribe_panel_edit")),$settings_panel=$(document.getElementById("tribe_panel_settings")),datepickerFormats=["yy-mm-dd","m/d/yy","mm/dd/yy","d/m/yy","dd/mm/yy","m-d-yy","mm-dd-yy","d-m-yy","dd-mm-yy","yy.mm.dd","mm.dd.yy","dd.mm.yy"],dateFormat=datepickerFormats[0];obj.beforeUnload=function(event){var returnValue=!1;return"true"===$base_panel.attr("aria-hidden")&&(returnValue=tribe_global_stock_admin_ui.nav_away_msg),event.returnValue=returnValue,returnValue},ticketHeaderImage={uploader:function(){var frame=wp.media({title:HeaderImageData.title,multiple:!1,library:{type:"image"},button:{text:HeaderImageData.button}});return frame.on("close",(function(){var attachments=frame.state().get("selection").toJSON();attachments.length&&ticketHeaderImage.render(attachments[0])})),frame.open(),!1},render:function(attachment){$(document.getElementById("tribe_ticket_header_preview")).html(ticketHeaderImage.imgHTML(attachment)),$(document.getElementById("tribe_ticket_header_image_id")).val(attachment.id),$(document.getElementById("tribe_ticket_header_remove")).show(),$(document.getElementById("tribe_tickets_image_preview_filename")).show().find(".filename").text(attachment.filename)},imgHTML:function(attachment){var img_html='<img src="'+attachment.url+'" ';return img_html+='width="'+attachment.width+'" ',img_html+='height="'+attachment.height+'" ',img_html+="/>"}},obj.panels={list:"#tribe_panel_base",ticket:"#tribe_panel_edit",settings:"#tribe_panel_settings"},obj.swapPanel=function(panel){var $panel;$panel=panel instanceof jQuery?panel:void 0!==obj.panels[panel]?$(obj.panels[panel]):$base_panel;var $eventTickets=$("#event_tickets");$eventTickets.trigger("before_panel_swap.tickets",{panel:$panel}),$tribe_tickets.find(".ticket_panel").each((function(){$(this).attr("aria-hidden","true")})),$panel.attr("aria-hidden","false"),$panel.is($base_panel)?($(window).off("beforeunload.tribe"),$document.trigger("tribe.dependencies-run")):$(window).on("beforeunload.tribe",obj.beforeUnload),$eventTickets.trigger("after_panel_swap.tickets",{panel:$panel})},obj.fetchPanels=function(data,swapTo){void 0===data&&(data=[]);var params={action:"tribe-ticket-panels",notice:!1,post_id:$post_id.val(),nonce:TribeTickets.add_ticket_nonce,data:data,is_admin:$("body").hasClass("wp-admin")};$.post(ajaxurl,params,(function(response){response.success&&obj.refreshPanels(response.data,swapTo)}),"json")},obj.startWatchingMoveLinkIn=function(){$tickets_container.find(".tribe-ticket-move-link").one("click",(function(){window.setTimeout(obj.listentToThickboxEvents,250)}))},obj.listentToThickboxEvents=function(){var $tbWindow=$("#TB_window");0!==$tbWindow.length&&$tbWindow.one("tb_unload",(function(){obj.fetchPanels(null,"list")}))},obj.refreshPanels=function(panels,swapTo){$base_panel=$(panels.list),$edit_panel=$(panels.ticket),$settings_panel=$(panels.settings),$tribe_tickets.find(obj.panels.list).replaceWith($base_panel),$tribe_tickets.find(obj.panels.ticket).replaceWith($edit_panel),$tribe_tickets.find(obj.panels.settings).replaceWith($settings_panel),obj.setupPanels(),obj.swapPanel(swapTo),$(".tribe-dependency").trigger("verify.dependency")},obj.setupPanels=function(){window.MTAccordion({target:".accordion"});var $event_pickers=$(document.getElementById("tribe-event-datepickers")),$ticket_start_date=$(document.getElementById("ticket_start_date")),$ticket_end_date=$(document.getElementById("ticket_end_date"));$(document.getElementById("ticket_start_time")),$(document.getElementById("ticket_end_time"));if("undefined"==typeof tribe_datepicker_opts){var $dateFormat=$("[data-datepicker_format]"),formatAttr=$dateFormat.length?$dateFormat.attr("data-datepicker_format"):"",format=parseInt(formatAttr,10);isNaN(format)||(window.tribe_datepicker_opts={dateFormat:datepickerFormats[format]})}var number,datepicker_opts=window.tribe_datepicker_opts||{};if($event_pickers.length&&$event_pickers.data("startofweek"),"undefined"!=typeof tribe_ticket_datepicker_format){var indexDatepickerFormat=(number=tribe_ticket_datepicker_format.datepicker_format_index,!isNaN(parseFloat(number))&&isFinite(number)?tribe_ticket_datepicker_format.datepicker_format_index:0);dateFormat=datepickerFormats[indexDatepickerFormat]}else datepicker_opts&&datepicker_opts.dateFormat&&(dateFormat=datepicker_opts.dateFormat);var datepickerOpts={dateFormat:dateFormat,showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,showButtonPanel:!1,onChange:function(){},beforeShow:function(element,object){object.input.data("prevDate",object.input.datepicker("getDate"));var $dpDiv=$(object.dpDiv);$dpDiv.addClass("tribe-ui-datepicker"),$dpDiv.attrchange({trackValues:!0,callback:function(attr){(attr.newValue.indexOf("display: none")>=0||attr.newValue.indexOf("display:none")>=0)&&$dpDiv.removeClass("tribe-ui-datepicker")}})},onSelect:function(dateText,inst){var the_date=$.datepicker.parseDate(dateFormat,dateText);"ticket_start_date"===inst.id?$ticket_end_date.datepicker("option","minDate",the_date):$ticket_start_date.datepicker("option","maxDate",the_date)}};$.extend(datepickerOpts,tribe_l10n_datatables.datepicker);var $timepickers=$tribe_tickets.find(".tribe-timepicker:not(.ui-timepicker-input)");if(tribe_timepickers.setup_timepickers($timepickers),$ticket_start_date.datepicker(datepickerOpts).datepicker("option","defaultDate",$(document.getElementById("EventStartDate")).val()).on("keyup",(function(e){8!==e.keyCode&&46!==e.keyCode||$.datepicker._clearDate(this)})),$ticket_end_date.datepicker(datepickerOpts).datepicker("option","defaultDate",$(document.getElementById("EventEndDate")).val()).on("keyup",(function(e){8!==e.keyCode&&46!==e.keyCode||$.datepicker._clearDate(this)})),$(document.getElementById("tribe_ticket_header_preview")).find("img").length){$(document.getElementById("tribe_ticket_header_remove")).show();var $tiximg=$(document.getElementById("tribe_ticket_header_preview")).find("img");$tiximg.removeAttr("width").removeAttr("height"),$tribe_tickets.width()<$tiximg.width()&&$tiximg.css("width","95%")}"undefined"!=typeof tribe_event_tickets_plus&&$.isPlainObject(tribe_event_tickets_plus)&&$.isPlainObject(tribe_event_tickets_plus.meta)&&$.isPlainObject(tribe_event_tickets_plus.meta.admin)&&"function"==typeof tribe_event_tickets_plus.meta.admin.init_ticket_fields&&tribe_event_tickets_plus.meta.admin.init_ticket_fields(),tribe.tickets.table&&0!==$base_panel.find(".tribe-tickets-editor-table-tickets-body tr").length&&tribe.tickets.table.toggle_sortable(),$tribe_tickets.find(tribe.validation.selectors.item).validation(),$tribe_tickets.find(".tribe-dependent").dependency(),$tribe_tickets.find(".tribe-dependency").trigger("verify.dependency")},$document.ajaxSend((function(event,jqxhr,settings){"string"===$.type(settings.data)&&-1!==settings.data.indexOf("action=tribe-ticket")&&$tribe_tickets.trigger("spin.tribe","start")})),$document.ajaxComplete((function(event,jqxhr,settings){"string"===$.type(settings.data)&&-1!==settings.data.indexOf("action=tribe-ticket")&&$tribe_tickets.trigger("spin.tribe","stop")})),$document.on({"spin.tribe":function(event,action){(void 0===action||$.inArray(action,["start","stop"]))&&(action="stop"),"stop"===action?($metaboxBlocker.hide(),$spinner.removeClass("is-active")):($metaboxBlocker.show(),$spinner.addClass("is-active"))}}),$publish.on("click",(function(event){$(window).off("beforeunload.tribe")})),$document.on("click","#settings_form_toggle",(function(event){return event.preventDefault(),obj.fetchPanels(null,"settings"),!1})),$document.on("click","#tribe_settings_form_cancel, #ticket_form_cancel",(function(event){return event.preventDefault(),obj.fetchPanels(null,"list"),!1})),$document.on("click","#tribe_settings_form_save",(function(event){event.preventDefault();var formData=$settings_panel.find("input,textarea").serialize();return obj.fetchPanels(formData,"list"),!1})),$document.on("click",".ticket_form_toggle",(function(event){return event.preventDefault(),function set_default_provider_radio(force_rsvp){void 0===force_rsvp&&(force_rsvp=!0);var provider_id,$checkedProvider=$tribe_tickets.find(".tribe-ticket-editor-field-default_provider");$checkedProvider.is(":radio")&&($checkedProvider=$checkedProvider.filter(":checked")),provider_id=force_rsvp?"Tribe__Tickets__RSVP_radio":"Tribe__Tickets_Plus__Commerce__WooCommerce__Main_radio",!force_rsvp&&$checkedProvider.length>0&&(provider_id=$checkedProvider.val()+"_radio"),$(document.getElementById(provider_id)).prop("checked",!0).trigger("change")}("rsvp_form_toggle"===$(this).attr("id")),$edit_panel.find(".tribe-dependency").trigger("verify.dependency"),obj.swapPanel("ticket"),!1})),$document.on("click",".ticket_edit_button",(function(event){event.preventDefault();var $button=$(this),params={action:"tribe-ticket-edit",post_id:$post_id.val(),ticket_id:$button.data("ticketId"),nonce:TribeTickets.edit_ticket_nonce,is_admin:$("body").hasClass("wp-admin")};return $.post(ajaxurl,params,(function(response){response.success&&(obj.refreshPanels(response.data,"ticket"),obj.startWatchingMoveLinkIn("#event_tickets"),$tribe_tickets.trigger("edit-ticket.tribe",event))}),"json"),!1})),$document.on("click.tribe",'[name="ticket_form_save"]',(function(e){var $form=$(document.getElementById("ticket_form_table")),additionalValidation=!0;if($form.trigger("validation.tribe"),!tribe.validation.hasErrors($form)&&!1!==(additionalValidation=$tribe_tickets.triggerHandler("additionalValidation.tribe",[additionalValidation]))){$tribe_tickets.trigger("pre-save-ticket.tribe",e);var ticketID=$edit_panel.find("#ticket_id").val(),orders=$base_panel.find(`[data-ticket-type-id="${ticketID}"]`).find(".tribe-ticket-field-order").val(),params={action:"tribe-ticket-add",data:$edit_panel.find("input,textarea,select").serialize().replace(/\'/g,"%27").replace(/\:/g,"%3A"),post_id:$post_id.val(),nonce:TribeTickets.add_ticket_nonce,menu_order:orders,is_admin:$("body").hasClass("wp-admin")};params.data=params.data.concat("&ticket_menu_order="+orders),$.post(ajaxurl,params,(function(response){response.success&&obj.refreshPanels(response.data)}),"json")}})),$document.on("click",".ticket_delete",(function(event){if(!confirm(tribe_ticket_notices.confirm_alert))return!1;event.preventDefault(),$tribe_tickets.trigger("delete-ticket.tribe",event);var deleted_ticket_id=$(this).attr("attr-ticket-id"),params={action:"tribe-ticket-delete",post_id:$post_id.val(),ticket_id:deleted_ticket_id,nonce:TribeTickets.remove_ticket_nonce,is_admin:$("body").hasClass("wp-admin")};$.post(ajaxurl,params,(function(response){response.success&&obj.refreshPanels(response.data)}),"json")})),$document.on("click",".ticket_duplicate",(function(event){event.preventDefault();var $button=$(this),params={action:"tribe-ticket-duplicate",post_id:$post_id.val(),ticket_id:$button.data("ticketId"),nonce:TribeTickets.duplicate_ticket_nonce,is_admin:$("body").hasClass("wp-admin")};return $.post(ajaxurl,params,(function(response){response.success&&obj.refreshPanels(response.data)}),"json"),!1})),$document.on("change",".tribe-ticket-field-capacity",(function(e){var $this=$(this),$globalField=$this.parents(".input_block").eq(0).find(".tribe-ticket-field-mode");$this.val()&&$globalField.val("capped")})),$document.on("keyup","#ticket_price",(function(e){e.preventDefault();var decimal_point=price_format.decimal,regex=new RegExp("[^-0-9%\\"+decimal_point+"]+","gi"),value=$(this).val(),newvalue=value.replace(regex,"");value!==newvalue&&$(this).val(newvalue)})),$document.on("click","#tribe_ticket_header_image, #tribe_ticket_header_preview",(function(e){e.preventDefault(),ticketHeaderImage.uploader("","")})),$document.on("focus","#settings_global_capacity_edit",(function(){var $capacity=$(this),nonSharedCapacity=0;$(".tribe-tickets-editor-capacity-table").find("[data-capacity]").each((function(){var $item=$(this);nonSharedCapacity+=parseInt($item.data("capacity"),10)})),$capacity.data("nonSharedCapacity",nonSharedCapacity)})),$document.on("blur change","#settings_global_capacity_edit",(function(){var $totalRow=$(".tribe-tickets-editor-table-row-capacity-total");if(-1!==parseInt($totalRow.data("totalCapacity"),10)){var $capacity=$(this),$total=$totalRow.find(".tribe-tickets-editor-total-capacity"),capacity=parseInt($capacity.val(),10),nonSharedCapacity=$capacity.data("nonSharedCapacity");(""===capacity||0>capacity||_.isNaN(capacity))&&(capacity=0);var total=nonSharedCapacity+capacity;$total.text(total)}})),$document.on("click","#global_capacity_edit_button",(function(e){e.preventDefault(),$(document.getElementById("settings_global_capacity_edit")).prop("disabled",!1).focus()})),$document.on("blur",'[name="tribe-ticket[event_capacity]"]',(function(event,eventCapacity){void 0===eventCapacity&&(eventCapacity=$(this).val());if(void 0!==eventCapacity){eventCapacity||(eventCapacity=0),eventCapacity=parseInt(eventCapacity,10);var $capacityValue=$(".tribe-ticket-capacity-max").find(".tribe-ticket-capacity-value"),$capacity=$('.tribe-ticket-field-capacity[name="tribe-ticket[capacity]"]');$capacity.attr("placeholder",eventCapacity),eventCapacity?$capacity.attr("max",eventCapacity):eventCapacity=0,$capacityValue.text(eventCapacity)}})),$document.on("change",'[name="tribe-ticket[capacity]"]',(function(event){var $field=$(this),max=parseInt($field.attr("max"),10),value=parseInt($field.val(),10);max&&max<value&&$field.val(max)})),noTicketsOnRecurring?($document.on("tribe-recurrence-active",(function(event){$(ticket_button_selectors).hide(),$(ticket_button_selectors).parent().find(".ticket-editor-notice.recurring_event_warning").show()})),$document.on("tribe-recurrence-inactive",(function(event){$(ticket_button_selectors).show(),$(ticket_button_selectors).parent().find(".ticket-editor-notice.recurring_event_warning").hide()})),$document.on("tribe-tickets-active",(function(event){$(".recurrence-row").hide(),$(".recurrence-row.tribe-recurrence-not-supported").css("visibility","visible").show()})),$document.on("tribe-tickets-inactive",(function(event){$(".recurrence-row").show(),$(".recurrence-row.tribe-recurrence-not-supported").hide()}))):$(ticket_button_selectors).parent().find(".ticket-editor-notice.recurring_event_warning").hide(),$document.on("click","#tribe_ticket_header_remove",(function(e){e.preventDefault(),$(document.getElementById("tribe_ticket_header_preview")).html(""),$(document.getElementById("tribe_ticket_header_remove")).hide(),$(document.getElementById("tribe_tickets_image_preview_filename")).hide().find(".filename").text(""),$(document.getElementById("tribe_ticket_header_image_id")).val("")})),$document.on("after_panel_swap.tickets",(function(){$document.trigger("tribe-tickets-active")})),$document.on("verify.dependency",(function(){$(".tribe-tickets-editor-table-tickets-body").is(":visible")?$document.trigger("tribe-tickets-active"):$document.trigger("tribe-tickets-inactive"),$(".tribe-event-recurrence-rule").is(":visible")?$document.trigger("tribe-recurrence-active"):$document.trigger("tribe-recurrence-inactive")})),$(obj.setupPanels)}(window,jQuery,_,tribe.tickets.editor);
Save Changes
Rename File
Rename