芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/the-events-calendar/src/resources/js/aggregator-fields.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_aggregator=tribe_aggregator||{};tribe_aggregator.fields={selector:{container:".tribe-ea",form:".tribe-ea-form",help:".tribe-ea-help",fields:".tribe-ea-field",dropdown:".tribe-ea-dropdown",origin_field:"#tribe-ea-field-origin",field_url_source:"#tribe-ea-field-url_source",eventbrite_url_source:"#tribe-ea-field-eventbrite_source",post_status:".tribe-ea-field-post_status",import_type_field:".tribe-import-type",media_button:".tribe-ea-media_button",datepicker:".tribe-datepicker",save_credentials_button:".enter-credentials .tribe-save",preview_container:".tribe-preview-container",preview_button:".tribe-preview:visible",refine_filters:".tribe-refine-filters",clear_filters_button:".tribe-clear-filters",finalize_button:".tribe-finalize",cancel_button:".tribe-cancel",schedule_delete_link:".tribe-ea-tab-scheduled a.submitdelete",tab_new:".tribe-ea-tab-new",action:"#tribe-action",view_filters:".tribe-view-filters"},media:{},$:{},construct:{},events:{},import_id:null,result_fetch_count:0,max_result_fetch_count:15,polling_frequency_index:0,polling_frequencies:[500,1e3,5e3,2e4],eventbrite:{refineControls:".tribe-refine-filters.eventbrite, .tribe-refine-filters.eventbrite .tribe-refine",refineControlsHideMap:{event:"tr.tribe-refine-filters",organizer:""},detect_type:function(url){if(!tribe_aggregator.source_origin_regexp.eventbrite)return null;var baseRegex=tribe_aggregator.source_origin_regexp.eventbrite,type_regexps={event:baseRegex+"e/[A-z0-9_-]+",organizer:baseRegex+"o/[A-z0-9_-]+"},type=void 0;return _.each(type_regexps,(function(regularExpression,key){null!==new RegExp(regularExpression,"g").exec(url)&&(type=key)})),type}}},function($,_,obj,ea){"use strict";obj.init=function(){if(obj.$.container=$(obj.selector.container),obj.$.form=$(obj.selector.form),obj.$.action=$(obj.selector.action),obj.$.fields=obj.$.container.find(obj.selector.fields),obj.$.preview_container=$(obj.selector.preview_container),obj.origin=$("#tribe-ea-field-origin"),obj.importType=$("#tribe-ea-field-url_import_type"),obj.urlImport={startDate:$("#tribe-ea-field-url_start"),originalMinDate:function(){return $("#tribe-ea-field-url_start").datepicker("option","minDate")||""}},$.each(obj.construct,(function(key,callback){callback(obj.$.fields)})),void 0!==typeof tribe_ev||void 0!==typeof tribe_ev.state){var $tribe_events=$(document.getElementById("eventDetails"));$tribe_events.data("datepicker_format")&&(tribe_ev.state.datepicker_format=$tribe_events.data("datepicker_format"))}$(document).on("keypress",obj.selector.fields,obj.events.trigger_field_change).on("click",obj.selector.save_credentials_button,obj.events.trigger_save_credentials).on("click",obj.selector.clear_filters_button,obj.clear_filters).on("click",obj.selector.finalize_button,obj.finalize_manual_import).on("click",obj.selector.preview_button,obj.preview_import).on("click",obj.selector.cancel_button,obj.events.cancel_edit).on("click",obj.selector.schedule_delete_link,obj.events.verify_schedule_delete).on("click",obj.selector.view_filters,obj.events.toggle_view_filters).on("blur",obj.selector.datepicker,obj.date_helper).on("submit",obj.selector.tab_new,obj.events.suppress_submission).on("change",obj.selector.import_type_field,(function(){obj.reset_preview();var $this=$(this),$frequency=$(this).next(obj.selector.fields),importType=$this.val();$frequency.val("schedule"===importType?"daily":"").trigger("change"),obj.$.form.attr("data-type",importType),obj.maybeLimitUrlStartDate()})).on("change",obj.selector.origin_field,(function(){var $field=$(this),origin=($(this).data("select2"),$field.val());obj.$.form.attr("data-origin",origin),obj.reset_preview(),$(".tribe-bumpdown-active").removeClass("tribe-bumpdown-active"),$(".tribe-bumpdown:visible").hide(),"redirect"===$(this).val()&&(window.open("https://theeventscalendar.com/wordpress-event-aggregator/?utm_source=importoptions&utm_medium=plugin-tec&utm_campaign=in-app","_blank"),location.reload()),""!==origin&&$(obj.selector.post_status).val(ea.default_settings[origin].post_status).trigger("change"),obj.maybeLimitUrlStartDate()})).on("change",obj.selector.eventbrite_url_source,(function(e){$(obj.eventbrite.refineControls).show();var type=obj.eventbrite.detect_type($("#tribe-ea-field-eventbrite_source").val());if(type){var controlsToHide=obj.eventbrite.refineControlsHideMap[type];controlsToHide&&$(controlsToHide).hide()}})).on("change",obj.selector.field_url_source,(function(e){var $field=$(this),value=($(this).data("select2"),$field.val()),origin=null;if(value&&(_.each(ea.source_origin_regexp,(function(regularExpression,key){null!==new RegExp(regularExpression,"g").exec(value)&&(origin=key)})),null!=origin)){var $origin=$(obj.selector.origin_field);if($origin.find('option[value="'+origin+'"]').length){var $type=$("#tribe-ea-field-url_import_type"),typeValue=$type.val(),frequencyValue=null;"schedule"===typeValue&&(frequencyValue=$("#tribe-ea-field-url_import_frequency").val()),$type.val(""),$origin.val(origin).trigger("change"),$("#tribe-ea-field-"+origin+"_import_type").val(typeValue).trigger("change"),"schedule"===typeValue&&$("#tribe-ea-field-"+origin+"_import_frequency").val(frequencyValue).trigger("change"),"eventbrite"===origin&&($("#tribe-ea-field-"+origin+"_source_type_url").trigger("click"),$("#tribe-ea-field-"+origin+"_import_source").val("source_type_url").trigger("change")),$("#tribe-ea-field-"+origin+"_source").val(value).trigger("change")}}})),$(".tribe-dependency").trigger("change"),tribe_timepickers.setup_timepickers($(tribe_timepickers.selector.timepicker)),"edit"===obj.$.action.val()&&(obj.$.form.addClass("edit-form"),$(obj.selector.finalize_button).html(ea.l10n.edit_save)),"object"==typeof tribe_aggregator_save&&$(document).trigger("tribe_aggregator_init_notice")},obj.preview_import=function(event){event.preventDefault();var $form=$(".tribe-ea-form.tribe-validation");if(obj.reset_post_status(),$form.trigger("validation.tribe"),!tribe.validation.hasErrors($form)){obj.reset_polling_counter();$(".tribe-fetch-warning-message").html("");var $post_id=$("#tribe-post_id");$post_id.data("value",$post_id.val()),$post_id.val("");var $import_id=$("#tribe-import_id");$import_id.data("value",$import_id.val()),$import_id.val("");var $preview=$(obj.selector.preview_button),data=($form=$preview.closest("form")).serialize();$post_id.val($post_id.data("value")),$import_id.val($post_id.data("value")),obj.$.preview_container.addClass("tribe-fetching").removeClass("tribe-fetch-error"),obj.$.form.removeClass("show-data"),$preview.prop("disabled",!0);var table=$(".dataTable").data("table");void 0!==table&&table.clear().draw(),"edit"===obj.$.action.val()?obj.preview_save_import(data):obj.create_import(data)}},obj.reset_post_status=function(){var $origin=$(obj.selector.origin_field),origin=0===$origin.length?"":$origin.val();""!==origin&&$(obj.selector.post_status).val(ea.default_settings[origin].post_status).trigger("change")},obj.reset_polling_counter=function(){obj.polling_frequency_index=0,obj.result_fetch_count=0},obj.reset_form=function(){obj.$.fields.val("").trigger("change"),$('[id$="import_frequency"]').val("daily").trigger("change"),obj.$.form.removeClass("show-data")},obj.reset_preview=function(){obj.$.form.removeClass("show-data"),$(".tribe-fetched, .tribe-fetching, .tribe-fetch-error").removeClass("tribe-fetched tribe-fetching tribe-fetch-error")},obj.clear_filters=function(){$(obj.selector.refine_filters).find("input, select").val("").trigger("change")},obj.preview_save_import=function(data){$.ajax({type:"POST",url:ajaxurl+"?action=tribe_aggregator_preview_import",data:data,dataType:"json"}).done(obj.handle_preview_create_results)},obj.create_import=function(data){$.ajax({type:"POST",url:ajaxurl+"?action=tribe_aggregator_create_import",data:data,dataType:"json"}).done(obj.handle_preview_create_results)},obj.handle_preview_create_results=function(response){if(!response.success){var error=response.data;return _.isString(error)||(error=error.message),void obj.display_fetch_error(["
",ea.l10n.preview_fetch_error_prefix,"
"," "+error].join(" "))}if(obj.import_id=response.data.data.import_id,$("#tribe-import_id").val(obj.import_id),void 0!==response.data.data.items)return obj.init_datatable(response.data.data),void obj.$.preview_container.removeClass("tribe-fetching").addClass("tribe-fetched");obj.$.container.find(".spinner-message").html(ea.l10n.preview_polling[0]),setTimeout(obj.poll_for_results,obj.polling_frequencies[obj.polling_frequency_index])},obj.poll_for_results=function(){obj.result_fetch_count++,$.ajax({type:"GET",url:ajaxurl+"?action=tribe_aggregator_fetch_import&import_id="+obj.import_id,dataType:"json"}).done((function(response){if(void 0!==response.data.warning&&response.data.warning){var warning_message=response.data.warning;obj.display_fetch_warning(["
",ea.l10n.preview_fetch_warning_prefix,"
"," "+warning_message].join(" "))}var error_message;if(!response.success)return void 0!==response.data.message?error_message=response.data.message:void 0!==response.data[0].message&&(error_message=response.data[0].message),void obj.display_fetch_error(["
",ea.l10n.preview_fetch_error_prefix,"
"," "+error_message].join(" "));"error"===response.data.status?obj.display_fetch_error(response.data.message):"success"!==response.data.status?(obj.result_fetch_count>obj.max_result_fetch_count&&(obj.polling_frequency_index++,obj.$.container.find(".spinner-message").html(ea.l10n.preview_polling[obj.polling_frequency_index]),obj.result_fetch_count=0),void 0===obj.polling_frequencies[obj.polling_frequency_index]?obj.display_fetch_error(ea.l10n.preview_timeout):setTimeout(obj.poll_for_results,obj.polling_frequencies[obj.polling_frequency_index])):(response.data.data.items=response.data.data.events,obj.init_datatable(response.data.data),obj.$.preview_container.removeClass("tribe-fetching").addClass("tribe-fetched"),$(obj.selector.preview_button).prop("disabled",!1))}))},obj.init_datatable=function(data){var display_checkboxes=!1,is_csv="csv"===(origin=$(obj.selector.origin_field).val()),$import_type=$('[id$="import_type"]:visible'),import_type="manual";if(void 0!==ea.default_settings[origin])for(var settings_key in ea.default_settings[origin]){if(ea.default_settings[origin].hasOwnProperty(settings_key))$("#tribe-ea-field-"+settings_key).val(ea.default_settings[origin][settings_key]).trigger("change")}if($import_type.length&&(import_type=$("#"+$import_type.first().attr("id").replace("s2id_","")).val()),"manual"!==import_type||data.items.length){$import_type.length&&"manual"!==import_type||(display_checkboxes=!0);var $table=obj.$.preview_container.find(".data-container table"),rows=[];for(var i in data.items){var row=data.items[i];row.checkbox=display_checkboxes?'
':"",row.all_day?row.start_time=ea.l10n.all_day:(void 0!==row.start_meridian&&row.start_meridian||(parseInt(row.start_hour,10)>11?row.start_meridian=ea.l10n.pm:row.start_meridian=ea.l10n.am),row.start_hour>12&&(row.start_hour=row.start_hour-12),row.start_time=(0===parseInt(row.start_hour,10)?12:row.start_hour)+":"+("00"+row.start_minute).slice(-2),row.start_time+=" "+row.start_meridian),rows.push(row)}display_checkboxes&&!is_csv?$table.addClass("display-checkboxes"):$table.removeClass("display-checkboxes"),obj.$.form.addClass("show-data");var text,args={lengthMenu:[[5,10,25,50,-1],[5,10,25,50,tribe_l10n_datatables.pagination.all]],order:[[1,"asc"]],columnDefs:[{cellType:"th",className:"check-column",orderable:!1,targets:0}],data:rows};if(void 0!==data.columns){args.columns=[{data:"checkbox"}];var $head=$table.find("thead tr"),$foot=$table.find("tfoot tr"),$map_row=$({}),column_map="",content_type="";if($head.find("th:first").nextAll().remove(),$foot.find("th:first").nextAll().remove(),is_csv){var $data_container=$table.closest(".data-container");$table.closest(".data-container").addClass("csv-data"),$data_container.find(".tribe-preview-message .tribe-csv-filename").html($("#tribe-ea-field-csv_file_name").text()),$head.closest("thead").prepend('
'),$map_row=$(".tribe-column-map"),content_type=(content_type=$("#tribe-ea-field-csv_content_type").val()).replace("tribe_",""),column_map=$("#tribe-csv-column-map-"+content_type).html()}var column=0;for(i in data.columns){if(args.columns.push({data:data.columns[i]}),$head.append('
'+data.columns[i]+"
"),$foot.append('
'+data.columns[i]+"
"),is_csv){var column_slug=data.columns[i].toLowerCase().replace(/^\s+|\s+$/g,"").replace(/\s/g,"_").replace(/[^a-z0-9_]/g,"");$map_row.append('
'+column_map.replace('name="column_map[]"','name="aggregator[column_map]['+column+']" id="column-'+column+'"')+"
");var $map_select=$map_row.find("#column-"+column);void 0!==ea.csv_column_mapping[content_type][column]&&(column_slug=ea.csv_column_mapping[content_type][column]),$map_select.find('option[value="'+column_slug+'"]').prop("selected",!0)}column++}args.scrollX=!0}else args.columns=[{data:"checkbox"},{data:"start_date"},{data:"start_time"},{data:"end_date"},{data:"title"}],args.autoWidth=!1;$table.tribeDataTable(args),obj.wrap_cell_content(),$table.on("select.dt",obj.events.twiddle_finalize_button_text).on("deselect.dt",obj.events.twiddle_finalize_button_text).on("draw.dt",obj.wrap_cell_content),"new"===obj.$.action.val()&&(text="manual"===import_type&&is_csv?ea.l10n.import_all_no_number:"manual"===import_type?ea.l10n.import_all.replace("%d",rows.length):ea.l10n.create_schedule),$(obj.selector.finalize_button).html(text)}else{var origin=data.origin,message=void 0!==ea.l10n[origin]&&void 0!==ea.l10n[origin].no_results?ea.l10n[origin].no_results:ea.l10n.no_results;obj.display_fetch_error(message)}},obj.wrap_cell_content=function(){$(".dataTable").find("tbody td").each((function(){var $cell=$(this);$cell.html('
'+$cell.html()+"
")}))},obj.display_fetch_error=function(message){var $message_container=$(".tribe-fetch-error-message");obj.$.preview_container.removeClass("tribe-fetching").addClass("tribe-fetch-error"),$message_container.html(""),obj.display_error($message_container,message),$(obj.selector.preview_button).prop("disabled",!1)},obj.display_fetch_warning=function(message){var $message_container=$(".tribe-fetch-warning-message");obj.$.preview_container.removeClass("tribe-fetching").addClass("tribe-fetch-warning"),$message_container.html(""),obj.display_warning($message_container,message)},obj.display_error=function($container,message){$container.prepend(['
',"
",message,"
","
"].join(""))},obj.display_warning=function($container,message){$container.prepend(['
',"
",message,"
","
"].join(""))},obj.display_success=function($container,message){$container.prepend(['
',"
",message,"
","
"].join(""))},obj.save_credentials=function($credentials_form){var data=$credentials_form.find(".tribe-fieldset").find("input").serialize(),url=ajaxurl+"?action=tribe_aggregator_save_credentials";$.post(url,data).done((function(response){response.success&&($credentials_form.addClass("credentials-entered"),$credentials_form.find('[name="has-credentials"]').val(1).trigger("change"))}))},obj.finalize_manual_import=function(){var origin=$("#tribe-ea-field-origin").val(),$table=$(".dataTable"),table=window.tribe_data_table;if($table.hasClass("display-checkboxes")){var row_selection=table.rows({selected:!0});if(row_selection[0].length||(row_selection=table.rows()),!row_selection[0].length)return void obj.display_error($(".tribe-finalize-container"),ea.l10n.events_required_for_manual_submit);var data=row_selection.data(),items=[],unique_id_field=null;if("meetup"===origin?unique_id_field="meetup_id":"eventbrite"===origin?unique_id_field="eventbrite_id":"ical"===origin||"ics"===origin||"gcal"===origin?unique_id_field="uid":"url"===origin&&(unique_id_field="id"),null!==unique_id_field){for(var i in data)isNaN(i)||void 0!==data[i][unique_id_field]&&items.push(data[i][unique_id_field]);$("#tribe-selected-rows").text(JSON.stringify(items))}else $("#tribe-selected-rows").text("all")}else $("#tribe-selected-rows").text("all");$(".dataTables_scrollBody").find('[name^="aggregator[column_map]"]').remove(),obj.$.form.trigger("submit")},obj.search_id=function(e){var id=null;return void 0!==e.id?id=e.id:void 0!==e.ID?id=e.ID:void 0!==e.value&&(id=e.value),null==e?null:id},obj.construct.dropdown=function($fields){var upsellFormatter=function(option){var $option=$(option.element);return"string"==typeof $option.data("subtitle")&&(option.text=option.text+'
'+$option.data("subtitle")+"
"),option.text},args={formatResult:upsellFormatter,formatSelection:upsellFormatter};return tribe_dropdowns.dropdown($fields.filter(".tribe-ea-dropdown"),args),$fields},obj.construct.media_button=function($fields){var $elements=$fields.filter(obj.selector.media_button);return"undefined"!=typeof wp&&wp.media&&wp.media.editor?($elements.each((function(){var $button=$(this),input=$button.data("input"),$field=$("#"+input),$name=$("#"+input+"_name"),media=obj.media[input]=wp.media({title:$button.data("mediaTitle"),library:{type:$button.data("mimeType")},multiple:!1});media.on("select",(function(){var selection=media.state().get("selection");selection&&selection.each((function(attachment){$field.data({id:attachment.attributes.id,text:attachment.attributes.title}),$field.val(attachment.attributes.id),$field.trigger("change"),$name.html(attachment.attributes.filename),$name.attr("title",attachment.attributes.filename)}))}))})),obj.$.container.on("click",obj.selector.media_button,(function(e){if(e.preventDefault(),$(this).is(":visible")){var input=$(this).data("input");return obj.media[input].open(input),!1}})),$elements):$elements},obj.events.trigger_field_change=function(){$(this).trigger("change")},obj.events.trigger_save_credentials=function(){obj.save_credentials($(this).closest(".enter-credentials"))},obj.events.suppress_submission=function(e){$("#tribe-ea-field-origin").val();if($("#tribe-selected-rows").val().length)return!0;e.preventDefault()},obj.events.twiddle_finalize_button_text=function(e,dt){if("new"===obj.$.action.val()){var selected_rows=dt.rows({selected:!0})[0].length,text=ea.l10n.import_checked;selected_rows||(text=ea.l10n.import_all,selected_rows=dt.rows()[0].length),text=text.replace("%d",selected_rows),$(obj.selector.finalize_button).html(text)}},obj.events.cancel_edit=function(e){e.preventDefault();var url=window.location.href;url=(url=url.replace("tab=edit","tab=scheduled")).replace(/id=\d+/,""),window.location.href=url},obj.events.verify_schedule_delete=function(){return confirm(ea.l10n.verify_schedule_delete)},obj.events.toggle_view_filters=function(e){e.preventDefault();var $el=$(this);$el.toggleClass("tribe-active"),$el.is(".tribe-active")?$el.html(ea.l10n.hide_filters):$el.html(ea.l10n.view_filters)},obj.date_helper=function(){var $picker;if(($picker=$(this)).hasClass("tribe-datepicker")){var selected_date=$picker.val();if(""!==selected_date&&null!==selected_date){var origin=$picker.attr("id").match("tribe-ea-field-(.*)_start")[1];""!==origin&&null!==origin&&jQuery("#tribe-date-helper-date-"+origin).html(selected_date)}}},obj.maybeLimitUrlStartDate=function(){"url"===obj.origin.val()&&("schedule"!==obj.importType.val()?obj.urlImport.startDate.data("datepicker-min-date",null):obj.urlImport.startDate.data("datepicker-min-date","today"))},$(obj.init)}(jQuery,_,tribe_aggregator.fields,tribe_aggregator);