1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
|
timely.define(["jquery_timely","domReady","scripts/calendar_feeds/ics/ics_event_handlers","libs/select2_multiselect_helper","libs/tags_select","libs/utils","ai1ec_config","libs/gmaps","external_libs/jquery_cookie","external_libs/bootstrap/tab","external_libs/bootstrap/alert","external_libs/bootstrap/modal","external_libs/bootstrap/button","external_libs/bootstrap/collapse","scripts/add_new_event/event_location/input_coordinates_utility_functions","external_libs/jquery.autocomplete_geomod","external_libs/geo_autocomplete"],function(e,t,n,r,i,s,o,u){var a=function(){var t=e(this.hash);r.refresh(t),i.refresh(t)},f=function(t){var n=e(this).attr("href");e.cookie("feeds_active_tab",n),"#suggested"===n&&g()},l=function(){var t=e("#ai1ec-feeds-after"),s=e(".ai1ec_submit_wrapper"),l=e(".ai1ec_file_upload_tags_categories");r.init(t),i.init(t),r.init(s),i.init(s),r.init(l),i.init(l),e("ul.ai1ec-nav a").on("click",f),e("ul.ai1ec-nav a").on("shown",a),e('select[name="cron_freq"]').on("change",function(){e.ajax({url:ajaxurl,type:"POST",data:{action:"ai1ec_feeds_page_post",cron_freq:this.value}})}),e("#ai1ec-ics-modal").on("click",".remove, .keep",n.submit_delete_modal),e(document).on("click","#ai1ec_add_new_ics",n.add_new_feed).on("click",".ai1ec_delete_ics",n.open_delete_modal).on("click",".ai1ec_update_ics",n.update_feed).on("click",".ai1ec_edit_ics",n.edit_feed).on("click","#ai1ec_cancel_ics",n.edit_cancel).on("click",".ai1ec-panel-heading > a",n.edit_cancel).on("click",'.ai1ec-feed-container .ai1ec-panel-heading a, .ai1ec-nav-tabs a[href="#import"]',n.edit_cancel),e(document).on("click",".ai1ec-suggested-import-event",function(){var t=e(this),n=t.closest(".ai1ec-suggested-event-import"),r=e.parseJSON(t.closest(".ai1ec-infowindow, tr").attr("data-event"));return e("a.ai1ec-suggested-processing",n).removeClass("ai1ec-hidden"),t.addClass("ai1ec-hidden"),e.ajax({url:o.ajax_url,type:"POST",data:{action:"ai1ec_import_suggested_event",ai1ec_feed_url:r.url,ai1ec_feed_id:r.feed_id,ai1ec_event_id:r.id},success:function(t){e("a.ai1ec-suggested-processing",n).addClass("ai1ec-hidden"),t.error?(e("a.ai1ec-suggested-import-event",n).removeClass("ai1ec-hidden"),e("#ai1ec-discovery-status").addClass("ai1ec-error").text(o.discovery_event_error).hide().fadeIn()):(e("a.ai1ec-suggested-remove-event",n).removeClass("ai1ec-hidden"),e("#ai1ec-discovery-status").removeClass("ai1ec-error").text(o.discovery_event_success).hide().fadeIn())},error:function(){e("a.ai1ec-suggested-processing",n).addClass("ai1ec-hidden"),e("a.ai1ec-suggested-import-event",n).removeClass("ai1ec-hidden"),e("#ai1ec-discovery-status").addClass("ai1ec-error").text(o.discovery_event_error).hide().fadeIn()}}),!1}),e(document).on("click",".ai1ec-suggested-remove-event",function(){var t=e(this),n=t.closest(".ai1ec-suggested-event-import, .ai1ec-myfeeds-event"),r=t.closest(".ai1ec-infowindow, tr"),i=t.closest(".ai1ec-myfeeds-event"),s=r.length?e.parseJSON(r.attr("data-event")):null,u=s?s.id:i.attr("data-event-id"),a=s?s.feed_id:i.attr("data-feed-id");return e("a.ai1ec-suggested-removing",n).removeClass("ai1ec-hidden"),t.addClass("ai1ec-hidden"),i.addClass("ai1ec-myfeeds-removing"),e.ajax({url:o.ajax_url,type:"POST",data:{action:"ai1ec_remove_suggested_event",ai1ec_event_id:u,ai1ec_feed_id:a,ai1ec_delete:!0},success:function(t){e("a.ai1ec-suggested-removing",n).addClass("ai1ec-hidden"),e("a.ai1ec-suggested-import-event",n).removeClass("ai1ec-hidden"),i.length&&!i.closest(".ai1ec-feed-category").find(".ai1ec-myfeeds-event").not(".ai1ec-myfeeds-removing").length&&i.closest(".ai1ec-feed-container").remove(),i.remove()},error:function(){e("a.ai1ec-suggested-removing",n).addClass("ai1ec-hidden"),e("a.ai1ec-suggested-remove-event",n).removeClass("ai1ec-hidden")}}),!1}),e(document).on("click",".ai1ec-suggested-view-selector > a",function(){var t=e(this),n=t.parent(),r=t.attr("data-ai1ec-view");return e("#suggested").removeClass(function(e,t){return(t.match(/(^|\s)ai1ec-feeds-\S+/g)||[]).join(" ")}).addClass("ai1ec-feeds-"+r),n.find("a.ai1ec-active").removeClass("ai1ec-active"),t.addClass("ai1ec
|